Skip to content

Commit e83fabb

Browse files
Wei Fangkuba-moo
authored andcommitted
net: fec: add exception tracing for XDP
As we already added the exception tracing for XDP_TX, I think it is necessary to add the exception tracing for other XDP actions, such as XDP_REDIRECT, XDP_ABORTED and unknown error actions. Signed-off-by: Wei Fang <wei.fang@nxp.com> Suggested-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://lore.kernel.org/r/20230822065255.606739-1-wei.fang@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 664c84c commit e83fabb

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,25 +1583,18 @@ fec_enet_run_xdp(struct fec_enet_private *fep, struct bpf_prog *prog,
15831583
case XDP_REDIRECT:
15841584
rxq->stats[RX_XDP_REDIRECT]++;
15851585
err = xdp_do_redirect(fep->netdev, xdp, prog);
1586-
if (!err) {
1587-
ret = FEC_ENET_XDP_REDIR;
1588-
} else {
1589-
ret = FEC_ENET_XDP_CONSUMED;
1590-
page = virt_to_head_page(xdp->data);
1591-
page_pool_put_page(rxq->page_pool, page, sync, true);
1592-
}
1586+
if (unlikely(err))
1587+
goto xdp_err;
1588+
1589+
ret = FEC_ENET_XDP_REDIR;
15931590
break;
15941591

15951592
case XDP_TX:
15961593
err = fec_enet_xdp_tx_xmit(fep, cpu, xdp, sync);
1597-
if (unlikely(err)) {
1598-
ret = FEC_ENET_XDP_CONSUMED;
1599-
page = virt_to_head_page(xdp->data);
1600-
page_pool_put_page(rxq->page_pool, page, sync, true);
1601-
trace_xdp_exception(fep->netdev, prog, act);
1602-
} else {
1603-
ret = FEC_ENET_XDP_TX;
1604-
}
1594+
if (unlikely(err))
1595+
goto xdp_err;
1596+
1597+
ret = FEC_ENET_XDP_TX;
16051598
break;
16061599

16071600
default:
@@ -1613,9 +1606,12 @@ fec_enet_run_xdp(struct fec_enet_private *fep, struct bpf_prog *prog,
16131606

16141607
case XDP_DROP:
16151608
rxq->stats[RX_XDP_DROP]++;
1609+
xdp_err:
16161610
ret = FEC_ENET_XDP_CONSUMED;
16171611
page = virt_to_head_page(xdp->data);
16181612
page_pool_put_page(rxq->page_pool, page, sync, true);
1613+
if (act != XDP_DROP)
1614+
trace_xdp_exception(fep->netdev, prog, act);
16191615
break;
16201616
}
16211617

0 commit comments

Comments
 (0)