[v16,01/19] net/i40e: i40e support ipn3ke FPGA port bonding

Message ID 1573628898-190337-2-git-send-email-rosen.xu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: xiaolong ye
Headers
Series add PCIe AER disable and IRQ support for ipn3ke |

Checks

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

Commit Message

Xu, Rosen Nov. 13, 2019, 7:08 a.m. UTC
  From: Andy Pei <andy.pei@intel.com>

In ipn3ke, each FPGA network side port bonding to an i40e pf,
each i40e pf link status should get data from FPGA network,
side port. This patch provide bonding relationship.

Signed-off-by: Rosen Xu <rosen.xu@intel.com>
Signed-off-by: Andy Pei <andy.pei@intel.com>
---
 drivers/net/i40e/base/i40e_type.h         |  3 +++
 drivers/net/i40e/i40e_ethdev.c            |  6 ++++++
 drivers/net/i40e/rte_pmd_i40e.c           | 21 +++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 18 ++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  8 +++++++-
 5 files changed, 55 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit Nov. 13, 2019, 2:38 p.m. UTC | #1
On 11/13/2019 7:08 AM, Rosen Xu wrote:
> From: Andy Pei <andy.pei@intel.com>
> 
> In ipn3ke, each FPGA network side port bonding to an i40e pf,
> each i40e pf link status should get data from FPGA network,
> side port. This patch provide bonding relationship.
> 
> Signed-off-by: Rosen Xu <rosen.xu@intel.com>
> Signed-off-by: Andy Pei <andy.pei@intel.com>

<...>

> @@ -1061,4 +1061,22 @@ int rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
>  	return 0;
>  }
>  
> +/**
> + * For ipn3ke, i40e works with FPGA.
> + * In this situation, i40e get link status from fpga,
> + * fpga works as switch_dev for i40e.
> + * This function set switch_dev for i40e.
> + *
> + * @param inset
> + *    Input set value.
> + * @param field_idx
> + *    Field index for input set.

These params are wrong, can you please provide proper information, I can update
them in next-net?

> + * @return
> + *   - (less than 0) if failed.
> + *   - (0) if success.
> + */
> +__rte_experimental
> +int
> +rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev *switch_dev);
> +
>  #endif /* _PMD_I40E_H_ */
> diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map b/drivers/net/i40e/rte_pmd_i40e_version.map
> index cccd576..79641f2 100644
> --- a/drivers/net/i40e/rte_pmd_i40e_version.map
> +++ b/drivers/net/i40e/rte_pmd_i40e_version.map
> @@ -64,4 +64,10 @@ DPDK_18.02 {
>  
>  	rte_pmd_i40e_inset_get;
>  	rte_pmd_i40e_inset_set;
> -} DPDK_17.11;
> \ No newline at end of file
> +} DPDK_17.11;
> +
> +EXPERIMENTAL {
> +	global:
> +
> +	rte_pmd_i40e_set_switch_dev;
> +} DPDK_18.02;

The 'DPDK_18.02' part is not required for experimental block, I will remove it
while merging.
  
Ferruh Yigit Nov. 13, 2019, 2:50 p.m. UTC | #2
On 11/13/2019 2:38 PM, Ferruh Yigit wrote:
> On 11/13/2019 7:08 AM, Rosen Xu wrote:
>> From: Andy Pei <andy.pei@intel.com>
>>
>> In ipn3ke, each FPGA network side port bonding to an i40e pf,
>> each i40e pf link status should get data from FPGA network,
>> side port. This patch provide bonding relationship.
>>
>> Signed-off-by: Rosen Xu <rosen.xu@intel.com>
>> Signed-off-by: Andy Pei <andy.pei@intel.com>
> 
> <...>
> 
>> @@ -1061,4 +1061,22 @@ int rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
>>  	return 0;
>>  }
>>  
>> +/**
>> + * For ipn3ke, i40e works with FPGA.
>> + * In this situation, i40e get link status from fpga,
>> + * fpga works as switch_dev for i40e.
>> + * This function set switch_dev for i40e.
>> + *
>> + * @param inset
>> + *    Input set value.
>> + * @param field_idx
>> + *    Field index for input set.
> 
> These params are wrong, can you please provide proper information, I can update
> them in next-net?
> 
>> + * @return
>> + *   - (less than 0) if failed.
>> + *   - (0) if success.
>> + */
>> +__rte_experimental
>> +int
>> +rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev *switch_dev);
>> +
>>  #endif /* _PMD_I40E_H_ */
>> diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map b/drivers/net/i40e/rte_pmd_i40e_version.map
>> index cccd576..79641f2 100644
>> --- a/drivers/net/i40e/rte_pmd_i40e_version.map
>> +++ b/drivers/net/i40e/rte_pmd_i40e_version.map
>> @@ -64,4 +64,10 @@ DPDK_18.02 {
>>  
>>  	rte_pmd_i40e_inset_get;
>>  	rte_pmd_i40e_inset_set;
>> -} DPDK_17.11;
>> \ No newline at end of file
>> +} DPDK_17.11;
>> +
>> +EXPERIMENTAL {
>> +	global:
>> +
>> +	rte_pmd_i40e_set_switch_dev;
>> +} DPDK_18.02;
> 
> The 'DPDK_18.02' part is not required for experimental block, I will remove it
> while merging.
> 

Since there will be a new version, can you please fix these too in next version?
  
