[v6,01/17] net/i40e: i40e support ipn3ke FPGA port bonding

Message ID 1568883774-92149-2-git-send-email-andy.pei@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/Intel-compilation fail Compilation issues
ci/Performance-Testing fail build patch failure

Commit Message

Pei, Andy Sept. 19, 2019, 9:02 a.m. UTC
  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    | 20 ++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h   |  4 ++++
 3 files changed, 27 insertions(+)
  

Comments

Qi Zhang Sept. 20, 2019, 12:55 a.m. UTC | #1
> -----Original Message-----
> From: Pei, Andy
> Sent: Thursday, September 19, 2019 5:03 PM
> To: dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei <tianfei.zhang@intel.com>;
> Ye, Xiaolong <xiaolong.ye@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>;
> Lomartire, David <david.lomartire@intel.com>; Yigit, Ferruh
> <ferruh.yigit@intel.com>
> Subject: [PATCH v6 01/17] net/i40e: i40e support ipn3ke FPGA port bonding
> 
> 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    | 20 ++++++++++++++++++++
>  drivers/net/i40e/rte_pmd_i40e.h   |  4 ++++
>  3 files changed, 27 insertions(+)
> 
> 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 4e40b7a..6c4b1e8 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -1312,6 +1312,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
> @@ -2782,6 +2785,20 @@ void i40e_flex_payload_reg_set_default(struct
> i40e_hw *hw)
>  	}
>  }
> 
> +void
> +i40e_set_switch_dev(struct rte_eth_dev *i40e_dev, struct rte_eth_dev
> +*switch_dev) {
> +	struct i40e_hw *hw;
> +
> +	if (!i40e_dev)
> +		return;
> +
> +	hw = I40E_DEV_PRIVATE_TO_HW(i40e_dev->data->dev_private);
> +
> +	hw->switch_dev = switch_dev;
> +}

Better to move the function implementation into rte_pmd_i40e.c since it is declared at rte_pmd_i40e.h
> +
>  int
>  i40e_dev_link_update(struct rte_eth_dev *dev,
>  		     int wait_to_complete)
> @@ -2803,6 +2820,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.h
> b/drivers/net/i40e/rte_pmd_i40e.h index faac9e2..9d77c85 100644
> --- a/drivers/net/i40e/rte_pmd_i40e.h
> +++ b/drivers/net/i40e/rte_pmd_i40e.h
> @@ -1061,4 +1061,8 @@ int rte_pmd_i40e_inset_set(uint16_t port, uint8_t
> pctype,
>  	return 0;
>  }
> 
> +void
> +i40e_set_switch_dev(struct rte_eth_dev *i40e_dev, struct rte_eth_dev
> +*switch_dev);


1. Missing doxygen header here for the new API.
2. Also as an external API, we should use port_id but not rte_eth_dev as parameter.
3. you may also need to update the rte_pmd_i40e_version.map.

Regards
Qi

> +
>  #endif /* _PMD_I40E_H_ */
> --
> 1.8.3.1
  
Xiaolong Ye Sept. 24, 2019, 3 p.m. UTC | #2
On 09/19, Andy Pei wrote:
>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    | 20 ++++++++++++++++++++
> drivers/net/i40e/rte_pmd_i40e.h   |  4 ++++
> 3 files changed, 27 insertions(+)
>
>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 4e40b7a..6c4b1e8 100644
>--- a/drivers/net/i40e/i40e_ethdev.c
>+++ b/drivers/net/i40e/i40e_ethdev.c
>@@ -1312,6 +1312,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
>@@ -2782,6 +2785,20 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
> 	}
> }
> 
>+void
>+i40e_set_switch_dev(struct rte_eth_dev *i40e_dev,
>+struct rte_eth_dev *switch_dev)

Put a few tabs before parameter.

>+{
>+	struct i40e_hw *hw;
>+
>+	if (!i40e_dev)
>+		return;
>+
>+	hw = I40E_DEV_PRIVATE_TO_HW(i40e_dev->data->dev_private);
>+
>+	hw->switch_dev = switch_dev;
>+}
>+
> int
> i40e_dev_link_update(struct rte_eth_dev *dev,
> 		     int wait_to_complete)
>@@ -2803,6 +2820,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.h b/drivers/net/i40e/rte_pmd_i40e.h
>index faac9e2..9d77c85 100644
>--- a/drivers/net/i40e/rte_pmd_i40e.h
>+++ b/drivers/net/i40e/rte_pmd_i40e.h
>@@ -1061,4 +1061,8 @@ int rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
> 	return 0;
> }
> 
>+void
>+i40e_set_switch_dev(struct rte_eth_dev *i40e_dev,
>+struct rte_eth_dev *switch_dev);

