From patchwork Mon May 9 15:31:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Habets X-Patchwork-Id: 12843790 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 5E79FC433EF for ; Mon, 9 May 2022 15:31:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238351AbiEIPfQ (ORCPT ); Mon, 9 May 2022 11:35:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238319AbiEIPfP (ORCPT ); Mon, 9 May 2022 11:35:15 -0400 Received: from mint-fitpc2.mph.net (unknown [81.168.73.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 84699631B for ; Mon, 9 May 2022 08:31:19 -0700 (PDT) Received: from palantir17.mph.net (unknown [192.168.0.4]) by mint-fitpc2.mph.net (Postfix) with ESMTP id 088F43200F2; Mon, 9 May 2022 16:31:19 +0100 (BST) Received: from localhost ([::1] helo=palantir17.mph.net) by palantir17.mph.net with esmtp (Exim 4.89) (envelope-from ) id 1no5Ly-0001PU-PN; Mon, 09 May 2022 16:31:18 +0100 Subject: [PATCH net-next v4 01/11] sfc: Move Siena specific files From: Martin Habets To: kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, ecree.xilinx@gmail.com Date: Mon, 09 May 2022 16:31:18 +0100 Message-ID: <165211027846.5289.5797037308376337970.stgit@palantir17.mph.net> In-Reply-To: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> References: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Martin Habets Files are only moved, no changes are made. Signed-off-by: Martin Habets --- drivers/net/ethernet/sfc/siena/farch.c | 0 drivers/net/ethernet/sfc/siena/siena.c | 0 drivers/net/ethernet/sfc/siena/siena_sriov.c | 0 drivers/net/ethernet/sfc/siena/siena_sriov.h | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename drivers/net/ethernet/sfc/{farch.c => siena/farch.c} (100%) rename drivers/net/ethernet/sfc/{siena.c => siena/siena.c} (100%) rename drivers/net/ethernet/sfc/{siena_sriov.c => siena/siena_sriov.c} (100%) rename drivers/net/ethernet/sfc/{siena_sriov.h => siena/siena_sriov.h} (100%) diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/siena/farch.c similarity index 100% rename from drivers/net/ethernet/sfc/farch.c rename to drivers/net/ethernet/sfc/siena/farch.c diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena/siena.c similarity index 100% rename from drivers/net/ethernet/sfc/siena.c rename to drivers/net/ethernet/sfc/siena/siena.c diff --git a/drivers/net/ethernet/sfc/siena_sriov.c b/drivers/net/ethernet/sfc/siena/siena_sriov.c similarity index 100% rename from drivers/net/ethernet/sfc/siena_sriov.c rename to drivers/net/ethernet/sfc/siena/siena_sriov.c diff --git a/drivers/net/ethernet/sfc/siena_sriov.h b/drivers/net/ethernet/sfc/siena/siena_sriov.h similarity index 100% rename from drivers/net/ethernet/sfc/siena_sriov.h rename to drivers/net/ethernet/sfc/siena/siena_sriov.h From patchwork Mon May 9 15:31:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Habets X-Patchwork-Id: 12843791 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 5BC3BC433F5 for ; Mon, 9 May 2022 15:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238339AbiEIPf2 (ORCPT ); Mon, 9 May 2022 11:35:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238213AbiEIPf0 (ORCPT ); Mon, 9 May 2022 11:35:26 -0400 Received: from mint-fitpc2.mph.net (unknown [81.168.73.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4D185FE21B for ; Mon, 9 May 2022 08:31:32 -0700 (PDT) Received: from palantir17.mph.net (unknown [192.168.0.4]) by mint-fitpc2.mph.net (Postfix) with ESMTP id 6FC023200F2; Mon, 9 May 2022 16:31:31 +0100 (BST) Received: from localhost ([::1] helo=palantir17.mph.net) by palantir17.mph.net with esmtp (Exim 4.89) (envelope-from ) id 1no5MB-0001Pj-7C; Mon, 09 May 2022 16:31:31 +0100 Subject: [PATCH net-next v4 02/11] sfc: Copy shared files needed for Siena (part 1) From: Martin Habets To: kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, ecree.xilinx@gmail.com Date: Mon, 09 May 2022 16:31:31 +0100 Message-ID: <165211029089.5289.1091556750756406391.stgit@palantir17.mph.net> In-Reply-To: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> References: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org These are the files starting with b through i. No changes are done, those will be done with subsequent commits. Signed-off-by: Martin Habets --- drivers/net/ethernet/sfc/siena/bitfield.h | 0 drivers/net/ethernet/sfc/siena/efx.c | 0 drivers/net/ethernet/sfc/siena/efx.h | 0 drivers/net/ethernet/sfc/siena/efx_channels.c | 0 drivers/net/ethernet/sfc/siena/efx_channels.h | 0 drivers/net/ethernet/sfc/siena/efx_common.c | 0 drivers/net/ethernet/sfc/siena/efx_common.h | 0 drivers/net/ethernet/sfc/siena/enum.h | 0 drivers/net/ethernet/sfc/siena/ethtool.c | 0 drivers/net/ethernet/sfc/siena/ethtool_common.c | 0 drivers/net/ethernet/sfc/siena/ethtool_common.h | 0 drivers/net/ethernet/sfc/siena/farch_regs.h | 0 drivers/net/ethernet/sfc/siena/filter.h | 0 drivers/net/ethernet/sfc/siena/io.h | 0 14 files changed, 0 insertions(+), 0 deletions(-) copy drivers/net/ethernet/sfc/{bitfield.h => siena/bitfield.h} (100%) copy drivers/net/ethernet/sfc/{efx.c => siena/efx.c} (100%) copy drivers/net/ethernet/sfc/{efx.h => siena/efx.h} (100%) copy drivers/net/ethernet/sfc/{efx_channels.c => siena/efx_channels.c} (100%) copy drivers/net/ethernet/sfc/{efx_channels.h => siena/efx_channels.h} (100%) copy drivers/net/ethernet/sfc/{efx_common.c => siena/efx_common.c} (100%) copy drivers/net/ethernet/sfc/{efx_common.h => siena/efx_common.h} (100%) copy drivers/net/ethernet/sfc/{enum.h => siena/enum.h} (100%) copy drivers/net/ethernet/sfc/{ethtool.c => siena/ethtool.c} (100%) copy drivers/net/ethernet/sfc/{ethtool_common.c => siena/ethtool_common.c} (100%) copy drivers/net/ethernet/sfc/{ethtool_common.h => siena/ethtool_common.h} (100%) copy drivers/net/ethernet/sfc/{farch_regs.h => siena/farch_regs.h} (100%) copy drivers/net/ethernet/sfc/{filter.h => siena/filter.h} (100%) copy drivers/net/ethernet/sfc/{io.h => siena/io.h} (100%) diff --git a/drivers/net/ethernet/sfc/bitfield.h b/drivers/net/ethernet/sfc/siena/bitfield.h similarity index 100% copy from drivers/net/ethernet/sfc/bitfield.h copy to drivers/net/ethernet/sfc/siena/bitfield.h diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/siena/efx.c similarity index 100% copy from drivers/net/ethernet/sfc/efx.c copy to drivers/net/ethernet/sfc/siena/efx.c diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/siena/efx.h similarity index 100% copy from drivers/net/ethernet/sfc/efx.h copy to drivers/net/ethernet/sfc/siena/efx.h diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/siena/efx_channels.c similarity index 100% copy from drivers/net/ethernet/sfc/efx_channels.c copy to drivers/net/ethernet/sfc/siena/efx_channels.c diff --git a/drivers/net/ethernet/sfc/efx_channels.h b/drivers/net/ethernet/sfc/siena/efx_channels.h similarity index 100% copy from drivers/net/ethernet/sfc/efx_channels.h copy to drivers/net/ethernet/sfc/siena/efx_channels.h diff --git a/drivers/net/ethernet/sfc/efx_common.c b/drivers/net/ethernet/sfc/siena/efx_common.c similarity index 100% copy from drivers/net/ethernet/sfc/efx_common.c copy to drivers/net/ethernet/sfc/siena/efx_common.c diff --git a/drivers/net/ethernet/sfc/efx_common.h b/drivers/net/ethernet/sfc/siena/efx_common.h similarity index 100% copy from drivers/net/ethernet/sfc/efx_common.h copy to drivers/net/ethernet/sfc/siena/efx_common.h diff --git a/drivers/net/ethernet/sfc/enum.h b/drivers/net/ethernet/sfc/siena/enum.h similarity index 100% copy from drivers/net/ethernet/sfc/enum.h copy to drivers/net/ethernet/sfc/siena/enum.h diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/siena/ethtool.c similarity index 100% copy from drivers/net/ethernet/sfc/ethtool.c copy to drivers/net/ethernet/sfc/siena/ethtool.c diff --git a/drivers/net/ethernet/sfc/ethtool_common.c b/drivers/net/ethernet/sfc/siena/ethtool_common.c similarity index 100% copy from drivers/net/ethernet/sfc/ethtool_common.c copy to drivers/net/ethernet/sfc/siena/ethtool_common.c diff --git a/drivers/net/ethernet/sfc/ethtool_common.h b/drivers/net/ethernet/sfc/siena/ethtool_common.h similarity index 100% copy from drivers/net/ethernet/sfc/ethtool_common.h copy to drivers/net/ethernet/sfc/siena/ethtool_common.h diff --git a/drivers/net/ethernet/sfc/farch_regs.h b/drivers/net/ethernet/sfc/siena/farch_regs.h similarity index 100% copy from drivers/net/ethernet/sfc/farch_regs.h copy to drivers/net/ethernet/sfc/siena/farch_regs.h diff --git a/drivers/net/ethernet/sfc/filter.h b/drivers/net/ethernet/sfc/siena/filter.h similarity index 100% copy from drivers/net/ethernet/sfc/filter.h copy to drivers/net/ethernet/sfc/siena/filter.h diff --git a/drivers/net/ethernet/sfc/io.h b/drivers/net/ethernet/sfc/siena/io.h similarity index 100% copy from drivers/net/ethernet/sfc/io.h copy to drivers/net/ethernet/sfc/siena/io.h From patchwork Mon May 9 15:31:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Habets X-Patchwork-Id: 12843792 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 4BB9DC433F5 for ; Mon, 9 May 2022 15:31:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238360AbiEIPfk (ORCPT ); Mon, 9 May 2022 11:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238342AbiEIPfj (ORCPT ); Mon, 9 May 2022 11:35:39 -0400 Received: from mint-fitpc2.mph.net (unknown [81.168.73.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8F6661BE10D for ; Mon, 9 May 2022 08:31:44 -0700 (PDT) Received: from palantir17.mph.net (unknown [192.168.0.4]) by mint-fitpc2.mph.net (Postfix) with ESMTP id D41B73200F2; Mon, 9 May 2022 16:31:43 +0100 (BST) Received: from localhost ([::1] helo=palantir17.mph.net) by palantir17.mph.net with esmtp (Exim 4.89) (envelope-from ) id 1no5MN-0001Pz-L3; Mon, 09 May 2022 16:31:43 +0100 Subject: [PATCH net-next v4 03/11] sfc: Copy shared files needed for Siena (part 2) From: Martin Habets To: kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, ecree.xilinx@gmail.com Date: Mon, 09 May 2022 16:31:43 +0100 Message-ID: <165211030330.5289.4000537768029138098.stgit@palantir17.mph.net> In-Reply-To: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> References: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Martin Habets These are the files starting with m through w. No changes are done, those will be done with subsequent commits. Signed-off-by: Martin Habets --- drivers/net/ethernet/sfc/siena/mcdi.c | 0 drivers/net/ethernet/sfc/siena/mcdi.h | 0 drivers/net/ethernet/sfc/siena/mcdi_mon.c | 0 drivers/net/ethernet/sfc/siena/mcdi_port.c | 0 drivers/net/ethernet/sfc/siena/mcdi_port.h | 0 drivers/net/ethernet/sfc/siena/mcdi_port_common.c | 0 drivers/net/ethernet/sfc/siena/mcdi_port_common.h | 0 drivers/net/ethernet/sfc/siena/mtd.c | 0 drivers/net/ethernet/sfc/siena/net_driver.h | 0 drivers/net/ethernet/sfc/siena/nic.c | 0 drivers/net/ethernet/sfc/siena/nic.h | 0 drivers/net/ethernet/sfc/siena/nic_common.h | 0 drivers/net/ethernet/sfc/siena/ptp.c | 0 drivers/net/ethernet/sfc/siena/ptp.h | 0 drivers/net/ethernet/sfc/siena/rx.c | 0 drivers/net/ethernet/sfc/siena/rx_common.c | 0 drivers/net/ethernet/sfc/siena/rx_common.h | 0 drivers/net/ethernet/sfc/siena/selftest.c | 0 drivers/net/ethernet/sfc/siena/selftest.h | 0 drivers/net/ethernet/sfc/siena/sriov.c | 0 drivers/net/ethernet/sfc/siena/sriov.h | 0 drivers/net/ethernet/sfc/siena/tx.c | 0 drivers/net/ethernet/sfc/siena/tx.h | 0 drivers/net/ethernet/sfc/siena/tx_common.c | 0 drivers/net/ethernet/sfc/siena/tx_common.h | 0 drivers/net/ethernet/sfc/siena/vfdi.h | 0 drivers/net/ethernet/sfc/siena/workarounds.h | 0 27 files changed, 0 insertions(+), 0 deletions(-) copy drivers/net/ethernet/sfc/{mcdi.c => siena/mcdi.c} (100%) copy drivers/net/ethernet/sfc/{mcdi.h => siena/mcdi.h} (100%) copy drivers/net/ethernet/sfc/{mcdi_mon.c => siena/mcdi_mon.c} (100%) copy drivers/net/ethernet/sfc/{mcdi_port.c => siena/mcdi_port.c} (100%) copy drivers/net/ethernet/sfc/{mcdi_port.h => siena/mcdi_port.h} (100%) copy drivers/net/ethernet/sfc/{mcdi_port_common.c => siena/mcdi_port_common.c} (100%) copy drivers/net/ethernet/sfc/{mcdi_port_common.h => siena/mcdi_port_common.h} (100%) copy drivers/net/ethernet/sfc/{mtd.c => siena/mtd.c} (100%) copy drivers/net/ethernet/sfc/{net_driver.h => siena/net_driver.h} (100%) copy drivers/net/ethernet/sfc/{nic.c => siena/nic.c} (100%) copy drivers/net/ethernet/sfc/{nic.h => siena/nic.h} (100%) copy drivers/net/ethernet/sfc/{nic_common.h => siena/nic_common.h} (100%) copy drivers/net/ethernet/sfc/{ptp.c => siena/ptp.c} (100%) copy drivers/net/ethernet/sfc/{ptp.h => siena/ptp.h} (100%) copy drivers/net/ethernet/sfc/{rx.c => siena/rx.c} (100%) copy drivers/net/ethernet/sfc/{rx_common.c => siena/rx_common.c} (100%) copy drivers/net/ethernet/sfc/{rx_common.h => siena/rx_common.h} (100%) copy drivers/net/ethernet/sfc/{selftest.c => siena/selftest.c} (100%) copy drivers/net/ethernet/sfc/{selftest.h => siena/selftest.h} (100%) copy drivers/net/ethernet/sfc/{sriov.c => siena/sriov.c} (100%) copy drivers/net/ethernet/sfc/{sriov.h => siena/sriov.h} (100%) copy drivers/net/ethernet/sfc/{tx.c => siena/tx.c} (100%) copy drivers/net/ethernet/sfc/{tx.h => siena/tx.h} (100%) copy drivers/net/ethernet/sfc/{tx_common.c => siena/tx_common.c} (100%) copy drivers/net/ethernet/sfc/{tx_common.h => siena/tx_common.h} (100%) copy drivers/net/ethernet/sfc/{vfdi.h => siena/vfdi.h} (100%) copy drivers/net/ethernet/sfc/{workarounds.h => siena/workarounds.h} (100%) diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/siena/mcdi.c similarity index 100% copy from drivers/net/ethernet/sfc/mcdi.c copy to drivers/net/ethernet/sfc/siena/mcdi.c diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/siena/mcdi.h similarity index 100% copy from drivers/net/ethernet/sfc/mcdi.h copy to drivers/net/ethernet/sfc/siena/mcdi.h diff --git a/drivers/net/ethernet/sfc/mcdi_mon.c b/drivers/net/ethernet/sfc/siena/mcdi_mon.c similarity index 100% copy from drivers/net/ethernet/sfc/mcdi_mon.c copy to drivers/net/ethernet/sfc/siena/mcdi_mon.c diff --git a/drivers/net/ethernet/sfc/mcdi_port.c b/drivers/net/ethernet/sfc/siena/mcdi_port.c similarity index 100% copy from drivers/net/ethernet/sfc/mcdi_port.c copy to drivers/net/ethernet/sfc/siena/mcdi_port.c diff --git a/drivers/net/ethernet/sfc/mcdi_port.h b/drivers/net/ethernet/sfc/siena/mcdi_port.h similarity index 100% copy from drivers/net/ethernet/sfc/mcdi_port.h copy to drivers/net/ethernet/sfc/siena/mcdi_port.h diff --git a/drivers/net/ethernet/sfc/mcdi_port_common.c b/drivers/net/ethernet/sfc/siena/mcdi_port_common.c similarity index 100% copy from drivers/net/ethernet/sfc/mcdi_port_common.c copy to drivers/net/ethernet/sfc/siena/mcdi_port_common.c diff --git a/drivers/net/ethernet/sfc/mcdi_port_common.h b/drivers/net/ethernet/sfc/siena/mcdi_port_common.h similarity index 100% copy from drivers/net/ethernet/sfc/mcdi_port_common.h copy to drivers/net/ethernet/sfc/siena/mcdi_port_common.h diff --git a/drivers/net/ethernet/sfc/mtd.c b/drivers/net/ethernet/sfc/siena/mtd.c similarity index 100% copy from drivers/net/ethernet/sfc/mtd.c copy to drivers/net/ethernet/sfc/siena/mtd.c diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/siena/net_driver.h similarity index 100% copy from drivers/net/ethernet/sfc/net_driver.h copy to drivers/net/ethernet/sfc/siena/net_driver.h diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/siena/nic.c similarity index 100% copy from drivers/net/ethernet/sfc/nic.c copy to drivers/net/ethernet/sfc/siena/nic.c diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/siena/nic.h similarity index 100% copy from drivers/net/ethernet/sfc/nic.h copy to drivers/net/ethernet/sfc/siena/nic.h diff --git a/drivers/net/ethernet/sfc/nic_common.h b/drivers/net/ethernet/sfc/siena/nic_common.h similarity index 100% copy from drivers/net/ethernet/sfc/nic_common.h copy to drivers/net/ethernet/sfc/siena/nic_common.h diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/siena/ptp.c similarity index 100% copy from drivers/net/ethernet/sfc/ptp.c copy to drivers/net/ethernet/sfc/siena/ptp.c diff --git a/drivers/net/ethernet/sfc/ptp.h b/drivers/net/ethernet/sfc/siena/ptp.h similarity index 100% copy from drivers/net/ethernet/sfc/ptp.h copy to drivers/net/ethernet/sfc/siena/ptp.h diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/siena/rx.c similarity index 100% copy from drivers/net/ethernet/sfc/rx.c copy to drivers/net/ethernet/sfc/siena/rx.c diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/siena/rx_common.c similarity index 100% copy from drivers/net/ethernet/sfc/rx_common.c copy to drivers/net/ethernet/sfc/siena/rx_common.c diff --git a/drivers/net/ethernet/sfc/rx_common.h b/drivers/net/ethernet/sfc/siena/rx_common.h similarity index 100% copy from drivers/net/ethernet/sfc/rx_common.h copy to drivers/net/ethernet/sfc/siena/rx_common.h diff --git a/drivers/net/ethernet/sfc/selftest.c b/drivers/net/ethernet/sfc/siena/selftest.c similarity index 100% copy from drivers/net/ethernet/sfc/selftest.c copy to drivers/net/ethernet/sfc/siena/selftest.c diff --git a/drivers/net/ethernet/sfc/selftest.h b/drivers/net/ethernet/sfc/siena/selftest.h similarity index 100% copy from drivers/net/ethernet/sfc/selftest.h copy to drivers/net/ethernet/sfc/siena/selftest.h diff --git a/drivers/net/ethernet/sfc/sriov.c b/drivers/net/ethernet/sfc/siena/sriov.c similarity index 100% copy from drivers/net/ethernet/sfc/sriov.c copy to drivers/net/ethernet/sfc/siena/sriov.c diff --git a/drivers/net/ethernet/sfc/sriov.h b/drivers/net/ethernet/sfc/siena/sriov.h similarity index 100% copy from drivers/net/ethernet/sfc/sriov.h copy to drivers/net/ethernet/sfc/siena/sriov.h diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/siena/tx.c similarity index 100% copy from drivers/net/ethernet/sfc/tx.c copy to drivers/net/ethernet/sfc/siena/tx.c diff --git a/drivers/net/ethernet/sfc/tx.h b/drivers/net/ethernet/sfc/siena/tx.h similarity index 100% copy from drivers/net/ethernet/sfc/tx.h copy to drivers/net/ethernet/sfc/siena/tx.h diff --git a/drivers/net/ethernet/sfc/tx_common.c b/drivers/net/ethernet/sfc/siena/tx_common.c similarity index 100% copy from drivers/net/ethernet/sfc/tx_common.c copy to drivers/net/ethernet/sfc/siena/tx_common.c diff --git a/drivers/net/ethernet/sfc/tx_common.h b/drivers/net/ethernet/sfc/siena/tx_common.h similarity index 100% copy from drivers/net/ethernet/sfc/tx_common.h copy to drivers/net/ethernet/sfc/siena/tx_common.h diff --git a/drivers/net/ethernet/sfc/vfdi.h b/drivers/net/ethernet/sfc/siena/vfdi.h similarity index 100% copy from drivers/net/ethernet/sfc/vfdi.h copy to drivers/net/ethernet/sfc/siena/vfdi.h diff --git a/drivers/net/ethernet/sfc/workarounds.h b/drivers/net/ethernet/sfc/siena/workarounds.h similarity index 100% copy from drivers/net/ethernet/sfc/workarounds.h copy to drivers/net/ethernet/sfc/siena/workarounds.h From patchwork Mon May 9 15:31:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Habets X-Patchwork-Id: 12843793 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 C4200C433EF for ; Mon, 9 May 2022 15:32:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238425AbiEIPgN (ORCPT ); Mon, 9 May 2022 11:36:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238353AbiEIPfx (ORCPT ); Mon, 9 May 2022 11:35:53 -0400 Received: from mint-fitpc2.mph.net (unknown [81.168.73.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B198E1C766D for ; Mon, 9 May 2022 08:31:57 -0700 (PDT) Received: from palantir17.mph.net (unknown [192.168.0.4]) by mint-fitpc2.mph.net (Postfix) with ESMTP id 3E22C3200F2; Mon, 9 May 2022 16:31:56 +0100 (BST) Received: from localhost ([::1] helo=palantir17.mph.net) by palantir17.mph.net with esmtp (Exim 4.89) (envelope-from ) id 1no5Ma-0001QE-13; Mon, 09 May 2022 16:31:56 +0100 Subject: [PATCH net-next v4 04/11] sfc/siena: Remove build references to missing functionality From: Martin Habets To: kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, ecree.xilinx@gmail.com Date: Mon, 09 May 2022 16:31:55 +0100 Message-ID: <165211031572.5289.6386149558813902925.stgit@palantir17.mph.net> In-Reply-To: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> References: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Functionality not supported or needed on Siena includes: - Anything for EF100 - EF10 specifics such as register access, PIO and TSO offload. Also only bind to Siena NICs. Remove EF10 specifics from nic.h. The functions that start with efx_farch_ will be removed from sfc.ko with a subsequent patch. Add the efx_ prefix to siena_prepare_flush() to make it consistent with the other APIs. Signed-off-by: Martin Habets --- drivers/net/ethernet/sfc/siena/efx.c | 28 --- drivers/net/ethernet/sfc/siena/efx.h | 15 -- drivers/net/ethernet/sfc/siena/nic.c | 7 - drivers/net/ethernet/sfc/siena/nic.h | 190 ------------------------ drivers/net/ethernet/sfc/siena/nic_common.h | 3 drivers/net/ethernet/sfc/siena/ptp.c | 11 - drivers/net/ethernet/sfc/siena/siena.c | 4 drivers/net/ethernet/sfc/siena/siena_sriov.c | 2 drivers/net/ethernet/sfc/siena/tx.c | 209 +------------------------- drivers/net/ethernet/sfc/siena/workarounds.h | 6 - 10 files changed, 17 insertions(+), 458 deletions(-) diff --git a/drivers/net/ethernet/sfc/siena/efx.c b/drivers/net/ethernet/sfc/siena/efx.c index 5a772354da83..08b3e36c34b4 100644 --- a/drivers/net/ethernet/sfc/siena/efx.c +++ b/drivers/net/ethernet/sfc/siena/efx.c @@ -26,7 +26,6 @@ #include "efx.h" #include "efx_common.h" #include "efx_channels.h" -#include "ef100.h" #include "rx_common.h" #include "tx_common.h" #include "nic.h" @@ -795,22 +794,10 @@ static void efx_unregister_netdev(struct efx_nic *efx) /* PCI device ID table */ static const struct pci_device_id efx_pci_table[] = { - {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x0903), /* SFC9120 PF */ - .driver_data = (unsigned long) &efx_hunt_a0_nic_type}, - {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x1903), /* SFC9120 VF */ - .driver_data = (unsigned long) &efx_hunt_a0_vf_nic_type}, - {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x0923), /* SFC9140 PF */ - .driver_data = (unsigned long) &efx_hunt_a0_nic_type}, - {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x1923), /* SFC9140 VF */ - .driver_data = (unsigned long) &efx_hunt_a0_vf_nic_type}, - {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x0a03), /* SFC9220 PF */ - .driver_data = (unsigned long) &efx_hunt_a0_nic_type}, - {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x1a03), /* SFC9220 VF */ - .driver_data = (unsigned long) &efx_hunt_a0_vf_nic_type}, - {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x0b03), /* SFC9250 PF */ - .driver_data = (unsigned long) &efx_hunt_a0_nic_type}, - {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x1b03), /* SFC9250 VF */ - .driver_data = (unsigned long) &efx_hunt_a0_vf_nic_type}, + {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x0803), /* SFC9020 */ + .driver_data = (unsigned long)&siena_a0_nic_type}, + {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x0813), /* SFL9021 */ + .driver_data = (unsigned long)&siena_a0_nic_type}, {0} /* end of list */ }; @@ -1298,14 +1285,8 @@ static int __init efx_init_module(void) if (rc < 0) goto err_pci; - rc = pci_register_driver(&ef100_pci_driver); - if (rc < 0) - goto err_pci_ef100; - return 0; - err_pci_ef100: - pci_unregister_driver(&efx_pci_driver); err_pci: efx_destroy_reset_workqueue(); err_reset: @@ -1318,7 +1299,6 @@ static void __exit efx_exit_module(void) { printk(KERN_INFO "Solarflare NET driver unloading\n"); - pci_unregister_driver(&ef100_pci_driver); pci_unregister_driver(&efx_pci_driver); efx_destroy_reset_workqueue(); unregister_netdevice_notifier(&efx_netdev_notifier); diff --git a/drivers/net/ethernet/sfc/siena/efx.h b/drivers/net/ethernet/sfc/siena/efx.h index c05a83da9e44..962c6b66eea7 100644 --- a/drivers/net/ethernet/sfc/siena/efx.h +++ b/drivers/net/ethernet/sfc/siena/efx.h @@ -10,8 +10,6 @@ #include #include "net_driver.h" -#include "ef100_rx.h" -#include "ef100_tx.h" #include "filter.h" int efx_net_open(struct net_device *net_dev); @@ -24,9 +22,8 @@ netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb, netdev_tx_t __efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb); static inline netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb) { - return INDIRECT_CALL_2(tx_queue->efx->type->tx_enqueue, - ef100_enqueue_skb, __efx_enqueue_skb, - tx_queue, skb); + return INDIRECT_CALL_1(tx_queue->efx->type->tx_enqueue, + __efx_enqueue_skb, tx_queue, skb); } void efx_xmit_done_single(struct efx_tx_queue *tx_queue); int efx_setup_tc(struct net_device *net_dev, enum tc_setup_type type, @@ -40,16 +37,10 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, static inline void efx_rx_flush_packet(struct efx_channel *channel) { if (channel->rx_pkt_n_frags) - INDIRECT_CALL_2(channel->efx->type->rx_packet, - __ef100_rx_packet, __efx_rx_packet, - channel); + __efx_rx_packet(channel); } static inline bool efx_rx_buf_hash_valid(struct efx_nic *efx, const u8 *prefix) { - if (efx->type->rx_buf_hash_valid) - return INDIRECT_CALL_1(efx->type->rx_buf_hash_valid, - ef100_rx_buf_hash_valid, - prefix); return true; } diff --git a/drivers/net/ethernet/sfc/siena/nic.c b/drivers/net/ethernet/sfc/siena/nic.c index 22fbb0ae77fb..c59357178657 100644 --- a/drivers/net/ethernet/sfc/siena/nic.c +++ b/drivers/net/ethernet/sfc/siena/nic.c @@ -16,7 +16,6 @@ #include "bitfield.h" #include "efx.h" #include "nic.h" -#include "ef10_regs.h" #include "farch_regs.h" #include "io.h" #include "workarounds.h" @@ -195,7 +194,6 @@ struct efx_nic_reg { #define REGISTER_BB(name) REGISTER(name, F, B, B) #define REGISTER_BZ(name) REGISTER(name, F, B, Z) #define REGISTER_CZ(name) REGISTER(name, F, C, Z) -#define REGISTER_DZ(name) REGISTER(name, E, D, Z) static const struct efx_nic_reg efx_nic_regs[] = { REGISTER_AZ(ADR_REGION), @@ -302,9 +300,6 @@ static const struct efx_nic_reg efx_nic_regs[] = { REGISTER_AB(XX_TXDRV_CTL), /* XX_PRBS_CTL, XX_PRBS_CHK and XX_PRBS_ERR are not used */ /* XX_CORE_STAT is partly RC */ - REGISTER_DZ(BIU_HW_REV_ID), - REGISTER_DZ(MC_DB_LWRD), - REGISTER_DZ(MC_DB_HWRD), }; struct efx_nic_reg_table { @@ -337,7 +332,6 @@ struct efx_nic_reg_table { FR_BZ_ ## name ## _STEP, \ FR_CZ_ ## name ## _ROWS) #define REGISTER_TABLE_CZ(name) REGISTER_TABLE(name, F, C, Z) -#define REGISTER_TABLE_DZ(name) REGISTER_TABLE(name, E, D, Z) static const struct efx_nic_reg_table efx_nic_reg_tables[] = { /* DRIVER is not used */ @@ -368,7 +362,6 @@ static const struct efx_nic_reg_table efx_nic_reg_tables[] = { /* MSIX_PBA_TABLE is not mapped */ /* SRM_DBG is not mapped (and is redundant with BUF_FLL_TBL) */ REGISTER_TABLE_BZ(RX_FILTER_TBL0), - REGISTER_TABLE_DZ(BIU_MC_SFT_STATUS), }; size_t efx_nic_get_regs_len(struct efx_nic *efx) diff --git a/drivers/net/ethernet/sfc/siena/nic.h b/drivers/net/ethernet/sfc/siena/nic.h index 251868235ae4..935cb0ab5ec0 100644 --- a/drivers/net/ethernet/sfc/siena/nic.h +++ b/drivers/net/ethernet/sfc/siena/nic.h @@ -116,193 +116,7 @@ struct siena_nic_data { #endif }; -enum { - EF10_STAT_port_tx_bytes = GENERIC_STAT_COUNT, - EF10_STAT_port_tx_packets, - EF10_STAT_port_tx_pause, - EF10_STAT_port_tx_control, - EF10_STAT_port_tx_unicast, - EF10_STAT_port_tx_multicast, - EF10_STAT_port_tx_broadcast, - EF10_STAT_port_tx_lt64, - EF10_STAT_port_tx_64, - EF10_STAT_port_tx_65_to_127, - EF10_STAT_port_tx_128_to_255, - EF10_STAT_port_tx_256_to_511, - EF10_STAT_port_tx_512_to_1023, - EF10_STAT_port_tx_1024_to_15xx, - EF10_STAT_port_tx_15xx_to_jumbo, - EF10_STAT_port_rx_bytes, - EF10_STAT_port_rx_bytes_minus_good_bytes, - EF10_STAT_port_rx_good_bytes, - EF10_STAT_port_rx_bad_bytes, - EF10_STAT_port_rx_packets, - EF10_STAT_port_rx_good, - EF10_STAT_port_rx_bad, - EF10_STAT_port_rx_pause, - EF10_STAT_port_rx_control, - EF10_STAT_port_rx_unicast, - EF10_STAT_port_rx_multicast, - EF10_STAT_port_rx_broadcast, - EF10_STAT_port_rx_lt64, - EF10_STAT_port_rx_64, - EF10_STAT_port_rx_65_to_127, - EF10_STAT_port_rx_128_to_255, - EF10_STAT_port_rx_256_to_511, - EF10_STAT_port_rx_512_to_1023, - EF10_STAT_port_rx_1024_to_15xx, - EF10_STAT_port_rx_15xx_to_jumbo, - EF10_STAT_port_rx_gtjumbo, - EF10_STAT_port_rx_bad_gtjumbo, - EF10_STAT_port_rx_overflow, - EF10_STAT_port_rx_align_error, - EF10_STAT_port_rx_length_error, - EF10_STAT_port_rx_nodesc_drops, - EF10_STAT_port_rx_pm_trunc_bb_overflow, - EF10_STAT_port_rx_pm_discard_bb_overflow, - EF10_STAT_port_rx_pm_trunc_vfifo_full, - EF10_STAT_port_rx_pm_discard_vfifo_full, - EF10_STAT_port_rx_pm_trunc_qbb, - EF10_STAT_port_rx_pm_discard_qbb, - EF10_STAT_port_rx_pm_discard_mapping, - EF10_STAT_port_rx_dp_q_disabled_packets, - EF10_STAT_port_rx_dp_di_dropped_packets, - EF10_STAT_port_rx_dp_streaming_packets, - EF10_STAT_port_rx_dp_hlb_fetch, - EF10_STAT_port_rx_dp_hlb_wait, - EF10_STAT_rx_unicast, - EF10_STAT_rx_unicast_bytes, - EF10_STAT_rx_multicast, - EF10_STAT_rx_multicast_bytes, - EF10_STAT_rx_broadcast, - EF10_STAT_rx_broadcast_bytes, - EF10_STAT_rx_bad, - EF10_STAT_rx_bad_bytes, - EF10_STAT_rx_overflow, - EF10_STAT_tx_unicast, - EF10_STAT_tx_unicast_bytes, - EF10_STAT_tx_multicast, - EF10_STAT_tx_multicast_bytes, - EF10_STAT_tx_broadcast, - EF10_STAT_tx_broadcast_bytes, - EF10_STAT_tx_bad, - EF10_STAT_tx_bad_bytes, - EF10_STAT_tx_overflow, - EF10_STAT_V1_COUNT, - EF10_STAT_fec_uncorrected_errors = EF10_STAT_V1_COUNT, - EF10_STAT_fec_corrected_errors, - EF10_STAT_fec_corrected_symbols_lane0, - EF10_STAT_fec_corrected_symbols_lane1, - EF10_STAT_fec_corrected_symbols_lane2, - EF10_STAT_fec_corrected_symbols_lane3, - EF10_STAT_ctpio_vi_busy_fallback, - EF10_STAT_ctpio_long_write_success, - EF10_STAT_ctpio_missing_dbell_fail, - EF10_STAT_ctpio_overflow_fail, - EF10_STAT_ctpio_underflow_fail, - EF10_STAT_ctpio_timeout_fail, - EF10_STAT_ctpio_noncontig_wr_fail, - EF10_STAT_ctpio_frm_clobber_fail, - EF10_STAT_ctpio_invalid_wr_fail, - EF10_STAT_ctpio_vi_clobber_fallback, - EF10_STAT_ctpio_unqualified_fallback, - EF10_STAT_ctpio_runt_fallback, - EF10_STAT_ctpio_success, - EF10_STAT_ctpio_fallback, - EF10_STAT_ctpio_poison, - EF10_STAT_ctpio_erase, - EF10_STAT_COUNT -}; - -/* Maximum number of TX PIO buffers we may allocate to a function. - * This matches the total number of buffers on each SFC9100-family - * controller. - */ -#define EF10_TX_PIOBUF_COUNT 16 - -/** - * struct efx_ef10_nic_data - EF10 architecture NIC state - * @mcdi_buf: DMA buffer for MCDI - * @warm_boot_count: Last seen MC warm boot count - * @vi_base: Absolute index of first VI in this function - * @n_allocated_vis: Number of VIs allocated to this function - * @n_piobufs: Number of PIO buffers allocated to this function - * @wc_membase: Base address of write-combining mapping of the memory BAR - * @pio_write_base: Base address for writing PIO buffers - * @pio_write_vi_base: Relative VI number for @pio_write_base - * @piobuf_handle: Handle of each PIO buffer allocated - * @piobuf_size: size of a single PIO buffer - * @must_restore_piobufs: Flag: PIO buffers have yet to be restored after MC - * reboot - * @mc_stats: Scratch buffer for converting statistics to the kernel's format - * @stats: Hardware statistics - * @workaround_35388: Flag: firmware supports workaround for bug 35388 - * @workaround_26807: Flag: firmware supports workaround for bug 26807 - * @workaround_61265: Flag: firmware supports workaround for bug 61265 - * @must_check_datapath_caps: Flag: @datapath_caps needs to be revalidated - * after MC reboot - * @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of - * %MC_CMD_GET_CAPABILITIES response) - * @datapath_caps2: Further Capabilities of datapath firmware (FLAGS2 field of - * %MC_CMD_GET_CAPABILITIES response) - * @rx_dpcpu_fw_id: Firmware ID of the RxDPCPU - * @tx_dpcpu_fw_id: Firmware ID of the TxDPCPU - * @must_probe_vswitching: Flag: vswitching has yet to be setup after MC reboot - * @pf_index: The number for this PF, or the parent PF if this is a VF -#ifdef CONFIG_SFC_SRIOV - * @vf: Pointer to VF data structure -#endif - * @vport_mac: The MAC address on the vport, only for PFs; VFs will be zero - * @vlan_list: List of VLANs added over the interface. Serialised by vlan_lock. - * @vlan_lock: Lock to serialize access to vlan_list. - * @udp_tunnels: UDP tunnel port numbers and types. - * @udp_tunnels_dirty: flag indicating a reboot occurred while pushing - * @udp_tunnels to hardware and thus the push must be re-done. - * @udp_tunnels_lock: Serialises writes to @udp_tunnels and @udp_tunnels_dirty. - */ -struct efx_ef10_nic_data { - struct efx_buffer mcdi_buf; - u16 warm_boot_count; - unsigned int vi_base; - unsigned int n_allocated_vis; - unsigned int n_piobufs; - void __iomem *wc_membase, *pio_write_base; - unsigned int pio_write_vi_base; - unsigned int piobuf_handle[EF10_TX_PIOBUF_COUNT]; - u16 piobuf_size; - bool must_restore_piobufs; - __le64 *mc_stats; - u64 stats[EF10_STAT_COUNT]; - bool workaround_35388; - bool workaround_26807; - bool workaround_61265; - bool must_check_datapath_caps; - u32 datapath_caps; - u32 datapath_caps2; - unsigned int rx_dpcpu_fw_id; - unsigned int tx_dpcpu_fw_id; - bool must_probe_vswitching; - unsigned int pf_index; - u8 port_id[ETH_ALEN]; -#ifdef CONFIG_SFC_SRIOV - unsigned int vf_index; - struct ef10_vf *vf; -#endif - u8 vport_mac[ETH_ALEN]; - struct list_head vlan_list; - struct mutex vlan_lock; - struct efx_udp_tunnel udp_tunnels[16]; - bool udp_tunnels_dirty; - struct mutex udp_tunnels_lock; - u64 licensed_features; -}; - -/* TSOv2 */ -int efx_ef10_tx_tso_desc(struct efx_tx_queue *tx_queue, struct sk_buff *skb, - bool *data_mapped); - -extern const struct efx_nic_type efx_hunt_a0_nic_type; -extern const struct efx_nic_type efx_hunt_a0_vf_nic_type; +extern const struct efx_nic_type siena_a0_nic_type; int falcon_probe_board(struct efx_nic *efx, u16 revision_info); @@ -364,7 +178,7 @@ irqreturn_t efx_farch_legacy_interrupt(int irq, void *dev_id); irqreturn_t efx_farch_fatal_interrupt(struct efx_nic *efx); /* Global Resources */ -void siena_prepare_flush(struct efx_nic *efx); +void efx_siena_prepare_flush(struct efx_nic *efx); int efx_farch_fini_dmaq(struct efx_nic *efx); void efx_farch_finish_flr(struct efx_nic *efx); void siena_finish_flush(struct efx_nic *efx); diff --git a/drivers/net/ethernet/sfc/siena/nic_common.h b/drivers/net/ethernet/sfc/siena/nic_common.h index 0cef35c0c559..47deeae0a034 100644 --- a/drivers/net/ethernet/sfc/siena/nic_common.h +++ b/drivers/net/ethernet/sfc/siena/nic_common.h @@ -75,9 +75,6 @@ static inline bool efx_nic_tx_is_empty(struct efx_tx_queue *tx_queue, unsigned i return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0; } -int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue, struct sk_buff *skb, - bool *data_mapped); - /* Decide whether to push a TX descriptor to the NIC vs merely writing * the doorbell. This can reduce latency when we are adding a single * descriptor to an empty queue, but is otherwise pointless. Further, diff --git a/drivers/net/ethernet/sfc/siena/ptp.c b/drivers/net/ethernet/sfc/siena/ptp.c index f0ef515e2ade..daf23070d353 100644 --- a/drivers/net/ethernet/sfc/siena/ptp.c +++ b/drivers/net/ethernet/sfc/siena/ptp.c @@ -1790,17 +1790,6 @@ void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info) ts_info->so_timestamping |= (SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_RX_HARDWARE | SOF_TIMESTAMPING_RAW_HARDWARE); - /* Check licensed features. If we don't have the license for TX - * timestamps, the NIC will not support them. - */ - if (efx_ptp_use_mac_tx_timestamps(efx)) { - struct efx_ef10_nic_data *nic_data = efx->nic_data; - - if (!(nic_data->licensed_features & - (1 << LICENSED_V3_FEATURES_TX_TIMESTAMPS_LBN))) - ts_info->so_timestamping &= - ~SOF_TIMESTAMPING_TX_HARDWARE; - } if (primary && primary->ptp_data && primary->ptp_data->phc_clock) ts_info->phc_index = ptp_clock_index(primary->ptp_data->phc_clock); diff --git a/drivers/net/ethernet/sfc/siena/siena.c b/drivers/net/ethernet/sfc/siena/siena.c index ce3060e15b54..7cc6a2583d6c 100644 --- a/drivers/net/ethernet/sfc/siena/siena.c +++ b/drivers/net/ethernet/sfc/siena/siena.c @@ -56,7 +56,7 @@ static void siena_push_irq_moderation(struct efx_channel *channel) channel->channel); } -void siena_prepare_flush(struct efx_nic *efx) +void efx_siena_prepare_flush(struct efx_nic *efx) { if (efx->fc_disable++ == 0) efx_mcdi_set_mac(efx); @@ -992,7 +992,7 @@ const struct efx_nic_type siena_a0_nic_type = { .probe_port = efx_mcdi_port_probe, .remove_port = efx_mcdi_port_remove, .fini_dmaq = efx_farch_fini_dmaq, - .prepare_flush = siena_prepare_flush, + .prepare_flush = efx_siena_prepare_flush, .finish_flush = siena_finish_flush, .prepare_flr = efx_port_dummy_op_void, .finish_flr = efx_farch_finish_flr, diff --git a/drivers/net/ethernet/sfc/siena/siena_sriov.c b/drivers/net/ethernet/sfc/siena/siena_sriov.c index f12851a527d9..8b0fdeebc1a5 100644 --- a/drivers/net/ethernet/sfc/siena/siena_sriov.c +++ b/drivers/net/ethernet/sfc/siena/siena_sriov.c @@ -689,7 +689,7 @@ static int efx_vfdi_fini_all_queues(struct siena_vf *vf) MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM); rtnl_lock(); - siena_prepare_flush(efx); + efx_siena_prepare_flush(efx); rtnl_unlock(); /* Flush all the initialized queues */ diff --git a/drivers/net/ethernet/sfc/siena/tx.c b/drivers/net/ethernet/sfc/siena/tx.c index 138bca611341..9e68dc434832 100644 --- a/drivers/net/ethernet/sfc/siena/tx.c +++ b/drivers/net/ethernet/sfc/siena/tx.c @@ -22,14 +22,6 @@ #include "tx.h" #include "tx_common.h" #include "workarounds.h" -#include "ef10_regs.h" - -#ifdef EFX_USE_PIO - -#define EFX_PIOBUF_SIZE_DEF ALIGN(256, L1_CACHE_BYTES) -unsigned int efx_piobuf_size __read_mostly = EFX_PIOBUF_SIZE_DEF; - -#endif /* EFX_USE_PIO */ static inline u8 *efx_tx_get_copy_buffer(struct efx_tx_queue *tx_queue, struct efx_tx_buffer *buffer) @@ -123,173 +115,6 @@ static int efx_enqueue_skb_copy(struct efx_tx_queue *tx_queue, return rc; } -#ifdef EFX_USE_PIO - -struct efx_short_copy_buffer { - int used; - u8 buf[L1_CACHE_BYTES]; -}; - -/* Copy to PIO, respecting that writes to PIO buffers must be dword aligned. - * Advances piobuf pointer. Leaves additional data in the copy buffer. - */ -static void efx_memcpy_toio_aligned(struct efx_nic *efx, u8 __iomem **piobuf, - u8 *data, int len, - struct efx_short_copy_buffer *copy_buf) -{ - int block_len = len & ~(sizeof(copy_buf->buf) - 1); - - __iowrite64_copy(*piobuf, data, block_len >> 3); - *piobuf += block_len; - len -= block_len; - - if (len) { - data += block_len; - BUG_ON(copy_buf->used); - BUG_ON(len > sizeof(copy_buf->buf)); - memcpy(copy_buf->buf, data, len); - copy_buf->used = len; - } -} - -/* Copy to PIO, respecting dword alignment, popping data from copy buffer first. - * Advances piobuf pointer. Leaves additional data in the copy buffer. - */ -static void efx_memcpy_toio_aligned_cb(struct efx_nic *efx, u8 __iomem **piobuf, - u8 *data, int len, - struct efx_short_copy_buffer *copy_buf) -{ - if (copy_buf->used) { - /* if the copy buffer is partially full, fill it up and write */ - int copy_to_buf = - min_t(int, sizeof(copy_buf->buf) - copy_buf->used, len); - - memcpy(copy_buf->buf + copy_buf->used, data, copy_to_buf); - copy_buf->used += copy_to_buf; - - /* if we didn't fill it up then we're done for now */ - if (copy_buf->used < sizeof(copy_buf->buf)) - return; - - __iowrite64_copy(*piobuf, copy_buf->buf, - sizeof(copy_buf->buf) >> 3); - *piobuf += sizeof(copy_buf->buf); - data += copy_to_buf; - len -= copy_to_buf; - copy_buf->used = 0; - } - - efx_memcpy_toio_aligned(efx, piobuf, data, len, copy_buf); -} - -static void efx_flush_copy_buffer(struct efx_nic *efx, u8 __iomem *piobuf, - struct efx_short_copy_buffer *copy_buf) -{ - /* if there's anything in it, write the whole buffer, including junk */ - if (copy_buf->used) - __iowrite64_copy(piobuf, copy_buf->buf, - sizeof(copy_buf->buf) >> 3); -} - -/* Traverse skb structure and copy fragments in to PIO buffer. - * Advances piobuf pointer. - */ -static void efx_skb_copy_bits_to_pio(struct efx_nic *efx, struct sk_buff *skb, - u8 __iomem **piobuf, - struct efx_short_copy_buffer *copy_buf) -{ - int i; - - efx_memcpy_toio_aligned(efx, piobuf, skb->data, skb_headlen(skb), - copy_buf); - - for (i = 0; i < skb_shinfo(skb)->nr_frags; ++i) { - skb_frag_t *f = &skb_shinfo(skb)->frags[i]; - u8 *vaddr; - - vaddr = kmap_atomic(skb_frag_page(f)); - - efx_memcpy_toio_aligned_cb(efx, piobuf, vaddr + skb_frag_off(f), - skb_frag_size(f), copy_buf); - kunmap_atomic(vaddr); - } - - EFX_WARN_ON_ONCE_PARANOID(skb_shinfo(skb)->frag_list); -} - -static int efx_enqueue_skb_pio(struct efx_tx_queue *tx_queue, - struct sk_buff *skb) -{ - struct efx_tx_buffer *buffer = - efx_tx_queue_get_insert_buffer(tx_queue); - u8 __iomem *piobuf = tx_queue->piobuf; - - /* Copy to PIO buffer. Ensure the writes are padded to the end - * of a cache line, as this is required for write-combining to be - * effective on at least x86. - */ - - if (skb_shinfo(skb)->nr_frags) { - /* The size of the copy buffer will ensure all writes - * are the size of a cache line. - */ - struct efx_short_copy_buffer copy_buf; - - copy_buf.used = 0; - - efx_skb_copy_bits_to_pio(tx_queue->efx, skb, - &piobuf, ©_buf); - efx_flush_copy_buffer(tx_queue->efx, piobuf, ©_buf); - } else { - /* Pad the write to the size of a cache line. - * We can do this because we know the skb_shared_info struct is - * after the source, and the destination buffer is big enough. - */ - BUILD_BUG_ON(L1_CACHE_BYTES > - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))); - __iowrite64_copy(tx_queue->piobuf, skb->data, - ALIGN(skb->len, L1_CACHE_BYTES) >> 3); - } - - buffer->skb = skb; - buffer->flags = EFX_TX_BUF_SKB | EFX_TX_BUF_OPTION; - - EFX_POPULATE_QWORD_5(buffer->option, - ESF_DZ_TX_DESC_IS_OPT, 1, - ESF_DZ_TX_OPTION_TYPE, ESE_DZ_TX_OPTION_DESC_PIO, - ESF_DZ_TX_PIO_CONT, 0, - ESF_DZ_TX_PIO_BYTE_CNT, skb->len, - ESF_DZ_TX_PIO_BUF_ADDR, - tx_queue->piobuf_offset); - ++tx_queue->insert_count; - return 0; -} - -/* Decide whether we can use TX PIO, ie. write packet data directly into - * a buffer on the device. This can reduce latency at the expense of - * throughput, so we only do this if both hardware and software TX rings - * are empty, including all queues for the channel. This also ensures that - * only one packet at a time can be using the PIO buffer. If the xmit_more - * flag is set then we don't use this - there'll be another packet along - * shortly and we want to hold off the doorbell. - */ -static bool efx_tx_may_pio(struct efx_tx_queue *tx_queue) -{ - struct efx_channel *channel = tx_queue->channel; - - if (!tx_queue->piobuf) - return false; - - EFX_WARN_ON_ONCE_PARANOID(!channel->efx->type->option_descriptors); - - efx_for_each_channel_tx_queue(tx_queue, channel) - if (!efx_nic_tx_is_empty(tx_queue, tx_queue->packet_write_count)) - return false; - - return true; -} -#endif /* EFX_USE_PIO */ - /* Send any pending traffic for a channel. xmit_more is shared across all * queues for a channel, so we must check all of them. */ @@ -338,35 +163,11 @@ netdev_tx_t __efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb * size limit. */ if (segments) { - switch (tx_queue->tso_version) { - case 1: - rc = efx_enqueue_skb_tso(tx_queue, skb, &data_mapped); - break; - case 2: - rc = efx_ef10_tx_tso_desc(tx_queue, skb, &data_mapped); - break; - case 0: /* No TSO on this queue, SW fallback needed */ - default: - rc = -EINVAL; - break; - } - if (rc == -EINVAL) { - rc = efx_tx_tso_fallback(tx_queue, skb); - tx_queue->tso_fallbacks++; - if (rc == 0) - return 0; - } - if (rc) - goto err; -#ifdef EFX_USE_PIO - } else if (skb_len <= efx_piobuf_size && !xmit_more && - efx_tx_may_pio(tx_queue)) { - /* Use PIO for short packets with an empty queue. */ - if (efx_enqueue_skb_pio(tx_queue, skb)) - goto err; - tx_queue->pio_packets++; - data_mapped = true; -#endif + rc = efx_tx_tso_fallback(tx_queue, skb); + tx_queue->tso_fallbacks++; + if (rc == 0) + return 0; + goto err; } else if (skb->data_len && skb_len <= EFX_TX_CB_SIZE) { /* Pad short packets or coalesce short fragmented packets. */ if (efx_enqueue_skb_copy(tx_queue, skb)) diff --git a/drivers/net/ethernet/sfc/siena/workarounds.h b/drivers/net/ethernet/sfc/siena/workarounds.h index 815be2d20c4b..42fb143a94ab 100644 --- a/drivers/net/ethernet/sfc/siena/workarounds.h +++ b/drivers/net/ethernet/sfc/siena/workarounds.h @@ -21,12 +21,6 @@ /* Legacy interrupt storm when interrupt fifo fills */ #define EFX_WORKAROUND_17213 EFX_WORKAROUND_SIENA -/* Lockup when writing event block registers at gen2/gen3 */ -#define EFX_EF10_WORKAROUND_35388(efx) \ - (((struct efx_ef10_nic_data *)efx->nic_data)->workaround_35388) -#define EFX_WORKAROUND_35388(efx) \ - (efx_nic_rev(efx) == EFX_REV_HUNT_A0 && EFX_EF10_WORKAROUND_35388(efx)) - /* Moderation timer access must go through MCDI */ #define EFX_EF10_WORKAROUND_61265(efx) \ (((struct efx_ef10_nic_data *)efx->nic_data)->workaround_61265) From patchwork Mon May 9 15:32:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Habets X-Patchwork-Id: 12843794 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 F3887C433F5 for ; Mon, 9 May 2022 15:32:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238375AbiEIPgP (ORCPT ); Mon, 9 May 2022 11:36:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238419AbiEIPgM (ORCPT ); Mon, 9 May 2022 11:36:12 -0400 Received: from mint-fitpc2.mph.net (unknown [81.168.73.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 587B21EFA12 for ; Mon, 9 May 2022 08:32:10 -0700 (PDT) Received: from palantir17.mph.net (unknown [192.168.0.4]) by mint-fitpc2.mph.net (Postfix) with ESMTP id A5FA43200F2; Mon, 9 May 2022 16:32:08 +0100 (BST) Received: from localhost ([::1] helo=palantir17.mph.net) by palantir17.mph.net with esmtp (Exim 4.89) (envelope-from ) id 1no5Mm-0001QX-ED; Mon, 09 May 2022 16:32:08 +0100 Subject: [PATCH net-next v4 05/11] sfc/siena: Rename functions in efx headers to avoid conflicts with sfc From: Martin Habets To: kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, ecree.xilinx@gmail.com Date: Mon, 09 May 2022 16:32:08 +0100 Message-ID: <165211032811.5289.17362550062336222267.stgit@palantir17.mph.net> In-Reply-To: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> References: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When building with allyesconfig there are many identical symbol names. For siena use efx_siena_ as the function and variable prefix to avoid build errors. efx_mtd_remove_partition can become static as it is no longer called from other files. efx_ticks_to_usecs and efx_xmit_done_single are not used in Siena, so they are removed. Several functions are only used inside efx_channels.c for Siena so they can become static. Signed-off-by: Martin Habets --- drivers/net/ethernet/sfc/siena/efx.c | 153 ++++++++++---------- drivers/net/ethernet/sfc/siena/efx.h | 65 ++++----- drivers/net/ethernet/sfc/siena/efx_channels.c | 113 ++++++++------- drivers/net/ethernet/sfc/siena/efx_channels.h | 67 ++++----- drivers/net/ethernet/sfc/siena/efx_common.c | 158 +++++++++++---------- drivers/net/ethernet/sfc/siena/efx_common.h | 90 ++++++------ drivers/net/ethernet/sfc/siena/enum.h | 2 drivers/net/ethernet/sfc/siena/ethtool.c | 12 +- drivers/net/ethernet/sfc/siena/ethtool_common.c | 6 - drivers/net/ethernet/sfc/siena/farch.c | 41 +++-- drivers/net/ethernet/sfc/siena/mcdi.c | 12 +- drivers/net/ethernet/sfc/siena/mcdi_port_common.c | 6 - drivers/net/ethernet/sfc/siena/mtd.c | 16 +- drivers/net/ethernet/sfc/siena/net_driver.h | 17 +- drivers/net/ethernet/sfc/siena/rx.c | 11 + drivers/net/ethernet/sfc/siena/rx_common.c | 8 + drivers/net/ethernet/sfc/siena/rx_common.h | 5 - drivers/net/ethernet/sfc/siena/selftest.c | 18 +- drivers/net/ethernet/sfc/siena/siena.c | 24 ++- drivers/net/ethernet/sfc/siena/siena_sriov.c | 2 drivers/net/ethernet/sfc/siena/tx.c | 61 ++------ drivers/net/ethernet/sfc/siena/tx_common.c | 8 + drivers/net/ethernet/sfc/siena/tx_common.h | 4 - 23 files changed, 427 insertions(+), 472 deletions(-) diff --git a/drivers/net/ethernet/sfc/siena/efx.c b/drivers/net/ethernet/sfc/siena/efx.c index 08b3e36c34b4..ca41c038f3ab 100644 --- a/drivers/net/ethernet/sfc/siena/efx.c +++ b/drivers/net/ethernet/sfc/siena/efx.c @@ -43,11 +43,11 @@ * *************************************************************************/ -module_param_named(interrupt_mode, efx_interrupt_mode, uint, 0444); +module_param_named(interrupt_mode, efx_siena_interrupt_mode, uint, 0444); MODULE_PARM_DESC(interrupt_mode, "Interrupt mode (0=>MSIX 1=>MSI 2=>legacy)"); -module_param(rss_cpus, uint, 0444); +module_param_named(rss_cpus, efx_siena_rss_cpus, uint, 0444); MODULE_PARM_DESC(rss_cpus, "Number of CPUs to use for Receive-Side Scaling"); /* @@ -174,7 +174,7 @@ static void efx_fini_port(struct efx_nic *efx) efx->port_initialized = false; efx->link_state.up = false; - efx_link_status_changed(efx); + efx_siena_link_status_changed(efx); } static void efx_remove_port(struct efx_nic *efx) @@ -284,11 +284,11 @@ static int efx_probe_nic(struct efx_nic *efx) /* Determine the number of channels and queues by trying * to hook in MSI-X interrupts. */ - rc = efx_probe_interrupts(efx); + rc = efx_siena_probe_interrupts(efx); if (rc) goto fail1; - rc = efx_set_channels(efx); + rc = efx_siena_set_channels(efx); if (rc) goto fail1; @@ -299,7 +299,7 @@ static int efx_probe_nic(struct efx_nic *efx) if (rc == -EAGAIN) /* try again with new max_channels */ - efx_remove_interrupts(efx); + efx_siena_remove_interrupts(efx); } while (rc == -EAGAIN); @@ -310,13 +310,13 @@ static int efx_probe_nic(struct efx_nic *efx) /* Initialise the interrupt moderation settings */ efx->irq_mod_step_us = DIV_ROUND_UP(efx->timer_quantum_ns, 1000); - efx_init_irq_moderation(efx, tx_irq_mod_usec, rx_irq_mod_usec, true, - true); + efx_siena_init_irq_moderation(efx, tx_irq_mod_usec, rx_irq_mod_usec, + true, true); return 0; fail2: - efx_remove_interrupts(efx); + efx_siena_remove_interrupts(efx); fail1: efx->type->remove(efx); return rc; @@ -326,7 +326,7 @@ static void efx_remove_nic(struct efx_nic *efx) { netif_dbg(efx, drv, efx->net_dev, "destroying NIC\n"); - efx_remove_interrupts(efx); + efx_siena_remove_interrupts(efx); efx->type->remove(efx); } @@ -373,7 +373,7 @@ static int efx_probe_all(struct efx_nic *efx) goto fail4; } - rc = efx_probe_channels(efx); + rc = efx_siena_probe_channels(efx); if (rc) goto fail5; @@ -399,7 +399,7 @@ static void efx_remove_all(struct efx_nic *efx) efx_xdp_setup_prog(efx, NULL); rtnl_unlock(); - efx_remove_channels(efx); + efx_siena_remove_channels(efx); efx_remove_filters(efx); #ifdef CONFIG_SFC_SRIOV efx->type->vswitching_remove(efx); @@ -413,7 +413,7 @@ static void efx_remove_all(struct efx_nic *efx) * Interrupt moderation * **************************************************************************/ -unsigned int efx_usecs_to_ticks(struct efx_nic *efx, unsigned int usecs) +unsigned int efx_siena_usecs_to_ticks(struct efx_nic *efx, unsigned int usecs) { if (usecs == 0) return 0; @@ -422,18 +422,10 @@ unsigned int efx_usecs_to_ticks(struct efx_nic *efx, unsigned int usecs) return usecs * 1000 / efx->timer_quantum_ns; } -unsigned int efx_ticks_to_usecs(struct efx_nic *efx, unsigned int ticks) -{ - /* We must round up when converting ticks to microseconds - * because we round down when converting the other way. - */ - return DIV_ROUND_UP(ticks * efx->timer_quantum_ns, 1000); -} - /* Set interrupt moderation parameters */ -int efx_init_irq_moderation(struct efx_nic *efx, unsigned int tx_usecs, - unsigned int rx_usecs, bool rx_adaptive, - bool rx_may_override_tx) +int efx_siena_init_irq_moderation(struct efx_nic *efx, unsigned int tx_usecs, + unsigned int rx_usecs, bool rx_adaptive, + bool rx_may_override_tx) { struct efx_channel *channel; unsigned int timer_max_us; @@ -466,8 +458,8 @@ int efx_init_irq_moderation(struct efx_nic *efx, unsigned int tx_usecs, return 0; } -void efx_get_irq_moderation(struct efx_nic *efx, unsigned int *tx_usecs, - unsigned int *rx_usecs, bool *rx_adaptive) +void efx_siena_get_irq_moderation(struct efx_nic *efx, unsigned int *tx_usecs, + unsigned int *rx_usecs, bool *rx_adaptive) { *rx_adaptive = efx->irq_rx_adaptive; *rx_usecs = efx->irq_rx_moderation_us; @@ -520,7 +512,7 @@ static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd) *************************************************************************/ /* Context: process, rtnl_lock() held. */ -int efx_net_open(struct net_device *net_dev) +static int efx_net_open(struct net_device *net_dev) { struct efx_nic *efx = netdev_priv(net_dev); int rc; @@ -533,14 +525,14 @@ int efx_net_open(struct net_device *net_dev) return rc; if (efx->phy_mode & PHY_MODE_SPECIAL) return -EBUSY; - if (efx_mcdi_poll_reboot(efx) && efx_reset(efx, RESET_TYPE_ALL)) + if (efx_mcdi_poll_reboot(efx) && efx_siena_reset(efx, RESET_TYPE_ALL)) return -EIO; /* Notify the kernel of the link state polled during driver load, * before the monitor starts running */ - efx_link_status_changed(efx); + efx_siena_link_status_changed(efx); - efx_start_all(efx); + efx_siena_start_all(efx); if (efx->state == STATE_DISABLED || efx->reset_pending) netif_device_detach(efx->net_dev); efx_selftest_async_start(efx); @@ -551,7 +543,7 @@ int efx_net_open(struct net_device *net_dev) * Note that the kernel will ignore our return code; this method * should really be a void. */ -int efx_net_stop(struct net_device *net_dev) +static int efx_net_stop(struct net_device *net_dev) { struct efx_nic *efx = netdev_priv(net_dev); @@ -559,7 +551,7 @@ int efx_net_stop(struct net_device *net_dev) raw_smp_processor_id()); /* Stop the device and flush all the channels */ - efx_stop_all(efx); + efx_siena_stop_all(efx); return 0; } @@ -587,16 +579,16 @@ static int efx_vlan_rx_kill_vid(struct net_device *net_dev, __be16 proto, u16 vi static const struct net_device_ops efx_netdev_ops = { .ndo_open = efx_net_open, .ndo_stop = efx_net_stop, - .ndo_get_stats64 = efx_net_stats, - .ndo_tx_timeout = efx_watchdog, - .ndo_start_xmit = efx_hard_start_xmit, + .ndo_get_stats64 = efx_siena_net_stats, + .ndo_tx_timeout = efx_siena_watchdog, + .ndo_start_xmit = efx_siena_hard_start_xmit, .ndo_validate_addr = eth_validate_addr, .ndo_eth_ioctl = efx_ioctl, - .ndo_change_mtu = efx_change_mtu, - .ndo_set_mac_address = efx_set_mac_address, - .ndo_set_rx_mode = efx_set_rx_mode, - .ndo_set_features = efx_set_features, - .ndo_features_check = efx_features_check, + .ndo_change_mtu = efx_siena_change_mtu, + .ndo_set_mac_address = efx_siena_set_mac_address, + .ndo_set_rx_mode = efx_siena_set_rx_mode, + .ndo_set_features = efx_siena_set_features, + .ndo_features_check = efx_siena_features_check, .ndo_vlan_rx_add_vid = efx_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = efx_vlan_rx_kill_vid, #ifdef CONFIG_SFC_SRIOV @@ -606,9 +598,9 @@ static const struct net_device_ops efx_netdev_ops = { .ndo_get_vf_config = efx_sriov_get_vf_config, .ndo_set_vf_link_state = efx_sriov_set_vf_link_state, #endif - .ndo_get_phys_port_id = efx_get_phys_port_id, - .ndo_get_phys_port_name = efx_get_phys_port_name, - .ndo_setup_tc = efx_setup_tc, + .ndo_get_phys_port_id = efx_siena_get_phys_port_id, + .ndo_get_phys_port_name = efx_siena_get_phys_port_name, + .ndo_setup_tc = efx_siena_setup_tc, #ifdef CONFIG_RFS_ACCEL .ndo_rx_flow_steer = efx_filter_rfs, #endif @@ -626,10 +618,10 @@ static int efx_xdp_setup_prog(struct efx_nic *efx, struct bpf_prog *prog) return -EINVAL; } - if (prog && efx->net_dev->mtu > efx_xdp_max_mtu(efx)) { + if (prog && efx->net_dev->mtu > efx_siena_xdp_max_mtu(efx)) { netif_err(efx, drv, efx->net_dev, "Unable to configure XDP with MTU of %d (max: %d)\n", - efx->net_dev->mtu, efx_xdp_max_mtu(efx)); + efx->net_dev->mtu, efx_siena_xdp_max_mtu(efx)); return -EINVAL; } @@ -663,14 +655,14 @@ static int efx_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **xdpfs, if (!netif_running(dev)) return -EINVAL; - return efx_xdp_tx_buffers(efx, n, xdpfs, flags & XDP_XMIT_FLUSH); + return efx_siena_xdp_tx_buffers(efx, n, xdpfs, flags & XDP_XMIT_FLUSH); } static void efx_update_name(struct efx_nic *efx) { strcpy(efx->name, efx->net_dev->name); - efx_mtd_rename(efx); - efx_set_channel_names(efx); + efx_siena_mtd_rename(efx); + efx_siena_set_channel_names(efx); } static int efx_netdev_event(struct notifier_block *this, @@ -708,7 +700,7 @@ static int efx_register_netdev(struct efx_nic *efx) net_dev->netdev_ops = &efx_netdev_ops; if (efx_nic_rev(efx) >= EFX_REV_HUNT_A0) net_dev->priv_flags |= IFF_UNICAST_FLT; - net_dev->ethtool_ops = &efx_ethtool_ops; + net_dev->ethtool_ops = &efx_siena_ethtool_ops; netif_set_tso_max_segs(net_dev, EFX_TSO_MAX_SEGS); net_dev->min_mtu = EFX_MIN_MTU; net_dev->max_mtu = EFX_MAX_MTU; @@ -742,7 +734,7 @@ static int efx_register_netdev(struct efx_nic *efx) efx_for_each_channel(channel, efx) { struct efx_tx_queue *tx_queue; efx_for_each_channel_tx_queue(tx_queue, channel) - efx_init_tx_queue_core_txq(tx_queue); + efx_siena_init_tx_queue_core_txq(tx_queue); } efx_associate(efx); @@ -756,7 +748,7 @@ static int efx_register_netdev(struct efx_nic *efx) goto fail_registered; } - efx_init_mcdi_logging(efx); + efx_siena_init_mcdi_logging(efx); return 0; @@ -780,7 +772,7 @@ static void efx_unregister_netdev(struct efx_nic *efx) if (efx_dev_registered(efx)) { strlcpy(efx->name, pci_name(efx->pci_dev), sizeof(efx->name)); - efx_fini_mcdi_logging(efx); + efx_siena_fini_mcdi_logging(efx); device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_type); unregister_netdev(efx->net_dev); } @@ -807,7 +799,7 @@ static const struct pci_device_id efx_pci_table[] = { * **************************************************************************/ -void efx_update_sw_stats(struct efx_nic *efx, u64 *stats) +void efx_siena_update_sw_stats(struct efx_nic *efx, u64 *stats) { u64 n_rx_nodesc_trunc = 0; struct efx_channel *channel; @@ -833,14 +825,14 @@ static void efx_pci_remove_main(struct efx_nic *efx) * are not READY. */ BUG_ON(efx->state == STATE_READY); - efx_flush_reset_workqueue(efx); + efx_siena_flush_reset_workqueue(efx); - efx_disable_interrupts(efx); - efx_clear_interrupt_affinity(efx); + efx_siena_disable_interrupts(efx); + efx_siena_clear_interrupt_affinity(efx); efx_nic_fini_interrupt(efx); efx_fini_port(efx); efx->type->fini(efx); - efx_fini_napi(efx); + efx_siena_fini_napi(efx); efx_remove_all(efx); } @@ -860,7 +852,7 @@ static void efx_pci_remove(struct pci_dev *pci_dev) rtnl_lock(); efx_dissociate(efx); dev_close(efx->net_dev); - efx_disable_interrupts(efx); + efx_siena_disable_interrupts(efx); efx->state = STATE_UNINIT; rtnl_unlock(); @@ -869,14 +861,14 @@ static void efx_pci_remove(struct pci_dev *pci_dev) efx_unregister_netdev(efx); - efx_mtd_remove(efx); + efx_siena_mtd_remove(efx); efx_pci_remove_main(efx); - efx_fini_io(efx); + efx_siena_fini_io(efx); netif_dbg(efx, drv, efx->net_dev, "shutdown successful\n"); - efx_fini_struct(efx); + efx_siena_fini_struct(efx); free_netdev(efx->net_dev); pci_disable_pcie_error_reporting(pci_dev); @@ -929,7 +921,7 @@ static int efx_pci_probe_main(struct efx_nic *efx) if (rc) goto fail1; - efx_init_napi(efx); + efx_siena_init_napi(efx); down_write(&efx->filter_sem); rc = efx->type->init(efx); @@ -950,22 +942,22 @@ static int efx_pci_probe_main(struct efx_nic *efx) if (rc) goto fail5; - efx_set_interrupt_affinity(efx); - rc = efx_enable_interrupts(efx); + efx_siena_set_interrupt_affinity(efx); + rc = efx_siena_enable_interrupts(efx); if (rc) goto fail6; return 0; fail6: - efx_clear_interrupt_affinity(efx); + efx_siena_clear_interrupt_affinity(efx); efx_nic_fini_interrupt(efx); fail5: efx_fini_port(efx); fail4: efx->type->fini(efx); fail3: - efx_fini_napi(efx); + efx_siena_fini_napi(efx); efx_remove_all(efx); fail1: return rc; @@ -1046,7 +1038,7 @@ static int efx_pci_probe(struct pci_dev *pci_dev, pci_set_drvdata(pci_dev, efx); SET_NETDEV_DEV(net_dev, &pci_dev->dev); - rc = efx_init_struct(efx, pci_dev, net_dev); + rc = efx_siena_init_struct(efx, pci_dev, net_dev); if (rc) goto fail1; @@ -1056,8 +1048,9 @@ static int efx_pci_probe(struct pci_dev *pci_dev, efx_probe_vpd_strings(efx); /* Set up basic I/O (BAR mappings etc) */ - rc = efx_init_io(efx, efx->type->mem_bar(efx), efx->type->max_dma_mask, - efx->type->mem_map_size(efx)); + rc = efx_siena_init_io(efx, efx->type->mem_bar(efx), + efx->type->max_dma_mask, + efx->type->mem_map_size(efx)); if (rc) goto fail2; @@ -1101,9 +1094,9 @@ static int efx_pci_probe(struct pci_dev *pci_dev, return 0; fail3: - efx_fini_io(efx); + efx_siena_fini_io(efx); fail2: - efx_fini_struct(efx); + efx_siena_fini_struct(efx); fail1: WARN_ON(rc > 0); netif_dbg(efx, drv, efx->net_dev, "initialisation failed. rc=%d\n", rc); @@ -1142,8 +1135,8 @@ static int efx_pm_freeze(struct device *dev) efx_device_detach_sync(efx); - efx_stop_all(efx); - efx_disable_interrupts(efx); + efx_siena_stop_all(efx); + efx_siena_disable_interrupts(efx); } rtnl_unlock(); @@ -1159,7 +1152,7 @@ static int efx_pm_thaw(struct device *dev) rtnl_lock(); if (efx->state != STATE_DISABLED) { - rc = efx_enable_interrupts(efx); + rc = efx_siena_enable_interrupts(efx); if (rc) goto fail; @@ -1167,7 +1160,7 @@ static int efx_pm_thaw(struct device *dev) efx_mcdi_port_reconfigure(efx); mutex_unlock(&efx->mac_lock); - efx_start_all(efx); + efx_siena_start_all(efx); efx_device_attach_if_not_resetting(efx); @@ -1179,7 +1172,7 @@ static int efx_pm_thaw(struct device *dev) rtnl_unlock(); /* Reschedule any quenched resets scheduled during efx_pm_freeze() */ - efx_queue_reset_work(efx); + efx_siena_queue_reset_work(efx); return 0; @@ -1255,7 +1248,7 @@ static struct pci_driver efx_pci_driver = { .probe = efx_pci_probe, .remove = efx_pci_remove, .driver.pm = &efx_pm_ops, - .err_handler = &efx_err_handlers, + .err_handler = &efx_siena_err_handlers, #ifdef CONFIG_SFC_SRIOV .sriov_configure = efx_pci_sriov_configure, #endif @@ -1277,7 +1270,7 @@ static int __init efx_init_module(void) if (rc) goto err_notifier; - rc = efx_create_reset_workqueue(); + rc = efx_siena_create_reset_workqueue(); if (rc) goto err_reset; @@ -1288,7 +1281,7 @@ static int __init efx_init_module(void) return 0; err_pci: - efx_destroy_reset_workqueue(); + efx_siena_destroy_reset_workqueue(); err_reset: unregister_netdevice_notifier(&efx_netdev_notifier); err_notifier: @@ -1300,7 +1293,7 @@ static void __exit efx_exit_module(void) printk(KERN_INFO "Solarflare NET driver unloading\n"); pci_unregister_driver(&efx_pci_driver); - efx_destroy_reset_workqueue(); + efx_siena_destroy_reset_workqueue(); unregister_netdevice_notifier(&efx_netdev_notifier); } diff --git a/drivers/net/ethernet/sfc/siena/efx.h b/drivers/net/ethernet/sfc/siena/efx.h index 962c6b66eea7..a4f9e6e962b0 100644 --- a/drivers/net/ethernet/sfc/siena/efx.h +++ b/drivers/net/ethernet/sfc/siena/efx.h @@ -12,36 +12,28 @@ #include "net_driver.h" #include "filter.h" -int efx_net_open(struct net_device *net_dev); -int efx_net_stop(struct net_device *net_dev); - /* TX */ -void efx_init_tx_queue_core_txq(struct efx_tx_queue *tx_queue); -netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb, - struct net_device *net_dev); -netdev_tx_t __efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb); +void efx_siena_init_tx_queue_core_txq(struct efx_tx_queue *tx_queue); +netdev_tx_t efx_siena_hard_start_xmit(struct sk_buff *skb, + struct net_device *net_dev); +netdev_tx_t __efx_siena_enqueue_skb(struct efx_tx_queue *tx_queue, + struct sk_buff *skb); static inline netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb) { return INDIRECT_CALL_1(tx_queue->efx->type->tx_enqueue, - __efx_enqueue_skb, tx_queue, skb); + __efx_siena_enqueue_skb, tx_queue, skb); } -void efx_xmit_done_single(struct efx_tx_queue *tx_queue); -int efx_setup_tc(struct net_device *net_dev, enum tc_setup_type type, - void *type_data); -extern unsigned int efx_piobuf_size; +int efx_siena_setup_tc(struct net_device *net_dev, enum tc_setup_type type, + void *type_data); /* RX */ -void __efx_rx_packet(struct efx_channel *channel); -void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, - unsigned int n_frags, unsigned int len, u16 flags); +void __efx_siena_rx_packet(struct efx_channel *channel); +void efx_siena_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, + unsigned int n_frags, unsigned int len, u16 flags); static inline void efx_rx_flush_packet(struct efx_channel *channel) { if (channel->rx_pkt_n_frags) - __efx_rx_packet(channel); -} -static inline bool efx_rx_buf_hash_valid(struct efx_nic *efx, const u8 *prefix) -{ - return true; + __efx_siena_rx_packet(channel); } /* Maximum number of TCP segments we support for soft-TSO */ @@ -156,34 +148,33 @@ static inline bool efx_rss_active(struct efx_rss_context *ctx) } /* Ethtool support */ -extern const struct ethtool_ops efx_ethtool_ops; +extern const struct ethtool_ops efx_siena_ethtool_ops; /* Global */ -unsigned int efx_usecs_to_ticks(struct efx_nic *efx, unsigned int usecs); -unsigned int efx_ticks_to_usecs(struct efx_nic *efx, unsigned int ticks); -int efx_init_irq_moderation(struct efx_nic *efx, unsigned int tx_usecs, - unsigned int rx_usecs, bool rx_adaptive, - bool rx_may_override_tx); -void efx_get_irq_moderation(struct efx_nic *efx, unsigned int *tx_usecs, - unsigned int *rx_usecs, bool *rx_adaptive); +unsigned int efx_siena_usecs_to_ticks(struct efx_nic *efx, unsigned int usecs); +int efx_siena_init_irq_moderation(struct efx_nic *efx, unsigned int tx_usecs, + unsigned int rx_usecs, bool rx_adaptive, + bool rx_may_override_tx); +void efx_siena_get_irq_moderation(struct efx_nic *efx, unsigned int *tx_usecs, + unsigned int *rx_usecs, bool *rx_adaptive); /* Update the generic software stats in the passed stats array */ -void efx_update_sw_stats(struct efx_nic *efx, u64 *stats); +void efx_siena_update_sw_stats(struct efx_nic *efx, u64 *stats); /* MTD */ #ifdef CONFIG_SFC_MTD -int efx_mtd_add(struct efx_nic *efx, struct efx_mtd_partition *parts, - size_t n_parts, size_t sizeof_part); +int efx_siena_mtd_add(struct efx_nic *efx, struct efx_mtd_partition *parts, + size_t n_parts, size_t sizeof_part); static inline int efx_mtd_probe(struct efx_nic *efx) { return efx->type->mtd_probe(efx); } -void efx_mtd_rename(struct efx_nic *efx); -void efx_mtd_remove(struct efx_nic *efx); +void efx_siena_mtd_rename(struct efx_nic *efx); +void efx_siena_mtd_remove(struct efx_nic *efx); #else static inline int efx_mtd_probe(struct efx_nic *efx) { return 0; } -static inline void efx_mtd_rename(struct efx_nic *efx) {} -static inline void efx_mtd_remove(struct efx_nic *efx) {} +static inline void efx_siena_mtd_rename(struct efx_nic *efx) {} +static inline void efx_siena_mtd_remove(struct efx_nic *efx) {} #endif #ifdef CONFIG_SFC_SRIOV @@ -221,7 +212,7 @@ static inline bool efx_rwsem_assert_write_locked(struct rw_semaphore *sem) return true; } -int efx_xdp_tx_buffers(struct efx_nic *efx, int n, struct xdp_frame **xdpfs, - bool flush); +int efx_siena_xdp_tx_buffers(struct efx_nic *efx, int n, + struct xdp_frame **xdpfs, bool flush); #endif /* EFX_EFX_H */ diff --git a/drivers/net/ethernet/sfc/siena/efx_channels.c b/drivers/net/ethernet/sfc/siena/efx_channels.c index 3f28f9861dfa..b04affb23f72 100644 --- a/drivers/net/ethernet/sfc/siena/efx_channels.c +++ b/drivers/net/ethernet/sfc/siena/efx_channels.c @@ -25,7 +25,7 @@ * 1 => MSI * 2 => legacy */ -unsigned int efx_interrupt_mode = EFX_INT_MODE_MSIX; +unsigned int efx_siena_interrupt_mode = EFX_INT_MODE_MSIX; /* This is the requested number of CPUs to use for Receive-Side Scaling (RSS), * i.e. the number of CPUs among which we may distribute simultaneous @@ -34,7 +34,7 @@ unsigned int efx_interrupt_mode = EFX_INT_MODE_MSIX; * Cards without MSI-X will only target one CPU via legacy or MSI interrupt. * The default (0) means to assign an interrupt to each core. */ -unsigned int rss_cpus; +unsigned int efx_siena_rss_cpus; static unsigned int irq_adapt_low_thresh = 8000; module_param(irq_adapt_low_thresh, uint, 0644); @@ -89,8 +89,8 @@ static unsigned int efx_wanted_parallelism(struct efx_nic *efx) { unsigned int count; - if (rss_cpus) { - count = rss_cpus; + if (efx_siena_rss_cpus) { + count = efx_siena_rss_cpus; } else { count = count_online_cores(efx, true); @@ -100,7 +100,8 @@ static unsigned int efx_wanted_parallelism(struct efx_nic *efx) } if (count > EFX_MAX_RX_QUEUES) { - netif_cond_dbg(efx, probe, efx->net_dev, !rss_cpus, warn, + netif_cond_dbg(efx, probe, efx->net_dev, !efx_siena_rss_cpus, + warn, "Reducing number of rx queues from %u to %u.\n", count, EFX_MAX_RX_QUEUES); count = EFX_MAX_RX_QUEUES; @@ -249,7 +250,7 @@ static int efx_allocate_msix_channels(struct efx_nic *efx, /* Probe the number and type of interrupts we are able to obtain, and * the resulting numbers of channels and RX queues. */ -int efx_probe_interrupts(struct efx_nic *efx) +int efx_siena_probe_interrupts(struct efx_nic *efx) { unsigned int extra_channels = 0; unsigned int rss_spread; @@ -361,7 +362,7 @@ int efx_probe_interrupts(struct efx_nic *efx) } #if defined(CONFIG_SMP) -void efx_set_interrupt_affinity(struct efx_nic *efx) +void efx_siena_set_interrupt_affinity(struct efx_nic *efx) { const struct cpumask *numa_mask = cpumask_of_pcibus(efx->pci_dev->bus); struct efx_channel *channel; @@ -380,7 +381,7 @@ void efx_set_interrupt_affinity(struct efx_nic *efx) } } -void efx_clear_interrupt_affinity(struct efx_nic *efx) +void efx_siena_clear_interrupt_affinity(struct efx_nic *efx) { struct efx_channel *channel; @@ -389,17 +390,17 @@ void efx_clear_interrupt_affinity(struct efx_nic *efx) } #else void -efx_set_interrupt_affinity(struct efx_nic *efx __attribute__ ((unused))) +efx_siena_set_interrupt_affinity(struct efx_nic *efx __always_unused) { } void -efx_clear_interrupt_affinity(struct efx_nic *efx __attribute__ ((unused))) +efx_siena_clear_interrupt_affinity(struct efx_nic *efx __always_unused) { } #endif /* CONFIG_SMP */ -void efx_remove_interrupts(struct efx_nic *efx) +void efx_siena_remove_interrupts(struct efx_nic *efx) { struct efx_channel *channel; @@ -422,7 +423,7 @@ void efx_remove_interrupts(struct efx_nic *efx) * is reset, the memory buffer will be reused; this guards against * errors during channel reset and also simplifies interrupt handling. */ -int efx_probe_eventq(struct efx_channel *channel) +static int efx_probe_eventq(struct efx_channel *channel) { struct efx_nic *efx = channel->efx; unsigned long entries; @@ -441,7 +442,7 @@ int efx_probe_eventq(struct efx_channel *channel) } /* Prepare channel's event queue */ -int efx_init_eventq(struct efx_channel *channel) +static int efx_init_eventq(struct efx_channel *channel) { struct efx_nic *efx = channel->efx; int rc; @@ -461,7 +462,7 @@ int efx_init_eventq(struct efx_channel *channel) } /* Enable event queue processing and NAPI */ -void efx_start_eventq(struct efx_channel *channel) +void efx_siena_start_eventq(struct efx_channel *channel) { netif_dbg(channel->efx, ifup, channel->efx->net_dev, "chan %d start event queue\n", channel->channel); @@ -475,7 +476,7 @@ void efx_start_eventq(struct efx_channel *channel) } /* Disable event queue processing and NAPI */ -void efx_stop_eventq(struct efx_channel *channel) +void efx_siena_stop_eventq(struct efx_channel *channel) { if (!channel->enabled) return; @@ -484,7 +485,7 @@ void efx_stop_eventq(struct efx_channel *channel) channel->enabled = false; } -void efx_fini_eventq(struct efx_channel *channel) +static void efx_fini_eventq(struct efx_channel *channel) { if (!channel->eventq_init) return; @@ -496,7 +497,7 @@ void efx_fini_eventq(struct efx_channel *channel) channel->eventq_init = false; } -void efx_remove_eventq(struct efx_channel *channel) +static void efx_remove_eventq(struct efx_channel *channel) { netif_dbg(channel->efx, drv, channel->efx->net_dev, "chan %d remove event queue\n", channel->channel); @@ -562,7 +563,7 @@ static struct efx_channel *efx_alloc_channel(struct efx_nic *efx, int i) return channel; } -int efx_init_channels(struct efx_nic *efx) +int efx_siena_init_channels(struct efx_nic *efx) { unsigned int i; @@ -576,7 +577,7 @@ int efx_init_channels(struct efx_nic *efx) /* Higher numbered interrupt modes are less capable! */ efx->interrupt_mode = min(efx->type->min_interrupt_mode, - efx_interrupt_mode); + efx_siena_interrupt_mode); efx->max_channels = EFX_MAX_CHANNELS; efx->max_tx_channels = EFX_MAX_CHANNELS; @@ -584,7 +585,7 @@ int efx_init_channels(struct efx_nic *efx) return 0; } -void efx_fini_channels(struct efx_nic *efx) +void efx_siena_fini_channels(struct efx_nic *efx) { unsigned int i; @@ -672,7 +673,7 @@ static int efx_probe_channel(struct efx_channel *channel) return 0; fail: - efx_remove_channel(channel); + efx_siena_remove_channel(channel); return rc; } @@ -700,7 +701,7 @@ static void efx_get_channel_name(struct efx_channel *channel, char *buf, snprintf(buf, len, "%s%s-%d", efx->name, type, number); } -void efx_set_channel_names(struct efx_nic *efx) +void efx_siena_set_channel_names(struct efx_nic *efx) { struct efx_channel *channel; @@ -710,7 +711,7 @@ void efx_set_channel_names(struct efx_nic *efx) sizeof(efx->msi_context[0].name)); } -int efx_probe_channels(struct efx_nic *efx) +int efx_siena_probe_channels(struct efx_nic *efx) { struct efx_channel *channel; int rc; @@ -732,16 +733,16 @@ int efx_probe_channels(struct efx_nic *efx) goto fail; } } - efx_set_channel_names(efx); + efx_siena_set_channel_names(efx); return 0; fail: - efx_remove_channels(efx); + efx_siena_remove_channels(efx); return rc; } -void efx_remove_channel(struct efx_channel *channel) +void efx_siena_remove_channel(struct efx_channel *channel) { struct efx_tx_queue *tx_queue; struct efx_rx_queue *rx_queue; @@ -757,12 +758,12 @@ void efx_remove_channel(struct efx_channel *channel) channel->type->post_remove(channel); } -void efx_remove_channels(struct efx_nic *efx) +void efx_siena_remove_channels(struct efx_nic *efx) { struct efx_channel *channel; efx_for_each_channel(channel, efx) - efx_remove_channel(channel); + efx_siena_remove_channel(channel); kfree(efx->xdp_tx_queues); } @@ -846,7 +847,13 @@ static void efx_set_xdp_channels(struct efx_nic *efx) } } -int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) +static int efx_soft_enable_interrupts(struct efx_nic *efx); +static void efx_soft_disable_interrupts(struct efx_nic *efx); +static void efx_init_napi_channel(struct efx_channel *channel); +static void efx_fini_napi_channel(struct efx_channel *channel); + +int efx_siena_realloc_channels(struct efx_nic *efx, u32 rxq_entries, + u32 txq_entries) { struct efx_channel *other_channel[EFX_MAX_CHANNELS], *channel; unsigned int i, next_buffer_table = 0; @@ -880,7 +887,7 @@ int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) } efx_device_detach_sync(efx); - efx_stop_all(efx); + efx_siena_stop_all(efx); efx_soft_disable_interrupts(efx); /* Clone channels (where possible) */ @@ -924,7 +931,7 @@ int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) channel = other_channel[i]; if (channel && channel->type->copy) { efx_fini_napi_channel(channel); - efx_remove_channel(channel); + efx_siena_remove_channel(channel); kfree(channel); } } @@ -934,9 +941,9 @@ int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) rc = rc ? rc : rc2; netif_err(efx, drv, efx->net_dev, "unable to restart interrupts on channel reallocation\n"); - efx_schedule_reset(efx, RESET_TYPE_DISABLE); + efx_siena_schedule_reset(efx, RESET_TYPE_DISABLE); } else { - efx_start_all(efx); + efx_siena_start_all(efx); efx_device_attach_if_not_resetting(efx); } return rc; @@ -950,7 +957,7 @@ int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) goto out; } -int efx_set_channels(struct efx_nic *efx) +int efx_siena_set_channels(struct efx_nic *efx) { struct efx_channel *channel; int rc; @@ -995,7 +1002,7 @@ static bool efx_default_channel_want_txqs(struct efx_channel *channel) * START/STOP *************/ -int efx_soft_enable_interrupts(struct efx_nic *efx) +static int efx_soft_enable_interrupts(struct efx_nic *efx) { struct efx_channel *channel, *end_channel; int rc; @@ -1011,7 +1018,7 @@ int efx_soft_enable_interrupts(struct efx_nic *efx) if (rc) goto fail; } - efx_start_eventq(channel); + efx_siena_start_eventq(channel); } efx_mcdi_mode_event(efx); @@ -1022,7 +1029,7 @@ int efx_soft_enable_interrupts(struct efx_nic *efx) efx_for_each_channel(channel, efx) { if (channel == end_channel) break; - efx_stop_eventq(channel); + efx_siena_stop_eventq(channel); if (!channel->type->keep_eventq) efx_fini_eventq(channel); } @@ -1030,7 +1037,7 @@ int efx_soft_enable_interrupts(struct efx_nic *efx) return rc; } -void efx_soft_disable_interrupts(struct efx_nic *efx) +static void efx_soft_disable_interrupts(struct efx_nic *efx) { struct efx_channel *channel; @@ -1049,7 +1056,7 @@ void efx_soft_disable_interrupts(struct efx_nic *efx) if (channel->irq) synchronize_irq(channel->irq); - efx_stop_eventq(channel); + efx_siena_stop_eventq(channel); if (!channel->type->keep_eventq) efx_fini_eventq(channel); } @@ -1058,7 +1065,7 @@ void efx_soft_disable_interrupts(struct efx_nic *efx) efx_mcdi_flush_async(efx); } -int efx_enable_interrupts(struct efx_nic *efx) +int efx_siena_enable_interrupts(struct efx_nic *efx) { struct efx_channel *channel, *end_channel; int rc; @@ -1101,7 +1108,7 @@ int efx_enable_interrupts(struct efx_nic *efx) return rc; } -void efx_disable_interrupts(struct efx_nic *efx) +void efx_siena_disable_interrupts(struct efx_nic *efx) { struct efx_channel *channel; @@ -1115,7 +1122,7 @@ void efx_disable_interrupts(struct efx_nic *efx) efx->type->irq_disable_non_ev(efx); } -void efx_start_channels(struct efx_nic *efx) +void efx_siena_start_channels(struct efx_nic *efx) { struct efx_tx_queue *tx_queue; struct efx_rx_queue *rx_queue; @@ -1130,16 +1137,16 @@ void efx_start_channels(struct efx_nic *efx) efx_for_each_channel_rx_queue(rx_queue, channel) { efx_init_rx_queue(rx_queue); atomic_inc(&efx->active_queues); - efx_stop_eventq(channel); + efx_siena_stop_eventq(channel); efx_fast_push_rx_descriptors(rx_queue, false); - efx_start_eventq(channel); + efx_siena_start_eventq(channel); } WARN_ON(channel->rx_pkt_n_frags); } } -void efx_stop_channels(struct efx_nic *efx) +void efx_siena_stop_channels(struct efx_nic *efx) { struct efx_tx_queue *tx_queue; struct efx_rx_queue *rx_queue; @@ -1160,8 +1167,8 @@ void efx_stop_channels(struct efx_nic *efx) * temporarily. */ if (efx_channel_has_rx_queue(channel)) { - efx_stop_eventq(channel); - efx_start_eventq(channel); + efx_siena_stop_eventq(channel); + efx_siena_start_eventq(channel); } } @@ -1311,7 +1318,7 @@ static int efx_poll(struct napi_struct *napi, int budget) return spent; } -void efx_init_napi_channel(struct efx_channel *channel) +static void efx_init_napi_channel(struct efx_channel *channel) { struct efx_nic *efx = channel->efx; @@ -1320,7 +1327,7 @@ void efx_init_napi_channel(struct efx_channel *channel) napi_weight); } -void efx_init_napi(struct efx_nic *efx) +void efx_siena_init_napi(struct efx_nic *efx) { struct efx_channel *channel; @@ -1328,7 +1335,7 @@ void efx_init_napi(struct efx_nic *efx) efx_init_napi_channel(channel); } -void efx_fini_napi_channel(struct efx_channel *channel) +static void efx_fini_napi_channel(struct efx_channel *channel) { if (channel->napi_dev) netif_napi_del(&channel->napi_str); @@ -1336,7 +1343,7 @@ void efx_fini_napi_channel(struct efx_channel *channel) channel->napi_dev = NULL; } -void efx_fini_napi(struct efx_nic *efx) +void efx_siena_fini_napi(struct efx_nic *efx) { struct efx_channel *channel; @@ -1353,13 +1360,13 @@ static int efx_channel_dummy_op_int(struct efx_channel *channel) return 0; } -void efx_channel_dummy_op_void(struct efx_channel *channel) +void efx_siena_channel_dummy_op_void(struct efx_channel *channel) { } static const struct efx_channel_type efx_default_channel_type = { .pre_probe = efx_channel_dummy_op_int, - .post_remove = efx_channel_dummy_op_void, + .post_remove = efx_siena_channel_dummy_op_void, .get_name = efx_get_channel_name, .copy = efx_copy_channel, .want_txqs = efx_default_channel_want_txqs, diff --git a/drivers/net/ethernet/sfc/siena/efx_channels.h b/drivers/net/ethernet/sfc/siena/efx_channels.h index 64abb99a56b8..10d78049b885 100644 --- a/drivers/net/ethernet/sfc/siena/efx_channels.h +++ b/drivers/net/ethernet/sfc/siena/efx_channels.h @@ -11,42 +11,35 @@ #ifndef EFX_CHANNELS_H #define EFX_CHANNELS_H -extern unsigned int efx_interrupt_mode; -extern unsigned int rss_cpus; - -int efx_probe_interrupts(struct efx_nic *efx); -void efx_remove_interrupts(struct efx_nic *efx); -int efx_soft_enable_interrupts(struct efx_nic *efx); -void efx_soft_disable_interrupts(struct efx_nic *efx); -int efx_enable_interrupts(struct efx_nic *efx); -void efx_disable_interrupts(struct efx_nic *efx); - -void efx_set_interrupt_affinity(struct efx_nic *efx); -void efx_clear_interrupt_affinity(struct efx_nic *efx); - -int efx_probe_eventq(struct efx_channel *channel); -int efx_init_eventq(struct efx_channel *channel); -void efx_start_eventq(struct efx_channel *channel); -void efx_stop_eventq(struct efx_channel *channel); -void efx_fini_eventq(struct efx_channel *channel); -void efx_remove_eventq(struct efx_channel *channel); - -int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries); -void efx_set_channel_names(struct efx_nic *efx); -int efx_init_channels(struct efx_nic *efx); -int efx_probe_channels(struct efx_nic *efx); -int efx_set_channels(struct efx_nic *efx); -void efx_remove_channel(struct efx_channel *channel); -void efx_remove_channels(struct efx_nic *efx); -void efx_fini_channels(struct efx_nic *efx); -void efx_start_channels(struct efx_nic *efx); -void efx_stop_channels(struct efx_nic *efx); - -void efx_init_napi_channel(struct efx_channel *channel); -void efx_init_napi(struct efx_nic *efx); -void efx_fini_napi_channel(struct efx_channel *channel); -void efx_fini_napi(struct efx_nic *efx); - -void efx_channel_dummy_op_void(struct efx_channel *channel); +extern unsigned int efx_siena_interrupt_mode; +extern unsigned int efx_siena_rss_cpus; + +int efx_siena_probe_interrupts(struct efx_nic *efx); +void efx_siena_remove_interrupts(struct efx_nic *efx); +int efx_siena_enable_interrupts(struct efx_nic *efx); +void efx_siena_disable_interrupts(struct efx_nic *efx); + +void efx_siena_set_interrupt_affinity(struct efx_nic *efx); +void efx_siena_clear_interrupt_affinity(struct efx_nic *efx); + +void efx_siena_start_eventq(struct efx_channel *channel); +void efx_siena_stop_eventq(struct efx_channel *channel); + +int efx_siena_realloc_channels(struct efx_nic *efx, u32 rxq_entries, + u32 txq_entries); +void efx_siena_set_channel_names(struct efx_nic *efx); +int efx_siena_init_channels(struct efx_nic *efx); +int efx_siena_probe_channels(struct efx_nic *efx); +int efx_siena_set_channels(struct efx_nic *efx); +void efx_siena_remove_channel(struct efx_channel *channel); +void efx_siena_remove_channels(struct efx_nic *efx); +void efx_siena_fini_channels(struct efx_nic *efx); +void efx_siena_start_channels(struct efx_nic *efx); +void efx_siena_stop_channels(struct efx_nic *efx); + +void efx_siena_init_napi(struct efx_nic *efx); +void efx_siena_fini_napi(struct efx_nic *efx); + +void efx_siena_channel_dummy_op_void(struct efx_channel *channel); #endif diff --git a/drivers/net/ethernet/sfc/siena/efx_common.c b/drivers/net/ethernet/sfc/siena/efx_common.c index f6577e74d6e6..fb6fb345cc56 100644 --- a/drivers/net/ethernet/sfc/siena/efx_common.c +++ b/drivers/net/ethernet/sfc/siena/efx_common.c @@ -110,7 +110,7 @@ const char *const efx_loopback_mode_names[] = { */ static struct workqueue_struct *reset_workqueue; -int efx_create_reset_workqueue(void) +int efx_siena_create_reset_workqueue(void) { reset_workqueue = create_singlethread_workqueue("sfc_reset"); if (!reset_workqueue) { @@ -121,17 +121,17 @@ int efx_create_reset_workqueue(void) return 0; } -void efx_queue_reset_work(struct efx_nic *efx) +void efx_siena_queue_reset_work(struct efx_nic *efx) { queue_work(reset_workqueue, &efx->reset_work); } -void efx_flush_reset_workqueue(struct efx_nic *efx) +void efx_siena_flush_reset_workqueue(struct efx_nic *efx) { cancel_work_sync(&efx->reset_work); } -void efx_destroy_reset_workqueue(void) +void efx_siena_destroy_reset_workqueue(void) { if (reset_workqueue) { destroy_workqueue(reset_workqueue); @@ -142,7 +142,7 @@ void efx_destroy_reset_workqueue(void) /* We assume that efx->type->reconfigure_mac will always try to sync RX * filters and therefore needs to read-lock the filter table against freeing */ -void efx_mac_reconfigure(struct efx_nic *efx, bool mtu_only) +void efx_siena_mac_reconfigure(struct efx_nic *efx, bool mtu_only) { if (efx->type->reconfigure_mac) { down_read(&efx->filter_sem); @@ -161,11 +161,11 @@ static void efx_mac_work(struct work_struct *data) mutex_lock(&efx->mac_lock); if (efx->port_enabled) - efx_mac_reconfigure(efx, false); + efx_siena_mac_reconfigure(efx, false); mutex_unlock(&efx->mac_lock); } -int efx_set_mac_address(struct net_device *net_dev, void *data) +int efx_siena_set_mac_address(struct net_device *net_dev, void *data) { struct efx_nic *efx = netdev_priv(net_dev); struct sockaddr *addr = data; @@ -193,14 +193,14 @@ int efx_set_mac_address(struct net_device *net_dev, void *data) /* Reconfigure the MAC */ mutex_lock(&efx->mac_lock); - efx_mac_reconfigure(efx, false); + efx_siena_mac_reconfigure(efx, false); mutex_unlock(&efx->mac_lock); return 0; } /* Context: netif_addr_lock held, BHs disabled. */ -void efx_set_rx_mode(struct net_device *net_dev) +void efx_siena_set_rx_mode(struct net_device *net_dev) { struct efx_nic *efx = netdev_priv(net_dev); @@ -209,7 +209,7 @@ void efx_set_rx_mode(struct net_device *net_dev) /* Otherwise efx_start_port() will do this */ } -int efx_set_features(struct net_device *net_dev, netdev_features_t data) +int efx_siena_set_features(struct net_device *net_dev, netdev_features_t data) { struct efx_nic *efx = netdev_priv(net_dev); int rc; @@ -226,10 +226,10 @@ int efx_set_features(struct net_device *net_dev, netdev_features_t data) */ if ((net_dev->features ^ data) & (NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS)) { - /* efx_set_rx_mode() will schedule MAC work to update filters + /* efx_siena_set_rx_mode() will schedule MAC work to update filters * when a new features are finally set in net_dev. */ - efx_set_rx_mode(net_dev); + efx_siena_set_rx_mode(net_dev); } return 0; @@ -239,7 +239,7 @@ int efx_set_features(struct net_device *net_dev, netdev_features_t data) * netif_carrier_on/off) of the link status, and also maintains the * link status's stop on the port's TX queue. */ -void efx_link_status_changed(struct efx_nic *efx) +void efx_siena_link_status_changed(struct efx_nic *efx) { struct efx_link_state *link_state = &efx->link_state; @@ -270,7 +270,7 @@ void efx_link_status_changed(struct efx_nic *efx) netif_info(efx, link, efx->net_dev, "link down\n"); } -unsigned int efx_xdp_max_mtu(struct efx_nic *efx) +unsigned int efx_siena_xdp_max_mtu(struct efx_nic *efx) { /* The maximum MTU that we can fit in a single page, allowing for * framing, overhead and XDP headroom + tailroom. @@ -283,7 +283,7 @@ unsigned int efx_xdp_max_mtu(struct efx_nic *efx) } /* Context: process, rtnl_lock() held. */ -int efx_change_mtu(struct net_device *net_dev, int new_mtu) +int efx_siena_change_mtu(struct net_device *net_dev, int new_mtu) { struct efx_nic *efx = netdev_priv(net_dev); int rc; @@ -293,24 +293,24 @@ int efx_change_mtu(struct net_device *net_dev, int new_mtu) return rc; if (rtnl_dereference(efx->xdp_prog) && - new_mtu > efx_xdp_max_mtu(efx)) { + new_mtu > efx_siena_xdp_max_mtu(efx)) { netif_err(efx, drv, efx->net_dev, "Requested MTU of %d too big for XDP (max: %d)\n", - new_mtu, efx_xdp_max_mtu(efx)); + new_mtu, efx_siena_xdp_max_mtu(efx)); return -EINVAL; } netif_dbg(efx, drv, efx->net_dev, "changing MTU to %d\n", new_mtu); efx_device_detach_sync(efx); - efx_stop_all(efx); + efx_siena_stop_all(efx); mutex_lock(&efx->mac_lock); net_dev->mtu = new_mtu; - efx_mac_reconfigure(efx, true); + efx_siena_mac_reconfigure(efx, true); mutex_unlock(&efx->mac_lock); - efx_start_all(efx); + efx_siena_start_all(efx); efx_device_attach_if_not_resetting(efx); return 0; } @@ -342,10 +342,10 @@ static void efx_monitor(struct work_struct *data) mutex_unlock(&efx->mac_lock); } - efx_start_monitor(efx); + efx_siena_start_monitor(efx); } -void efx_start_monitor(struct efx_nic *efx) +void efx_siena_start_monitor(struct efx_nic *efx) { if (efx->type->monitor) queue_delayed_work(efx->workqueue, &efx->monitor_work, @@ -432,7 +432,7 @@ static void efx_start_datapath(struct efx_nic *efx) efx->txq_wake_thresh = efx->txq_stop_thresh / 2; /* Initialise the channels */ - efx_start_channels(efx); + efx_siena_start_channels(efx); efx_ptp_start_datapath(efx); @@ -447,7 +447,7 @@ static void efx_stop_datapath(struct efx_nic *efx) efx_ptp_stop_datapath(efx); - efx_stop_channels(efx); + efx_siena_stop_channels(efx); } /************************************************************************** @@ -459,13 +459,13 @@ static void efx_stop_datapath(struct efx_nic *efx) /* Equivalent to efx_link_set_advertising with all-zeroes, except does not * force the Autoneg bit on. */ -void efx_link_clear_advertising(struct efx_nic *efx) +void efx_siena_link_clear_advertising(struct efx_nic *efx) { bitmap_zero(efx->link_advertising, __ETHTOOL_LINK_MODE_MASK_NBITS); efx->wanted_fc &= ~(EFX_FC_TX | EFX_FC_RX); } -void efx_link_set_wanted_fc(struct efx_nic *efx, u8 wanted_fc) +void efx_siena_link_set_wanted_fc(struct efx_nic *efx, u8 wanted_fc) { efx->wanted_fc = wanted_fc; if (efx->link_advertising[0]) { @@ -489,7 +489,7 @@ static void efx_start_port(struct efx_nic *efx) efx->port_enabled = true; /* Ensure MAC ingress/egress is enabled */ - efx_mac_reconfigure(efx, false); + efx_siena_mac_reconfigure(efx, false); mutex_unlock(&efx->mac_lock); } @@ -525,7 +525,7 @@ static void efx_stop_port(struct efx_nic *efx) * is safe to call multiple times, so long as the NIC is not disabled. * Requires the RTNL lock. */ -void efx_start_all(struct efx_nic *efx) +void efx_siena_start_all(struct efx_nic *efx) { EFX_ASSERT_RESET_SERIALISED(efx); BUG_ON(efx->state == STATE_DISABLED); @@ -541,14 +541,14 @@ void efx_start_all(struct efx_nic *efx) efx_start_datapath(efx); /* Start the hardware monitor if there is one */ - efx_start_monitor(efx); + efx_siena_start_monitor(efx); /* Link state detection is normally event-driven; we have * to poll now because we could have missed a change */ mutex_lock(&efx->mac_lock); if (efx_mcdi_phy_poll(efx)) - efx_link_status_changed(efx); + efx_siena_link_status_changed(efx); mutex_unlock(&efx->mac_lock); if (efx->type->start_stats) { @@ -565,7 +565,7 @@ void efx_start_all(struct efx_nic *efx) * times with the NIC in almost any state, but interrupts should be * enabled. Requires the RTNL lock. */ -void efx_stop_all(struct efx_nic *efx) +void efx_siena_stop_all(struct efx_nic *efx) { EFX_ASSERT_RESET_SERIALISED(efx); @@ -598,7 +598,8 @@ void efx_stop_all(struct efx_nic *efx) } /* Context: process, dev_base_lock or RTNL held, non-blocking. */ -void efx_net_stats(struct net_device *net_dev, struct rtnl_link_stats64 *stats) +void efx_siena_net_stats(struct net_device *net_dev, + struct rtnl_link_stats64 *stats) { struct efx_nic *efx = netdev_priv(net_dev); @@ -614,7 +615,7 @@ void efx_net_stats(struct net_device *net_dev, struct rtnl_link_stats64 *stats) * * Callers must hold the mac_lock */ -int __efx_reconfigure_port(struct efx_nic *efx) +int __efx_siena_reconfigure_port(struct efx_nic *efx) { enum efx_phy_mode phy_mode; int rc = 0; @@ -640,14 +641,14 @@ int __efx_reconfigure_port(struct efx_nic *efx) /* Reinitialise the MAC to pick up new PHY settings, even if the port is * disabled. */ -int efx_reconfigure_port(struct efx_nic *efx) +int efx_siena_reconfigure_port(struct efx_nic *efx) { int rc; EFX_ASSERT_RESET_SERIALISED(efx); mutex_lock(&efx->mac_lock); - rc = __efx_reconfigure_port(efx); + rc = __efx_siena_reconfigure_port(efx); mutex_unlock(&efx->mac_lock); return rc; @@ -682,7 +683,7 @@ static void efx_wait_for_bist_end(struct efx_nic *efx) * Returns 0 if the recovery mechanisms are unsuccessful. * Returns a non-zero value otherwise. */ -int efx_try_recovery(struct efx_nic *efx) +int efx_siena_try_recovery(struct efx_nic *efx) { #ifdef CONFIG_EEH /* A PCI error can occur and not be seen by EEH because nothing @@ -704,15 +705,15 @@ int efx_try_recovery(struct efx_nic *efx) /* Tears down the entire software state and most of the hardware state * before reset. */ -void efx_reset_down(struct efx_nic *efx, enum reset_type method) +void efx_siena_reset_down(struct efx_nic *efx, enum reset_type method) { EFX_ASSERT_RESET_SERIALISED(efx); if (method == RESET_TYPE_MCDI_TIMEOUT) efx->type->prepare_flr(efx); - efx_stop_all(efx); - efx_disable_interrupts(efx); + efx_siena_stop_all(efx); + efx_siena_disable_interrupts(efx); mutex_lock(&efx->mac_lock); down_write(&efx->filter_sem); @@ -721,7 +722,7 @@ void efx_reset_down(struct efx_nic *efx, enum reset_type method) } /* Context: netif_tx_lock held, BHs disabled. */ -void efx_watchdog(struct net_device *net_dev, unsigned int txqueue) +void efx_siena_watchdog(struct net_device *net_dev, unsigned int txqueue) { struct efx_nic *efx = netdev_priv(net_dev); @@ -729,16 +730,16 @@ void efx_watchdog(struct net_device *net_dev, unsigned int txqueue) "TX stuck with port_enabled=%d: resetting channels\n", efx->port_enabled); - efx_schedule_reset(efx, RESET_TYPE_TX_WATCHDOG); + efx_siena_schedule_reset(efx, RESET_TYPE_TX_WATCHDOG); } /* This function will always ensure that the locks acquired in - * efx_reset_down() are released. A failure return code indicates + * efx_siena_reset_down() are released. A failure return code indicates * that we were unable to reinitialise the hardware, and the * driver should be disabled. If ok is false, then the rx and tx * engines are not restarted, pending a RESET_DISABLE. */ -int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) +int efx_siena_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) { int rc; @@ -765,7 +766,7 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) "could not restore PHY settings\n"); } - rc = efx_enable_interrupts(efx); + rc = efx_siena_enable_interrupts(efx); if (rc) goto fail; @@ -787,7 +788,7 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) mutex_unlock(&efx->mac_lock); - efx_start_all(efx); + efx_siena_start_all(efx); if (efx->type->udp_tnl_push_ports) efx->type->udp_tnl_push_ports(efx); @@ -809,7 +810,7 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) * * Caller must hold the rtnl_lock. */ -int efx_reset(struct efx_nic *efx, enum reset_type method) +int efx_siena_reset(struct efx_nic *efx, enum reset_type method) { int rc, rc2 = 0; bool disabled; @@ -818,11 +819,11 @@ int efx_reset(struct efx_nic *efx, enum reset_type method) RESET_TYPE(method)); efx_device_detach_sync(efx); - /* efx_reset_down() grabs locks that prevent recovery on EF100. + /* efx_siena_reset_down() grabs locks that prevent recovery on EF100. * EF100 reset is handled in the efx_nic_type callback below. */ if (efx_nic_rev(efx) != EFX_REV_EF100) - efx_reset_down(efx, method); + efx_siena_reset_down(efx, method); rc = efx->type->reset(efx, method); if (rc) { @@ -851,7 +852,7 @@ int efx_reset(struct efx_nic *efx, enum reset_type method) method == RESET_TYPE_DISABLE || method == RESET_TYPE_RECOVER_OR_DISABLE; if (efx_nic_rev(efx) != EFX_REV_EF100) - rc2 = efx_reset_up(efx, method, !disabled); + rc2 = efx_siena_reset_up(efx, method, !disabled); if (rc2) { disabled = true; if (!rc) @@ -886,7 +887,7 @@ static void efx_reset_work(struct work_struct *data) if ((method == RESET_TYPE_RECOVER_OR_DISABLE || method == RESET_TYPE_RECOVER_OR_ALL) && - efx_try_recovery(efx)) + efx_siena_try_recovery(efx)) return; if (!pending) @@ -894,17 +895,17 @@ static void efx_reset_work(struct work_struct *data) rtnl_lock(); - /* We checked the state in efx_schedule_reset() but it may + /* We checked the state in efx_siena_schedule_reset() but it may * have changed by now. Now that we have the RTNL lock, * it cannot change again. */ if (efx->state == STATE_READY) - (void)efx_reset(efx, method); + (void)efx_siena_reset(efx, method); rtnl_unlock(); } -void efx_schedule_reset(struct efx_nic *efx, enum reset_type type) +void efx_siena_schedule_reset(struct efx_nic *efx, enum reset_type type) { enum reset_type method; @@ -951,7 +952,7 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type) */ efx_mcdi_mode_poll(efx); - efx_queue_reset_work(efx); + efx_siena_queue_reset_work(efx); } /************************************************************************** @@ -963,11 +964,12 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type) * before use * **************************************************************************/ -int efx_port_dummy_op_int(struct efx_nic *efx) +int efx_siena_port_dummy_op_int(struct efx_nic *efx) { return 0; } -void efx_port_dummy_op_void(struct efx_nic *efx) {} + +void efx_siena_port_dummy_op_void(struct efx_nic *efx) {} /************************************************************************** * @@ -978,8 +980,8 @@ void efx_port_dummy_op_void(struct efx_nic *efx) {} /* This zeroes out and then fills in the invariants in a struct * efx_nic (including all sub-structures). */ -int efx_init_struct(struct efx_nic *efx, - struct pci_dev *pci_dev, struct net_device *net_dev) +int efx_siena_init_struct(struct efx_nic *efx, + struct pci_dev *pci_dev, struct net_device *net_dev) { int rc = -ENOMEM; @@ -1033,7 +1035,7 @@ int efx_init_struct(struct efx_nic *efx, efx->mem_bar = UINT_MAX; - rc = efx_init_channels(efx); + rc = efx_siena_init_channels(efx); if (rc) goto fail; @@ -1049,17 +1051,17 @@ int efx_init_struct(struct efx_nic *efx, return 0; fail: - efx_fini_struct(efx); + efx_siena_fini_struct(efx); return rc; } -void efx_fini_struct(struct efx_nic *efx) +void efx_siena_fini_struct(struct efx_nic *efx) { #ifdef CONFIG_RFS_ACCEL kfree(efx->rps_hash_table); #endif - efx_fini_channels(efx); + efx_siena_fini_channels(efx); kfree(efx->vpd_sn); @@ -1070,8 +1072,8 @@ void efx_fini_struct(struct efx_nic *efx) } /* This configures the PCI device to enable I/O and DMA. */ -int efx_init_io(struct efx_nic *efx, int bar, dma_addr_t dma_mask, - unsigned int mem_map_size) +int efx_siena_init_io(struct efx_nic *efx, int bar, dma_addr_t dma_mask, + unsigned int mem_map_size) { struct pci_dev *pci_dev = efx->pci_dev; int rc; @@ -1140,7 +1142,7 @@ int efx_init_io(struct efx_nic *efx, int bar, dma_addr_t dma_mask, return rc; } -void efx_fini_io(struct efx_nic *efx) +void efx_siena_fini_io(struct efx_nic *efx) { netif_dbg(efx, drv, efx->net_dev, "shutting down I/O\n"); @@ -1185,7 +1187,7 @@ static ssize_t mcdi_logging_store(struct device *dev, static DEVICE_ATTR_RW(mcdi_logging); -void efx_init_mcdi_logging(struct efx_nic *efx) +void efx_siena_init_mcdi_logging(struct efx_nic *efx) { int rc = device_create_file(&efx->pci_dev->dev, &dev_attr_mcdi_logging); @@ -1195,7 +1197,7 @@ void efx_init_mcdi_logging(struct efx_nic *efx) } } -void efx_fini_mcdi_logging(struct efx_nic *efx) +void efx_siena_fini_mcdi_logging(struct efx_nic *efx) { device_remove_file(&efx->pci_dev->dev, &dev_attr_mcdi_logging); } @@ -1222,8 +1224,8 @@ static pci_ers_result_t efx_io_error_detected(struct pci_dev *pdev, efx_device_detach_sync(efx); - efx_stop_all(efx); - efx_disable_interrupts(efx); + efx_siena_stop_all(efx); + efx_siena_disable_interrupts(efx); status = PCI_ERS_RESULT_NEED_RESET; } else { @@ -1266,10 +1268,10 @@ static void efx_io_resume(struct pci_dev *pdev) if (efx->state == STATE_DISABLED) goto out; - rc = efx_reset(efx, RESET_TYPE_ALL); + rc = efx_siena_reset(efx, RESET_TYPE_ALL); if (rc) { netif_err(efx, hw, efx->net_dev, - "efx_reset failed after PCI error (%d)\n", rc); + "efx_siena_reset failed after PCI error (%d)\n", rc); } else { efx->state = STATE_READY; netif_dbg(efx, hw, efx->net_dev, @@ -1286,7 +1288,7 @@ static void efx_io_resume(struct pci_dev *pdev) * with our request for slot reset the mmio_enabled callback will never be * called, and the link_reset callback is not used by AER or EEH mechanisms. */ -const struct pci_error_handlers efx_err_handlers = { +const struct pci_error_handlers efx_siena_err_handlers = { .error_detected = efx_io_error_detected, .slot_reset = efx_io_slot_reset, .resume = efx_io_resume, @@ -1354,8 +1356,9 @@ static bool efx_can_encap_offloads(struct efx_nic *efx, struct sk_buff *skb) } } -netdev_features_t efx_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t features) +netdev_features_t efx_siena_features_check(struct sk_buff *skb, + struct net_device *dev, + netdev_features_t features) { struct efx_nic *efx = netdev_priv(dev); @@ -1375,8 +1378,8 @@ netdev_features_t efx_features_check(struct sk_buff *skb, struct net_device *dev return features; } -int efx_get_phys_port_id(struct net_device *net_dev, - struct netdev_phys_item_id *ppid) +int efx_siena_get_phys_port_id(struct net_device *net_dev, + struct netdev_phys_item_id *ppid) { struct efx_nic *efx = netdev_priv(net_dev); @@ -1386,7 +1389,8 @@ int efx_get_phys_port_id(struct net_device *net_dev, return -EOPNOTSUPP; } -int efx_get_phys_port_name(struct net_device *net_dev, char *name, size_t len) +int efx_siena_get_phys_port_name(struct net_device *net_dev, + char *name, size_t len) { struct efx_nic *efx = netdev_priv(net_dev); diff --git a/drivers/net/ethernet/sfc/siena/efx_common.h b/drivers/net/ethernet/sfc/siena/efx_common.h index 65513fd0cf6c..470033611436 100644 --- a/drivers/net/ethernet/sfc/siena/efx_common.h +++ b/drivers/net/ethernet/sfc/siena/efx_common.h @@ -11,12 +11,12 @@ #ifndef EFX_COMMON_H #define EFX_COMMON_H -int efx_init_io(struct efx_nic *efx, int bar, dma_addr_t dma_mask, - unsigned int mem_map_size); -void efx_fini_io(struct efx_nic *efx); -int efx_init_struct(struct efx_nic *efx, struct pci_dev *pci_dev, - struct net_device *net_dev); -void efx_fini_struct(struct efx_nic *efx); +int efx_siena_init_io(struct efx_nic *efx, int bar, dma_addr_t dma_mask, + unsigned int mem_map_size); +void efx_siena_fini_io(struct efx_nic *efx); +int efx_siena_init_struct(struct efx_nic *efx, struct pci_dev *pci_dev, + struct net_device *net_dev); +void efx_siena_fini_struct(struct efx_nic *efx); #define EFX_MAX_DMAQ_SIZE 4096UL #define EFX_DEFAULT_DMAQ_SIZE 1024UL @@ -25,23 +25,24 @@ void efx_fini_struct(struct efx_nic *efx); #define EFX_MAX_EVQ_SIZE 16384UL #define EFX_MIN_EVQ_SIZE 512UL -void efx_link_clear_advertising(struct efx_nic *efx); -void efx_link_set_wanted_fc(struct efx_nic *efx, u8); +void efx_siena_link_clear_advertising(struct efx_nic *efx); +void efx_siena_link_set_wanted_fc(struct efx_nic *efx, u8 wanted_fc); -void efx_start_all(struct efx_nic *efx); -void efx_stop_all(struct efx_nic *efx); +void efx_siena_start_all(struct efx_nic *efx); +void efx_siena_stop_all(struct efx_nic *efx); -void efx_net_stats(struct net_device *net_dev, struct rtnl_link_stats64 *stats); +void efx_siena_net_stats(struct net_device *net_dev, + struct rtnl_link_stats64 *stats); -int efx_create_reset_workqueue(void); -void efx_queue_reset_work(struct efx_nic *efx); -void efx_flush_reset_workqueue(struct efx_nic *efx); -void efx_destroy_reset_workqueue(void); +int efx_siena_create_reset_workqueue(void); +void efx_siena_queue_reset_work(struct efx_nic *efx); +void efx_siena_flush_reset_workqueue(struct efx_nic *efx); +void efx_siena_destroy_reset_workqueue(void); -void efx_start_monitor(struct efx_nic *efx); +void efx_siena_start_monitor(struct efx_nic *efx); -int __efx_reconfigure_port(struct efx_nic *efx); -int efx_reconfigure_port(struct efx_nic *efx); +int __efx_siena_reconfigure_port(struct efx_nic *efx); +int efx_siena_reconfigure_port(struct efx_nic *efx); #define EFX_ASSERT_RESET_SERIALISED(efx) \ do { \ @@ -51,16 +52,16 @@ int efx_reconfigure_port(struct efx_nic *efx); ASSERT_RTNL(); \ } while (0) -int efx_try_recovery(struct efx_nic *efx); -void efx_reset_down(struct efx_nic *efx, enum reset_type method); -void efx_watchdog(struct net_device *net_dev, unsigned int txqueue); -int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok); -int efx_reset(struct efx_nic *efx, enum reset_type method); -void efx_schedule_reset(struct efx_nic *efx, enum reset_type type); +int efx_siena_try_recovery(struct efx_nic *efx); +void efx_siena_reset_down(struct efx_nic *efx, enum reset_type method); +void efx_siena_watchdog(struct net_device *net_dev, unsigned int txqueue); +int efx_siena_reset_up(struct efx_nic *efx, enum reset_type method, bool ok); +int efx_siena_reset(struct efx_nic *efx, enum reset_type method); +void efx_siena_schedule_reset(struct efx_nic *efx, enum reset_type type); /* Dummy PHY ops for PHY drivers */ -int efx_port_dummy_op_int(struct efx_nic *efx); -void efx_port_dummy_op_void(struct efx_nic *efx); +int efx_siena_port_dummy_op_int(struct efx_nic *efx); +void efx_siena_port_dummy_op_void(struct efx_nic *efx); static inline int efx_check_disabled(struct efx_nic *efx) { @@ -88,29 +89,30 @@ static inline void efx_schedule_channel_irq(struct efx_channel *channel) } #ifdef CONFIG_SFC_MCDI_LOGGING -void efx_init_mcdi_logging(struct efx_nic *efx); -void efx_fini_mcdi_logging(struct efx_nic *efx); +void efx_siena_init_mcdi_logging(struct efx_nic *efx); +void efx_siena_fini_mcdi_logging(struct efx_nic *efx); #else -static inline void efx_init_mcdi_logging(struct efx_nic *efx) {} -static inline void efx_fini_mcdi_logging(struct efx_nic *efx) {} +static inline void efx_siena_init_mcdi_logging(struct efx_nic *efx) {} +static inline void efx_siena_fini_mcdi_logging(struct efx_nic *efx) {} #endif -void efx_mac_reconfigure(struct efx_nic *efx, bool mtu_only); -int efx_set_mac_address(struct net_device *net_dev, void *data); -void efx_set_rx_mode(struct net_device *net_dev); -int efx_set_features(struct net_device *net_dev, netdev_features_t data); -void efx_link_status_changed(struct efx_nic *efx); -unsigned int efx_xdp_max_mtu(struct efx_nic *efx); -int efx_change_mtu(struct net_device *net_dev, int new_mtu); +void efx_siena_mac_reconfigure(struct efx_nic *efx, bool mtu_only); +int efx_siena_set_mac_address(struct net_device *net_dev, void *data); +void efx_siena_set_rx_mode(struct net_device *net_dev); +int efx_siena_set_features(struct net_device *net_dev, netdev_features_t data); +void efx_siena_link_status_changed(struct efx_nic *efx); +unsigned int efx_siena_xdp_max_mtu(struct efx_nic *efx); +int efx_siena_change_mtu(struct net_device *net_dev, int new_mtu); -extern const struct pci_error_handlers efx_err_handlers; +extern const struct pci_error_handlers efx_siena_err_handlers; -netdev_features_t efx_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t features); +netdev_features_t efx_siena_features_check(struct sk_buff *skb, + struct net_device *dev, + netdev_features_t features); -int efx_get_phys_port_id(struct net_device *net_dev, - struct netdev_phys_item_id *ppid); +int efx_siena_get_phys_port_id(struct net_device *net_dev, + struct netdev_phys_item_id *ppid); -int efx_get_phys_port_name(struct net_device *net_dev, - char *name, size_t len); +int efx_siena_get_phys_port_name(struct net_device *net_dev, + char *name, size_t len); #endif diff --git a/drivers/net/ethernet/sfc/siena/enum.h b/drivers/net/ethernet/sfc/siena/enum.h index cd590e0685e5..25b28b3969d7 100644 --- a/drivers/net/ethernet/sfc/siena/enum.h +++ b/drivers/net/ethernet/sfc/siena/enum.h @@ -127,7 +127,7 @@ enum efx_loopback_mode { * * %RESET_TYPE_INVSIBLE, %RESET_TYPE_ALL, %RESET_TYPE_WORLD and * %RESET_TYPE_DISABLE specify the method/scope of the reset. The - * other valuesspecify reasons, which efx_schedule_reset() will choose + * other valuesspecify reasons, which efx_siena_schedule_reset() will choose * a method for. * * Reset methods are numbered in order of increasing scope. diff --git a/drivers/net/ethernet/sfc/siena/ethtool.c b/drivers/net/ethernet/sfc/siena/ethtool.c index 48506373721a..7aa621e97212 100644 --- a/drivers/net/ethernet/sfc/siena/ethtool.c +++ b/drivers/net/ethernet/sfc/siena/ethtool.c @@ -105,7 +105,7 @@ static int efx_ethtool_get_coalesce(struct net_device *net_dev, unsigned int tx_usecs, rx_usecs; bool rx_adaptive; - efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &rx_adaptive); + efx_siena_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &rx_adaptive); coalesce->tx_coalesce_usecs = tx_usecs; coalesce->tx_coalesce_usecs_irq = tx_usecs; @@ -127,7 +127,7 @@ static int efx_ethtool_set_coalesce(struct net_device *net_dev, bool adaptive, rx_may_override_tx; int rc; - efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &adaptive); + efx_siena_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &adaptive); if (coalesce->rx_coalesce_usecs != rx_usecs) rx_usecs = coalesce->rx_coalesce_usecs; @@ -146,8 +146,8 @@ static int efx_ethtool_set_coalesce(struct net_device *net_dev, else tx_usecs = coalesce->tx_coalesce_usecs_irq; - rc = efx_init_irq_moderation(efx, tx_usecs, rx_usecs, adaptive, - rx_may_override_tx); + rc = efx_siena_init_irq_moderation(efx, tx_usecs, rx_usecs, adaptive, + rx_may_override_tx); if (rc != 0) return rc; @@ -198,7 +198,7 @@ efx_ethtool_set_ringparam(struct net_device *net_dev, "increasing TX queue size to minimum of %u\n", txq_entries); - return efx_realloc_channels(efx, ring->rx_pending, txq_entries); + return efx_siena_realloc_channels(efx, ring->rx_pending, txq_entries); } static void efx_ethtool_get_wol(struct net_device *net_dev, @@ -239,7 +239,7 @@ static int efx_ethtool_get_ts_info(struct net_device *net_dev, return 0; } -const struct ethtool_ops efx_ethtool_ops = { +const struct ethtool_ops efx_siena_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_USECS_IRQ | ETHTOOL_COALESCE_USE_ADAPTIVE_RX, diff --git a/drivers/net/ethernet/sfc/siena/ethtool_common.c b/drivers/net/ethernet/sfc/siena/ethtool_common.c index bd552c7dffcb..e177b58e0664 100644 --- a/drivers/net/ethernet/sfc/siena/ethtool_common.c +++ b/drivers/net/ethernet/sfc/siena/ethtool_common.c @@ -218,7 +218,7 @@ int efx_ethtool_set_pauseparam(struct net_device *net_dev, old_adv = efx->link_advertising[0]; old_fc = efx->wanted_fc; - efx_link_set_wanted_fc(efx, wanted_fc); + efx_siena_link_set_wanted_fc(efx, wanted_fc); if (efx->link_advertising[0] != old_adv || (efx->wanted_fc ^ old_fc) & EFX_FC_AUTO) { rc = efx_mcdi_port_reconfigure(efx); @@ -233,7 +233,7 @@ int efx_ethtool_set_pauseparam(struct net_device *net_dev, /* Reconfigure the MAC. The PHY *may* generate a link state change event * if the user just changed the advertised capabilities, but there's no * harm doing this twice */ - efx_mac_reconfigure(efx, false); + efx_siena_mac_reconfigure(efx, false); out: mutex_unlock(&efx->mac_lock); @@ -1307,7 +1307,7 @@ int efx_ethtool_reset(struct net_device *net_dev, u32 *flags) if (rc < 0) return rc; - return efx_reset(efx, rc); + return efx_siena_reset(efx, rc); } int efx_ethtool_get_module_eeprom(struct net_device *net_dev, diff --git a/drivers/net/ethernet/sfc/siena/farch.c b/drivers/net/ethernet/sfc/siena/farch.c index 9599123bc28d..6ee6ca192a44 100644 --- a/drivers/net/ethernet/sfc/siena/farch.c +++ b/drivers/net/ethernet/sfc/siena/farch.c @@ -747,12 +747,13 @@ int efx_farch_fini_dmaq(struct efx_nic *efx) * completion events. This means that efx->rxq_flush_outstanding remained at 4 * after the FLR; also, efx->active_queues was non-zero (as no flush completion * events were received, and we didn't go through efx_check_tx_flush_complete()) - * If we don't fix this up, on the next call to efx_realloc_channels() we won't - * flush any RX queues because efx->rxq_flush_outstanding is at the limit of 4 - * for batched flush requests; and the efx->active_queues gets messed up because - * we keep incrementing for the newly initialised queues, but it never went to - * zero previously. Then we get a timeout every time we try to restart the - * queues, as it doesn't go back to zero when we should be flushing the queues. + * If we don't fix this up, on the next call to efx_siena_realloc_channels() we + * won't flush any RX queues because efx->rxq_flush_outstanding is at the limit + * of 4 for batched flush requests; and the efx->active_queues gets messed up + * because we keep incrementing for the newly initialised queues, but it never + * went to zero previously. Then we get a timeout every time we try to restart + * the queues, as it doesn't go back to zero when we should be flushing the + * queues. */ void efx_farch_finish_flr(struct efx_nic *efx) { @@ -838,7 +839,7 @@ efx_farch_handle_tx_event(struct efx_channel *channel, efx_qword_t *event) tx_ev_q_label = EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_Q_LABEL); tx_queue = channel->tx_queue + (tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL); - efx_xmit_done(tx_queue, tx_ev_desc_ptr); + efx_siena_xmit_done(tx_queue, tx_ev_desc_ptr); } else if (EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_WQ_FF_FULL)) { /* Rewrite the FIFO write pointer */ tx_ev_q_label = EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_Q_LABEL); @@ -849,7 +850,7 @@ efx_farch_handle_tx_event(struct efx_channel *channel, efx_qword_t *event) efx_farch_notify_tx_desc(tx_queue); netif_tx_unlock(efx->net_dev); } else if (EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_PKT_ERR)) { - efx_schedule_reset(efx, RESET_TYPE_DMA_ERROR); + efx_siena_schedule_reset(efx, RESET_TYPE_DMA_ERROR); } else { netif_err(efx, tx_err, efx->net_dev, "channel %d unexpected TX event " @@ -956,7 +957,7 @@ efx_farch_handle_rx_bad_index(struct efx_rx_queue *rx_queue, unsigned index) "dropped %d events (index=%d expected=%d)\n", dropped, index, expected); - efx_schedule_reset(efx, RESET_TYPE_DISABLE); + efx_siena_schedule_reset(efx, RESET_TYPE_DISABLE); return false; } @@ -1001,7 +1002,7 @@ efx_farch_handle_rx_event(struct efx_channel *channel, const efx_qword_t *event) /* Discard all pending fragments */ if (rx_queue->scatter_n) { - efx_rx_packet( + efx_siena_rx_packet( rx_queue, rx_queue->removed_count & rx_queue->ptr_mask, rx_queue->scatter_n, 0, EFX_RX_PKT_DISCARD); @@ -1015,7 +1016,7 @@ efx_farch_handle_rx_event(struct efx_channel *channel, const efx_qword_t *event) /* Discard new fragment if not SOP */ if (!rx_ev_sop) { - efx_rx_packet( + efx_siena_rx_packet( rx_queue, rx_queue->removed_count & rx_queue->ptr_mask, 1, 0, EFX_RX_PKT_DISCARD); @@ -1067,9 +1068,9 @@ efx_farch_handle_rx_event(struct efx_channel *channel, const efx_qword_t *event) channel->irq_mod_score += 2; /* Handle received packet */ - efx_rx_packet(rx_queue, - rx_queue->removed_count & rx_queue->ptr_mask, - rx_queue->scatter_n, rx_ev_byte_cnt, flags); + efx_siena_rx_packet(rx_queue, + rx_queue->removed_count & rx_queue->ptr_mask, + rx_queue->scatter_n, rx_ev_byte_cnt, flags); rx_queue->removed_count += rx_queue->scatter_n; rx_queue->scatter_n = 0; } @@ -1222,7 +1223,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event) "channel %d seen DRIVER RX_RESET event. " "Resetting.\n", channel->channel); atomic_inc(&efx->rx_reset); - efx_schedule_reset(efx, RESET_TYPE_DISABLE); + efx_siena_schedule_reset(efx, RESET_TYPE_DISABLE); break; case FSE_BZ_RX_DSC_ERROR_EV: if (ev_sub_data < EFX_VI_BASE) { @@ -1230,7 +1231,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event) "RX DMA Q %d reports descriptor fetch error." " RX Q %d is disabled.\n", ev_sub_data, ev_sub_data); - efx_schedule_reset(efx, RESET_TYPE_DMA_ERROR); + efx_siena_schedule_reset(efx, RESET_TYPE_DMA_ERROR); } #ifdef CONFIG_SFC_SRIOV else @@ -1243,7 +1244,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event) "TX DMA Q %d reports descriptor fetch error." " TX Q %d is disabled.\n", ev_sub_data, ev_sub_data); - efx_schedule_reset(efx, RESET_TYPE_DMA_ERROR); + efx_siena_schedule_reset(efx, RESET_TYPE_DMA_ERROR); } #ifdef CONFIG_SFC_SRIOV else @@ -1496,12 +1497,12 @@ irqreturn_t efx_farch_fatal_interrupt(struct efx_nic *efx) if (++efx->int_error_count < EFX_MAX_INT_ERRORS) { netif_err(efx, hw, efx->net_dev, "SYSTEM ERROR - reset scheduled\n"); - efx_schedule_reset(efx, RESET_TYPE_INT_ERROR); + efx_siena_schedule_reset(efx, RESET_TYPE_INT_ERROR); } else { netif_err(efx, hw, efx->net_dev, "SYSTEM ERROR - max number of errors seen." "NIC will be disabled\n"); - efx_schedule_reset(efx, RESET_TYPE_DISABLE); + efx_siena_schedule_reset(efx, RESET_TYPE_DISABLE); } return IRQ_HANDLED; @@ -1529,7 +1530,7 @@ irqreturn_t efx_farch_legacy_interrupt(int irq, void *dev_id) * code. Disable them earlier. * If an EEH error occurred, the read will have returned all ones. */ - if (EFX_DWORD_IS_ALL_ONES(reg) && efx_try_recovery(efx) && + if (EFX_DWORD_IS_ALL_ONES(reg) && efx_siena_try_recovery(efx) && !efx->eeh_disabled_legacy_irq) { disable_irq_nosync(efx->legacy_irq); efx->eeh_disabled_legacy_irq = true; diff --git a/drivers/net/ethernet/sfc/siena/mcdi.c b/drivers/net/ethernet/sfc/siena/mcdi.c index 50baf62b2cbc..7f8f0889bf8d 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi.c +++ b/drivers/net/ethernet/sfc/siena/mcdi.c @@ -725,7 +725,7 @@ static int _efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned int cmd, cmd, -rc); if (efx->type->mcdi_reboot_detected) efx->type->mcdi_reboot_detected(efx); - efx_schedule_reset(efx, RESET_TYPE_MC_FAILURE); + efx_siena_schedule_reset(efx, RESET_TYPE_MC_FAILURE); } else if (proxy_handle && (rc == -EPROTO) && efx_mcdi_get_proxy_handle(efx, hdr_len, data_len, proxy_handle)) { @@ -849,7 +849,7 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd, cmd, rc); if (rc == -EINTR || rc == -EIO) - efx_schedule_reset(efx, RESET_TYPE_MC_FAILURE); + efx_siena_schedule_reset(efx, RESET_TYPE_MC_FAILURE); efx_mcdi_release(mcdi); } } @@ -1254,7 +1254,7 @@ static void efx_mcdi_ev_death(struct efx_nic *efx, int rc) mcdi->new_epoch = true; /* Nobody was waiting for an MCDI request, so trigger a reset */ - efx_schedule_reset(efx, RESET_TYPE_MC_FAILURE); + efx_siena_schedule_reset(efx, RESET_TYPE_MC_FAILURE); } spin_unlock(&mcdi->iface_lock); @@ -1282,7 +1282,7 @@ static void efx_mcdi_ev_bist(struct efx_nic *efx) } } mcdi->new_epoch = true; - efx_schedule_reset(efx, RESET_TYPE_MC_BIST); + efx_siena_schedule_reset(efx, RESET_TYPE_MC_BIST); spin_unlock(&mcdi->iface_lock); } @@ -1296,7 +1296,7 @@ static void efx_mcdi_abandon(struct efx_nic *efx) if (xchg(&mcdi->mode, MCDI_MODE_FAIL) == MCDI_MODE_FAIL) return; /* it had already been done */ netif_dbg(efx, hw, efx->net_dev, "MCDI is timing out; trying to recover\n"); - efx_schedule_reset(efx, RESET_TYPE_MCDI_TIMEOUT); + efx_siena_schedule_reset(efx, RESET_TYPE_MCDI_TIMEOUT); } static void efx_handle_drain_event(struct efx_nic *efx) @@ -1387,7 +1387,7 @@ void efx_mcdi_process_event(struct efx_channel *channel, "%s DMA error (event: "EFX_QWORD_FMT")\n", code == MCDI_EVENT_CODE_TX_ERR ? "TX" : "RX", EFX_QWORD_VAL(*event)); - efx_schedule_reset(efx, RESET_TYPE_DMA_ERROR); + efx_siena_schedule_reset(efx, RESET_TYPE_DMA_ERROR); break; case MCDI_EVENT_CODE_PROXY_RESPONSE: efx_mcdi_ev_proxy_response(efx, diff --git a/drivers/net/ethernet/sfc/siena/mcdi_port_common.c b/drivers/net/ethernet/sfc/siena/mcdi_port_common.c index 899cc1671004..57908045fb15 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi_port_common.c +++ b/drivers/net/ethernet/sfc/siena/mcdi_port_common.c @@ -518,7 +518,7 @@ int efx_mcdi_phy_probe(struct efx_nic *efx) efx->wanted_fc = EFX_FC_RX | EFX_FC_TX; if (phy_data->supported_cap & (1 << MC_CMD_PHY_CAP_AN_LBN)) efx->wanted_fc |= EFX_FC_AUTO; - efx_link_set_wanted_fc(efx, efx->wanted_fc); + efx_siena_link_set_wanted_fc(efx, efx->wanted_fc); return 0; @@ -605,7 +605,7 @@ int efx_mcdi_phy_set_link_ksettings(struct efx_nic *efx, const struct ethtool_li efx_link_set_advertising(efx, cmd->link_modes.advertising); phy_cfg->forced_cap = 0; } else { - efx_link_clear_advertising(efx); + efx_siena_link_clear_advertising(efx); phy_cfg->forced_cap = caps; } return 0; @@ -1297,5 +1297,5 @@ void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev) efx_mcdi_phy_check_fcntl(efx, lpa); - efx_link_status_changed(efx); + efx_siena_link_status_changed(efx); } diff --git a/drivers/net/ethernet/sfc/siena/mtd.c b/drivers/net/ethernet/sfc/siena/mtd.c index 273c08e5455f..12a624247f44 100644 --- a/drivers/net/ethernet/sfc/siena/mtd.c +++ b/drivers/net/ethernet/sfc/siena/mtd.c @@ -37,7 +37,7 @@ static void efx_mtd_sync(struct mtd_info *mtd) part->name, part->dev_type_name, rc); } -static void efx_mtd_remove_partition(struct efx_mtd_partition *part) +static void efx_siena_mtd_remove_partition(struct efx_mtd_partition *part) { int rc; @@ -51,8 +51,8 @@ static void efx_mtd_remove_partition(struct efx_mtd_partition *part) list_del(&part->node); } -int efx_mtd_add(struct efx_nic *efx, struct efx_mtd_partition *parts, - size_t n_parts, size_t sizeof_part) +int efx_siena_mtd_add(struct efx_nic *efx, struct efx_mtd_partition *parts, + size_t n_parts, size_t sizeof_part) { struct efx_mtd_partition *part; size_t i; @@ -79,7 +79,7 @@ int efx_mtd_add(struct efx_nic *efx, struct efx_mtd_partition *parts, if (mtd_device_register(&part->mtd, NULL, 0)) goto fail; - /* Add to list in order - efx_mtd_remove() depends on this */ + /* Add to list in order - efx_siena_mtd_remove() depends on this */ list_add_tail(&part->node, &efx->mtd_list); } @@ -89,13 +89,13 @@ int efx_mtd_add(struct efx_nic *efx, struct efx_mtd_partition *parts, while (i--) { part = (struct efx_mtd_partition *)((char *)parts + i * sizeof_part); - efx_mtd_remove_partition(part); + efx_siena_mtd_remove_partition(part); } /* Failure is unlikely here, but probably means we're out of memory */ return -ENOMEM; } -void efx_mtd_remove(struct efx_nic *efx) +void efx_siena_mtd_remove(struct efx_nic *efx) { struct efx_mtd_partition *parts, *part, *next; @@ -108,12 +108,12 @@ void efx_mtd_remove(struct efx_nic *efx) node); list_for_each_entry_safe(part, next, &efx->mtd_list, node) - efx_mtd_remove_partition(part); + efx_siena_mtd_remove_partition(part); kfree(parts); } -void efx_mtd_rename(struct efx_nic *efx) +void efx_siena_mtd_rename(struct efx_nic *efx) { struct efx_mtd_partition *part; diff --git a/drivers/net/ethernet/sfc/siena/net_driver.h b/drivers/net/ethernet/sfc/siena/net_driver.h index 318db906a154..3fe93f25a569 100644 --- a/drivers/net/ethernet/sfc/siena/net_driver.h +++ b/drivers/net/ethernet/sfc/siena/net_driver.h @@ -207,7 +207,6 @@ struct efx_tx_buffer { * @txd: The hardware descriptor ring * @ptr_mask: The size of the ring minus 1. * @piobuf: PIO buffer region for this TX queue (shared with its partner). - * Size of the region is efx_piobuf_size. * @piobuf_offset: Buffer offset to be specified in PIO descriptors * @initialised: Has hardware queue been initialised? * @timestamping: Is timestamping enabled for this channel? @@ -478,9 +477,9 @@ enum efx_sync_events_state { * @n_rx_xdp_tx: Count of RX packets retransmitted due to XDP * @n_rx_xdp_redirect: Count of RX packets redirected to a different NIC by XDP * @rx_pkt_n_frags: Number of fragments in next packet to be delivered by - * __efx_rx_packet(), or zero if there is none + * __efx_siena_rx_packet(), or zero if there is none * @rx_pkt_index: Ring index of first buffer for next packet to be delivered - * by __efx_rx_packet(), if @rx_pkt_n_frags != 0 + * by __efx_siena_rx_packet(), if @rx_pkt_n_frags != 0 * @rx_list: list of SKBs from current RX, awaiting processing * @rx_queue: RX queue for this channel * @tx_queue: TX queues for this channel @@ -869,12 +868,12 @@ enum efx_xdp_tx_queues_mode { * @nic_data: Hardware dependent state * @mcdi: Management-Controller-to-Driver Interface state * @mac_lock: MAC access lock. Protects @port_enabled, @phy_mode, - * efx_monitor() and efx_reconfigure_port() + * efx_monitor() and efx_siena_reconfigure_port() * @port_enabled: Port enabled indicator. - * Serialises efx_stop_all(), efx_start_all(), efx_monitor() and - * efx_mac_work() with kernel interfaces. Safe to read under any - * one of the rtnl_lock, mac_lock, or netif_tx_lock, but all three must - * be held to modify it. + * Serialises efx_siena_stop_all(), efx_siena_start_all(), + * efx_monitor() and efx_mac_work() with kernel interfaces. + * Safe to read under any one of the rtnl_lock, mac_lock, or netif_tx_lock, + * but all three must be held to modify it. * @port_initialized: Port initialized? * @net_dev: Operating system network device. Consider holding the rtnl lock * @fixed_features: Features which cannot be turned off @@ -1255,7 +1254,7 @@ struct efx_udp_tunnel { * This must check whether the specified table entry is used by RFS * and that rps_may_expire_flow() returns true for it. * @mtd_probe: Probe and add MTD partitions associated with this net device, - * using efx_mtd_add() + * using efx_siena_mtd_add() * @mtd_rename: Set an MTD partition name using the net device name * @mtd_read: Read from an MTD partition * @mtd_erase: Erase part of an MTD partition diff --git a/drivers/net/ethernet/sfc/siena/rx.c b/drivers/net/ethernet/sfc/siena/rx.c index 2375cef577e4..099cb23e3250 100644 --- a/drivers/net/ethernet/sfc/siena/rx.c +++ b/drivers/net/ethernet/sfc/siena/rx.c @@ -118,8 +118,8 @@ static struct sk_buff *efx_rx_mk_skb(struct efx_channel *channel, return skb; } -void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, - unsigned int n_frags, unsigned int len, u16 flags) +void efx_siena_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, + unsigned int n_frags, unsigned int len, u16 flags) { struct efx_nic *efx = rx_queue->efx; struct efx_channel *channel = efx_rx_queue_channel(rx_queue); @@ -310,7 +310,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, case XDP_TX: /* Buffer ownership passes to tx on success. */ xdpf = xdp_convert_buff_to_frame(&xdp); - err = efx_xdp_tx_buffers(efx, 1, &xdpf, true); + err = efx_siena_xdp_tx_buffers(efx, 1, &xdpf, true); if (unlikely(err != 1)) { efx_free_rx_buffers(rx_queue, rx_buf, 1); if (net_ratelimit()) @@ -357,7 +357,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, } /* Handle a received packet. Second half: Touches packet payload. */ -void __efx_rx_packet(struct efx_channel *channel) +void __efx_siena_rx_packet(struct efx_channel *channel) { struct efx_nic *efx = channel->efx; struct efx_rx_buffer *rx_buf = @@ -391,7 +391,8 @@ void __efx_rx_packet(struct efx_channel *channel) rx_buf->flags &= ~EFX_RX_PKT_CSUMMED; if ((rx_buf->flags & EFX_RX_PKT_TCP) && !channel->type->receive_skb) - efx_rx_packet_gro(channel, rx_buf, channel->rx_pkt_n_frags, eh, 0); + efx_siena_rx_packet_gro(channel, rx_buf, + channel->rx_pkt_n_frags, eh, 0); else efx_rx_deliver(channel, eh, rx_buf, channel->rx_pkt_n_frags); out: diff --git a/drivers/net/ethernet/sfc/siena/rx_common.c b/drivers/net/ethernet/sfc/siena/rx_common.c index fa8b9aacca11..9fb442da043c 100644 --- a/drivers/net/ethernet/sfc/siena/rx_common.c +++ b/drivers/net/ethernet/sfc/siena/rx_common.c @@ -504,8 +504,9 @@ void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue, bool atomic) * regardless of checksum state and skbs with a good checksum. */ void -efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf, - unsigned int n_frags, u8 *eh, __wsum csum) +efx_siena_rx_packet_gro(struct efx_channel *channel, + struct efx_rx_buffer *rx_buf, + unsigned int n_frags, u8 *eh, __wsum csum) { struct napi_struct *napi = &channel->napi_str; struct efx_nic *efx = channel->efx; @@ -520,8 +521,7 @@ efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf, return; } - if (efx->net_dev->features & NETIF_F_RXHASH && - efx_rx_buf_hash_valid(efx, eh)) + if (efx->net_dev->features & NETIF_F_RXHASH) skb_set_hash(skb, efx_rx_buf_hash(efx, eh), PKT_HASH_TYPE_L3); if (csum) { diff --git a/drivers/net/ethernet/sfc/siena/rx_common.h b/drivers/net/ethernet/sfc/siena/rx_common.h index fbd2769307f9..909d06a4fdc9 100644 --- a/drivers/net/ethernet/sfc/siena/rx_common.h +++ b/drivers/net/ethernet/sfc/siena/rx_common.h @@ -81,8 +81,9 @@ void efx_rx_config_page_split(struct efx_nic *efx); void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue, bool atomic); void -efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf, - unsigned int n_frags, u8 *eh, __wsum csum); +efx_siena_rx_packet_gro(struct efx_channel *channel, + struct efx_rx_buffer *rx_buf, + unsigned int n_frags, u8 *eh, __wsum csum); struct efx_rss_context *efx_alloc_rss_context_entry(struct efx_nic *efx); struct efx_rss_context *efx_find_rss_context_entry(struct efx_nic *efx, u32 id); diff --git a/drivers/net/ethernet/sfc/siena/selftest.c b/drivers/net/ethernet/sfc/siena/selftest.c index 3c5227afd497..7e24329bc005 100644 --- a/drivers/net/ethernet/sfc/siena/selftest.c +++ b/drivers/net/ethernet/sfc/siena/selftest.c @@ -58,14 +58,14 @@ static const char payload_msg[] = "Hello world! This is an Efx loopback test in progress!"; /* Interrupt mode names */ -static const unsigned int efx_interrupt_mode_max = EFX_INT_MODE_MAX; -static const char *const efx_interrupt_mode_names[] = { +static const unsigned int efx_siena_interrupt_mode_max = EFX_INT_MODE_MAX; +static const char *const efx_siena_interrupt_mode_names[] = { [EFX_INT_MODE_MSIX] = "MSI-X", [EFX_INT_MODE_MSI] = "MSI", [EFX_INT_MODE_LEGACY] = "legacy", }; #define INT_MODE(efx) \ - STRING_TABLE_LOOKUP(efx->interrupt_mode, efx_interrupt_mode) + STRING_TABLE_LOOKUP(efx->interrupt_mode, efx_siena_interrupt_mode) /** * struct efx_loopback_state - persistent state during a loopback selftest @@ -197,7 +197,7 @@ static int efx_test_eventq_irq(struct efx_nic *efx, schedule_timeout_uninterruptible(wait); efx_for_each_channel(channel, efx) { - efx_stop_eventq(channel); + efx_siena_stop_eventq(channel); if (channel->eventq_read_ptr != read_ptr[channel->channel]) { set_bit(channel->channel, &napi_ran); @@ -209,7 +209,7 @@ static int efx_test_eventq_irq(struct efx_nic *efx, if (efx_nic_event_test_irq_cpu(channel) >= 0) clear_bit(channel->channel, &int_pend); } - efx_start_eventq(channel); + efx_siena_start_eventq(channel); } wait *= 2; @@ -637,7 +637,7 @@ static int efx_test_loopbacks(struct efx_nic *efx, struct efx_self_tests *tests, state->flush = true; mutex_lock(&efx->mac_lock); efx->loopback_mode = mode; - rc = __efx_reconfigure_port(efx); + rc = __efx_siena_reconfigure_port(efx); mutex_unlock(&efx->mac_lock); if (rc) { netif_err(efx, drv, efx->net_dev, @@ -731,7 +731,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, if (rc_reset) { netif_err(efx, hw, efx->net_dev, "Unable to recover from chip test\n"); - efx_schedule_reset(efx, RESET_TYPE_DISABLE); + efx_siena_schedule_reset(efx, RESET_TYPE_DISABLE); return rc_reset; } @@ -744,7 +744,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, mutex_lock(&efx->mac_lock); efx->phy_mode &= ~PHY_MODE_LOW_POWER; efx->loopback_mode = LOOPBACK_NONE; - __efx_reconfigure_port(efx); + __efx_siena_reconfigure_port(efx); mutex_unlock(&efx->mac_lock); rc = efx_test_phy(efx, tests, flags); @@ -759,7 +759,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, mutex_lock(&efx->mac_lock); efx->phy_mode = phy_mode; efx->loopback_mode = loopback_mode; - __efx_reconfigure_port(efx); + __efx_siena_reconfigure_port(efx); mutex_unlock(&efx->mac_lock); efx_device_attach_if_not_resetting(efx); diff --git a/drivers/net/ethernet/sfc/siena/siena.c b/drivers/net/ethernet/sfc/siena/siena.c index 7cc6a2583d6c..726dd4b72779 100644 --- a/drivers/net/ethernet/sfc/siena/siena.c +++ b/drivers/net/ethernet/sfc/siena/siena.c @@ -40,7 +40,7 @@ static void siena_push_irq_moderation(struct efx_channel *channel) if (channel->irq_moderation_us) { unsigned int ticks; - ticks = efx_usecs_to_ticks(efx, channel->irq_moderation_us); + ticks = efx_siena_usecs_to_ticks(efx, channel->irq_moderation_us); EFX_POPULATE_DWORD_2(timer_cmd, FRF_CZ_TC_TIMER_MODE, FFE_CZ_TIMER_MODE_INT_HLDOFF, @@ -102,7 +102,7 @@ static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) enum reset_type reset_method = RESET_TYPE_ALL; int rc, rc2; - efx_reset_down(efx, reset_method); + efx_siena_reset_down(efx, reset_method); /* Reset the chip immediately so that it is completely * quiescent regardless of what any VF driver does. @@ -118,7 +118,7 @@ static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) rc = efx_mcdi_reset(efx, reset_method); out: - rc2 = efx_reset_up(efx, reset_method, rc == 0); + rc2 = efx_siena_reset_up(efx, reset_method, rc == 0); return rc ? rc : rc2; } @@ -583,7 +583,7 @@ static int siena_try_update_nic_stats(struct efx_nic *efx) efx_update_diff_stat(&stats[SIENA_STAT_rx_good_bytes], stats[SIENA_STAT_rx_bytes] - stats[SIENA_STAT_rx_bad_bytes]); - efx_update_sw_stats(efx, stats); + efx_siena_update_sw_stats(efx, stats); return 0; } @@ -943,7 +943,7 @@ static int siena_mtd_probe(struct efx_nic *efx) if (rc) goto fail; - rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); + rc = efx_siena_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); fail: if (rc) kfree(parts); @@ -980,7 +980,7 @@ const struct efx_nic_type siena_a0_nic_type = { .remove = siena_remove_nic, .init = siena_init_nic, .dimension_resources = siena_dimension_resources, - .fini = efx_port_dummy_op_void, + .fini = efx_siena_port_dummy_op_void, #ifdef CONFIG_EEH .monitor = siena_monitor, #else @@ -994,7 +994,7 @@ const struct efx_nic_type siena_a0_nic_type = { .fini_dmaq = efx_farch_fini_dmaq, .prepare_flush = efx_siena_prepare_flush, .finish_flush = siena_finish_flush, - .prepare_flr = efx_port_dummy_op_void, + .prepare_flr = efx_siena_port_dummy_op_void, .finish_flr = efx_farch_finish_flr, .describe_stats = siena_describe_nic_stats, .update_stats = siena_update_nic_stats, @@ -1024,7 +1024,7 @@ const struct efx_nic_type siena_a0_nic_type = { .tx_remove = efx_farch_tx_remove, .tx_write = efx_farch_tx_write, .tx_limit_len = efx_farch_tx_limit_len, - .tx_enqueue = __efx_enqueue_skb, + .tx_enqueue = __efx_siena_enqueue_skb, .rx_push_rss_config = siena_rx_push_rss_config, .rx_pull_rss_config = siena_rx_pull_rss_config, .rx_probe = efx_farch_rx_probe, @@ -1032,7 +1032,7 @@ const struct efx_nic_type siena_a0_nic_type = { .rx_remove = efx_farch_rx_remove, .rx_write = efx_farch_rx_write, .rx_defer_refill = efx_farch_rx_defer_refill, - .rx_packet = __efx_rx_packet, + .rx_packet = __efx_siena_rx_packet, .ev_probe = efx_farch_ev_probe, .ev_init = efx_farch_ev_init, .ev_fini = efx_farch_ev_fini, @@ -1075,9 +1075,9 @@ const struct efx_nic_type siena_a0_nic_type = { .sriov_set_vf_vlan = efx_siena_sriov_set_vf_vlan, .sriov_set_vf_spoofchk = efx_siena_sriov_set_vf_spoofchk, .sriov_get_vf_config = efx_siena_sriov_get_vf_config, - .vswitching_probe = efx_port_dummy_op_int, - .vswitching_restore = efx_port_dummy_op_int, - .vswitching_remove = efx_port_dummy_op_void, + .vswitching_probe = efx_siena_port_dummy_op_int, + .vswitching_restore = efx_siena_port_dummy_op_int, + .vswitching_remove = efx_siena_port_dummy_op_void, .set_mac_address = efx_siena_sriov_mac_address_changed, #endif diff --git a/drivers/net/ethernet/sfc/siena/siena_sriov.c b/drivers/net/ethernet/sfc/siena/siena_sriov.c index 8b0fdeebc1a5..f8e14f0d2f34 100644 --- a/drivers/net/ethernet/sfc/siena/siena_sriov.c +++ b/drivers/net/ethernet/sfc/siena/siena_sriov.c @@ -1043,7 +1043,7 @@ efx_siena_sriov_get_channel_name(struct efx_channel *channel, static const struct efx_channel_type efx_siena_sriov_channel_type = { .handle_no_channel = efx_siena_sriov_handle_no_channel, .pre_probe = efx_siena_sriov_probe_channel, - .post_remove = efx_channel_dummy_op_void, + .post_remove = efx_siena_channel_dummy_op_void, .get_name = efx_siena_sriov_get_channel_name, /* no copy operation; channel must not be reallocated */ .keep_eventq = true, diff --git a/drivers/net/ethernet/sfc/siena/tx.c b/drivers/net/ethernet/sfc/siena/tx.c index 9e68dc434832..118ec6f5f097 100644 --- a/drivers/net/ethernet/sfc/siena/tx.c +++ b/drivers/net/ethernet/sfc/siena/tx.c @@ -138,13 +138,14 @@ static void efx_tx_send_pending(struct efx_channel *channel) * If any DMA mapping fails, any mapped fragments will be unmapped, * the queue's insert pointer will be restored to its original value. * - * This function is split out from efx_hard_start_xmit to allow the + * This function is split out from efx_siena_hard_start_xmit to allow the * loopback test to direct packets via specific TX queues. * * Returns NETDEV_TX_OK. * You must hold netif_tx_lock() to call this function. */ -netdev_tx_t __efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb) +netdev_tx_t __efx_siena_enqueue_skb(struct efx_tx_queue *tx_queue, + struct sk_buff *skb) { unsigned int old_insert_count = tx_queue->insert_count; bool xmit_more = netdev_xmit_more(); @@ -219,8 +220,8 @@ netdev_tx_t __efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb * Runs in NAPI context, either in our poll (for XDP TX) or a different NIC * (for XDP redirect). */ -int efx_xdp_tx_buffers(struct efx_nic *efx, int n, struct xdp_frame **xdpfs, - bool flush) +int efx_siena_xdp_tx_buffers(struct efx_nic *efx, int n, struct xdp_frame **xdpfs, + bool flush) { struct efx_tx_buffer *tx_buffer; struct efx_tx_queue *tx_queue; @@ -310,8 +311,8 @@ int efx_xdp_tx_buffers(struct efx_nic *efx, int n, struct xdp_frame **xdpfs, * Context: non-blocking. * Should always return NETDEV_TX_OK and consume the skb. */ -netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb, - struct net_device *net_dev) +netdev_tx_t efx_siena_hard_start_xmit(struct sk_buff *skb, + struct net_device *net_dev) { struct efx_nic *efx = netdev_priv(net_dev); struct efx_tx_queue *tx_queue; @@ -354,52 +355,14 @@ netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb, return NETDEV_TX_OK; } - return __efx_enqueue_skb(tx_queue, skb); + return __efx_siena_enqueue_skb(tx_queue, skb); } -void efx_xmit_done_single(struct efx_tx_queue *tx_queue) -{ - unsigned int pkts_compl = 0, bytes_compl = 0; - unsigned int read_ptr; - bool finished = false; - - read_ptr = tx_queue->read_count & tx_queue->ptr_mask; - - while (!finished) { - struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr]; - - if (!efx_tx_buffer_in_use(buffer)) { - struct efx_nic *efx = tx_queue->efx; - - netif_err(efx, hw, efx->net_dev, - "TX queue %d spurious single TX completion\n", - tx_queue->queue); - efx_schedule_reset(efx, RESET_TYPE_TX_SKIP); - return; - } - - /* Need to check the flag before dequeueing. */ - if (buffer->flags & EFX_TX_BUF_SKB) - finished = true; - efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl); - - ++tx_queue->read_count; - read_ptr = tx_queue->read_count & tx_queue->ptr_mask; - } - - tx_queue->pkts_compl += pkts_compl; - tx_queue->bytes_compl += bytes_compl; - - EFX_WARN_ON_PARANOID(pkts_compl != 1); - - efx_xmit_done_check_empty(tx_queue); -} - -void efx_init_tx_queue_core_txq(struct efx_tx_queue *tx_queue) +void efx_siena_init_tx_queue_core_txq(struct efx_tx_queue *tx_queue) { struct efx_nic *efx = tx_queue->efx; - /* Must be inverse of queue lookup in efx_hard_start_xmit() */ + /* Must be inverse of queue lookup in efx_siena_hard_start_xmit() */ tx_queue->core_txq = netdev_get_tx_queue(efx->net_dev, tx_queue->channel->channel + @@ -407,8 +370,8 @@ void efx_init_tx_queue_core_txq(struct efx_tx_queue *tx_queue) efx->n_tx_channels : 0)); } -int efx_setup_tc(struct net_device *net_dev, enum tc_setup_type type, - void *type_data) +int efx_siena_setup_tc(struct net_device *net_dev, enum tc_setup_type type, + void *type_data) { struct efx_nic *efx = netdev_priv(net_dev); struct tc_mqprio_qopt *mqprio = type_data; diff --git a/drivers/net/ethernet/sfc/siena/tx_common.c b/drivers/net/ethernet/sfc/siena/tx_common.c index 9bc8281b7f5b..7945fe681e29 100644 --- a/drivers/net/ethernet/sfc/siena/tx_common.c +++ b/drivers/net/ethernet/sfc/siena/tx_common.c @@ -214,7 +214,7 @@ static void efx_dequeue_buffers(struct efx_tx_queue *tx_queue, netif_err(efx, tx_err, efx->net_dev, "TX queue %d spurious TX completion id %d\n", tx_queue->queue, read_ptr); - efx_schedule_reset(efx, RESET_TYPE_TX_SKIP); + efx_siena_schedule_reset(efx, RESET_TYPE_TX_SKIP); return; } @@ -225,7 +225,7 @@ static void efx_dequeue_buffers(struct efx_tx_queue *tx_queue, } } -void efx_xmit_done_check_empty(struct efx_tx_queue *tx_queue) +void efx_siena_xmit_done_check_empty(struct efx_tx_queue *tx_queue) { if ((int)(tx_queue->read_count - tx_queue->old_write_count) >= 0) { tx_queue->old_write_count = READ_ONCE(tx_queue->write_count); @@ -238,7 +238,7 @@ void efx_xmit_done_check_empty(struct efx_tx_queue *tx_queue) } } -void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index) +void efx_siena_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index) { unsigned int fill_level, pkts_compl = 0, bytes_compl = 0; struct efx_nic *efx = tx_queue->efx; @@ -265,7 +265,7 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index) netif_tx_wake_queue(tx_queue->core_txq); } - efx_xmit_done_check_empty(tx_queue); + efx_siena_xmit_done_check_empty(tx_queue); } /* Remove buffers put into a tx_queue for the current packet. diff --git a/drivers/net/ethernet/sfc/siena/tx_common.h b/drivers/net/ethernet/sfc/siena/tx_common.h index bbab7f248250..602f5a052918 100644 --- a/drivers/net/ethernet/sfc/siena/tx_common.h +++ b/drivers/net/ethernet/sfc/siena/tx_common.h @@ -26,8 +26,8 @@ static inline bool efx_tx_buffer_in_use(struct efx_tx_buffer *buffer) return buffer->len || (buffer->flags & EFX_TX_BUF_OPTION); } -void efx_xmit_done_check_empty(struct efx_tx_queue *tx_queue); -void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index); +void efx_siena_xmit_done_check_empty(struct efx_tx_queue *tx_queue); +void efx_siena_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index); void efx_enqueue_unwind(struct efx_tx_queue *tx_queue, unsigned int insert_count); From patchwork Mon May 9 15:32:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Habets X-Patchwork-Id: 12843795 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 C2070C433EF for ; Mon, 9 May 2022 15:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238432AbiEIPgc (ORCPT ); Mon, 9 May 2022 11:36:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238441AbiEIPga (ORCPT ); Mon, 9 May 2022 11:36:30 -0400 Received: from mint-fitpc2.mph.net (unknown [81.168.73.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0AC162229EE for ; Mon, 9 May 2022 08:32:22 -0700 (PDT) Received: from palantir17.mph.net (unknown [192.168.0.4]) by mint-fitpc2.mph.net (Postfix) with ESMTP id 15F6D3200F2; Mon, 9 May 2022 16:32:21 +0100 (BST) Received: from localhost ([::1] helo=palantir17.mph.net) by palantir17.mph.net with esmtp (Exim 4.89) (envelope-from ) id 1no5My-0001Qo-Rd; Mon, 09 May 2022 16:32:20 +0100 Subject: [PATCH net-next v4 06/11] sfc/siena: Rename RX/TX functions to avoid conflicts with sfc From: Martin Habets To: kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, ecree.xilinx@gmail.com Date: Mon, 09 May 2022 16:32:20 +0100 Message-ID: <165211034052.5289.3019192723750798268.stgit@palantir17.mph.net> In-Reply-To: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> References: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org For siena use efx_siena_ as the function prefix. Several functions are not used in Siena, so they are removed. Use a Siena specific variable name for module parameter efx_separate_tx_channels. Move efx_fini_tx_queue() to avoid a forward declaration of efx_dequeue_buffer(). Signed-off-by: Martin Habets --- drivers/net/ethernet/sfc/siena/efx.c | 15 ++- drivers/net/ethernet/sfc/siena/efx.h | 4 - drivers/net/ethernet/sfc/siena/efx_channels.c | 35 ++++--- drivers/net/ethernet/sfc/siena/efx_common.c | 4 - drivers/net/ethernet/sfc/siena/ethtool_common.c | 15 ++- drivers/net/ethernet/sfc/siena/farch.c | 9 +- drivers/net/ethernet/sfc/siena/rx.c | 22 ++-- drivers/net/ethernet/sfc/siena/rx_common.c | 116 ++++++++++++----------- drivers/net/ethernet/sfc/siena/rx_common.h | 89 ++++++++---------- drivers/net/ethernet/sfc/siena/tx.c | 16 +-- drivers/net/ethernet/sfc/siena/tx.h | 7 - drivers/net/ethernet/sfc/siena/tx_common.c | 85 ++++++++--------- drivers/net/ethernet/sfc/siena/tx_common.h | 32 +++--- 13 files changed, 216 insertions(+), 233 deletions(-) diff --git a/drivers/net/ethernet/sfc/siena/efx.c b/drivers/net/ethernet/sfc/siena/efx.c index ca41c038f3ab..d94e2438ae3a 100644 --- a/drivers/net/ethernet/sfc/siena/efx.c +++ b/drivers/net/ethernet/sfc/siena/efx.c @@ -58,8 +58,9 @@ MODULE_PARM_DESC(rss_cpus, "Number of CPUs to use for Receive-Side Scaling"); * * This is only used in MSI-X interrupt mode */ -bool efx_separate_tx_channels; -module_param(efx_separate_tx_channels, bool, 0444); +bool efx_siena_separate_tx_channels; +module_param_named(efx_separate_tx_channels, efx_siena_separate_tx_channels, + bool, 0444); MODULE_PARM_DESC(efx_separate_tx_channels, "Use separate channels for TX and RX"); @@ -306,7 +307,7 @@ static int efx_probe_nic(struct efx_nic *efx) if (efx->n_channels > 1) netdev_rss_key_fill(efx->rss_context.rx_hash_key, sizeof(efx->rss_context.rx_hash_key)); - efx_set_default_rx_indir_table(efx, &efx->rss_context); + efx_siena_set_default_rx_indir_table(efx, &efx->rss_context); /* Initialise the interrupt moderation settings */ efx->irq_mod_step_us = DIV_ROUND_UP(efx->timer_quantum_ns, 1000); @@ -366,7 +367,7 @@ static int efx_probe_all(struct efx_nic *efx) " VFs may not function\n", rc); #endif - rc = efx_probe_filters(efx); + rc = efx_siena_probe_filters(efx); if (rc) { netif_err(efx, probe, efx->net_dev, "failed to create filter tables\n"); @@ -380,7 +381,7 @@ static int efx_probe_all(struct efx_nic *efx) return 0; fail5: - efx_remove_filters(efx); + efx_siena_remove_filters(efx); fail4: #ifdef CONFIG_SFC_SRIOV efx->type->vswitching_remove(efx); @@ -400,7 +401,7 @@ static void efx_remove_all(struct efx_nic *efx) rtnl_unlock(); efx_siena_remove_channels(efx); - efx_remove_filters(efx); + efx_siena_remove_filters(efx); #ifdef CONFIG_SFC_SRIOV efx->type->vswitching_remove(efx); #endif @@ -602,7 +603,7 @@ static const struct net_device_ops efx_netdev_ops = { .ndo_get_phys_port_name = efx_siena_get_phys_port_name, .ndo_setup_tc = efx_siena_setup_tc, #ifdef CONFIG_RFS_ACCEL - .ndo_rx_flow_steer = efx_filter_rfs, + .ndo_rx_flow_steer = efx_siena_filter_rfs, #endif .ndo_xdp_xmit = efx_xdp_xmit, .ndo_bpf = efx_xdp diff --git a/drivers/net/ethernet/sfc/siena/efx.h b/drivers/net/ethernet/sfc/siena/efx.h index a4f9e6e962b0..f91f3c94a275 100644 --- a/drivers/net/ethernet/sfc/siena/efx.h +++ b/drivers/net/ethernet/sfc/siena/efx.h @@ -44,7 +44,7 @@ static inline void efx_rx_flush_packet(struct efx_channel *channel) * TSO skbs. */ #define EFX_RXQ_MIN_ENT 128U -#define EFX_TXQ_MIN_ENT(efx) (2 * efx_tx_max_skb_descs(efx)) +#define EFX_TXQ_MIN_ENT(efx) (2 * efx_siena_tx_max_skb_descs(efx)) /* All EF10 architecture NICs steal one bit of the DMAQ size for various * other purposes when counting TxQ entries, so we halve the queue size. @@ -78,7 +78,7 @@ static inline bool efx_rss_enabled(struct efx_nic *efx) * * 2. If the existing filters have higher priority, return -%EPERM. * - * 3. If !efx_filter_is_mc_recipient(@spec), or the NIC does not + * 3. If !efx_siena_filter_is_mc_recipient(@spec), or the NIC does not * support delivery to multiple recipients, return -%EEXIST. * * This implies that filters for multiple multicast recipients must diff --git a/drivers/net/ethernet/sfc/siena/efx_channels.c b/drivers/net/ethernet/sfc/siena/efx_channels.c index b04affb23f72..799c0a90358c 100644 --- a/drivers/net/ethernet/sfc/siena/efx_channels.c +++ b/drivers/net/ethernet/sfc/siena/efx_channels.c @@ -138,7 +138,7 @@ static int efx_allocate_msix_channels(struct efx_nic *efx, int n_xdp_tx; int n_xdp_ev; - if (efx_separate_tx_channels) + if (efx_siena_separate_tx_channels) n_channels *= 2; n_channels += extra_channels; @@ -220,7 +220,7 @@ static int efx_allocate_msix_channels(struct efx_nic *efx, /* Ignore XDP tx channels when creating rx channels. */ n_channels -= efx->n_xdp_channels; - if (efx_separate_tx_channels) { + if (efx_siena_separate_tx_channels) { efx->n_tx_channels = min(max(n_channels / 2, 1U), efx->max_tx_channels); @@ -321,7 +321,7 @@ int efx_siena_probe_interrupts(struct efx_nic *efx) /* Assume legacy interrupts */ if (efx->interrupt_mode == EFX_INT_MODE_LEGACY) { - efx->n_channels = 1 + (efx_separate_tx_channels ? 1 : 0); + efx->n_channels = 1 + (efx_siena_separate_tx_channels ? 1 : 0); efx->n_rx_channels = 1; efx->n_tx_channels = 1; efx->n_xdp_channels = 0; @@ -521,7 +521,8 @@ static void efx_filter_rfs_expire(struct work_struct *data) channel = container_of(dwork, struct efx_channel, filter_work); time = jiffies - channel->rfs_last_expiry; quota = channel->rfs_filter_count * time / (30 * HZ); - if (quota >= 20 && __efx_filter_rfs_expire(channel, min(channel->rfs_filter_count, quota))) + if (quota >= 20 && __efx_siena_filter_rfs_expire(channel, + min(channel->rfs_filter_count, quota))) channel->rfs_last_expiry += time; /* Ensure we do more work eventually even if NAPI poll is not happening */ schedule_delayed_work(dwork, 30 * HZ); @@ -558,7 +559,7 @@ static struct efx_channel *efx_alloc_channel(struct efx_nic *efx, int i) rx_queue = &channel->rx_queue; rx_queue->efx = efx; - timer_setup(&rx_queue->slow_fill, efx_rx_slow_fill, 0); + timer_setup(&rx_queue->slow_fill, efx_siena_rx_slow_fill, 0); return channel; } @@ -631,7 +632,7 @@ struct efx_channel *efx_copy_channel(const struct efx_channel *old_channel) rx_queue = &channel->rx_queue; rx_queue->buffer = NULL; memset(&rx_queue->rxd, 0, sizeof(rx_queue->rxd)); - timer_setup(&rx_queue->slow_fill, efx_rx_slow_fill, 0); + timer_setup(&rx_queue->slow_fill, efx_siena_rx_slow_fill, 0); #ifdef CONFIG_RFS_ACCEL INIT_DELAYED_WORK(&channel->filter_work, efx_filter_rfs_expire); #endif @@ -657,13 +658,13 @@ static int efx_probe_channel(struct efx_channel *channel) goto fail; efx_for_each_channel_tx_queue(tx_queue, channel) { - rc = efx_probe_tx_queue(tx_queue); + rc = efx_siena_probe_tx_queue(tx_queue); if (rc) goto fail; } efx_for_each_channel_rx_queue(rx_queue, channel) { - rc = efx_probe_rx_queue(rx_queue); + rc = efx_siena_probe_rx_queue(rx_queue); if (rc) goto fail; } @@ -751,9 +752,9 @@ void efx_siena_remove_channel(struct efx_channel *channel) "destroy chan %d\n", channel->channel); efx_for_each_channel_rx_queue(rx_queue, channel) - efx_remove_rx_queue(rx_queue); + efx_siena_remove_rx_queue(rx_queue); efx_for_each_channel_tx_queue(tx_queue, channel) - efx_remove_tx_queue(tx_queue); + efx_siena_remove_tx_queue(tx_queue); efx_remove_eventq(channel); channel->type->post_remove(channel); } @@ -963,7 +964,7 @@ int efx_siena_set_channels(struct efx_nic *efx) int rc; efx->tx_channel_offset = - efx_separate_tx_channels ? + efx_siena_separate_tx_channels ? efx->n_channels - efx->n_tx_channels : 0; if (efx->xdp_tx_queue_count) { @@ -1130,15 +1131,15 @@ void efx_siena_start_channels(struct efx_nic *efx) efx_for_each_channel_rev(channel, efx) { efx_for_each_channel_tx_queue(tx_queue, channel) { - efx_init_tx_queue(tx_queue); + efx_siena_init_tx_queue(tx_queue); atomic_inc(&efx->active_queues); } efx_for_each_channel_rx_queue(rx_queue, channel) { - efx_init_rx_queue(rx_queue); + efx_siena_init_rx_queue(rx_queue); atomic_inc(&efx->active_queues); efx_siena_stop_eventq(channel); - efx_fast_push_rx_descriptors(rx_queue, false); + efx_siena_fast_push_rx_descriptors(rx_queue, false); efx_siena_start_eventq(channel); } @@ -1184,9 +1185,9 @@ void efx_siena_stop_channels(struct efx_nic *efx) efx_for_each_channel(channel, efx) { efx_for_each_channel_rx_queue(rx_queue, channel) - efx_fini_rx_queue(rx_queue); + efx_siena_fini_rx_queue(rx_queue); efx_for_each_channel_tx_queue(tx_queue, channel) - efx_fini_tx_queue(tx_queue); + efx_siena_fini_tx_queue(tx_queue); } } @@ -1228,7 +1229,7 @@ static int efx_process_channel(struct efx_channel *channel, int budget) efx_channel_get_rx_queue(channel); efx_rx_flush_packet(channel); - efx_fast_push_rx_descriptors(rx_queue, true); + efx_siena_fast_push_rx_descriptors(rx_queue, true); } /* Update BQL */ diff --git a/drivers/net/ethernet/sfc/siena/efx_common.c b/drivers/net/ethernet/sfc/siena/efx_common.c index fb6fb345cc56..f245d03c4caa 100644 --- a/drivers/net/ethernet/sfc/siena/efx_common.c +++ b/drivers/net/ethernet/sfc/siena/efx_common.c @@ -395,7 +395,7 @@ static void efx_start_datapath(struct efx_nic *efx) efx->rx_buffer_order = get_order(rx_buf_len); } - efx_rx_config_page_split(efx); + efx_siena_rx_config_page_split(efx); if (efx->rx_buffer_order) netif_dbg(efx, drv, efx->net_dev, "RX buf len=%u; page order=%u batch=%u\n", @@ -428,7 +428,7 @@ static void efx_start_datapath(struct efx_nic *efx) * the ring completely. We wake it when half way back to * empty. */ - efx->txq_stop_thresh = efx->txq_entries - efx_tx_max_skb_descs(efx); + efx->txq_stop_thresh = efx->txq_entries - efx_siena_tx_max_skb_descs(efx); efx->txq_wake_thresh = efx->txq_stop_thresh / 2; /* Initialise the channels */ diff --git a/drivers/net/ethernet/sfc/siena/ethtool_common.c b/drivers/net/ethernet/sfc/siena/ethtool_common.c index e177b58e0664..f54510cf4e72 100644 --- a/drivers/net/ethernet/sfc/siena/ethtool_common.c +++ b/drivers/net/ethernet/sfc/siena/ethtool_common.c @@ -824,7 +824,8 @@ int efx_ethtool_get_rxnfc(struct net_device *net_dev, mutex_lock(&efx->rss_lock); if (info->flow_type & FLOW_RSS && info->rss_context) { - ctx = efx_find_rss_context_entry(efx, info->rss_context); + ctx = efx_siena_find_rss_context_entry(efx, + info->rss_context); if (!ctx) { rc = -ENOENT; goto out_unlock; @@ -1213,7 +1214,7 @@ int efx_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir, return -EOPNOTSUPP; mutex_lock(&efx->rss_lock); - ctx = efx_find_rss_context_entry(efx, rss_context); + ctx = efx_siena_find_rss_context_entry(efx, rss_context); if (!ctx) { rc = -ENOENT; goto out_unlock; @@ -1257,18 +1258,18 @@ int efx_ethtool_set_rxfh_context(struct net_device *net_dev, rc = -EINVAL; goto out_unlock; } - ctx = efx_alloc_rss_context_entry(efx); + ctx = efx_siena_alloc_rss_context_entry(efx); if (!ctx) { rc = -ENOMEM; goto out_unlock; } ctx->context_id = EFX_MCDI_RSS_CONTEXT_INVALID; /* Initialise indir table and key to defaults */ - efx_set_default_rx_indir_table(efx, ctx); + efx_siena_set_default_rx_indir_table(efx, ctx); netdev_rss_key_fill(ctx->rx_hash_key, sizeof(ctx->rx_hash_key)); allocated = true; } else { - ctx = efx_find_rss_context_entry(efx, *rss_context); + ctx = efx_siena_find_rss_context_entry(efx, *rss_context); if (!ctx) { rc = -ENOENT; goto out_unlock; @@ -1279,7 +1280,7 @@ int efx_ethtool_set_rxfh_context(struct net_device *net_dev, /* delete this context */ rc = efx->type->rx_push_rss_context_config(efx, ctx, NULL, NULL); if (!rc) - efx_free_rss_context_entry(ctx); + efx_siena_free_rss_context_entry(ctx); goto out_unlock; } @@ -1290,7 +1291,7 @@ int efx_ethtool_set_rxfh_context(struct net_device *net_dev, rc = efx->type->rx_push_rss_context_config(efx, ctx, indir, key); if (rc && allocated) - efx_free_rss_context_entry(ctx); + efx_siena_free_rss_context_entry(ctx); else *rss_context = ctx->user_id; out_unlock: diff --git a/drivers/net/ethernet/sfc/siena/farch.c b/drivers/net/ethernet/sfc/siena/farch.c index 6ee6ca192a44..4de36c6c28e1 100644 --- a/drivers/net/ethernet/sfc/siena/farch.c +++ b/drivers/net/ethernet/sfc/siena/farch.c @@ -1160,7 +1160,7 @@ static void efx_farch_handle_generated_event(struct efx_channel *channel, /* The queue must be empty, so we won't receive any rx * events, so efx_process_channel() won't refill the * queue. Refill it here */ - efx_fast_push_rx_descriptors(rx_queue, true); + efx_siena_fast_push_rx_descriptors(rx_queue, true); } else if (rx_queue && magic == EFX_CHANNEL_MAGIC_RX_DRAIN(rx_queue)) { efx_farch_handle_drain_event(channel); } else if (code == _EFX_CHANNEL_MAGIC_TX_DRAIN) { @@ -2925,13 +2925,14 @@ bool efx_farch_filter_rfs_expire_one(struct efx_nic *efx, u32 flow_id, */ arfs_id = 0; } else { - rule = efx_rps_hash_find(efx, &spec); + rule = efx_siena_rps_hash_find(efx, &spec); if (!rule) { /* ARFS table doesn't know of this filter, remove it */ force = true; } else { arfs_id = rule->arfs_id; - if (!efx_rps_check_rule(rule, index, &force)) + if (!efx_siena_rps_check_rule(rule, index, + &force)) goto out_unlock; } } @@ -2939,7 +2940,7 @@ bool efx_farch_filter_rfs_expire_one(struct efx_nic *efx, u32 flow_id, flow_id, arfs_id)) { if (rule) rule->filter_id = EFX_ARFS_FILTER_ID_REMOVING; - efx_rps_hash_del(efx, &spec); + efx_siena_rps_hash_del(efx, &spec); efx_farch_filter_table_clear_entry(efx, table, index); ret = true; } diff --git a/drivers/net/ethernet/sfc/siena/rx.c b/drivers/net/ethernet/sfc/siena/rx.c index 099cb23e3250..47c09b93f7c4 100644 --- a/drivers/net/ethernet/sfc/siena/rx.c +++ b/drivers/net/ethernet/sfc/siena/rx.c @@ -157,7 +157,7 @@ void efx_siena_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, */ if (unlikely(rx_buf->flags & EFX_RX_PKT_DISCARD)) { efx_rx_flush_packet(channel); - efx_discard_rx_packet(channel, rx_buf, n_frags); + efx_siena_discard_rx_packet(channel, rx_buf, n_frags); return; } @@ -195,7 +195,7 @@ void efx_siena_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, /* All fragments have been DMA-synced, so recycle pages. */ rx_buf = efx_rx_buffer(rx_queue, index); - efx_recycle_rx_pages(channel, rx_buf, n_frags); + efx_siena_recycle_rx_pages(channel, rx_buf, n_frags); /* Pipeline receives so that we give time for packet headers to be * prefetched into cache. @@ -217,7 +217,7 @@ static void efx_rx_deliver(struct efx_channel *channel, u8 *eh, struct efx_rx_queue *rx_queue; rx_queue = efx_channel_get_rx_queue(channel); - efx_free_rx_buffers(rx_queue, rx_buf, n_frags); + efx_siena_free_rx_buffers(rx_queue, rx_buf, n_frags); return; } skb_record_rx_queue(skb, channel->rx_queue.core_index); @@ -268,8 +268,8 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, if (unlikely(channel->rx_pkt_n_frags > 1)) { /* We can't do XDP on fragmented packets - drop. */ - efx_free_rx_buffers(rx_queue, rx_buf, - channel->rx_pkt_n_frags); + efx_siena_free_rx_buffers(rx_queue, rx_buf, + channel->rx_pkt_n_frags); if (net_ratelimit()) netif_err(efx, rx_err, efx->net_dev, "XDP is not possible with multiple receive fragments (%d)\n", @@ -312,7 +312,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, xdpf = xdp_convert_buff_to_frame(&xdp); err = efx_siena_xdp_tx_buffers(efx, 1, &xdpf, true); if (unlikely(err != 1)) { - efx_free_rx_buffers(rx_queue, rx_buf, 1); + efx_siena_free_rx_buffers(rx_queue, rx_buf, 1); if (net_ratelimit()) netif_err(efx, rx_err, efx->net_dev, "XDP TX failed (%d)\n", err); @@ -326,7 +326,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, case XDP_REDIRECT: err = xdp_do_redirect(efx->net_dev, &xdp, xdp_prog); if (unlikely(err)) { - efx_free_rx_buffers(rx_queue, rx_buf, 1); + efx_siena_free_rx_buffers(rx_queue, rx_buf, 1); if (net_ratelimit()) netif_err(efx, rx_err, efx->net_dev, "XDP redirect failed (%d)\n", err); @@ -339,7 +339,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, default: bpf_warn_invalid_xdp_action(efx->net_dev, xdp_prog, xdp_act); - efx_free_rx_buffers(rx_queue, rx_buf, 1); + efx_siena_free_rx_buffers(rx_queue, rx_buf, 1); channel->n_rx_xdp_bad_drops++; trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act); break; @@ -348,7 +348,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act); fallthrough; case XDP_DROP: - efx_free_rx_buffers(rx_queue, rx_buf, 1); + efx_siena_free_rx_buffers(rx_queue, rx_buf, 1); channel->n_rx_xdp_drops++; break; } @@ -379,8 +379,8 @@ void __efx_siena_rx_packet(struct efx_channel *channel) efx_loopback_rx_packet(efx, eh, rx_buf->len); rx_queue = efx_channel_get_rx_queue(channel); - efx_free_rx_buffers(rx_queue, rx_buf, - channel->rx_pkt_n_frags); + efx_siena_free_rx_buffers(rx_queue, rx_buf, + channel->rx_pkt_n_frags); goto out; } diff --git a/drivers/net/ethernet/sfc/siena/rx_common.c b/drivers/net/ethernet/sfc/siena/rx_common.c index 9fb442da043c..4579f43484c3 100644 --- a/drivers/net/ethernet/sfc/siena/rx_common.c +++ b/drivers/net/ethernet/sfc/siena/rx_common.c @@ -30,6 +30,9 @@ MODULE_PARM_DESC(rx_refill_threshold, */ #define EFX_RXD_HEAD_ROOM (1 + EFX_RX_MAX_FRAGS) +static void efx_unmap_rx_buffer(struct efx_nic *efx, + struct efx_rx_buffer *rx_buf); + /* Check the RX page recycle ring for a page that can be reused. */ static struct page *efx_reuse_page(struct efx_rx_queue *rx_queue) { @@ -103,9 +106,9 @@ static void efx_recycle_rx_page(struct efx_channel *channel, } /* Recycle the pages that are used by buffers that have just been received. */ -void efx_recycle_rx_pages(struct efx_channel *channel, - struct efx_rx_buffer *rx_buf, - unsigned int n_frags) +void efx_siena_recycle_rx_pages(struct efx_channel *channel, + struct efx_rx_buffer *rx_buf, + unsigned int n_frags) { struct efx_rx_queue *rx_queue = efx_channel_get_rx_queue(channel); @@ -118,15 +121,15 @@ void efx_recycle_rx_pages(struct efx_channel *channel, } while (--n_frags); } -void efx_discard_rx_packet(struct efx_channel *channel, - struct efx_rx_buffer *rx_buf, - unsigned int n_frags) +void efx_siena_discard_rx_packet(struct efx_channel *channel, + struct efx_rx_buffer *rx_buf, + unsigned int n_frags) { struct efx_rx_queue *rx_queue = efx_channel_get_rx_queue(channel); - efx_recycle_rx_pages(channel, rx_buf, n_frags); + efx_siena_recycle_rx_pages(channel, rx_buf, n_frags); - efx_free_rx_buffers(rx_queue, rx_buf, n_frags); + efx_siena_free_rx_buffers(rx_queue, rx_buf, n_frags); } static void efx_init_rx_recycle_ring(struct efx_rx_queue *rx_queue) @@ -181,12 +184,12 @@ static void efx_fini_rx_buffer(struct efx_rx_queue *rx_queue, /* If this is the last buffer in a page, unmap and free it. */ if (rx_buf->flags & EFX_RX_BUF_LAST_IN_PAGE) { efx_unmap_rx_buffer(rx_queue->efx, rx_buf); - efx_free_rx_buffers(rx_queue, rx_buf, 1); + efx_siena_free_rx_buffers(rx_queue, rx_buf, 1); } rx_buf->page = NULL; } -int efx_probe_rx_queue(struct efx_rx_queue *rx_queue) +int efx_siena_probe_rx_queue(struct efx_rx_queue *rx_queue) { struct efx_nic *efx = rx_queue->efx; unsigned int entries; @@ -217,7 +220,7 @@ int efx_probe_rx_queue(struct efx_rx_queue *rx_queue) return rc; } -void efx_init_rx_queue(struct efx_rx_queue *rx_queue) +void efx_siena_init_rx_queue(struct efx_rx_queue *rx_queue) { unsigned int max_fill, trigger, max_trigger; struct efx_nic *efx = rx_queue->efx; @@ -272,7 +275,7 @@ void efx_init_rx_queue(struct efx_rx_queue *rx_queue) efx_nic_init_rx(rx_queue); } -void efx_fini_rx_queue(struct efx_rx_queue *rx_queue) +void efx_siena_fini_rx_queue(struct efx_rx_queue *rx_queue) { struct efx_rx_buffer *rx_buf; int i; @@ -301,7 +304,7 @@ void efx_fini_rx_queue(struct efx_rx_queue *rx_queue) rx_queue->xdp_rxq_info_valid = false; } -void efx_remove_rx_queue(struct efx_rx_queue *rx_queue) +void efx_siena_remove_rx_queue(struct efx_rx_queue *rx_queue) { netif_dbg(rx_queue->efx, drv, rx_queue->efx->net_dev, "destroying RX queue %d\n", efx_rx_queue_index(rx_queue)); @@ -315,8 +318,8 @@ void efx_remove_rx_queue(struct efx_rx_queue *rx_queue) /* Unmap a DMA-mapped page. This function is only called for the final RX * buffer in a page. */ -void efx_unmap_rx_buffer(struct efx_nic *efx, - struct efx_rx_buffer *rx_buf) +static void efx_unmap_rx_buffer(struct efx_nic *efx, + struct efx_rx_buffer *rx_buf) { struct page *page = rx_buf->page; @@ -330,9 +333,9 @@ void efx_unmap_rx_buffer(struct efx_nic *efx, } } -void efx_free_rx_buffers(struct efx_rx_queue *rx_queue, - struct efx_rx_buffer *rx_buf, - unsigned int num_bufs) +void efx_siena_free_rx_buffers(struct efx_rx_queue *rx_queue, + struct efx_rx_buffer *rx_buf, + unsigned int num_bufs) { do { if (rx_buf->page) { @@ -343,7 +346,7 @@ void efx_free_rx_buffers(struct efx_rx_queue *rx_queue, } while (--num_bufs); } -void efx_rx_slow_fill(struct timer_list *t) +void efx_siena_rx_slow_fill(struct timer_list *t) { struct efx_rx_queue *rx_queue = from_timer(rx_queue, t, slow_fill); @@ -352,7 +355,7 @@ void efx_rx_slow_fill(struct timer_list *t) ++rx_queue->slow_fill_count; } -void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue) +static void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue) { mod_timer(&rx_queue->slow_fill, jiffies + msecs_to_jiffies(10)); } @@ -425,7 +428,7 @@ static int efx_init_rx_buffers(struct efx_rx_queue *rx_queue, bool atomic) return 0; } -void efx_rx_config_page_split(struct efx_nic *efx) +void efx_siena_rx_config_page_split(struct efx_nic *efx) { efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + efx->rx_ip_align + EFX_XDP_HEADROOM + EFX_XDP_TAILROOM, @@ -439,7 +442,7 @@ void efx_rx_config_page_split(struct efx_nic *efx) efx->rx_bufs_per_page); } -/* efx_fast_push_rx_descriptors - push new RX descriptors quickly +/* efx_siena_fast_push_rx_descriptors - push new RX descriptors quickly * @rx_queue: RX descriptor queue * * This will aim to fill the RX descriptor queue up to @@ -450,7 +453,8 @@ void efx_rx_config_page_split(struct efx_nic *efx) * this means this function must run from the NAPI handler, or be called * when NAPI is disabled. */ -void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue, bool atomic) +void efx_siena_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue, + bool atomic) { struct efx_nic *efx = rx_queue->efx; unsigned int fill_level, batch_size; @@ -517,7 +521,7 @@ efx_siena_rx_packet_gro(struct efx_channel *channel, struct efx_rx_queue *rx_queue; rx_queue = efx_channel_get_rx_queue(channel); - efx_free_rx_buffers(rx_queue, rx_buf, n_frags); + efx_siena_free_rx_buffers(rx_queue, rx_buf, n_frags); return; } @@ -556,7 +560,7 @@ efx_siena_rx_packet_gro(struct efx_channel *channel, /* RSS contexts. We're using linked lists and crappy O(n) algorithms, because * (a) this is an infrequent control-plane operation and (b) n is small (max 64) */ -struct efx_rss_context *efx_alloc_rss_context_entry(struct efx_nic *efx) +struct efx_rss_context *efx_siena_alloc_rss_context_entry(struct efx_nic *efx) { struct list_head *head = &efx->rss_context.list; struct efx_rss_context *ctx, *new; @@ -589,7 +593,8 @@ struct efx_rss_context *efx_alloc_rss_context_entry(struct efx_nic *efx) return new; } -struct efx_rss_context *efx_find_rss_context_entry(struct efx_nic *efx, u32 id) +struct efx_rss_context *efx_siena_find_rss_context_entry(struct efx_nic *efx, + u32 id) { struct list_head *head = &efx->rss_context.list; struct efx_rss_context *ctx; @@ -602,14 +607,14 @@ struct efx_rss_context *efx_find_rss_context_entry(struct efx_nic *efx, u32 id) return NULL; } -void efx_free_rss_context_entry(struct efx_rss_context *ctx) +void efx_siena_free_rss_context_entry(struct efx_rss_context *ctx) { list_del(&ctx->list); kfree(ctx); } -void efx_set_default_rx_indir_table(struct efx_nic *efx, - struct efx_rss_context *ctx) +void efx_siena_set_default_rx_indir_table(struct efx_nic *efx, + struct efx_rss_context *ctx) { size_t i; @@ -619,7 +624,7 @@ void efx_set_default_rx_indir_table(struct efx_nic *efx, } /** - * efx_filter_is_mc_recipient - test whether spec is a multicast recipient + * efx_siena_filter_is_mc_recipient - test whether spec is a multicast recipient * @spec: Specification to test * * Return: %true if the specification is a non-drop RX filter that @@ -627,7 +632,7 @@ void efx_set_default_rx_indir_table(struct efx_nic *efx, * IPv4 or IPv6 address value in the respective multicast address * range. Otherwise %false. */ -bool efx_filter_is_mc_recipient(const struct efx_filter_spec *spec) +bool efx_siena_filter_is_mc_recipient(const struct efx_filter_spec *spec) { if (!(spec->flags & EFX_FILTER_FLAG_RX) || spec->dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP) @@ -652,8 +657,8 @@ bool efx_filter_is_mc_recipient(const struct efx_filter_spec *spec) return false; } -bool efx_filter_spec_equal(const struct efx_filter_spec *left, - const struct efx_filter_spec *right) +bool efx_siena_filter_spec_equal(const struct efx_filter_spec *left, + const struct efx_filter_spec *right) { if ((left->match_flags ^ right->match_flags) | ((left->flags ^ right->flags) & @@ -665,7 +670,7 @@ bool efx_filter_spec_equal(const struct efx_filter_spec *left, offsetof(struct efx_filter_spec, outer_vid)) == 0; } -u32 efx_filter_spec_hash(const struct efx_filter_spec *spec) +u32 efx_siena_filter_spec_hash(const struct efx_filter_spec *spec) { BUILD_BUG_ON(offsetof(struct efx_filter_spec, outer_vid) & 3); return jhash2((const u32 *)&spec->outer_vid, @@ -675,8 +680,8 @@ u32 efx_filter_spec_hash(const struct efx_filter_spec *spec) } #ifdef CONFIG_RFS_ACCEL -bool efx_rps_check_rule(struct efx_arfs_rule *rule, unsigned int filter_idx, - bool *force) +bool efx_siena_rps_check_rule(struct efx_arfs_rule *rule, + unsigned int filter_idx, bool *force) { if (rule->filter_id == EFX_ARFS_FILTER_ID_PENDING) { /* ARFS is currently updating this entry, leave it */ @@ -692,7 +697,7 @@ bool efx_rps_check_rule(struct efx_arfs_rule *rule, unsigned int filter_idx, } else if (WARN_ON(rule->filter_id != filter_idx)) { /* can't happen */ /* ARFS has moved on, so old filter is not needed. Since we did * not mark the rule with EFX_ARFS_FILTER_ID_REMOVING, it will - * not be removed by efx_rps_hash_del() subsequently. + * not be removed by efx_siena_rps_hash_del() subsequently. */ *force = true; return true; @@ -705,7 +710,7 @@ static struct hlist_head *efx_rps_hash_bucket(struct efx_nic *efx, const struct efx_filter_spec *spec) { - u32 hash = efx_filter_spec_hash(spec); + u32 hash = efx_siena_filter_spec_hash(spec); lockdep_assert_held(&efx->rps_hash_lock); if (!efx->rps_hash_table) @@ -713,7 +718,7 @@ struct hlist_head *efx_rps_hash_bucket(struct efx_nic *efx, return &efx->rps_hash_table[hash % EFX_ARFS_HASH_TABLE_SIZE]; } -struct efx_arfs_rule *efx_rps_hash_find(struct efx_nic *efx, +struct efx_arfs_rule *efx_siena_rps_hash_find(struct efx_nic *efx, const struct efx_filter_spec *spec) { struct efx_arfs_rule *rule; @@ -725,15 +730,15 @@ struct efx_arfs_rule *efx_rps_hash_find(struct efx_nic *efx, return NULL; hlist_for_each(node, head) { rule = container_of(node, struct efx_arfs_rule, node); - if (efx_filter_spec_equal(spec, &rule->spec)) + if (efx_siena_filter_spec_equal(spec, &rule->spec)) return rule; } return NULL; } -struct efx_arfs_rule *efx_rps_hash_add(struct efx_nic *efx, - const struct efx_filter_spec *spec, - bool *new) +static struct efx_arfs_rule *efx_rps_hash_add(struct efx_nic *efx, + const struct efx_filter_spec *spec, + bool *new) { struct efx_arfs_rule *rule; struct hlist_head *head; @@ -744,7 +749,7 @@ struct efx_arfs_rule *efx_rps_hash_add(struct efx_nic *efx, return NULL; hlist_for_each(node, head) { rule = container_of(node, struct efx_arfs_rule, node); - if (efx_filter_spec_equal(spec, &rule->spec)) { + if (efx_siena_filter_spec_equal(spec, &rule->spec)) { *new = false; return rule; } @@ -758,7 +763,8 @@ struct efx_arfs_rule *efx_rps_hash_add(struct efx_nic *efx, return rule; } -void efx_rps_hash_del(struct efx_nic *efx, const struct efx_filter_spec *spec) +void efx_siena_rps_hash_del(struct efx_nic *efx, + const struct efx_filter_spec *spec) { struct efx_arfs_rule *rule; struct hlist_head *head; @@ -769,7 +775,7 @@ void efx_rps_hash_del(struct efx_nic *efx, const struct efx_filter_spec *spec) return; hlist_for_each(node, head) { rule = container_of(node, struct efx_arfs_rule, node); - if (efx_filter_spec_equal(spec, &rule->spec)) { + if (efx_siena_filter_spec_equal(spec, &rule->spec)) { /* Someone already reused the entry. We know that if * this check doesn't fire (i.e. filter_id == REMOVING) * then the REMOVING mark was put there by our caller, @@ -788,7 +794,7 @@ void efx_rps_hash_del(struct efx_nic *efx, const struct efx_filter_spec *spec) } #endif -int efx_probe_filters(struct efx_nic *efx) +int efx_siena_probe_filters(struct efx_nic *efx) { int rc; @@ -835,7 +841,7 @@ int efx_probe_filters(struct efx_nic *efx) return rc; } -void efx_remove_filters(struct efx_nic *efx) +void efx_siena_remove_filters(struct efx_nic *efx) { #ifdef CONFIG_RFS_ACCEL struct efx_channel *channel; @@ -870,7 +876,7 @@ static void efx_filter_rfs_work(struct work_struct *data) rc %= efx->type->max_rx_ip_filters; if (efx->rps_hash_table) { spin_lock_bh(&efx->rps_hash_lock); - rule = efx_rps_hash_find(efx, &req->spec); + rule = efx_siena_rps_hash_find(efx, &req->spec); /* The rule might have already gone, if someone else's request * for the same spec was already worked and then expired before * we got around to our work. In that case we have nothing @@ -930,8 +936,9 @@ static void efx_filter_rfs_work(struct work_struct *data) /* We're overloading the NIC's filter tables, so let's do a * chunk of extra expiry work. */ - __efx_filter_rfs_expire(channel, min(channel->rfs_filter_count, - 100u)); + __efx_siena_filter_rfs_expire(channel, + min(channel->rfs_filter_count, + 100u)); } /* Release references */ @@ -939,8 +946,8 @@ static void efx_filter_rfs_work(struct work_struct *data) dev_put(req->net_dev); } -int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, - u16 rxq_index, u32 flow_id) +int efx_siena_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, + u16 rxq_index, u32 flow_id) { struct efx_nic *efx = netdev_priv(net_dev); struct efx_async_filter_insertion *req; @@ -1041,7 +1048,8 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, return rc; } -bool __efx_filter_rfs_expire(struct efx_channel *channel, unsigned int quota) +bool __efx_siena_filter_rfs_expire(struct efx_channel *channel, + unsigned int quota) { bool (*expire_one)(struct efx_nic *efx, u32 flow_id, unsigned int index); struct efx_nic *efx = channel->efx; diff --git a/drivers/net/ethernet/sfc/siena/rx_common.h b/drivers/net/ethernet/sfc/siena/rx_common.h index 909d06a4fdc9..6b37f83ecb30 100644 --- a/drivers/net/ethernet/sfc/siena/rx_common.h +++ b/drivers/net/ethernet/sfc/siena/rx_common.h @@ -43,26 +43,19 @@ static inline u32 efx_rx_buf_hash(struct efx_nic *efx, const u8 *eh) #endif } -void efx_rx_slow_fill(struct timer_list *t); - -void efx_recycle_rx_pages(struct efx_channel *channel, - struct efx_rx_buffer *rx_buf, - unsigned int n_frags); -void efx_discard_rx_packet(struct efx_channel *channel, - struct efx_rx_buffer *rx_buf, - unsigned int n_frags); - -int efx_probe_rx_queue(struct efx_rx_queue *rx_queue); -void efx_init_rx_queue(struct efx_rx_queue *rx_queue); -void efx_fini_rx_queue(struct efx_rx_queue *rx_queue); -void efx_remove_rx_queue(struct efx_rx_queue *rx_queue); -void efx_destroy_rx_queue(struct efx_rx_queue *rx_queue); - -void efx_init_rx_buffer(struct efx_rx_queue *rx_queue, - struct page *page, - unsigned int page_offset, - u16 flags); -void efx_unmap_rx_buffer(struct efx_nic *efx, struct efx_rx_buffer *rx_buf); +void efx_siena_rx_slow_fill(struct timer_list *t); + +void efx_siena_recycle_rx_pages(struct efx_channel *channel, + struct efx_rx_buffer *rx_buf, + unsigned int n_frags); +void efx_siena_discard_rx_packet(struct efx_channel *channel, + struct efx_rx_buffer *rx_buf, + unsigned int n_frags); + +int efx_siena_probe_rx_queue(struct efx_rx_queue *rx_queue); +void efx_siena_init_rx_queue(struct efx_rx_queue *rx_queue); +void efx_siena_fini_rx_queue(struct efx_rx_queue *rx_queue); +void efx_siena_remove_rx_queue(struct efx_rx_queue *rx_queue); static inline void efx_sync_rx_buffer(struct efx_nic *efx, struct efx_rx_buffer *rx_buf, @@ -72,46 +65,46 @@ static inline void efx_sync_rx_buffer(struct efx_nic *efx, DMA_FROM_DEVICE); } -void efx_free_rx_buffers(struct efx_rx_queue *rx_queue, - struct efx_rx_buffer *rx_buf, - unsigned int num_bufs); +void efx_siena_free_rx_buffers(struct efx_rx_queue *rx_queue, + struct efx_rx_buffer *rx_buf, + unsigned int num_bufs); -void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue); -void efx_rx_config_page_split(struct efx_nic *efx); -void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue, bool atomic); +void efx_siena_rx_config_page_split(struct efx_nic *efx); +void efx_siena_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue, + bool atomic); void efx_siena_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf, unsigned int n_frags, u8 *eh, __wsum csum); -struct efx_rss_context *efx_alloc_rss_context_entry(struct efx_nic *efx); -struct efx_rss_context *efx_find_rss_context_entry(struct efx_nic *efx, u32 id); -void efx_free_rss_context_entry(struct efx_rss_context *ctx); -void efx_set_default_rx_indir_table(struct efx_nic *efx, - struct efx_rss_context *ctx); +struct efx_rss_context *efx_siena_alloc_rss_context_entry(struct efx_nic *efx); +struct efx_rss_context *efx_siena_find_rss_context_entry(struct efx_nic *efx, + u32 id); +void efx_siena_free_rss_context_entry(struct efx_rss_context *ctx); +void efx_siena_set_default_rx_indir_table(struct efx_nic *efx, + struct efx_rss_context *ctx); -bool efx_filter_is_mc_recipient(const struct efx_filter_spec *spec); -bool efx_filter_spec_equal(const struct efx_filter_spec *left, - const struct efx_filter_spec *right); -u32 efx_filter_spec_hash(const struct efx_filter_spec *spec); +bool efx_siena_filter_is_mc_recipient(const struct efx_filter_spec *spec); +bool efx_siena_filter_spec_equal(const struct efx_filter_spec *left, + const struct efx_filter_spec *right); +u32 efx_siena_filter_spec_hash(const struct efx_filter_spec *spec); #ifdef CONFIG_RFS_ACCEL -bool efx_rps_check_rule(struct efx_arfs_rule *rule, unsigned int filter_idx, - bool *force); -struct efx_arfs_rule *efx_rps_hash_find(struct efx_nic *efx, +bool efx_siena_rps_check_rule(struct efx_arfs_rule *rule, + unsigned int filter_idx, bool *force); +struct efx_arfs_rule *efx_siena_rps_hash_find(struct efx_nic *efx, const struct efx_filter_spec *spec); -struct efx_arfs_rule *efx_rps_hash_add(struct efx_nic *efx, - const struct efx_filter_spec *spec, - bool *new); -void efx_rps_hash_del(struct efx_nic *efx, const struct efx_filter_spec *spec); - -int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, - u16 rxq_index, u32 flow_id); -bool __efx_filter_rfs_expire(struct efx_channel *channel, unsigned int quota); +void efx_siena_rps_hash_del(struct efx_nic *efx, + const struct efx_filter_spec *spec); + +int efx_siena_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, + u16 rxq_index, u32 flow_id); +bool __efx_siena_filter_rfs_expire(struct efx_channel *channel, + unsigned int quota); #endif -int efx_probe_filters(struct efx_nic *efx); -void efx_remove_filters(struct efx_nic *efx); +int efx_siena_probe_filters(struct efx_nic *efx); +void efx_siena_remove_filters(struct efx_nic *efx); #endif diff --git a/drivers/net/ethernet/sfc/siena/tx.c b/drivers/net/ethernet/sfc/siena/tx.c index 118ec6f5f097..0677a0254d85 100644 --- a/drivers/net/ethernet/sfc/siena/tx.c +++ b/drivers/net/ethernet/sfc/siena/tx.c @@ -41,14 +41,6 @@ static inline u8 *efx_tx_get_copy_buffer(struct efx_tx_queue *tx_queue, return (u8 *)page_buf->addr + offset; } -u8 *efx_tx_get_copy_buffer_limited(struct efx_tx_queue *tx_queue, - struct efx_tx_buffer *buffer, size_t len) -{ - if (len > EFX_TX_CB_SIZE) - return NULL; - return efx_tx_get_copy_buffer(tx_queue, buffer); -} - static void efx_tx_maybe_stop_queue(struct efx_tx_queue *txq1) { /* We need to consider all queues that the net core sees as one */ @@ -164,7 +156,7 @@ netdev_tx_t __efx_siena_enqueue_skb(struct efx_tx_queue *tx_queue, * size limit. */ if (segments) { - rc = efx_tx_tso_fallback(tx_queue, skb); + rc = efx_siena_tx_tso_fallback(tx_queue, skb); tx_queue->tso_fallbacks++; if (rc == 0) return 0; @@ -178,7 +170,7 @@ netdev_tx_t __efx_siena_enqueue_skb(struct efx_tx_queue *tx_queue, } /* Map for DMA and create descriptors if we haven't done so already. */ - if (!data_mapped && (efx_tx_map_data(tx_queue, skb, segments))) + if (!data_mapped && (efx_siena_tx_map_data(tx_queue, skb, segments))) goto err; efx_tx_maybe_stop_queue(tx_queue); @@ -201,7 +193,7 @@ netdev_tx_t __efx_siena_enqueue_skb(struct efx_tx_queue *tx_queue, err: - efx_enqueue_unwind(tx_queue, old_insert_count); + efx_siena_enqueue_unwind(tx_queue, old_insert_count); dev_kfree_skb_any(skb); /* If we're not expecting another transmit and we had something to push @@ -285,7 +277,7 @@ int efx_siena_xdp_tx_buffers(struct efx_nic *efx, int n, struct xdp_frame **xdpf break; /* Create descriptor and set up for unmapping DMA. */ - tx_buffer = efx_tx_map_chunk(tx_queue, dma_addr, len); + tx_buffer = efx_siena_tx_map_chunk(tx_queue, dma_addr, len); tx_buffer->xdpf = xdpf; tx_buffer->flags = EFX_TX_BUF_XDP | EFX_TX_BUF_MAP_SINGLE; diff --git a/drivers/net/ethernet/sfc/siena/tx.h b/drivers/net/ethernet/sfc/siena/tx.h index f2c4d2f89919..ee801950c909 100644 --- a/drivers/net/ethernet/sfc/siena/tx.h +++ b/drivers/net/ethernet/sfc/siena/tx.h @@ -11,13 +11,6 @@ #include /* Driver internal tx-path related declarations. */ - -unsigned int efx_tx_limit_len(struct efx_tx_queue *tx_queue, - dma_addr_t dma_addr, unsigned int len); - -u8 *efx_tx_get_copy_buffer_limited(struct efx_tx_queue *tx_queue, - struct efx_tx_buffer *buffer, size_t len); - /* What TXQ type will satisfy the checksum offloads required for this skb? */ static inline unsigned int efx_tx_csum_type_skb(struct sk_buff *skb) { diff --git a/drivers/net/ethernet/sfc/siena/tx_common.c b/drivers/net/ethernet/sfc/siena/tx_common.c index 7945fe681e29..66adc8525a3a 100644 --- a/drivers/net/ethernet/sfc/siena/tx_common.c +++ b/drivers/net/ethernet/sfc/siena/tx_common.c @@ -19,7 +19,7 @@ static unsigned int efx_tx_cb_page_count(struct efx_tx_queue *tx_queue) PAGE_SIZE >> EFX_TX_CB_ORDER); } -int efx_probe_tx_queue(struct efx_tx_queue *tx_queue) +int efx_siena_probe_tx_queue(struct efx_tx_queue *tx_queue) { struct efx_nic *efx = tx_queue->efx; unsigned int entries; @@ -64,7 +64,7 @@ int efx_probe_tx_queue(struct efx_tx_queue *tx_queue) return rc; } -void efx_init_tx_queue(struct efx_tx_queue *tx_queue) +void efx_siena_init_tx_queue(struct efx_tx_queue *tx_queue) { struct efx_nic *efx = tx_queue->efx; @@ -94,32 +94,7 @@ void efx_init_tx_queue(struct efx_tx_queue *tx_queue) tx_queue->initialised = true; } -void efx_fini_tx_queue(struct efx_tx_queue *tx_queue) -{ - struct efx_tx_buffer *buffer; - - netif_dbg(tx_queue->efx, drv, tx_queue->efx->net_dev, - "shutting down TX queue %d\n", tx_queue->queue); - - tx_queue->initialised = false; - - if (!tx_queue->buffer) - return; - - /* Free any buffers left in the ring */ - while (tx_queue->read_count != tx_queue->write_count) { - unsigned int pkts_compl = 0, bytes_compl = 0; - - buffer = &tx_queue->buffer[tx_queue->read_count & tx_queue->ptr_mask]; - efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl); - - ++tx_queue->read_count; - } - tx_queue->xmit_pending = false; - netdev_tx_reset_queue(tx_queue->core_txq); -} - -void efx_remove_tx_queue(struct efx_tx_queue *tx_queue) +void efx_siena_remove_tx_queue(struct efx_tx_queue *tx_queue) { int i; @@ -143,10 +118,10 @@ void efx_remove_tx_queue(struct efx_tx_queue *tx_queue) tx_queue->channel->tx_queue_by_type[tx_queue->type] = NULL; } -void efx_dequeue_buffer(struct efx_tx_queue *tx_queue, - struct efx_tx_buffer *buffer, - unsigned int *pkts_compl, - unsigned int *bytes_compl) +static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue, + struct efx_tx_buffer *buffer, + unsigned int *pkts_compl, + unsigned int *bytes_compl) { if (buffer->unmap_len) { struct device *dma_dev = &tx_queue->efx->pci_dev->dev; @@ -191,6 +166,29 @@ void efx_dequeue_buffer(struct efx_tx_queue *tx_queue, buffer->flags = 0; } +void efx_siena_fini_tx_queue(struct efx_tx_queue *tx_queue) +{ + struct efx_tx_buffer *buffer; + + netif_dbg(tx_queue->efx, drv, tx_queue->efx->net_dev, + "shutting down TX queue %d\n", tx_queue->queue); + + if (!tx_queue->buffer) + return; + + /* Free any buffers left in the ring */ + while (tx_queue->read_count != tx_queue->write_count) { + unsigned int pkts_compl = 0, bytes_compl = 0; + + buffer = &tx_queue->buffer[tx_queue->read_count & tx_queue->ptr_mask]; + efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl); + + ++tx_queue->read_count; + } + tx_queue->xmit_pending = false; + netdev_tx_reset_queue(tx_queue->core_txq); +} + /* Remove packets from the TX queue * * This removes packets from the TX queue, up to and including the @@ -271,8 +269,8 @@ void efx_siena_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index) /* Remove buffers put into a tx_queue for the current packet. * None of the buffers must have an skb attached. */ -void efx_enqueue_unwind(struct efx_tx_queue *tx_queue, - unsigned int insert_count) +void efx_siena_enqueue_unwind(struct efx_tx_queue *tx_queue, + unsigned int insert_count) { struct efx_tx_buffer *buffer; unsigned int bytes_compl = 0; @@ -286,8 +284,8 @@ void efx_enqueue_unwind(struct efx_tx_queue *tx_queue, } } -struct efx_tx_buffer *efx_tx_map_chunk(struct efx_tx_queue *tx_queue, - dma_addr_t dma_addr, size_t len) +struct efx_tx_buffer *efx_siena_tx_map_chunk(struct efx_tx_queue *tx_queue, + dma_addr_t dma_addr, size_t len) { const struct efx_nic_type *nic_type = tx_queue->efx->type; struct efx_tx_buffer *buffer; @@ -313,7 +311,7 @@ struct efx_tx_buffer *efx_tx_map_chunk(struct efx_tx_queue *tx_queue, return buffer; } -int efx_tx_tso_header_length(struct sk_buff *skb) +static int efx_tx_tso_header_length(struct sk_buff *skb) { size_t header_len; @@ -328,8 +326,8 @@ int efx_tx_tso_header_length(struct sk_buff *skb) } /* Map all data from an SKB for DMA and create descriptors on the queue. */ -int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb, - unsigned int segment_count) +int efx_siena_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb, + unsigned int segment_count) { struct efx_nic *efx = tx_queue->efx; struct device *dma_dev = &efx->pci_dev->dev; @@ -359,7 +357,7 @@ int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb, if (header_len != len) { tx_queue->tso_long_headers++; - efx_tx_map_chunk(tx_queue, dma_addr, header_len); + efx_siena_tx_map_chunk(tx_queue, dma_addr, header_len); len -= header_len; dma_addr += header_len; } @@ -370,7 +368,7 @@ int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb, struct efx_tx_buffer *buffer; skb_frag_t *fragment; - buffer = efx_tx_map_chunk(tx_queue, dma_addr, len); + buffer = efx_siena_tx_map_chunk(tx_queue, dma_addr, len); /* The final descriptor for a fragment is responsible for * unmapping the whole fragment. @@ -402,7 +400,7 @@ int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb, } while (1); } -unsigned int efx_tx_max_skb_descs(struct efx_nic *efx) +unsigned int efx_siena_tx_max_skb_descs(struct efx_nic *efx) { /* Header and payload descriptor for each output segment, plus * one for every input fragment boundary within a segment @@ -430,7 +428,8 @@ unsigned int efx_tx_max_skb_descs(struct efx_nic *efx) * * Returns 0 on success, error code otherwise. */ -int efx_tx_tso_fallback(struct efx_tx_queue *tx_queue, struct sk_buff *skb) +int efx_siena_tx_tso_fallback(struct efx_tx_queue *tx_queue, + struct sk_buff *skb) { struct sk_buff *segments, *next; diff --git a/drivers/net/ethernet/sfc/siena/tx_common.h b/drivers/net/ethernet/sfc/siena/tx_common.h index 602f5a052918..31ca52a25015 100644 --- a/drivers/net/ethernet/sfc/siena/tx_common.h +++ b/drivers/net/ethernet/sfc/siena/tx_common.h @@ -11,15 +11,10 @@ #ifndef EFX_TX_COMMON_H #define EFX_TX_COMMON_H -int efx_probe_tx_queue(struct efx_tx_queue *tx_queue); -void efx_init_tx_queue(struct efx_tx_queue *tx_queue); -void efx_fini_tx_queue(struct efx_tx_queue *tx_queue); -void efx_remove_tx_queue(struct efx_tx_queue *tx_queue); - -void efx_dequeue_buffer(struct efx_tx_queue *tx_queue, - struct efx_tx_buffer *buffer, - unsigned int *pkts_compl, - unsigned int *bytes_compl); +int efx_siena_probe_tx_queue(struct efx_tx_queue *tx_queue); +void efx_siena_init_tx_queue(struct efx_tx_queue *tx_queue); +void efx_siena_fini_tx_queue(struct efx_tx_queue *tx_queue); +void efx_siena_remove_tx_queue(struct efx_tx_queue *tx_queue); static inline bool efx_tx_buffer_in_use(struct efx_tx_buffer *buffer) { @@ -29,17 +24,16 @@ static inline bool efx_tx_buffer_in_use(struct efx_tx_buffer *buffer) void efx_siena_xmit_done_check_empty(struct efx_tx_queue *tx_queue); void efx_siena_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index); -void efx_enqueue_unwind(struct efx_tx_queue *tx_queue, - unsigned int insert_count); +void efx_siena_enqueue_unwind(struct efx_tx_queue *tx_queue, + unsigned int insert_count); -struct efx_tx_buffer *efx_tx_map_chunk(struct efx_tx_queue *tx_queue, - dma_addr_t dma_addr, size_t len); -int efx_tx_tso_header_length(struct sk_buff *skb); -int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb, - unsigned int segment_count); +struct efx_tx_buffer *efx_siena_tx_map_chunk(struct efx_tx_queue *tx_queue, + dma_addr_t dma_addr, size_t len); +int efx_siena_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb, + unsigned int segment_count); -unsigned int efx_tx_max_skb_descs(struct efx_nic *efx); -int efx_tx_tso_fallback(struct efx_tx_queue *tx_queue, struct sk_buff *skb); +unsigned int efx_siena_tx_max_skb_descs(struct efx_nic *efx); +int efx_siena_tx_tso_fallback(struct efx_tx_queue *tx_queue, struct sk_buff *skb); -extern bool efx_separate_tx_channels; +extern bool efx_siena_separate_tx_channels; #endif From patchwork Mon May 9 15:32:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Habets X-Patchwork-Id: 12843796 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 544D8C433EF for ; Mon, 9 May 2022 15:32:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238451AbiEIPgh (ORCPT ); Mon, 9 May 2022 11:36:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238429AbiEIPgc (ORCPT ); Mon, 9 May 2022 11:36:32 -0400 Received: from mint-fitpc2.mph.net (unknown [81.168.73.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9262622A2F9 for ; Mon, 9 May 2022 08:32:34 -0700 (PDT) Received: from palantir17.mph.net (unknown [192.168.0.4]) by mint-fitpc2.mph.net (Postfix) with ESMTP id 7709A3200F2; Mon, 9 May 2022 16:32:33 +0100 (BST) Received: from localhost ([::1] helo=palantir17.mph.net) by palantir17.mph.net with esmtp (Exim 4.89) (envelope-from ) id 1no5NB-0001R3-8E; Mon, 09 May 2022 16:32:33 +0100 Subject: [PATCH net-next v4 07/11] sfc/siena: Rename peripheral functions to avoid conflicts with sfc From: Martin Habets To: kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, ecree.xilinx@gmail.com Date: Mon, 09 May 2022 16:32:33 +0100 Message-ID: <165211035294.5289.13198288616244004306.stgit@palantir17.mph.net> In-Reply-To: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> References: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org For siena use efx_siena_ as the function prefix. This patch covers selftest.h, ptp.h, net_driver.h and ethtool_common.h. efx_ethtool_fill_self_tests() can become static. Some functions in ptp.c can also become static. Rename loopback_mode in net_driver.h. Signed-off-by: Martin Habets --- drivers/net/ethernet/sfc/siena/efx.c | 6 - drivers/net/ethernet/sfc/siena/efx_common.c | 12 + drivers/net/ethernet/sfc/siena/ethtool.c | 50 +++--- drivers/net/ethernet/sfc/siena/ethtool_common.c | 199 ++++++++++++----------- drivers/net/ethernet/sfc/siena/ethtool_common.h | 95 +++++------ drivers/net/ethernet/sfc/siena/mcdi.c | 4 drivers/net/ethernet/sfc/siena/net_driver.h | 6 - drivers/net/ethernet/sfc/siena/ptp.c | 53 +++--- drivers/net/ethernet/sfc/siena/ptp.h | 46 +++-- drivers/net/ethernet/sfc/siena/rx.c | 2 drivers/net/ethernet/sfc/siena/selftest.c | 24 +-- drivers/net/ethernet/sfc/siena/selftest.h | 14 +- drivers/net/ethernet/sfc/siena/siena.c | 17 +- drivers/net/ethernet/sfc/siena/tx.c | 6 - drivers/net/ethernet/sfc/siena/tx_common.c | 6 - 15 files changed, 270 insertions(+), 270 deletions(-) diff --git a/drivers/net/ethernet/sfc/siena/efx.c b/drivers/net/ethernet/sfc/siena/efx.c index d94e2438ae3a..3b79c39300a4 100644 --- a/drivers/net/ethernet/sfc/siena/efx.c +++ b/drivers/net/ethernet/sfc/siena/efx.c @@ -494,9 +494,9 @@ static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd) struct mii_ioctl_data *data = if_mii(ifr); if (cmd == SIOCSHWTSTAMP) - return efx_ptp_set_ts_config(efx, ifr); + return efx_siena_ptp_set_ts_config(efx, ifr); if (cmd == SIOCGHWTSTAMP) - return efx_ptp_get_ts_config(efx, ifr); + return efx_siena_ptp_get_ts_config(efx, ifr); /* Convert phy_id from older PRTAD/DEVAD format */ if ((cmd == SIOCGMIIREG || cmd == SIOCSMIIREG) && @@ -536,7 +536,7 @@ static int efx_net_open(struct net_device *net_dev) efx_siena_start_all(efx); if (efx->state == STATE_DISABLED || efx->reset_pending) netif_device_detach(efx->net_dev); - efx_selftest_async_start(efx); + efx_siena_selftest_async_start(efx); return 0; } diff --git a/drivers/net/ethernet/sfc/siena/efx_common.c b/drivers/net/ethernet/sfc/siena/efx_common.c index f245d03c4caa..6b524775c929 100644 --- a/drivers/net/ethernet/sfc/siena/efx_common.c +++ b/drivers/net/ethernet/sfc/siena/efx_common.c @@ -73,8 +73,8 @@ static const char *const efx_reset_type_names[] = { STRING_TABLE_LOOKUP(type, efx_reset_type) /* Loopback mode names (see LOOPBACK_MODE()) */ -const unsigned int efx_loopback_mode_max = LOOPBACK_MAX; -const char *const efx_loopback_mode_names[] = { +const unsigned int efx_siena_loopback_mode_max = LOOPBACK_MAX; +const char *const efx_siena_loopback_mode_names[] = { [LOOPBACK_NONE] = "NONE", [LOOPBACK_DATA] = "DATAPATH", [LOOPBACK_GMAC] = "GMAC", @@ -434,7 +434,7 @@ static void efx_start_datapath(struct efx_nic *efx) /* Initialise the channels */ efx_siena_start_channels(efx); - efx_ptp_start_datapath(efx); + efx_siena_ptp_start_datapath(efx); if (netif_device_present(efx->net_dev)) netif_tx_wake_all_queues(efx->net_dev); @@ -445,7 +445,7 @@ static void efx_stop_datapath(struct efx_nic *efx) EFX_ASSERT_RESET_SERIALISED(efx); BUG_ON(efx->port_enabled); - efx_ptp_stop_datapath(efx); + efx_siena_ptp_stop_datapath(efx); efx_siena_stop_channels(efx); } @@ -514,7 +514,7 @@ static void efx_stop_port(struct efx_nic *efx) netif_addr_unlock_bh(efx->net_dev); cancel_delayed_work_sync(&efx->monitor_work); - efx_selftest_async_cancel(efx); + efx_siena_selftest_async_cancel(efx); cancel_work_sync(&efx->mac_work); } @@ -994,7 +994,7 @@ int efx_siena_init_struct(struct efx_nic *efx, #endif INIT_WORK(&efx->reset_work, efx_reset_work); INIT_DELAYED_WORK(&efx->monitor_work, efx_monitor); - efx_selftest_async_init(efx); + efx_siena_selftest_async_init(efx); efx->pci_dev = pci_dev; efx->msg_enable = debug; efx->state = STATE_UNINIT; diff --git a/drivers/net/ethernet/sfc/siena/ethtool.c b/drivers/net/ethernet/sfc/siena/ethtool.c index 7aa621e97212..63388bec421d 100644 --- a/drivers/net/ethernet/sfc/siena/ethtool.c +++ b/drivers/net/ethernet/sfc/siena/ethtool.c @@ -235,7 +235,7 @@ static int efx_ethtool_get_ts_info(struct net_device *net_dev, SOF_TIMESTAMPING_SOFTWARE); ts_info->phc_index = -1; - efx_ptp_get_ts_info(efx, ts_info); + efx_siena_ptp_get_ts_info(efx, ts_info); return 0; } @@ -243,40 +243,40 @@ const struct ethtool_ops efx_siena_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_USECS_IRQ | ETHTOOL_COALESCE_USE_ADAPTIVE_RX, - .get_drvinfo = efx_ethtool_get_drvinfo, + .get_drvinfo = efx_siena_ethtool_get_drvinfo, .get_regs_len = efx_ethtool_get_regs_len, .get_regs = efx_ethtool_get_regs, - .get_msglevel = efx_ethtool_get_msglevel, - .set_msglevel = efx_ethtool_set_msglevel, + .get_msglevel = efx_siena_ethtool_get_msglevel, + .set_msglevel = efx_siena_ethtool_set_msglevel, .get_link = ethtool_op_get_link, .get_coalesce = efx_ethtool_get_coalesce, .set_coalesce = efx_ethtool_set_coalesce, .get_ringparam = efx_ethtool_get_ringparam, .set_ringparam = efx_ethtool_set_ringparam, - .get_pauseparam = efx_ethtool_get_pauseparam, - .set_pauseparam = efx_ethtool_set_pauseparam, - .get_sset_count = efx_ethtool_get_sset_count, - .self_test = efx_ethtool_self_test, - .get_strings = efx_ethtool_get_strings, + .get_pauseparam = efx_siena_ethtool_get_pauseparam, + .set_pauseparam = efx_siena_ethtool_set_pauseparam, + .get_sset_count = efx_siena_ethtool_get_sset_count, + .self_test = efx_siena_ethtool_self_test, + .get_strings = efx_siena_ethtool_get_strings, .set_phys_id = efx_ethtool_phys_id, - .get_ethtool_stats = efx_ethtool_get_stats, + .get_ethtool_stats = efx_siena_ethtool_get_stats, .get_wol = efx_ethtool_get_wol, .set_wol = efx_ethtool_set_wol, - .reset = efx_ethtool_reset, - .get_rxnfc = efx_ethtool_get_rxnfc, - .set_rxnfc = efx_ethtool_set_rxnfc, - .get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size, - .get_rxfh_key_size = efx_ethtool_get_rxfh_key_size, - .get_rxfh = efx_ethtool_get_rxfh, - .set_rxfh = efx_ethtool_set_rxfh, - .get_rxfh_context = efx_ethtool_get_rxfh_context, - .set_rxfh_context = efx_ethtool_set_rxfh_context, + .reset = efx_siena_ethtool_reset, + .get_rxnfc = efx_siena_ethtool_get_rxnfc, + .set_rxnfc = efx_siena_ethtool_set_rxnfc, + .get_rxfh_indir_size = efx_siena_ethtool_get_rxfh_indir_size, + .get_rxfh_key_size = efx_siena_ethtool_get_rxfh_key_size, + .get_rxfh = efx_siena_ethtool_get_rxfh, + .set_rxfh = efx_siena_ethtool_set_rxfh, + .get_rxfh_context = efx_siena_ethtool_get_rxfh_context, + .set_rxfh_context = efx_siena_ethtool_set_rxfh_context, .get_ts_info = efx_ethtool_get_ts_info, - .get_module_info = efx_ethtool_get_module_info, - .get_module_eeprom = efx_ethtool_get_module_eeprom, - .get_link_ksettings = efx_ethtool_get_link_ksettings, - .set_link_ksettings = efx_ethtool_set_link_ksettings, + .get_module_info = efx_siena_ethtool_get_module_info, + .get_module_eeprom = efx_siena_ethtool_get_module_eeprom, + .get_link_ksettings = efx_siena_ethtool_get_link_ksettings, + .set_link_ksettings = efx_siena_ethtool_set_link_ksettings, .get_fec_stats = efx_ethtool_get_fec_stats, - .get_fecparam = efx_ethtool_get_fecparam, - .set_fecparam = efx_ethtool_set_fecparam, + .get_fecparam = efx_siena_ethtool_get_fecparam, + .set_fecparam = efx_siena_ethtool_set_fecparam, }; diff --git a/drivers/net/ethernet/sfc/siena/ethtool_common.c b/drivers/net/ethernet/sfc/siena/ethtool_common.c index f54510cf4e72..91f750e4ede8 100644 --- a/drivers/net/ethernet/sfc/siena/ethtool_common.c +++ b/drivers/net/ethernet/sfc/siena/ethtool_common.c @@ -100,8 +100,8 @@ static const struct efx_sw_stat_desc efx_sw_stat_desc[] = { #define EFX_ETHTOOL_SW_STAT_COUNT ARRAY_SIZE(efx_sw_stat_desc) -void efx_ethtool_get_drvinfo(struct net_device *net_dev, - struct ethtool_drvinfo *info) +void efx_siena_ethtool_get_drvinfo(struct net_device *net_dev, + struct ethtool_drvinfo *info) { struct efx_nic *efx = netdev_priv(net_dev); @@ -111,70 +111,22 @@ void efx_ethtool_get_drvinfo(struct net_device *net_dev, strlcpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info)); } -u32 efx_ethtool_get_msglevel(struct net_device *net_dev) +u32 efx_siena_ethtool_get_msglevel(struct net_device *net_dev) { struct efx_nic *efx = netdev_priv(net_dev); return efx->msg_enable; } -void efx_ethtool_set_msglevel(struct net_device *net_dev, u32 msg_enable) +void efx_siena_ethtool_set_msglevel(struct net_device *net_dev, u32 msg_enable) { struct efx_nic *efx = netdev_priv(net_dev); efx->msg_enable = msg_enable; } -void efx_ethtool_self_test(struct net_device *net_dev, - struct ethtool_test *test, u64 *data) -{ - struct efx_nic *efx = netdev_priv(net_dev); - struct efx_self_tests *efx_tests; - bool already_up; - int rc = -ENOMEM; - - efx_tests = kzalloc(sizeof(*efx_tests), GFP_KERNEL); - if (!efx_tests) - goto fail; - - if (efx->state != STATE_READY) { - rc = -EBUSY; - goto out; - } - - netif_info(efx, drv, efx->net_dev, "starting %sline testing\n", - (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); - - /* We need rx buffers and interrupts. */ - already_up = (efx->net_dev->flags & IFF_UP); - if (!already_up) { - rc = dev_open(efx->net_dev, NULL); - if (rc) { - netif_err(efx, drv, efx->net_dev, - "failed opening device.\n"); - goto out; - } - } - - rc = efx_selftest(efx, efx_tests, test->flags); - - if (!already_up) - dev_close(efx->net_dev); - - netif_info(efx, drv, efx->net_dev, "%s %sline self-tests\n", - rc == 0 ? "passed" : "failed", - (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); - -out: - efx_ethtool_fill_self_tests(efx, efx_tests, NULL, data); - kfree(efx_tests); -fail: - if (rc) - test->flags |= ETH_TEST_FL_FAILED; -} - -void efx_ethtool_get_pauseparam(struct net_device *net_dev, - struct ethtool_pauseparam *pause) +void efx_siena_ethtool_get_pauseparam(struct net_device *net_dev, + struct ethtool_pauseparam *pause) { struct efx_nic *efx = netdev_priv(net_dev); @@ -183,8 +135,8 @@ void efx_ethtool_get_pauseparam(struct net_device *net_dev, pause->autoneg = !!(efx->wanted_fc & EFX_FC_AUTO); } -int efx_ethtool_set_pauseparam(struct net_device *net_dev, - struct ethtool_pauseparam *pause) +int efx_siena_ethtool_set_pauseparam(struct net_device *net_dev, + struct ethtool_pauseparam *pause) { struct efx_nic *efx = netdev_priv(net_dev); u8 wanted_fc, old_fc; @@ -281,7 +233,7 @@ static void efx_fill_test(unsigned int test_index, u8 *strings, u64 *data, #define EFX_CHANNEL_NAME(_channel) "chan%d", _channel->channel #define EFX_TX_QUEUE_NAME(_tx_queue) "txq%d", _tx_queue->label #define EFX_LOOPBACK_NAME(_mode, _counter) \ - "loopback.%s." _counter, STRING_TABLE_LOOKUP(_mode, efx_loopback_mode) + "loopback.%s." _counter, STRING_TABLE_LOOKUP(_mode, efx_siena_loopback_mode) /** * efx_fill_loopback_test - fill in a block of loopback self-test entries @@ -340,9 +292,9 @@ static int efx_fill_loopback_test(struct efx_nic *efx, * The reason for merging these three functions is to make sure that * they can never be inconsistent. */ -int efx_ethtool_fill_self_tests(struct efx_nic *efx, - struct efx_self_tests *tests, - u8 *strings, u64 *data) +static int efx_ethtool_fill_self_tests(struct efx_nic *efx, + struct efx_self_tests *tests, + u8 *strings, u64 *data) { struct efx_channel *channel; unsigned int n = 0, i; @@ -395,6 +347,54 @@ int efx_ethtool_fill_self_tests(struct efx_nic *efx, return n; } +void efx_siena_ethtool_self_test(struct net_device *net_dev, + struct ethtool_test *test, u64 *data) +{ + struct efx_nic *efx = netdev_priv(net_dev); + struct efx_self_tests *efx_tests; + bool already_up; + int rc = -ENOMEM; + + efx_tests = kzalloc(sizeof(*efx_tests), GFP_KERNEL); + if (!efx_tests) + goto fail; + + if (efx->state != STATE_READY) { + rc = -EBUSY; + goto out; + } + + netif_info(efx, drv, efx->net_dev, "starting %sline testing\n", + (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); + + /* We need rx buffers and interrupts. */ + already_up = (efx->net_dev->flags & IFF_UP); + if (!already_up) { + rc = dev_open(efx->net_dev, NULL); + if (rc) { + netif_err(efx, drv, efx->net_dev, + "failed opening device.\n"); + goto out; + } + } + + rc = efx_siena_selftest(efx, efx_tests, test->flags); + + if (!already_up) + dev_close(efx->net_dev); + + netif_info(efx, drv, efx->net_dev, "%s %sline self-tests\n", + rc == 0 ? "passed" : "failed", + (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); + +out: + efx_ethtool_fill_self_tests(efx, efx_tests, NULL, data); + kfree(efx_tests); +fail: + if (rc) + test->flags |= ETH_TEST_FL_FAILED; +} + static size_t efx_describe_per_queue_stats(struct efx_nic *efx, u8 *strings) { size_t n_stats = 0; @@ -439,7 +439,7 @@ static size_t efx_describe_per_queue_stats(struct efx_nic *efx, u8 *strings) return n_stats; } -int efx_ethtool_get_sset_count(struct net_device *net_dev, int string_set) +int efx_siena_ethtool_get_sset_count(struct net_device *net_dev, int string_set) { struct efx_nic *efx = netdev_priv(net_dev); @@ -448,7 +448,7 @@ int efx_ethtool_get_sset_count(struct net_device *net_dev, int string_set) return efx->type->describe_stats(efx, NULL) + EFX_ETHTOOL_SW_STAT_COUNT + efx_describe_per_queue_stats(efx, NULL) + - efx_ptp_describe_stats(efx, NULL); + efx_siena_ptp_describe_stats(efx, NULL); case ETH_SS_TEST: return efx_ethtool_fill_self_tests(efx, NULL, NULL, NULL); default: @@ -456,8 +456,8 @@ int efx_ethtool_get_sset_count(struct net_device *net_dev, int string_set) } } -void efx_ethtool_get_strings(struct net_device *net_dev, - u32 string_set, u8 *strings) +void efx_siena_ethtool_get_strings(struct net_device *net_dev, + u32 string_set, u8 *strings) { struct efx_nic *efx = netdev_priv(net_dev); int i; @@ -472,7 +472,7 @@ void efx_ethtool_get_strings(struct net_device *net_dev, strings += EFX_ETHTOOL_SW_STAT_COUNT * ETH_GSTRING_LEN; strings += (efx_describe_per_queue_stats(efx, strings) * ETH_GSTRING_LEN); - efx_ptp_describe_stats(efx, strings); + efx_siena_ptp_describe_stats(efx, strings); break; case ETH_SS_TEST: efx_ethtool_fill_self_tests(efx, NULL, strings, NULL); @@ -483,9 +483,9 @@ void efx_ethtool_get_strings(struct net_device *net_dev, } } -void efx_ethtool_get_stats(struct net_device *net_dev, - struct ethtool_stats *stats, - u64 *data) +void efx_siena_ethtool_get_stats(struct net_device *net_dev, + struct ethtool_stats *stats, + u64 *data) { struct efx_nic *efx = netdev_priv(net_dev); const struct efx_sw_stat_desc *stat; @@ -554,12 +554,12 @@ void efx_ethtool_get_stats(struct net_device *net_dev, } } - efx_ptp_update_stats(efx, data); + efx_siena_ptp_update_stats(efx, data); } /* This must be called with rtnl_lock held. */ -int efx_ethtool_get_link_ksettings(struct net_device *net_dev, - struct ethtool_link_ksettings *cmd) +int efx_siena_ethtool_get_link_ksettings(struct net_device *net_dev, + struct ethtool_link_ksettings *cmd) { struct efx_nic *efx = netdev_priv(net_dev); struct efx_link_state *link_state = &efx->link_state; @@ -581,8 +581,9 @@ int efx_ethtool_get_link_ksettings(struct net_device *net_dev, } /* This must be called with rtnl_lock held. */ -int efx_ethtool_set_link_ksettings(struct net_device *net_dev, - const struct ethtool_link_ksettings *cmd) +int +efx_siena_ethtool_set_link_ksettings(struct net_device *net_dev, + const struct ethtool_link_ksettings *cmd) { struct efx_nic *efx = netdev_priv(net_dev); int rc; @@ -601,8 +602,8 @@ int efx_ethtool_set_link_ksettings(struct net_device *net_dev, return rc; } -int efx_ethtool_get_fecparam(struct net_device *net_dev, - struct ethtool_fecparam *fecparam) +int efx_siena_ethtool_get_fecparam(struct net_device *net_dev, + struct ethtool_fecparam *fecparam) { struct efx_nic *efx = netdev_priv(net_dev); int rc; @@ -614,8 +615,8 @@ int efx_ethtool_get_fecparam(struct net_device *net_dev, return rc; } -int efx_ethtool_set_fecparam(struct net_device *net_dev, - struct ethtool_fecparam *fecparam) +int efx_siena_ethtool_set_fecparam(struct net_device *net_dev, + struct ethtool_fecparam *fecparam) { struct efx_nic *efx = netdev_priv(net_dev); int rc; @@ -806,8 +807,8 @@ static int efx_ethtool_get_class_rule(struct efx_nic *efx, return rc; } -int efx_ethtool_get_rxnfc(struct net_device *net_dev, - struct ethtool_rxnfc *info, u32 *rule_locs) +int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev, + struct ethtool_rxnfc *info, u32 *rule_locs) { struct efx_nic *efx = netdev_priv(net_dev); u32 rss_context = 0; @@ -1125,8 +1126,8 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx, return 0; } -int efx_ethtool_set_rxnfc(struct net_device *net_dev, - struct ethtool_rxnfc *info) +int efx_siena_ethtool_set_rxnfc(struct net_device *net_dev, + struct ethtool_rxnfc *info) { struct efx_nic *efx = netdev_priv(net_dev); @@ -1147,7 +1148,7 @@ int efx_ethtool_set_rxnfc(struct net_device *net_dev, } } -u32 efx_ethtool_get_rxfh_indir_size(struct net_device *net_dev) +u32 efx_siena_ethtool_get_rxfh_indir_size(struct net_device *net_dev) { struct efx_nic *efx = netdev_priv(net_dev); @@ -1156,15 +1157,15 @@ u32 efx_ethtool_get_rxfh_indir_size(struct net_device *net_dev) return ARRAY_SIZE(efx->rss_context.rx_indir_table); } -u32 efx_ethtool_get_rxfh_key_size(struct net_device *net_dev) +u32 efx_siena_ethtool_get_rxfh_key_size(struct net_device *net_dev) { struct efx_nic *efx = netdev_priv(net_dev); return efx->type->rx_hash_key_size; } -int efx_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key, - u8 *hfunc) +int efx_siena_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key, + u8 *hfunc) { struct efx_nic *efx = netdev_priv(net_dev); int rc; @@ -1184,8 +1185,8 @@ int efx_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key, return 0; } -int efx_ethtool_set_rxfh(struct net_device *net_dev, const u32 *indir, - const u8 *key, const u8 hfunc) +int efx_siena_ethtool_set_rxfh(struct net_device *net_dev, const u32 *indir, + const u8 *key, const u8 hfunc) { struct efx_nic *efx = netdev_priv(net_dev); @@ -1203,8 +1204,8 @@ int efx_ethtool_set_rxfh(struct net_device *net_dev, const u32 *indir, return efx->type->rx_push_rss_config(efx, true, indir, key); } -int efx_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir, - u8 *key, u8 *hfunc, u32 rss_context) +int efx_siena_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir, + u8 *key, u8 *hfunc, u32 rss_context) { struct efx_nic *efx = netdev_priv(net_dev); struct efx_rss_context *ctx; @@ -1234,10 +1235,10 @@ int efx_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir, return rc; } -int efx_ethtool_set_rxfh_context(struct net_device *net_dev, - const u32 *indir, const u8 *key, - const u8 hfunc, u32 *rss_context, - bool delete) +int efx_siena_ethtool_set_rxfh_context(struct net_device *net_dev, + const u32 *indir, const u8 *key, + const u8 hfunc, u32 *rss_context, + bool delete) { struct efx_nic *efx = netdev_priv(net_dev); struct efx_rss_context *ctx; @@ -1299,7 +1300,7 @@ int efx_ethtool_set_rxfh_context(struct net_device *net_dev, return rc; } -int efx_ethtool_reset(struct net_device *net_dev, u32 *flags) +int efx_siena_ethtool_reset(struct net_device *net_dev, u32 *flags) { struct efx_nic *efx = netdev_priv(net_dev); int rc; @@ -1311,9 +1312,9 @@ int efx_ethtool_reset(struct net_device *net_dev, u32 *flags) return efx_siena_reset(efx, rc); } -int efx_ethtool_get_module_eeprom(struct net_device *net_dev, - struct ethtool_eeprom *ee, - u8 *data) +int efx_siena_ethtool_get_module_eeprom(struct net_device *net_dev, + struct ethtool_eeprom *ee, + u8 *data) { struct efx_nic *efx = netdev_priv(net_dev); int ret; @@ -1325,8 +1326,8 @@ int efx_ethtool_get_module_eeprom(struct net_device *net_dev, return ret; } -int efx_ethtool_get_module_info(struct net_device *net_dev, - struct ethtool_modinfo *modinfo) +int efx_siena_ethtool_get_module_info(struct net_device *net_dev, + struct ethtool_modinfo *modinfo) { struct efx_nic *efx = netdev_priv(net_dev); int ret; diff --git a/drivers/net/ethernet/sfc/siena/ethtool_common.h b/drivers/net/ethernet/sfc/siena/ethtool_common.h index 659491932101..04b375dc6800 100644 --- a/drivers/net/ethernet/sfc/siena/ethtool_common.h +++ b/drivers/net/ethernet/sfc/siena/ethtool_common.h @@ -11,53 +11,50 @@ #ifndef EFX_ETHTOOL_COMMON_H #define EFX_ETHTOOL_COMMON_H -void efx_ethtool_get_drvinfo(struct net_device *net_dev, - struct ethtool_drvinfo *info); -u32 efx_ethtool_get_msglevel(struct net_device *net_dev); -void efx_ethtool_set_msglevel(struct net_device *net_dev, u32 msg_enable); -void efx_ethtool_self_test(struct net_device *net_dev, - struct ethtool_test *test, u64 *data); -void efx_ethtool_get_pauseparam(struct net_device *net_dev, - struct ethtool_pauseparam *pause); -int efx_ethtool_set_pauseparam(struct net_device *net_dev, - struct ethtool_pauseparam *pause); -int efx_ethtool_fill_self_tests(struct efx_nic *efx, - struct efx_self_tests *tests, - u8 *strings, u64 *data); -int efx_ethtool_get_sset_count(struct net_device *net_dev, int string_set); -void efx_ethtool_get_strings(struct net_device *net_dev, u32 string_set, - u8 *strings); -void efx_ethtool_get_stats(struct net_device *net_dev, - struct ethtool_stats *stats __attribute__ ((unused)), - u64 *data); -int efx_ethtool_get_link_ksettings(struct net_device *net_dev, - struct ethtool_link_ksettings *out); -int efx_ethtool_set_link_ksettings(struct net_device *net_dev, - const struct ethtool_link_ksettings *settings); -int efx_ethtool_get_fecparam(struct net_device *net_dev, - struct ethtool_fecparam *fecparam); -int efx_ethtool_set_fecparam(struct net_device *net_dev, - struct ethtool_fecparam *fecparam); -int efx_ethtool_get_rxnfc(struct net_device *net_dev, - struct ethtool_rxnfc *info, u32 *rule_locs); -int efx_ethtool_set_rxnfc(struct net_device *net_dev, - struct ethtool_rxnfc *info); -u32 efx_ethtool_get_rxfh_indir_size(struct net_device *net_dev); -u32 efx_ethtool_get_rxfh_key_size(struct net_device *net_dev); -int efx_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key, - u8 *hfunc); -int efx_ethtool_set_rxfh(struct net_device *net_dev, - const u32 *indir, const u8 *key, const u8 hfunc); -int efx_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir, - u8 *key, u8 *hfunc, u32 rss_context); -int efx_ethtool_set_rxfh_context(struct net_device *net_dev, - const u32 *indir, const u8 *key, - const u8 hfunc, u32 *rss_context, - bool delete); -int efx_ethtool_reset(struct net_device *net_dev, u32 *flags); -int efx_ethtool_get_module_eeprom(struct net_device *net_dev, - struct ethtool_eeprom *ee, - u8 *data); -int efx_ethtool_get_module_info(struct net_device *net_dev, - struct ethtool_modinfo *modinfo); +void efx_siena_ethtool_get_drvinfo(struct net_device *net_dev, + struct ethtool_drvinfo *info); +u32 efx_siena_ethtool_get_msglevel(struct net_device *net_dev); +void efx_siena_ethtool_set_msglevel(struct net_device *net_dev, u32 msg_enable); +void efx_siena_ethtool_self_test(struct net_device *net_dev, + struct ethtool_test *test, u64 *data); +void efx_siena_ethtool_get_pauseparam(struct net_device *net_dev, + struct ethtool_pauseparam *pause); +int efx_siena_ethtool_set_pauseparam(struct net_device *net_dev, + struct ethtool_pauseparam *pause); +int efx_siena_ethtool_get_sset_count(struct net_device *net_dev, int string_set); +void efx_siena_ethtool_get_strings(struct net_device *net_dev, u32 string_set, + u8 *strings); +void efx_siena_ethtool_get_stats(struct net_device *net_dev, + struct ethtool_stats *stats __always_unused, + u64 *data); +int efx_siena_ethtool_get_link_ksettings(struct net_device *net_dev, + struct ethtool_link_ksettings *out); +int efx_siena_ethtool_set_link_ksettings(struct net_device *net_dev, + const struct ethtool_link_ksettings *settings); +int efx_siena_ethtool_get_fecparam(struct net_device *net_dev, + struct ethtool_fecparam *fecparam); +int efx_siena_ethtool_set_fecparam(struct net_device *net_dev, + struct ethtool_fecparam *fecparam); +int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev, + struct ethtool_rxnfc *info, u32 *rule_locs); +int efx_siena_ethtool_set_rxnfc(struct net_device *net_dev, + struct ethtool_rxnfc *info); +u32 efx_siena_ethtool_get_rxfh_indir_size(struct net_device *net_dev); +u32 efx_siena_ethtool_get_rxfh_key_size(struct net_device *net_dev); +int efx_siena_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key, + u8 *hfunc); +int efx_siena_ethtool_set_rxfh(struct net_device *net_dev, + const u32 *indir, const u8 *key, const u8 hfunc); +int efx_siena_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir, + u8 *key, u8 *hfunc, u32 rss_context); +int efx_siena_ethtool_set_rxfh_context(struct net_device *net_dev, + const u32 *indir, const u8 *key, + const u8 hfunc, u32 *rss_context, + bool delete); +int efx_siena_ethtool_reset(struct net_device *net_dev, u32 *flags); +int efx_siena_ethtool_get_module_eeprom(struct net_device *net_dev, + struct ethtool_eeprom *ee, + u8 *data); +int efx_siena_ethtool_get_module_info(struct net_device *net_dev, + struct ethtool_modinfo *modinfo); #endif diff --git a/drivers/net/ethernet/sfc/siena/mcdi.c b/drivers/net/ethernet/sfc/siena/mcdi.c index 7f8f0889bf8d..ff426b228cb2 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi.c +++ b/drivers/net/ethernet/sfc/siena/mcdi.c @@ -1363,10 +1363,10 @@ void efx_mcdi_process_event(struct efx_channel *channel, case MCDI_EVENT_CODE_PTP_RX: case MCDI_EVENT_CODE_PTP_FAULT: case MCDI_EVENT_CODE_PTP_PPS: - efx_ptp_event(efx, event); + efx_siena_ptp_event(efx, event); break; case MCDI_EVENT_CODE_PTP_TIME: - efx_time_sync_event(channel, event); + efx_siena_time_sync_event(channel, event); break; case MCDI_EVENT_CODE_TX_FLUSH: case MCDI_EVENT_CODE_RX_FLUSH: diff --git a/drivers/net/ethernet/sfc/siena/net_driver.h b/drivers/net/ethernet/sfc/siena/net_driver.h index 3fe93f25a569..7e0659be4348 100644 --- a/drivers/net/ethernet/sfc/siena/net_driver.h +++ b/drivers/net/ethernet/sfc/siena/net_driver.h @@ -606,10 +606,10 @@ enum efx_led_mode { #define STRING_TABLE_LOOKUP(val, member) \ ((val) < member ## _max) ? member ## _names[val] : "(invalid)" -extern const char *const efx_loopback_mode_names[]; -extern const unsigned int efx_loopback_mode_max; +extern const char *const efx_siena_loopback_mode_names[]; +extern const unsigned int efx_siena_loopback_mode_max; #define LOOPBACK_MODE(efx) \ - STRING_TABLE_LOOKUP((efx)->loopback_mode, efx_loopback_mode) + STRING_TABLE_LOOKUP((efx)->loopback_mode, efx_siena_loopback_mode) enum efx_int_mode { /* Be careful if altering to correct macro below */ diff --git a/drivers/net/ethernet/sfc/siena/ptp.c b/drivers/net/ethernet/sfc/siena/ptp.c index daf23070d353..b67417063a80 100644 --- a/drivers/net/ethernet/sfc/siena/ptp.c +++ b/drivers/net/ethernet/sfc/siena/ptp.c @@ -355,7 +355,7 @@ static int efx_phc_settime(struct ptp_clock_info *ptp, static int efx_phc_enable(struct ptp_clock_info *ptp, struct ptp_clock_request *request, int on); -bool efx_ptp_use_mac_tx_timestamps(struct efx_nic *efx) +bool efx_siena_ptp_use_mac_tx_timestamps(struct efx_nic *efx) { return efx_has_cap(efx, TX_MAC_TIMESTAMPING); } @@ -365,7 +365,7 @@ bool efx_ptp_use_mac_tx_timestamps(struct efx_nic *efx) */ static bool efx_ptp_want_txqs(struct efx_channel *channel) { - return efx_ptp_use_mac_tx_timestamps(channel->efx); + return efx_siena_ptp_use_mac_tx_timestamps(channel->efx); } #define PTP_SW_STAT(ext_name, field_name) \ @@ -393,7 +393,7 @@ static const unsigned long efx_ptp_stat_mask[] = { [0 ... BITS_TO_LONGS(PTP_STAT_COUNT) - 1] = ~0UL, }; -size_t efx_ptp_describe_stats(struct efx_nic *efx, u8 *strings) +size_t efx_siena_ptp_describe_stats(struct efx_nic *efx, u8 *strings) { if (!efx->ptp_data) return 0; @@ -402,7 +402,7 @@ size_t efx_ptp_describe_stats(struct efx_nic *efx, u8 *strings) efx_ptp_stat_mask, strings); } -size_t efx_ptp_update_stats(struct efx_nic *efx, u64 *stats) +size_t efx_siena_ptp_update_stats(struct efx_nic *efx, u64 *stats) { MCDI_DECLARE_BUF(inbuf, MC_CMD_PTP_IN_STATUS_LEN); MCDI_DECLARE_BUF(outbuf, MC_CMD_PTP_OUT_STATUS_LEN); @@ -536,14 +536,14 @@ static ktime_t efx_ptp_s_qns_to_ktime_correction(u32 nic_major, u32 nic_minor, return kt; } -struct efx_channel *efx_ptp_channel(struct efx_nic *efx) +struct efx_channel *efx_siena_ptp_channel(struct efx_nic *efx) { return efx->ptp_data ? efx->ptp_data->channel : NULL; } static u32 last_sync_timestamp_major(struct efx_nic *efx) { - struct efx_channel *channel = efx_ptp_channel(efx); + struct efx_channel *channel = efx_siena_ptp_channel(efx); u32 major = 0; if (channel) @@ -606,13 +606,13 @@ efx_ptp_mac_nic_to_ktime_correction(struct efx_nic *efx, return kt; } -ktime_t efx_ptp_nic_to_kernel_time(struct efx_tx_queue *tx_queue) +ktime_t efx_siena_ptp_nic_to_kernel_time(struct efx_tx_queue *tx_queue) { struct efx_nic *efx = tx_queue->efx; struct efx_ptp_data *ptp = efx->ptp_data; ktime_t kt; - if (efx_ptp_use_mac_tx_timestamps(efx)) + if (efx_siena_ptp_use_mac_tx_timestamps(efx)) kt = efx_ptp_mac_nic_to_ktime_correction(efx, ptp, tx_queue->completed_timestamp_major, tx_queue->completed_timestamp_minor, @@ -1437,7 +1437,7 @@ static const struct ptp_clock_info efx_phc_clock_info = { }; /* Initialise PTP state. */ -int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel) +static int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel) { struct efx_ptp_data *ptp; int rc = 0; @@ -1464,7 +1464,7 @@ int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel) goto fail2; } - if (efx_ptp_use_mac_tx_timestamps(efx)) { + if (efx_siena_ptp_use_mac_tx_timestamps(efx)) { ptp->xmit_skb = efx_ptp_xmit_skb_queue; /* Request sync events on this channel. */ channel->sync_events_state = SYNC_EVENTS_QUIESCENT; @@ -1553,7 +1553,7 @@ static int efx_ptp_probe_channel(struct efx_channel *channel) return 0; } -void efx_ptp_remove(struct efx_nic *efx) +static void efx_ptp_remove(struct efx_nic *efx) { if (!efx->ptp_data) return; @@ -1593,7 +1593,7 @@ static void efx_ptp_get_channel_name(struct efx_channel *channel, /* Determine whether this packet should be processed by the PTP module * or transmitted conventionally. */ -bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb) +bool efx_siena_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb) { return efx->ptp_data && efx->ptp_data->enabled && @@ -1699,7 +1699,7 @@ static bool efx_ptp_rx(struct efx_channel *channel, struct sk_buff *skb) * itself, through an MCDI call. MCDI calls aren't permitted * in the transmit path so defer the actual transmission to a suitable worker. */ -int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb) +int efx_siena_ptp_tx(struct efx_nic *efx, struct sk_buff *skb) { struct efx_ptp_data *ptp = efx->ptp_data; @@ -1713,13 +1713,13 @@ int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb) return NETDEV_TX_OK; } -int efx_ptp_get_mode(struct efx_nic *efx) +int efx_siena_ptp_get_mode(struct efx_nic *efx) { return efx->ptp_data->mode; } -int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted, - unsigned int new_mode) +int efx_siena_ptp_change_mode(struct efx_nic *efx, bool enable_wanted, + unsigned int new_mode) { if ((enable_wanted != efx->ptp_data->enabled) || (enable_wanted && (efx->ptp_data->mode != new_mode))) { @@ -1777,7 +1777,8 @@ static int efx_ptp_ts_init(struct efx_nic *efx, struct hwtstamp_config *init) return 0; } -void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info) +void efx_siena_ptp_get_ts_info(struct efx_nic *efx, + struct ethtool_ts_info *ts_info) { struct efx_ptp_data *ptp = efx->ptp_data; struct efx_nic *primary = efx->primary; @@ -1797,7 +1798,7 @@ void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info) ts_info->rx_filters = ptp->efx->type->hwtstamp_filters; } -int efx_ptp_set_ts_config(struct efx_nic *efx, struct ifreq *ifr) +int efx_siena_ptp_set_ts_config(struct efx_nic *efx, struct ifreq *ifr) { struct hwtstamp_config config; int rc; @@ -1817,7 +1818,7 @@ int efx_ptp_set_ts_config(struct efx_nic *efx, struct ifreq *ifr) ? -EFAULT : 0; } -int efx_ptp_get_ts_config(struct efx_nic *efx, struct ifreq *ifr) +int efx_siena_ptp_get_ts_config(struct efx_nic *efx, struct ifreq *ifr) { if (!efx->ptp_data) return -EOPNOTSUPP; @@ -1898,7 +1899,7 @@ static void ptp_event_pps(struct efx_nic *efx, struct efx_ptp_data *ptp) queue_work(ptp->pps_workwq, &ptp->pps_work); } -void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev) +void efx_siena_ptp_event(struct efx_nic *efx, efx_qword_t *ev) { struct efx_ptp_data *ptp = efx->ptp_data; int code = EFX_QWORD_FIELD(*ev, MCDI_EVENT_CODE); @@ -1949,7 +1950,7 @@ void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev) } } -void efx_time_sync_event(struct efx_channel *channel, efx_qword_t *ev) +void efx_siena_time_sync_event(struct efx_channel *channel, efx_qword_t *ev) { struct efx_nic *efx = channel->efx; struct efx_ptp_data *ptp = efx->ptp_data; @@ -1985,8 +1986,8 @@ static inline u32 efx_rx_buf_timestamp_minor(struct efx_nic *efx, const u8 *eh) #endif } -void __efx_rx_skb_attach_timestamp(struct efx_channel *channel, - struct sk_buff *skb) +void __efx_siena_rx_skb_attach_timestamp(struct efx_channel *channel, + struct sk_buff *skb) { struct efx_nic *efx = channel->efx; struct efx_ptp_data *ptp = efx->ptp_data; @@ -2171,7 +2172,7 @@ static const struct efx_channel_type efx_ptp_channel_type = { .keep_eventq = false, }; -void efx_ptp_defer_probe_with_channel(struct efx_nic *efx) +void efx_siena_ptp_defer_probe_with_channel(struct efx_nic *efx) { /* Check whether PTP is implemented on this NIC. The DISABLE * operation will succeed if and only if it is implemented. @@ -2181,7 +2182,7 @@ void efx_ptp_defer_probe_with_channel(struct efx_nic *efx) &efx_ptp_channel_type; } -void efx_ptp_start_datapath(struct efx_nic *efx) +void efx_siena_ptp_start_datapath(struct efx_nic *efx) { if (efx_ptp_restart(efx)) netif_err(efx, drv, efx->net_dev, "Failed to restart PTP.\n"); @@ -2190,7 +2191,7 @@ void efx_ptp_start_datapath(struct efx_nic *efx) efx->type->ptp_set_ts_sync_events(efx, true, true); } -void efx_ptp_stop_datapath(struct efx_nic *efx) +void efx_siena_ptp_stop_datapath(struct efx_nic *efx) { /* temporarily disable timestamping */ if (efx->type->ptp_set_ts_sync_events) diff --git a/drivers/net/ethernet/sfc/siena/ptp.h b/drivers/net/ethernet/sfc/siena/ptp.h index 9855e8c9e544..4172f90e9f6f 100644 --- a/drivers/net/ethernet/sfc/siena/ptp.h +++ b/drivers/net/ethernet/sfc/siena/ptp.h @@ -13,33 +13,33 @@ #include "net_driver.h" struct ethtool_ts_info; -int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel); -void efx_ptp_defer_probe_with_channel(struct efx_nic *efx); -struct efx_channel *efx_ptp_channel(struct efx_nic *efx); -void efx_ptp_remove(struct efx_nic *efx); -int efx_ptp_set_ts_config(struct efx_nic *efx, struct ifreq *ifr); -int efx_ptp_get_ts_config(struct efx_nic *efx, struct ifreq *ifr); -void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info); -bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); -int efx_ptp_get_mode(struct efx_nic *efx); -int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted, - unsigned int new_mode); -int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); -void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev); -size_t efx_ptp_describe_stats(struct efx_nic *efx, u8 *strings); -size_t efx_ptp_update_stats(struct efx_nic *efx, u64 *stats); -void efx_time_sync_event(struct efx_channel *channel, efx_qword_t *ev); -void __efx_rx_skb_attach_timestamp(struct efx_channel *channel, - struct sk_buff *skb); +void efx_siena_ptp_defer_probe_with_channel(struct efx_nic *efx); +struct efx_channel *efx_siena_ptp_channel(struct efx_nic *efx); +int efx_siena_ptp_set_ts_config(struct efx_nic *efx, struct ifreq *ifr); +int efx_siena_ptp_get_ts_config(struct efx_nic *efx, struct ifreq *ifr); +void efx_siena_ptp_get_ts_info(struct efx_nic *efx, + struct ethtool_ts_info *ts_info); +bool efx_siena_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); +int efx_siena_ptp_get_mode(struct efx_nic *efx); +int efx_siena_ptp_change_mode(struct efx_nic *efx, bool enable_wanted, + unsigned int new_mode); +int efx_siena_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); +void efx_siena_ptp_event(struct efx_nic *efx, efx_qword_t *ev); +size_t efx_siena_ptp_describe_stats(struct efx_nic *efx, u8 *strings); +size_t efx_siena_ptp_update_stats(struct efx_nic *efx, u64 *stats); +void efx_siena_time_sync_event(struct efx_channel *channel, efx_qword_t *ev); +void __efx_siena_rx_skb_attach_timestamp(struct efx_channel *channel, + struct sk_buff *skb); static inline void efx_rx_skb_attach_timestamp(struct efx_channel *channel, struct sk_buff *skb) { if (channel->sync_events_state == SYNC_EVENTS_VALID) - __efx_rx_skb_attach_timestamp(channel, skb); + __efx_siena_rx_skb_attach_timestamp(channel, skb); } -void efx_ptp_start_datapath(struct efx_nic *efx); -void efx_ptp_stop_datapath(struct efx_nic *efx); -bool efx_ptp_use_mac_tx_timestamps(struct efx_nic *efx); -ktime_t efx_ptp_nic_to_kernel_time(struct efx_tx_queue *tx_queue); + +void efx_siena_ptp_start_datapath(struct efx_nic *efx); +void efx_siena_ptp_stop_datapath(struct efx_nic *efx); +bool efx_siena_ptp_use_mac_tx_timestamps(struct efx_nic *efx); +ktime_t efx_siena_ptp_nic_to_kernel_time(struct efx_tx_queue *tx_queue); #endif /* EFX_PTP_H */ diff --git a/drivers/net/ethernet/sfc/siena/rx.c b/drivers/net/ethernet/sfc/siena/rx.c index 47c09b93f7c4..98d3c0743c0f 100644 --- a/drivers/net/ethernet/sfc/siena/rx.c +++ b/drivers/net/ethernet/sfc/siena/rx.c @@ -377,7 +377,7 @@ void __efx_siena_rx_packet(struct efx_channel *channel) if (unlikely(efx->loopback_selftest)) { struct efx_rx_queue *rx_queue; - efx_loopback_rx_packet(efx, eh, rx_buf->len); + efx_siena_loopback_rx_packet(efx, eh, rx_buf->len); rx_queue = efx_channel_get_rx_queue(channel); efx_siena_free_rx_buffers(rx_queue, rx_buf, channel->rx_pkt_n_frags); diff --git a/drivers/net/ethernet/sfc/siena/selftest.c b/drivers/net/ethernet/sfc/siena/selftest.c index 7e24329bc005..83bd27df30d4 100644 --- a/drivers/net/ethernet/sfc/siena/selftest.c +++ b/drivers/net/ethernet/sfc/siena/selftest.c @@ -69,7 +69,7 @@ static const char *const efx_siena_interrupt_mode_names[] = { /** * struct efx_loopback_state - persistent state during a loopback selftest - * @flush: Drop all packets in efx_loopback_rx_packet + * @flush: Drop all packets in efx_siena_loopback_rx_packet * @packet_count: Number of packets being used in this test * @skbs: An array of skbs transmitted * @offload_csum: Checksums are being offloaded @@ -278,8 +278,8 @@ static int efx_test_phy(struct efx_nic *efx, struct efx_self_tests *tests, /* Loopback test RX callback * This is called for each received packet during loopback testing. */ -void efx_loopback_rx_packet(struct efx_nic *efx, - const char *buf_ptr, int pkt_len) +void efx_siena_loopback_rx_packet(struct efx_nic *efx, + const char *buf_ptr, int pkt_len) { struct efx_loopback_state *state = efx->loopback_selftest; struct efx_loopback_payload *received; @@ -369,7 +369,7 @@ void efx_loopback_rx_packet(struct efx_nic *efx, atomic_inc(&state->rx_bad); } -/* Initialise an efx_selftest_state for a new iteration */ +/* Initialise an efx_siena_selftest_state for a new iteration */ static void efx_iterate_state(struct efx_nic *efx) { struct efx_loopback_state *state = efx->loopback_selftest; @@ -684,14 +684,14 @@ static int efx_test_loopbacks(struct efx_nic *efx, struct efx_self_tests *tests, * *************************************************************************/ -int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, - unsigned flags) +int efx_siena_selftest(struct efx_nic *efx, struct efx_self_tests *tests, + unsigned int flags) { enum efx_loopback_mode loopback_mode = efx->loopback_mode; int phy_mode = efx->phy_mode; int rc_test = 0, rc_reset, rc; - efx_selftest_async_cancel(efx); + efx_siena_selftest_async_cancel(efx); /* Online (i.e. non-disruptive) testing * This checks interrupt generation, event delivery and PHY presence. */ @@ -767,7 +767,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, return rc_test; } -void efx_selftest_async_start(struct efx_nic *efx) +void efx_siena_selftest_async_start(struct efx_nic *efx) { struct efx_channel *channel; @@ -776,12 +776,12 @@ void efx_selftest_async_start(struct efx_nic *efx) schedule_delayed_work(&efx->selftest_work, IRQ_TIMEOUT); } -void efx_selftest_async_cancel(struct efx_nic *efx) +void efx_siena_selftest_async_cancel(struct efx_nic *efx) { cancel_delayed_work_sync(&efx->selftest_work); } -static void efx_selftest_async_work(struct work_struct *data) +static void efx_siena_selftest_async_work(struct work_struct *data) { struct efx_nic *efx = container_of(data, struct efx_nic, selftest_work.work); @@ -801,7 +801,7 @@ static void efx_selftest_async_work(struct work_struct *data) } } -void efx_selftest_async_init(struct efx_nic *efx) +void efx_siena_selftest_async_init(struct efx_nic *efx) { - INIT_DELAYED_WORK(&efx->selftest_work, efx_selftest_async_work); + INIT_DELAYED_WORK(&efx->selftest_work, efx_siena_selftest_async_work); } diff --git a/drivers/net/ethernet/sfc/siena/selftest.h b/drivers/net/ethernet/sfc/siena/selftest.h index a23f085bf298..6af6e7fbfcee 100644 --- a/drivers/net/ethernet/sfc/siena/selftest.h +++ b/drivers/net/ethernet/sfc/siena/selftest.h @@ -41,12 +41,12 @@ struct efx_self_tests { struct efx_loopback_self_tests loopback[LOOPBACK_TEST_MAX + 1]; }; -void efx_loopback_rx_packet(struct efx_nic *efx, const char *buf_ptr, - int pkt_len); -int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, - unsigned flags); -void efx_selftest_async_init(struct efx_nic *efx); -void efx_selftest_async_start(struct efx_nic *efx); -void efx_selftest_async_cancel(struct efx_nic *efx); +void efx_siena_loopback_rx_packet(struct efx_nic *efx, const char *buf_ptr, + int pkt_len); +int efx_siena_selftest(struct efx_nic *efx, struct efx_self_tests *tests, + unsigned int flags); +void efx_siena_selftest_async_init(struct efx_nic *efx); +void efx_siena_selftest_async_start(struct efx_nic *efx); +void efx_siena_selftest_async_cancel(struct efx_nic *efx); #endif /* EFX_SELFTEST_H */ diff --git a/drivers/net/ethernet/sfc/siena/siena.c b/drivers/net/ethernet/sfc/siena/siena.c index 726dd4b72779..d70e481d0c73 100644 --- a/drivers/net/ethernet/sfc/siena/siena.c +++ b/drivers/net/ethernet/sfc/siena/siena.c @@ -143,27 +143,28 @@ static int siena_ptp_set_ts_config(struct efx_nic *efx, switch (init->rx_filter) { case HWTSTAMP_FILTER_NONE: /* if TX timestamping is still requested then leave PTP on */ - return efx_ptp_change_mode(efx, - init->tx_type != HWTSTAMP_TX_OFF, - efx_ptp_get_mode(efx)); + return efx_siena_ptp_change_mode(efx, + init->tx_type != HWTSTAMP_TX_OFF, + efx_siena_ptp_get_mode(efx)); case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: init->rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; - return efx_ptp_change_mode(efx, true, MC_CMD_PTP_MODE_V1); + return efx_siena_ptp_change_mode(efx, true, MC_CMD_PTP_MODE_V1); case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: init->rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT; - rc = efx_ptp_change_mode(efx, true, - MC_CMD_PTP_MODE_V2_ENHANCED); + rc = efx_siena_ptp_change_mode(efx, true, + MC_CMD_PTP_MODE_V2_ENHANCED); /* bug 33070 - old versions of the firmware do not support the * improved UUID filtering option. Similarly old versions of the * application do not expect it to be enabled. If the firmware * does not accept the enhanced mode, fall back to the standard * PTP v2 UUID filtering. */ if (rc != 0) - rc = efx_ptp_change_mode(efx, true, MC_CMD_PTP_MODE_V2); + rc = efx_siena_ptp_change_mode(efx, true, + MC_CMD_PTP_MODE_V2); return rc; default: return -ERANGE; @@ -329,7 +330,7 @@ static int siena_probe_nic(struct efx_nic *efx) #ifdef CONFIG_SFC_SRIOV efx_siena_sriov_probe(efx); #endif - efx_ptp_defer_probe_with_channel(efx); + efx_siena_ptp_defer_probe_with_channel(efx); return 0; diff --git a/drivers/net/ethernet/sfc/siena/tx.c b/drivers/net/ethernet/sfc/siena/tx.c index 0677a0254d85..ef238e9efa94 100644 --- a/drivers/net/ethernet/sfc/siena/tx.c +++ b/drivers/net/ethernet/sfc/siena/tx.c @@ -321,14 +321,14 @@ netdev_tx_t efx_siena_hard_start_xmit(struct sk_buff *skb, /* PTP "event" packet */ if (unlikely(efx_xmit_with_hwtstamp(skb)) && - ((efx_ptp_use_mac_tx_timestamps(efx) && efx->ptp_data) || - unlikely(efx_ptp_is_ptp_tx(efx, skb)))) { + ((efx_siena_ptp_use_mac_tx_timestamps(efx) && efx->ptp_data) || + unlikely(efx_siena_ptp_is_ptp_tx(efx, skb)))) { /* There may be existing transmits on the channel that are * waiting for this packet to trigger the doorbell write. * We need to send the packets at this point. */ efx_tx_send_pending(efx_get_tx_channel(efx, index)); - return efx_ptp_tx(efx, skb); + return efx_siena_ptp_tx(efx, skb); } tx_queue = efx_get_tx_queue(efx, index, type); diff --git a/drivers/net/ethernet/sfc/siena/tx_common.c b/drivers/net/ethernet/sfc/siena/tx_common.c index 66adc8525a3a..31e9888e71df 100644 --- a/drivers/net/ethernet/sfc/siena/tx_common.c +++ b/drivers/net/ethernet/sfc/siena/tx_common.c @@ -80,8 +80,8 @@ void efx_siena_init_tx_queue(struct efx_tx_queue *tx_queue) tx_queue->old_read_count = 0; tx_queue->empty_read_count = 0 | EFX_EMPTY_COUNT_VALID; tx_queue->xmit_pending = false; - tx_queue->timestamping = (efx_ptp_use_mac_tx_timestamps(efx) && - tx_queue->channel == efx_ptp_channel(efx)); + tx_queue->timestamping = (efx_siena_ptp_use_mac_tx_timestamps(efx) && + tx_queue->channel == efx_siena_ptp_channel(efx)); tx_queue->completed_timestamp_major = 0; tx_queue->completed_timestamp_minor = 0; @@ -148,7 +148,7 @@ static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue, struct skb_shared_hwtstamps hwtstamp; hwtstamp.hwtstamp = - efx_ptp_nic_to_kernel_time(tx_queue); + efx_siena_ptp_nic_to_kernel_time(tx_queue); skb_tstamp_tx(skb, &hwtstamp); tx_queue->completed_timestamp_major = 0; From patchwork Mon May 9 15:32:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Habets X-Patchwork-Id: 12843799 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 8C8A8C433EF for ; Mon, 9 May 2022 15:33:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238482AbiEIPhR (ORCPT ); Mon, 9 May 2022 11:37:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238429AbiEIPhF (ORCPT ); Mon, 9 May 2022 11:37:05 -0400 Received: from mint-fitpc2.mph.net (unknown [81.168.73.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D2969230213 for ; Mon, 9 May 2022 08:32:46 -0700 (PDT) Received: from palantir17.mph.net (unknown [192.168.0.4]) by mint-fitpc2.mph.net (Postfix) with ESMTP id DFCE73200F2; Mon, 9 May 2022 16:32:45 +0100 (BST) Received: from localhost ([::1] helo=palantir17.mph.net) by palantir17.mph.net with esmtp (Exim 4.89) (envelope-from ) id 1no5NN-0001RM-Lp; Mon, 09 May 2022 16:32:45 +0100 Subject: [PATCH net-next v4 08/11] sfc/siena: Rename functions in mcdi headers to avoid conflicts with sfc From: Martin Habets To: kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, ecree.xilinx@gmail.com Date: Mon, 09 May 2022 16:32:45 +0100 Message-ID: <165211036534.5289.1211071428299099655.stgit@palantir17.mph.net> In-Reply-To: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> References: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org For siena use efx_siena_ as the function prefix. Several functions are not used in Siena, so they are removed. Signed-off-by: Martin Habets --- drivers/net/ethernet/sfc/siena/efx.c | 6 drivers/net/ethernet/sfc/siena/efx_channels.c | 6 drivers/net/ethernet/sfc/siena/efx_common.c | 10 - drivers/net/ethernet/sfc/siena/ethtool.c | 2 drivers/net/ethernet/sfc/siena/ethtool_common.c | 20 + drivers/net/ethernet/sfc/siena/farch.c | 4 drivers/net/ethernet/sfc/siena/mcdi.c | 410 ++++++++------------- drivers/net/ethernet/sfc/siena/mcdi.h | 134 +++---- drivers/net/ethernet/sfc/siena/mcdi_mon.c | 25 + drivers/net/ethernet/sfc/siena/mcdi_port.c | 33 +- drivers/net/ethernet/sfc/siena/mcdi_port.h | 7 drivers/net/ethernet/sfc/siena/mcdi_port_common.c | 174 ++++----- drivers/net/ethernet/sfc/siena/mcdi_port_common.h | 61 +-- drivers/net/ethernet/sfc/siena/ptp.c | 70 ++-- drivers/net/ethernet/sfc/siena/selftest.c | 4 drivers/net/ethernet/sfc/siena/siena.c | 93 ++--- drivers/net/ethernet/sfc/siena/siena_sriov.c | 9 17 files changed, 459 insertions(+), 609 deletions(-) diff --git a/drivers/net/ethernet/sfc/siena/efx.c b/drivers/net/ethernet/sfc/siena/efx.c index 3b79c39300a4..1bc5ee6220f0 100644 --- a/drivers/net/ethernet/sfc/siena/efx.c +++ b/drivers/net/ethernet/sfc/siena/efx.c @@ -153,7 +153,7 @@ static int efx_init_port(struct efx_nic *efx) efx->port_initialized = true; /* Ensure the PHY advertises the correct flow control settings */ - rc = efx_mcdi_port_reconfigure(efx); + rc = efx_siena_mcdi_port_reconfigure(efx); if (rc && rc != -EPERM) goto fail; @@ -526,7 +526,7 @@ static int efx_net_open(struct net_device *net_dev) return rc; if (efx->phy_mode & PHY_MODE_SPECIAL) return -EBUSY; - if (efx_mcdi_poll_reboot(efx) && efx_siena_reset(efx, RESET_TYPE_ALL)) + if (efx_siena_mcdi_poll_reboot(efx) && efx_siena_reset(efx, RESET_TYPE_ALL)) return -EIO; /* Notify the kernel of the link state polled during driver load, @@ -1158,7 +1158,7 @@ static int efx_pm_thaw(struct device *dev) goto fail; mutex_lock(&efx->mac_lock); - efx_mcdi_port_reconfigure(efx); + efx_siena_mcdi_port_reconfigure(efx); mutex_unlock(&efx->mac_lock); efx_siena_start_all(efx); diff --git a/drivers/net/ethernet/sfc/siena/efx_channels.c b/drivers/net/ethernet/sfc/siena/efx_channels.c index 799c0a90358c..276cd7d88732 100644 --- a/drivers/net/ethernet/sfc/siena/efx_channels.c +++ b/drivers/net/ethernet/sfc/siena/efx_channels.c @@ -1022,7 +1022,7 @@ static int efx_soft_enable_interrupts(struct efx_nic *efx) efx_siena_start_eventq(channel); } - efx_mcdi_mode_event(efx); + efx_siena_mcdi_mode_event(efx); return 0; fail: @@ -1045,7 +1045,7 @@ static void efx_soft_disable_interrupts(struct efx_nic *efx) if (efx->state == STATE_DISABLED) return; - efx_mcdi_mode_poll(efx); + efx_siena_mcdi_mode_poll(efx); efx->irq_soft_enabled = false; smp_wmb(); @@ -1063,7 +1063,7 @@ static void efx_soft_disable_interrupts(struct efx_nic *efx) } /* Flush the asynchronous MCDI request queue */ - efx_mcdi_flush_async(efx); + efx_siena_mcdi_flush_async(efx); } int efx_siena_enable_interrupts(struct efx_nic *efx) diff --git a/drivers/net/ethernet/sfc/siena/efx_common.c b/drivers/net/ethernet/sfc/siena/efx_common.c index 6b524775c929..3293221b9e9e 100644 --- a/drivers/net/ethernet/sfc/siena/efx_common.c +++ b/drivers/net/ethernet/sfc/siena/efx_common.c @@ -456,7 +456,7 @@ static void efx_stop_datapath(struct efx_nic *efx) * **************************************************************************/ -/* Equivalent to efx_link_set_advertising with all-zeroes, except does not +/* Equivalent to efx_siena_link_set_advertising with all-zeroes, except does not * force the Autoneg bit on. */ void efx_siena_link_clear_advertising(struct efx_nic *efx) @@ -547,7 +547,7 @@ void efx_siena_start_all(struct efx_nic *efx) * to poll now because we could have missed a change */ mutex_lock(&efx->mac_lock); - if (efx_mcdi_phy_poll(efx)) + if (efx_siena_mcdi_phy_poll(efx)) efx_siena_link_status_changed(efx); mutex_unlock(&efx->mac_lock); @@ -665,7 +665,7 @@ static void efx_wait_for_bist_end(struct efx_nic *efx) int i; for (i = 0; i < BIST_WAIT_DELAY_COUNT; ++i) { - if (efx_mcdi_poll_reboot(efx)) + if (efx_siena_mcdi_poll_reboot(efx)) goto out; msleep(BIST_WAIT_DELAY_MS); } @@ -760,7 +760,7 @@ int efx_siena_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) if (efx->port_initialized && method != RESET_TYPE_INVISIBLE && method != RESET_TYPE_DATAPATH) { - rc = efx_mcdi_port_reconfigure(efx); + rc = efx_siena_mcdi_port_reconfigure(efx); if (rc && rc != -EPERM) netif_err(efx, drv, efx->net_dev, "could not restore PHY settings\n"); @@ -950,7 +950,7 @@ void efx_siena_schedule_reset(struct efx_nic *efx, enum reset_type type) /* efx_process_channel() will no longer read events once a * reset is scheduled. So switch back to poll'd MCDI completions. */ - efx_mcdi_mode_poll(efx); + efx_siena_mcdi_mode_poll(efx); efx_siena_queue_reset_work(efx); } diff --git a/drivers/net/ethernet/sfc/siena/ethtool.c b/drivers/net/ethernet/sfc/siena/ethtool.c index 63388bec421d..5ee626ba4eb1 100644 --- a/drivers/net/ethernet/sfc/siena/ethtool.c +++ b/drivers/net/ethernet/sfc/siena/ethtool.c @@ -50,7 +50,7 @@ static int efx_ethtool_phys_id(struct net_device *net_dev, return 1; /* cycle on/off once per second */ } - return efx_mcdi_set_id_led(efx, mode); + return efx_siena_mcdi_set_id_led(efx, mode); } static int efx_ethtool_get_regs_len(struct net_device *net_dev) diff --git a/drivers/net/ethernet/sfc/siena/ethtool_common.c b/drivers/net/ethernet/sfc/siena/ethtool_common.c index 91f750e4ede8..0207d07f54e3 100644 --- a/drivers/net/ethernet/sfc/siena/ethtool_common.c +++ b/drivers/net/ethernet/sfc/siena/ethtool_common.c @@ -106,8 +106,8 @@ void efx_siena_ethtool_get_drvinfo(struct net_device *net_dev, struct efx_nic *efx = netdev_priv(net_dev); strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); - efx_mcdi_print_fwver(efx, info->fw_version, - sizeof(info->fw_version)); + efx_siena_mcdi_print_fwver(efx, info->fw_version, + sizeof(info->fw_version)); strlcpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info)); } @@ -173,7 +173,7 @@ int efx_siena_ethtool_set_pauseparam(struct net_device *net_dev, efx_siena_link_set_wanted_fc(efx, wanted_fc); if (efx->link_advertising[0] != old_adv || (efx->wanted_fc ^ old_fc) & EFX_FC_AUTO) { - rc = efx_mcdi_port_reconfigure(efx); + rc = efx_siena_mcdi_port_reconfigure(efx); if (rc) { netif_err(efx, drv, efx->net_dev, "Unable to advertise requested flow " @@ -328,7 +328,7 @@ static int efx_ethtool_fill_self_tests(struct efx_nic *efx, const char *name; EFX_WARN_ON_PARANOID(i >= EFX_MAX_PHY_TESTS); - name = efx_mcdi_phy_test_name(efx, i); + name = efx_siena_mcdi_phy_test_name(efx, i); if (name == NULL) break; @@ -565,7 +565,7 @@ int efx_siena_ethtool_get_link_ksettings(struct net_device *net_dev, struct efx_link_state *link_state = &efx->link_state; mutex_lock(&efx->mac_lock); - efx_mcdi_phy_get_link_ksettings(efx, cmd); + efx_siena_mcdi_phy_get_link_ksettings(efx, cmd); mutex_unlock(&efx->mac_lock); /* Both MACs support pause frames (bidirectional and respond-only) */ @@ -597,7 +597,7 @@ efx_siena_ethtool_set_link_ksettings(struct net_device *net_dev, } mutex_lock(&efx->mac_lock); - rc = efx_mcdi_phy_set_link_ksettings(efx, cmd); + rc = efx_siena_mcdi_phy_set_link_ksettings(efx, cmd); mutex_unlock(&efx->mac_lock); return rc; } @@ -609,7 +609,7 @@ int efx_siena_ethtool_get_fecparam(struct net_device *net_dev, int rc; mutex_lock(&efx->mac_lock); - rc = efx_mcdi_phy_get_fecparam(efx, fecparam); + rc = efx_siena_mcdi_phy_get_fecparam(efx, fecparam); mutex_unlock(&efx->mac_lock); return rc; @@ -622,7 +622,7 @@ int efx_siena_ethtool_set_fecparam(struct net_device *net_dev, int rc; mutex_lock(&efx->mac_lock); - rc = efx_mcdi_phy_set_fecparam(efx, fecparam); + rc = efx_siena_mcdi_phy_set_fecparam(efx, fecparam); mutex_unlock(&efx->mac_lock); return rc; @@ -1320,7 +1320,7 @@ int efx_siena_ethtool_get_module_eeprom(struct net_device *net_dev, int ret; mutex_lock(&efx->mac_lock); - ret = efx_mcdi_phy_get_module_eeprom(efx, ee, data); + ret = efx_siena_mcdi_phy_get_module_eeprom(efx, ee, data); mutex_unlock(&efx->mac_lock); return ret; @@ -1333,7 +1333,7 @@ int efx_siena_ethtool_get_module_info(struct net_device *net_dev, int ret; mutex_lock(&efx->mac_lock); - ret = efx_mcdi_phy_get_module_info(efx, modinfo); + ret = efx_siena_mcdi_phy_get_module_info(efx, modinfo); mutex_unlock(&efx->mac_lock); return ret; diff --git a/drivers/net/ethernet/sfc/siena/farch.c b/drivers/net/ethernet/sfc/siena/farch.c index 4de36c6c28e1..ebd6fa408126 100644 --- a/drivers/net/ethernet/sfc/siena/farch.c +++ b/drivers/net/ethernet/sfc/siena/farch.c @@ -667,7 +667,7 @@ static int efx_farch_do_flush(struct efx_nic *efx) * completion). If that fails, fall back to the old scheme. */ if (efx_siena_sriov_enabled(efx)) { - rc = efx_mcdi_flush_rxqs(efx); + rc = efx_siena_mcdi_flush_rxqs(efx); if (!rc) goto wait; } @@ -1313,7 +1313,7 @@ int efx_farch_ev_process(struct efx_channel *channel, int budget) break; #endif case FSE_CZ_EV_CODE_MCDI_EV: - efx_mcdi_process_event(channel, &event); + efx_siena_mcdi_process_event(channel, &event); break; case FSE_AZ_EV_CODE_GLOBAL_EV: if (efx->type->handle_global_event && diff --git a/drivers/net/ethernet/sfc/siena/mcdi.c b/drivers/net/ethernet/sfc/siena/mcdi.c index ff426b228cb2..eb13aa59fe50 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi.c +++ b/drivers/net/ethernet/sfc/siena/mcdi.c @@ -58,7 +58,7 @@ MODULE_PARM_DESC(mcdi_logging_default, "Enable MCDI logging on newly-probed functions"); #endif -int efx_mcdi_init(struct efx_nic *efx) +int efx_siena_mcdi_init(struct efx_nic *efx) { struct efx_mcdi_iface *mcdi; bool already_attached; @@ -86,11 +86,11 @@ int efx_mcdi_init(struct efx_nic *efx) INIT_LIST_HEAD(&mcdi->async_list); timer_setup(&mcdi->async_timer, efx_mcdi_timeout_async, 0); - (void) efx_mcdi_poll_reboot(efx); + (void)efx_siena_mcdi_poll_reboot(efx); mcdi->new_epoch = true; /* Recover from a failed assertion before probing */ - rc = efx_mcdi_handle_assertion(efx); + rc = efx_siena_mcdi_handle_assertion(efx); if (rc) goto fail2; @@ -124,7 +124,7 @@ int efx_mcdi_init(struct efx_nic *efx) return rc; } -void efx_mcdi_detach(struct efx_nic *efx) +void efx_siena_mcdi_detach(struct efx_nic *efx) { if (!efx->mcdi) return; @@ -135,7 +135,7 @@ void efx_mcdi_detach(struct efx_nic *efx) efx_mcdi_drv_attach(efx, false, NULL); } -void efx_mcdi_fini(struct efx_nic *efx) +void efx_siena_mcdi_fini(struct efx_nic *efx) { if (!efx->mcdi) return; @@ -360,7 +360,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) int rc; /* Check for a reboot atomically with respect to efx_mcdi_copyout() */ - rc = efx_mcdi_poll_reboot(efx); + rc = efx_siena_mcdi_poll_reboot(efx); if (rc) { spin_lock_bh(&mcdi->iface_lock); mcdi->resprc = rc; @@ -401,7 +401,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) /* Test and clear MC-rebooted flag for this port/function; reset * software state as necessary. */ -int efx_mcdi_poll_reboot(struct efx_nic *efx) +int efx_siena_mcdi_poll_reboot(struct efx_nic *efx) { if (!efx->mcdi) return 0; @@ -440,7 +440,7 @@ static int efx_mcdi_await_completion(struct efx_nic *efx) * completed the request first, then we'll just end up completing the * request again, which is safe. * - * We need an smp_rmb() to synchronise with efx_mcdi_mode_poll(), which + * We need an smp_rmb() to synchronise with efx_siena_mcdi_mode_poll(), which * wait_event_timeout() implicitly provides. */ if (mcdi->mode == MCDI_MODE_POLL) @@ -548,8 +548,8 @@ static bool efx_mcdi_complete_async(struct efx_mcdi_iface *mcdi, bool timeout) err_len = min(sizeof(errbuf), data_len); efx->type->mcdi_read_response(efx, errbuf, hdr_len, sizeof(errbuf)); - efx_mcdi_display_error(efx, async->cmd, async->inlen, errbuf, - err_len, rc); + efx_siena_mcdi_display_error(efx, async->cmd, async->inlen, + errbuf, err_len, rc); } if (async->complete) @@ -733,13 +733,13 @@ static int _efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned int cmd, mcdi->proxy_rx_handle = 0; mcdi->state = MCDI_STATE_PROXY_WAIT; } else if (rc && !quiet) { - efx_mcdi_display_error(efx, cmd, inlen, errbuf, err_len, - rc); + efx_siena_mcdi_display_error(efx, cmd, inlen, errbuf, + err_len, rc); } if (rc == -EIO || rc == -EINTR) { msleep(MCDI_STATUS_SLEEP_MS); - efx_mcdi_poll_reboot(efx); + efx_siena_mcdi_poll_reboot(efx); mcdi->new_epoch = true; } } @@ -813,7 +813,7 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd, return -EINVAL; } - rc = efx_mcdi_rpc_start(efx, cmd, inbuf, inlen); + rc = efx_siena_mcdi_rpc_start(efx, cmd, inbuf, inlen); if (rc) return rc; @@ -894,14 +894,14 @@ static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd, } if (rc && !quiet && !(cmd == MC_CMD_REBOOT && rc == -EIO)) - efx_mcdi_display_error(efx, cmd, inlen, - outbuf, outlen, rc); + efx_siena_mcdi_display_error(efx, cmd, inlen, + outbuf, outlen, rc); return rc; } /** - * efx_mcdi_rpc - Issue an MCDI command and wait for completion + * efx_siena_mcdi_rpc - Issue an MCDI command and wait for completion * @efx: NIC through which to issue the command * @cmd: Command type number * @inbuf: Command parameters @@ -924,34 +924,34 @@ static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd, * set accordingly. In the latter case, *@outlen_actual will be * set to zero. */ -int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, - const efx_dword_t *inbuf, size_t inlen, - efx_dword_t *outbuf, size_t outlen, - size_t *outlen_actual) +int efx_siena_mcdi_rpc(struct efx_nic *efx, unsigned int cmd, + const efx_dword_t *inbuf, size_t inlen, + efx_dword_t *outbuf, size_t outlen, + size_t *outlen_actual) { return _efx_mcdi_rpc_evb_retry(efx, cmd, inbuf, inlen, outbuf, outlen, outlen_actual, false); } /* Normally, on receiving an error code in the MCDI response, - * efx_mcdi_rpc will log an error message containing (among other - * things) the raw error code, by means of efx_mcdi_display_error. + * efx_siena_mcdi_rpc will log an error message containing (among other + * things) the raw error code, by means of efx_siena_mcdi_display_error. * This _quiet version suppresses that; if the caller wishes to log * the error conditionally on the return code, it should call this - * function and is then responsible for calling efx_mcdi_display_error + * function and is then responsible for calling efx_siena_mcdi_display_error * as needed. */ -int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd, - const efx_dword_t *inbuf, size_t inlen, - efx_dword_t *outbuf, size_t outlen, - size_t *outlen_actual) +int efx_siena_mcdi_rpc_quiet(struct efx_nic *efx, unsigned int cmd, + const efx_dword_t *inbuf, size_t inlen, + efx_dword_t *outbuf, size_t outlen, + size_t *outlen_actual) { return _efx_mcdi_rpc_evb_retry(efx, cmd, inbuf, inlen, outbuf, outlen, outlen_actual, true); } -int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd, - const efx_dword_t *inbuf, size_t inlen) +int efx_siena_mcdi_rpc_start(struct efx_nic *efx, unsigned int cmd, + const efx_dword_t *inbuf, size_t inlen) { struct efx_mcdi_iface *mcdi = efx_mcdi(efx); int rc; @@ -1026,7 +1026,7 @@ static int _efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd, } /** - * efx_mcdi_rpc_async - Schedule an MCDI command to run asynchronously + * efx_siena_mcdi_rpc_async - Schedule an MCDI command to run asynchronously * @efx: NIC through which to issue the command * @cmd: Command type number * @inbuf: Command parameters @@ -1046,42 +1046,44 @@ static int _efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd, * (c) the request times-out (in timer context) */ int -efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd, - const efx_dword_t *inbuf, size_t inlen, size_t outlen, - efx_mcdi_async_completer *complete, unsigned long cookie) +efx_siena_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd, + const efx_dword_t *inbuf, size_t inlen, size_t outlen, + efx_mcdi_async_completer *complete, + unsigned long cookie) { return _efx_mcdi_rpc_async(efx, cmd, inbuf, inlen, outlen, complete, cookie, false); } -int efx_mcdi_rpc_async_quiet(struct efx_nic *efx, unsigned int cmd, - const efx_dword_t *inbuf, size_t inlen, - size_t outlen, efx_mcdi_async_completer *complete, - unsigned long cookie) +int efx_siena_mcdi_rpc_async_quiet(struct efx_nic *efx, unsigned int cmd, + const efx_dword_t *inbuf, size_t inlen, + size_t outlen, + efx_mcdi_async_completer *complete, + unsigned long cookie) { return _efx_mcdi_rpc_async(efx, cmd, inbuf, inlen, outlen, complete, cookie, true); } -int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, - efx_dword_t *outbuf, size_t outlen, - size_t *outlen_actual) +int efx_siena_mcdi_rpc_finish(struct efx_nic *efx, unsigned int cmd, + size_t inlen, efx_dword_t *outbuf, size_t outlen, + size_t *outlen_actual) { return _efx_mcdi_rpc_finish(efx, cmd, inlen, outbuf, outlen, outlen_actual, false, NULL, NULL); } -int efx_mcdi_rpc_finish_quiet(struct efx_nic *efx, unsigned cmd, size_t inlen, - efx_dword_t *outbuf, size_t outlen, - size_t *outlen_actual) +int efx_siena_mcdi_rpc_finish_quiet(struct efx_nic *efx, unsigned int cmd, + size_t inlen, efx_dword_t *outbuf, + size_t outlen, size_t *outlen_actual) { return _efx_mcdi_rpc_finish(efx, cmd, inlen, outbuf, outlen, outlen_actual, true, NULL, NULL); } -void efx_mcdi_display_error(struct efx_nic *efx, unsigned cmd, - size_t inlen, efx_dword_t *outbuf, - size_t outlen, int rc) +void efx_siena_mcdi_display_error(struct efx_nic *efx, unsigned int cmd, + size_t inlen, efx_dword_t *outbuf, + size_t outlen, int rc) { int code = 0, err_arg = 0; @@ -1098,7 +1100,7 @@ void efx_mcdi_display_error(struct efx_nic *efx, unsigned cmd, * error conditions with various locks held, so it must be lockless. * Caller is responsible for flushing asynchronous requests later. */ -void efx_mcdi_mode_poll(struct efx_nic *efx) +void efx_siena_mcdi_mode_poll(struct efx_nic *efx) { struct efx_mcdi_iface *mcdi; @@ -1129,7 +1131,7 @@ void efx_mcdi_mode_poll(struct efx_nic *efx) /* Flush any running or queued asynchronous requests, after event processing * is stopped */ -void efx_mcdi_flush_async(struct efx_nic *efx) +void efx_siena_mcdi_flush_async(struct efx_nic *efx) { struct efx_mcdi_async_param *async, *next; struct efx_mcdi_iface *mcdi; @@ -1166,7 +1168,7 @@ void efx_mcdi_flush_async(struct efx_nic *efx) } } -void efx_mcdi_mode_event(struct efx_nic *efx) +void efx_siena_mcdi_mode_event(struct efx_nic *efx) { struct efx_mcdi_iface *mcdi; @@ -1185,7 +1187,7 @@ void efx_mcdi_mode_event(struct efx_nic *efx) * request, because the completion method is specified in the request. * So acquire the interface to serialise the requestors. We don't need * to acquire the iface_lock to change the mode here, but we do need a - * write memory barrier ensure that efx_mcdi_rpc() sees it, which + * write memory barrier ensure that efx_siena_mcdi_rpc() sees it, which * efx_mcdi_acquire() provides. */ efx_mcdi_acquire_sync(mcdi); @@ -1234,18 +1236,18 @@ static void efx_mcdi_ev_death(struct efx_nic *efx, int rc) } else { int count; - /* Consume the status word since efx_mcdi_rpc_finish() won't */ + /* Consume the status word since efx_siena_mcdi_rpc_finish() won't */ for (count = 0; count < MCDI_STATUS_DELAY_COUNT; ++count) { - rc = efx_mcdi_poll_reboot(efx); + rc = efx_siena_mcdi_poll_reboot(efx); if (rc) break; udelay(MCDI_STATUS_DELAY_US); } /* On EF10, a CODE_MC_REBOOT event can be received without the - * reboot detection in efx_mcdi_poll_reboot() being triggered. + * reboot detection in efx_siena_mcdi_poll_reboot() being triggered. * If zero was returned from the final call to - * efx_mcdi_poll_reboot(), the MC reboot wasn't noticed but the + * efx_siena_mcdi_poll_reboot(), the MC reboot wasn't noticed but the * MC has definitely rebooted so prepare for the reset. */ if (!rc && efx->type->mcdi_reboot_detected) @@ -1308,8 +1310,8 @@ static void efx_handle_drain_event(struct efx_nic *efx) } /* Called from efx_farch_ev_process and efx_ef10_ev_process for MCDI events */ -void efx_mcdi_process_event(struct efx_channel *channel, - efx_qword_t *event) +void efx_siena_mcdi_process_event(struct efx_channel *channel, + efx_qword_t *event) { struct efx_nic *efx = channel->efx; int code = EFX_QWORD_FIELD(*event, MCDI_EVENT_CODE); @@ -1334,7 +1336,7 @@ void efx_mcdi_process_event(struct efx_channel *channel, break; case MCDI_EVENT_CODE_LINKCHANGE: - efx_mcdi_process_link_change(efx, event); + efx_siena_mcdi_process_link_change(efx, event); break; case MCDI_EVENT_CODE_SENSOREVT: efx_sensor_event(efx, event); @@ -1408,7 +1410,7 @@ void efx_mcdi_process_event(struct efx_channel *channel, ************************************************************************** */ -void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len) +void efx_siena_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len) { MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_VERSION_OUT_LEN); size_t outlength; @@ -1417,8 +1419,8 @@ void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len) int rc; BUILD_BUG_ON(MC_CMD_GET_VERSION_IN_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_GET_VERSION, NULL, 0, - outbuf, sizeof(outbuf), &outlength); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_GET_VERSION, NULL, 0, + outbuf, sizeof(outbuf), &outlength); if (rc) goto fail; if (outlength < MC_CMD_GET_VERSION_OUT_LEN) { @@ -1464,8 +1466,9 @@ static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, MCDI_SET_DWORD(inbuf, DRV_ATTACH_IN_UPDATE, 1); MCDI_SET_DWORD(inbuf, DRV_ATTACH_IN_FIRMWARE_ID, MC_CMD_FW_LOW_LATENCY); - rc = efx_mcdi_rpc_quiet(efx, MC_CMD_DRV_ATTACH, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc_quiet(efx, MC_CMD_DRV_ATTACH, inbuf, + sizeof(inbuf), outbuf, sizeof(outbuf), + &outlen); /* If we're not the primary PF, trying to ATTACH with a FIRMWARE_ID * specified will fail with EPERM, and we have to tell the MC we don't * care what firmware we get. @@ -1475,13 +1478,13 @@ static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, "efx_mcdi_drv_attach with fw-variant setting failed EPERM, trying without it\n"); MCDI_SET_DWORD(inbuf, DRV_ATTACH_IN_FIRMWARE_ID, MC_CMD_FW_DONT_CARE); - rc = efx_mcdi_rpc_quiet(efx, MC_CMD_DRV_ATTACH, inbuf, - sizeof(inbuf), outbuf, sizeof(outbuf), - &outlen); + rc = efx_siena_mcdi_rpc_quiet(efx, MC_CMD_DRV_ATTACH, inbuf, + sizeof(inbuf), outbuf, + sizeof(outbuf), &outlen); } if (rc) { - efx_mcdi_display_error(efx, MC_CMD_DRV_ATTACH, sizeof(inbuf), - outbuf, outlen, rc); + efx_siena_mcdi_display_error(efx, MC_CMD_DRV_ATTACH, + sizeof(inbuf), outbuf, outlen, rc); goto fail; } if (outlen < MC_CMD_DRV_ATTACH_OUT_LEN) { @@ -1518,8 +1521,8 @@ static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, return rc; } -int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, - u16 *fw_subtype_list, u32 *capabilities) +int efx_siena_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, + u16 *fw_subtype_list, u32 *capabilities) { MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_BOARD_CFG_OUT_LENMAX); size_t outlen, i; @@ -1531,8 +1534,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST & 1); BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT1_OFST & 1); - rc = efx_mcdi_rpc(efx, MC_CMD_GET_BOARD_CFG, NULL, 0, - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_GET_BOARD_CFG, NULL, 0, + outbuf, sizeof(outbuf), &outlen); if (rc) goto fail; @@ -1574,7 +1577,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, return rc; } -int efx_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart, u32 dest_evq) +int efx_siena_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart, + u32 dest_evq) { MCDI_DECLARE_BUF(inbuf, MC_CMD_LOG_CTRL_IN_LEN); u32 dest = 0; @@ -1590,12 +1594,12 @@ int efx_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart, u32 dest_evq) BUILD_BUG_ON(MC_CMD_LOG_CTRL_OUT_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_LOG_CTRL, inbuf, sizeof(inbuf), - NULL, 0, NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_LOG_CTRL, inbuf, sizeof(inbuf), + NULL, 0, NULL); return rc; } -int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out) +int efx_siena_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out) { MCDI_DECLARE_BUF(outbuf, MC_CMD_NVRAM_TYPES_OUT_LEN); size_t outlen; @@ -1603,8 +1607,8 @@ int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out) BUILD_BUG_ON(MC_CMD_NVRAM_TYPES_IN_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_TYPES, NULL, 0, - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_NVRAM_TYPES, NULL, 0, + outbuf, sizeof(outbuf), &outlen); if (rc) goto fail; if (outlen < MC_CMD_NVRAM_TYPES_OUT_LEN) { @@ -1621,38 +1625,9 @@ int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out) return rc; } -/* This function finds types using the new NVRAM_PARTITIONS mcdi. */ -static int efx_new_mcdi_nvram_types(struct efx_nic *efx, u32 *number, - u32 *nvram_types) -{ - efx_dword_t *outbuf = kzalloc(MC_CMD_NVRAM_PARTITIONS_OUT_LENMAX_MCDI2, - GFP_KERNEL); - size_t outlen; - int rc; - - if (!outbuf) - return -ENOMEM; - - BUILD_BUG_ON(MC_CMD_NVRAM_PARTITIONS_IN_LEN != 0); - - rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_PARTITIONS, NULL, 0, - outbuf, MC_CMD_NVRAM_PARTITIONS_OUT_LENMAX_MCDI2, &outlen); - if (rc) - goto fail; - - *number = MCDI_DWORD(outbuf, NVRAM_PARTITIONS_OUT_NUM_PARTITIONS); - - memcpy(nvram_types, MCDI_PTR(outbuf, NVRAM_PARTITIONS_OUT_TYPE_ID), - *number * sizeof(u32)); - -fail: - kfree(outbuf); - return rc; -} - -int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type, - size_t *size_out, size_t *erase_size_out, - bool *protected_out) +int efx_siena_mcdi_nvram_info(struct efx_nic *efx, unsigned int type, + size_t *size_out, size_t *erase_size_out, + bool *protected_out) { MCDI_DECLARE_BUF(inbuf, MC_CMD_NVRAM_INFO_IN_LEN); MCDI_DECLARE_BUF(outbuf, MC_CMD_NVRAM_INFO_OUT_LEN); @@ -1661,8 +1636,8 @@ int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type, MCDI_SET_DWORD(inbuf, NVRAM_INFO_IN_TYPE, type); - rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_INFO, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_NVRAM_INFO, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), &outlen); if (rc) goto fail; if (outlen < MC_CMD_NVRAM_INFO_OUT_LEN) { @@ -1689,8 +1664,8 @@ static int efx_mcdi_nvram_test(struct efx_nic *efx, unsigned int type) MCDI_SET_DWORD(inbuf, NVRAM_TEST_IN_TYPE, type); - rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_TEST, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_NVRAM_TEST, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), NULL); if (rc) return rc; @@ -1703,46 +1678,13 @@ static int efx_mcdi_nvram_test(struct efx_nic *efx, unsigned int type) } } -/* This function tests nvram partitions using the new mcdi partition lookup scheme */ -int efx_new_mcdi_nvram_test_all(struct efx_nic *efx) -{ - u32 *nvram_types = kzalloc(MC_CMD_NVRAM_PARTITIONS_OUT_LENMAX_MCDI2, - GFP_KERNEL); - unsigned int number; - int rc, i; - - if (!nvram_types) - return -ENOMEM; - - rc = efx_new_mcdi_nvram_types(efx, &number, nvram_types); - if (rc) - goto fail; - - /* Require at least one check */ - rc = -EAGAIN; - - for (i = 0; i < number; i++) { - if (nvram_types[i] == NVRAM_PARTITION_TYPE_PARTITION_MAP || - nvram_types[i] == NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG) - continue; - - rc = efx_mcdi_nvram_test(efx, nvram_types[i]); - if (rc) - goto fail; - } - -fail: - kfree(nvram_types); - return rc; -} - -int efx_mcdi_nvram_test_all(struct efx_nic *efx) +int efx_siena_mcdi_nvram_test_all(struct efx_nic *efx) { u32 nvram_types; unsigned int type; int rc; - rc = efx_mcdi_nvram_types(efx, &nvram_types); + rc = efx_siena_mcdi_nvram_types(efx, &nvram_types); if (rc) goto fail1; @@ -1788,17 +1730,17 @@ static int efx_mcdi_read_assertion(struct efx_nic *efx) retry = 2; do { MCDI_SET_DWORD(inbuf, GET_ASSERTS_IN_CLEAR, 1); - rc = efx_mcdi_rpc_quiet(efx, MC_CMD_GET_ASSERTS, - inbuf, MC_CMD_GET_ASSERTS_IN_LEN, - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc_quiet(efx, MC_CMD_GET_ASSERTS, + inbuf, MC_CMD_GET_ASSERTS_IN_LEN, + outbuf, sizeof(outbuf), &outlen); if (rc == -EPERM) return 0; } while ((rc == -EINTR || rc == -EIO) && retry-- > 0); if (rc) { - efx_mcdi_display_error(efx, MC_CMD_GET_ASSERTS, - MC_CMD_GET_ASSERTS_IN_LEN, outbuf, - outlen, rc); + efx_siena_mcdi_display_error(efx, MC_CMD_GET_ASSERTS, + MC_CMD_GET_ASSERTS_IN_LEN, outbuf, + outlen, rc); return rc; } if (outlen < MC_CMD_GET_ASSERTS_OUT_LEN) @@ -1847,17 +1789,17 @@ static int efx_mcdi_exit_assertion(struct efx_nic *efx) BUILD_BUG_ON(MC_CMD_REBOOT_OUT_LEN != 0); MCDI_SET_DWORD(inbuf, REBOOT_IN_FLAGS, MC_CMD_REBOOT_FLAGS_AFTER_ASSERTION); - rc = efx_mcdi_rpc_quiet(efx, MC_CMD_REBOOT, inbuf, MC_CMD_REBOOT_IN_LEN, - NULL, 0, NULL); + rc = efx_siena_mcdi_rpc_quiet(efx, MC_CMD_REBOOT, inbuf, + MC_CMD_REBOOT_IN_LEN, NULL, 0, NULL); if (rc == -EIO) rc = 0; if (rc) - efx_mcdi_display_error(efx, MC_CMD_REBOOT, MC_CMD_REBOOT_IN_LEN, - NULL, 0, rc); + efx_siena_mcdi_display_error(efx, MC_CMD_REBOOT, + MC_CMD_REBOOT_IN_LEN, NULL, 0, rc); return rc; } -int efx_mcdi_handle_assertion(struct efx_nic *efx) +int efx_siena_mcdi_handle_assertion(struct efx_nic *efx) { int rc; @@ -1868,7 +1810,7 @@ int efx_mcdi_handle_assertion(struct efx_nic *efx) return efx_mcdi_exit_assertion(efx); } -int efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode) +int efx_siena_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode) { MCDI_DECLARE_BUF(inbuf, MC_CMD_SET_ID_LED_IN_LEN); @@ -1880,7 +1822,8 @@ int efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode) MCDI_SET_DWORD(inbuf, SET_ID_LED_IN_STATE, mode); - return efx_mcdi_rpc(efx, MC_CMD_SET_ID_LED, inbuf, sizeof(inbuf), NULL, 0, NULL); + return efx_siena_mcdi_rpc(efx, MC_CMD_SET_ID_LED, inbuf, sizeof(inbuf), + NULL, 0, NULL); } static int efx_mcdi_reset_func(struct efx_nic *efx) @@ -1891,8 +1834,8 @@ static int efx_mcdi_reset_func(struct efx_nic *efx) BUILD_BUG_ON(MC_CMD_ENTITY_RESET_OUT_LEN != 0); MCDI_POPULATE_DWORD_1(inbuf, ENTITY_RESET_IN_FLAG, ENTITY_RESET_IN_FUNCTION_RESOURCE_RESET, 1); - rc = efx_mcdi_rpc(efx, MC_CMD_ENTITY_RESET, inbuf, sizeof(inbuf), - NULL, 0, NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_ENTITY_RESET, inbuf, sizeof(inbuf), + NULL, 0, NULL); return rc; } @@ -1903,8 +1846,8 @@ static int efx_mcdi_reset_mc(struct efx_nic *efx) BUILD_BUG_ON(MC_CMD_REBOOT_OUT_LEN != 0); MCDI_SET_DWORD(inbuf, REBOOT_IN_FLAGS, 0); - rc = efx_mcdi_rpc(efx, MC_CMD_REBOOT, inbuf, sizeof(inbuf), - NULL, 0, NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_REBOOT, inbuf, sizeof(inbuf), + NULL, 0, NULL); /* White is black, and up is down */ if (rc == -EIO) return 0; @@ -1913,12 +1856,12 @@ static int efx_mcdi_reset_mc(struct efx_nic *efx) return rc; } -enum reset_type efx_mcdi_map_reset_reason(enum reset_type reason) +enum reset_type efx_siena_mcdi_map_reset_reason(enum reset_type reason) { return RESET_TYPE_RECOVER_OR_ALL; } -int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method) +int efx_siena_mcdi_reset(struct efx_nic *efx, enum reset_type method) { int rc; @@ -1936,7 +1879,7 @@ int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method) } /* Recover from a failed assertion pre-reset */ - rc = efx_mcdi_handle_assertion(efx); + rc = efx_siena_mcdi_handle_assertion(efx); if (rc) return rc; @@ -1961,8 +1904,8 @@ static int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type, MC_CMD_FILTER_MODE_SIMPLE); ether_addr_copy(MCDI_PTR(inbuf, WOL_FILTER_SET_IN_MAGIC_MAC), mac); - rc = efx_mcdi_rpc(efx, MC_CMD_WOL_FILTER_SET, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_WOL_FILTER_SET, inbuf, + sizeof(inbuf), outbuf, sizeof(outbuf), &outlen); if (rc) goto fail; @@ -1983,21 +1926,21 @@ static int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type, } -int -efx_mcdi_wol_filter_set_magic(struct efx_nic *efx, const u8 *mac, int *id_out) +int efx_siena_mcdi_wol_filter_set_magic(struct efx_nic *efx, const u8 *mac, + int *id_out) { return efx_mcdi_wol_filter_set(efx, MC_CMD_WOL_TYPE_MAGIC, mac, id_out); } -int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out) +int efx_siena_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out) { MCDI_DECLARE_BUF(outbuf, MC_CMD_WOL_FILTER_GET_OUT_LEN); size_t outlen; int rc; - rc = efx_mcdi_rpc(efx, MC_CMD_WOL_FILTER_GET, NULL, 0, - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_WOL_FILTER_GET, NULL, 0, + outbuf, sizeof(outbuf), &outlen); if (rc) goto fail; @@ -2017,19 +1960,19 @@ int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out) } -int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id) +int efx_siena_mcdi_wol_filter_remove(struct efx_nic *efx, int id) { MCDI_DECLARE_BUF(inbuf, MC_CMD_WOL_FILTER_REMOVE_IN_LEN); int rc; MCDI_SET_DWORD(inbuf, WOL_FILTER_REMOVE_IN_FILTER_ID, (u32)id); - rc = efx_mcdi_rpc(efx, MC_CMD_WOL_FILTER_REMOVE, inbuf, sizeof(inbuf), - NULL, 0, NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_WOL_FILTER_REMOVE, inbuf, + sizeof(inbuf), NULL, 0, NULL); return rc; } -int efx_mcdi_flush_rxqs(struct efx_nic *efx) +int efx_siena_mcdi_flush_rxqs(struct efx_nic *efx) { struct efx_channel *channel; struct efx_rx_queue *rx_queue; @@ -2054,79 +1997,20 @@ int efx_mcdi_flush_rxqs(struct efx_nic *efx) } } - rc = efx_mcdi_rpc(efx, MC_CMD_FLUSH_RX_QUEUES, inbuf, - MC_CMD_FLUSH_RX_QUEUES_IN_LEN(count), NULL, 0, NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_FLUSH_RX_QUEUES, inbuf, + MC_CMD_FLUSH_RX_QUEUES_IN_LEN(count), + NULL, 0, NULL); WARN_ON(rc < 0); return rc; } -int efx_mcdi_wol_filter_reset(struct efx_nic *efx) -{ - int rc; - - rc = efx_mcdi_rpc(efx, MC_CMD_WOL_FILTER_RESET, NULL, 0, NULL, 0, NULL); - return rc; -} - -int efx_mcdi_set_workaround(struct efx_nic *efx, u32 type, bool enabled, - unsigned int *flags) -{ - MCDI_DECLARE_BUF(inbuf, MC_CMD_WORKAROUND_IN_LEN); - MCDI_DECLARE_BUF(outbuf, MC_CMD_WORKAROUND_EXT_OUT_LEN); - size_t outlen; - int rc; - - BUILD_BUG_ON(MC_CMD_WORKAROUND_OUT_LEN != 0); - MCDI_SET_DWORD(inbuf, WORKAROUND_IN_TYPE, type); - MCDI_SET_DWORD(inbuf, WORKAROUND_IN_ENABLED, enabled); - rc = efx_mcdi_rpc(efx, MC_CMD_WORKAROUND, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &outlen); - if (rc) - return rc; - - if (!flags) - return 0; - - if (outlen >= MC_CMD_WORKAROUND_EXT_OUT_LEN) - *flags = MCDI_DWORD(outbuf, WORKAROUND_EXT_OUT_FLAGS); - else - *flags = 0; - - return 0; -} - -int efx_mcdi_get_workarounds(struct efx_nic *efx, unsigned int *impl_out, - unsigned int *enabled_out) +int efx_siena_mcdi_wol_filter_reset(struct efx_nic *efx) { - MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_WORKAROUNDS_OUT_LEN); - size_t outlen; int rc; - rc = efx_mcdi_rpc(efx, MC_CMD_GET_WORKAROUNDS, NULL, 0, - outbuf, sizeof(outbuf), &outlen); - if (rc) - goto fail; - - if (outlen < MC_CMD_GET_WORKAROUNDS_OUT_LEN) { - rc = -EIO; - goto fail; - } - - if (impl_out) - *impl_out = MCDI_DWORD(outbuf, GET_WORKAROUNDS_OUT_IMPLEMENTED); - - if (enabled_out) - *enabled_out = MCDI_DWORD(outbuf, GET_WORKAROUNDS_OUT_ENABLED); - - return 0; - -fail: - /* Older firmware lacks GET_WORKAROUNDS and this isn't especially - * terrifying. The call site will have to deal with it though. - */ - netif_cond_dbg(efx, hw, efx->net_dev, rc == -ENOSYS, err, - "%s: failed rc=%d\n", __func__, rc); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_WOL_FILTER_RESET, NULL, 0, + NULL, 0, NULL); return rc; } @@ -2146,8 +2030,8 @@ static int efx_mcdi_nvram_update_start(struct efx_nic *efx, unsigned int type) BUILD_BUG_ON(MC_CMD_NVRAM_UPDATE_START_OUT_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_UPDATE_START, inbuf, sizeof(inbuf), - NULL, 0, NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_NVRAM_UPDATE_START, inbuf, + sizeof(inbuf), NULL, 0, NULL); return rc; } @@ -2167,8 +2051,8 @@ static int efx_mcdi_nvram_read(struct efx_nic *efx, unsigned int type, MCDI_SET_DWORD(inbuf, NVRAM_READ_IN_V2_MODE, MC_CMD_NVRAM_READ_IN_V2_DEFAULT); - rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_READ, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_NVRAM_READ, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), &outlen); if (rc) return rc; @@ -2190,9 +2074,9 @@ static int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type, BUILD_BUG_ON(MC_CMD_NVRAM_WRITE_OUT_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_WRITE, inbuf, - ALIGN(MC_CMD_NVRAM_WRITE_IN_LEN(length), 4), - NULL, 0, NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_NVRAM_WRITE, inbuf, + ALIGN(MC_CMD_NVRAM_WRITE_IN_LEN(length), 4), + NULL, 0, NULL); return rc; } @@ -2208,8 +2092,8 @@ static int efx_mcdi_nvram_erase(struct efx_nic *efx, unsigned int type, BUILD_BUG_ON(MC_CMD_NVRAM_ERASE_OUT_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_ERASE, inbuf, sizeof(inbuf), - NULL, 0, NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_NVRAM_ERASE, inbuf, sizeof(inbuf), + NULL, 0, NULL); return rc; } @@ -2226,8 +2110,8 @@ static int efx_mcdi_nvram_update_finish(struct efx_nic *efx, unsigned int type) NVRAM_UPDATE_FINISH_V2_IN_FLAG_REPORT_VERIFY_RESULT, 1); - rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_UPDATE_FINISH, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_NVRAM_UPDATE_FINISH, inbuf, + sizeof(inbuf), outbuf, sizeof(outbuf), &outlen); if (!rc && outlen >= MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN) { rc2 = MCDI_DWORD(outbuf, NVRAM_UPDATE_FINISH_V2_OUT_RESULT_CODE); if (rc2 != MC_CMD_NVRAM_VERIFY_RC_SUCCESS) @@ -2263,8 +2147,8 @@ static int efx_mcdi_nvram_update_finish(struct efx_nic *efx, unsigned int type) return rc; } -int efx_mcdi_mtd_read(struct mtd_info *mtd, loff_t start, - size_t len, size_t *retlen, u8 *buffer) +int efx_siena_mcdi_mtd_read(struct mtd_info *mtd, loff_t start, + size_t len, size_t *retlen, u8 *buffer) { struct efx_mcdi_mtd_partition *part = to_efx_mcdi_mtd_partition(mtd); struct efx_nic *efx = mtd->priv; @@ -2287,7 +2171,7 @@ int efx_mcdi_mtd_read(struct mtd_info *mtd, loff_t start, return rc; } -int efx_mcdi_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len) +int efx_siena_mcdi_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len) { struct efx_mcdi_mtd_partition *part = to_efx_mcdi_mtd_partition(mtd); struct efx_nic *efx = mtd->priv; @@ -2317,8 +2201,8 @@ int efx_mcdi_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len) return rc; } -int efx_mcdi_mtd_write(struct mtd_info *mtd, loff_t start, - size_t len, size_t *retlen, const u8 *buffer) +int efx_siena_mcdi_mtd_write(struct mtd_info *mtd, loff_t start, + size_t len, size_t *retlen, const u8 *buffer) { struct efx_mcdi_mtd_partition *part = to_efx_mcdi_mtd_partition(mtd); struct efx_nic *efx = mtd->priv; @@ -2348,7 +2232,7 @@ int efx_mcdi_mtd_write(struct mtd_info *mtd, loff_t start, return rc; } -int efx_mcdi_mtd_sync(struct mtd_info *mtd) +int efx_siena_mcdi_mtd_sync(struct mtd_info *mtd) { struct efx_mcdi_mtd_partition *part = to_efx_mcdi_mtd_partition(mtd); struct efx_nic *efx = mtd->priv; @@ -2362,7 +2246,7 @@ int efx_mcdi_mtd_sync(struct mtd_info *mtd) return rc; } -void efx_mcdi_mtd_rename(struct efx_mtd_partition *part) +void efx_siena_mcdi_mtd_rename(struct efx_mtd_partition *part) { struct efx_mcdi_mtd_partition *mcdi_part = container_of(part, struct efx_mcdi_mtd_partition, common); diff --git a/drivers/net/ethernet/sfc/siena/mcdi.h b/drivers/net/ethernet/sfc/siena/mcdi.h index 69c2924a147c..dcebdbf956ce 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi.h +++ b/drivers/net/ethernet/sfc/siena/mcdi.h @@ -138,52 +138,54 @@ static inline struct efx_mcdi_mon *efx_mcdi_mon(struct efx_nic *efx) } #endif -int efx_mcdi_init(struct efx_nic *efx); -void efx_mcdi_detach(struct efx_nic *efx); -void efx_mcdi_fini(struct efx_nic *efx); +int efx_siena_mcdi_init(struct efx_nic *efx); +void efx_siena_mcdi_detach(struct efx_nic *efx); +void efx_siena_mcdi_fini(struct efx_nic *efx); -int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, const efx_dword_t *inbuf, - size_t inlen, efx_dword_t *outbuf, size_t outlen, - size_t *outlen_actual); -int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd, +int efx_siena_mcdi_rpc(struct efx_nic *efx, unsigned int cmd, const efx_dword_t *inbuf, size_t inlen, efx_dword_t *outbuf, size_t outlen, size_t *outlen_actual); +int efx_siena_mcdi_rpc_quiet(struct efx_nic *efx, unsigned int cmd, + const efx_dword_t *inbuf, size_t inlen, + efx_dword_t *outbuf, size_t outlen, + size_t *outlen_actual); -int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd, - const efx_dword_t *inbuf, size_t inlen); -int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, - efx_dword_t *outbuf, size_t outlen, - size_t *outlen_actual); -int efx_mcdi_rpc_finish_quiet(struct efx_nic *efx, unsigned cmd, - size_t inlen, efx_dword_t *outbuf, - size_t outlen, size_t *outlen_actual); +int efx_siena_mcdi_rpc_start(struct efx_nic *efx, unsigned int cmd, + const efx_dword_t *inbuf, size_t inlen); +int efx_siena_mcdi_rpc_finish(struct efx_nic *efx, unsigned int cmd, + size_t inlen, efx_dword_t *outbuf, size_t outlen, + size_t *outlen_actual); +int efx_siena_mcdi_rpc_finish_quiet(struct efx_nic *efx, unsigned int cmd, + size_t inlen, efx_dword_t *outbuf, + size_t outlen, size_t *outlen_actual); typedef void efx_mcdi_async_completer(struct efx_nic *efx, unsigned long cookie, int rc, efx_dword_t *outbuf, size_t outlen_actual); -int efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd, - const efx_dword_t *inbuf, size_t inlen, size_t outlen, - efx_mcdi_async_completer *complete, - unsigned long cookie); -int efx_mcdi_rpc_async_quiet(struct efx_nic *efx, unsigned int cmd, +int efx_siena_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd, const efx_dword_t *inbuf, size_t inlen, size_t outlen, efx_mcdi_async_completer *complete, unsigned long cookie); +int efx_siena_mcdi_rpc_async_quiet(struct efx_nic *efx, unsigned int cmd, + const efx_dword_t *inbuf, size_t inlen, + size_t outlen, + efx_mcdi_async_completer *complete, + unsigned long cookie); -void efx_mcdi_display_error(struct efx_nic *efx, unsigned cmd, - size_t inlen, efx_dword_t *outbuf, - size_t outlen, int rc); +void efx_siena_mcdi_display_error(struct efx_nic *efx, unsigned int cmd, + size_t inlen, efx_dword_t *outbuf, + size_t outlen, int rc); -int efx_mcdi_poll_reboot(struct efx_nic *efx); -void efx_mcdi_mode_poll(struct efx_nic *efx); -void efx_mcdi_mode_event(struct efx_nic *efx); -void efx_mcdi_flush_async(struct efx_nic *efx); +int efx_siena_mcdi_poll_reboot(struct efx_nic *efx); +void efx_siena_mcdi_mode_poll(struct efx_nic *efx); +void efx_siena_mcdi_mode_event(struct efx_nic *efx); +void efx_siena_mcdi_flush_async(struct efx_nic *efx); -void efx_mcdi_process_event(struct efx_channel *channel, efx_qword_t *event); -void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev); +void efx_siena_mcdi_process_event(struct efx_channel *channel, efx_qword_t *event); +void efx_siena_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev); /* We expect that 16- and 32-bit fields in MCDI requests and responses * are appropriately aligned, but 64-bit fields are only @@ -338,51 +340,47 @@ void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev); MCDI_CAPABILITY(field), \ MCDI_CAPABILITY_OFST(field)) -void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len); -int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, - u16 *fw_subtype_list, u32 *capabilities); -int efx_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart, u32 dest_evq); -int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out); -int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type, - size_t *size_out, size_t *erase_size_out, - bool *protected_out); -int efx_new_mcdi_nvram_test_all(struct efx_nic *efx); -int efx_mcdi_nvram_test_all(struct efx_nic *efx); -int efx_mcdi_handle_assertion(struct efx_nic *efx); -int efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); -int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx, const u8 *mac, - int *id_out); -int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out); -int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id); -int efx_mcdi_wol_filter_reset(struct efx_nic *efx); -int efx_mcdi_flush_rxqs(struct efx_nic *efx); -void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev); -void efx_mcdi_mac_start_stats(struct efx_nic *efx); -void efx_mcdi_mac_stop_stats(struct efx_nic *efx); -void efx_mcdi_mac_pull_stats(struct efx_nic *efx); -enum reset_type efx_mcdi_map_reset_reason(enum reset_type reason); -int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method); -int efx_mcdi_set_workaround(struct efx_nic *efx, u32 type, bool enabled, - unsigned int *flags); -int efx_mcdi_get_workarounds(struct efx_nic *efx, unsigned int *impl_out, - unsigned int *enabled_out); +void efx_siena_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len); +int efx_siena_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, + u16 *fw_subtype_list, u32 *capabilities); +int efx_siena_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart, + u32 dest_evq); +int efx_siena_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out); +int efx_siena_mcdi_nvram_info(struct efx_nic *efx, unsigned int type, + size_t *size_out, size_t *erase_size_out, + bool *protected_out); +int efx_siena_mcdi_nvram_test_all(struct efx_nic *efx); +int efx_siena_mcdi_handle_assertion(struct efx_nic *efx); +int efx_siena_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); +int efx_siena_mcdi_wol_filter_set_magic(struct efx_nic *efx, const u8 *mac, + int *id_out); +int efx_siena_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out); +int efx_siena_mcdi_wol_filter_remove(struct efx_nic *efx, int id); +int efx_siena_mcdi_wol_filter_reset(struct efx_nic *efx); +int efx_siena_mcdi_flush_rxqs(struct efx_nic *efx); +void efx_siena_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev); +void efx_siena_mcdi_mac_start_stats(struct efx_nic *efx); +void efx_siena_mcdi_mac_stop_stats(struct efx_nic *efx); +void efx_siena_mcdi_mac_pull_stats(struct efx_nic *efx); +enum reset_type efx_siena_mcdi_map_reset_reason(enum reset_type reason); +int efx_siena_mcdi_reset(struct efx_nic *efx, enum reset_type method); #ifdef CONFIG_SFC_MCDI_MON -int efx_mcdi_mon_probe(struct efx_nic *efx); -void efx_mcdi_mon_remove(struct efx_nic *efx); +int efx_siena_mcdi_mon_probe(struct efx_nic *efx); +void efx_siena_mcdi_mon_remove(struct efx_nic *efx); #else -static inline int efx_mcdi_mon_probe(struct efx_nic *efx) { return 0; } -static inline void efx_mcdi_mon_remove(struct efx_nic *efx) {} +static inline int efx_siena_mcdi_mon_probe(struct efx_nic *efx) { return 0; } +static inline void efx_siena_mcdi_mon_remove(struct efx_nic *efx) {} #endif #ifdef CONFIG_SFC_MTD -int efx_mcdi_mtd_read(struct mtd_info *mtd, loff_t start, size_t len, - size_t *retlen, u8 *buffer); -int efx_mcdi_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len); -int efx_mcdi_mtd_write(struct mtd_info *mtd, loff_t start, size_t len, - size_t *retlen, const u8 *buffer); -int efx_mcdi_mtd_sync(struct mtd_info *mtd); -void efx_mcdi_mtd_rename(struct efx_mtd_partition *part); +int efx_siena_mcdi_mtd_read(struct mtd_info *mtd, loff_t start, size_t len, + size_t *retlen, u8 *buffer); +int efx_siena_mcdi_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len); +int efx_siena_mcdi_mtd_write(struct mtd_info *mtd, loff_t start, size_t len, + size_t *retlen, const u8 *buffer); +int efx_siena_mcdi_mtd_sync(struct mtd_info *mtd); +void efx_siena_mcdi_mtd_rename(struct efx_mtd_partition *part); #endif #endif /* EFX_MCDI_H */ diff --git a/drivers/net/ethernet/sfc/siena/mcdi_mon.c b/drivers/net/ethernet/sfc/siena/mcdi_mon.c index 5954fcfee2b1..eb44d4140925 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi_mon.c +++ b/drivers/net/ethernet/sfc/siena/mcdi_mon.c @@ -100,7 +100,7 @@ static const char *const sensor_status_names[] = { [MC_CMD_SENSOR_STATE_NO_READING] = "No reading", }; -void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev) +void efx_siena_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev) { unsigned int type, state, value; enum efx_hwmon_type hwmon_type = EFX_HWMON_UNKNOWN; @@ -151,8 +151,8 @@ static int efx_mcdi_mon_update(struct efx_nic *efx) hwmon->dma_buf.dma_addr); MCDI_SET_DWORD(inbuf, READ_SENSORS_EXT_IN_LENGTH, hwmon->dma_buf.len); - rc = efx_mcdi_rpc(efx, MC_CMD_READ_SENSORS, - inbuf, sizeof(inbuf), NULL, 0, NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_READ_SENSORS, + inbuf, sizeof(inbuf), NULL, 0, NULL); if (rc == 0) hwmon->last_update = jiffies; return rc; @@ -300,7 +300,7 @@ efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name, hwmon->group.attrs[hwmon->n_attrs++] = &attr->dev_attr.attr; } -int efx_mcdi_mon_probe(struct efx_nic *efx) +int efx_siena_mcdi_mon_probe(struct efx_nic *efx) { unsigned int n_temp = 0, n_cool = 0, n_in = 0, n_curr = 0, n_power = 0; struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); @@ -318,8 +318,9 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) do { MCDI_SET_DWORD(inbuf, SENSOR_INFO_EXT_IN_PAGE, page); - rc = efx_mcdi_rpc(efx, MC_CMD_SENSOR_INFO, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_SENSOR_INFO, inbuf, + sizeof(inbuf), outbuf, sizeof(outbuf), + &outlen); if (rc) return rc; if (outlen < MC_CMD_SENSOR_INFO_OUT_LENMIN) @@ -380,10 +381,10 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) MCDI_SET_DWORD(inbuf, SENSOR_INFO_EXT_IN_PAGE, page); - rc = efx_mcdi_rpc(efx, MC_CMD_SENSOR_INFO, - inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), - &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_SENSOR_INFO, + inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), + &outlen); if (rc) goto fail; if (outlen < MC_CMD_SENSOR_INFO_OUT_LENMIN) { @@ -513,11 +514,11 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) return 0; fail: - efx_mcdi_mon_remove(efx); + efx_siena_mcdi_mon_remove(efx); return rc; } -void efx_mcdi_mon_remove(struct efx_nic *efx) +void efx_siena_mcdi_mon_remove(struct efx_nic *efx) { struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); diff --git a/drivers/net/ethernet/sfc/siena/mcdi_port.c b/drivers/net/ethernet/sfc/siena/mcdi_port.c index 94c6a345c0b1..93b8b2338f11 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi_port.c +++ b/drivers/net/ethernet/sfc/siena/mcdi_port.c @@ -31,8 +31,8 @@ static int efx_mcdi_mdio_read(struct net_device *net_dev, MCDI_SET_DWORD(inbuf, MDIO_READ_IN_DEVAD, devad); MCDI_SET_DWORD(inbuf, MDIO_READ_IN_ADDR, addr); - rc = efx_mcdi_rpc(efx, MC_CMD_MDIO_READ, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_MDIO_READ, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), &outlen); if (rc) return rc; @@ -58,8 +58,8 @@ static int efx_mcdi_mdio_write(struct net_device *net_dev, MCDI_SET_DWORD(inbuf, MDIO_WRITE_IN_ADDR, addr); MCDI_SET_DWORD(inbuf, MDIO_WRITE_IN_VALUE, value); - rc = efx_mcdi_rpc(efx, MC_CMD_MDIO_WRITE, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_MDIO_WRITE, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), &outlen); if (rc) return rc; @@ -70,14 +70,7 @@ static int efx_mcdi_mdio_write(struct net_device *net_dev, return 0; } -u32 efx_mcdi_phy_get_caps(struct efx_nic *efx) -{ - struct efx_mcdi_phy_data *phy_data = efx->phy_data; - - return phy_data->supported_cap; -} - -bool efx_mcdi_mac_check_fault(struct efx_nic *efx) +bool efx_siena_mcdi_mac_check_fault(struct efx_nic *efx) { MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_LINK_OUT_LEN); size_t outlength; @@ -85,15 +78,15 @@ bool efx_mcdi_mac_check_fault(struct efx_nic *efx) BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, - outbuf, sizeof(outbuf), &outlength); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, + outbuf, sizeof(outbuf), &outlength); if (rc) return true; return MCDI_DWORD(outbuf, GET_LINK_OUT_MAC_FAULT) != 0; } -int efx_mcdi_port_probe(struct efx_nic *efx) +int efx_siena_mcdi_port_probe(struct efx_nic *efx) { int rc; @@ -103,15 +96,15 @@ int efx_mcdi_port_probe(struct efx_nic *efx) efx->mdio.mdio_write = efx_mcdi_mdio_write; /* Fill out MDIO structure, loopback modes, and initial link state */ - rc = efx_mcdi_phy_probe(efx); + rc = efx_siena_mcdi_phy_probe(efx); if (rc != 0) return rc; - return efx_mcdi_mac_init_stats(efx); + return efx_siena_mcdi_mac_init_stats(efx); } -void efx_mcdi_port_remove(struct efx_nic *efx) +void efx_siena_mcdi_port_remove(struct efx_nic *efx) { - efx_mcdi_phy_remove(efx); - efx_mcdi_mac_fini_stats(efx); + efx_siena_mcdi_phy_remove(efx); + efx_siena_mcdi_mac_fini_stats(efx); } diff --git a/drivers/net/ethernet/sfc/siena/mcdi_port.h b/drivers/net/ethernet/sfc/siena/mcdi_port.h index 07863ddbe740..7b4ae250b51f 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi_port.h +++ b/drivers/net/ethernet/sfc/siena/mcdi_port.h @@ -10,9 +10,8 @@ #include "net_driver.h" -u32 efx_mcdi_phy_get_caps(struct efx_nic *efx); -bool efx_mcdi_mac_check_fault(struct efx_nic *efx); -int efx_mcdi_port_probe(struct efx_nic *efx); -void efx_mcdi_port_remove(struct efx_nic *efx); +bool efx_siena_mcdi_mac_check_fault(struct efx_nic *efx); +int efx_siena_mcdi_port_probe(struct efx_nic *efx); +void efx_siena_mcdi_port_remove(struct efx_nic *efx); #endif /* EFX_MCDI_PORT_H */ diff --git a/drivers/net/ethernet/sfc/siena/mcdi_port_common.c b/drivers/net/ethernet/sfc/siena/mcdi_port_common.c index 57908045fb15..a842c139d76f 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi_port_common.c +++ b/drivers/net/ethernet/sfc/siena/mcdi_port_common.c @@ -12,7 +12,8 @@ #include "efx_common.h" #include "nic.h" -int efx_mcdi_get_phy_cfg(struct efx_nic *efx, struct efx_mcdi_phy_data *cfg) +static int efx_mcdi_get_phy_cfg(struct efx_nic *efx, + struct efx_mcdi_phy_data *cfg) { MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_PHY_CFG_OUT_LEN); size_t outlen; @@ -21,8 +22,8 @@ int efx_mcdi_get_phy_cfg(struct efx_nic *efx, struct efx_mcdi_phy_data *cfg) BUILD_BUG_ON(MC_CMD_GET_PHY_CFG_IN_LEN != 0); BUILD_BUG_ON(MC_CMD_GET_PHY_CFG_OUT_NAME_LEN != sizeof(cfg->name)); - rc = efx_mcdi_rpc(efx, MC_CMD_GET_PHY_CFG, NULL, 0, - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_GET_PHY_CFG, NULL, 0, + outbuf, sizeof(outbuf), &outlen); if (rc) goto fail; @@ -52,8 +53,8 @@ int efx_mcdi_get_phy_cfg(struct efx_nic *efx, struct efx_mcdi_phy_data *cfg) return rc; } -void efx_link_set_advertising(struct efx_nic *efx, - const unsigned long *advertising) +void efx_siena_link_set_advertising(struct efx_nic *efx, + const unsigned long *advertising) { memcpy(efx->link_advertising, advertising, sizeof(__ETHTOOL_DECLARE_LINK_MODE_MASK())); @@ -67,8 +68,8 @@ void efx_link_set_advertising(struct efx_nic *efx, efx->wanted_fc ^= EFX_FC_TX; } -int efx_mcdi_set_link(struct efx_nic *efx, u32 capabilities, - u32 flags, u32 loopback_mode, u32 loopback_speed) +static int efx_mcdi_set_link(struct efx_nic *efx, u32 capabilities, + u32 flags, u32 loopback_mode, u32 loopback_speed) { MCDI_DECLARE_BUF(inbuf, MC_CMD_SET_LINK_IN_LEN); @@ -79,18 +80,18 @@ int efx_mcdi_set_link(struct efx_nic *efx, u32 capabilities, MCDI_SET_DWORD(inbuf, SET_LINK_IN_LOOPBACK_MODE, loopback_mode); MCDI_SET_DWORD(inbuf, SET_LINK_IN_LOOPBACK_SPEED, loopback_speed); - return efx_mcdi_rpc(efx, MC_CMD_SET_LINK, inbuf, sizeof(inbuf), - NULL, 0, NULL); + return efx_siena_mcdi_rpc(efx, MC_CMD_SET_LINK, inbuf, sizeof(inbuf), + NULL, 0, NULL); } -int efx_mcdi_loopback_modes(struct efx_nic *efx, u64 *loopback_modes) +static int efx_mcdi_loopback_modes(struct efx_nic *efx, u64 *loopback_modes) { MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_LOOPBACK_MODES_OUT_LEN); size_t outlen; int rc; - rc = efx_mcdi_rpc(efx, MC_CMD_GET_LOOPBACK_MODES, NULL, 0, - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_GET_LOOPBACK_MODES, NULL, 0, + outbuf, sizeof(outbuf), &outlen); if (rc) goto fail; @@ -109,7 +110,7 @@ int efx_mcdi_loopback_modes(struct efx_nic *efx, u64 *loopback_modes) return rc; } -void mcdi_to_ethtool_linkset(u32 media, u32 cap, unsigned long *linkset) +static void mcdi_to_ethtool_linkset(u32 media, u32 cap, unsigned long *linkset) { #define SET_BIT(name) __set_bit(ETHTOOL_LINK_MODE_ ## name ## _BIT, \ linkset) @@ -184,7 +185,7 @@ void mcdi_to_ethtool_linkset(u32 media, u32 cap, unsigned long *linkset) #undef SET_BIT } -u32 ethtool_linkset_to_mcdi_cap(const unsigned long *linkset) +static u32 ethtool_linkset_to_mcdi_cap(const unsigned long *linkset) { u32 result = 0; @@ -229,7 +230,7 @@ u32 ethtool_linkset_to_mcdi_cap(const unsigned long *linkset) return result; } -u32 efx_get_mcdi_phy_flags(struct efx_nic *efx) +static u32 efx_get_mcdi_phy_flags(struct efx_nic *efx) { struct efx_mcdi_phy_data *phy_cfg = efx->phy_data; enum efx_phy_mode mode, supported; @@ -257,7 +258,7 @@ u32 efx_get_mcdi_phy_flags(struct efx_nic *efx) return flags; } -u8 mcdi_to_ethtool_media(u32 media) +static u8 mcdi_to_ethtool_media(u32 media) { switch (media) { case MC_CMD_MEDIA_XAUI: @@ -278,9 +279,9 @@ u8 mcdi_to_ethtool_media(u32 media) } } -void efx_mcdi_phy_decode_link(struct efx_nic *efx, - struct efx_link_state *link_state, - u32 speed, u32 flags, u32 fcntl) +static void efx_mcdi_phy_decode_link(struct efx_nic *efx, + struct efx_link_state *link_state, + u32 speed, u32 flags, u32 fcntl) { switch (fcntl) { case MC_CMD_FCNTL_AUTO: @@ -321,7 +322,7 @@ void efx_mcdi_phy_decode_link(struct efx_nic *efx, * Both RS and BASER (whether AUTO or not) means use FEC if cable and link * partner support it, preferring RS to BASER. */ -u32 ethtool_fec_caps_to_mcdi(u32 supported_cap, u32 ethtool_cap) +static u32 ethtool_fec_caps_to_mcdi(u32 supported_cap, u32 ethtool_cap) { u32 ret = 0; @@ -352,7 +353,7 @@ u32 ethtool_fec_caps_to_mcdi(u32 supported_cap, u32 ethtool_cap) * maps both of those to AUTO. This should never matter, and it's not clear * what a better mapping would be anyway. */ -u32 mcdi_fec_caps_to_ethtool(u32 caps, bool is_25g) +static u32 mcdi_fec_caps_to_ethtool(u32 caps, bool is_25g) { bool rs = caps & (1 << MC_CMD_PHY_CAP_RS_FEC_LBN), rs_req = caps & (1 << MC_CMD_PHY_CAP_RS_FEC_REQUESTED_LBN), @@ -371,7 +372,7 @@ u32 mcdi_fec_caps_to_ethtool(u32 caps, bool is_25g) /* Verify that the forced flow control settings (!EFX_FC_AUTO) are * supported by the link partner. Warn the user if this isn't the case */ -void efx_mcdi_phy_check_fcntl(struct efx_nic *efx, u32 lpa) +static void efx_mcdi_phy_check_fcntl(struct efx_nic *efx, u32 lpa) { struct efx_mcdi_phy_data *phy_cfg = efx->phy_data; u32 rmtadv; @@ -397,7 +398,7 @@ void efx_mcdi_phy_check_fcntl(struct efx_nic *efx, u32 lpa) "warning: link partner doesn't support pause frames"); } -bool efx_mcdi_phy_poll(struct efx_nic *efx) +bool efx_siena_mcdi_phy_poll(struct efx_nic *efx) { struct efx_link_state old_state = efx->link_state; MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_LINK_OUT_LEN); @@ -407,8 +408,8 @@ bool efx_mcdi_phy_poll(struct efx_nic *efx) BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, - outbuf, sizeof(outbuf), NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, + outbuf, sizeof(outbuf), NULL); if (rc) efx->link_state.up = false; else @@ -421,7 +422,7 @@ bool efx_mcdi_phy_poll(struct efx_nic *efx) return !efx_link_state_equal(&efx->link_state, &old_state); } -int efx_mcdi_phy_probe(struct efx_nic *efx) +int efx_siena_mcdi_phy_probe(struct efx_nic *efx) { struct efx_mcdi_phy_data *phy_data; MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_LINK_OUT_LEN); @@ -439,8 +440,8 @@ int efx_mcdi_phy_probe(struct efx_nic *efx) /* Read initial link advertisement */ BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, - outbuf, sizeof(outbuf), NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, + outbuf, sizeof(outbuf), NULL); if (rc) goto fail; @@ -527,7 +528,7 @@ int efx_mcdi_phy_probe(struct efx_nic *efx) return rc; } -void efx_mcdi_phy_remove(struct efx_nic *efx) +void efx_siena_mcdi_phy_remove(struct efx_nic *efx) { struct efx_mcdi_phy_data *phy_data = efx->phy_data; @@ -535,7 +536,8 @@ void efx_mcdi_phy_remove(struct efx_nic *efx) kfree(phy_data); } -void efx_mcdi_phy_get_link_ksettings(struct efx_nic *efx, struct ethtool_link_ksettings *cmd) +void efx_siena_mcdi_phy_get_link_ksettings(struct efx_nic *efx, + struct ethtool_link_ksettings *cmd) { struct efx_mcdi_phy_data *phy_cfg = efx->phy_data; MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_LINK_OUT_LEN); @@ -555,8 +557,8 @@ void efx_mcdi_phy_get_link_ksettings(struct efx_nic *efx, struct ethtool_link_ks sizeof(__ETHTOOL_DECLARE_LINK_MODE_MASK())); BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, - outbuf, sizeof(outbuf), NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, + outbuf, sizeof(outbuf), NULL); if (rc) return; mcdi_to_ethtool_linkset(phy_cfg->media, @@ -564,7 +566,9 @@ void efx_mcdi_phy_get_link_ksettings(struct efx_nic *efx, struct ethtool_link_ks cmd->link_modes.lp_advertising); } -int efx_mcdi_phy_set_link_ksettings(struct efx_nic *efx, const struct ethtool_link_ksettings *cmd) +int +efx_siena_mcdi_phy_set_link_ksettings(struct efx_nic *efx, + const struct ethtool_link_ksettings *cmd) { struct efx_mcdi_phy_data *phy_cfg = efx->phy_data; u32 caps; @@ -602,7 +606,7 @@ int efx_mcdi_phy_set_link_ksettings(struct efx_nic *efx, const struct ethtool_li return rc; if (cmd->base.autoneg) { - efx_link_set_advertising(efx, cmd->link_modes.advertising); + efx_siena_link_set_advertising(efx, cmd->link_modes.advertising); phy_cfg->forced_cap = 0; } else { efx_siena_link_clear_advertising(efx); @@ -611,7 +615,8 @@ int efx_mcdi_phy_set_link_ksettings(struct efx_nic *efx, const struct ethtool_li return 0; } -int efx_mcdi_phy_get_fecparam(struct efx_nic *efx, struct ethtool_fecparam *fec) +int efx_siena_mcdi_phy_get_fecparam(struct efx_nic *efx, + struct ethtool_fecparam *fec) { MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_LINK_OUT_V2_LEN); u32 caps, active, speed; /* MCDI format */ @@ -620,8 +625,8 @@ int efx_mcdi_phy_get_fecparam(struct efx_nic *efx, struct ethtool_fecparam *fec) int rc; BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, + outbuf, sizeof(outbuf), &outlen); if (rc) return rc; if (outlen < MC_CMD_GET_LINK_OUT_V2_LEN) @@ -676,7 +681,8 @@ static int ethtool_fec_supported(u32 supported_cap, u32 ethtool_cap) return 0; } -int efx_mcdi_phy_set_fecparam(struct efx_nic *efx, const struct ethtool_fecparam *fec) +int efx_siena_mcdi_phy_set_fecparam(struct efx_nic *efx, + const struct ethtool_fecparam *fec) { struct efx_mcdi_phy_data *phy_cfg = efx->phy_data; u32 caps; @@ -686,7 +692,7 @@ int efx_mcdi_phy_set_fecparam(struct efx_nic *efx, const struct ethtool_fecparam if (rc) return rc; - /* Work out what efx_mcdi_phy_set_link_ksettings() would produce from + /* Work out what efx_siena_mcdi_phy_set_link_ksettings() would produce from * saved advertising bits */ if (test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, efx->link_advertising)) @@ -706,7 +712,7 @@ int efx_mcdi_phy_set_fecparam(struct efx_nic *efx, const struct ethtool_fecparam return 0; } -int efx_mcdi_phy_test_alive(struct efx_nic *efx) +int efx_siena_mcdi_phy_test_alive(struct efx_nic *efx) { MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_PHY_STATE_OUT_LEN); size_t outlen; @@ -714,8 +720,8 @@ int efx_mcdi_phy_test_alive(struct efx_nic *efx) BUILD_BUG_ON(MC_CMD_GET_PHY_STATE_IN_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_GET_PHY_STATE, NULL, 0, - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_GET_PHY_STATE, NULL, 0, + outbuf, sizeof(outbuf), &outlen); if (rc) return rc; @@ -727,7 +733,7 @@ int efx_mcdi_phy_test_alive(struct efx_nic *efx) return 0; } -int efx_mcdi_port_reconfigure(struct efx_nic *efx) +int efx_siena_mcdi_port_reconfigure(struct efx_nic *efx) { struct efx_mcdi_phy_data *phy_cfg = efx->phy_data; u32 caps = (efx->link_advertising[0] ? @@ -764,16 +770,16 @@ static int efx_mcdi_bist(struct efx_nic *efx, unsigned int bist_mode, BUILD_BUG_ON(MC_CMD_START_BIST_OUT_LEN != 0); MCDI_SET_DWORD(inbuf, START_BIST_IN_TYPE, bist_mode); - rc = efx_mcdi_rpc(efx, MC_CMD_START_BIST, - inbuf, MC_CMD_START_BIST_IN_LEN, NULL, 0, NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_START_BIST, inbuf, + MC_CMD_START_BIST_IN_LEN, NULL, 0, NULL); if (rc) goto out; /* Wait up to 10s for BIST to finish */ for (retry = 0; retry < 100; ++retry) { BUILD_BUG_ON(MC_CMD_POLL_BIST_IN_LEN != 0); - rc = efx_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0, - outbuf, sizeof(outbuf), &outlen); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0, + outbuf, sizeof(outbuf), &outlen); if (rc) goto out; @@ -811,7 +817,8 @@ static int efx_mcdi_bist(struct efx_nic *efx, unsigned int bist_mode, return rc; } -int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results, unsigned int flags) +int efx_siena_mcdi_phy_run_tests(struct efx_nic *efx, int *results, + unsigned int flags) { struct efx_mcdi_phy_data *phy_cfg = efx->phy_data; u32 mode; @@ -850,7 +857,8 @@ int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results, unsigned int flags return 0; } -const char *efx_mcdi_phy_test_name(struct efx_nic *efx, unsigned int index) +const char *efx_siena_mcdi_phy_test_name(struct efx_nic *efx, + unsigned int index) { struct efx_mcdi_phy_data *phy_cfg = efx->phy_data; @@ -913,10 +921,10 @@ static int efx_mcdi_phy_get_module_eeprom_page(struct efx_nic *efx, to_copy = min(space, SFP_PAGE_SIZE - offset); MCDI_SET_DWORD(inbuf, GET_PHY_MEDIA_INFO_IN_PAGE, page); - rc = efx_mcdi_rpc_quiet(efx, MC_CMD_GET_PHY_MEDIA_INFO, - inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), - &outlen); + rc = efx_siena_mcdi_rpc_quiet(efx, MC_CMD_GET_PHY_MEDIA_INFO, + inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), + &outlen); if (rc) return rc; @@ -984,7 +992,8 @@ static u32 efx_mcdi_phy_module_type(struct efx_nic *efx) } } -int efx_mcdi_phy_get_module_eeprom(struct efx_nic *efx, struct ethtool_eeprom *ee, u8 *data) +int efx_siena_mcdi_phy_get_module_eeprom(struct efx_nic *efx, + struct ethtool_eeprom *ee, u8 *data) { int rc; ssize_t space_remaining = ee->len; @@ -1045,7 +1054,7 @@ int efx_mcdi_phy_get_module_eeprom(struct efx_nic *efx, struct ethtool_eeprom *e return 0; } -int efx_mcdi_phy_get_module_info(struct efx_nic *efx, struct ethtool_modinfo *modinfo) +int efx_siena_mcdi_phy_get_module_info(struct efx_nic *efx, struct ethtool_modinfo *modinfo) { int sff_8472_level; int diag_type; @@ -1090,7 +1099,7 @@ static unsigned int efx_calc_mac_mtu(struct efx_nic *efx) return EFX_MAX_FRAME_LEN(efx->net_dev->mtu); } -int efx_mcdi_set_mac(struct efx_nic *efx) +int efx_siena_mcdi_set_mac(struct efx_nic *efx) { u32 fcntl; MCDI_DECLARE_BUF(cmdbytes, MC_CMD_SET_MAC_IN_LEN); @@ -1130,23 +1139,8 @@ int efx_mcdi_set_mac(struct efx_nic *efx) MCDI_SET_DWORD(cmdbytes, SET_MAC_IN_FCNTL, fcntl); - return efx_mcdi_rpc(efx, MC_CMD_SET_MAC, cmdbytes, sizeof(cmdbytes), - NULL, 0, NULL); -} - -int efx_mcdi_set_mtu(struct efx_nic *efx) -{ - MCDI_DECLARE_BUF(inbuf, MC_CMD_SET_MAC_EXT_IN_LEN); - - BUILD_BUG_ON(MC_CMD_SET_MAC_OUT_LEN != 0); - - MCDI_SET_DWORD(inbuf, SET_MAC_EXT_IN_MTU, efx_calc_mac_mtu(efx)); - - MCDI_POPULATE_DWORD_1(inbuf, SET_MAC_EXT_IN_CONTROL, - SET_MAC_EXT_IN_CFG_MTU, 1); - - return efx_mcdi_rpc(efx, MC_CMD_SET_MAC, inbuf, sizeof(inbuf), - NULL, 0, NULL); + return efx_siena_mcdi_rpc(efx, MC_CMD_SET_MAC, cmdbytes, + sizeof(cmdbytes), NULL, 0, NULL); } enum efx_stats_action { @@ -1183,16 +1177,16 @@ static int efx_mcdi_mac_stats(struct efx_nic *efx, if (efx_nic_rev(efx) >= EFX_REV_HUNT_A0) MCDI_SET_DWORD(inbuf, MAC_STATS_IN_PORT_ID, efx->vport_id); - rc = efx_mcdi_rpc_quiet(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf), - NULL, 0, NULL); + rc = efx_siena_mcdi_rpc_quiet(efx, MC_CMD_MAC_STATS, inbuf, + sizeof(inbuf), NULL, 0, NULL); /* Expect ENOENT if DMA queues have not been set up */ if (rc && (rc != -ENOENT || atomic_read(&efx->active_queues))) - efx_mcdi_display_error(efx, MC_CMD_MAC_STATS, sizeof(inbuf), - NULL, 0, rc); + efx_siena_mcdi_display_error(efx, MC_CMD_MAC_STATS, + sizeof(inbuf), NULL, 0, rc); return rc; } -void efx_mcdi_mac_start_stats(struct efx_nic *efx) +void efx_siena_mcdi_mac_start_stats(struct efx_nic *efx) { __le64 *dma_stats = efx->stats_buffer.addr; @@ -1201,7 +1195,7 @@ void efx_mcdi_mac_start_stats(struct efx_nic *efx) efx_mcdi_mac_stats(efx, EFX_STATS_ENABLE, 0); } -void efx_mcdi_mac_stop_stats(struct efx_nic *efx) +void efx_siena_mcdi_mac_stop_stats(struct efx_nic *efx) { efx_mcdi_mac_stats(efx, EFX_STATS_DISABLE, 0); } @@ -1209,7 +1203,7 @@ void efx_mcdi_mac_stop_stats(struct efx_nic *efx) #define EFX_MAC_STATS_WAIT_US 100 #define EFX_MAC_STATS_WAIT_ATTEMPTS 10 -void efx_mcdi_mac_pull_stats(struct efx_nic *efx) +void efx_siena_mcdi_mac_pull_stats(struct efx_nic *efx) { __le64 *dma_stats = efx->stats_buffer.addr; int attempts = EFX_MAC_STATS_WAIT_ATTEMPTS; @@ -1223,7 +1217,7 @@ void efx_mcdi_mac_pull_stats(struct efx_nic *efx) udelay(EFX_MAC_STATS_WAIT_US); } -int efx_mcdi_mac_init_stats(struct efx_nic *efx) +int efx_siena_mcdi_mac_init_stats(struct efx_nic *efx) { int rc; @@ -1248,25 +1242,11 @@ int efx_mcdi_mac_init_stats(struct efx_nic *efx) return 0; } -void efx_mcdi_mac_fini_stats(struct efx_nic *efx) +void efx_siena_mcdi_mac_fini_stats(struct efx_nic *efx) { efx_nic_free_buffer(efx, &efx->stats_buffer); } -/* Get physical port number (EF10 only; on Siena it is same as PF number) */ -int efx_mcdi_port_get_number(struct efx_nic *efx) -{ - MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_PORT_ASSIGNMENT_OUT_LEN); - int rc; - - rc = efx_mcdi_rpc(efx, MC_CMD_GET_PORT_ASSIGNMENT, NULL, 0, - outbuf, sizeof(outbuf), NULL); - if (rc) - return rc; - - return MCDI_DWORD(outbuf, GET_PORT_ASSIGNMENT_OUT_PORT); -} - static unsigned int efx_mcdi_event_link_speed[] = { [MCDI_EVENT_LINKCHANGE_SPEED_100M] = 100, [MCDI_EVENT_LINKCHANGE_SPEED_1G] = 1000, @@ -1277,7 +1257,7 @@ static unsigned int efx_mcdi_event_link_speed[] = { [MCDI_EVENT_LINKCHANGE_SPEED_100G] = 100000, }; -void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev) +void efx_siena_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev) { u32 flags, fcntl, speed, lpa; diff --git a/drivers/net/ethernet/sfc/siena/mcdi_port_common.h b/drivers/net/ethernet/sfc/siena/mcdi_port_common.h index ed31690e591c..7a6de13d9ce6 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi_port_common.h +++ b/drivers/net/ethernet/sfc/siena/mcdi_port_common.h @@ -28,40 +28,31 @@ struct efx_mcdi_phy_data { u32 forced_cap; }; -int efx_mcdi_get_phy_cfg(struct efx_nic *efx, struct efx_mcdi_phy_data *cfg); -void efx_link_set_advertising(struct efx_nic *efx, - const unsigned long *advertising); -int efx_mcdi_set_link(struct efx_nic *efx, u32 capabilities, - u32 flags, u32 loopback_mode, u32 loopback_speed); -int efx_mcdi_loopback_modes(struct efx_nic *efx, u64 *loopback_modes); -void mcdi_to_ethtool_linkset(u32 media, u32 cap, unsigned long *linkset); -u32 ethtool_linkset_to_mcdi_cap(const unsigned long *linkset); -u32 efx_get_mcdi_phy_flags(struct efx_nic *efx); -u8 mcdi_to_ethtool_media(u32 media); -void efx_mcdi_phy_decode_link(struct efx_nic *efx, - struct efx_link_state *link_state, - u32 speed, u32 flags, u32 fcntl); -u32 ethtool_fec_caps_to_mcdi(u32 supported_cap, u32 ethtool_cap); -u32 mcdi_fec_caps_to_ethtool(u32 caps, bool is_25g); -void efx_mcdi_phy_check_fcntl(struct efx_nic *efx, u32 lpa); -bool efx_mcdi_phy_poll(struct efx_nic *efx); -int efx_mcdi_phy_probe(struct efx_nic *efx); -void efx_mcdi_phy_remove(struct efx_nic *efx); -void efx_mcdi_phy_get_link_ksettings(struct efx_nic *efx, struct ethtool_link_ksettings *cmd); -int efx_mcdi_phy_set_link_ksettings(struct efx_nic *efx, const struct ethtool_link_ksettings *cmd); -int efx_mcdi_phy_get_fecparam(struct efx_nic *efx, struct ethtool_fecparam *fec); -int efx_mcdi_phy_set_fecparam(struct efx_nic *efx, const struct ethtool_fecparam *fec); -int efx_mcdi_phy_test_alive(struct efx_nic *efx); -int efx_mcdi_port_reconfigure(struct efx_nic *efx); -int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results, unsigned int flags); -const char *efx_mcdi_phy_test_name(struct efx_nic *efx, unsigned int index); -int efx_mcdi_phy_get_module_eeprom(struct efx_nic *efx, struct ethtool_eeprom *ee, u8 *data); -int efx_mcdi_phy_get_module_info(struct efx_nic *efx, struct ethtool_modinfo *modinfo); -int efx_mcdi_set_mac(struct efx_nic *efx); -int efx_mcdi_set_mtu(struct efx_nic *efx); -int efx_mcdi_mac_init_stats(struct efx_nic *efx); -void efx_mcdi_mac_fini_stats(struct efx_nic *efx); -int efx_mcdi_port_get_number(struct efx_nic *efx); -void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev); +void efx_siena_link_set_advertising(struct efx_nic *efx, + const unsigned long *advertising); +bool efx_siena_mcdi_phy_poll(struct efx_nic *efx); +int efx_siena_mcdi_phy_probe(struct efx_nic *efx); +void efx_siena_mcdi_phy_remove(struct efx_nic *efx); +void efx_siena_mcdi_phy_get_link_ksettings(struct efx_nic *efx, + struct ethtool_link_ksettings *cmd); +int efx_siena_mcdi_phy_set_link_ksettings(struct efx_nic *efx, + const struct ethtool_link_ksettings *cmd); +int efx_siena_mcdi_phy_get_fecparam(struct efx_nic *efx, + struct ethtool_fecparam *fec); +int efx_siena_mcdi_phy_set_fecparam(struct efx_nic *efx, + const struct ethtool_fecparam *fec); +int efx_siena_mcdi_phy_test_alive(struct efx_nic *efx); +int efx_siena_mcdi_port_reconfigure(struct efx_nic *efx); +int efx_siena_mcdi_phy_run_tests(struct efx_nic *efx, int *results, + unsigned int flags); +const char *efx_siena_mcdi_phy_test_name(struct efx_nic *efx, + unsigned int index); +int efx_siena_mcdi_phy_get_module_eeprom(struct efx_nic *efx, + struct ethtool_eeprom *ee, u8 *data); +int efx_siena_mcdi_phy_get_module_info(struct efx_nic *efx, + struct ethtool_modinfo *modinfo); +int efx_siena_mcdi_set_mac(struct efx_nic *efx); +int efx_siena_mcdi_mac_init_stats(struct efx_nic *efx); +void efx_siena_mcdi_mac_fini_stats(struct efx_nic *efx); #endif diff --git a/drivers/net/ethernet/sfc/siena/ptp.c b/drivers/net/ethernet/sfc/siena/ptp.c index b67417063a80..5b4717520c3e 100644 --- a/drivers/net/ethernet/sfc/siena/ptp.c +++ b/drivers/net/ethernet/sfc/siena/ptp.c @@ -426,8 +426,8 @@ size_t efx_siena_ptp_update_stats(struct efx_nic *efx, u64 *stats) */ MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_STATUS); MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); - rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), NULL); if (rc) memset(outbuf, 0, sizeof(outbuf)); efx_nic_update_stats(efx_ptp_stat_desc, PTP_STAT_COUNT, @@ -641,8 +641,8 @@ static int efx_ptp_get_attributes(struct efx_nic *efx) */ MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_GET_ATTRIBUTES); MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); - rc = efx_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &out_len); + rc = efx_siena_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), &out_len); if (rc == 0) { fmt = MCDI_DWORD(outbuf, PTP_OUT_GET_ATTRIBUTES_TIME_FORMAT); } else if (rc == -EINVAL) { @@ -651,8 +651,8 @@ static int efx_ptp_get_attributes(struct efx_nic *efx) pci_info(efx->pci_dev, "no PTP support\n"); return rc; } else { - efx_mcdi_display_error(efx, MC_CMD_PTP, sizeof(inbuf), - outbuf, sizeof(outbuf), rc); + efx_siena_mcdi_display_error(efx, MC_CMD_PTP, sizeof(inbuf), + outbuf, sizeof(outbuf), rc); return rc; } @@ -739,8 +739,8 @@ static int efx_ptp_get_timestamp_corrections(struct efx_nic *efx) MC_CMD_PTP_OP_GET_TIMESTAMP_CORRECTIONS); MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); - rc = efx_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), &out_len); + rc = efx_siena_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), &out_len); if (rc == 0) { efx->ptp_data->ts_corrections.ptp_tx = MCDI_DWORD(outbuf, PTP_OUT_GET_TIMESTAMP_CORRECTIONS_TRANSMIT); @@ -772,8 +772,8 @@ static int efx_ptp_get_timestamp_corrections(struct efx_nic *efx) efx->ptp_data->ts_corrections.general_tx = 0; efx->ptp_data->ts_corrections.general_rx = 0; } else { - efx_mcdi_display_error(efx, MC_CMD_PTP, sizeof(inbuf), outbuf, - sizeof(outbuf), rc); + efx_siena_mcdi_display_error(efx, MC_CMD_PTP, sizeof(inbuf), + outbuf, sizeof(outbuf), rc); return rc; } @@ -794,13 +794,13 @@ static int efx_ptp_enable(struct efx_nic *efx) efx->ptp_data->channel->channel : 0); MCDI_SET_DWORD(inbuf, PTP_IN_ENABLE_MODE, efx->ptp_data->mode); - rc = efx_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), NULL); + rc = efx_siena_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), NULL); rc = (rc == -EALREADY) ? 0 : rc; if (rc) - efx_mcdi_display_error(efx, MC_CMD_PTP, - MC_CMD_PTP_IN_ENABLE_LEN, - outbuf, sizeof(outbuf), rc); + efx_siena_mcdi_display_error(efx, MC_CMD_PTP, + MC_CMD_PTP_IN_ENABLE_LEN, + outbuf, sizeof(outbuf), rc); return rc; } @@ -817,8 +817,8 @@ static int efx_ptp_disable(struct efx_nic *efx) MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_DISABLE); MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); - rc = efx_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), NULL); + rc = efx_siena_mcdi_rpc_quiet(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), NULL); rc = (rc == -EALREADY) ? 0 : rc; /* If we get ENOSYS, the NIC doesn't support PTP, and thus this function * should only have been called during probe. @@ -826,9 +826,9 @@ static int efx_ptp_disable(struct efx_nic *efx) if (rc == -ENOSYS || rc == -EPERM) pci_info(efx->pci_dev, "no PTP support\n"); else if (rc) - efx_mcdi_display_error(efx, MC_CMD_PTP, - MC_CMD_PTP_IN_DISABLE_LEN, - outbuf, sizeof(outbuf), rc); + efx_siena_mcdi_display_error(efx, MC_CMD_PTP, + MC_CMD_PTP_IN_DISABLE_LEN, + outbuf, sizeof(outbuf), rc); return rc; } @@ -1042,8 +1042,8 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings) /* Clear flag that signals MC ready */ WRITE_ONCE(*start, 0); - rc = efx_mcdi_rpc_start(efx, MC_CMD_PTP, synch_buf, - MC_CMD_PTP_IN_SYNCHRONIZE_LEN); + rc = efx_siena_mcdi_rpc_start(efx, MC_CMD_PTP, synch_buf, + MC_CMD_PTP_IN_SYNCHRONIZE_LEN); EFX_WARN_ON_ONCE_PARANOID(rc); /* Wait for start from MCDI (or timeout) */ @@ -1062,10 +1062,10 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings) efx_ptp_send_times(efx, &last_time); /* Collect results */ - rc = efx_mcdi_rpc_finish(efx, MC_CMD_PTP, - MC_CMD_PTP_IN_SYNCHRONIZE_LEN, - synch_buf, sizeof(synch_buf), - &response_length); + rc = efx_siena_mcdi_rpc_finish(efx, MC_CMD_PTP, + MC_CMD_PTP_IN_SYNCHRONIZE_LEN, + synch_buf, sizeof(synch_buf), + &response_length); if (rc == 0) { rc = efx_ptp_process_times(efx, synch_buf, response_length, &last_time); @@ -1127,9 +1127,9 @@ static void efx_ptp_xmit_skb_mc(struct efx_nic *efx, struct sk_buff *skb) MCDI_PTR(ptp_data->txbuf, PTP_IN_TRANSMIT_PACKET), skb->len); - rc = efx_mcdi_rpc(efx, MC_CMD_PTP, - ptp_data->txbuf, MC_CMD_PTP_IN_TRANSMIT_LEN(skb->len), - txtime, sizeof(txtime), &len); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_PTP, ptp_data->txbuf, + MC_CMD_PTP_IN_TRANSMIT_LEN(skb->len), txtime, + sizeof(txtime), &len); if (rc != 0) goto fail; @@ -2068,8 +2068,8 @@ static int efx_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta) MCDI_SET_QWORD(inadj, PTP_IN_ADJUST_FREQ, adjustment_ns); MCDI_SET_DWORD(inadj, PTP_IN_ADJUST_SECONDS, 0); MCDI_SET_DWORD(inadj, PTP_IN_ADJUST_NANOSECONDS, 0); - rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inadj, sizeof(inadj), - NULL, 0, NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_PTP, inadj, sizeof(inadj), + NULL, 0, NULL); if (rc != 0) return rc; @@ -2093,8 +2093,8 @@ static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) MCDI_SET_QWORD(inbuf, PTP_IN_ADJUST_FREQ, ptp_data->current_adjfreq); MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_MAJOR, nic_major); MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_MINOR, nic_minor); - return efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), - NULL, 0, NULL); + return efx_siena_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), + NULL, 0, NULL); } static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) @@ -2111,8 +2111,8 @@ static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_READ_NIC_TIME); MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); - rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), - outbuf, sizeof(outbuf), NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), + outbuf, sizeof(outbuf), NULL); if (rc != 0) return rc; diff --git a/drivers/net/ethernet/sfc/siena/selftest.c b/drivers/net/ethernet/sfc/siena/selftest.c index 83bd27df30d4..2d70b3356ddf 100644 --- a/drivers/net/ethernet/sfc/siena/selftest.c +++ b/drivers/net/ethernet/sfc/siena/selftest.c @@ -100,7 +100,7 @@ static int efx_test_phy_alive(struct efx_nic *efx, struct efx_self_tests *tests) { int rc = 0; - rc = efx_mcdi_phy_test_alive(efx); + rc = efx_siena_mcdi_phy_test_alive(efx); tests->phy_alive = rc ? -1 : 1; return rc; @@ -257,7 +257,7 @@ static int efx_test_phy(struct efx_nic *efx, struct efx_self_tests *tests, int rc; mutex_lock(&efx->mac_lock); - rc = efx_mcdi_phy_run_tests(efx, tests->phy_ext, flags); + rc = efx_siena_mcdi_phy_run_tests(efx, tests->phy_ext, flags); mutex_unlock(&efx->mac_lock); if (rc == -EPERM) rc = 0; diff --git a/drivers/net/ethernet/sfc/siena/siena.c b/drivers/net/ethernet/sfc/siena/siena.c index d70e481d0c73..74ed8e972c93 100644 --- a/drivers/net/ethernet/sfc/siena/siena.c +++ b/drivers/net/ethernet/sfc/siena/siena.c @@ -59,13 +59,13 @@ static void siena_push_irq_moderation(struct efx_channel *channel) void efx_siena_prepare_flush(struct efx_nic *efx) { if (efx->fc_disable++ == 0) - efx_mcdi_set_mac(efx); + efx_siena_mcdi_set_mac(efx); } void siena_finish_flush(struct efx_nic *efx) { if (--efx->fc_disable == 0) - efx_mcdi_set_mac(efx); + efx_siena_mcdi_set_mac(efx); } static const struct efx_farch_register_test siena_register_tests[] = { @@ -107,7 +107,7 @@ static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) /* Reset the chip immediately so that it is completely * quiescent regardless of what any VF driver does. */ - rc = efx_mcdi_reset(efx, reset_method); + rc = efx_siena_mcdi_reset(efx, reset_method); if (rc) goto out; @@ -116,7 +116,7 @@ static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) ARRAY_SIZE(siena_register_tests)) ? -1 : 1; - rc = efx_mcdi_reset(efx, reset_method); + rc = efx_siena_mcdi_reset(efx, reset_method); out: rc2 = efx_siena_reset_up(efx, reset_method, rc == 0); return rc ? rc : rc2; @@ -223,7 +223,8 @@ static int siena_probe_nvconfig(struct efx_nic *efx) u32 caps = 0; int rc; - rc = efx_mcdi_get_board_cfg(efx, efx->net_dev->perm_addr, NULL, &caps); + rc = efx_siena_mcdi_get_board_cfg(efx, efx->net_dev->perm_addr, NULL, + &caps); efx->timer_quantum_ns = (caps & (1 << MC_CMD_CAPABILITIES_TURBO_ACTIVE_LBN)) ? @@ -286,12 +287,12 @@ static int siena_probe_nic(struct efx_nic *efx) efx_reado(efx, ®, FR_AZ_CS_DEBUG); efx->port_num = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1; - rc = efx_mcdi_init(efx); + rc = efx_siena_mcdi_init(efx); if (rc) goto fail1; /* Now we can reset the NIC */ - rc = efx_mcdi_reset(efx, RESET_TYPE_ALL); + rc = efx_siena_mcdi_reset(efx, RESET_TYPE_ALL); if (rc) { netif_err(efx, probe, efx->net_dev, "failed to reset NIC\n"); goto fail3; @@ -323,7 +324,7 @@ static int siena_probe_nic(struct efx_nic *efx) goto fail5; } - rc = efx_mcdi_mon_probe(efx); + rc = efx_siena_mcdi_mon_probe(efx); if (rc) goto fail5; @@ -338,8 +339,8 @@ static int siena_probe_nic(struct efx_nic *efx) efx_nic_free_buffer(efx, &efx->irq_status); fail4: fail3: - efx_mcdi_detach(efx); - efx_mcdi_fini(efx); + efx_siena_mcdi_detach(efx); + efx_siena_mcdi_fini(efx); fail1: kfree(efx->nic_data); return rc; @@ -406,7 +407,7 @@ static int siena_init_nic(struct efx_nic *efx) int rc; /* Recover from a failed assertion post-reset */ - rc = efx_mcdi_handle_assertion(efx); + rc = efx_siena_mcdi_handle_assertion(efx); if (rc) return rc; @@ -440,7 +441,7 @@ static int siena_init_nic(struct efx_nic *efx) efx->rss_context.context_id = 0; /* indicates RSS is active */ /* Enable event logging */ - rc = efx_mcdi_log_ctrl(efx, true, false, 0); + rc = efx_siena_mcdi_log_ctrl(efx, true, false, 0); if (rc) return rc; @@ -457,14 +458,14 @@ static int siena_init_nic(struct efx_nic *efx) static void siena_remove_nic(struct efx_nic *efx) { - efx_mcdi_mon_remove(efx); + efx_siena_mcdi_mon_remove(efx); efx_nic_free_buffer(efx, &efx->irq_status); - efx_mcdi_reset(efx, RESET_TYPE_ALL); + efx_siena_mcdi_reset(efx, RESET_TYPE_ALL); - efx_mcdi_detach(efx); - efx_mcdi_fini(efx); + efx_siena_mcdi_detach(efx); + efx_siena_mcdi_fini(efx); /* Tear down the private nic state */ kfree(efx->nic_data); @@ -649,14 +650,14 @@ static int siena_mac_reconfigure(struct efx_nic *efx, bool mtu_only __always_unu WARN_ON(!mutex_is_locked(&efx->mac_lock)); - rc = efx_mcdi_set_mac(efx); + rc = efx_siena_mcdi_set_mac(efx); if (rc != 0) return rc; memcpy(MCDI_PTR(inbuf, SET_MCAST_HASH_IN_HASH0), efx->multicast_hash.byte, sizeof(efx->multicast_hash)); - return efx_mcdi_rpc(efx, MC_CMD_SET_MCAST_HASH, - inbuf, sizeof(inbuf), NULL, 0, NULL); + return efx_siena_mcdi_rpc(efx, MC_CMD_SET_MCAST_HASH, + inbuf, sizeof(inbuf), NULL, 0, NULL); } /************************************************************************** @@ -689,16 +690,17 @@ static int siena_set_wol(struct efx_nic *efx, u32 type) if (type & WAKE_MAGIC) { if (nic_data->wol_filter_id != -1) - efx_mcdi_wol_filter_remove(efx, - nic_data->wol_filter_id); - rc = efx_mcdi_wol_filter_set_magic(efx, efx->net_dev->dev_addr, - &nic_data->wol_filter_id); + efx_siena_mcdi_wol_filter_remove(efx, + nic_data->wol_filter_id); + rc = efx_siena_mcdi_wol_filter_set_magic(efx, + efx->net_dev->dev_addr, + &nic_data->wol_filter_id); if (rc) goto fail; pci_wake_from_d3(efx->pci_dev, true); } else { - rc = efx_mcdi_wol_filter_reset(efx); + rc = efx_siena_mcdi_wol_filter_reset(efx); nic_data->wol_filter_id = -1; pci_wake_from_d3(efx->pci_dev, false); if (rc) @@ -718,12 +720,12 @@ static void siena_init_wol(struct efx_nic *efx) struct siena_nic_data *nic_data = efx->nic_data; int rc; - rc = efx_mcdi_wol_filter_get_magic(efx, &nic_data->wol_filter_id); + rc = efx_siena_mcdi_wol_filter_get_magic(efx, &nic_data->wol_filter_id); if (rc != 0) { /* If it failed, attempt to get into a synchronised * state with MC by resetting any set WoL filters */ - efx_mcdi_wol_filter_reset(efx); + efx_siena_mcdi_wol_filter_reset(efx); nic_data->wol_filter_id = -1; } else if (nic_data->wol_filter_id != -1) { pci_wake_from_d3(efx->pci_dev, true); @@ -869,7 +871,8 @@ static int siena_mtd_probe_partition(struct efx_nic *efx, if (info->port != efx_port_num(efx)) return -ENODEV; - rc = efx_mcdi_nvram_info(efx, type, &size, &erase_size, &protected); + rc = efx_siena_mcdi_nvram_info(efx, type, &size, &erase_size, + &protected); if (rc) return rc; if (protected) @@ -896,7 +899,7 @@ static int siena_mtd_get_fw_subtypes(struct efx_nic *efx, size_t i; int rc; - rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list, NULL); + rc = efx_siena_mcdi_get_board_cfg(efx, NULL, fw_subtype_list, NULL); if (rc) return rc; @@ -916,7 +919,7 @@ static int siena_mtd_probe(struct efx_nic *efx) ASSERT_RTNL(); - rc = efx_mcdi_nvram_types(efx, &nvram_types); + rc = efx_siena_mcdi_nvram_types(efx, &nvram_types); if (rc) return rc; @@ -987,11 +990,11 @@ const struct efx_nic_type siena_a0_nic_type = { #else .monitor = NULL, #endif - .map_reset_reason = efx_mcdi_map_reset_reason, + .map_reset_reason = efx_siena_mcdi_map_reset_reason, .map_reset_flags = siena_map_reset_flags, - .reset = efx_mcdi_reset, - .probe_port = efx_mcdi_port_probe, - .remove_port = efx_mcdi_port_remove, + .reset = efx_siena_mcdi_reset, + .probe_port = efx_siena_mcdi_port_probe, + .remove_port = efx_siena_mcdi_port_remove, .fini_dmaq = efx_farch_fini_dmaq, .prepare_flush = efx_siena_prepare_flush, .finish_flush = siena_finish_flush, @@ -999,18 +1002,18 @@ const struct efx_nic_type siena_a0_nic_type = { .finish_flr = efx_farch_finish_flr, .describe_stats = siena_describe_nic_stats, .update_stats = siena_update_nic_stats, - .start_stats = efx_mcdi_mac_start_stats, - .pull_stats = efx_mcdi_mac_pull_stats, - .stop_stats = efx_mcdi_mac_stop_stats, + .start_stats = efx_siena_mcdi_mac_start_stats, + .pull_stats = efx_siena_mcdi_mac_pull_stats, + .stop_stats = efx_siena_mcdi_mac_stop_stats, .push_irq_moderation = siena_push_irq_moderation, .reconfigure_mac = siena_mac_reconfigure, - .check_mac_fault = efx_mcdi_mac_check_fault, - .reconfigure_port = efx_mcdi_port_reconfigure, + .check_mac_fault = efx_siena_mcdi_mac_check_fault, + .reconfigure_port = efx_siena_mcdi_port_reconfigure, .get_wol = siena_get_wol, .set_wol = siena_set_wol, .resume_wol = siena_init_wol, .test_chip = siena_test_chip, - .test_nvram = efx_mcdi_nvram_test_all, + .test_nvram = efx_siena_mcdi_nvram_test_all, .mcdi_request = siena_mcdi_request, .mcdi_poll_response = siena_mcdi_poll_response, .mcdi_read_response = siena_mcdi_read_response, @@ -1057,11 +1060,11 @@ const struct efx_nic_type siena_a0_nic_type = { #endif #ifdef CONFIG_SFC_MTD .mtd_probe = siena_mtd_probe, - .mtd_rename = efx_mcdi_mtd_rename, - .mtd_read = efx_mcdi_mtd_read, - .mtd_erase = efx_mcdi_mtd_erase, - .mtd_write = efx_mcdi_mtd_write, - .mtd_sync = efx_mcdi_mtd_sync, + .mtd_rename = efx_siena_mcdi_mtd_rename, + .mtd_read = efx_siena_mcdi_mtd_read, + .mtd_erase = efx_siena_mcdi_mtd_erase, + .mtd_write = efx_siena_mcdi_mtd_write, + .mtd_sync = efx_siena_mcdi_mtd_sync, #endif .ptp_write_host_time = siena_ptp_write_host_time, .ptp_set_ts_config = siena_ptp_set_ts_config, @@ -1105,6 +1108,6 @@ const struct efx_nic_type siena_a0_nic_type = { 1 << HWTSTAMP_FILTER_PTP_V2_L4_EVENT), .rx_hash_key_size = 16, .check_caps = siena_check_caps, - .sensor_event = efx_mcdi_sensor_event, + .sensor_event = efx_siena_mcdi_sensor_event, .rx_recycle_ring_size = efx_siena_recycle_ring_size, }; diff --git a/drivers/net/ethernet/sfc/siena/siena_sriov.c b/drivers/net/ethernet/sfc/siena/siena_sriov.c index f8e14f0d2f34..fdfcf480fd47 100644 --- a/drivers/net/ethernet/sfc/siena/siena_sriov.c +++ b/drivers/net/ethernet/sfc/siena/siena_sriov.c @@ -206,8 +206,9 @@ static int efx_siena_sriov_cmd(struct efx_nic *efx, bool enable, MCDI_SET_DWORD(inbuf, SRIOV_IN_VI_BASE, EFX_VI_BASE); MCDI_SET_DWORD(inbuf, SRIOV_IN_VF_COUNT, efx->vf_count); - rc = efx_mcdi_rpc_quiet(efx, MC_CMD_SRIOV, inbuf, MC_CMD_SRIOV_IN_LEN, - outbuf, MC_CMD_SRIOV_OUT_LEN, &outlen); + rc = efx_siena_mcdi_rpc_quiet(efx, MC_CMD_SRIOV, inbuf, + MC_CMD_SRIOV_IN_LEN, outbuf, + MC_CMD_SRIOV_OUT_LEN, &outlen); if (rc) return rc; if (outlen < MC_CMD_SRIOV_OUT_LEN) @@ -288,7 +289,7 @@ static int efx_siena_sriov_memcpy(struct efx_nic *efx, ++req; } - rc = efx_mcdi_rpc(efx, MC_CMD_MEMCPY, inbuf, used, NULL, 0, NULL); + rc = efx_siena_mcdi_rpc(efx, MC_CMD_MEMCPY, inbuf, used, NULL, 0, NULL); out: mb(); /* Don't write source/read dest before DMA is complete */ @@ -712,7 +713,7 @@ static int efx_vfdi_fini_all_queues(struct siena_vf *vf) atomic_set(&vf->rxq_retry_count, 0); while (timeout && (vf->rxq_count || vf->txq_count)) { - rc = efx_mcdi_rpc(efx, MC_CMD_FLUSH_RX_QUEUES, inbuf, + rc = efx_siena_mcdi_rpc(efx, MC_CMD_FLUSH_RX_QUEUES, inbuf, MC_CMD_FLUSH_RX_QUEUES_IN_LEN(rxqs_count), NULL, 0, NULL); WARN_ON(rc < 0); From patchwork Mon May 9 15:32:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Habets X-Patchwork-Id: 12843797 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 8E83CC433F5 for ; Mon, 9 May 2022 15:33:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238434AbiEIPhN (ORCPT ); Mon, 9 May 2022 11:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238480AbiEIPhI (ORCPT ); Mon, 9 May 2022 11:37:08 -0400 Received: from mint-fitpc2.mph.net (unknown [81.168.73.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DF6E72311EC for ; Mon, 9 May 2022 08:32:59 -0700 (PDT) Received: from palantir17.mph.net (unknown [192.168.0.4]) by mint-fitpc2.mph.net (Postfix) with ESMTP id 4FD6A320190; Mon, 9 May 2022 16:32:58 +0100 (BST) Received: from localhost ([::1] helo=palantir17.mph.net) by palantir17.mph.net with esmtp (Exim 4.89) (envelope-from ) id 1no5Na-0001Rb-2T; Mon, 09 May 2022 16:32:58 +0100 Subject: [PATCH net-next v4 09/11] sfc/siena: Rename functions in nic_common.h to avoid conflicts with sfc From: Martin Habets To: kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, ecree.xilinx@gmail.com Date: Mon, 09 May 2022 16:32:58 +0100 Message-ID: <165211037776.5289.6641012357323706725.stgit@palantir17.mph.net> In-Reply-To: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> References: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org For siena use efx_siena_ as the function prefix. efx_nic_update_stats_atomic is only used in efx_common.c, so move it there. efx_nic_copy_stats is not used in Siena, so it is removed. Signed-off-by: Martin Habets --- drivers/net/ethernet/sfc/siena/efx.c | 6 +- drivers/net/ethernet/sfc/siena/efx_common.c | 10 ++- drivers/net/ethernet/sfc/siena/ethtool.c | 4 + drivers/net/ethernet/sfc/siena/farch.c | 4 + drivers/net/ethernet/sfc/siena/mcdi_mon.c | 9 +- drivers/net/ethernet/sfc/siena/mcdi_port_common.c | 7 +- drivers/net/ethernet/sfc/siena/nic.c | 79 +++++---------------- drivers/net/ethernet/sfc/siena/nic_common.h | 40 ++++------- drivers/net/ethernet/sfc/siena/ptp.c | 16 ++-- drivers/net/ethernet/sfc/siena/selftest.c | 8 +- drivers/net/ethernet/sfc/siena/siena.c | 20 +++-- drivers/net/ethernet/sfc/siena/siena_sriov.c | 22 +++--- drivers/net/ethernet/sfc/siena/tx.c | 4 + drivers/net/ethernet/sfc/siena/tx_common.c | 4 + 14 files changed, 95 insertions(+), 138 deletions(-) diff --git a/drivers/net/ethernet/sfc/siena/efx.c b/drivers/net/ethernet/sfc/siena/efx.c index 1bc5ee6220f0..d937704e416b 100644 --- a/drivers/net/ethernet/sfc/siena/efx.c +++ b/drivers/net/ethernet/sfc/siena/efx.c @@ -830,7 +830,7 @@ static void efx_pci_remove_main(struct efx_nic *efx) efx_siena_disable_interrupts(efx); efx_siena_clear_interrupt_affinity(efx); - efx_nic_fini_interrupt(efx); + efx_siena_fini_interrupt(efx); efx_fini_port(efx); efx->type->fini(efx); efx_siena_fini_napi(efx); @@ -939,7 +939,7 @@ static int efx_pci_probe_main(struct efx_nic *efx) goto fail4; } - rc = efx_nic_init_interrupt(efx); + rc = efx_siena_init_interrupt(efx); if (rc) goto fail5; @@ -952,7 +952,7 @@ static int efx_pci_probe_main(struct efx_nic *efx) fail6: efx_siena_clear_interrupt_affinity(efx); - efx_nic_fini_interrupt(efx); + efx_siena_fini_interrupt(efx); fail5: efx_fini_port(efx); fail4: diff --git a/drivers/net/ethernet/sfc/siena/efx_common.c b/drivers/net/ethernet/sfc/siena/efx_common.c index 3293221b9e9e..b44a7114e319 100644 --- a/drivers/net/ethernet/sfc/siena/efx_common.c +++ b/drivers/net/ethernet/sfc/siena/efx_common.c @@ -597,6 +597,14 @@ void efx_siena_stop_all(struct efx_nic *efx) efx_stop_datapath(efx); } +static size_t efx_siena_update_stats_atomic(struct efx_nic *efx, u64 *full_stats, + struct rtnl_link_stats64 *core_stats) +{ + if (efx->type->update_stats_atomic) + return efx->type->update_stats_atomic(efx, full_stats, core_stats); + return efx->type->update_stats(efx, full_stats, core_stats); +} + /* Context: process, dev_base_lock or RTNL held, non-blocking. */ void efx_siena_net_stats(struct net_device *net_dev, struct rtnl_link_stats64 *stats) @@ -604,7 +612,7 @@ void efx_siena_net_stats(struct net_device *net_dev, struct efx_nic *efx = netdev_priv(net_dev); spin_lock_bh(&efx->stats_lock); - efx_nic_update_stats_atomic(efx, NULL, stats); + efx_siena_update_stats_atomic(efx, NULL, stats); spin_unlock_bh(&efx->stats_lock); } diff --git a/drivers/net/ethernet/sfc/siena/ethtool.c b/drivers/net/ethernet/sfc/siena/ethtool.c index 5ee626ba4eb1..e4ec589216c1 100644 --- a/drivers/net/ethernet/sfc/siena/ethtool.c +++ b/drivers/net/ethernet/sfc/siena/ethtool.c @@ -55,7 +55,7 @@ static int efx_ethtool_phys_id(struct net_device *net_dev, static int efx_ethtool_get_regs_len(struct net_device *net_dev) { - return efx_nic_get_regs_len(netdev_priv(net_dev)); + return efx_siena_get_regs_len(netdev_priv(net_dev)); } static void efx_ethtool_get_regs(struct net_device *net_dev, @@ -64,7 +64,7 @@ static void efx_ethtool_get_regs(struct net_device *net_dev, struct efx_nic *efx = netdev_priv(net_dev); regs->version = efx->type->revision; - efx_nic_get_regs(efx, buf); + efx_siena_get_regs(efx, buf); } /* diff --git a/drivers/net/ethernet/sfc/siena/farch.c b/drivers/net/ethernet/sfc/siena/farch.c index ebd6fa408126..a24ba23fd19f 100644 --- a/drivers/net/ethernet/sfc/siena/farch.c +++ b/drivers/net/ethernet/sfc/siena/farch.c @@ -233,7 +233,7 @@ static int efx_alloc_special_buffer(struct efx_nic *efx, #endif len = ALIGN(len, EFX_BUF_SIZE); - if (efx_nic_alloc_buffer(efx, &buffer->buf, len, GFP_KERNEL)) + if (efx_siena_alloc_buffer(efx, &buffer->buf, len, GFP_KERNEL)) return -ENOMEM; buffer->entries = len / EFX_BUF_SIZE; BUG_ON(buffer->buf.dma_addr & (EFX_BUF_SIZE - 1)); @@ -269,7 +269,7 @@ efx_free_special_buffer(struct efx_nic *efx, struct efx_special_buffer *buffer) (u64)buffer->buf.dma_addr, buffer->buf.len, buffer->buf.addr, (u64)virt_to_phys(buffer->buf.addr)); - efx_nic_free_buffer(efx, &buffer->buf); + efx_siena_free_buffer(efx, &buffer->buf); buffer->entries = 0; } diff --git a/drivers/net/ethernet/sfc/siena/mcdi_mon.c b/drivers/net/ethernet/sfc/siena/mcdi_mon.c index eb44d4140925..d0c25dfda0d7 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi_mon.c +++ b/drivers/net/ethernet/sfc/siena/mcdi_mon.c @@ -336,10 +336,9 @@ int efx_siena_mcdi_mon_probe(struct efx_nic *efx) if (n_sensors == 0) return 0; - rc = efx_nic_alloc_buffer( - efx, &hwmon->dma_buf, - n_sensors * MC_CMD_SENSOR_VALUE_ENTRY_TYPEDEF_LEN, - GFP_KERNEL); + rc = efx_siena_alloc_buffer(efx, &hwmon->dma_buf, + n_sensors * MC_CMD_SENSOR_VALUE_ENTRY_TYPEDEF_LEN, + GFP_KERNEL); if (rc) return rc; @@ -526,7 +525,7 @@ void efx_siena_mcdi_mon_remove(struct efx_nic *efx) hwmon_device_unregister(hwmon->device); kfree(hwmon->attrs); kfree(hwmon->group.attrs); - efx_nic_free_buffer(efx, &hwmon->dma_buf); + efx_siena_free_buffer(efx, &hwmon->dma_buf); } #endif /* CONFIG_SFC_MCDI_MON */ diff --git a/drivers/net/ethernet/sfc/siena/mcdi_port_common.c b/drivers/net/ethernet/sfc/siena/mcdi_port_common.c index a842c139d76f..067fe0f4393a 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi_port_common.c +++ b/drivers/net/ethernet/sfc/siena/mcdi_port_common.c @@ -1225,8 +1225,9 @@ int efx_siena_mcdi_mac_init_stats(struct efx_nic *efx) return 0; /* Allocate buffer for stats */ - rc = efx_nic_alloc_buffer(efx, &efx->stats_buffer, - efx->num_mac_stats * sizeof(u64), GFP_KERNEL); + rc = efx_siena_alloc_buffer(efx, &efx->stats_buffer, + efx->num_mac_stats * sizeof(u64), + GFP_KERNEL); if (rc) { netif_warn(efx, probe, efx->net_dev, "failed to allocate DMA buffer: %d\n", rc); @@ -1244,7 +1245,7 @@ int efx_siena_mcdi_mac_init_stats(struct efx_nic *efx) void efx_siena_mcdi_mac_fini_stats(struct efx_nic *efx) { - efx_nic_free_buffer(efx, &efx->stats_buffer); + efx_siena_free_buffer(efx, &efx->stats_buffer); } static unsigned int efx_mcdi_event_link_speed[] = { diff --git a/drivers/net/ethernet/sfc/siena/nic.c b/drivers/net/ethernet/sfc/siena/nic.c index c59357178657..abf9a4adf139 100644 --- a/drivers/net/ethernet/sfc/siena/nic.c +++ b/drivers/net/ethernet/sfc/siena/nic.c @@ -28,8 +28,8 @@ * **************************************************************************/ -int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, - unsigned int len, gfp_t gfp_flags) +int efx_siena_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, + unsigned int len, gfp_t gfp_flags) { buffer->addr = dma_alloc_coherent(&efx->pci_dev->dev, len, &buffer->dma_addr, gfp_flags); @@ -39,7 +39,7 @@ int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, return 0; } -void efx_nic_free_buffer(struct efx_nic *efx, struct efx_buffer *buffer) +void efx_siena_free_buffer(struct efx_nic *efx, struct efx_buffer *buffer) { if (buffer->addr) { dma_free_coherent(&efx->pci_dev->dev, buffer->len, @@ -51,19 +51,19 @@ void efx_nic_free_buffer(struct efx_nic *efx, struct efx_buffer *buffer) /* Check whether an event is present in the eventq at the current * read pointer. Only useful for self-test. */ -bool efx_nic_event_present(struct efx_channel *channel) +bool efx_siena_event_present(struct efx_channel *channel) { return efx_event_present(efx_event(channel, channel->eventq_read_ptr)); } -void efx_nic_event_test_start(struct efx_channel *channel) +void efx_siena_event_test_start(struct efx_channel *channel) { channel->event_test_cpu = -1; smp_wmb(); channel->efx->type->ev_test_generate(channel); } -int efx_nic_irq_test_start(struct efx_nic *efx) +int efx_siena_irq_test_start(struct efx_nic *efx) { efx->last_irq_cpu = -1; smp_wmb(); @@ -73,7 +73,7 @@ int efx_nic_irq_test_start(struct efx_nic *efx) /* Hook interrupt handler(s) * Try MSI and then legacy interrupts. */ -int efx_nic_init_interrupt(struct efx_nic *efx) +int efx_siena_init_interrupt(struct efx_nic *efx) { struct efx_channel *channel; unsigned int n_irqs; @@ -146,7 +146,7 @@ int efx_nic_init_interrupt(struct efx_nic *efx) return rc; } -void efx_nic_fini_interrupt(struct efx_nic *efx) +void efx_siena_fini_interrupt(struct efx_nic *efx) { struct efx_channel *channel; @@ -364,7 +364,7 @@ static const struct efx_nic_reg_table efx_nic_reg_tables[] = { REGISTER_TABLE_BZ(RX_FILTER_TBL0), }; -size_t efx_nic_get_regs_len(struct efx_nic *efx) +size_t efx_siena_get_regs_len(struct efx_nic *efx) { const struct efx_nic_reg *reg; const struct efx_nic_reg_table *table; @@ -387,7 +387,7 @@ size_t efx_nic_get_regs_len(struct efx_nic *efx) return len; } -void efx_nic_get_regs(struct efx_nic *efx, void *buf) +void efx_siena_get_regs(struct efx_nic *efx, void *buf) { const struct efx_nic_reg *reg; const struct efx_nic_reg_table *table; @@ -439,7 +439,7 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf) } /** - * efx_nic_describe_stats - Describe supported statistics for ethtool + * efx_siena_describe_stats - Describe supported statistics for ethtool * @desc: Array of &struct efx_hw_stat_desc describing the statistics * @count: Length of the @desc array * @mask: Bitmask of which elements of @desc are enabled @@ -449,8 +449,8 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf) * Returns the number of visible statistics, i.e. the number of set * bits in the first @count bits of @mask for which a name is defined. */ -size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count, - const unsigned long *mask, u8 *names) +size_t efx_siena_describe_stats(const struct efx_hw_stat_desc *desc, size_t count, + const unsigned long *mask, u8 *names) { size_t visible = 0; size_t index; @@ -470,50 +470,7 @@ size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count, } /** - * efx_nic_copy_stats - Copy stats from the DMA buffer in to an - * intermediate buffer. This is used to get a consistent - * set of stats while the DMA buffer can be written at any time - * by the NIC. - * @efx: The associated NIC. - * @dest: Destination buffer. Must be the same size as the DMA buffer. - */ -int efx_nic_copy_stats(struct efx_nic *efx, __le64 *dest) -{ - __le64 *dma_stats = efx->stats_buffer.addr; - __le64 generation_start, generation_end; - int rc = 0, retry; - - if (!dest) - return 0; - - if (!dma_stats) - goto return_zeroes; - - /* If we're unlucky enough to read statistics during the DMA, wait - * up to 10ms for it to finish (typically takes <500us) - */ - for (retry = 0; retry < 100; ++retry) { - generation_end = dma_stats[efx->num_mac_stats - 1]; - if (generation_end == EFX_MC_STATS_GENERATION_INVALID) - goto return_zeroes; - rmb(); - memcpy(dest, dma_stats, efx->num_mac_stats * sizeof(__le64)); - rmb(); - generation_start = dma_stats[MC_CMD_MAC_GENERATION_START]; - if (generation_end == generation_start) - return 0; /* return good data */ - udelay(100); - } - - rc = -EIO; - -return_zeroes: - memset(dest, 0, efx->num_mac_stats * sizeof(u64)); - return rc; -} - -/** - * efx_nic_update_stats - Convert statistics DMA buffer to array of u64 + * efx_siena_update_stats - Convert statistics DMA buffer to array of u64 * @desc: Array of &struct efx_hw_stat_desc describing the DMA buffer * layout. DMA widths of 0, 16, 32 and 64 are supported; where * the width is specified as 0 the corresponding element of @@ -526,9 +483,9 @@ int efx_nic_copy_stats(struct efx_nic *efx, __le64 *dest) * @accumulate: If set, the converted values will be added rather than * directly stored to the corresponding elements of @stats */ -void efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count, - const unsigned long *mask, - u64 *stats, const void *dma_buf, bool accumulate) +void efx_siena_update_stats(const struct efx_hw_stat_desc *desc, size_t count, + const unsigned long *mask, + u64 *stats, const void *dma_buf, bool accumulate) { size_t index; @@ -561,7 +518,7 @@ void efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count, } } -void efx_nic_fix_nodesc_drop_stat(struct efx_nic *efx, u64 *rx_nodesc_drops) +void efx_siena_fix_nodesc_drop_stat(struct efx_nic *efx, u64 *rx_nodesc_drops) { /* if down, or this is the first update after coming up */ if (!(efx->net_dev->flags & IFF_UP) || !efx->rx_nodesc_drops_prev_state) diff --git a/drivers/net/ethernet/sfc/siena/nic_common.h b/drivers/net/ethernet/sfc/siena/nic_common.h index 47deeae0a034..3af0405eeaa4 100644 --- a/drivers/net/ethernet/sfc/siena/nic_common.h +++ b/drivers/net/ethernet/sfc/siena/nic_common.h @@ -182,9 +182,9 @@ static inline void efx_nic_eventq_read_ack(struct efx_channel *channel) channel->efx->type->ev_read_ack(channel); } -void efx_nic_event_test_start(struct efx_channel *channel); +void efx_siena_event_test_start(struct efx_channel *channel); -bool efx_nic_event_present(struct efx_channel *channel); +bool efx_siena_event_present(struct efx_channel *channel); static inline void efx_sensor_event(struct efx_nic *efx, efx_qword_t *ev) { @@ -216,9 +216,9 @@ static inline void efx_update_diff_stat(u64 *stat, u64 diff) } /* Interrupts */ -int efx_nic_init_interrupt(struct efx_nic *efx); -int efx_nic_irq_test_start(struct efx_nic *efx); -void efx_nic_fini_interrupt(struct efx_nic *efx); +int efx_siena_init_interrupt(struct efx_nic *efx); +int efx_siena_irq_test_start(struct efx_nic *efx); +void efx_siena_fini_interrupt(struct efx_nic *efx); static inline int efx_nic_event_test_irq_cpu(struct efx_channel *channel) { @@ -230,29 +230,21 @@ static inline int efx_nic_irq_test_irq_cpu(struct efx_nic *efx) } /* Global Resources */ -int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, - unsigned int len, gfp_t gfp_flags); -void efx_nic_free_buffer(struct efx_nic *efx, struct efx_buffer *buffer); +int efx_siena_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, + unsigned int len, gfp_t gfp_flags); +void efx_siena_free_buffer(struct efx_nic *efx, struct efx_buffer *buffer); -size_t efx_nic_get_regs_len(struct efx_nic *efx); -void efx_nic_get_regs(struct efx_nic *efx, void *buf); +size_t efx_siena_get_regs_len(struct efx_nic *efx); +void efx_siena_get_regs(struct efx_nic *efx, void *buf); #define EFX_MC_STATS_GENERATION_INVALID ((__force __le64)(-1)) -size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count, - const unsigned long *mask, u8 *names); -int efx_nic_copy_stats(struct efx_nic *efx, __le64 *dest); -void efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count, - const unsigned long *mask, u64 *stats, - const void *dma_buf, bool accumulate); -void efx_nic_fix_nodesc_drop_stat(struct efx_nic *efx, u64 *stat); -static inline size_t efx_nic_update_stats_atomic(struct efx_nic *efx, u64 *full_stats, - struct rtnl_link_stats64 *core_stats) -{ - if (efx->type->update_stats_atomic) - return efx->type->update_stats_atomic(efx, full_stats, core_stats); - return efx->type->update_stats(efx, full_stats, core_stats); -} +size_t efx_siena_describe_stats(const struct efx_hw_stat_desc *desc, size_t count, + const unsigned long *mask, u8 *names); +void efx_siena_update_stats(const struct efx_hw_stat_desc *desc, size_t count, + const unsigned long *mask, u64 *stats, + const void *dma_buf, bool accumulate); +void efx_siena_fix_nodesc_drop_stat(struct efx_nic *efx, u64 *stat); #define EFX_MAX_FLUSH_TIME 5000 diff --git a/drivers/net/ethernet/sfc/siena/ptp.c b/drivers/net/ethernet/sfc/siena/ptp.c index 5b4717520c3e..8e18da096595 100644 --- a/drivers/net/ethernet/sfc/siena/ptp.c +++ b/drivers/net/ethernet/sfc/siena/ptp.c @@ -398,8 +398,8 @@ size_t efx_siena_ptp_describe_stats(struct efx_nic *efx, u8 *strings) if (!efx->ptp_data) return 0; - return efx_nic_describe_stats(efx_ptp_stat_desc, PTP_STAT_COUNT, - efx_ptp_stat_mask, strings); + return efx_siena_describe_stats(efx_ptp_stat_desc, PTP_STAT_COUNT, + efx_ptp_stat_mask, strings); } size_t efx_siena_ptp_update_stats(struct efx_nic *efx, u64 *stats) @@ -430,9 +430,9 @@ size_t efx_siena_ptp_update_stats(struct efx_nic *efx, u64 *stats) outbuf, sizeof(outbuf), NULL); if (rc) memset(outbuf, 0, sizeof(outbuf)); - efx_nic_update_stats(efx_ptp_stat_desc, PTP_STAT_COUNT, - efx_ptp_stat_mask, - stats, _MCDI_PTR(outbuf, 0), false); + efx_siena_update_stats(efx_ptp_stat_desc, PTP_STAT_COUNT, + efx_ptp_stat_mask, + stats, _MCDI_PTR(outbuf, 0), false); return PTP_STAT_COUNT; } @@ -1452,7 +1452,7 @@ static int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel) ptp->channel = channel; ptp->rx_ts_inline = efx_nic_rev(efx) >= EFX_REV_HUNT_A0; - rc = efx_nic_alloc_buffer(efx, &ptp->start, sizeof(int), GFP_KERNEL); + rc = efx_siena_alloc_buffer(efx, &ptp->start, sizeof(int), GFP_KERNEL); if (rc != 0) goto fail1; @@ -1519,7 +1519,7 @@ static int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel) destroy_workqueue(efx->ptp_data->workwq); fail2: - efx_nic_free_buffer(efx, &ptp->start); + efx_siena_free_buffer(efx, &ptp->start); fail1: kfree(efx->ptp_data); @@ -1574,7 +1574,7 @@ static void efx_ptp_remove(struct efx_nic *efx) destroy_workqueue(efx->ptp_data->workwq); - efx_nic_free_buffer(efx, &efx->ptp_data->start); + efx_siena_free_buffer(efx, &efx->ptp_data->start); kfree(efx->ptp_data); efx->ptp_data = NULL; } diff --git a/drivers/net/ethernet/sfc/siena/selftest.c b/drivers/net/ethernet/sfc/siena/selftest.c index 2d70b3356ddf..07715a3d6bea 100644 --- a/drivers/net/ethernet/sfc/siena/selftest.c +++ b/drivers/net/ethernet/sfc/siena/selftest.c @@ -138,7 +138,7 @@ static int efx_test_interrupts(struct efx_nic *efx, netif_dbg(efx, drv, efx->net_dev, "testing interrupts\n"); tests->interrupt = -1; - rc = efx_nic_irq_test_start(efx); + rc = efx_siena_irq_test_start(efx); if (rc == -ENOTSUPP) { netif_dbg(efx, drv, efx->net_dev, "direct interrupt testing not supported\n"); @@ -184,7 +184,7 @@ static int efx_test_eventq_irq(struct efx_nic *efx, read_ptr[channel->channel] = channel->eventq_read_ptr; set_bit(channel->channel, &dma_pend); set_bit(channel->channel, &int_pend); - efx_nic_event_test_start(channel); + efx_siena_event_test_start(channel); } timeout = jiffies + IRQ_TIMEOUT; @@ -204,7 +204,7 @@ static int efx_test_eventq_irq(struct efx_nic *efx, clear_bit(channel->channel, &dma_pend); clear_bit(channel->channel, &int_pend); } else { - if (efx_nic_event_present(channel)) + if (efx_siena_event_present(channel)) clear_bit(channel->channel, &dma_pend); if (efx_nic_event_test_irq_cpu(channel) >= 0) clear_bit(channel->channel, &int_pend); @@ -772,7 +772,7 @@ void efx_siena_selftest_async_start(struct efx_nic *efx) struct efx_channel *channel; efx_for_each_channel(channel, efx) - efx_nic_event_test_start(channel); + efx_siena_event_test_start(channel); schedule_delayed_work(&efx->selftest_work, IRQ_TIMEOUT); } diff --git a/drivers/net/ethernet/sfc/siena/siena.c b/drivers/net/ethernet/sfc/siena/siena.c index 74ed8e972c93..741313aff1d1 100644 --- a/drivers/net/ethernet/sfc/siena/siena.c +++ b/drivers/net/ethernet/sfc/siena/siena.c @@ -301,8 +301,8 @@ static int siena_probe_nic(struct efx_nic *efx) siena_init_wol(efx); /* Allocate memory for INT_KER */ - rc = efx_nic_alloc_buffer(efx, &efx->irq_status, sizeof(efx_oword_t), - GFP_KERNEL); + rc = efx_siena_alloc_buffer(efx, &efx->irq_status, sizeof(efx_oword_t), + GFP_KERNEL); if (rc) goto fail4; BUG_ON(efx->irq_status.dma_addr & 0x0f); @@ -336,7 +336,7 @@ static int siena_probe_nic(struct efx_nic *efx) return 0; fail5: - efx_nic_free_buffer(efx, &efx->irq_status); + efx_siena_free_buffer(efx, &efx->irq_status); fail4: fail3: efx_siena_mcdi_detach(efx); @@ -460,7 +460,7 @@ static void siena_remove_nic(struct efx_nic *efx) { efx_siena_mcdi_mon_remove(efx); - efx_nic_free_buffer(efx, &efx->irq_status); + efx_siena_free_buffer(efx, &efx->irq_status); efx_siena_mcdi_reset(efx, RESET_TYPE_ALL); @@ -547,8 +547,8 @@ static const unsigned long siena_stat_mask[] = { static size_t siena_describe_nic_stats(struct efx_nic *efx, u8 *names) { - return efx_nic_describe_stats(siena_stat_desc, SIENA_STAT_COUNT, - siena_stat_mask, names); + return efx_siena_describe_stats(siena_stat_desc, SIENA_STAT_COUNT, + siena_stat_mask, names); } static int siena_try_update_nic_stats(struct efx_nic *efx) @@ -564,16 +564,16 @@ static int siena_try_update_nic_stats(struct efx_nic *efx) if (generation_end == EFX_MC_STATS_GENERATION_INVALID) return 0; rmb(); - efx_nic_update_stats(siena_stat_desc, SIENA_STAT_COUNT, siena_stat_mask, - stats, efx->stats_buffer.addr, false); + efx_siena_update_stats(siena_stat_desc, SIENA_STAT_COUNT, siena_stat_mask, + stats, efx->stats_buffer.addr, false); rmb(); generation_start = dma_stats[MC_CMD_MAC_GENERATION_START]; if (generation_end != generation_start) return -EAGAIN; /* Update derived statistics */ - efx_nic_fix_nodesc_drop_stat(efx, - &stats[SIENA_STAT_rx_nodesc_drop_cnt]); + efx_siena_fix_nodesc_drop_stat(efx, + &stats[SIENA_STAT_rx_nodesc_drop_cnt]); efx_update_diff_stat(&stats[SIENA_STAT_tx_good_bytes], stats[SIENA_STAT_tx_bytes] - stats[SIENA_STAT_tx_bad_bytes]); diff --git a/drivers/net/ethernet/sfc/siena/siena_sriov.c b/drivers/net/ethernet/sfc/siena/siena_sriov.c index fdfcf480fd47..8353c15dc233 100644 --- a/drivers/net/ethernet/sfc/siena/siena_sriov.c +++ b/drivers/net/ethernet/sfc/siena/siena_sriov.c @@ -1012,9 +1012,9 @@ static void efx_siena_sriov_reset_vf_work(struct work_struct *work) struct efx_nic *efx = vf->efx; struct efx_buffer buf; - if (!efx_nic_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO)) { + if (!efx_siena_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO)) { efx_siena_sriov_reset_vf(vf, &buf); - efx_nic_free_buffer(efx, &buf); + efx_siena_free_buffer(efx, &buf); } } @@ -1229,7 +1229,7 @@ static void efx_siena_sriov_vfs_fini(struct efx_nic *efx) for (pos = 0; pos < efx->vf_count; ++pos) { vf = nic_data->vf + pos; - efx_nic_free_buffer(efx, &vf->buf); + efx_siena_free_buffer(efx, &vf->buf); kfree(vf->peer_page_addrs); vf->peer_page_addrs = NULL; vf->peer_page_count = 0; @@ -1269,8 +1269,8 @@ static int efx_siena_sriov_vfs_init(struct efx_nic *efx) pci_domain_nr(pci_dev->bus), pci_dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); - rc = efx_nic_alloc_buffer(efx, &vf->buf, EFX_PAGE_SIZE, - GFP_KERNEL); + rc = efx_siena_alloc_buffer(efx, &vf->buf, EFX_PAGE_SIZE, + GFP_KERNEL); if (rc) goto fail; @@ -1303,8 +1303,8 @@ int efx_siena_sriov_init(struct efx_nic *efx) if (rc) goto fail_cmd; - rc = efx_nic_alloc_buffer(efx, &nic_data->vfdi_status, - sizeof(*vfdi_status), GFP_KERNEL); + rc = efx_siena_alloc_buffer(efx, &nic_data->vfdi_status, + sizeof(*vfdi_status), GFP_KERNEL); if (rc) goto fail_status; vfdi_status = nic_data->vfdi_status.addr; @@ -1359,7 +1359,7 @@ int efx_siena_sriov_init(struct efx_nic *efx) efx_siena_sriov_free_local(efx); kfree(nic_data->vf); fail_alloc: - efx_nic_free_buffer(efx, &nic_data->vfdi_status); + efx_siena_free_buffer(efx, &nic_data->vfdi_status); fail_status: efx_siena_sriov_cmd(efx, false, NULL, NULL); fail_cmd: @@ -1396,7 +1396,7 @@ void efx_siena_sriov_fini(struct efx_nic *efx) efx_siena_sriov_vfs_fini(efx); efx_siena_sriov_free_local(efx); kfree(nic_data->vf); - efx_nic_free_buffer(efx, &nic_data->vfdi_status); + efx_siena_free_buffer(efx, &nic_data->vfdi_status); efx_siena_sriov_cmd(efx, false, NULL, NULL); } @@ -1564,7 +1564,7 @@ void efx_siena_sriov_reset(struct efx_nic *efx) efx_siena_sriov_usrev(efx, true); (void)efx_siena_sriov_cmd(efx, true, NULL, NULL); - if (efx_nic_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO)) + if (efx_siena_alloc_buffer(efx, &buf, EFX_PAGE_SIZE, GFP_NOIO)) return; for (vf_i = 0; vf_i < efx->vf_init_count; ++vf_i) { @@ -1572,7 +1572,7 @@ void efx_siena_sriov_reset(struct efx_nic *efx) efx_siena_sriov_reset_vf(vf, &buf); } - efx_nic_free_buffer(efx, &buf); + efx_siena_free_buffer(efx, &buf); } int efx_init_sriov(void) diff --git a/drivers/net/ethernet/sfc/siena/tx.c b/drivers/net/ethernet/sfc/siena/tx.c index ef238e9efa94..b84b9e348c13 100644 --- a/drivers/net/ethernet/sfc/siena/tx.c +++ b/drivers/net/ethernet/sfc/siena/tx.c @@ -33,8 +33,8 @@ static inline u8 *efx_tx_get_copy_buffer(struct efx_tx_queue *tx_queue, ((index << EFX_TX_CB_ORDER) + NET_IP_ALIGN) & (PAGE_SIZE - 1); if (unlikely(!page_buf->addr) && - efx_nic_alloc_buffer(tx_queue->efx, page_buf, PAGE_SIZE, - GFP_ATOMIC)) + efx_siena_alloc_buffer(tx_queue->efx, page_buf, PAGE_SIZE, + GFP_ATOMIC)) return NULL; buffer->dma_addr = page_buf->dma_addr + offset; buffer->unmap_len = 0; diff --git a/drivers/net/ethernet/sfc/siena/tx_common.c b/drivers/net/ethernet/sfc/siena/tx_common.c index 31e9888e71df..93a32d61944f 100644 --- a/drivers/net/ethernet/sfc/siena/tx_common.c +++ b/drivers/net/ethernet/sfc/siena/tx_common.c @@ -107,8 +107,8 @@ void efx_siena_remove_tx_queue(struct efx_tx_queue *tx_queue) if (tx_queue->cb_page) { for (i = 0; i < efx_tx_cb_page_count(tx_queue); i++) - efx_nic_free_buffer(tx_queue->efx, - &tx_queue->cb_page[i]); + efx_siena_free_buffer(tx_queue->efx, + &tx_queue->cb_page[i]); kfree(tx_queue->cb_page); tx_queue->cb_page = NULL; } From patchwork Mon May 9 15:33:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Habets X-Patchwork-Id: 12843798 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 AFFADC433F5 for ; Mon, 9 May 2022 15:33:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238444AbiEIPhV (ORCPT ); Mon, 9 May 2022 11:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238455AbiEIPhM (ORCPT ); Mon, 9 May 2022 11:37:12 -0400 Received: from mint-fitpc2.mph.net (unknown [81.168.73.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6727922D626 for ; Mon, 9 May 2022 08:33:11 -0700 (PDT) Received: from palantir17.mph.net (unknown [192.168.0.4]) by mint-fitpc2.mph.net (Postfix) with ESMTP id ADC0E3200F2; Mon, 9 May 2022 16:33:10 +0100 (BST) Received: from localhost ([::1] helo=palantir17.mph.net) by palantir17.mph.net with esmtp (Exim 4.89) (envelope-from ) id 1no5Nm-0001Rr-FN; Mon, 09 May 2022 16:33:10 +0100 Subject: [PATCH net-next v4 10/11] sfc/siena: Inline functions in sriov.h to avoid conflicts with sfc From: Martin Habets To: kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, ecree.xilinx@gmail.com Date: Mon, 09 May 2022 16:33:10 +0100 Message-ID: <165211039017.5289.5346164883871029432.stgit@palantir17.mph.net> In-Reply-To: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> References: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The implementation of each is quite short. This means sriov.c is not needed any more. Signed-off-by: Martin Habets --- drivers/net/ethernet/sfc/siena/sriov.c | 72 -------------------------------- drivers/net/ethernet/sfc/siena/sriov.h | 68 ++++++++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 77 deletions(-) delete mode 100644 drivers/net/ethernet/sfc/siena/sriov.c diff --git a/drivers/net/ethernet/sfc/siena/sriov.c b/drivers/net/ethernet/sfc/siena/sriov.c deleted file mode 100644 index 3f241e6c881a..000000000000 --- a/drivers/net/ethernet/sfc/siena/sriov.c +++ /dev/null @@ -1,72 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/**************************************************************************** - * Driver for Solarflare network controllers and boards - * Copyright 2014-2015 Solarflare Communications Inc. - */ -#include -#include "net_driver.h" -#include "nic.h" -#include "sriov.h" - -int efx_sriov_set_vf_mac(struct net_device *net_dev, int vf_i, u8 *mac) -{ - struct efx_nic *efx = netdev_priv(net_dev); - - if (efx->type->sriov_set_vf_mac) - return efx->type->sriov_set_vf_mac(efx, vf_i, mac); - else - return -EOPNOTSUPP; -} - -int efx_sriov_set_vf_vlan(struct net_device *net_dev, int vf_i, u16 vlan, - u8 qos, __be16 vlan_proto) -{ - struct efx_nic *efx = netdev_priv(net_dev); - - if (efx->type->sriov_set_vf_vlan) { - if ((vlan & ~VLAN_VID_MASK) || - (qos & ~(VLAN_PRIO_MASK >> VLAN_PRIO_SHIFT))) - return -EINVAL; - - if (vlan_proto != htons(ETH_P_8021Q)) - return -EPROTONOSUPPORT; - - return efx->type->sriov_set_vf_vlan(efx, vf_i, vlan, qos); - } else { - return -EOPNOTSUPP; - } -} - -int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf_i, - bool spoofchk) -{ - struct efx_nic *efx = netdev_priv(net_dev); - - if (efx->type->sriov_set_vf_spoofchk) - return efx->type->sriov_set_vf_spoofchk(efx, vf_i, spoofchk); - else - return -EOPNOTSUPP; -} - -int efx_sriov_get_vf_config(struct net_device *net_dev, int vf_i, - struct ifla_vf_info *ivi) -{ - struct efx_nic *efx = netdev_priv(net_dev); - - if (efx->type->sriov_get_vf_config) - return efx->type->sriov_get_vf_config(efx, vf_i, ivi); - else - return -EOPNOTSUPP; -} - -int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i, - int link_state) -{ - struct efx_nic *efx = netdev_priv(net_dev); - - if (efx->type->sriov_set_vf_link_state) - return efx->type->sriov_set_vf_link_state(efx, vf_i, - link_state); - else - return -EOPNOTSUPP; -} diff --git a/drivers/net/ethernet/sfc/siena/sriov.h b/drivers/net/ethernet/sfc/siena/sriov.h index 747707bee483..fbde67319d87 100644 --- a/drivers/net/ethernet/sfc/siena/sriov.h +++ b/drivers/net/ethernet/sfc/siena/sriov.h @@ -11,15 +11,73 @@ #ifdef CONFIG_SFC_SRIOV -int efx_sriov_set_vf_mac(struct net_device *net_dev, int vf_i, u8 *mac); +static inline +int efx_sriov_set_vf_mac(struct net_device *net_dev, int vf_i, u8 *mac) +{ + struct efx_nic *efx = netdev_priv(net_dev); + + if (efx->type->sriov_set_vf_mac) + return efx->type->sriov_set_vf_mac(efx, vf_i, mac); + else + return -EOPNOTSUPP; +} + +static inline int efx_sriov_set_vf_vlan(struct net_device *net_dev, int vf_i, u16 vlan, - u8 qos, __be16 vlan_proto); + u8 qos, __be16 vlan_proto) +{ + struct efx_nic *efx = netdev_priv(net_dev); + + if (efx->type->sriov_set_vf_vlan) { + if ((vlan & ~VLAN_VID_MASK) || + (qos & ~(VLAN_PRIO_MASK >> VLAN_PRIO_SHIFT))) + return -EINVAL; + + if (vlan_proto != htons(ETH_P_8021Q)) + return -EPROTONOSUPPORT; + + return efx->type->sriov_set_vf_vlan(efx, vf_i, vlan, qos); + } else { + return -EOPNOTSUPP; + } +} + +static inline int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf_i, - bool spoofchk); + bool spoofchk) +{ + struct efx_nic *efx = netdev_priv(net_dev); + + if (efx->type->sriov_set_vf_spoofchk) + return efx->type->sriov_set_vf_spoofchk(efx, vf_i, spoofchk); + else + return -EOPNOTSUPP; +} + +static inline int efx_sriov_get_vf_config(struct net_device *net_dev, int vf_i, - struct ifla_vf_info *ivi); + struct ifla_vf_info *ivi) +{ + struct efx_nic *efx = netdev_priv(net_dev); + + if (efx->type->sriov_get_vf_config) + return efx->type->sriov_get_vf_config(efx, vf_i, ivi); + else + return -EOPNOTSUPP; +} + +static inline int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i, - int link_state); + int link_state) +{ + struct efx_nic *efx = netdev_priv(net_dev); + + if (efx->type->sriov_set_vf_link_state) + return efx->type->sriov_set_vf_link_state(efx, vf_i, + link_state); + else + return -EOPNOTSUPP; +} #endif /* CONFIG_SFC_SRIOV */ #endif /* EFX_SRIOV_H */ From patchwork Mon May 9 15:33:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Habets X-Patchwork-Id: 12843800 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 E69DFC433F5 for ; Mon, 9 May 2022 15:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238467AbiEIPho (ORCPT ); Mon, 9 May 2022 11:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238468AbiEIPh3 (ORCPT ); Mon, 9 May 2022 11:37:29 -0400 Received: from mint-fitpc2.mph.net (unknown [81.168.73.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 91CAF238D50 for ; Mon, 9 May 2022 08:33:24 -0700 (PDT) Received: from palantir17.mph.net (unknown [192.168.0.4]) by mint-fitpc2.mph.net (Postfix) with ESMTP id B3D503200F2; Mon, 9 May 2022 16:33:23 +0100 (BST) Received: from localhost ([::1] helo=palantir17.mph.net) by palantir17.mph.net with esmtp (Exim 4.89) (envelope-from ) id 1no5Nz-0001S7-Gj; Mon, 09 May 2022 16:33:23 +0100 Subject: [PATCH net-next v4 11/11] sfc: Add a basic Siena module From: Martin Habets To: kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, ecree.xilinx@gmail.com Date: Mon, 09 May 2022 16:33:23 +0100 Message-ID: <165211040255.5289.15600898006437166615.stgit@palantir17.mph.net> In-Reply-To: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> References: <165211018297.5289.9658523545298485394.stgit@palantir17.mph.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Make the (un)load message more specific to differentiate it from the sfc.ko messages. Signed-off-by: Martin Habets --- drivers/net/ethernet/sfc/Kconfig | 1 + drivers/net/ethernet/sfc/Makefile | 1 + drivers/net/ethernet/sfc/siena/Kconfig | 12 ++++++++++++ drivers/net/ethernet/sfc/siena/Makefile | 11 +++++++++++ drivers/net/ethernet/sfc/siena/efx.c | 6 +++--- 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/sfc/siena/Kconfig create mode 100644 drivers/net/ethernet/sfc/siena/Makefile diff --git a/drivers/net/ethernet/sfc/Kconfig b/drivers/net/ethernet/sfc/Kconfig index 846fff16fa48..98db551ba2b7 100644 --- a/drivers/net/ethernet/sfc/Kconfig +++ b/drivers/net/ethernet/sfc/Kconfig @@ -65,5 +65,6 @@ config SFC_MCDI_LOGGING a sysfs file 'mcdi_logging' under the PCI device. source "drivers/net/ethernet/sfc/falcon/Kconfig" +source "drivers/net/ethernet/sfc/siena/Kconfig" endif # NET_VENDOR_SOLARFLARE diff --git a/drivers/net/ethernet/sfc/Makefile b/drivers/net/ethernet/sfc/Makefile index 9b3374cf7937..b9298031ea51 100644 --- a/drivers/net/ethernet/sfc/Makefile +++ b/drivers/net/ethernet/sfc/Makefile @@ -13,3 +13,4 @@ sfc-$(CONFIG_SFC_SRIOV) += sriov.o ef10_sriov.o ef100_sriov.o obj-$(CONFIG_SFC) += sfc.o obj-$(CONFIG_SFC_FALCON) += falcon/ +obj-$(CONFIG_SFC_SIENA) += siena/ diff --git a/drivers/net/ethernet/sfc/siena/Kconfig b/drivers/net/ethernet/sfc/siena/Kconfig new file mode 100644 index 000000000000..3d52aee50d5a --- /dev/null +++ b/drivers/net/ethernet/sfc/siena/Kconfig @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only +config SFC_SIENA + tristate "Solarflare SFC9000 support" + depends on PCI + select MDIO + select CRC32 + help + This driver supports 10-gigabit Ethernet cards based on + the Solarflare SFC9000 controller. + + To compile this driver as a module, choose M here. The module + will be called sfc-siena. diff --git a/drivers/net/ethernet/sfc/siena/Makefile b/drivers/net/ethernet/sfc/siena/Makefile new file mode 100644 index 000000000000..74cb8b7d281e --- /dev/null +++ b/drivers/net/ethernet/sfc/siena/Makefile @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 +sfc-siena-y += farch.o siena.o \ + efx.o efx_common.o efx_channels.o nic.o \ + tx.o tx_common.o rx.o rx_common.o \ + selftest.o ethtool.o ethtool_common.o ptp.o \ + mcdi.o mcdi_port.o mcdi_port_common.o \ + mcdi_mon.o +sfc-siena-$(CONFIG_SFC_MTD) += mtd.o +sfc-siena-$(CONFIG_SFC_SRIOV) += siena_sriov.o + +obj-$(CONFIG_SFC_SIENA) += sfc-siena.o diff --git a/drivers/net/ethernet/sfc/siena/efx.c b/drivers/net/ethernet/sfc/siena/efx.c index d937704e416b..3f6e732f5fdc 100644 --- a/drivers/net/ethernet/sfc/siena/efx.c +++ b/drivers/net/ethernet/sfc/siena/efx.c @@ -1265,7 +1265,7 @@ static int __init efx_init_module(void) { int rc; - printk(KERN_INFO "Solarflare NET driver\n"); + pr_info("Solarflare Siena driver\n"); rc = register_netdevice_notifier(&efx_netdev_notifier); if (rc) @@ -1291,7 +1291,7 @@ static int __init efx_init_module(void) static void __exit efx_exit_module(void) { - printk(KERN_INFO "Solarflare NET driver unloading\n"); + pr_info("Solarflare Siena driver unloading\n"); pci_unregister_driver(&efx_pci_driver); efx_siena_destroy_reset_workqueue(); @@ -1304,6 +1304,6 @@ module_exit(efx_exit_module); MODULE_AUTHOR("Solarflare Communications and " "Michael Brown "); -MODULE_DESCRIPTION("Solarflare network driver"); +MODULE_DESCRIPTION("Solarflare Siena network driver"); MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(pci, efx_pci_table);