aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/hyperv/hyperv_net.h
AgeCommit message (Collapse)AuthorFilesLines
2016-03-23hv_netvsc: Fix the array sizes to be max supported channelsHaiyang Zhang1-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]>
2016-02-29hv_netvsc: add ethtool support for set and get of settings[email protected]1-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]>
2016-01-25hv_netvsc: Fix book keeping of skb during batching processHaiyang Zhang1-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]>
2015-12-02hv_netvsc: Eliminate vlan_tci from struct hv_netvsc_packetKY Srinivasan1-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]>
2015-12-02hv_netvsc: Eliminate status from struct hv_netvsc_packetKY Srinivasan1-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]>
2015-12-02hv_netvsc: Eliminate xmit_more from struct hv_netvsc_packetKY Srinivasan1-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]>
2015-12-02hv_netvsc: Eliminate completion_func from struct hv_netvsc_packetKY Srinivasan1-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]>
2015-12-02hv_netvsc: Eliminate is_data_pkt from struct hv_netvsc_packetKY Srinivasan1-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]>
2015-12-02hv_netvsc: Eliminate send_completion_tid from struct hv_netvsc_packetKY Srinivasan1-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]>
2015-12-02hv_netvsc: Eliminate page_buf from struct hv_netvsc_packetKY Srinivasan1-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]>
2015-12-02hv_netvsc: remove locking in netvsc_send()Vitaly Kuznetsov1-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]>
2015-12-02hv_netvsc: move subchannel existence check to netvsc_select_queue()Vitaly Kuznetsov1-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]>
2015-12-02hv_netvsc: Don't ask for additional head room in the skbKY Srinivasan1-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]>
2015-12-02hv_netvsc: Eliminate send_completion_ctx from struct hv_netvsc_packetKY Srinivasan1-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]>
2015-12-02hv_netvsc: Eliminate send_completion from struct hv_netvsc_packetKY Srinivasan1-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]>
2015-12-02hv_netvsc: Eliminatte the data field from struct hv_netvsc_packetKY Srinivasan1-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]>
2015-12-02hv_netvsc: Eliminate rndis_msg pointer from hv_netvsc_packet structureKY Srinivasan1-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]>
2015-12-02hv_netvsc: Eliminate the channel field in hv_netvsc_packet structureKY Srinivasan1-4/+18
Eliminate the channel field in 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]>
2015-12-02hv_netvsc: Rearrange the hv_negtvsc_packet to be space efficientKY Srinivasan1-8/+10
Rearrange the elements of struct hv_negtvsc_packet for optimal layout - eliminate unnecessary padding. Signed-off-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-12-02hv_netvsc: Resize some of the variables in hv_netvsc_packetKY Srinivasan1-7/+7
As part of reducing the size of the hv_netvsc_packet, resize some of the variables based on their usage. Signed-off-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-12-01hv_netvsc: rework link status change handlingVitaly Kuznetsov1-1/+13
There are several issues in hv_netvsc driver with regards to link status change handling: - RNDIS_STATUS_NETWORK_CHANGE results in calling userspace helper doing '/etc/init.d/network restart' and this is inappropriate and broken for many reasons. - link_watch infrastructure only sends one notification per second and in case of e.g. paired disconnect/connect events we get only one notification with last status. This makes it impossible to handle such situations in userspace. Redo link status changes handling in the following way: - Create a list of reconfig events in network device context. - On a reconfig event add it to the list of events and schedule netvsc_link_change(). - In netvsc_link_change() ensure 2-second delay between link status changes. - Handle RNDIS_STATUS_NETWORK_CHANGE as a paired disconnect/connect event. Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-08-12hv_netvsc: Set vRSS with num_chn in RNDIS filterAndrew Schwartzmeyer1-0/+1
Uses device_info->num_chn to pass user provided number of vRSS queues (from ethtool --set-channels) to rndis_filter_device_add. If nonzero and less than the maximum, set net_device->num_chn to the given value; else default to prior algorithm. Always initialize struct device_info to 0, otherwise not all its fields are guaranteed to be 0, which is necessary when checking if num_chn has been purposefully set. Signed-off-by: Andrew Schwartzmeyer <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-07-27hv_netvsc: Add structs and handlers for VF messagesHaiyang Zhang1-0/+29
This patch adds data structures and handlers for messages related to SRIOV Virtual Function. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-07-26hv_netvsc: Wait for sub-channels to be processed during probeKY Srinivasan1-0/+2
The current code returns from probe without waiting for the proper handling of subchannels that may be requested. If the netvsc driver were to be rapidly loaded/unloaded, we can trigger a panic as the unload will be tearing down state that may not have been fully setup yet. We fix this issue by making sure that we return from the probe call only after ensuring that the sub-channel offers in flight are properly handled. Reviewed-and-tested-by: Haiyang Zhang <[email protected] Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-07-08hv_netvsc: Add support to set MTU reservation from guest sideHaiyang Zhang1-0/+1
When packet encapsulation is in use, the MTU needs to be reduced for headroom reservation. The existing code takes the updated MTU value only from the host side. But vSwitch extensions, such as Open vSwitch, require the flexibility to change the MTU to different values from within a guest during the lifecycle of a vNIC, when the encapsulation protocol is changed. The patch supports this kind of MTU changes. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-30hv_netvsc: Properly size the vrss queuesKY Srinivasan1-0/+1
The current algorithm for deciding on the number of VRSS channels is not optimal since we open up the min of number of CPUs online and the number of VRSS channels the host is offering. So on a 32 VCPU guest we could potentially open 32 VRSS subchannels. Experimentation has shown that it is best to limit the number of VRSS channels to the number of CPUs within a NUMA node. Here is the new algorithm for deciding on the number of sub-channels we would open up: 1) Pick the minimum of what the host is offering and what the driver in the guest is specifying as the default value. 2) Pick the minimum of (1) and the numbers of CPUs in the NUMA node the primary channel is bound to. Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-17hv_netvsc: change member name of struct netvsc_stats[email protected]1-1/+1
Currently the struct netvsc_stats has a member s_sync of type u64_stats_sync. This definition will break kernel build as the macro netdev_alloc_pcpu_stats requires this member name to be syncp. (see netdev_alloc_pcpu_stats definition in ./include/linux/netdevice.h) This patch changes netvsc_stats's member name from s_sync to syncp to fix the build break. Signed-off-by: Simon Xiao <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-14hv_netvsc: use per_cpu stats to calculate TX/RX data[email protected]1-0/+9
Current code does not lock anything when calculating the TX and RX stats. As a result, the RX and TX data reported by ifconfig are not accuracy in a system with high network throughput and multiple CPUs (in my test, RX/TX = 83% between 2 HyperV VM nodes which have 8 vCPUs and 40G Ethernet). This patch fixed the above issue by using per_cpu stats. netvsc_get_stats64() summarizes TX and RX data by iterating over all CPUs to get their respective stats. This v2 patch addressed David's comments on the cleanup path when netdev_alloc_pcpu_stats() failed. Signed-off-by: Simon Xiao <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-29hv_netvsc: Fix a bug in netvsc_start_xmit()KY Srinivasan1-1/+0
Commit b08cc79155fc26d0d112b1470d1ece5034651a4b eliminated memory allocation in the packet send path: "hv_netvsc: Eliminate memory allocation in the packet send path The network protocol used to communicate with the host is the remote ndis (rndis) protocol. We need to decorate each outgoing packet with a rndis header and additional rndis state (rndis per-packet state). To manage this state, we currently allocate memory in the transmit path. Eliminate this allocation by requesting additional head room in the skb." This commit introduced a bug since it did not account for the case if the skb was cloned. Fix this bug. Signed-off-by: K. Y. Srinivasan <[email protected]> Tested-by: Dexuan Cui <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-29hv_netvsc: introduce netif-msg into netvsc moduleSimon Xiao1-0/+12
1. Introduce netif-msg to netvsc to control debug logging output and keep msg_enable in netvsc_device_context so that it is kept persistently. 2. Only call dump_rndis_message() when NETIF_MSG_RX_ERR or above is specified in netvsc module debug param. In non-debug mode, in current code, dump_rndis_message() will not dump anything but it still initialize some local variables and process the switch logic which is unnecessary, especially in high network throughput situation. Signed-off-by: Simon Xiao <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-14hv_netvsc: Implement partial copy into send bufferHaiyang Zhang1-0/+5
If remaining space in a send buffer slot is too small for the whole message, we only copy the RNDIS header and PPI data into send buffer, so we can batch one more packet each time. It reduces the vmbus per-message overhead. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-07hv_netvsc: Fix the packet free when it is in skb headroomHaiyang Zhang1-0/+1
In the two places changed, we now use netvsc_xmit_completion() which properly frees hv_netvsc_packet in or not in skb headroom. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-07hv_netvsc: Define a macro RNDIS_AND_PPI_SIZEHaiyang Zhang1-0/+6
The sum of RNDIS msg and PPI struct sizes is used in multiple places, so we define a macro for them. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-07hv_netvsc: Clean up two unused variablesHaiyang Zhang1-1/+0
Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-31hv_netvsc: Eliminate memory allocation in the packet send pathKY Srinivasan1-1/+2
The network protocol used to communicate with the host is the remote ndis (rndis) protocol. We need to decorate each outgoing packet with a rndis header and additional rndis state (rndis per-packet state). To manage this state, we currently allocate memory in the transmit path. Eliminate this allocation by requesting additional head room in the skb. Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29hv_netvsc: Implement batching in send bufferHaiyang Zhang1-1/+15
With this patch, we can send out multiple RNDIS data packets in one send buffer slot and one VMBus message. It reduces the overhead associated with VMBus messages. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-02-28hyperv: Implement netvsc_get_channels() ethool opAndrew Schwartzmeyer1-0/+1
This adds support for reporting the actual and maximum combined channels count of the hv_netvsc driver via 'ethtool --show-channels'. This required adding 'max_chn' to 'struct netvsc_device', and assigning it 'rsscap.num_recv_que' in 'rndis_filter_device_add'. Now we can access the combined maximum channel count via 'struct netvsc_device' in the ethtool callback. Signed-off-by: Andrew Schwartzmeyer <[email protected]> Signed-off-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-12-22hyperv: Fix some variable name typos in send-buffer init/revokeHaiyang Zhang1-0/+1
The changed names are union fields with the same size, so the existing code still works. But, we now update these variables to the correct names. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-08-22hyperv: Increase the buffer length for netvsc_channel_cb()Haiyang Zhang1-2/+2
When the buffer is too small for a packet from VMBus, a bigger buffer will be allocated in netvsc_channel_cb() and retry reading the packet from VMBus. Increasing this buffer size will reduce the retry overhead. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: Dexuan Cui <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-08-06hyperv: Adjust the size of sendbuf region to support ws2008r2KY Srinivasan1-1/+1
WS2008R2 is a supported platform and it turns out that the maximum sendbuf size that ws2008R2 can support is only 15MB. Make the necessary adjustment. Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-08-04Drivers: net-next: hyperv: Increase the size of the sendbuf regionKY Srinivasan1-1/+1
Intel did some benchmarking on our network throughput when Linux on Hyper-V is as used as a gateway. This fix gave us almost a 1 Gbps additional throughput on about 5Gbps base throughput we hadi, prior to increasing the sendbuf size. The sendbuf mechanism is a copy based transport that we have which is clearly more optimal than the copy-free page flipping mechanism (for small packets). In the forwarding scenario, we deal only with MTU sized packets, and increasing the size of the senbuf area gave us the additional performance. For what it is worth, Windows guests on Hyper-V, I am told use similar sendbuf size as well. The exact value of sendbuf I think is less important than the fact that it needs to be larger than what Linux can allocate as physically contiguous memory. Thus the change over to allocating via vmalloc(). We currently allocate 16MB receive buffer and we use vmalloc there for allocation. Also the low level channel code has already been modified to deal with physically dis-contiguous memory in the ringbuffer setup. Based on experimentation Intel did, they say there was some improvement in throughput as the sendbuf size was increased up to 16MB and there was no effect on throughput beyond 16MB. Thus I have chosen 16MB here. Increasing the sendbuf value makes a material difference in small packet handling In this version of the patch, based on David's feedback, I have added additional details in the commit log. Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-06-19hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE eventHaiyang Zhang1-1/+2
The RNDIS_STATUS_NETWORK_CHANGE event is received after the Hyper-V host sleep or hibernation. We refresh network at this time. MS-TFS: 135162 Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-05-23hyperv: Add hash value into RNDIS Per-packet infoHaiyang Zhang1-0/+4
It passes the hash value as the RNDIS Per-packet info to the Hyper-V host, so that the send completion notices can be spread across multiple channels. MS-TFS: 140273 Signed-off-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-04-30hyperv: Enable sendbuf mechanism on the send pathKY Srinivasan1-0/+14
We send packets using a copy-free mechanism (this is the Guest to Host transport via VMBUS). While this is obviously optimal for large packets, it may not be optimal for small packets. Hyper-V host supports a second mechanism for sending packets that is "copy based". We implement that mechanism in this patch. In this version of the patch I have addressed a comment from David Miller. With this patch (and all of the other offload and VRSS patches), we are now able to almost saturate a 10G interface between Linux VMs on Hyper-V on different hosts - close to 9 Gbps as measured via iperf. Signed-off-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-04-23hyperv: Simplify the send_completion variablesHaiyang Zhang1-7/+3
The union contains only one member now, so we use the variables in it directly. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-04-23hyperv: Remove recv_pkt_list and lockHaiyang Zhang1-33/+0
Removed recv_pkt_list and lock, and updated related code, so that the locking overhead is reduced especially when multiple channels are in use. The recv_pkt_list isn't actually necessary because the packets are processed sequentially in each channel. It has been replaced by a local variable, and the related lock for this list is also removed. The is_data_pkt field is not used in receive path, so its assignment is cleaned up. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-04-21hyperv: Add support for virtual Receive Side Scaling (vRSS)Haiyang Zhang1-1/+109
This feature allows multiple channels to be used by each virtual NIC. It is available on Hyper-V host 2012 R2. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-04-11Drivers: net: hyperv: Address UDP checksum issuesKY Srinivasan1-0/+1
ws2008r2 does not support UDP checksum offload. Thus, we cannnot turn on UDP offload in the host. Also, on ws2012 and ws2012 r2, there appear to be an issue with UDP checksum offload. Fix this issue by computing the UDP checksum in the Hyper-V driver. Based on Dave Miller's comments, in this version, I have COWed the skb before modifying the UDP header (the checksum field). Signed-off-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-03-10hyperv: Change the receive buffer size for legacy hostsHaiyang Zhang1-0/+1
Due to a bug in the Hyper-V host verion 2008R2, we need to use a slightly smaller receive buffer size, otherwise the buffer will not be accepted by the legacy hosts. Signed-off-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-03-10Drivers: net: hyperv: Enable large send offloadKY Srinivasan1-0/+40
Enable segmentation offload. Signed-off-by: K. Y. Srinivasan <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>