Skip to content

Commit da54d75

Browse files
committed
Merge branch 'netdev-RT'
Sebastian Andrzej Siewior says: ==================== net: dev: PREEMPT_RT fixups. this series removes or replaces preempt_disable() and local_irq_save() sections which are problematic on PREEMPT_RT. Patch 2 makes netif_rx() work from any context after I found suggestions for it in an old thread. Should that work, then the context-specific variants could be removed. v2…v3: - #2 - Export __netif_rx() so it can be used by everyone. - Add a lockdep assert to check for interrupt context. - Update the kernel doc and mention that the skb is posted to backlog NAPI. - Use __netif_rx() also in drivers/net/*.c. - Added Toke''s review tag and kept Eric's desptite the changes made. v1…v2: - #1 and #2 - merge patch 1 und 2 from the series (as per Toke). - updated patch description and corrected the first commit number (as per Eric). - #2 - Provide netif_rx() as in v1 and additionally __netif_rx() without local_bh disable()+enable() for the loopback driver. __netif_rx() is not exported (loopback is built-in only) so it won't be used drivers. If this doesn't work then we can still export/ define a wrapper as Eric suggested. - Added a comment that netif_rx() considered legacy. - #3 - Moved ____napi_schedule() into rps_ipi_queued() and renamed it napi_schedule_rps(). https://lore.kernel.org/all/[email protected]/ v1: https://lore.kernel.org/all/[email protected] ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 88f62ae + e722db8 commit da54d75

File tree

16 files changed

+103
-111
lines changed

16 files changed

+103
-111
lines changed

drivers/net/amt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,7 +2373,7 @@ static bool amt_membership_query_handler(struct amt_dev *amt,
23732373
skb->pkt_type = PACKET_MULTICAST;
23742374
skb->ip_summed = CHECKSUM_NONE;
23752375
len = skb->len;
2376-
if (netif_rx(skb) == NET_RX_SUCCESS) {
2376+
if (__netif_rx(skb) == NET_RX_SUCCESS) {
23772377
amt_update_gw_status(amt, AMT_STATUS_RECEIVED_QUERY, true);
23782378
dev_sw_netstats_rx_add(amt->dev, len);
23792379
} else {
@@ -2470,7 +2470,7 @@ static bool amt_update_handler(struct amt_dev *amt, struct sk_buff *skb)
24702470
skb->pkt_type = PACKET_MULTICAST;
24712471
skb->ip_summed = CHECKSUM_NONE;
24722472
len = skb->len;
2473-
if (netif_rx(skb) == NET_RX_SUCCESS) {
2473+
if (__netif_rx(skb) == NET_RX_SUCCESS) {
24742474
amt_update_relay_status(tunnel, AMT_STATUS_RECEIVED_UPDATE,
24752475
true);
24762476
dev_sw_netstats_rx_add(amt->dev, len);

drivers/net/geneve.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
925925
}
926926

927927
skb->protocol = eth_type_trans(skb, geneve->dev);
928-
netif_rx(skb);
928+
__netif_rx(skb);
929929
dst_release(&rt->dst);
930930
return -EMSGSIZE;
931931
}
@@ -1021,7 +1021,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
10211021
}
10221022

10231023
skb->protocol = eth_type_trans(skb, geneve->dev);
1024-
netif_rx(skb);
1024+
__netif_rx(skb);
10251025
dst_release(dst);
10261026
return -EMSGSIZE;
10271027
}

drivers/net/gtp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static int gtp_rx(struct pdp_ctx *pctx, struct sk_buff *skb,
207207

208208
dev_sw_netstats_rx_add(pctx->dev, skb->len);
209209

210-
netif_rx(skb);
210+
__netif_rx(skb);
211211
return 0;
212212

213213
err:

drivers/net/loopback.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,
7878

7979
skb_orphan(skb);
8080

81-
/* Before queueing this packet to netif_rx(),
81+
/* Before queueing this packet to __netif_rx(),
8282
* make sure dst is refcounted.
8383
*/
8484
skb_dst_force(skb);
8585

8686
skb->protocol = eth_type_trans(skb, dev);
8787

8888
len = skb->len;
89-
if (likely(netif_rx(skb) == NET_RX_SUCCESS))
89+
if (likely(__netif_rx(skb) == NET_RX_SUCCESS))
9090
dev_lstats_add(dev, len);
9191

9292
return NETDEV_TX_OK;

drivers/net/macsec.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ static enum rx_handler_result handle_not_macsec(struct sk_buff *skb)
10331033
else
10341034
nskb->pkt_type = PACKET_MULTICAST;
10351035

1036-
netif_rx(nskb);
1036+
__netif_rx(nskb);
10371037
}
10381038
continue;
10391039
}
@@ -1056,7 +1056,7 @@ static enum rx_handler_result handle_not_macsec(struct sk_buff *skb)
10561056

