From patchwork Wed Dec 7 05:26:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 9463959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0D2256074E for ; Wed, 7 Dec 2016 05:27:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0142528478 for ; Wed, 7 Dec 2016 05:27:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA4A5284D9; Wed, 7 Dec 2016 05:27:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91856284CF for ; Wed, 7 Dec 2016 05:27:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752388AbcLGF04 (ORCPT ); Wed, 7 Dec 2016 00:26:56 -0500 Received: from mail-pf0-f179.google.com ([209.85.192.179]:33124 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752278AbcLGF0y (ORCPT ); Wed, 7 Dec 2016 00:26:54 -0500 Received: by mail-pf0-f179.google.com with SMTP id d2so74952130pfd.0 for ; Tue, 06 Dec 2016 21:26:54 -0800 (PST) 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=x8mWHS5ABgMt0uRv2PU8tI4wcR2hNTSXnLMq9elLU5s=; b=acSLnmvneHXqIhisophiRwSA2m6wkkFVfFQa1f93X9EEoAGE/l7WyEXYTDoW3Af8Le 5cXnJm+h87+7oqF2tP9K34/JlOcZeio9lyJccIhP8iEXt6ixbakbL0QHSCodKQgktb/U 9Dg75FLAOK24JNt6kvjVqm7Oz5HEiu6oh736A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=x8mWHS5ABgMt0uRv2PU8tI4wcR2hNTSXnLMq9elLU5s=; b=NEq/1tzEwcTS5nbYky3MV+XqbQ6Rb5540z9x9bqzFMf+Pz5k7F4dtztGuByvv3MBWl FbqzJxpWRZYAou+5AHt/4y9Yb7n+6+6VbQcbUb4K4aswTl9qQ0P/T4oyZuzYRlvwr+zf FKUtTSw3urag8XHyTcl4O2efwvy4z/sYYXnkNCl0jyQEJTmMOF7OZS6p9Jz6W7deS4LK QQql1ehW3wTURGwA9hT+cvgyjkN0qPblqc/y/PL5GcJQLd8S4D8X1k1XlN6ljkWYLiFU EkLauDJ1sm68wBJ5M2Xo/fJ3GQbbtVEuhYYTMo8HxbjJXMFKBrD3P1zbzgT0WqHcIydv ciKg== X-Gm-Message-State: AKaTC00o9Z6SaEEQD+yqOEE5rz645EWcLEqMw6/32J3q9y99hkDeRX8e4RdLSkbygcQbyRFb X-Received: by 10.84.216.17 with SMTP id m17mr141627640pli.82.1481088413405; Tue, 06 Dec 2016 21:26:53 -0800 (PST) Received: from localhost.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id x90sm38605509pfk.73.2016.12.06.21.26.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 21:26:52 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, selvin.xavier@broadcom.com, somnath.kotur@broadcom.com, dledford@redhat.com, linux-rdma@vger.kernel.org Subject: [PATCH net-next v2 1/7] bnxt_en: Add bnxt_set_max_func_irqs(). Date: Wed, 7 Dec 2016 00:26:15 -0500 Message-Id: <1481088381-30411-2-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1481088381-30411-1-git-send-email-michael.chan@broadcom.com> References: <1481088381-30411-1-git-send-email-michael.chan@broadcom.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP By refactoring existing code into this new function. The new function will be used in subsequent patches. v2: Fixed compile warning when CONFIG_BNXT_SRIOV is not set. Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 +++++++++++------ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index e84613a..269e757 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -4743,6 +4743,16 @@ static int bnxt_trim_rings(struct bnxt *bp, int *rx, int *tx, int max, return 0; } +void bnxt_set_max_func_irqs(struct bnxt *bp, unsigned int max_irqs) +{ +#if defined(CONFIG_BNXT_SRIOV) + if (BNXT_VF(bp)) + bp->vf.max_irqs = max_irqs; + else +#endif + bp->pf.max_irqs = max_irqs; +} + static int bnxt_setup_msix(struct bnxt *bp) { struct msix_entry *msix_ent; @@ -6949,12 +6959,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) bnxt_set_tpa_flags(bp); bnxt_set_ring_params(bp); - if (BNXT_PF(bp)) - bp->pf.max_irqs = max_irqs; -#if defined(CONFIG_BNXT_SRIOV) - else - bp->vf.max_irqs = max_irqs; -#endif + bnxt_set_max_func_irqs(bp, max_irqs); bnxt_set_dflt_rings(bp); /* Default RSS hash cfg. */ diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index b4abc1b..8327d0d 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1235,6 +1235,7 @@ static inline void bnxt_disable_poll(struct bnxt_napi *bnapi) int hwrm_send_message_silent(struct bnxt *, void *, u32, int); int bnxt_hwrm_set_coal(struct bnxt *); int bnxt_hwrm_func_qcaps(struct bnxt *); +void bnxt_set_max_func_irqs(struct bnxt *bp, unsigned int max); void bnxt_tx_disable(struct bnxt *bp); void bnxt_tx_enable(struct bnxt *bp); int bnxt_hwrm_set_pause(struct bnxt *);