Skip to content

Commit 93f93a4

Browse files
edumazetdavem330
authored andcommitted
net: move skb_mark_napi_id() into core networking stack
We would like to automatically provide busy polling support to all NAPI drivers, without them having to implement anything. skb_mark_napi_id() can be called from napi_gro_receive() and napi_get_frags(). Few drivers are still calling skb_mark_napi_id() because they use netif_receive_skb(). They should eventually call napi_gro_receive() instead. I will leave this to drivers maintainers. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 868fdb0 commit 93f93a4

File tree

13 files changed

+4
-16
lines changed

13 files changed

+4
-16
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-drv.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,6 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
20242024
skb->dev = netdev;
20252025
skb->protocol = eth_type_trans(skb, netdev);
20262026
skb_record_rx_queue(skb, channel->queue_index);
2027-
skb_mark_napi_id(skb, napi);
20282027

20292028
napi_gro_receive(napi, skb);
20302029

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,6 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
10941094
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
10951095
le16_to_cpu(cqe_fp->vlan_tag));
10961096

1097-
skb_mark_napi_id(skb, &fp->napi);
1098-
10991097
napi_gro_receive(&fp->napi, skb);
11001098
next_rx:
11011099
rx_buf->data = NULL;

drivers/net/ethernet/chelsio/cxgb4/sge.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,6 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
18641864
skb->truesize += skb->data_len;
18651865
skb->ip_summed = CHECKSUM_UNNECESSARY;
18661866
skb_record_rx_queue(skb, rxq->rspq.idx);
1867-
skb_mark_napi_id(skb, &rxq->rspq.napi);
18681867
pi = netdev_priv(skb->dev);
18691868
if (pi->rxtstamp)
18701869
cxgb4_sgetim_to_hwtstamp(adapter, skb_hwtstamps(skb),

drivers/net/ethernet/emulex/benet/be_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2184,7 +2184,6 @@ static void be_rx_compl_process_gro(struct be_rx_obj *rxo,
21842184
skb_set_hash(skb, rxcp->rss_hash, PKT_HASH_TYPE_L3);
21852185

21862186
skb->csum_level = rxcp->tunneled;
2187-
skb_mark_napi_id(skb, napi);
21882187

21892188
if (rxcp->vlanf)
21902189
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rxcp->vlan_tag);

drivers/net/ethernet/intel/i40e/i40e_txrx.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,6 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)
16321632
continue;
16331633
}
16341634
#endif
1635-
skb_mark_napi_id(skb, &rx_ring->q_vector->napi);
16361635
i40e_receive_skb(rx_ring, skb, vlan_tag);
16371636

16381637
rx_desc->wb.qword1.status_error_len = 0;

drivers/net/ethernet/intel/i40evf/i40e_txrx.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,6 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)
10901090
continue;
10911091
}
10921092
#endif
1093-
skb_mark_napi_id(skb, &rx_ring->q_vector->napi);
10941093
i40e_receive_skb(rx_ring, skb, vlan_tag);
10951094

10961095
rx_desc->wb.qword1.status_error_len = 0;

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,7 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring,
16591659
static void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector,
16601660
struct sk_buff *skb)
16611661
{
1662+
skb_mark_napi_id(skb, &q_vector->napi);
16621663
if (ixgbe_qv_busy_polling(q_vector))
16631664
netif_receive_skb(skb);
16641665
else
@@ -2123,7 +2124,6 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
21232124
}
21242125

21252126
#endif /* IXGBE_FCOE */
2126-
skb_mark_napi_id(skb, &q_vector->napi);
21272127
ixgbe_rx_skb(q_vector, skb);
21282128

21292129
/* update budget accounting */

drivers/net/ethernet/mellanox/mlx4/en_rx.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,6 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
925925
PKT_HASH_TYPE_L3);
926926

927927
skb_record_rx_queue(gro_skb, cq->ring);
928-
skb_mark_napi_id(gro_skb, &cq->napi);
929928

930929
if (ring->hwtstamp_rx_filter == HWTSTAMP_FILTER_ALL) {
931930
timestamp = mlx4_en_get_cqe_ts(cqe);
@@ -988,8 +987,6 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
988987
timestamp);
989988
}
990989

991-
skb_mark_napi_id(skb, &cq->napi);
992-
993990
napi_gro_receive(&cq->napi, skb);
994991
next:
995992
for (nr = 0; nr < priv->num_frags; nr++)

drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
243243
wqe = mlx5_wq_ll_get_wqe(&rq->wq, wqe_counter);
244244
skb = rq->skb[wqe_counter];
245245
prefetch(skb->data);
246-
skb_mark_napi_id(skb, cq->napi);
247246
rq->skb[wqe_counter] = NULL;
248247

249248
dma_unmap_single(rq->pdev,

drivers/net/ethernet/myricom/myri10ge/myri10ge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,6 @@ myri10ge_rx_done(struct myri10ge_slice_state *ss, int len, __wsum csum)
14881488
}
14891489
myri10ge_vlan_rx(mgp->dev, va, skb);
14901490
skb_record_rx_queue(skb, ss - &mgp->ss[0]);
1491-
skb_mark_napi_id(skb, &ss->napi);
14921491

14931492
if (polling) {
14941493
int hlen;
@@ -1506,6 +1505,7 @@ myri10ge_rx_done(struct myri10ge_slice_state *ss, int len, __wsum csum)
15061505
skb->data_len -= hlen;
15071506
skb->tail += hlen;
15081507
skb->protocol = eth_type_trans(skb, dev);
1508+
skb_mark_napi_id(skb, &ss->napi);
15091509
netif_receive_skb(skb);
15101510
}
15111511
else

drivers/net/ethernet/sfc/rx.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,6 @@ efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf,
463463

464464
skb_record_rx_queue(skb, channel->rx_queue.core_index);
465465

466-
skb_mark_napi_id(skb, &channel->napi_str);
467466
gro_result = napi_gro_frags(napi);
468467
if (gro_result != GRO_DROP)
469468
channel->irq_mod_score += 2;

drivers/net/virtio_net.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,6 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
516516
skb_shinfo(skb)->gso_segs = 0;
517517
}
518518

519-
skb_mark_napi_id(skb, &rq->napi);
520-
521519
napi_gro_receive(&rq->napi, skb);
522520
return;
523521

net/core/dev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4356,6 +4356,7 @@ static gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb)
43564356

43574357
gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
43584358
{
4359+
skb_mark_napi_id(skb, napi);
43594360
trace_napi_gro_receive_entry(skb);
43604361

43614362
skb_gro_reset_offset(skb);
@@ -4390,6 +4391,7 @@ struct sk_buff *napi_get_frags(struct napi_struct *napi)
43904391
if (!skb) {
43914392
skb = napi_alloc_skb(napi, GRO_MAX_HEAD);
43924393
napi->skb = skb;
4394+
skb_mark_napi_id(skb, napi);
43934395
}
43944396
return skb;
43954397
}

0 commit comments

Comments
 (0)