summaryrefslogtreecommitdiffstats
path: root/drivers/net/hyperv
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2017-06-301-2/+2
|\ | | | | | | | | | | | | A set of overlapping changes in macvlan and the rocker driver, nothing serious. Signed-off-by: David S. Miller <davem@davemloft.net>
| * netvsc: don't access netdev->num_rx_queues directlyArnd Bergmann2017-06-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This structure member is hidden behind CONFIG_SYSFS, and we get a build error when that is disabled: drivers/net/hyperv/netvsc_drv.c: In function 'netvsc_set_channels': drivers/net/hyperv/netvsc_drv.c:754:49: error: 'struct net_device' has no member named 'num_rx_queues'; did you mean 'num_tx_queues'? drivers/net/hyperv/netvsc_drv.c: In function 'netvsc_set_rxfh': drivers/net/hyperv/netvsc_drv.c:1181:25: error: 'struct net_device' has no member named 'num_rx_queues'; did you mean 'num_tx_queues'? As the value is only set once to the argument of alloc_netdev_mq(), we can compare against that constant directly. Fixes: ff4a44199012 ("netvsc: allow get/set of RSS indirection table") Fixes: 2b01888d1b45 ("netvsc: allow more flexible setting of number of channels") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | hv_netvsc: Fix the carrier state error when data path is offHaiyang Zhang2017-06-223-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the VF NIC is opened, the synthetic NIC's carrier state is set to off. This tells the host to transitions data path to the VF device. But if startup script or user manipulates the admin state of the netvsc device directly for example: # ifconfig eth0 down # ifconfig eth0 up Then the carrier state of the synthetic NIC would be on, even though the data path was still over the VF NIC. This patch sets the carrier state of synthetic NIC with consideration of the related VF state. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | hv_netvsc: Remove unnecessary var link_state from struct netvsc_device_infoHaiyang Zhang2017-06-222-5/+4
| | | | | | | | | | | | | | | | | | We simply use rndis_device->link_state in the netdev_dbg. The variable, link_state from struct netvsc_device_info, is not used anywhere else. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | networking: introduce and use skb_put_data()Johannes Berg2017-06-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A common pattern with skb_put() is to just want to memcpy() some data into the new space, introduce skb_put_data() for this. An spatch similar to the one for skb_put_zero() converts many of the places using it: @@ identifier p, p2; expression len, skb, data; type t, t2; @@ ( -p = skb_put(skb, len); +p = skb_put_data(skb, data, len); | -p = (t)skb_put(skb, len); +p = skb_put_data(skb, data, len); ) ( p2 = (t2)p; -memcpy(p2, data, len); | -memcpy(p, data, len); ) @@ type t, t2; identifier p, p2; expression skb, data; @@ t *p; ... ( -p = skb_put(skb, sizeof(t)); +p = skb_put_data(skb, data, sizeof(t)); | -p = (t *)skb_put(skb, sizeof(t)); +p = skb_put_data(skb, data, sizeof(t)); ) ( p2 = (t2)p; -memcpy(p2, data, sizeof(*p)); | -memcpy(p, data, sizeof(*p)); ) @@ expression skb, len, data; @@ -memcpy(skb_put(skb, len), data, len); +skb_put_data(skb, data, len); (again, manually post-processed to retain some comments) Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2017-06-153-39/+50
|\| | | | | | | | | | | | | The conflicts were two cases of overlapping changes in batman-adv and the qed driver. Signed-off-by: David S. Miller <davem@davemloft.net>
| * netvsc: move filter setting to rndis_devicestephen hemminger2017-06-083-34/+34
| | | | | | | | | | | | | | | | | | The work queue and handling of network filter parameters should be in rndis_device. This gets rid of warning from RCU checks, eliminates a race and cleans up code. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * netvsc: fix net poll modestephen hemminger2017-06-081-4/+15
| | | | | | | | | | | | | | | | | | | | | | The ndo_poll_controller function needs to schedule NAPI to pick up arriving packets and send completions. Otherwise no data will ever be received. For simple case of netconsole, it also will allow send completions to happen. Without this netpoll will eventually get stuck. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * netvsc: fix rcu dereference warning from ethtoolstephen hemminger2017-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | The ethtool info command calls the netvsc get_sset_count with RTNL but not with RCU. Which causes warning: drivers/net/hyperv/netvsc_drv.c:1010 suspicious rcu_dereference_check() usage! Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: fold in get_outbound_net_devicestephen hemminger2017-06-091-13/+3
| | | | | | | | | | | | | | No longer need common code to find get_outbound_net_device. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: pass net_device to netvsc_init_buf and netvsc_connect_vspstephen hemminger2017-06-091-20/+11
| | | | | | | | | | | | | | | | Don't need to find netvsc_device structure, caller already had it. Also rearrange declarations. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: mark error cases as unlikelystephen hemminger2017-06-091-2/+2
| | | | | | | | | | | | | | Mark if() statements used for error handling only as unlikely() Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: use typed pointer for internal statestephen hemminger2017-06-091-2/+1
| | | | | | | | | | | | | | | | The element netvsc_device:extension is always a pointer to RNDIS information. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: use hv_get_bytes_to_readstephen hemminger2017-06-091-7/+3
| | | | | | | | | | | | | | Don't need need to look at write space in netvsc_close. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: optimize calculation of number of slotsstephen hemminger2017-06-091-33/+10
| | | | | | | | | | | | | | | | | | Speed up transmit check for fragmented packets by using existing macros to compute number of pages, and eliminate loop since skb fragments each take a page. Number of slots is also unsigned. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: Add #include's for csum_* function declarationsMichael Kelley2017-05-311-0/+2
|/ | | | | | | | | | Add direct #include statements for declarations of csum_tcpudp_magic() and csum_ipv6_magic(). While the needed #include's are picked up indirectly for the x86 architecture, they aren't on other architectures, resulting in compile errors. Signed-off-by: Michael Kelley <mikelley@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* netvsc: make sure napi enabled before vmbus_openstephen hemminger2017-05-042-4/+6
| | | | | | | | This fixes a race where vmbus callback for new packet arriving could occur before NAPI is initialized. Signed-off-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. Miller2017-04-262-6/+4
|\ | | | | | | Signed-off-by: David S. Miller <davem@davemloft.net>
| * netvsc: fix calculation of available send sectionsstephen hemminger2017-04-252-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | My change (introduced in 4.11) to use find_first_clear_bit incorrectly assumed that the size argument was words, not bits. The effect was only a small limited number of the available send sections were being actually used. This can cause performance loss with some workloads. Since map_words is now used only during initialization, it can be on stack instead of in per-device data. Fixes: b58a185801da ("netvsc: simplify get next send section") Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * netvsc: fix race during initializationstephen hemminger2017-03-161-2/+5
| | | | | | | | | | | | | | | | | | | | | | When device is being setup on boot, there is a small race where network device callback is registered, but the netvsc_device pointer is not set yet. This can cause a NULL ptr dereference if packet arrives during this window. Fixes: 46b4f7f5d1f7 ("netvsc: eliminate per-device outstanding send counter") Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: fix use after free on module removalstephen hemminger2017-04-212-7/+11
| | | | | | | | | | | | | | | | | | | | The NAPI data structure is embedded in the netvsc_device structure and is freed when device is closed. There is still a reference (in NAPI list) to this which causes a crash in netif_napi_del when device is removed. Fix by managing NAPI instances correctly. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: Deal with rescinded channels correctlyK. Y. Srinivasan2017-04-211-0/+16
| | | | | | | | | | | | | | | | | | | | We will not be able to send packets over a channel that has been rescinded. Make necessary adjustments so we can properly cleanup even when the channel is rescinded. This issue can be trigerred in the NIC hot-remove path. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | hv_netvsc: change netvsc device default duplex to FULLSimon Xiao2017-04-171-1/+1
| | | | | | | | | | | | | | | | | | The netvsc device supports full duplex by default. This warnings in log from bonding device which did not like seeing UNKNOWN duplex. Signed-off-by: Simon Xiao <sixiao@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: fix RCU warning in get_statsstephen hemminger2017-04-171-1/+1
| | | | | | | | | | | | | | | | | | The statistics functionis called with RTNL held during probe but with RCU held during access from /proc and elsewhere. This is safe so update the lockdep annotation. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | hv_netvsc: Exclude non-TCP port numbers from vRSS hashingHaiyang Zhang2017-04-171-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | Azure hosts are not supporting non-TCP port numbers in vRSS hashing for now. For example, UDP packet loss rate will be high if port numbers are also included in vRSS hash. So, we created this patch to use only IP numbers for hashing in non-TCP traffic. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | hv_netvsc: Fix the queue index computation in forwarding caseHaiyang Zhang2017-04-172-15/+31
| | | | | | | | | | | | | | | | | | If the outgoing skb has a RX queue mapping available, we use the queue number directly, other than put it through Send Indirection Table. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: use napi_consume_skbstephen hemminger2017-04-091-7/+11
| | | | | | | | | | | | | | | | This allows using deferred skb freeing and with NAPI. And get buffer recycling. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: Initialize all channel related state prior to opening the channelK. Y. Srinivasan2017-04-082-14/+18
| | | | | | | | | | | | | | | | | | Prior to opening the channel we should have all the state setup to handle interrupts. The current code does not do that; fix the bug. This bug can result in faults in the interrupt path. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: fix dereference before null check errorsColin Ian King2017-03-271-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ndev is being checked to see if it is a null pointer however before the null check ndev is being dereferenced; hence there is a potential null pointer dereference bug that needs fixing. Fix this by only dereferencing ndev after the null check. Detected by CoverityScan, CID#1420760, CID#140761 ("Dereference before null check") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: Properly initialize the return valueK. Y. Srinivasan2017-03-251-1/+1
| | | | | | | | | | | | | | Initialize the return value correctly. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: Fix a bug in sub-channel handlingK. Y. Srinivasan2017-03-251-0/+5
| | | | | | | | | | | | | | | | All netvsc channels are handled via NAPI. Setup the "read mode" correctly for the netvsc sub-channels. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: fix and cleanup rndis_filter_set_packet_filterstephen hemminger2017-03-221-12/+6
| | | | | | | | | | | | | | | | Fix warning from unused set_complete variable. And rearrange code to eliminate unnecessary goto's. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: eliminate unnecessary skb == NULL checksstephen hemminger2017-03-221-6/+3
| | | | | | | | | | | | | | | | Since there already is a special case goto for control messages (skb == NULL) in netvsc_send, there is no need for later checks in same code path. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: remove unnecessary lock on shutdownstephen hemminger2017-03-221-4/+3
| | | | | | | | | | | | | | | | | | The channel inbound lock was not being used at all by the netvsc device, but the spin_lock was helpful by providing necessary barrier before waiting. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: use refcount_t for keeping track of sub channelsstephen hemminger2017-03-222-33/+12
| | | | | | | | | | | | | | | | | | | | | | | | Rather than a lock and variable, use a refcount_t to keep track of the number of sub channels. Don't need to wait for subchannels on device removal since wait was already done in device_add. Also fix the error handling; don't wait forever in case of an error on request to create sub channels. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: uses RCU instead of removal flagstephen hemminger2017-03-223-31/+10
| | | | | | | | | | | | | | | | | | | | It is cleaner to use RCU protected pointer (nvdev_ctx->nvdev) to indicate device is in removed state, rather than having a separate boolean flag. By using the pointer the context can be checked by static checkers and dynamic lockdep. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: use RCU to protect inner device structurestephen hemminger2017-03-223-24/+57
| | | | | | | | | | | | | | | | | | | | | | | | The netvsc driver has an internal structure (netvsc_device) which is created when device is opened and released when device is closed. And also opened/released when MTU or number of channels change. Since this is referenced in the receive and transmit path, it is safer to use RCU to protect/prevent use after free problems. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: change max channel calculationstephen hemminger2017-03-222-17/+11
| | | | | | | | | | | | | | | | | | The default number of maximum channels should be limited to the number of cpus available on the numa node of the primary channel. This also makes sure maximum channels <= num_online_cpus Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: handle offline mtu and channel changestephen hemminger2017-03-221-9/+20
| | | | | | | | | | | | | | | | If device is not up, then changing MTU (or number of channels) should not re-enable the device. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: fix NAPI performance regressionstephen hemminger2017-03-222-23/+19
| | | | | | | | | | | | | | | | | | | | | | | | When using NAPI, the single stream performance declined signifcantly because the poll routine was updating host after every burst of packets. This excess signalling caused host throttling. This fix restores the old behavior. Host is only signalled after the ring has been emptied. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: remove unused #definestephen hemminger2017-03-161-3/+0
| | | | | | | | | | | | | | Not used anywhere. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: add comments about callback's and NAPIstephen hemminger2017-03-161-1/+12
| | | | | | | | | | | | | | Add some short description of how callback's and NAPI interoperate. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: avoid race with callbackstephen hemminger2017-03-162-18/+15
| | | | | | | | | | | | | | | | | | | | Change the argument to channel callback from the channel pointer to the internal data structure containing per-channel info. This avoids any possible races when callback happens during initialization and makes IRQ code simpler. Signed-off-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. Miller2017-03-153-15/+7
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: drivers/net/ethernet/broadcom/genet/bcmgenet.c net/core/sock.c Conflicts were overlapping changes in bcmgenet and the lockdep handling of sockets. Signed-off-by: David S. Miller <davem@davemloft.net>
| * netvsc: handle select_queue when device is being removedstephen hemminger2017-03-123-15/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Move the send indirection table from the inner device (netvsc) to the network device context. It is possible that netvsc_device is not present (remove in progress). This solves potential use after free issues when packet is being created during MTU change, shutdown, or queue count changes. Fixes: d8e18ee0fa96 ("netvsc: enhance transmit select_queue") Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: fix hang on netvsc module removalstephen hemminger2017-03-121-2/+2
| | | | | | | | | | | | | | | | | | | | The code in netvsc_device_remove was incorrectly calling napi_disable repeatedly on the same element. This would cause attempts to remove netvsc module to hang. Fixes: 2506b1dc4bbe ("netvsc: implement NAPI") Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: need napi scheduled during removalstephen hemminger2017-03-121-14/+2
| | | | | | | | | | | | | | | | | | | | Since rndis_halt_device waits until all outstanding sends and receives are completed. Netvsc device needs to still schedule NAPI to see those completions. Fixes: 2506b1dc4bbe ("netvsc: implement NAPI") Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net: hyperv: use new api ethtool_{get|set}_link_ksettingsPhilippe Reynes2017-03-121-18/+21
| | | | | | | | | | | | | | | | | | | | | | | | The ethtool api {get|set}_settings is deprecated. We move this driver to new api {get|set}_link_ksettings. As I don't have the hardware, I'd be very pleased if someone may test this patch. Signed-off-by: Philippe Reynes <tremyfr@gmail.com> Tested-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: replace netdev_alloc_skb_ip_align with napi_alloc_skbstephen hemminger2017-03-061-2/+4
| | | | | | | | | | | | | | Gives potential performance gain. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | netvsc: enable GROstephen hemminger2017-03-061-4/+4
| | | | | | | | | | | | | | Use GRO when receiving packets. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
OpenPOWER on IntegriCloud