From patchwork Sun Apr 26 20:24:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 220530 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=-9.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 804B7C55194 for ; Sun, 26 Apr 2020 20:25:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5FF5B2071C for ; Sun, 26 Apr 2020 20:25:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="BuVDqraP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726374AbgDZUZI (ORCPT ); Sun, 26 Apr 2020 16:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726179AbgDZUZH (ORCPT ); Sun, 26 Apr 2020 16:25:07 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BFCFC061A0F for ; Sun, 26 Apr 2020 13:25:07 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id h69so7620079pgc.8 for ; Sun, 26 Apr 2020 13:25:07 -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=3p13JvitxL6ZUjchuAaJQQISalZ/XH0YQY+hiqxR9cI=; b=BuVDqraPxkeZa00Q/Zhsx+IIwqkXKGVkBua8W8979ik797Zbr38MClunOvQkPGI3DG 7IdJeUOwSVXnefRyQXCbaj+MQwi1zMwTF4yt3jMYUcUDmkJjSkvtZjQqTFyzofgwWlX9 UZcs0qOag1l2iFfqQIJyl9NGnfZGfujSqhXy4= 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=3p13JvitxL6ZUjchuAaJQQISalZ/XH0YQY+hiqxR9cI=; b=YNzNPSXR2B0p0Zz66bU4gctdF/qD/V08qFALlWP1iw54REHC2CJM3sX7aeecaE7t5Z 8HNw4dsBFo87DzvO/gshmeS4hs8aoXg9uw371oQqdgpNgHNUnIClA3YV73SW8MT7jpFT gvEQCwCAihlGkrhjGMGgA/q/N1cWTNYZvvKgLY0sPi77WEtyj+QSAK1jIK05/uNvM7xM w0HkbvGY54ZF5Vbgt6UMgT8Ye/5CmPhGr/FQ0LfovI9ndJUrTfH7q2e0r49ryGn4X8Ge HfKbAr4Cp4xS+eLO6pSiLlJyMCJZH3/8d/0wsAHsvCDusRqKtG730B1yO+wSWi4GPRJL TiCg== X-Gm-Message-State: AGi0PublNw/gSlhZlyWVeAfH7Lq3OSpfr2Ex1L5s1YzzPfRwHQP8mMsW uq1d4t+IUlXleF/pMbNVSEwwjA== X-Google-Smtp-Source: APiQypJECNjWT0IUH73gLOKuOBdBmZICwtFXJO5WWe3L7K73GnCAy1t5+musVn4HP/G2fvbvmyy58Q== X-Received: by 2002:a63:f70f:: with SMTP id x15mr17780193pgh.199.1587932706607; Sun, 26 Apr 2020 13:25:06 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a136sm10862103pfa.99.2020.04.26.13.25.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Apr 2020 13:25:06 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, Vasundhara Volam Subject: [PATCH net 2/5] bnxt_en: Reduce BNXT_MSIX_VEC_MAX value to supported CQs per PF. Date: Sun, 26 Apr 2020 16:24:39 -0400 Message-Id: <1587932682-1212-3-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1587932682-1212-1-git-send-email-michael.chan@broadcom.com> References: <1587932682-1212-1-git-send-email-michael.chan@broadcom.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vasundhara Volam Broadcom adapters support only maximum of 512 CQs per PF. If user sets MSIx vectors more than supported CQs, firmware is setting incorrect value for msix_vec_per_pf_max parameter. Fix it by reducing the BNXT_MSIX_VEC_MAX value to 512, even though the maximum # of MSIx vectors supported by adapter are 1280. Fixes: f399e8497826 ("bnxt_en: Use msix_vec_per_pf_max and msix_vec_per_pf_min devlink params.") Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h index 95f893f..d5c8bd4 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h @@ -43,7 +43,7 @@ static inline void bnxt_link_bp_to_dl(struct bnxt *bp, struct devlink *dl) #define BNXT_NVM_CFG_VER_BITS 24 #define BNXT_NVM_CFG_VER_BYTES 4 -#define BNXT_MSIX_VEC_MAX 1280 +#define BNXT_MSIX_VEC_MAX 512 #define BNXT_MSIX_VEC_MIN_MAX 128 enum bnxt_nvm_dir_type { From patchwork Sun Apr 26 20:24:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 220529 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=-9.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 D917CC55199 for ; Sun, 26 Apr 2020 20:25:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B924B20700 for ; Sun, 26 Apr 2020 20:25:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="gK2L4zm2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726390AbgDZUZM (ORCPT ); Sun, 26 Apr 2020 16:25:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726375AbgDZUZL (ORCPT ); Sun, 26 Apr 2020 16:25:11 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32ADAC061A10 for ; Sun, 26 Apr 2020 13:25:11 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id t16so6101652plo.7 for ; Sun, 26 Apr 2020 13:25:11 -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=FSQ/OXSBy4O7NEVG24htaQyaXEGfdhXxBs93cQNLCxM=; b=gK2L4zm2Y5PPEfsP6DXXgeVDUdPxJCe0taDTLfs/kaQrw66XjNueSKa100Z0csbio0 xo5xeg/Z4oierhsfNEMJBoJ8jfl4oY8ixs/QgMAuI7/QsT0HImEh+CYbpUwQ04hrB0eC gS0ml2RV3+kU9bXkBs7tSChVxK7EIsTSkOSow= 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=FSQ/OXSBy4O7NEVG24htaQyaXEGfdhXxBs93cQNLCxM=; b=DMchalZno/knoNX8bwj6QMpZo9fyFDyKgjBQ9SNRBWqzxoBYrpBJhG8Vq+GJCdnU+T +rbjVmXlrwkUyrBFd6AED9J+wIPn3oH3V7ZjuaqVVxWa5mKi013Kr6zcnQbz2f0zMdBT rBl63OaZydoB5aDrs5o1F97mgzIHxm2KkTv2iiWhz3w5tO9V45fDTPgeUoIFL78dsB8o BUIPWWT8pZra6l8lV4XF47IS0j6Gn5EZPcxI5kVP5aqx9d2YL4H4nzHlNzABqKAy0g6a GAPfwXANB2DaKxz4fZ3fQDWGYmc9zlsSnlLWJFI0siSHBiia5ndGGmP/p/RRhqNCKCCZ Be9w== X-Gm-Message-State: AGi0PuaGzL0hOXG9482NboeDaS8pGcDQVtkAxPxUtNVQyEbY7AE4lmMp fA+k1ZUxssTOu/JK4bThNvWyUw== X-Google-Smtp-Source: APiQypL4x/5J6AhowC0S6BmuXjiXWTf1X9aeV+IGUKnao2ay3XWEB/wETXRHs55zqyd4q5E2gxTB9w== X-Received: by 2002:a17:902:164:: with SMTP id 91mr9933233plb.207.1587932710743; Sun, 26 Apr 2020 13:25:10 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a136sm10862103pfa.99.2020.04.26.13.25.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Apr 2020 13:25:10 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org Subject: [PATCH net 4/5] bnxt_en: Return error when allocating zero size context memory. Date: Sun, 26 Apr 2020 16:24:41 -0400 Message-Id: <1587932682-1212-5-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1587932682-1212-1-git-send-email-michael.chan@broadcom.com> References: <1587932682-1212-1-git-send-email-michael.chan@broadcom.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org bnxt_alloc_ctx_pg_tbls() should return error when the memory size of the context memory to set up is zero. By returning success (0), the caller may proceed normally and may crash later when it tries to set up the memory. Fixes: 08fe9d181606 ("bnxt_en: Add Level 2 context memory paging support.") Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index d8db08e..070c42d 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -6642,7 +6642,7 @@ static int bnxt_alloc_ctx_pg_tbls(struct bnxt *bp, int rc; if (!mem_size) - return 0; + return -EINVAL; ctx_pg->nr_pages = DIV_ROUND_UP(mem_size, BNXT_PAGE_SIZE); if (ctx_pg->nr_pages > MAX_CTX_TOTAL_PAGES) {