From patchwork Tue Dec 6 05:50:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13065427 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D4FBC47090 for ; Tue, 6 Dec 2022 05:51:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231978AbiLFFvL (ORCPT ); Tue, 6 Dec 2022 00:51:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbiLFFvI (ORCPT ); Tue, 6 Dec 2022 00:51:08 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A742E18E33 for ; Mon, 5 Dec 2022 21:51:04 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-352e29ff8c2so146837797b3.21 for ; Mon, 05 Dec 2022 21:51:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=DH6jzHsVpI9ObruTmkI1ZuAZiR6+TqqdR1QCaKU3mKw=; b=tVgZJhEiWbYJ+dIZchhHLaASX0VcJj2NxcAlxyqvlryynHCgcFWA/hmQlPhJGqlQrm MjS5Ey+dHCNUWCW1cpSbA1gOu1SahNPEj1IdDvsxOXFfzMhxHewDqxBgPoIDv4SYIC9M xQ+60fuHYDoyKGDZQOBDKlh2fOF0YFyD8eBDjPbP0y6lQeEnd2ISqGxQO6rxp6pNc8ch irdw2zO93bk09vhkm/TrmDz3Bb6/WXGeq9HLrCn8+u3XqfrRkgsjYYak11xK+iG12k1x 4ZUKPg02iOMYH+7mARIyVxsblnMqM0TxxFuuRYOFi/soMPqcfniR7Dk0odFompcOGhAv pXfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DH6jzHsVpI9ObruTmkI1ZuAZiR6+TqqdR1QCaKU3mKw=; b=54x/0fm3uFLvTzotA3sIEklCNb8Yp0nxx+2gDr2HC31dwd87ReUwRyCIbYDVIEwRYH FR2SlMHqoeLY+kfSl2nc51N62TpXCDU9NOuP2WnhdhrVqpZoPDY67QMWYynLkkfuzXV1 tz/dkO2yt6ZdDNDAoOyzdNCrm4sw0yNvMZfvFebbTQ4rJzREQ1Xv1/UCn9R2wzJ4cr25 4txFpExNx/6gAI4McquRNvjalF1+vAzZXSklhH01V/LqgMlLoClGkhpPKfli3QlVNkEU ISJjS82jeS867VnSryY4LRhpHNvfMWFVCJ/uO4k2JYpfLFTYQQdYBFU/q9/nSvqWZCHX n8dA== X-Gm-Message-State: ANoB5plUfPbF1ms06zlOhkPwk3+BZwijdhQ7XzQ15GjZofvGiGcQqg2R 5Od89El1qs9+FWKaIQihMZZfg8c5wXd22A== X-Google-Smtp-Source: AA0mqf5PQpX7rBNzIY6VsB0l00/fTQR2Ld7OP81ywF1LYZxGGBcqj7S25wNVTfXbBroudJaGjVgjEtzJ337bTg== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a25:7648:0:b0:6fe:54d5:2524 with SMTP id r69-20020a257648000000b006fe54d52524mr13061842ybc.522.1670305863932; Mon, 05 Dec 2022 21:51:03 -0800 (PST) Date: Tue, 6 Dec 2022 05:50:57 +0000 In-Reply-To: <20221206055059.1877471-1-edumazet@google.com> Mime-Version: 1.0 References: <20221206055059.1877471-1-edumazet@google.com> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog Message-ID: <20221206055059.1877471-2-edumazet@google.com> Subject: [PATCH net-next 1/3] net/mlx4: rename two constants From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Tariq Toukan , Wei Wang , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org MAX_DESC_SIZE is really the size of the bounce buffer used when reaching the right side of TX ring buffer. MAX_DESC_TXBBS get a MLX4_ prefix. Signed-off-by: Eric Dumazet Cc: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 10 ++++++---- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 43a4102e9c091758b33aa7377dcb82cab7c43a94..8372aeb392a28cf36a454e1b8a4783bc2b2056eb 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c @@ -65,7 +65,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, ring->size = size; ring->size_mask = size - 1; ring->sp_stride = stride; - ring->full_size = ring->size - HEADROOM - MAX_DESC_TXBBS; + ring->full_size = ring->size - HEADROOM - MLX4_MAX_DESC_TXBBS; tmp = size * sizeof(struct mlx4_en_tx_info); ring->tx_info = kvmalloc_node(tmp, GFP_KERNEL, node); @@ -77,9 +77,11 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, en_dbg(DRV, priv, "Allocated tx_info ring at addr:%p size:%d\n", ring->tx_info, tmp); - ring->bounce_buf = kmalloc_node(MAX_DESC_SIZE, GFP_KERNEL, node); + ring->bounce_buf = kmalloc_node(MLX4_TX_BOUNCE_BUFFER_SIZE, + GFP_KERNEL, node); if (!ring->bounce_buf) { - ring->bounce_buf = kmalloc(MAX_DESC_SIZE, GFP_KERNEL); + ring->bounce_buf = kmalloc(MLX4_TX_BOUNCE_BUFFER_SIZE, + GFP_KERNEL); if (!ring->bounce_buf) { err = -ENOMEM; goto err_info; @@ -909,7 +911,7 @@ 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 > MAX_DESC_TXBBS)) { + 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; diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index e132ff4c82f2d33045f6c9aeecaaa409a41e0b0d..7cc288db2a64f75ffe64882e3c25b90715e68855 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h @@ -90,8 +90,8 @@ #define MLX4_EN_FILTER_EXPIRY_QUOTA 60 /* Typical TSO descriptor with 16 gather entries is 352 bytes... */ -#define MAX_DESC_SIZE 512 -#define MAX_DESC_TXBBS (MAX_DESC_SIZE / TXBB_SIZE) +#define MLX4_TX_BOUNCE_BUFFER_SIZE 512 +#define MLX4_MAX_DESC_TXBBS (MLX4_TX_BOUNCE_BUFFER_SIZE / TXBB_SIZE) /* * OS related constants and tunables From patchwork Tue Dec 6 05:50:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13065428 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38DB1C3A5A7 for ; Tue, 6 Dec 2022 05:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232702AbiLFFvN (ORCPT ); Tue, 6 Dec 2022 00:51:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230289AbiLFFvI (ORCPT ); Tue, 6 Dec 2022 00:51:08 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8086C1BE86 for ; Mon, 5 Dec 2022 21:51:06 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-3b0af5bcbd3so144349637b3.0 for ; Mon, 05 Dec 2022 21:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=yhKQ0tJxGEWIlA44fnQ1gEcdOhETqpVQAxs5YblPxEU=; b=C+R8/zr0XC8Sy7Xh3BahNx86YGafdgh8REpEe9l/ms9B57Gyyq1zSOprpd2TofRJkL AzmV989Z4UxE19kpn/bdRbccoCe1wmIsLIyJpEPWC+oeH433+L6g/Sw++Wu79OlMm3hQ IauVWz6vJGv+yFc8IGnTr4/v98iEI5J4n1aalS+Mbk77yGL071p4sK13RLbhEqq9t6gL mQadlFXtVEiwFCltwkrmeRkVQTci+cCNaMKl1cO+n/Ff1iCLm3wHuCsux/3ltWK/6ruu zrVr154AQ3/RmEC1SUz/ooAEHl5NwvgJnT/iOqECyFRSmuufQ6nQ5oipnUUhnH7dYzVy vAXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yhKQ0tJxGEWIlA44fnQ1gEcdOhETqpVQAxs5YblPxEU=; b=V+mGESJdQjVkrXwpMztA1bOpNT3Xm9+z3krMHSWpFzi528H4abWGoNmrs+huHKDeUF SPNjEkDZfs1izkKk9Xb64xfLuRpY8s54duyRZsFgsrEv3phdsNxoy/Y/m4+NgpptspWP jcr+LCr5zPfdxPFuxKYzbhaG1wQOXZNH9zsXlrx9m/o/dl6z2tj7WVM29kJeISksOJ+Y cTDhd+99lNCtGbCE3Ij/MrC1tJ/zoG1e1dWfPWOIAqwtVKfQuHtmzp2HBhccvJXpH21K 1YFfEpul4rIi3SxoXGhY69SH/UtXt7ANAYa/sroGt1GAHx6cIMzAhz4KstfBflkEcV06 QwvQ== X-Gm-Message-State: ANoB5pk5HF66tpQWvSwXCy5CGoHzC7qJrttKA9FsAR5yRc9nLW+vWraK LvAF1Ci25Dz1cg9ERK/EyZmyJqLrNEMFVQ== X-Google-Smtp-Source: AA0mqf51PLM8MQo60nNjP5Y2mrOLJjt5pR6z14XA30zMyrTLn0YF55NxjK9OIirbsJ9APJ+LMotu0ZBm4B8g1A== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a25:29c2:0:b0:6f8:bc8c:445f with SMTP id p185-20020a2529c2000000b006f8bc8c445fmr30592262ybp.142.1670305865845; Mon, 05 Dec 2022 21:51:05 -0800 (PST) Date: Tue, 6 Dec 2022 05:50:58 +0000 In-Reply-To: <20221206055059.1877471-1-edumazet@google.com> Mime-Version: 1.0 References: <20221206055059.1877471-1-edumazet@google.com> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog Message-ID: <20221206055059.1877471-3-edumazet@google.com> Subject: [PATCH net-next 2/3] net/mlx4: MLX4_TX_BOUNCE_BUFFER_SIZE depends on MAX_SKB_FRAGS From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Tariq Toukan , Wei Wang , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Google production kernel has increased MAX_SKB_FRAGS to 45 for BIG-TCP rollout. Unfortunately mlx4 TX bounce buffer is not big enough whenever an skb has up to 45 page fragments. This can happen often with TCP TX zero copy, as one frag usually holds 4096 bytes of payload (order-0 page). Tested: Kernel built with MAX_SKB_FRAGS=45 ip link set dev eth0 gso_max_size 185000 netperf -t TCP_SENDFILE I made sure that "ethtool -G eth0 tx 64" was properly working, ring->full_size being set to 16. Signed-off-by: Eric Dumazet Reported-by: Wei Wang Cc: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 7cc288db2a64f75ffe64882e3c25b90715e68855..120b8c361e91d443f83f100a1afabcabc776a92a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h @@ -89,8 +89,18 @@ #define MLX4_EN_FILTER_HASH_SHIFT 4 #define MLX4_EN_FILTER_EXPIRY_QUOTA 60 -/* Typical TSO descriptor with 16 gather entries is 352 bytes... */ -#define MLX4_TX_BOUNCE_BUFFER_SIZE 512 +#define CTRL_SIZE sizeof(struct mlx4_wqe_ctrl_seg) +#define DS_SIZE sizeof(struct mlx4_wqe_data_seg) + +/* Maximal size of the bounce buffer: + * 256 bytes for LSO headers. + * CTRL_SIZE for control desc. + * DS_SIZE if skb->head contains some payload. + * MAX_SKB_FRAGS frags. + */ +#define MLX4_TX_BOUNCE_BUFFER_SIZE (256 + CTRL_SIZE + DS_SIZE + \ + MAX_SKB_FRAGS * DS_SIZE) + #define MLX4_MAX_DESC_TXBBS (MLX4_TX_BOUNCE_BUFFER_SIZE / TXBB_SIZE) /* @@ -217,9 +227,7 @@ struct mlx4_en_tx_info { #define MLX4_EN_BIT_DESC_OWN 0x80000000 -#define CTRL_SIZE sizeof(struct mlx4_wqe_ctrl_seg) #define MLX4_EN_MEMTYPE_PAD 0x100 -#define DS_SIZE sizeof(struct mlx4_wqe_data_seg) struct mlx4_en_tx_desc { From patchwork Tue Dec 6 05:50:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13065429 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEDD0C352A1 for ; Tue, 6 Dec 2022 05:51:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233169AbiLFFvQ (ORCPT ); Tue, 6 Dec 2022 00:51:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232490AbiLFFvJ (ORCPT ); Tue, 6 Dec 2022 00:51:09 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 699B724F28 for ; Mon, 5 Dec 2022 21:51:08 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-3b4eb124be5so145253487b3.19 for ; Mon, 05 Dec 2022 21:51:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=8Eaz0b8Ne/t46erZUnPI8xk8Al1zhW7z2bfzwuvD1jY=; b=KhjtyohXRm4vmy41VKIyr/YjitqwVUnmF3QosxPzbadppjUKBHMKCYhXZxy6USf9Ey miAu1W+4JI+hCa9FEbcapNo7Y9NI4scRQppi/bT+5iyzfGtpRTVW03SWvKLiI7gsB83S wBAGt2Ba9iZQ5BXyaBXlszKAR4R8IG4qJCCLqHnSt5M3SaEy1xSfJGuqQdXD7snLuBMA SW6ggdHbIyjfev6E29Q4Drv7NoWnaTWvVkdYCHtLJF5jsR1pQQcmwnr8S44R/IqieO5X 3nI6CcFKDVfgh9eBlcJtAbGMNGSv7+PqWhaMZDHPH6WMNlMW2wJiFRFJRRBDKaOwPrsH 5zMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8Eaz0b8Ne/t46erZUnPI8xk8Al1zhW7z2bfzwuvD1jY=; b=GIWUwMTYesOurL7frrxvvcHe4+3qERgY1V/6y36B4yekmIaVSelAltHYfkfhRXKeFs 6mZjohawCdyH1316L4lE1oa0m1Eib0q/BWdRnn6yvNq23QVtFUFRG+nI2ZNhyQ3l6/rZ ad29pgGwx68FU6Hgza3vwzjTT1akwQtpdsNfWUDE4xCzJBQHN56QnUVY+4VMf3mqX05+ SJDvOCuXfmITiQkpUev+3PyVkkZuXaJLiWQSc7sZeJbWVmR6XydF99cQ5YpWJxIoy4JT FwnRv6WhAwcCfZ+J1EHst1Pvzbau1H481jZuwqCz2opNU3Een3JHie0IW0Bp4gkk8w0L Tbcw== X-Gm-Message-State: ANoB5pna4ijfvkjSCSDCCLFUXLCKFzS8XQgfGQXx0WxCDmQNfoD+5S1c NTDtzJlPv14GYymwZIaSjgWo1qzbWCvnSg== X-Google-Smtp-Source: AA0mqf5I+gsHsK4CnZpBBmKOljcn2UeG7pPHmJc7knAZeFZkV2nqe28vANEQ4IWC1ujh+/crozJj3ZAPMSDTrg== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a25:c6c2:0:b0:6f0:b351:c300 with SMTP id k185-20020a25c6c2000000b006f0b351c300mr54518270ybf.102.1670305867764; Mon, 05 Dec 2022 21:51:07 -0800 (PST) Date: Tue, 6 Dec 2022 05:50:59 +0000 In-Reply-To: <20221206055059.1877471-1-edumazet@google.com> Mime-Version: 1.0 References: <20221206055059.1877471-1-edumazet@google.com> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog Message-ID: <20221206055059.1877471-4-edumazet@google.com> Subject: [PATCH net-next 3/3] net/mlx4: small optimization in mlx4_en_xmit() From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Tariq Toukan , Wei Wang , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Test against MLX4_MAX_DESC_TXBBS only matters if the TX bounce buffer is going to be used. Signed-off-by: Eric Dumazet Cc: Tariq Toukan Cc: Wei Wang --- 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;