From patchwork Thu Jan 3 21:35:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirsher, Jeffrey T" X-Patchwork-Id: 1020515 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43W1Rr1YsLz9s7h for ; Fri, 4 Jan 2019 08:35:35 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 4A2F687108; Thu, 3 Jan 2019 21:35:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rwrGIylIi1ez; Thu, 3 Jan 2019 21:35:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 207D9870F3; Thu, 3 Jan 2019 21:35:33 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 173B21BF46F for ; Thu, 3 Jan 2019 21:35:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 141FB8358F for ; Thu, 3 Jan 2019 21:35:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l2OPb5VlNsff for ; Thu, 3 Jan 2019 21:35:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 1853281BD2 for ; Thu, 3 Jan 2019 21:35:31 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jan 2019 13:35:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,436,1539673200"; d="scan'208";a="123901228" Received: from jtkirshe-desk1.jf.intel.com ([134.134.177.96]) by orsmga001.jf.intel.com with ESMTP; 03 Jan 2019 13:35:30 -0800 From: Jeff Kirsher To: intel-wired-lan@lists.osuosl.org Date: Thu, 3 Jan 2019 13:35:19 -0800 Message-Id: <20190103213519.9754-1-jeffrey.t.kirsher@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH] ixgbe: fix Kconfig when driver is not a module X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Florian Fainelli , Dave Jones Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" The new ability added to the driver to use mii_bus to handle MII related ioctls is causing compile issues when the driver is compiled into the kernel (i.e. not a module). The simple solution of requiring the driver to be compiled as a module when MDIO_BUS is a module, causes a recursion Kconfig issue due to IPSec dependencies. So created another Kconfig option for ixgbe, to enable mdio_bus support for DSA devices. This solution solves the problem when the ixgbe driver is compiled into the kernel and MDIO_BUS is compiled as a module. In this case, the IXGBE_MDIO option is disabled and the code is not compiled into the driver. CC: Dave Jones CC: Steve Douthit CC: Florian Fainelli Signed-off-by: Jeff Kirsher Tested-by: Andrew Bowers Tested-by: Stephen Douthit --- drivers/net/ethernet/intel/Kconfig | 11 ++++++++++- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 4 ++++ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 12 ++++++++++-- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 4 ++++ drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h | 3 ++- 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig index 31fb76ee9d82..35317ecdd0c3 100644 --- a/drivers/net/ethernet/intel/Kconfig +++ b/drivers/net/ethernet/intel/Kconfig @@ -159,7 +159,6 @@ config IXGBE tristate "Intel(R) 10GbE PCI Express adapters support" depends on PCI select MDIO - select MDIO_DEVICE imply PTP_1588_CLOCK ---help--- This driver supports Intel(R) 10GbE PCI Express family of @@ -210,6 +209,16 @@ config IXGBE_IPSEC ---help--- Enable support for IPSec offload in ixgbe.ko +config IXGBE_MDIO + bool "MDIO Support for DSA devices" + default n + depends on IXGBE && MDIO_BUS && !(IXGBE=y && MDIO_BUS=m) + ---help--- + Say Y here if you want MDIO_BUS support for DSA devices in the + driver. + + If unsure, say N. + config IXGBEVF tristate "Intel(R) 10GbE PCI Express Virtual Function Ethernet support" depends on PCI_MSI diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 08d85e336bd4..9d7496508ee0 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h @@ -12,7 +12,9 @@ #include #include #include +#ifdef CONFIG_IXGBE_MDIO #include +#endif #include #include @@ -562,7 +564,9 @@ struct ixgbe_adapter { struct net_device *netdev; struct bpf_prog *xdp_prog; struct pci_dev *pdev; +#ifdef CONFIG_IXGBE_MDIO struct mii_bus *mii_bus; +#endif unsigned long state; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index d2ce7f0bc32d..afa0337f7ba0 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -39,7 +39,9 @@ #include "ixgbe.h" #include "ixgbe_common.h" #include "ixgbe_dcb_82599.h" +#ifdef CONFIG_IXGBE_MDIO #include "ixgbe_phy.h" +#endif #include "ixgbe_sriov.h" #include "ixgbe_model.h" #include "ixgbe_txrx_common.h" @@ -8791,6 +8793,7 @@ ixgbe_mdio_read(struct net_device *netdev, int prtad, int devad, u16 addr) u16 value; int rc; +#ifdef CONFIG_IXGBE_MDIO if (adapter->mii_bus) { int regnum = addr; @@ -8799,7 +8802,7 @@ ixgbe_mdio_read(struct net_device *netdev, int prtad, int devad, u16 addr) return mdiobus_read(adapter->mii_bus, prtad, regnum); } - +#endif if (prtad != hw->phy.mdio.prtad) return -EINVAL; rc = hw->phy.ops.read_reg(hw, addr, devad, &value); @@ -8814,6 +8817,7 @@ static int ixgbe_mdio_write(struct net_device *netdev, int prtad, int devad, struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_hw *hw = &adapter->hw; +#ifdef CONFIG_IXGBE_MDIO if (adapter->mii_bus) { int regnum = addr; @@ -8822,7 +8826,7 @@ static int ixgbe_mdio_write(struct net_device *netdev, int prtad, int devad, return mdiobus_write(adapter->mii_bus, prtad, regnum, value); } - +#endif if (prtad != hw->phy.mdio.prtad) return -EINVAL; return hw->phy.ops.write_reg(hw, addr, devad, value); @@ -11141,7 +11145,9 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) IXGBE_LINK_SPEED_10GB_FULL | IXGBE_LINK_SPEED_1GB_FULL, true); +#ifdef CONFIG_IXGBE_MDIO ixgbe_mii_bus_init(hw); +#endif return 0; @@ -11193,8 +11199,10 @@ static void ixgbe_remove(struct pci_dev *pdev) set_bit(__IXGBE_REMOVING, &adapter->state); cancel_work_sync(&adapter->service_task); +#ifdef CONFIG_IXGBE_MDIO if (adapter->mii_bus) mdiobus_unregister(adapter->mii_bus); +#endif #ifdef CONFIG_IXGBE_DCA if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) { diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c index cc4907f9ff02..05da21920863 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c @@ -3,7 +3,9 @@ #include #include +#ifdef CONFIG_IXGBE_MDIO #include +#endif #include #include "ixgbe.h" @@ -659,6 +661,7 @@ s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr, return status; } +#ifdef CONFIG_IXGBE_MDIO #define IXGBE_HW_READ_REG(addr) IXGBE_READ_REG(hw, addr) /** @@ -956,6 +959,7 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) adapter->mii_bus = NULL; return -ENODEV; } +#endif /** * ixgbe_setup_phy_link_generic - Set and restart autoneg diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h index 214b01085718..88b851178d7e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h @@ -120,8 +120,9 @@ /* SFP+ SFF-8472 Compliance code */ #define IXGBE_SFF_SFF_8472_UNSUP 0x00 +#ifdef CONFIG_IXGBE_MDIO s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw); - +#endif s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw); s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw); s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,