From patchwork Sun Aug 29 07:35:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12463779 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 X-Spam-Level: X-Spam-Status: No, score=-19.0 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,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 D6139C432BE for ; Sun, 29 Aug 2021 07:35:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB05B60E94 for ; Sun, 29 Aug 2021 07:35:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234906AbhH2Hgr (ORCPT ); Sun, 29 Aug 2021 03:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234883AbhH2Hge (ORCPT ); Sun, 29 Aug 2021 03:36:34 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A425BC0617AE for ; Sun, 29 Aug 2021 00:35:42 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id bt14so23771925ejb.3 for ; Sun, 29 Aug 2021 00:35:42 -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=hSOmE0bJ0/zERdm74N+Ot0+J/nh1vPOxdqh/2obUnZ8=; b=KwdaYd+eW3AWSolKxX2yatA3OtRVwKBrGSymZsDWlwL216qF5nCE5oK3zd6aw5fFWy i2mLq1eE8UnuNuKAK2mYrwfGixGrQApwoVEafxo0MHmj7kVtEfWLZjxpFUmDo+DlfeKu p8j1Y5PSVB6ORB2obf3Fj5q5iicEMMqAyHCcg= 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=hSOmE0bJ0/zERdm74N+Ot0+J/nh1vPOxdqh/2obUnZ8=; b=NbnpU5DT2GYhi/8Kx14M+z7XNfwlk/xq/uymVLWKRr5Rt+MhuRivGxK52C3jeIPlvS DJfa7j0C3Wdv/62oZ1Qh+LE5kez7O+aG8K31ICL/SPOUl8ycEU1ZKNAguPL2Zb/NSvm4 Xrh/Vn078yo3RwQQK/aObF8nkI9C6hYyjcayzShzwqKL+5/sAm9Lp+DRqHvJbEwgh30C Fg4cqCXVswJ0gB+n48saxHlxgANjq2+tOV1ToP2XCLxpGnDnLJUcRPBcomuOxcufzFLZ Vl6YXYS5+Ij7mWG/l7XcpV6mk5LZk89stttFMhTHw3JU1h08Kwr6tNJfTDxMenzR+Sie LaWQ== X-Gm-Message-State: AOAM530Yec4/IAgX9hyjYPD7CyvHfmwT3HFQpXpdmQ9FrVFHa0DjpZ2/ ZQxQBFqubJjJqQt35cP/HgHXPg== X-Google-Smtp-Source: ABdhPJyVzilE5HqTiIElhwfFR7+19W/ZMEiusoDlwTloqiFO6g/PWqyyh4WxfT8vZipyOaVCaKYt2A== X-Received: by 2002:a17:906:1701:: with SMTP id c1mr18787319eje.425.1630222540860; Sun, 29 Aug 2021 00:35:40 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id dy7sm984007edb.38.2021.08.29.00.35.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Aug 2021 00:35:40 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, edwin.peer@broadcom.com, gospo@broadcom.com Subject: [PATCH net-next v2 10/11] bnxt_en: remove legacy HWRM interface Date: Sun, 29 Aug 2021 03:35:05 -0400 Message-Id: <1630222506-19532-11-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1630222506-19532-1-git-send-email-michael.chan@broadcom.com> References: <1630222506-19532-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Edwin Peer There are no longer any callers relying on the old API. Signed-off-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 18 +---- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 - .../net/ethernet/broadcom/bnxt/bnxt_hwrm.c | 77 ------------------- .../net/ethernet/broadcom/bnxt/bnxt_hwrm.h | 10 --- 4 files changed, 1 insertion(+), 106 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 6e9ca9b59e51..ddec1163748d 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -3956,29 +3956,13 @@ static int bnxt_alloc_vnic_attributes(struct bnxt *bp) static void bnxt_free_hwrm_resources(struct bnxt *bp) { - struct pci_dev *pdev = bp->pdev; - - if (bp->hwrm_cmd_resp_addr) { - dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr, - bp->hwrm_cmd_resp_dma_addr); - bp->hwrm_cmd_resp_addr = NULL; - } - dma_pool_destroy(bp->hwrm_dma_pool); bp->hwrm_dma_pool = NULL; } static int bnxt_alloc_hwrm_resources(struct bnxt *bp) { - struct pci_dev *pdev = bp->pdev; - - bp->hwrm_cmd_resp_addr = dma_alloc_coherent(&pdev->dev, PAGE_SIZE, - &bp->hwrm_cmd_resp_dma_addr, - GFP_KERNEL); - if (!bp->hwrm_cmd_resp_addr) - return -ENOMEM; - - bp->hwrm_dma_pool = dma_pool_create("bnxt_hwrm", &pdev->dev, + bp->hwrm_dma_pool = dma_pool_create("bnxt_hwrm", &bp->pdev->dev, BNXT_HWRM_DMA_SIZE, BNXT_HWRM_DMA_ALIGN, 0); if (!bp->hwrm_dma_pool) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 79a78a7468f3..f343e87bef0b 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1881,8 +1881,6 @@ struct bnxt { u16 hwrm_cmd_seq; u16 hwrm_cmd_kong_seq; u16 hwrm_intr_seq_id; - void *hwrm_cmd_resp_addr; - dma_addr_t hwrm_cmd_resp_dma_addr; struct dma_pool *hwrm_dma_pool; struct rtnl_link_stats64 net_stats_prev; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c index 6609a86d5226..60ec0caa5c56 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c @@ -24,17 +24,6 @@ #include "bnxt.h" #include "bnxt_hwrm.h" -void bnxt_hwrm_cmd_hdr_init(struct bnxt *bp, void *request, u16 req_type, - u16 cmpl_ring, u16 target_id) -{ - struct input *req = request; - - req->req_type = cpu_to_le16(req_type); - req->cmpl_ring = cpu_to_le16(cmpl_ring); - req->target_id = cpu_to_le16(target_id); - req->resp_addr = cpu_to_le64(bp->hwrm_cmd_resp_dma_addr); -} - static u64 hwrm_calc_sentinel(struct bnxt_hwrm_ctx *ctx, u16 req_type) { return (((uintptr_t)ctx) + req_type) ^ BNXT_HWRM_SENTINEL; @@ -587,72 +576,6 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx) return rc; } -static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, - int timeout, bool silent) -{ - struct bnxt_hwrm_ctx default_ctx = {0}; - struct bnxt_hwrm_ctx *ctx = &default_ctx; - struct input *req = msg; - int rc; - - if ((bp->fw_cap & BNXT_FW_CAP_SHORT_CMD) || - msg_len > BNXT_HWRM_MAX_REQ_LEN) { - rc = __hwrm_req_init(bp, (void **)&req, - le16_to_cpu(req->req_type), msg_len); - if (rc) - return rc; - memcpy(req, msg, msg_len); /* also copies resp_addr */ - ctx = __hwrm_ctx(bp, (u8 *)req); - /* belts and brances, NULL ctx shouldn't be possible here */ - if (!ctx) - return -ENOMEM; - } - - ctx->req = req; - ctx->req_len = msg_len; - ctx->resp = bp->hwrm_cmd_resp_addr; - /* global response is not reallocated __GFP_ZERO between requests */ - ctx->flags = BNXT_HWRM_INTERNAL_RESP_DIRTY; - ctx->timeout = timeout ?: DFLT_HWRM_CMD_TIMEOUT; - if (silent) - ctx->flags |= BNXT_HWRM_CTX_SILENT; - - /* will consume req if allocated with __hwrm_req_init() */ - return __hwrm_send(bp, ctx); -} - -int _hwrm_send_message(struct bnxt *bp, void *msg, u32 msg_len, int timeout) -{ - return bnxt_hwrm_do_send_msg(bp, msg, msg_len, timeout, false); -} - -int _hwrm_send_message_silent(struct bnxt *bp, void *msg, u32 msg_len, - int timeout) -{ - return bnxt_hwrm_do_send_msg(bp, msg, msg_len, timeout, true); -} - -int hwrm_send_message(struct bnxt *bp, void *msg, u32 msg_len, int timeout) -{ - int rc; - - mutex_lock(&bp->hwrm_cmd_lock); - rc = _hwrm_send_message(bp, msg, msg_len, timeout); - mutex_unlock(&bp->hwrm_cmd_lock); - return rc; -} - -int hwrm_send_message_silent(struct bnxt *bp, void *msg, u32 msg_len, - int timeout) -{ - int rc; - - mutex_lock(&bp->hwrm_cmd_lock); - rc = bnxt_hwrm_do_send_msg(bp, msg, msg_len, timeout, true); - mutex_unlock(&bp->hwrm_cmd_lock); - return rc; -} - /** * hwrm_req_send() - Execute an HWRM command. * @bp: The driver context. diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h index b3af7a88e2c7..39032cf66258 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h @@ -114,11 +114,6 @@ static inline bool bnxt_kong_hwrm_message(struct bnxt *bp, struct input *req) le16_to_cpu(req->target_id) == HWRM_TARGET_ID_KONG)); } -static inline void *bnxt_get_hwrm_resp_addr(struct bnxt *bp, void *req) -{ - return bp->hwrm_cmd_resp_addr; -} - static inline u16 bnxt_get_hwrm_seq_id(struct bnxt *bp, u16 dst) { u16 seq_id; @@ -130,11 +125,6 @@ static inline u16 bnxt_get_hwrm_seq_id(struct bnxt *bp, u16 dst) return seq_id; } -void bnxt_hwrm_cmd_hdr_init(struct bnxt *, void *, u16, u16, u16); -int _hwrm_send_message(struct bnxt *bp, void *msg, u32 len, int timeout); -int _hwrm_send_message_silent(struct bnxt *bp, void *msg, u32 len, int timeout); -int hwrm_send_message(struct bnxt *bp, void *msg, u32 len, int timeout); -int hwrm_send_message_silent(struct bnxt *bp, void *msg, u32 len, int timeout); int __hwrm_req_init(struct bnxt *bp, void **req, u16 req_type, u32 req_len); #define hwrm_req_init(bp, req, req_type) \ __hwrm_req_init((bp), (void **)&(req), (req_type), sizeof(*(req)))