From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f68.google.com (mail-vk0-f68.google.com [209.85.213.68]) by dpdk.org (Postfix) with ESMTP id 98222A84E for ; Tue, 23 Jan 2018 16:12:22 +0100 (CET) Received: by mail-vk0-f68.google.com with SMTP id t4so481223vkb.9 for ; Tue, 23 Jan 2018 07:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xO4rol1I4blhDjsRyGAbivMe8kqf+EFRRsIUDiwg7eU=; b=lsXvrnwu3bdR9dk9rWFFN36JTbiaYcKisokP6LHvy7ApNLN4Tjn6JBGAqah6s0aF9F uY45b6D6cpV6u8DCcu/J6ZeCElR4awcEsnnjW6A8sBJjxPSuPeWhMNYywOnUBsyktQix m+nIRzYcsxTnRveKV1ypdMi2cJcw99XK1g+myEgOZvBqS5Ex+6Mzo8E+AwcOTgKQ5d4v h+Pn5IU1z4S9SrU4Q0/UbYi/+DAFj5M7EIL7ccjNSc6egWltDh5jZzkaO405j0LbPhNu Mo1mB+Q5OwL+VEQLFCNA5OwznClpyXIRklEGyQtfgVShsNs4ak+BLvTBHTPAm68bx12E g+JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xO4rol1I4blhDjsRyGAbivMe8kqf+EFRRsIUDiwg7eU=; b=BG4jBGj3cyxmoLQvZTqknnIileXxc5MQNR0z6aff0y6BQpEt2ThLG3mUiVJHx0Fo2P AfvCg6lUDTWV7tf3H5+bT8+MikFsgse1YIvKnzhzZX7zsvGCLa/sPow4nDWLGbX2sele X0gEZucO9Ikjik+FkUo32D9VE2A7EXA/JGj9v+AUEXRmB7dIfhc1aSoaI/D7Xsa7wW8u MuhQoyPxvEvkjPD2uqAoLA1ckHPn0irZ//0orJMuha41RfMU001fGVgzHJXVUzdGYVMM FMjDAtHKncAV/HGzR9Q3ZCe5nsVo4/4H0kXFRexQw6b/RUtoPUgxkYhCq+jlJscvKlAb eDuA== X-Gm-Message-State: AKwxytdtvvNqlhXdYXrNf7LVqavTB8Vncx6IEhVpEbSz4lAbtLSBbl54 5IcaFmA+L9YFdiLJZLb7KMOltG+9TG2UK6FJ2lY= X-Google-Smtp-Source: AH8x224ii1hkN1FBCvqrOcq+79fMdUmkGJCrBPKn9lbgcFcUfESVp2aSncu8y4drqD3bAksPDoHdRLi9qTItEB7xfDc= X-Received: by 10.31.49.75 with SMTP id x72mr1784552vkx.174.1516720341776; Tue, 23 Jan 2018 07:12:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.13.144 with HTTP; Tue, 23 Jan 2018 07:12:21 -0800 (PST) In-Reply-To: References: <1509978323-9879-1-git-send-email-shweta.choudaha@gmail.com> From: Shweta Choudaha Date: Tue, 23 Jan 2018 15:12:21 +0000 Message-ID: To: "Zhang, Helin" Cc: "dev@dpdk.org" , Shweta Choudaha Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 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: Tue, 23 Jan 2018 15:12:23 -0000 Hi Helin, Thanks for the review. I 'll look at adding test cases too. In the meantime, updated this patch to reflect changes in patch 2 of the series. Thanks, Shweta On Thu, Dec 21, 2017 at 3:25 AM, Zhang, Helin wrote: > 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 > > > > From: Shweta Choudaha > > > > Add ixgbe MDIO access APIs to read and write PHY registers when being > used > > as a backplane port. Export these APIs via the map file > > > > 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(+) > > > > 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 = NULL; > > + *phy = NULL; > > + > > + dev = &rte_eth_devices[port]; > > + if (!is_ixgbe_supported(dev)) > > + return; > > + > > + *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > + if (!*hw) > > + return; > > + > > + *phy = &(*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); > > > > +/** > > + * 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); > > > > /** > > * 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 > >