10571057
nskb->dev = ndev;
10581058

1059-
if (netif_rx(nskb) == NET_RX_SUCCESS) {
1059+
if (__netif_rx(nskb) == NET_RX_SUCCESS) {
10601060
u64_stats_update_begin(&secy_stats->syncp);
10611061
secy_stats->stats.InPktsUntagged++;
10621062
u64_stats_update_end(&secy_stats->syncp);
@@ -1288,7 +1288,7 @@ static rx_handler_result_t macsec_handle_frame(struct sk_buff **pskb)
12881288

12891289
macsec_reset_skb(nskb, macsec->secy.netdev);
12901290

1291-
ret = netif_rx(nskb);
1291+
ret = __netif_rx(nskb);
12921292
if (ret == NET_RX_SUCCESS) {
12931293
u64_stats_update_begin(&secy_stats->syncp);
12941294
secy_stats->stats.InPktsUnknownSCI++;

drivers/net/macvlan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ static void macvlan_forward_source_one(struct sk_buff *skb,
410410
if (ether_addr_equal_64bits(eth_hdr(skb)->h_dest, dev->dev_addr))
411411
nskb->pkt_type = PACKET_HOST;
412412

413-
ret = netif_rx(nskb);
413+
ret = __netif_rx(nskb);
414414
macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, false);
415415
}
416416

@@ -468,7 +468,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
468468
/* forward to original port. */
469469
vlan = src;
470470
ret = macvlan_broadcast_one(skb, vlan, eth, 0) ?:
471-
netif_rx(skb);
471+
__netif_rx(skb);
472472
handle_res = RX_HANDLER_CONSUMED;
473473
goto out;
474474
}

drivers/net/mhi_net.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
225225
u64_stats_inc(&mhi_netdev->stats.rx_packets);
226226
u64_stats_add(&mhi_netdev->stats.rx_bytes, skb->len);
227227
u64_stats_update_end(&mhi_netdev->stats.rx_syncp);
228-
netif_rx(skb);
228+
__netif_rx(skb);
229229
}
230230

231231
/* Refill if RX buffers queue becomes low */

drivers/net/ntb_netdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data,
119119
skb->protocol = eth_type_trans(skb, ndev);
120120
skb->ip_summed = CHECKSUM_NONE;
121121

