> -----Original Message-----
> From: Stillwell Jr, Paul M
> Sent: Wednesday, May 1, 2019 00:24
> To: Wang, Haiyue <haiyue.w...@intel.com>; dev@dpdk.org; Zhang, Qi Z
> <qi.z.zh...@intel.com>; Lu, Wenzhuo <wenzhuo...@intel.com>
> Cc: Wang, Haiyue <haiyue.w...@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v1] net/ice: add link-up and link-down 
> functions
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Haiyue Wang
> > Sent: Tuesday, April 30, 2019 12:12 AM
> > To: dev@dpdk.org; Zhang, Qi Z <qi.z.zh...@intel.com>; Lu, Wenzhuo
> > <wenzhuo...@intel.com>
> > Cc: Wang, Haiyue <haiyue.w...@intel.com>
> > Subject: [dpdk-dev] [PATCH v1] net/ice: add link-up and link-down
> > functions
> >
> > Support link up and down functions for ice, and when stop the ice,
> > makes the link down also.
> >
> > Signed-off-by: Haiyue Wang <haiyue.w...@intel.com>
> > ---
> >  drivers/net/ice/ice_ethdev.c | 83
> > ++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 83 insertions(+)
> >
> > diff --git a/drivers/net/ice/ice_ethdev.c
> > b/drivers/net/ice/ice_ethdev.c index 1f06a2c..8f58150 100644
> > --- a/drivers/net/ice/ice_ethdev.c
> > +++ b/drivers/net/ice/ice_ethdev.c
> > @@ -32,6 +32,9 @@ static void ice_dev_info_get(struct rte_eth_dev *dev,
> >                          struct rte_eth_dev_info *dev_info);  static int
> > ice_link_update(struct rte_eth_dev *dev,
> > +   if (link_up)
> > +           cfg.caps |= ICE_AQ_PHY_ENA_LINK;
> > +   else
> > +           cfg.caps &= ~ICE_AQ_PHY_ENA_LINK;
> > +
> > +   status = ice_aq_set_phy_cfg(hw, pi->lport, &cfg, NULL);
> > +
> 
> It seems like you should either check the return value here and tell the user 
> if it
> didn't work or change the code that calls this to tell the user if something 
> went
> wrong. Otherwise the user thinks things worked when it didn't.
> 
I just make use of 'ICE_SUCCESS == 0' be treated as successful, and other value 
defined
in 'enum ice_status ' will be treated as error code by function ' eth_err ' 
through
' rte_eth_dev_set_link_down/up'.

> > +out:
> > +   ice_free(hw, pcaps);
> > +   return status;
> > +}
> > +
> > +static int
> > +ice_dev_set_link_up(struct rte_eth_dev *dev) {
> > +   struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data-
> > >dev_private);
> > +
> > +   return ice_force_phys_link_state(hw, true); }
> > +
> > +static int
> > +ice_dev_set_link_down(struct rte_eth_dev *dev) {
> > +   struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data-
> > >dev_private);
> > +
> > +   return ice_force_phys_link_state(hw, false); }
> > +
> >  static int
> >  ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)  {
> > --
> > 2.7.4

Reply via email to