Skip to content

Commit 31b9998

Browse files
CCX-Stingraydavem330
authored andcommitted
bnxt: set xdp_buff pfmemalloc flag if needed
Set the pfmemaloc flag in the xdp buff so that this can be copied to the skb if needed for an XDP_PASS action. Signed-off-by: Andy Gospodarek <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4c6c123 commit 31b9998

File tree

1 file changed

+9
-5
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+9
-5
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,8 @@ static struct sk_buff *bnxt_rx_skb(struct bnxt *bp,
10411041
static u32 __bnxt_rx_agg_pages(struct bnxt *bp,
10421042
struct bnxt_cp_ring_info *cpr,
10431043
struct skb_shared_info *shinfo,
1044-
u16 idx, u32 agg_bufs, bool tpa)
1044+
u16 idx, u32 agg_bufs, bool tpa,
1045+
struct xdp_buff *xdp)
10451046
{
10461047
struct bnxt_napi *bnapi = cpr->bnapi;
10471048
struct pci_dev *pdev = bp->pdev;
@@ -1084,6 +1085,9 @@ static u32 __bnxt_rx_agg_pages(struct bnxt *bp,
10841085
page = cons_rx_buf->page;
10851086
cons_rx_buf->page = NULL;
10861087

1088+
if (xdp && page_is_pfmemalloc(page))
1089+
xdp_buff_set_frag_pfmemalloc(xdp);
1090+
10871091
if (bnxt_alloc_rx_page(bp, rxr, prod, GFP_ATOMIC) != 0) {
10881092
unsigned int nr_frags;
10891093

@@ -1118,8 +1122,8 @@ static struct sk_buff *bnxt_rx_agg_pages_skb(struct bnxt *bp,
11181122
struct skb_shared_info *shinfo = skb_shinfo(skb);
11191123
u32 total_frag_len = 0;
11201124

1121-
total_frag_len = __bnxt_rx_agg_pages(bp, cpr, shinfo, idx, agg_bufs, tpa);
1122-
1125+
total_frag_len = __bnxt_rx_agg_pages(bp, cpr, shinfo, idx,
1126+
agg_bufs, tpa, NULL);
11231127
if (!total_frag_len) {
11241128
dev_kfree_skb(skb);
11251129
return NULL;
@@ -1142,8 +1146,8 @@ static u32 bnxt_rx_agg_pages_xdp(struct bnxt *bp,
11421146
if (!xdp_buff_has_frags(xdp))
11431147
shinfo->nr_frags = 0;
11441148

1145-
total_frag_len = __bnxt_rx_agg_pages(bp, cpr, shinfo, idx, agg_bufs, tpa);
1146-
1149+
total_frag_len = __bnxt_rx_agg_pages(bp, cpr, shinfo,
1150+
idx, agg_bufs, tpa, xdp);
11471151
if (total_frag_len) {
11481152
xdp_buff_set_frags_flag(xdp);
11491153
shinfo->nr_frags = agg_bufs;

0 commit comments

Comments
 (0)