Xu, Rosen Nov. 14, 2019, 7:15 a.m. UTC | #3
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, November 13, 2019 22:38
> To: Xu, Rosen <rosen.xu@intel.com>; dev@dpdk.org
> Cc: Zhang, Tianfei <tianfei.zhang@intel.com>; Pei, Andy
> <andy.pei@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>
> Subject: Re: [PATCH v16 01/19] net/i40e: i40e support ipn3ke FPGA port
> bonding
> 
> On 11/13/2019 7:08 AM, Rosen Xu wrote:
> > From: Andy Pei <andy.pei@intel.com>
> >
> > In ipn3ke, each FPGA network side port bonding to an i40e pf, each
> > i40e pf link status should get data from FPGA network, side port. This
> > patch provide bonding relationship.
> >
> > Signed-off-by: Rosen Xu <rosen.xu@intel.com>
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> 
> <...>
> 
> > @@ -1061,4 +1061,22 @@ int rte_pmd_i40e_inset_set(uint16_t port,
> uint8_t pctype,
> >  	return 0;
> >  }
> >
> > +/**
> > + * For ipn3ke, i40e works with FPGA.
> > + * In this situation, i40e get link status from fpga,
> > + * fpga works as switch_dev for i40e.
> > + * This function set switch_dev for i40e.
> > + *
> > + * @param inset
> > + *    Input set value.
> > + * @param field_idx
> > + *    Field index for input set.
> 
> These params are wrong, can you please provide proper information, I can
> update them in next-net?

Fixed in v17.

> > + * @return
> > + *   - (less than 0) if failed.
> > + *   - (0) if success.
> > + */
> > +__rte_experimental
> > +int
> > +rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev
> > +*switch_dev);
> > +
> >  #endif /* _PMD_I40E_H_ */
> > diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map
> > b/drivers/net/i40e/rte_pmd_i40e_version.map
> > index cccd576..79641f2 100644
> > --- a/drivers/net/i40e/rte_pmd_i40e_version.map
> > +++ b/drivers/net/i40e/rte_pmd_i40e_version.map
> > @@ -64,4 +64,10 @@ DPDK_18.02 {
> >
> >  	rte_pmd_i40e_inset_get;
> >  	rte_pmd_i40e_inset_set;
> > -} DPDK_17.11;
> > \ No newline at end of file
> > +} DPDK_17.11;
> > +
> > +EXPERIMENTAL {
> > +	global:
> > +
> > +	rte_pmd_i40e_set_switch_dev;
> > +} DPDK_18.02;
> 
> The 'DPDK_18.02' part is not required for experimental block, I will remove it
> while merging.

Fixed in v17.
  

Patch

diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h
index 112866b..06863d7 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -660,6 +660,9 @@  struct i40e_hw {
 	struct i40e_nvm_info nvm;
 	struct i40e_fc_info fc;
 
+	/* switch device is used to get link status when i40e is in ipn3ke */
+	struct rte_eth_dev *switch_dev;
+
 	/* pci info */
 	u16 device_id;
 	u16 vendor_id;
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 9a81f99..1afddeb 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1393,6 +1393,9 @@  static inline void i40e_config_automask(struct i40e_pf *pf)
 	hw->adapter_stopped = 0;
 	hw->adapter_closed = 0;
 
+	/* Init switch device pointer */
+	hw->switch_dev = NULL;
+
 	/*
 	 * Switch Tag value should not be identical to either the First Tag
 	 * or Second Tag values. So set something other than common Ethertype
@@ -2906,6 +2909,9 @@  void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
 	else
 		update_link_aq(hw, &link, enable_lse, wait_to_complete);
 
+	if (hw->switch_dev)
+		rte_eth_linkstatus_get(hw->switch_dev, &link);
+
 	ret = rte_eth_linkstatus_set(dev, &link);
 	i40e_notify_all_vfs_link_status(dev);
 
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index 4c3c708..fdcb1a4 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -3207,3 +3207,24 @@  int rte_pmd_i40e_flow_add_del_packet_template(
 	I40E_WRITE_FLUSH(hw);
 	return 0;
 }
+
+int
+rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev *switch_dev)
+{
+	struct rte_eth_dev *i40e_dev;
+	struct i40e_hw *hw;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+	i40e_dev = &rte_eth_devices[port_id];
+	if (!is_i40e_supported(i40e_dev))
+		return -ENOTSUP;
+
+	hw = I40E_DEV_PRIVATE_TO_HW(i40e_dev->data->dev_private);
+	if (!hw)
+		return -1;
+
+	hw->switch_dev = switch_dev;
+
+	return 0;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index faac9e2..355b8be 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -1061,4 +1061,22 @@  int rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
 	return 0;
 }
 
+/**
+ * For ipn3ke, i40e works with FPGA.
+ * In this situation, i40e get link status from fpga,
+ * fpga works as switch_dev for i40e.
+ * This function set switch_dev for i40e.
+ *
+ * @param inset
+ *    Input set value.
+ * @param field_idx
+ *    Field index for input set.
+ * @return
+ *   - (less than 0) if failed.
+ *   - (0) if success.
+ */
+__rte_experimental
+int
+rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev *switch_dev);
+
 #endif /* _PMD_I40E_H_ */
diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map b/drivers/net/i40e/rte_pmd_i40e_version.map
index cccd576..79641f2 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -64,4 +64,10 @@  DPDK_18.02 {
 
 	rte_pmd_i40e_inset_get;
 	rte_pmd_i40e_inset_set;
-} DPDK_17.11;
\ No newline at end of file
+} DPDK_17.11;
+
+EXPERIMENTAL {
+	global:
+
+	rte_pmd_i40e_set_switch_dev;
+} DPDK_18.02;
\ No newline at end of file