[dpdk-dev] [PATCH v4] nfp: report link speed using hardware info
Alejandro Lucero
alejandro.lucero at netronome.com
Mon Dec 19 11:32:39 CET 2016
On Mon, Dec 19, 2016 at 10:24 AM, Ferruh Yigit <ferruh.yigit at intel.com>
wrote:
> On 12/16/2016 5:10 PM, Alejandro Lucero wrote:
> > Previous reported speed was hardcoded because there was not firmware
> > support for getting this information. This change needs to support old
> > firmware versions, keeping with the hardcoded report, and the new
> > versions, where the firmware makes that information available.
> >
> > v4: Make conditional simple and more ellaborated commit comment.
> > v3: remove unsed macro
> > v2: use RTE_DIM instead of own macro
> >
> > Signed-off-by: Alejandro Lucero <alejandro.lucero at netronome.com>
> > ---
> > drivers/net/nfp/nfp_net.c | 27 +++++++++++++++++++++++++--
> > drivers/net/nfp/nfp_net_ctrl.h | 11 +++++++++++
> > 2 files changed, 36 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
> <...>
> > @@ -831,8 +842,20 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw)
> > link.link_status = ETH_LINK_UP;
> >
> > link.link_duplex = ETH_LINK_FULL_DUPLEX;
> > - /* Other cards can limit the tx and rx rate per VF */
> > - link.link_speed = ETH_SPEED_NUM_40G;
> > +
> > + nn_link_status = (nn_link_status >> NFP_NET_CFG_STS_LINK_RATE_SHIFT)
> &
> > + NFP_NET_CFG_STS_LINK_RATE_MASK;
> > +
> > + if ((NFD_CFG_MAJOR_VERSION_of(hw->ver) < 4) ||
> > + ((NFD_CFG_MINOR_VERSION_of(hw->ver) == 4) &&
> > + (NFD_CFG_MINOR_VERSION_of(hw->ver) == 0)))
> > + link.link_speed = ETH_SPEED_NUM_40G;
> > + else {
> > + if (nn_link_status >= RTE_DIM(ls_to_ethtool)
>
> This is not compiling fine, missing parenthesis.
>
Sorry about that. It was so simple the change I did not do any test.
>
> > + link.link_speed = ETH_SPEED_NUM_NONE;
> > + else
> > + link.link_speed = ls_to_ethtool[nn_link_status];
> > + }
> >
> > if (old.link_status != link.link_status) {
> > nfp_net_dev_atomic_write_link_status(dev, &link);
> <...>
>
>
More information about the dev
mailing list