Message ID | 20221207141237.2575012-4-edumazet@google.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 0e706f7961a44f4be13cf9b5eedb70f0ab2724b8 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | mlx4: better BIG-TCP support | expand |
On 12/7/2022 4:12 PM, Eric Dumazet wrote: > Test against MLX4_MAX_DESC_TXBBS only matters if the TX > bounce buffer is going to be used. > > Signed-off-by: Eric Dumazet <edumazet@google.com> > Cc: Tariq Toukan <tariqt@nvidia.com> > Cc: Wei Wang <weiwan@google.com> > --- > drivers/net/ethernet/mellanox/mlx4/en_tx.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 8372aeb392a28cf36a454e1b8a4783bc2b2056eb..c5758637b7bed67021a9f3e9c5283033f68639a3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c @@ -911,11 +911,6 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) /* Align descriptor to TXBB size */ desc_size = ALIGN(real_size, TXBB_SIZE); nr_txbb = desc_size >> LOG_TXBB_SIZE; - if (unlikely(nr_txbb > MLX4_MAX_DESC_TXBBS)) { - if (netif_msg_tx_err(priv)) - en_warn(priv, "Oversized header or SG list\n"); - goto tx_drop_count; - } bf_ok = ring->bf_enabled; if (skb_vlan_tag_present(skb)) { @@ -943,6 +938,11 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) if (likely(index + nr_txbb <= ring->size)) tx_desc = ring->buf + (index << LOG_TXBB_SIZE); else { + if (unlikely(nr_txbb > MLX4_MAX_DESC_TXBBS)) { + if (netif_msg_tx_err(priv)) + en_warn(priv, "Oversized header or SG list\n"); + goto tx_drop_count; + } tx_desc = (struct mlx4_en_tx_desc *) ring->bounce_buf; bounce = true; bf_ok = false;
Test against MLX4_MAX_DESC_TXBBS only matters if the TX bounce buffer is going to be used. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Tariq Toukan <tariqt@nvidia.com> Cc: Wei Wang <weiwan@google.com> --- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)