From patchwork Sun Sep 27 17:42:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 260081 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 901AFC4727F for ; Sun, 27 Sep 2020 17:43:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4BF0223976 for ; Sun, 27 Sep 2020 17:43:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="WefDOOMZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726562AbgI0RnA (ORCPT ); Sun, 27 Sep 2020 13:43:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726396AbgI0Rm6 (ORCPT ); Sun, 27 Sep 2020 13:42:58 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17316C0613CE for ; Sun, 27 Sep 2020 10:42:58 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id k8so7203880pfk.2 for ; Sun, 27 Sep 2020 10:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WClYeEX3Ae3O9Z6mMoxuef7JhHSIAu4fDjglccWWGXA=; b=WefDOOMZQ2g5f70EEEoVNJve5ZnybauelpmW7jCQeB3oBXquJn2kxqLFBho7SFN/+b 4KqTqzG4MwfLlK8vdsIm85CTEaHu+yopb4QLDZt1UKFDU4Dmmx+Jjl/SPY545I8FzyaY E1bBLKULGqNLTnmtJ0UuxWioV1JIPLvzBtl8A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WClYeEX3Ae3O9Z6mMoxuef7JhHSIAu4fDjglccWWGXA=; b=SdI+5O12PB/cs58ucY2Og4YceE14jVr9197qZK+j6IMHJgsfZooN7H48f8JTj8ybIk qQ30HwuP+uQbcbkjzw0Qx5nnQr3DJDoiqokwIjlxQMqgCQCTlVWTfLM77v2pH8dhXmQ1 KLIGBiSSWHNO74XUdFpHGlgznwMw8QY2tr2S8b1bIXKNZIbJWjUq1a3dKXw2Dob452tg IW0nV/183bBjy0ZFJQ2MpPcwLD8++uGYp1ALNTQE2hcKSSrVqy9Urc0Ig9QbaA5NGkm5 LD6ZxjKOvnuhUceIqqb6MY2blJYj0iiYCMwZ1eVNHD5K9xDRwnxFsjF17e+0g5POItE4 XLbA== X-Gm-Message-State: AOAM5312HORLb2fuyKpjLGCVYnaDR1SADruNwVFqD7F5DmZW+5/c621i 1jCEg+bfgOCUIzHT5n1gIkL0cg== X-Google-Smtp-Source: ABdhPJzIt6SvwWQHYWJeELRUiNNPb+nWH5vBxYtuy8LgXzTQzCB0A/BatahFj0Px6xbuVNbImyn4lA== X-Received: by 2002:aa7:9ad6:0:b029:142:2501:3975 with SMTP id x22-20020aa79ad60000b029014225013975mr7584779pfp.58.1601228577377; Sun, 27 Sep 2020 10:42:57 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id o19sm8765570pfp.64.2020.09.27.10.42.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Sep 2020 10:42:56 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org Subject: [PATCH net-next 11/11] bnxt_en: Improve preset max value for ethtool -l. Date: Sun, 27 Sep 2020 13:42:20 -0400 Message-Id: <1601228540-20852-12-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601228540-20852-1-git-send-email-michael.chan@broadcom.com> References: <1601228540-20852-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The current logic that calculates the preset maximum value for combined channel does not take into account the rings used for XDP and mqprio TCs. Each of these features will reduce the number of TX rings. Add the logic to divide the TX rings accordingly based on whether the device is currently in XDP mode and whether TCs are in use. Reviewed-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 0d9fe14646f7..19b8e3e822f1 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -801,7 +801,7 @@ static void bnxt_get_channels(struct net_device *dev, struct bnxt *bp = netdev_priv(dev); struct bnxt_hw_resc *hw_resc = &bp->hw_resc; int max_rx_rings, max_tx_rings, tcs; - int max_tx_sch_inputs; + int max_tx_sch_inputs, tx_grps; /* Get the most up-to-date max_tx_sch_inputs. */ if (netif_running(dev) && BNXT_NEW_RM(bp)) @@ -811,6 +811,12 @@ static void bnxt_get_channels(struct net_device *dev, bnxt_get_max_rings(bp, &max_rx_rings, &max_tx_rings, true); if (max_tx_sch_inputs) max_tx_rings = min_t(int, max_tx_rings, max_tx_sch_inputs); + + tcs = netdev_get_num_tc(dev); + tx_grps = max(tcs, 1); + if (bp->tx_nr_rings_xdp) + tx_grps++; + max_tx_rings /= tx_grps; channel->max_combined = min_t(int, max_rx_rings, max_tx_rings); if (bnxt_get_max_rings(bp, &max_rx_rings, &max_tx_rings, false)) { @@ -820,7 +826,6 @@ static void bnxt_get_channels(struct net_device *dev, if (max_tx_sch_inputs) max_tx_rings = min_t(int, max_tx_rings, max_tx_sch_inputs); - tcs = netdev_get_num_tc(dev); if (tcs > 1) max_tx_rings /= tcs;