[dpdk-dev] net/fm10k: initialize link status in device start

Message ID 1496228822-6753-1-git-send-email-xiao.w.wang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Xiao Wang May 31, 2017, 11:07 a.m. UTC
  If port LSC interrupt is configured, application will read link
status directly, so driver need to prepare that value in advance.

Fixes: 9ae6068c86da ("fm10k: add dev start/stop")
Cc: stable@dpdk.org

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/fm10k_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Chen, Jing D June 21, 2017, 2:35 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Wang, Xiao W
> Sent: Wednesday, May 31, 2017 7:07 PM
> To: Chen, Jing D <jing.d.chen@intel.com>
> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] net/fm10k: initialize link status in device start
> 
> If port LSC interrupt is configured, application will read link status directly, so
> driver need to prepare that value in advance.

Fm10k host driver can't manage PHY directly and provide a fake link status, 
so it always provide a constant value, whatever lsc is set or not.
I think you need to reorganize the message. :)

> 
> Fixes: 9ae6068c86da ("fm10k: add dev start/stop")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  drivers/net/fm10k/fm10k_ethdev.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> b/drivers/net/fm10k/fm10k_ethdev.c
> index a742eec..54bf10c 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -84,6 +84,8 @@ static void fm10k_MAC_filter_set(struct rte_eth_dev
> *dev,  static void fm10k_set_rx_function(struct rte_eth_dev *dev);  static
> void fm10k_set_tx_function(struct rte_eth_dev *dev);  static int
> fm10k_check_ftag(struct rte_devargs *devargs);
> +static int fm10k_link_update(struct rte_eth_dev *dev,
> +	__rte_unused int wait_to_complete);
> 
>  struct fm10k_xstats_name_off {
>  	char name[RTE_ETH_XSTATS_NAME_SIZE];
> @@ -1166,6 +1168,9 @@ static inline int fm10k_glort_valid(struct fm10k_hw
> *hw)
>  	if (!(dev->data->dev_conf.rxmode.mq_mode &
> ETH_MQ_RX_VMDQ_FLAG))
>  		fm10k_vlan_filter_set(dev, hw->mac.default_vid, true);
> 
> +	if (dev->data->dev_conf.intr_conf.lsc != 0)
> +		fm10k_link_update(dev, 0);
> +

I'll recommend updating link status anyway when port starts, not considering
lsc set status.

>  	return 0;
>  }
> 
> --
> 1.8.3.1
  
Xiao Wang June 22, 2017, 2:31 a.m. UTC | #2
Hi,

> -----Original Message-----
> From: Chen, Jing D
> Sent: Wednesday, June 21, 2017 10:36 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH] net/fm10k: initialize link status in device start
> 
> Hi,
> 
> > -----Original Message-----
> > From: Wang, Xiao W
> > Sent: Wednesday, May 31, 2017 7:07 PM
> > To: Chen, Jing D <jing.d.chen@intel.com>
> > Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>;
> > stable@dpdk.org
> > Subject: [PATCH] net/fm10k: initialize link status in device start
> >
> > If port LSC interrupt is configured, application will read link status directly,
> so
> > driver need to prepare that value in advance.
> 
> Fm10k host driver can't manage PHY directly and provide a fake link status,
> so it always provide a constant value, whatever lsc is set or not.
> I think you need to reorganize the message. :)

OK, thanks.
> 
> >
> > Fixes: 9ae6068c86da ("fm10k: add dev start/stop")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  drivers/net/fm10k/fm10k_ethdev.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> > b/drivers/net/fm10k/fm10k_ethdev.c
> > index a742eec..54bf10c 100644
> > --- a/drivers/net/fm10k/fm10k_ethdev.c
> > +++ b/drivers/net/fm10k/fm10k_ethdev.c
> > @@ -84,6 +84,8 @@ static void fm10k_MAC_filter_set(struct rte_eth_dev
> > *dev,  static void fm10k_set_rx_function(struct rte_eth_dev *dev);  static
> > void fm10k_set_tx_function(struct rte_eth_dev *dev);  static int
> > fm10k_check_ftag(struct rte_devargs *devargs);
> > +static int fm10k_link_update(struct rte_eth_dev *dev,
> > +	__rte_unused int wait_to_complete);
> >
> >  struct fm10k_xstats_name_off {
> >  	char name[RTE_ETH_XSTATS_NAME_SIZE];
> > @@ -1166,6 +1168,9 @@ static inline int fm10k_glort_valid(struct
> fm10k_hw
> > *hw)
> >  	if (!(dev->data->dev_conf.rxmode.mq_mode &
> > ETH_MQ_RX_VMDQ_FLAG))
> >  		fm10k_vlan_filter_set(dev, hw->mac.default_vid, true);
> >
> > +	if (dev->data->dev_conf.intr_conf.lsc != 0)
> > +		fm10k_link_update(dev, 0);
> > +
> 
> I'll recommend updating link status anyway when port starts, not considering
> lsc set status.

Agree, will send v2.

BRs,
Xiao
  

Patch

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index a742eec..54bf10c 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -84,6 +84,8 @@  static void fm10k_MAC_filter_set(struct rte_eth_dev *dev,
 static void fm10k_set_rx_function(struct rte_eth_dev *dev);
 static void fm10k_set_tx_function(struct rte_eth_dev *dev);
 static int fm10k_check_ftag(struct rte_devargs *devargs);
+static int fm10k_link_update(struct rte_eth_dev *dev,
+	__rte_unused int wait_to_complete);
 
 struct fm10k_xstats_name_off {
 	char name[RTE_ETH_XSTATS_NAME_SIZE];
@@ -1166,6 +1168,9 @@  static inline int fm10k_glort_valid(struct fm10k_hw *hw)
 	if (!(dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_VMDQ_FLAG))
 		fm10k_vlan_filter_set(dev, hw->mac.default_vid, true);
 
+	if (dev->data->dev_conf.intr_conf.lsc != 0)
+		fm10k_link_update(dev, 0);
+
 	return 0;
 }