net/i40e: fix conflict with multi-driver

Message ID 20201119061616.37482-1-beilei.xing@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series net/i40e: fix conflict with multi-driver |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-testing warning Testing issues
ci/travis-robot success Travis build: passed

Commit Message

Xing, Beilei Nov. 19, 2020, 6:16 a.m. UTC
  From: Beilei Xing <beilei.xing@intel.com>

PMD configures the global register I40E_GLINT_CTL during
device initialization to work around the Rx write back
issue. But when a device is bound from DPDK to kernel,
the global register is not recovered to the original
state, it will cause kernel driver performance drop issue.
This patch fixes this issue.

Fixes: be6c228d4da3 ("i40e: support Rx interrupt")
Cc: stable@dpdk.org

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
  

Comments

Guo, Jia Nov. 19, 2020, 6:24 a.m. UTC | #1
Hi, beilei

> -----Original Message-----
> From: Xing, Beilei <beilei.xing@intel.com>
> Sent: Thursday, November 19, 2020 2:16 PM
> To: dev@dpdk.org
> Cc: Guo, Jia <jia.guo@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] net/i40e: fix conflict with multi-driver
> 

Seems that this patch both handle multi-driver and none multi-driver.
I am not sure if it need to rename to a better name, you choice.
" net/i40e: fix global register recovery"?

> From: Beilei Xing <beilei.xing@intel.com>
> 
> PMD configures the global register I40E_GLINT_CTL during device
> initialization to work around the Rx write back issue. But when a device is
> bound from DPDK to kernel, the global register is not recovered to the
> original state, it will cause kernel driver performance drop issue.
> This patch fixes this issue.
> 
> Fixes: be6c228d4da3 ("i40e: support Rx interrupt")

If the issue is root cause that the miss-pair automask configure and automask clear, 
do you think it will be better to add one more fixes tag  as below? 
Fixes: 4ab831449a1c ("net/i40e: fix interrupt conflict with multi-driver ")

> Cc: stable@dpdk.org
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index f54769c29d..2cb18ecc03 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -763,6 +763,21 @@ static inline void i40e_config_automask(struct
> i40e_pf *pf)
>  	I40E_WRITE_REG(hw, I40E_GLINT_CTL, val);  }
> 
> +static inline void i40e_clear_automask(struct i40e_pf *pf) {
> +	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
> +	uint32_t val;
> +
> +	val = I40E_READ_REG(hw, I40E_GLINT_CTL);
> +	val &= ~(I40E_GLINT_CTL_DIS_AUTOMASK_PF0_MASK |
> +		 I40E_GLINT_CTL_DIS_AUTOMASK_VF0_MASK);
> +
> +	if (!pf->support_multi_driver)
> +		val &= ~I40E_GLINT_CTL_DIS_AUTOMASK_N_MASK;
> +
> +	I40E_WRITE_REG(hw, I40E_GLINT_CTL, val); }
> +
>  #define I40E_FLOW_CONTROL_ETHERTYPE  0x8808
> 
>  /*
> @@ -2741,6 +2756,8 @@ i40e_dev_close(struct rte_eth_dev *dev)
>  	/* Remove all Traffic Manager configuration */
>  	i40e_tm_conf_uninit(dev);
> 
> +	i40e_clear_automask(pf);
> +
>  	hw->adapter_closed = 1;
>  	return ret;
>  }
> --
> 2.26.2
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f54769c29d..2cb18ecc03 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -763,6 +763,21 @@  static inline void i40e_config_automask(struct i40e_pf *pf)
 	I40E_WRITE_REG(hw, I40E_GLINT_CTL, val);
 }
 
+static inline void i40e_clear_automask(struct i40e_pf *pf)
+{
+	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+	uint32_t val;
+
+	val = I40E_READ_REG(hw, I40E_GLINT_CTL);
+	val &= ~(I40E_GLINT_CTL_DIS_AUTOMASK_PF0_MASK |
+		 I40E_GLINT_CTL_DIS_AUTOMASK_VF0_MASK);
+
+	if (!pf->support_multi_driver)
+		val &= ~I40E_GLINT_CTL_DIS_AUTOMASK_N_MASK;
+
+	I40E_WRITE_REG(hw, I40E_GLINT_CTL, val);
+}
+
 #define I40E_FLOW_CONTROL_ETHERTYPE  0x8808
 
 /*
@@ -2741,6 +2756,8 @@  i40e_dev_close(struct rte_eth_dev *dev)
 	/* Remove all Traffic Manager configuration */
 	i40e_tm_conf_uninit(dev);
 
+	i40e_clear_automask(pf);
+
 	hw->adapter_closed = 1;
 	return ret;
 }