Skip to content

Commit

Permalink
bnxt: add flag to denote that an xdp program is currently attached
Browse files Browse the repository at this point in the history
This will be used to determine if bnxt_rx_xdp should be called
rather than calling it every time.

Signed-off-by: Andy Gospodarek <gospo@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
CCX-Stingray authored and davem330 committed Apr 8, 2022
1 parent b231c3f commit ee536dc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
struct bnxt_sw_rx_bd *rx_buf;
unsigned int len;
u8 *data_ptr, agg_bufs, cmp_type;
bool xdp_active = false;
dma_addr_t dma_addr;
struct sk_buff *skb;
struct xdp_buff xdp;
Expand Down Expand Up @@ -1842,11 +1843,17 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,

if (bnxt_xdp_attached(bp, rxr)) {
bnxt_xdp_buff_init(bp, rxr, cons, &data_ptr, &len, &xdp);
xdp_active = true;
}

/* skip running XDP prog if there are aggregation bufs */
if (!agg_bufs && xdp_active) {
if (bnxt_rx_xdp(bp, rxr, cons, xdp, data, &len, event)) {
rc = 1;
goto next_rx;
}
}

if (len <= bp->rx_copy_thresh) {
skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr);
bnxt_reuse_rx_data(rxr, cons, data);
Expand Down

0 comments on commit ee536dc

Please sign in to comment.