From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id E062D1B1E7 for ; Thu, 21 Dec 2017 04:25:26 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2017 19:25:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,434,1508828400"; d="scan'208";a="4207961" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga008.fm.intel.com with ESMTP; 20 Dec 2017 19:25:26 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 20 Dec 2017 19:25:25 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Thu, 21 Dec 2017 11:25:23 +0800 From: "Zhang, Helin" To: Shweta Choudaha , "dev@dpdk.org" CC: Shweta Choudaha Thread-Topic: [dpdk-dev] [PATCH v2 1/2] net/ixgbe: add and export MDIO APIs Thread-Index: AQHTVwssVbfETkL9pEunbcvp2BVIN6NNaBHQ Date: Thu, 21 Dec 2017 03:25:23 +0000 Message-ID: References: <1509978323-9879-1-git-send-email-shweta.choudaha@gmail.com> In-Reply-To: <1509978323-9879-1-git-send-email-shweta.choudaha@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 1/2] net/ixgbe: add and export MDIO APIs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Dec 2017 03:25:27 -0000 In general, I'd suggest to add two things together with this patch set. 1. test cases in testpmd. 2. documentation in release notes, testpmd doc, and others if needed. Regards, Helin > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shweta Choudaha > Sent: Monday, November 6, 2017 10:25 PM > To: dev@dpdk.org > Cc: Shweta Choudaha > Subject: [dpdk-dev] [PATCH v2 1/2] net/ixgbe: add and export MDIO APIs >=20 > From: Shweta Choudaha >=20 > Add ixgbe MDIO access APIs to read and write PHY registers when being use= d > as a backplane port. Export these APIs via the map file >=20 > Signed-off-by: Shweta Choudaha > Reviewed-by: Chas Williams > Reviewed-by: Luca Boccassi > --- > drivers/net/ixgbe/rte_pmd_ixgbe.c | 53 > +++++++++++++++++++++++++++++ > drivers/net/ixgbe/rte_pmd_ixgbe.h | 39 +++++++++++++++++++++ > drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 7 ++++ > 3 files changed, 99 insertions(+) >=20 > diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c > b/drivers/net/ixgbe/rte_pmd_ixgbe.c > index f127378..34d8cb4 100644 > --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c > +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c > @@ -1041,3 +1041,56 @@ rte_pmd_ixgbe_bypass_wd_reset(uint16_t > port_id) > return ixgbe_bypass_wd_reset(dev); > } > #endif > + > +static void rte_pmd_ixgbe_get_hw_phy(uint16_t port, struct ixgbe_hw > **hw, > + struct ixgbe_phy_info **phy) > +{ > + struct rte_eth_dev *dev; > + > + *hw =3D NULL; > + *phy =3D NULL; > + > + dev =3D &rte_eth_devices[port]; > + if (!is_ixgbe_supported(dev)) > + return; > + > + *hw =3D IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + if (!*hw) > + return; > + > + *phy =3D &(*hw)->phy; > +} > + > +int > +rte_pmd_ixgbe_mdio_read(uint16_t port, uint32_t reg_addr, > + uint32_t dev_type, uint16_t *phy_data) { > + struct ixgbe_hw *hw; > + struct ixgbe_phy_info *phy; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); > + > + rte_pmd_ixgbe_get_hw_phy(port, &hw, &phy); > + > + if (!hw || !phy) > + return -ENOTSUP; > + > + return phy->ops.read_reg_mdi(hw, reg_addr, dev_type, phy_data); } > + > +int > +rte_pmd_ixgbe_mdio_write(uint16_t port, uint32_t reg_addr, > + uint32_t dev_type, uint16_t phy_data) { > + struct ixgbe_hw *hw; > + struct ixgbe_phy_info *phy; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); > + > + rte_pmd_ixgbe_get_hw_phy(port, &hw, &phy); > + > + if (!hw || !phy) > + return -ENOTSUP; > + > + return phy->ops.write_reg_mdi(hw, reg_addr, dev_type, phy_data); } > diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h > b/drivers/net/ixgbe/rte_pmd_ixgbe.h > index 81b18f8..5d36f8a 100644 > --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h > +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h > @@ -601,6 +601,45 @@ int > rte_pmd_ixgbe_bypass_wd_timeout_show(uint16_t port, uint32_t > *wd_timeout); > */ > int rte_pmd_ixgbe_bypass_wd_reset(uint16_t port); >=20 > +/** > + * Read PHY register using MDIO > + * > + * @param port > + * The port identifier of the Ethernet device. > + * @param reg_addr > + * 32 bit PHY Register > + * @param dev_type > + * Always Unused > + * @param phy_data > + * Pointer for reading PHY register data > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port* invalid. > + */ > +int > +rte_pmd_ixgbe_mdio_read(uint16_t port, uint32_t reg_addr, > + uint32_t dev_type, uint16_t *phy_data); > + > +/** > + * Write data to PHY register using MDIO > + * > + * @param port > + * The port identifier of the Ethernet device. > + * @param reg_addr > + * 32 bit PHY Register > + * @param dev_type > + * Always unused > + * @param phy_data > + * Data to write to PHY register > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port* invalid. > + */ > +int > +rte_pmd_ixgbe_mdio_write(uint16_t port, uint32_t reg_addr, > + uint32_t dev_type, uint16_t phy_data); >=20 > /** > * Response sent back to ixgbe driver from user app after callback diff = --git > a/drivers/net/ixgbe/rte_pmd_ixgbe_version.map > b/drivers/net/ixgbe/rte_pmd_ixgbe_version.map > index bf77674..ce72c73 100644 > --- a/drivers/net/ixgbe/rte_pmd_ixgbe_version.map > +++ b/drivers/net/ixgbe/rte_pmd_ixgbe_version.map > @@ -52,3 +52,10 @@ DPDK_17.08 { > rte_pmd_ixgbe_bypass_wd_timeout_show; > rte_pmd_ixgbe_bypass_wd_timeout_store; > } DPDK_17.05; > + > +EXPERIMENTAL { > + global: > + > + rte_pmd_ixgbe_mdio_read; > + rte_pmd_ixgbe_mdio_write; > +} DPDK_17.08; > -- > 2.1.4