aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hyperv/hyperv_net.h
Commit message (Collapse)AuthorAgeFilesLines
...
* | netvsc: implement NAPIstephen hemminger2017-03-071-0/+2
|/ | | | | | | | Use NAPI (softirq), to handle receive packets and send completions. Previously this was handled by tasklet. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* netvsc: report per-channel stats in ethtool statisticsSimon Xiao2017-01-241-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Report packets and bytes transferred through a vmbus channel via ethtool. This supersedes need for per-cpu statistics. Example: $ ethtool -S eth0 NIC statistics: ... tx_queue_0_packets: 3523179 tx_queue_0_bytes: 505370920 rx_queue_0_packets: 41430490 rx_queue_0_bytes: 62714661254 tx_queue_1_packets: 0 tx_queue_1_bytes: 0 rx_queue_1_packets: 0 rx_queue_1_bytes: 0 ... Reviewed-by: Long Li <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: Simon Xiao <[email protected]> Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* netvsc: account for packets/bytes transmitted after completionstephen hemminger2017-01-241-1/+3
| | | | | | | | | | | Most drivers do not increment transmit statistics until after the transmit is completed. This will also be necessary for BQL support. Slight additional complexity because the netvsc driver aggregates multiple packets into one transmit. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* netvsc: eliminate per-device outstanding send counterstephen hemminger2017-01-241-1/+0
| | | | | | | | Since now keep track of per-queue outstanding sends, we can avoid one atomic update by removing no longer needed per-device atomic. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* netvsc: simplify rndis_filter_removestephen hemminger2017-01-241-1/+2
| | | | | | | All caller's already have pointer to netvsc_device so pass it. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* netvsc: don't pass void * to internal device_addstephen hemminger2017-01-241-2/+3
| | | | | | | | All the caller's/callee's know that the format of the device_add parameter is a netvsc_device_info struct. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* netvsc: optimize receive pathstephen hemminger2017-01-241-10/+11
| | | | | | | | | | | | | | Do manual optimizations of receive path: - remove checks for impossible conditions (but keep checks for bad data from host) - pass argument down, rather than having callee recompute what is already known - remove indirection about receive buffer datalength - remove dependence on VLAN_TAG_PRESENCE - use _hot/_cold and likely/unlikely Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* netvsc: group all per-channel state togetherstephen hemminger2017-01-241-4/+10
| | | | | | | Put all the per-channel state together in one data struct. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* netvsc: allow get/set of RSS indirection tablestephen hemminger2017-01-241-0/+1
| | | | | | | | Allow setting receive indirection table. Also uses the system standard for initialization. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* netvsc: allow more flexible setting of number of channelsstephen hemminger2017-01-241-0/+1
| | | | | | | | | This allows for number of channels to be managed in a manner similar to existing hardware drivers. It also removes the restriction of maximum 8 channels and allows as many as the host will allow. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* netvsc: add ethtool ops to get/set RSS keystephen hemminger2017-01-241-1/+6
| | | | | | | | For some cases it is useful to be able to change RSS key value. For example, replacing RSS key with a symmetric hash. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* netvsc: negotiate checksum and segmentation parametersstephen hemminger2017-01-241-11/+138
| | | | | | | | | | | | | | | | Redo how Hyper-V network driver negotiates offload features. Query the host to determine offload settings, and use the result. Also: * disable IPv4 header checksum offload (not used by Linux) * enable TSO only if host supports * enable UDP checksum offload if supported * don't advertise support for checksumming of non-IP protocols * adjust GSO maximum segment size * enable HIGHDMA Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* netvsc: remove no longer needed receive staging buffersstephen hemminger2017-01-241-5/+0
| | | | | | | | | | | | The ring buffer mapping now handles the wraparound case inside get_next_pkt_raw. Therefore it is not necessary to have an additional special receive staging buffer. See commit 1562edaed8c164ca5199 ("Drivers: hv: ring_buffer: count on wrap around mappings") Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* net: use core MTU range checking in virt driversJarod Wilson2016-10-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hyperv_net: - set min/max_mtu, per Haiyang, after rndis_filter_device_add virtio_net: - set min/max_mtu - remove virtnet_change_mtu vmxnet3: - set min/max_mtu xen-netback: - min_mtu = 0, max_mtu = 65517 xen-netfront: - min_mtu = 0, max_mtu = 65535 unisys/visor: - clean up defines a little to not clash with network core or add redundat definitions CC: [email protected] CC: [email protected] CC: "K. Y. Srinivasan" <[email protected]> CC: Haiyang Zhang <[email protected]> CC: "Michael S. Tsirkin" <[email protected]> CC: Shrikrishna Khare <[email protected]> CC: "VMware, Inc." <[email protected]> CC: Wei Liu <[email protected]> CC: Paul Durrant <[email protected]> CC: David Kershner <[email protected]> Signed-off-by: Jarod Wilson <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: fix commentsStephen Hemminger2016-09-241-4/+3
| | | | | | | Typo's and spelling errors. Also remove old comment from staging era. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: count multicast packets receivedStephen Hemminger2016-09-231-0/+2
| | | | | | | | Useful for debugging issues with multicast and SR-IOV to keep track of number of received multicast packets. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: remove VF in flight countersStephen Hemminger2016-09-231-2/+1
| | | | | | | | Since VF reference is now protected by RCU, no longer need the VF usage counter and can use device flags to see whether to inject or not. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: use RCU to protect vf_netdevStephen Hemminger2016-09-231-1/+1
| | | | | | | | The vf_netdev pointer in the netvsc device context can simply be protected by RCU because network device destruction is already RCU synchronized. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: add ethtool statistics for tx packet issuesStephen Hemminger2016-08-231-0/+9
| | | | | | | | | Printing console messages is not helpful when system is out of memory; and can be disastrous with netconsole. Instead keep statistics of these anomalous conditions. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: make device_remove voidStephen Hemminger2016-08-231-1/+1
| | | | | | | Always returns 0 and no callers check. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: make RSS hash key staticStephen Hemminger2016-08-231-2/+0
| | | | | Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Implement batching of receive completionsHaiyang Zhang2016-08-201-0/+17
| | | | | | | | | | | | The existing code uses busy retry when unable to send out receive completions due to full ring buffer. It also gives up retrying after limit is reached, and causes receive buffer slots not being recycled. This patch implements batching of receive completions. It also prevents dropping receive completions due to full ring buffer. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2016-08-181-15/+9
|\ | | | | | | | | | | | | | | | | Minor overlapping changes for both merge conflicts. Resolution work done by Stephen Rothwell was used as a reference. Signed-off-by: David S. Miller <[email protected]>
| * hv_netvsc: avoid deadlocks between rtnl lock and vf_use_cnt waitVitaly Kuznetsov2016-08-151-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here is a deadlock scenario: - netvsc_vf_up() schedules netvsc_notify_peers() work and quits. - netvsc_vf_down() runs before netvsc_notify_peers() gets executed. As it is being executed from netdev notifier chain we hold rtnl lock when we get here. - we enter while (atomic_read(&net_device_ctx->vf_use_cnt) != 0) loop and wait till netvsc_notify_peers() drops vf_use_cnt. - netvsc_notify_peers() starts on some other CPU but netdev_notify_peers() will hang on rtnl_lock(). - deadlock! Instead of introducing additional synchronization I suggest we drop gwrk.dwrk completely and call NETDEV_NOTIFY_PEERS directly. As we're acting under rtnl lock this is legitimate. Signed-off-by: Vitaly Kuznetsov <[email protected]> Acked-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
| * hv_netvsc: don't lose VF informationVitaly Kuznetsov2016-08-151-9/+10
| | | | | | | | | | | | | | | | | | | | | | struct netvsc_device is not suitable for storing VF information as this structure is being destroyed on MTU change / set channel operation (see rndis_filter_device_remove()). Move all VF related stuff to struct net_device_context which is persistent. Signed-off-by: Vitaly Kuznetsov <[email protected]> Acked-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* | hv_netvsc: Add handler for physical link speed changeHaiyang Zhang2016-08-081-0/+1
|/ | | | | | | | | | On Hyper-V host 2016 and later, VMs gets an event message of the physical link speed when vSwitch is changed. This patch handles this message, so the updated link speed can be reported by ethtool. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: pass struct net_device to rndis_filter_set_device_mac()Vitaly Kuznetsov2016-06-061-1/+1
| | | | | | | | | We unpack 'struct net_device' in netvsc_set_mac_addr() to get to 'struct hv_device' pointer which we use in rndis_filter_set_device_mac() to get back to 'struct net_device'. Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: pass struct netvsc_device to rndis_filter_{open, close}()Vitaly Kuznetsov2016-06-061-2/+3
| | | | | | | | | | Both rndis_filter_open()/rndis_filter_close() use struct hv_device to reach to struct netvsc_device only and all callers have it already. While on it, rename net_device to nvdev in rndis_filter_open() as net_device is misleading. Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: introduce {net, hv}_device_to_netvsc_device() helpersVitaly Kuznetsov2016-06-061-0/+12
| | | | | | | | Make it easier to get 'struct netvsc_device' from 'struct net_device' and 'struct hv_device' by introducing inline helpers. Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: get rid of struct net_device pointer in struct netvsc_deviceVitaly Kuznetsov2016-05-161-4/+1
| | | | | | | | | Simplify netvsvc pointer graph by getting rid of the redundant ndev pointer. We can always get a pointer to struct net_device from somewhere else. Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: untangle the pointer messVitaly Kuznetsov2016-05-161-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have the following structures keeping netvsc adapter state: - struct net_device - struct net_device_context - struct netvsc_device - struct rndis_device - struct hv_device and there are pointers/dependencies between them: - struct net_device_context is contained in struct net_device - struct hv_device has driver_data pointer which points to 'struct net_device' OR 'struct netvsc_device' depending on driver's state (!). - struct net_device_context has a pointer to 'struct hv_device'. - struct netvsc_device has pointers to 'struct hv_device' and 'struct net_device_context'. - struct rndis_device has a pointer to 'struct netvsc_device'. Different functions get different structures as parameters and use these pointers for traveling. The problem is (in addition to keeping in mind this complex graph) that some of these structures (struct netvsc_device and struct rndis_device) are being removed and re-created on mtu change (as we implement it as re-creation of hyper-v device) so our travel using these pointers is dangerous. Simplify this to a the following: - add struct netvsc_device pointer to struct net_device_context (which is a part of struct net_device and thus never disappears) - remove struct hv_device and struct net_device_context pointers from struct netvsc_device - replace pointer to 'struct netvsc_device' with pointer to 'struct net_device'. - always keep 'struct net_device' in hv_device driver_data. We'll end up with the following 'circular' structure: net_device: [net_device_context] -> netvsc_device -> rndis_device -> net_device -> hv_device -> net_device On MTU change we'll be removing the 'netvsc_device -> rndis_device' branch and re-creating it making the synchronization easier. There is one additional redundant pointer left, it is struct net_device link in struct netvsc_device, it is going to be removed in a separate commit. Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: move start_remove flag to net_device_contextVitaly Kuznetsov2016-05-161-1/+3
| | | | | | | | | struct netvsc_device is destroyed on mtu change so keeping the protection flag there is not a good idea. Move it to struct net_device_context which is preserved. Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Implement support for VF drivers on Hyper-VKY Srinivasan2016-04-181-0/+14
| | | | | | | | | | | | | | | | | | Support VF drivers on Hyper-V. On Hyper-V, each VF instance presented to the guest has an associated synthetic interface that shares the MAC address with the VF instance. Typically these are bonded together to support live migration. By default, the host delivers all the incoming packets on the synthetic interface. Once the VF is up, we need to explicitly switch the data path on the host to divert traffic onto the VF interface. Even after switching the data path, broadcast and multicast packets are always delivered on the synthetic interface and these will have to be injected back onto the VF interface (if VF is up). This patch implements the necessary support in netvsc to support Linux VF drivers. Signed-off-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Fix the array sizes to be max supported channelsHaiyang Zhang2016-03-231-3/+4
| | | | | | | | | | | The VRSS_CHANNEL_MAX is the max number of channels supported by Hyper-V hosts. We use it for the related array sizes instead of using NR_CPUS, which may be set to several thousands. This patch reduces possible memory allocation failures. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: add ethtool support for set and get of settings[email protected]2016-02-291-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | This patch allows the user to set and retrieve speed and duplex of the hv_netvsc device via ethtool. Example: $ ethtool eth0 Settings for eth0: ... Speed: Unknown! Duplex: Unknown! (255) ... $ ethtool -s eth0 speed 1000 duplex full $ ethtool eth0 Settings for eth0: ... Speed: 1000Mb/s Duplex: Full ... This is based on patches by Roopa Prabhu and Nikolay Aleksandrov. Signed-off-by: Simon Xiao <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Fix book keeping of skb during batching processHaiyang Zhang2016-01-251-0/+1
| | | | | | | | | | | | Since eliminating send_completion_tid from struct hv_netvsc_packet, we haven't add proper book keeping for the skb of the batched packet. This patch fixes this issue and allows the previous skb is properly freed. Otherwise, a panic may happen. Thanks to Simon Xiao <[email protected]> for bisecting and analysis. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Eliminate vlan_tci from struct hv_netvsc_packetKY Srinivasan2015-12-031-2/+2
| | | | | | | Eliminate vlan_tci from struct hv_netvsc_packet. Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Eliminate status from struct hv_netvsc_packetKY Srinivasan2015-12-031-1/+0
| | | | | | | Eliminate status from struct hv_netvsc_packet. Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Eliminate xmit_more from struct hv_netvsc_packetKY Srinivasan2015-12-031-1/+0
| | | | | | | Eliminate xmit_more from struct hv_netvsc_packet. Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Eliminate completion_func from struct hv_netvsc_packetKY Srinivasan2015-12-031-1/+0
| | | | | | | Eliminate completion_func from struct hv_netvsc_packet. Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Eliminate is_data_pkt from struct hv_netvsc_packetKY Srinivasan2015-12-031-1/+0
| | | | | | | Eliminate is_data_pkt from struct hv_netvsc_packet. Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Eliminate send_completion_tid from struct hv_netvsc_packetKY Srinivasan2015-12-031-6/+2
| | | | | | | Eliminate send_completion_tid from struct hv_netvsc_packet. Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Eliminate page_buf from struct hv_netvsc_packetKY Srinivasan2015-12-031-2/+2
| | | | | | | | Eliminate page_buf from struct hv_netvsc_packet. Signed-off-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: remove locking in netvsc_send()Vitaly Kuznetsov2015-12-031-1/+0
| | | | | | | | | Packet scheduler guarantees there won't be multiple senders for the same queue and as we use q_idx for multi_send_data the spinlock is redundant. Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: move subchannel existence check to netvsc_select_queue()Vitaly Kuznetsov2015-12-031-15/+0
| | | | | | Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Don't ask for additional head room in the skbKY Srinivasan2015-12-031-0/+3
| | | | | | | | | | | | The rndis header is 116 bytes big and can be placed in the default head room that will be available in the skb. Since the netvsc packet is less than 48 bytes, we can use the skb control buffer for the netvsc packet. With these changes we don't need to ask for additional head room. Signed-off-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Eliminate send_completion_ctx from struct hv_netvsc_packetKY Srinivasan2015-12-031-1/+0
| | | | | | | | Eliminate send_completion_ctx from struct hv_netvsc_packet. Signed-off-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Eliminate send_completion from struct hv_netvsc_packetKY Srinivasan2015-12-031-2/+1
| | | | | | | | Eliminate send_completion from struct hv_netvsc_packet. Signed-off-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Eliminatte the data field from struct hv_netvsc_packetKY Srinivasan2015-12-031-3/+2
| | | | | | | | Eliminatte the data field from struct hv_netvsc_packet. Signed-off-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
* hv_netvsc: Eliminate rndis_msg pointer from hv_netvsc_packet structureKY Srinivasan2015-12-031-5/+3
| | | | | | | | Eliminate rndis_msg pointer from hv_netvsc_packet structure. Signed-off-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>