122-
if (netif_rx(skb) == NET_RX_DROP) {
122+
if (__netif_rx(skb) == NET_RX_DROP) {
123123
ndev->stats.rx_errors++;
124124
ndev->stats.rx_dropped++;
125125
} else {

drivers/net/rionet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static int rionet_rx_clean(struct net_device *ndev)
109109
skb_put(rnet->rx_skb[i], RIO_MAX_MSG_SIZE);
110110
rnet->rx_skb[i]->protocol =
111111
eth_type_trans(rnet->rx_skb[i], ndev);
112-
error = netif_rx(rnet->rx_skb[i]);
112+
error = __netif_rx(rnet->rx_skb[i]);
113113

114114
if (error == NET_RX_DROP) {
115115
ndev->stats.rx_dropped++;

drivers/net/sb1000.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ printk("cm0: IP identification: %02x%02x fragment offset: %02x%02x\n", buffer[3
872872

873873
/* datagram completed: send to upper level */
874874
skb_trim(skb, dlen);
875-
netif_rx(skb);
875+
__netif_rx(skb);
876876
stats->rx_bytes+=dlen;
877877
stats->rx_packets++;
878878
lp->rx_skb[ns] = NULL;

drivers/net/veth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static int veth_forward_skb(struct net_device *dev, struct sk_buff *skb,
287287
{
288288
return __dev_forward_skb(dev, skb) ?: xdp ?
289289
veth_xdp_rx(rq, skb) :
290-
netif_rx(skb);
290+
__netif_rx(skb);
291291
}
292292

293293
/* return true if the specified skb has chances of GRO aggregation

drivers/net/vrf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ static int vrf_local_xmit(struct sk_buff *skb, struct net_device *dev,
418418

419419
skb->protocol = eth_type_trans(skb, dev);
420420

421-
if (likely(netif_rx(skb) == NET_RX_SUCCESS))
421+
if (likely(__netif_rx(skb) == NET_RX_SUCCESS))
422422
vrf_rx_stats(dev, len);
423423
else
424424
this_cpu_inc(dev->dstats->rx_drps);

drivers/net/vxlan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2541,7 +2541,7 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
25412541
tx_stats->tx_bytes += len;
25422542
u64_stats_update_end(&tx_stats->syncp);
25432543

2544-
if (netif_rx(skb) == NET_RX_SUCCESS) {
2544+
if (__netif_rx(skb) == NET_RX_SUCCESS) {
25452545
u64_stats_update_begin(&rx_stats->syncp);
25462546
rx_stats->rx_packets++;
25472547
rx_stats->rx_bytes += len;

include/linux/netdevice.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3672,8 +3672,18 @@ u32 bpf_prog_run_generic_xdp(struct sk_buff *skb, struct xdp_buff *xdp,
36723672
void generic_xdp_tx(struct sk_buff *skb, struct bpf_prog *xdp_prog);
36733673
int do_xdp_generic(struct bpf_prog *xdp_prog, struct sk_buff *skb);
36743674
int netif_rx(struct sk_buff *skb);
3675-
int netif_rx_ni(struct sk_buff *skb);
3676-
int netif_rx_any_context(struct sk_buff *skb);
3675+
int __netif_rx(struct sk_buff *skb);
3676+
3677+
static inline int netif_rx_ni(struct sk_buff *skb)
3678+
{
3679+
return netif_rx(skb);
3680+
}
3681+
3682+
static inline int netif_rx_any_context(struct sk_buff *skb)
3683+
{
3684+
return netif_rx(skb);
3685+
}
3686+
36773687
int netif_receive_skb(struct sk_buff *skb);
36783688
int netif_receive_skb_core(struct sk_buff *skb);
36793689
void netif_receive_skb_list_internal(struct list_head *head);

include/trace/events/net.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,6 @@ DEFINE_EVENT(net_dev_rx_verbose_template, netif_rx_entry,
260260
TP_ARGS(skb)
261261
);
262262

263-
DEFINE_EVENT(net_dev_rx_verbose_template, netif_rx_ni_entry,
264-
265-
TP_PROTO(const struct sk_buff *skb),
266-
267-
TP_ARGS(skb)
268-
);
269-
270263
DECLARE_EVENT_CLASS(net_dev_rx_exit_template,
271264

272265
TP_PROTO(int ret),
@@ -312,13 +305,6 @@ DEFINE_EVENT(net_dev_rx_exit_template, netif_rx_exit,
312305
TP_ARGS(ret)
313306
);
314307

315-
DEFINE_EVENT(net_dev_rx_exit_template, netif_rx_ni_exit,
316-
317-
TP_PROTO(int ret),
318-
319-
TP_ARGS(ret)
320-
);
321-
322308
DEFINE_EVENT(net_dev_rx_exit_template, netif_receive_skb_list_exit,
323309

324310
TP_PROTO(int ret),

0 commit comments

Comments
 (0)