History

netvsc: use napi_consume_skb

This allows using deferred skb freeing and with NAPI. And get buffer recycling.

stephen hemminger committed 9 years ago

Commit f9645431 parent cdd32101 file · +11 −7Browse files

Unified · Split

drivers/net/hyperv/netvsc.c+11−7
@@ -601,7 +601,8 @@ static inline void netvsc_free_send_slot(struct netvsc_device *net_device, · 600 unmodified lines
601601 static void netvsc_send_tx_complete(struct netvsc_device *net_device,
602602 struct vmbus_channel *incoming_channel,
603603 struct hv_device *device,
604− const struct vmpacket_descriptor *desc)
604+ const struct vmpacket_descriptor *desc,
605+ int budget)
605606 {
606607 struct sk_buff *skb = (struct sk_buff *)(unsigned long)desc->trans_id;
607608 struct net_device *ndev = hv_get_drvdata(device);
@@ -628,7 +629,7 @@ static void netvsc_send_tx_complete(struct netvsc_device *net_device, · 20 unmodified lines
628629 tx_stats->bytes += packet->total_bytes;
629630 u64_stats_update_end(&tx_stats->syncp);
630631
631− dev_consume_skb_any(skb);
632+ napi_consume_skb(skb, budget);
632633 }
633634
634635 queue_sends =
@@ -646,7 +647,8 @@ static void netvsc_send_tx_complete(struct netvsc_device *net_device, · 11 unmodified lines
646647 static void netvsc_send_completion(struct netvsc_device *net_device,
647648 struct vmbus_channel *incoming_channel,
648649 struct hv_device *device,
649− const struct vmpacket_descriptor *desc)
650+ const struct vmpacket_descriptor *desc,
651+ int budget)
650652 {
651653 struct nvsp_message *nvsp_packet = hv_pkt_data(desc);
652654 struct net_device *ndev = hv_get_drvdata(device);
@@ -664,7 +666,7 @@ static void netvsc_send_completion(struct netvsc_device *net_device, · 11 unmodified lines
664666
665667 case NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE:
666668 netvsc_send_tx_complete(net_device, incoming_channel,
667− device, desc);
669+ device, desc, budget);
668670 break;
669671
670672 default:
@@ -1174,14 +1176,16 @@ static int netvsc_process_raw_pkt(struct hv_device *device, · 503 unmodified lines
11741176 struct vmbus_channel *channel,
11751177 struct netvsc_device *net_device,
11761178 struct net_device *ndev,
1177− const struct vmpacket_descriptor *desc)
1179+ const struct vmpacket_descriptor *desc,
1180+ int budget)
11781181 {
11791182 struct net_device_context *net_device_ctx = netdev_priv(ndev);
11801183 struct nvsp_message *nvmsg = hv_pkt_data(desc);
11811184
11821185 switch (desc->type) {
11831186 case VM_PKT_COMP:
1184− netvsc_send_completion(net_device, channel, device, desc);
1187+ netvsc_send_completion(net_device, channel, device,
1188+ desc, budget);
11851189 break;
11861190
11871191 case VM_PKT_DATA_USING_XFER_PAGES:
@@ -1230,7 +1234,7 @@ int netvsc_poll(struct napi_struct *napi, int budget) · 42 unmodified lines
12301234
12311235 while (nvchan->desc && work_done < budget) {
12321236 work_done += netvsc_process_raw_pkt(device, channel, net_device,
1233− ndev, nvchan->desc);
1237+ ndev, nvchan->desc, budget);
12341238 nvchan->desc = hv_pkt_iter_next(channel, nvchan->desc);
12351239 }
12361240

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t