Ditto.

>+
> #endif /* _PMD_I40E_H_ */
>-- 
>1.8.3.1
>
  
Pei, Andy Sept. 25, 2019, 7:08 a.m. UTC | #3
Hi Qi,

Will modify in next version.

-----Original Message-----
From: Zhang, Qi Z 
Sent: Friday, September 20, 2019 8:55 AM
To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
Cc: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei <tianfei.zhang@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>; Lomartire, David <david.lomartire@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
Subject: RE: [PATCH v6 01/17] net/i40e: i40e support ipn3ke FPGA port bonding



> -----Original Message-----
> From: Pei, Andy
> Sent: Thursday, September 19, 2019 5:03 PM
> To: dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei 
> <tianfei.zhang@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>; 
> Zhang, Qi Z <qi.z.zhang@intel.com>; Lomartire, David 
> <david.lomartire@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: [PATCH v6 01/17] net/i40e: i40e support ipn3ke FPGA port 
> bonding
> 
> 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    | 20 ++++++++++++++++++++
>  drivers/net/i40e/rte_pmd_i40e.h   |  4 ++++
>  3 files changed, 27 insertions(+)
> 
> 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 4e40b7a..6c4b1e8 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -1312,6 +1312,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 @@ -2782,6 +2785,20 @@ void 
> i40e_flex_payload_reg_set_default(struct
> i40e_hw *hw)
>  	}
>  }
> 
> +void
> +i40e_set_switch_dev(struct rte_eth_dev *i40e_dev, struct rte_eth_dev
> +*switch_dev) {
> +	struct i40e_hw *hw;
> +
> +	if (!i40e_dev)
> +		return;
> +
> +	hw = I40E_DEV_PRIVATE_TO_HW(i40e_dev->data->dev_private);
> +
> +	hw->switch_dev = switch_dev;
> +}

Better to move the function implementation into rte_pmd_i40e.c since it is declared at rte_pmd_i40e.h
> +
>  int
>  i40e_dev_link_update(struct rte_eth_dev *dev,
>  		     int wait_to_complete)
> @@ -2803,6 +2820,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.h 
> b/drivers/net/i40e/rte_pmd_i40e.h index faac9e2..9d77c85 100644
> --- a/drivers/net/i40e/rte_pmd_i40e.h
> +++ b/drivers/net/i40e/rte_pmd_i40e.h
> @@ -1061,4 +1061,8 @@ int rte_pmd_i40e_inset_set(uint16_t port, 
> uint8_t pctype,
>  	return 0;
>  }
> 
> +void
> +i40e_set_switch_dev(struct rte_eth_dev *i40e_dev, struct rte_eth_dev 
> +*switch_dev);


1. Missing doxygen header here for the new API.
2. Also as an external API, we should use port_id but not rte_eth_dev as parameter.
3. you may also need to update the rte_pmd_i40e_version.map.

Regards
Qi

> +
>  #endif /* _PMD_I40E_H_ */
> --
> 1.8.3.1
  

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 4e40b7a..6c4b1e8 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1312,6 +1312,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
@@ -2782,6 +2785,20 @@  void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
 	}
 }
 
+void
+i40e_set_switch_dev(struct rte_eth_dev *i40e_dev,
+struct rte_eth_dev *switch_dev)
+{
+	struct i40e_hw *hw;
+
+	if (!i40e_dev)
+		return;
+
+	hw = I40E_DEV_PRIVATE_TO_HW(i40e_dev->data->dev_private);
+
+	hw->switch_dev = switch_dev;
+}
+
 int
 i40e_dev_link_update(struct rte_eth_dev *dev,
 		     int wait_to_complete)
@@ -2803,6 +2820,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.h b/drivers/net/i40e/rte_pmd_i40e.h
index faac9e2..9d77c85 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -1061,4 +1061,8 @@  int rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
 	return 0;
 }
 
+void
+i40e_set_switch_dev(struct rte_eth_dev *i40e_dev,
+struct rte_eth_dev *switch_dev);
+
 #endif /* _PMD_I40E_H_ */