mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 11:33:58 -04:00
bnxt_en: Linearize TX SKB if the fragments exceed the max
If skb_shinfo(skb)->nr_frags excceds what the chip can support,
linearize the SKB and warn once to let the user know.
net.core.max_skb_frags can be lowered, for example, to avoid the
issue.
Fixes: 3948b05950 ("net: introduce a config option to tweak MAX_SKB_FRAGS")
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250321211639.3812992-3-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
107b25db61
commit
b91e821294
@@ -485,6 +485,17 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
txr = &bp->tx_ring[bp->tx_ring_map[i]];
|
||||
prod = txr->tx_prod;
|
||||
|
||||
#if (MAX_SKB_FRAGS > TX_MAX_FRAGS)
|
||||
if (skb_shinfo(skb)->nr_frags > TX_MAX_FRAGS) {
|
||||
netdev_warn_once(dev, "SKB has too many (%d) fragments, max supported is %d. SKB will be linearized.\n",
|
||||
skb_shinfo(skb)->nr_frags, TX_MAX_FRAGS);
|
||||
if (skb_linearize(skb)) {
|
||||
dev_kfree_skb_any(skb);
|
||||
dev_core_stats_tx_dropped_inc(dev);
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
free_size = bnxt_tx_avail(bp, txr);
|
||||
if (unlikely(free_size < skb_shinfo(skb)->nr_frags + 2)) {
|
||||
/* We must have raced with NAPI cleanup */
|
||||
|
||||
@@ -84,6 +84,10 @@ struct tx_bd {
|
||||
|
||||
#define TX_BD_CNT(n) (((n) << TX_BD_FLAGS_BD_CNT_SHIFT) & TX_BD_FLAGS_BD_CNT)
|
||||
|
||||
#define TX_MAX_BD_CNT 32
|
||||
|
||||
#define TX_MAX_FRAGS (TX_MAX_BD_CNT - 2)
|
||||
|
||||
struct tx_bd_ext {
|
||||
__le32 tx_bd_hsize_lflags;
|
||||
#define TX_BD_FLAGS_TCP_UDP_CHKSUM (1 << 0)
|
||||
|
||||
Reference in New Issue
Block a user