hyperv: Remove recv_pkt_list and lock
Subsystems (3)
Haiyang Zhang
maintainerPATCH 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.
--- 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 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
David Miller
maintainerFrom: Haiyang Zhang <[email protected]>
Date: Mon, 21 Apr 2014 12:26:15 -0700
drivers/net/hyperv/rndis_filter.c static void rndis_filter_receive_data(struct rndis_device *dev, · line 406
Quoted 9 lines
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 |
This part of your change is not explained at all in your commit message.
Please resubmit this series with this hunk properly described and accounted for.
Haiyang Zhang
maintainerQuoted 27 lines
-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Monday, April 21, 2014 2:57 PM
To: Haiyang Zhang
Cc: [email protected]; KY Srinivasan; [email protected]; [email protected]; [email protected]; driverdev- [email protected]
Subject: Re: [PATCH net-next,1/2] hyperv: Removerecv_pkt_listand lockFrom: Haiyang Zhang <[email protected]>
Date: Mon, 21 Apr 2014 12:26:15 -0700Review static void rndis_filter_receive_data(struct
Quoted 1 line
(quoted diff) +0
-0@@ -401,8 +401,6 @@ static void rndis_filter_receive_data(struct
rndis_device*dev,drivers/net/hyperv/rndis_filter.c static void rndis_filter_receive_data(struct rndis_device *dev, · line 406
Quoted 8 lines
drivers/net/hyperv/rndis_filter.c +0
-2pkt->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 |This part of your change is not explained at all in your commit message.
Quoted 1 line
Please resubmit this series with this hunk properly described and accounted for.
I have updated the description and re-send them.
Thanks,
- Haiyang