hyperv: Remove recv_pkt_list and lock
Subsystems (3)
Haiyang Zhang
maintainerPATCH v2 1/2 hyperv: Remove recv_pkt_list and lock
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.
--- drivers/net/hyperv/hyperv_net.h | 33 ------- drivers/net/hyperv/netvsc.c | 174 +++---------------------------------- drivers/net/hyperv/netvsc_drv.c | 2 +- drivers/net/hyperv/rndis_filter.c | 2 - 4 files changed, 13 insertions(+), 198 deletions(-)
drivers/net/hyperv/hyperv_net.h +0 -33
@@ -119,27 +119,14 @@ struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */ };/* Fwd declaration */ -struct hv_netvsc_packet ;struct ndis_tcp_ip_checksum_info ; -/* Represent the xfer page packet which contains 1 or more netvsc packet */ -struct xferpage_packet { -struct list_head list_ent; -u32 status; - -/* # of netvsc packets this xfer packet contains */ -u32 count; - -struct vmbus_channel *channel; -}; -/* * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame * within the RNDIS */ struct hv_netvsc_packet {/* Bookkeeping stuff */ -struct list_head list_ent;u32 status;struct hv_device *device;
@@ -149,19 +136,8 @@ struct hv_netvsc_packet {u16 q_idx;struct vmbus_channel *channel; -/* -* Valid only for receives when we break a xfer page packet -* into multiple netvsc packets -*/ -struct xferpage_packet *xfer_page_pkt; -union {struct { -u64 recv_completion_tid; -void *recv_completion_ctx; -void (*recv_completion)(void *context); - } recv; -struct {u64 send_completion_tid;void *send_completion_ctx;void (*send_completion)(void *context);
@@ -613,9 +589,6 @@ struct nvsp_message {#define NETVSC_RECEIVE_BUFFER_ID 0xcafe -/* Preallocated receive packets */ -#define NETVSC_RECEIVE_PACKETLIST_COUNT 256 -#define NETVSC_PACKET_SIZE 2048#define VRSS_SEND_TAB_SIZE 16
@@ -630,12 +603,6 @@ struct netvsc_device {wait_queue_head_t wait_drain;bool start_remove;bool destroy; -/* -* List of free preallocated hv_netvsc_packet to represent receive -* packet -*/ -struct list_head recv_pkt_list; -spinlock_t recv_pkt_list_lock;/* Receive buffer allocated by us but manages by NetVSP */ void *recv_buf;
drivers/net/hyperv/netvsc.c +12 -162
242 lines not on this page · raw message
drivers/net/hyperv/netvsc_drv.c +1 -1
@@ -638,7 +638,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,__vlan_hwaccel_put_tag (skb,htons (ETH_P_8021Q ), packet->vlan_tci); -skb_record_rx_queue (skb, packet->xfer_page_pkt->channel-> +skb_record_rx_queue (skb, packet->channel-> offermsg.offer.sub_channel_index % net->real_num_rx_queues);
drivers/net/hyperv/rndis_filter.c +0 -2
@@ -401,8 +401,6 @@ static void rndis_filter_receive_data(struct rndis_device *dev, pkt->total_data_buflen = rndis_pkt->data_len; pkt->data = (void *)((unsigned long )pkt->data + data_offset); - pkt->is_data_pkt = true; - vlan =rndis_get_ppi (rndis_pkt,IEEE_8021Q_INFO );if (vlan) { pkt->vlan_tci = VLAN_TAG_PRESENT | vlan->vlanid |
Signature · 1 line
1.7.4.1
Haiyang Zhang
maintainerPATCH v2 2/2 hyperv: Simplify the send_completion variables
The union contains only one member now, so we use the variables in it directly.
--- drivers/net/hyperv/hyperv_net.h | 10 +++------- drivers/net/hyperv/netvsc.c | 7 +++---- drivers/net/hyperv/netvsc_drv.c | 8 ++++---- drivers/net/hyperv/rndis_filter.c | 2 +- 4 files changed, 11 insertions(+), 16 deletions(-)
drivers/net/hyperv/hyperv_net.h +3 -7
@@ -136,13 +136,9 @@ struct hv_netvsc_packet {u16 q_idx;struct vmbus_channel *channel; -union { -struct { -u64 send_completion_tid; -void *send_completion_ctx; -void (*send_completion)(void *context); - } send; - } completion; +u64 send_completion_tid; +void *send_completion_ctx; +void (*send_completion)(void *context);/* This points to the memory after page_buf */ struct rndis_message *rndis_msg;
drivers/net/hyperv/netvsc.c +3 -4
@@ -479,9 +479,8 @@ static void netvsc_send_completion(struct netvsc_device *net_device,if (nvsc_packet) { q_idx = nvsc_packet->q_idx; channel = nvsc_packet->channel; - nvsc_packet->completion.send.send_completion ( - nvsc_packet->completion.send. - send_completion_ctx); + nvsc_packet->send_completion (nvsc_packet-> + send_completion_ctx); } num_outstanding_sends =
@@ -534,7 +533,7 @@ int netvsc_send(struct hv_device *device,0xFFFFFFFF ; sendMessage.msg.v1_msg.send_rndis_pkt.send_buf_section_size =0 ; -if (packet->completion.send.send_completion) +if (packet->send_completion) req_id = (ulong )packet;else req_id =0 ;
drivers/net/hyperv/netvsc_drv.c +4 -4
@@ -235,7 +235,7 @@ static void netvsc_xmit_completion(void *context) {struct hv_netvsc_packet *packet = (struct hv_netvsc_packet *)context;struct sk_buff *skb = (struct sk_buff *) - (unsigned long )packet->completion.send.send_completion_tid; + (unsigned long )packet->send_completion_tid;kfree (packet);
@@ -425,9 +425,9 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) (num_data_pgs * sizeof(struct hv_page_buffer)));/* Set the completion routine */ - packet->completion.send.send_completion = netvsc_xmit_completion; - packet->completion.send.send_completion_ctx = packet; - packet->completion.send.send_completion_tid = (unsigned long )skb; + packet->send_completion = netvsc_xmit_completion; + packet->send_completion_ctx = packet; + packet->send_completion_tid = (unsigned long )skb; isvlan = packet->vlan_tci &VLAN_TAG_PRESENT ;
drivers/net/hyperv/rndis_filter.c +1 -1
@@ -236,7 +236,7 @@ static int rndis_filter_send_request(struct rndis_device *dev, packet->page_buf[0 ].len; } - packet->completion.send.send_completion =NULL ; + packet->send_completion =NULL ; ret =netvsc_send (dev->net_dev->dev, packet);return ret;
Signature · 1 line
1.7.4.1
From: Haiyang Zhang <[email protected]>
Date: Mon, 21 Apr 2014 14:54:43 -0700
Quoted 4 lines
Removed
recv_pkt_listand lock, and updated related code, so that the locking overhead is reduced especially when multiple channels are in use.
Quoted 8 lines
The
recv_pkt_listisn'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. Theis_data_pktfield 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]>
Applied.
David Miller
maintainerRe: [PATCH net-next,v2,2/2] hyperv: Simplify the send_completion variables
In reply to Haiyang ZhangFrom: Haiyang Zhang <[email protected]>
Date: Mon, 21 Apr 2014 14:54:44 -0700
Quoted 4 lines
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]>
Also applied, thanks.