net/mlx4: small optimization in mlx4_en_xmit()
authorEric Dumazet <edumazet@google.com>
Wed, 7 Dec 2022 14:12:37 +0000 (14:12 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 8 Dec 2022 22:27:48 +0000 (14:27 -0800)
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: Wei Wang <weiwan@google.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx4/en_tx.c

index 8372aeb..c575863 100644 (file)
@@ -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;