[DPDK] net/i40e: fix SFP X722 not work with FW4.16

Message ID 1563470021-16325-1-git-send-email-xiao.zhang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series [DPDK] net/i40e: fix SFP X722 not work with FW4.16 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Xiao Zhang July 18, 2019, 5:13 p.m. UTC
  FW4.16 of SFP X722 does not support setting TPID by set_switch_config
adminq operation, for firmware version less than 4.16 TPID is set by
register instead. Follow the same path with new firmware version for
SFP X722 to make it work.

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Wang, Haiyue July 18, 2019, 8:23 a.m. UTC | #1
> -----Original Message-----
> From: Zhang, Xiao
> Sent: Friday, July 19, 2019 01:14
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Zhang, Xiao <xiao.zhang@intel.com>
> Subject: [DPDK] net/i40e: fix SFP X722 not work with FW4.16
> 
> FW4.16 of SFP X722 does not support setting TPID by set_switch_config
> adminq operation, for firmware version less than 4.16 TPID is set by
> register instead. Follow the same path with new firmware version for
> SFP X722 to make it work.
> 
> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 2b9fc45..bf6dc2b 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -3708,7 +3708,9 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,
>  	}
> 
>  	/* 802.1ad frames ability is added in NVM API 1.7*/
> -	if (hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) {
> +	/* FW4.16 for SFP x722 does not support set_switch_config option */
> +	if ((hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) &&
> +		hw->device_id != I40E_DEV_ID_SFP_X722) {
>  		if (qinq) {
>  			if (vlan_type == ETH_VLAN_TYPE_OUTER)
>  				hw->first_tag = rte_cpu_to_le_16(tpid);

Control the ' I40E_HW_FLAG_802_1AD_CAPABLE ' set or not here is better ?

enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)

	/* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */
	if ((hw->aq.api_maj_ver > 1) ||
	    ((hw->aq.api_maj_ver == 1) &&
	     (hw->aq.api_min_ver >= 7)))
		hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;

> --
> 2.7.4
  
Wang, Haiyue July 18, 2019, 8:25 a.m. UTC | #2
BR,
Haiyue


> -----Original Message-----
> From: Wang, Haiyue
> Sent: Thursday, July 18, 2019 16:23
> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: RE: [DPDK] net/i40e: fix SFP X722 not work with FW4.16
> 
> > -----Original Message-----
> > From: Zhang, Xiao
> > Sent: Friday, July 19, 2019 01:14
> > To: dev@dpdk.org
> > Cc: Xing, Beilei <beilei.xing@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; Zhang, Xiao <xiao.zhang@intel.com>
> > Subject: [DPDK] net/i40e: fix SFP X722 not work with FW4.16
> >
> > FW4.16 of SFP X722 does not support setting TPID by set_switch_config
> > adminq operation, for firmware version less than 4.16 TPID is set by
> > register instead. Follow the same path with new firmware version for
> > SFP X722 to make it work.
> >
> > Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> > ---
> >  drivers/net/i40e/i40e_ethdev.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> > index 2b9fc45..bf6dc2b 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -3708,7 +3708,9 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,
> >  	}
> >
> >  	/* 802.1ad frames ability is added in NVM API 1.7*/
> > -	if (hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) {
> > +	/* FW4.16 for SFP x722 does not support set_switch_config option */
> > +	if ((hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) &&
> > +		hw->device_id != I40E_DEV_ID_SFP_X722) {
> >  		if (qinq) {
> >  			if (vlan_type == ETH_VLAN_TYPE_OUTER)
> >  				hw->first_tag = rte_cpu_to_le_16(tpid);
> 
> Control the ' I40E_HW_FLAG_802_1AD_CAPABLE ' set or not here is better ?
> 
> enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
> 
> 	/* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */
> 	if ((hw->aq.api_maj_ver > 1) ||
> 	    ((hw->aq.api_maj_ver == 1) &&
> 	     (hw->aq.api_min_ver >= 7)))
> 		hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;
> 
Looks like changing the share code. Or like :

	ret = i40e_init_adminq(hw);
	if (ret != I40E_SUCCESS) {
		PMD_INIT_LOG(ERR, "Failed to init adminq: %d", ret);
		return -EIO;
	}
	...
	clear I40E_HW_FLAG_802_1AD_CAPABLE here ...
> > --
> > 2.7.4
  
Xiao Zhang July 18, 2019, 8:32 a.m. UTC | #3
> -----Original Message-----
> From: Wang, Haiyue
> Sent: Thursday, July 18, 2019 4:26 PM
> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: RE: [DPDK] net/i40e: fix SFP X722 not work with FW4.16
> 
> 
> 
> BR,
> Haiyue
> 
> 
> > -----Original Message-----
> > From: Wang, Haiyue
> > Sent: Thursday, July 18, 2019 16:23
> > To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
> > Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>
> > Subject: RE: [DPDK] net/i40e: fix SFP X722 not work with FW4.16
> >
> > > -----Original Message-----
> > > From: Zhang, Xiao
> > > Sent: Friday, July 19, 2019 01:14
> > > To: dev@dpdk.org
> > > Cc: Xing, Beilei <beilei.xing@intel.com>; Wang, Haiyue
> > > <haiyue.wang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Zhang,
> > > Xiao <xiao.zhang@intel.com>
> > > Subject: [DPDK] net/i40e: fix SFP X722 not work with FW4.16
> > >
> > > FW4.16 of SFP X722 does not support setting TPID by
> > > set_switch_config adminq operation, for firmware version less than
> > > 4.16 TPID is set by register instead. Follow the same path with new
> > > firmware version for SFP X722 to make it work.
> > >
> > > Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> > > ---
> > >  drivers/net/i40e/i40e_ethdev.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > > b/drivers/net/i40e/i40e_ethdev.c index 2b9fc45..bf6dc2b 100644
> > > --- a/drivers/net/i40e/i40e_ethdev.c
> > > +++ b/drivers/net/i40e/i40e_ethdev.c
> > > @@ -3708,7 +3708,9 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,
> > >  	}
> > >
> > >  	/* 802.1ad frames ability is added in NVM API 1.7*/
> > > -	if (hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) {
> > > +	/* FW4.16 for SFP x722 does not support set_switch_config option */
> > > +	if ((hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) &&
> > > +		hw->device_id != I40E_DEV_ID_SFP_X722) {
> > >  		if (qinq) {
> > >  			if (vlan_type == ETH_VLAN_TYPE_OUTER)
> > >  				hw->first_tag = rte_cpu_to_le_16(tpid);
> >
> > Control the ' I40E_HW_FLAG_802_1AD_CAPABLE ' set or not here is better ?
> >
> > enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
> >
> > 	/* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */
> > 	if ((hw->aq.api_maj_ver > 1) ||
> > 	    ((hw->aq.api_maj_ver == 1) &&
> > 	     (hw->aq.api_min_ver >= 7)))
> > 		hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE;
> >
> Looks like changing the share code. Or like :
> 
> 	ret = i40e_init_adminq(hw);
> 	if (ret != I40E_SUCCESS) {
> 		PMD_INIT_LOG(ERR, "Failed to init adminq: %d", ret);
> 		return -EIO;
> 	}
> 	...
> 	clear I40E_HW_FLAG_802_1AD_CAPABLE here ...

Yes, it's better to clear this flag in case it will be used in other place.

> > > --
> > > 2.7.4
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2b9fc45..bf6dc2b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -3708,7 +3708,9 @@  i40e_vlan_tpid_set(struct rte_eth_dev *dev,
 	}
 
 	/* 802.1ad frames ability is added in NVM API 1.7*/
-	if (hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) {
+	/* FW4.16 for SFP x722 does not support set_switch_config option */
+	if ((hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) &&
+		hw->device_id != I40E_DEV_ID_SFP_X722) {
 		if (qinq) {
 			if (vlan_type == ETH_VLAN_TYPE_OUTER)
 				hw->first_tag = rte_cpu_to_le_16(tpid);