Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] When CONFIG_MAX_SKB_FRAGS is raised, the patch keeps an skb
within the hardware's 32-BD-per-packet limit (TX_MAX_BD_CNT) with only…
--
eth: bnxt: split TX buffers that don't fit in a single BD
This patch splits TX buffers that are too long for the 16-bit BD length
field into multiple BDs of 0xF000 bytes. It also raises the minimum TX
ring size and the queue stop threshold to make room for the extra BDs.
When CONFIG_MAX_SKB_FRAGS is raised, it clears the GSO features in
bnxt_features_check() for skbs that would need more data BDs than one
packet can have.
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 85ce4b2e297ec..fae048021853d 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
[ ... ]
> @@ -14351,6 +14420,12 @@ static netdev_features_t bnxt_features_check(struct sk_buff *skb,
>
> features = vlan_features_check(skb, features);
>
> +#if (BNXT_TX_MAX_SKB_BDS > TX_MAX_BD_CNT)
> + /* Let the stack segment skbs that exceed the TX BD limit per packet. */
> + if (unlikely(bnxt_tx_nr_data_bds(skb) > TX_MAX_FRAGS))
> + features &= ~NETIF_F_GSO_MASK;
> +#endif
[Severity: High]
Can the BD count taken here end up one lower than the count that
bnxt_start_xmit() uses later?
validate_xmit_skb() computes the features before the software VLAN insert:
net/core/dev.c:validate_xmit_skb() {
...
features = netif_skb_features(skb);
skb = validate_xmit_vlan(skb, features);
...
}
TX VLAN insertion can be inactive on bnxt, either through
ethtool -K txvlan off or because firmware reports
VLAN_ACCELERATION_TX_DISABLED. In that case validate_xmit_vlan() calls
__vlan_hwaccel_push_inside(), which ends in skb_push(skb, VLAN_HLEN).
That makes skb_headlen() 4 bytes larger, after bnxt_features_check() has
already counted the BDs.
For example, take nr_frags == 30 and headlen == 65533.
bnxt_tx_nr_data_bds() returns 30 here. That is not greater than
TX_MAX_FRAGS, so GSO stays enabled. After the push, headlen is 65537 and
bnxt_tx_buf_extra_bds() adds one more BD. netif_needs_gso() uses the
stale features, so the skb is not segmented.
In bnxt_start_xmit(), the linearize check only looks at nr_frags. The
recomputed count is never compared with TX_MAX_FRAGS:
nr_bds = bnxt_tx_nr_data_bds(skb);
...
flags = (bnxt_tx_buf_first_bd_len(len) << TX_BD_LEN_SHIFT) |
TX_BD_TYPE_LONG_TX_BD | TX_BD_CNT(nr_bds + 2);
Here nr_bds is 31. TX_BD_CNT(33) is masked by TX_BD_FLAGS_BD_CNT
(0x1f << 8), so the long BD reports a count of 1 while 33 BDs are posted
for one packet. That is also more than the 32-BD limit per packet.
Would this hand the NIC the same kind of malformed descriptor chain the
patch is meant to prevent?
The check is compiled in whenever CONFIG_MAX_SKB_FRAGS >= 23. For 23 to
30 frags, bnxt_features_check() is the only guard against overflow caused
by splitting.
The v2 changelog removed the bound check in bnxt_start_xmit() because it
could not trigger. Should bnxt_features_check() add VLAN_HLEN when a
hwaccel tag will be pushed in software? Or should that check come back
in bnxt_start_xmit()?
With the default MAX_SKB_FRAGS of 17, this path doesn't look reachable.
An skb of up to GSO_MAX_SIZE needs at most 27 BDs.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40gmail.com