public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google•com>
To: "David S . Miller" <davem@davemloft•net>,
	Jakub Kicinski <kuba@kernel•org>, Paolo Abeni <pabeni@redhat•com>
Cc: Tariq Toukan <tariqt@nvidia•com>,
	Leon Romanovsky <leonro@nvidia•com>,
	netdev@vger•kernel.org, eric.dumazet@gmail•com,
	Eric Dumazet <edumazet@google•com>, Wei Wang <weiwan@google•com>
Subject: [PATCH v2 net-next 3/3] net/mlx4: small optimization in mlx4_en_xmit()
Date: Wed,  7 Dec 2022 14:12:37 +0000	[thread overview]
Message-ID: <20221207141237.2575012-4-edumazet@google.com> (raw)
In-Reply-To: <20221207141237.2575012-1-edumazet@google.com>

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(-)

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;
-- 
2.39.0.rc0.267.gcb52ba06e7-goog


  parent reply	other threads:[~2022-12-07 14:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 14:12 [PATCH v2 net-next 0/3] mlx4: better BIG-TCP support Eric Dumazet
2022-12-07 14:12 ` [PATCH v2 net-next 1/3] net/mlx4: rename two constants Eric Dumazet
2022-12-07 18:53   ` Tariq Toukan
2022-12-07 14:12 ` [PATCH v2 net-next 2/3] net/mlx4: MLX4_TX_BOUNCE_BUFFER_SIZE depends on MAX_SKB_FRAGS Eric Dumazet
2022-12-07 18:53   ` Tariq Toukan
2022-12-07 14:12 ` Eric Dumazet [this message]
2022-12-07 18:54   ` [PATCH v2 net-next 3/3] net/mlx4: small optimization in mlx4_en_xmit() Tariq Toukan
2022-12-08 22:30 ` [PATCH v2 net-next 0/3] mlx4: better BIG-TCP support patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221207141237.2575012-4-edumazet@google.com \
    --to=edumazet@google$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=eric.dumazet@gmail$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=leonro@nvidia$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    --cc=tariqt@nvidia$(echo .)com \
    --cc=weiwan@google$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox