From patchwork Mon Jul 18 06:20:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikas Gupta X-Patchwork-Id: 12920751 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 57B2ACCA48B for ; Mon, 18 Jul 2022 06:22:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232903AbiGRGV3 (ORCPT ); Mon, 18 Jul 2022 02:21:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233074AbiGRGVK (ORCPT ); Mon, 18 Jul 2022 02:21:10 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F16AF14029 for ; Sun, 17 Jul 2022 23:21:08 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id q16so6611968pgq.6 for ; Sun, 17 Jul 2022 23:21:08 -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=9iYJeiLF/IMZ3VOd4ku91fSFnr/Au9LlTdqiUHfpJfI=; b=XwHkl0xy55qvW1KXW78qDiYGQTuSzhV9ohR+PrZ/kCJ88p11v6wQEWTIomfTWNgaS5 yiNTyslTaRajeAeTZuG4Fx5JbMZ9dH59m7EfvQ5FX9Hgb+z1oXfrbQ/ZJxzdpVIEBqdO 9P0V6P15q5glrYCB5YKP/WdynHTComLSIqmGc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9iYJeiLF/IMZ3VOd4ku91fSFnr/Au9LlTdqiUHfpJfI=; b=AjTXvuk8Ul3sbQmEsrSQAaOtxrD61tn1cDWlQSi3NB7QE9VW24Gt3m6pCAn4s7mAOl 5weiuuzzzqBoYFf2U3x+dW9tv8UNC3D+8jxhAw80ISXNANG9rlubbqFMoiCvFVlLwkMA DrhInskNRsAxpaCtcEJYn4JMcWBJz8R9OZfs3DkITv25BdovDKIQf3HIf5GfD5ySRQDE LOZnHIcNHiKvfoq9yVd3K1+XfV7cFx2o2A7K2aZLNdKLxGzgW2fJlfpZtsdIglKIx9Ud lJWyyxk1O/ujPc9mnt6zkv/r6OBWHnuP5AszChkYerPoyBZGM8+zmLzcBgrzugJGf/kq zh0g== X-Gm-Message-State: AJIora/+qcJtwksG0xYv+tKZR7PQ4Y+Hbrbn1dyJa+gFa6cHQ59ofwQm oGJb+ig2AlWMFKeTuesTy+x6Aw== X-Google-Smtp-Source: AGRyM1sf2TWvTyYwA6Oq0WNCY/E8ZStJyRJz4ad93C/PpKO4eL5sUE67KWj34iO989WpsKlqIfvIWw== X-Received: by 2002:a63:91c1:0:b0:419:ae66:c6b5 with SMTP id l184-20020a6391c1000000b00419ae66c6b5mr19555966pge.377.1658125268531; Sun, 17 Jul 2022 23:21:08 -0700 (PDT) Received: from rahul_yocto_ubuntu18.ibn.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id h22-20020a170902f7d600b0016c4fe627eesm8360164plw.241.2022.07.17.23.21.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 23:21:07 -0700 (PDT) From: Vikas Gupta To: jiri@nvidia.com, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, dsahern@kernel.org, stephen@networkplumber.org, edumazet@google.com, pabeni@redhat.com, ast@kernel.org, leon@kernel.org, linux-doc@vger.kernel.org, corbet@lwn.net, michael.chan@broadcom.com, andrew.gospodarek@broadcom.com, Vikas Gupta Subject: [PATCH net-next v3 2/3] bnxt_en: refactor NVM APIs Date: Mon, 18 Jul 2022 11:50:31 +0530 Message-Id: <20220718062032.22426-3-vikas.gupta@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220718062032.22426-1-vikas.gupta@broadcom.com> References: <0220707182950.29348-1-vikas.gupta@broadcom.com> <20220718062032.22426-1-vikas.gupta@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org modify declaration for NVM APIs so that they can be used with devlink and ethtool both. Signed-off-by: Vikas Gupta Reviewed-by: Michael Chan Reviewed-by: Andy Gospodarek --- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 24 +++++++++---------- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.h | 12 ++++++++++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 7191e5d74208..87eb5362ad70 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -2176,14 +2176,14 @@ static void bnxt_print_admin_err(struct bnxt *bp) netdev_info(bp->dev, "PF does not have admin privileges to flash or reset the device\n"); } -static int bnxt_find_nvram_item(struct net_device *dev, u16 type, u16 ordinal, - u16 ext, u16 *index, u32 *item_length, - u32 *data_length); +int bnxt_find_nvram_item(struct net_device *dev, u16 type, u16 ordinal, + u16 ext, u16 *index, u32 *item_length, + u32 *data_length); -static int bnxt_flash_nvram(struct net_device *dev, u16 dir_type, - u16 dir_ordinal, u16 dir_ext, u16 dir_attr, - u32 dir_item_len, const u8 *data, - size_t data_len) +int bnxt_flash_nvram(struct net_device *dev, u16 dir_type, + u16 dir_ordinal, u16 dir_ext, u16 dir_attr, + u32 dir_item_len, const u8 *data, + size_t data_len) { struct bnxt *bp = netdev_priv(dev); struct hwrm_nvm_write_input *req; @@ -2836,8 +2836,8 @@ static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data) return rc; } -static int bnxt_get_nvram_item(struct net_device *dev, u32 index, u32 offset, - u32 length, u8 *data) +int bnxt_get_nvram_item(struct net_device *dev, u32 index, u32 offset, + u32 length, u8 *data) { struct bnxt *bp = netdev_priv(dev); int rc; @@ -2871,9 +2871,9 @@ static int bnxt_get_nvram_item(struct net_device *dev, u32 index, u32 offset, return rc; } -static int bnxt_find_nvram_item(struct net_device *dev, u16 type, u16 ordinal, - u16 ext, u16 *index, u32 *item_length, - u32 *data_length) +int bnxt_find_nvram_item(struct net_device *dev, u16 type, u16 ordinal, + u16 ext, u16 *index, u32 *item_length, + u32 *data_length) { struct hwrm_nvm_find_dir_entry_output *output; struct hwrm_nvm_find_dir_entry_input *req; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h index a59284215e78..a8ecef8ab82c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h @@ -58,5 +58,17 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware int bnxt_get_pkginfo(struct net_device *dev, char *ver, int size); void bnxt_ethtool_init(struct bnxt *bp); void bnxt_ethtool_free(struct bnxt *bp); +int bnxt_find_nvram_item(struct net_device *dev, u16 type, u16 ordinal, + u16 ext, u16 *index, u32 *item_length, + u32 *data_length); +int bnxt_find_nvram_item(struct net_device *dev, u16 type, u16 ordinal, + u16 ext, u16 *index, u32 *item_length, + u32 *data_length); +int bnxt_flash_nvram(struct net_device *dev, u16 dir_type, + u16 dir_ordinal, u16 dir_ext, u16 dir_attr, + u32 dir_item_len, const u8 *data, + size_t data_len); +int bnxt_get_nvram_item(struct net_device *dev, u32 index, u32 offset, + u32 length, u8 *data); #endif