summaryrefslogtreecommitdiffstats
path: root/drivers/net/hyperv
Commit message (Collapse)AuthorAgeFilesLines
* netvsc: reduce maximum GSO sizestephen hemminger2016-12-071-0/+5
| | | | | | | | | | | | | Hyper-V (and Azure) support using NVGRE which requires some extra space for encapsulation headers. Because of this the largest allowed TSO packet is reduced. For older releases, hard code a fixed reduced value. For next release, there is a better solution which uses result of host offload negotiation. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Revert "hv_netvsc: report vmbus name in ethtool"Stephen Hemminger2016-10-291-4/+0
| | | | | | | | | | | | This reverts commit e3f74b841d48 ("hv_netvsc: report vmbus name in ethtool")' because of problem introduced by commit f9a56e5d6a0ba ("Drivers: hv: make VMBus bus ids persistent"). This changed the format of the vmbus name and this new format is too long to fit in the bus_info field of ethtool. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* netvsc: fix incorrect receive checksum offloadingStephen Hemminger2016-10-261-8/+11
| | | | | | | | | | | | | | | | | The Hyper-V netvsc driver was looking at the incorrect status bits in the checksum info. It was setting the receive checksum unnecessary flag based on the IP header checksum being correct. The checksum flag is skb is about TCP and UDP checksum status. Because of this bug, any packet received with bad TCP checksum would be passed up the stack and to the application causing data corruption. The problem is reproducible via netcat and netem. This had a side effect of not doing receive checksum offload on IPv6. The driver was also also always doing checksum offload independent of the checksum setting done via ethtool. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net/hyperv: avoid uninitialized variableArnd Bergmann2016-10-181-1/+1
| | | | | | | | | | | | | | | | | | | The hdr_offset variable is only if we deal with a TCP or UDP packet, but as the check surrounding its usage tests for skb_is_gso() instead, the compiler has no idea if the variable is initialized or not at that point: drivers/net/hyperv/netvsc_drv.c: In function ‘netvsc_start_xmit’: drivers/net/hyperv/netvsc_drv.c:494:42: error: ‘hdr_offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized] This adds an additional check for the transport type, which tells the compiler that this path cannot happen. Since the get_net_transport_info() function should always be inlined here, I don't expect this to result in additional runtime checks. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
* netvsc: Remove mistaken udp.h inclusion.David S. Miller2016-10-131-1/+0
| | | | | | Based upon v2 of Stephen's patch. Signed-off-by: David S. Miller <davem@davemloft.net>
* netvsc: fix checksum on UDP IPV6stephen hemminger2016-10-131-50/+22
| | | | | | | | | | | | | | | | The software calculation of UDP checksum in Netvsc driver was only handling IPv4 case. By using skb_checksum_help() instead all protocols can be handled. Rearrange code to eliminate goto and look like other drivers. This is a temporary solution; recent versions of Window Server etc do support UDP checksum offload, just need to do the appropriate negotiation with host to validate before using. This will be done in later patch. Please queue this for -stable as well. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* 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 <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: count multicast packets receivedStephen Hemminger2016-09-232-1/+10
| | | | | | | | Useful for debugging issues with multicast and SR-IOV to keep track of number of received multicast packets. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: remove VF in flight countersStephen Hemminger2016-09-232-63/+21
| | | | | | | | 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 <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: use RCU to protect vf_netdevStephen Hemminger2016-09-232-15/+16
| | | | | | | | 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 <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: improve VF device matchingStephen Hemminger2016-09-231-21/+39
| | | | | | | | | | | | | The code to associate netvsc and VF devices can be made less error prone by using a better matching algorithms. On registration, use the permanent address which avoids any possible issues caused by device MAC address being changed. For all other callbacks, search by the netdevice pointer value to ensure getting the correct network device. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: simplify callback event codeStephen Hemminger2016-09-231-18/+10
| | | | | | | | | The callback handler for netlink events can be simplified: * Consolidate check for netlink callback events about this driver itself. * Ignore non-Ethernet devices. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: dev hold/put reference to VFStephen Hemminger2016-09-231-0/+3
| | | | | | | | | | The netvsc driver holds a pointer to the virtual function network device if managing SR-IOV association. In order to ensure that the VF network device does not disappear, it should be using dev_hold/dev_put to get a reference count. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: use consume_skbStephen Hemminger2016-09-231-2/+2
| | | | | | | | Packets that are transmitted in normal path should use consume_skb instead of kfree_skb. This allows for better tracing of packet drops. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Revert "hv_netvsc: make inline functions static"Stephen Hemminger2016-09-101-84/+1
| | | | | | | | | These functions are used by other code misc-next tree. This reverts commit 30d1de08c87ddde6f73936c3350e7e153988fe02. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: add ethtool statistics for tx packet issuesStephen Hemminger2016-08-232-16/+79
| | | | | | | | | 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 <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: report vmbus name in ethtoolStephen Hemminger2016-08-231-0/+4
| | | | | | | Make netvsc on vmbus behave more like PCI. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: make variable localStephen Hemminger2016-08-231-3/+3
| | | | | | | The variable m_ret is only used in one basic block. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: make netvsc_destroy_buf voidStephen Hemminger2016-08-231-8/+6
| | | | | | | No caller checks the return value. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: refactor completion functionStephen Hemminger2016-08-231-47/+56
| | | | | | | Break the different cases, code is cleaner if broken up Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: rearrange start_xmitStephen Hemminger2016-08-231-55/+51
| | | | | | | | Rearrange the transmit routine to eliminate goto's and unnecessary boolean variables. Use standard functions to test for vlan tag. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: init completion during allocStephen Hemminger2016-08-231-3/+1
| | | | | | | Move initialization to allocate where other fields are initialized. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: make device_remove voidStephen Hemminger2016-08-232-3/+2
| | | | | | | Always returns 0 and no callers check. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: use ARRAY_SIZE() for NDIS versionsStephen Hemminger2016-08-231-3/+4
| | | | | | | Don't hard code size of array of NDIS versions. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: make inline functions staticStephen Hemminger2016-08-231-1/+84
| | | | | | | | Several new functions were introduced into hyperv.h but only used in one file. Move them and let compiler decide on inline. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: style cleanupsStephen Hemminger2016-08-233-30/+3
| | | | | | | | Fix most of the complaints about the style of the code. Things like extra blank lines and return statements. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: use kcallocStephen Hemminger2016-08-231-2/+2
| | | | | | | Better to use kcalloc rather than kzalloc and multiply for an array. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: make RSS hash key staticStephen Hemminger2016-08-232-3/+2
| | | | | Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: fix rtnl locking in callbackStephen Hemminger2016-08-231-4/+1
| | | | | | | | | | | | The function get_netvsc_net_device had conditional locking. This was unnecessary, incorrect, but harmless. It was unnecessary since the code is only called from netlink netdev event callback where RTNL is always acquired before the callbacks are run. It was incorrect because of use of trylock and then continuing. Fix by replacing with proper assertion. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: Implement batching of receive completionsHaiyang Zhang2016-08-193-33/+160
| | | | | | | | | | | | 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 <haiyangz@microsoft.com> Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2016-08-183-82/+66
|\ | | | | | | | | | | | | | | | | Minor overlapping changes for both merge conflicts. Resolution work done by Stephen Rothwell was used as a reference. Signed-off-by: David S. Miller <davem@davemloft.net>
| * hv_netvsc: fix bonding devices check in netvsc_netdev_event()Vitaly Kuznetsov2016-08-151-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bonding driver sets IFF_BONDING on both master (the bonding device) and slave (the real NIC) devices and in netvsc_netdev_event() we want to skip master devices only. Currently, there is an uncertainty when a slave interface is removed: if bonding module comes first in netdev_chain it clears IFF_BONDING flag on the netdev and netvsc_netdev_event() correctly handles NETDEV_UNREGISTER event, but in case netvsc comes first on the chain it sees the device with IFF_BONDING still attached and skips it. As we still hold vf_netdev pointer to the device we crash on the next inject. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Acked-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * hv_netvsc: protect module refcount by checking net_device_ctx->vf_netdevVitaly Kuznetsov2016-08-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | We're not guaranteed to see NETDEV_REGISTER/NETDEV_UNREGISTER notifications only once per VF but we increase/decrease module refcount unconditionally. Check vf_netdev to make sure we don't take/release it twice. We presume that only one VF per netvsc device may exist. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Acked-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * hv_netvsc: reset vf_inject on VF removalVitaly Kuznetsov2016-08-151-10/+16
| | | | | | | | | | | | | | | | | | | | | | We reset vf_inject on VF going down (netvsc_vf_down()) but we don't on VF removal (netvsc_unregister_vf()) so vf_inject stays 'true' while vf_netdev is already NULL and we're trying to inject packets into NULL net device in netvsc_recv_callback() causing kernel to crash. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Acked-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * hv_netvsc: avoid deadlocks between rtnl lock and vf_use_cnt waitVitaly Kuznetsov2016-08-152-35/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <vkuznets@redhat.com> Acked-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * hv_netvsc: don't lose VF informationVitaly Kuznetsov2016-08-153-42/+45
| | | | | | | | | | | | | | | | | | | | | | 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 <vkuznets@redhat.com> Acked-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | hv_netvsc: Add handler for physical link speed changeHaiyang Zhang2016-08-083-7/+25
| | | | | | | | | | | | | | | | | | | | 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 <haiyangz@microsoft.com> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | hv_netvsc: Add query for initial physical link speedHaiyang Zhang2016-08-082-2/+26
|/ | | | | | | | | The physical link speed value will be reported by ethtool command. The real speed is available from Windows 2016 host or later. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: Fix VF register on bonding devicesHaiyang Zhang2016-07-251-2/+2
| | | | | | | | | Added a condition to avoid bonding devices with same MAC registering as VF. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* netvsc: Use the new in-place consumption APIs in the rx pathK. Y. Srinivasan2016-07-081-29/+59
| | | | | | | | | | | | Use the new APIs for eliminating a copy on the receive path. These new APIs also help in minimizing the number of memory barriers we end up issuing (in the ringbuffer code) since we can better control when we want to expose the ring state to the host. The patch is being resent to address earlier email issues. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* netvsc: get rid of completion timeoutsVitaly Kuznetsov2016-06-092-100/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm hitting 5 second timeout in rndis_filter_set_rss_param() while setting RSS parameters for the device. When this happens we end up returning -ETIMEDOUT from the function and rndis_filter_device_add() falls back to setting net_device->max_chn = 1; net_device->num_chn = 1; net_device->num_sc_offered = 0; but after a moment the rndis request succeeds and subchannels start to appear. netvsc_sc_open() does unconditional nvscdev->num_sc_offered-- and it becomes U32_MAX-1. Consequent rndis_filter_device_remove() will hang while waiting for all U32_MAX-1 subchannels to appear and this is not going to happen. The immediate issue could be solved by adding num_sc_offered > 0 check to netvsc_sc_open() but we're getting out of sync with the host and it's not easy to adjust things later, e.g. in this particular case we'll be creating queues without a user request for it and races are expected. Same applies to other parts of the driver which have the same completion timeout. Following the trend in drivers/hv/* code I suggest we remove all these timeouts completely. As a guest we can always trust the host we're running on and if the host screws things up there is no easy way to recover anyway. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Acked-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: pass struct net_device to rndis_filter_set_offload_params()Vitaly Kuznetsov2016-06-051-3/+2
| | | | | | | | The only caller rndis_filter_device_add() has 'struct net_device' pointer already. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: pass struct net_device to rndis_filter_set_device_mac()Vitaly Kuznetsov2016-06-053-6/+3
| | | | | | | | | 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 <vkuznets@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: pass struct netvsc_device to rndis_filter_{open, close}()Vitaly Kuznetsov2016-06-053-19/+13
| | | | | | | | | | 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 <vkuznets@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: introduce {net, hv}_device_to_netvsc_device() helpersVitaly Kuznetsov2016-06-053-25/+22
| | | | | | | | 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 <vkuznets@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: remove redundant assignment in netvsc_recv_callback()Vitaly Kuznetsov2016-06-051-1/+0
| | | | | | | | net_device_ctx is assigned in the very beginning of the function and 'net' pointer doesn't change. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: Fix VF register on vlan devicesHaiyang Zhang2016-06-031-0/+4
| | | | | | | | | Added a condition to avoid vlan devices with same MAC registering as VF. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: set nvdev link after populating chn_tableVitaly Kuznetsov2016-05-161-11/+18
| | | | | | | | | | | | | | | | | Crash in netvsc_send() is observed when netvsc device is re-created on mtu change/set channels. The crash is caused by dereferencing of NULL channel pointer which comes from chn_table. The root cause is a mixture of two facts: - we set nvdev pointer in net_device_context in alloc_net_device() before we populate chn_table. - we populate chn_table[0] only. The issue could be papered over by checking channel != NULL in netvsc_send() but populating the whole chn_table and writing the nvdev pointer afterwards seems more appropriate. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: synchronize netvsc_change_mtu()/netvsc_set_channels() with ↵Vitaly Kuznetsov2016-05-161-2/+7
| | | | | | | | | | | netvsc_remove() When netvsc device is removed during mtu change or channels setup we get into troubles as both paths are trying to remove the device. Synchronize them with start_remove flag and rtnl lock. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* hv_netvsc: get rid of struct net_device pointer in struct netvsc_deviceVitaly Kuznetsov2016-05-164-64/+72
| | | | | | | | | 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 <vkuznets@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
OpenPOWER on IntegriCloud