Skip to content

Commit f6c10b4

Browse files
magnus-karlssonanguy11
authored andcommitted
i40e: add correct exception tracing for XDP
Add missing exception tracing to XDP when a number of different errors can occur. The support was only partial. Several errors where not logged which would confuse the user quite a lot not knowing where and why the packets disappeared. Fixes: 74608d1 ("i40e: add support for XDP_TX action") Fixes: 0a71418 ("i40e: add AF_XDP zero-copy Rx support") Reported-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Tested-by: Kiran Bhandare <kiranx.bhandare@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 5379260 commit f6c10b4

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2313,15 +2313,20 @@ static int i40e_run_xdp(struct i40e_ring *rx_ring, struct xdp_buff *xdp)
23132313
case XDP_TX:
23142314
xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index];
23152315
result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring);
2316+
if (result == I40E_XDP_CONSUMED)
2317+
goto out_failure;
23162318
break;
23172319
case XDP_REDIRECT:
23182320
err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
2319-
result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED;
2321+
if (err)
2322+
goto out_failure;
2323+
result = I40E_XDP_REDIR;
23202324
break;
23212325
default:
23222326
bpf_warn_invalid_xdp_action(act);
23232327
fallthrough;
23242328
case XDP_ABORTED:
2329+
out_failure:
23252330
trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
23262331
fallthrough; /* handle aborts by dropping packet */
23272332
case XDP_DROP:

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,10 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp)
162162

163163
if (likely(act == XDP_REDIRECT)) {
164164
err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
165-
result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED;
165+
if (err)
166+
goto out_failure;
166167
rcu_read_unlock();
167-
return result;
168+
return I40E_XDP_REDIR;
168169
}
169170

170171
switch (act) {
@@ -173,11 +174,14 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp)
173174
case XDP_TX:
174175
xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index];
175176
result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring);
177+
if (result == I40E_XDP_CONSUMED)
178+
goto out_failure;
176179
break;
177180
default:
178181
bpf_warn_invalid_xdp_action(act);
179182
fallthrough;
180183
case XDP_ABORTED:
184+
out_failure:
181185
trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
182186
fallthrough; /* handle aborts by dropping packet */
183187
case XDP_DROP:

0 commit comments

Comments
 (0)