Skip to content

Commit 8c49527

Browse files
committed
bnx2x: use the right build_skb() helper
build_skb() no longer accepts slab buffers. Since slab use is fairly uncommon we prefer the drivers to call a separate slab_build_skb() function appropriately. bnx2x uses the old semantics where size of 0 meant buffer from slab. It sets the fp->rx_frag_size to 0 for MTUs which don't fit in a page. It needs to call slab_build_skb(). This fixes the WARN_ONCE() of incorrect API use seen with bnx2x. Reported-by: Thomas Voegtle <[email protected]> Link: https://lore.kernel.org/all/[email protected]/ Fixes: ce098da ("skbuff: Introduce slab_build_skb()") Reviewed-by: Leon Romanovsky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 6c75dc9 commit 8c49527

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,18 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
672672
return 0;
673673
}
674674

675+
static struct sk_buff *
676+
bnx2x_build_skb(const struct bnx2x_fastpath *fp, void *data)
677+
{
678+
struct sk_buff *skb;
679+
680+
if (fp->rx_frag_size)
681+
skb = build_skb(data, fp->rx_frag_size);
682+
else
683+
skb = slab_build_skb(data);
684+
return skb;
685+
}
686+
675687
static void bnx2x_frag_free(const struct bnx2x_fastpath *fp, void *data)
676688
{
677689
if (fp->rx_frag_size)
@@ -779,7 +791,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
779791
dma_unmap_single(&bp->pdev->dev, dma_unmap_addr(rx_buf, mapping),
780792
fp->rx_buf_size, DMA_FROM_DEVICE);
781793
if (likely(new_data))
782-
skb = build_skb(data, fp->rx_frag_size);
794+
skb = bnx2x_build_skb(fp, data);
783795

784796
if (likely(skb)) {
785797
#ifdef BNX2X_STOP_ON_ERROR
@@ -1046,7 +1058,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
10461058
dma_unmap_addr(rx_buf, mapping),
10471059
fp->rx_buf_size,
10481060
DMA_FROM_DEVICE);
1049-
skb = build_skb(data, fp->rx_frag_size);
1061+
skb = bnx2x_build_skb(fp, data);
10501062
if (unlikely(!skb)) {
10511063
bnx2x_frag_free(fp, data);
10521064
bnx2x_fp_qstats(bp, fp)->

0 commit comments

Comments
 (0)