From patchwork Sun Jul 18 19:36:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 479783 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=-20.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED, 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 8E0D8C636CA for ; Sun, 18 Jul 2021 19:36:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 747A8600D1 for ; Sun, 18 Jul 2021 19:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231846AbhGRTjv (ORCPT ); Sun, 18 Jul 2021 15:39:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbhGRTjs (ORCPT ); Sun, 18 Jul 2021 15:39:48 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C7F4C061762 for ; Sun, 18 Jul 2021 12:36:50 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id b2so3820697plx.1 for ; Sun, 18 Jul 2021 12:36:50 -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=siqVdRJT8bhOSVR5T1FftAUSbOX5LO960bTwfqwwGTE=; b=Y21iGyPNsm8dejqU4z++onVbxHRKXgHuFrB8+IcIEbhOmutwaT1YUPYB6fjtsZV86R wAahszK/f/1QnSCFF6Twiq2SJJ7DuOJ+P7d1tmEoJqDIJrwXu2ejppRkGW8X3RXs5Tlg /Q0+zvZ2K+NMHaEyFZaeCuzVOUYo4Bsy04DmY= 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=siqVdRJT8bhOSVR5T1FftAUSbOX5LO960bTwfqwwGTE=; b=mhaDAkD2oCNOQfMYL2O2Bi5uo6mMGI79izE1+kLhz4syuYNeTHPsclKILVs8rQ1W1O xn3UFL/3weOMGjvs5dy5dQJaZFz+zJIOPiD6yhEJaMBamfVmIm/cmS0J9sqrBGhGiz8b c8yyJqwVZNCjBeg5Ry5YzGk3BfJnp+HzrBc6oH8y/z/3gDF0zBrC1WnKnW6b+cL/8DpA KeLoOBMXSr+TUde8SjKBVO/5chpGO00z/cOokMvF6GfC87z2OdH4eUNa2PMSx9+JKfoS XsyuKxV7ADzxcnLOiizCEEReXwF6j/ZeC5Rl9/WYE+vB9Gd1juuLD5qtq/g1pWkf83n5 htfg== X-Gm-Message-State: AOAM533CHtMMiMDLT7/nndCIUtAQ9rSPCJOpBBbm2Jp/bGDTXv/pFt2q nnVzzCxFodHPZ6PHPUJ+kkX2Qw== X-Google-Smtp-Source: ABdhPJzbokO+XCZ32TY9U0eYcBJs1AGePiiTQUocZQYPB/fYfk3j2aU/x79DtGFxk+dpjms8UOVX7g== X-Received: by 2002:a17:902:e00e:b029:ef:5f1c:18a8 with SMTP id o14-20020a170902e00eb02900ef5f1c18a8mr16751156plo.38.1626637009637; Sun, 18 Jul 2021 12:36:49 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 22sm16743648pfo.80.2021.07.18.12.36.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Jul 2021 12:36:49 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net 2/9] bnxt_en: reject ETS settings that will starve a TC Date: Sun, 18 Jul 2021 15:36:26 -0400 Message-Id: <1626636993-31926-3-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1626636993-31926-1-git-send-email-michael.chan@broadcom.com> References: <1626636993-31926-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Edwin Peer ETS proportions are presented to HWRM_QUEUE_COS2BW_CFG as minimum bandwidth constraints. Thus, zero is a legal value for a given TC. However, if all the other TCs sum up to 100%, then at least one hardware queue will starve, resulting in guaranteed TX timeouts. Reject such nonsensical configurations. Reviewed-by: Pavan Chebbi Signed-off-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c index 8e90224c43a2..8a68df4d9e59 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c @@ -433,6 +433,7 @@ static int bnxt_hwrm_queue_dscp2pri_cfg(struct bnxt *bp, struct dcb_app *app, static int bnxt_ets_validate(struct bnxt *bp, struct ieee_ets *ets, u8 *tc) { int total_ets_bw = 0; + bool zero = false; u8 max_tc = 0; int i; @@ -453,13 +454,20 @@ static int bnxt_ets_validate(struct bnxt *bp, struct ieee_ets *ets, u8 *tc) break; case IEEE_8021QAZ_TSA_ETS: total_ets_bw += ets->tc_tx_bw[i]; + zero = zero || !ets->tc_tx_bw[i]; break; default: return -ENOTSUPP; } } - if (total_ets_bw > 100) + if (total_ets_bw > 100) { + netdev_warn(bp->dev, "rejecting ETS config exceeding available bandwidth\n"); return -EINVAL; + } + if (zero && total_ets_bw == 100) { + netdev_warn(bp->dev, "rejecting ETS config starving a TC\n"); + return -EINVAL; + } if (max_tc >= bp->max_tc) *tc = bp->max_tc;