hv_netvsc: Implement partial copy into send buffer
Subsystems (3)
Haiyang Zhang
maintainerPATCH 1/1 hv_netvsc: Implement partial copy into send buffer
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]>
--- drivers/net/hyperv/hyperv_net.h | 5 ++++ drivers/net/hyperv/netvsc.c | 50 ++++++++++++++++++++++++++------------ drivers/net/hyperv/netvsc_drv.c | 10 +++++-- 3 files changed, 46 insertions(+), 19 deletions(-)
drivers/net/hyperv/hyperv_net.h +5 -0
@@ -132,6 +132,8 @@ struct hv_netvsc_packet {bool is_data_pkt;bool xmit_more;/* from skb */ +bool cp_partial;/* partial copy into send buffer */ +u16 vlan_tci;u16 q_idx;
@@ -146,6 +148,9 @@ struct hv_netvsc_packet {/* This points to the memory after page_buf */ struct rndis_message *rndis_msg; +u32 rmsg_size;/* RNDIS header and PPI size */ +u32 rmsg_pgcnt;/* page count of RNDIS header and PPI */ +u32 total_data_buflen;/* Points to the send/receive buffer where the ethernet frame is */ void *data;
drivers/net/hyperv/netvsc.c +34 -16
109 lines not on this page · raw message
drivers/net/hyperv/netvsc_drv.c +7 -3
@@ -277,15 +277,16 @@ static u32 fill_pg_buf(struct page *page, u32 offset, u32 len, }static u32 init_page_array (void *hdr,u32 len,struct sk_buff *skb, -struct hv_page_buffer *pb) +struct hv_netvsc_packet *packet) { +struct hv_page_buffer *pb = packet->page_buf;u32 slots_used =0 ;char *data = skb->data;int frags =skb_shinfo (skb)->nr_frags;int i;/* The packet is laid out thus: -* 1. hdr +* 1. hdr: RNDIS header and PPI * 2. skb linear data * 3. skb fragment data */
@@ -294,6 +295,9 @@ static u32 init_page_array(void *hdr, u32 len, struct sk_buff *skb,offset_in_page (hdr), len, &pb[slots_used]); + packet->rmsg_size = len; + packet->rmsg_pgcnt = slots_used; + slots_used +=fill_pg_buf (virt_to_page (data),offset_in_page (data),skb_headlen (skb), &pb[slots_used]);
@@ -578,7 +582,7 @@ do_send: rndis_msg->msg_len += rndis_msg_size; packet->total_data_buflen = rndis_msg->msg_len; packet->page_buf_cnt =init_page_array (rndis_msg, rndis_msg_size, - skb, &page_buf[0 ]); + skb, packet); ret =netvsc_send (net_device_ctx->device_ctx, packet);
Signature · 1 line
1.7.4.1
From: Haiyang Zhang <[email protected]>
Date: Mon, 13 Apr 2015 16:34:35 -0700
Quoted 6 lines
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]>
Applied, thanks.