DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: fix PF notify issue when VF is not up
@ 2017-08-15  3:33 Xiaoyun Li
  2017-08-15  5:26 ` Xing, Beilei
  2017-08-15  7:06 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
  0 siblings, 2 replies; 6+ messages in thread
From: Xiaoyun Li @ 2017-08-15  3:33 UTC (permalink / raw)
  To: beilei.xing; +Cc: jingjing.wu, dev, Xiaoyun Li, stable

This patch stops PF from sending message to VF when VF's ARQ and ATQ
isn't enabled, namely VF isn't up and modifies VF state to active when
VF reset is completed.

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
 drivers/net/i40e/i40e_pf.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 100f8dc..c40f40a 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -167,6 +167,9 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)
 		PMD_DRV_LOG(ERR, "VF reset timeout");
 		return -ETIMEDOUT;
 	}
+
+	vf->state = I40E_VF_ACTIVE;
+
 	/* This is not first time to do reset, do cleanup job first */
 	if (vf->vsi) {
 		/* Disable queues */
@@ -1224,8 +1227,22 @@ i40e_notify_vf_link_status(struct rte_eth_dev *dev, struct i40e_pf_vf *vf)
 		break;
 	}
 
-	i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_EVENT,
-		I40E_SUCCESS, (uint8_t *)&event, sizeof(event));
+	uint32_t tval, rval;
+	uint16_t vf_id;
+	struct i40e_hw *hw;
+
+	hw = I40E_PF_TO_HW(vf->pf);
+	vf_id = vf->vf_idx;
+
+	tval = I40E_READ_REG(hw, I40E_VF_ATQLEN(vf_id));
+	rval = I40E_READ_REG(hw, I40E_VF_ARQLEN(vf_id));
+
+	if (tval & I40E_VF_ATQLEN_ATQLEN_MASK ||
+		tval & I40E_VF_ATQLEN_ATQENABLE_MASK ||
+		rval & I40E_VF_ARQLEN_ARQLEN_MASK ||
+		rval & I40E_VF_ARQLEN_ARQENABLE_MASK)
+		i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_EVENT,
+			I40E_SUCCESS, (uint8_t *)&event, sizeof(event));
 }
 
 void
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] net/i40e: fix PF notify issue when VF is not up
  2017-08-15  3:33 [dpdk-dev] [PATCH] net/i40e: fix PF notify issue when VF is not up Xiaoyun Li
@ 2017-08-15  5:26 ` Xing, Beilei
  2017-08-15  7:06 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
  1 sibling, 0 replies; 6+ messages in thread
From: Xing, Beilei @ 2017-08-15  5:26 UTC (permalink / raw)
  To: Li, Xiaoyun; +Cc: Wu, Jingjing, dev, stable


> -----Original Message-----
> From: Li, Xiaoyun
> Sent: Tuesday, August 15, 2017 11:34 AM
> To: Xing, Beilei <beilei.xing@intel.com>
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org; Li, Xiaoyun
> <xiaoyun.li@intel.com>; stable@dpdk.org
> Subject: [PATCH] net/i40e: fix PF notify issue when VF is not up
> 
> This patch stops PF from sending message to VF when VF's ARQ and ATQ isn't

Abbreviation is not easy to understand, how about changing ARQ and ATQ with admin queue?

> enabled, namely VF isn't up and modifies VF state to active when VF reset is
> completed.
> 
> Fixes: 4861cde46116 ("i40e: new poll mode driver")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> ---
>  drivers/net/i40e/i40e_pf.c | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index
> 100f8dc..c40f40a 100644
> --- a/drivers/net/i40e/i40e_pf.c
> +++ b/drivers/net/i40e/i40e_pf.c
> @@ -167,6 +167,9 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool
> do_hw_reset)
>  		PMD_DRV_LOG(ERR, "VF reset timeout");
>  		return -ETIMEDOUT;
>  	}
> +
> +	vf->state = I40E_VF_ACTIVE;
> +
>  	/* This is not first time to do reset, do cleanup job first */
>  	if (vf->vsi) {
>  		/* Disable queues */
> @@ -1224,8 +1227,22 @@ i40e_notify_vf_link_status(struct rte_eth_dev
> *dev, struct i40e_pf_vf *vf)
>  		break;
>  	}
> 
> -	i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_EVENT,
> -		I40E_SUCCESS, (uint8_t *)&event, sizeof(event));
> +	uint32_t tval, rval;
> +	uint16_t vf_id;
> +	struct i40e_hw *hw;

Move the above variable up to the begin of the function.

> +
> +	hw = I40E_PF_TO_HW(vf->pf);
> +	vf_id = vf->vf_idx;
> +
> +	tval = I40E_READ_REG(hw, I40E_VF_ATQLEN(vf_id));
> +	rval = I40E_READ_REG(hw, I40E_VF_ARQLEN(vf_id));
> +
> +	if (tval & I40E_VF_ATQLEN_ATQLEN_MASK ||
> +		tval & I40E_VF_ATQLEN_ATQENABLE_MASK ||
> +		rval & I40E_VF_ARQLEN_ARQLEN_MASK ||
> +		rval & I40E_VF_ARQLEN_ARQENABLE_MASK)
> +		i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_EVENT,
> +			I40E_SUCCESS, (uint8_t *)&event, sizeof(event));
>  }
> 
>  void
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] net/i40e: fix PF notify issue when VF is not up
  2017-08-15  3:33 [dpdk-dev] [PATCH] net/i40e: fix PF notify issue when VF is not up Xiaoyun Li
  2017-08-15  5:26 ` Xing, Beilei
@ 2017-08-15  7:06 ` Xiaoyun Li
  2017-08-15  7:39   ` [dpdk-dev] [PATCH v3] " Xiaoyun Li
  1 sibling, 1 reply; 6+ messages in thread
From: Xiaoyun Li @ 2017-08-15  7:06 UTC (permalink / raw)
  To: beilei.xing; +Cc: jingjing.wu, dev, Xiaoyun Li, stable

This patch stops PF from sending message to VF when VF's admin queue
isn't enabled, namely VF isn't up and modifies VF state to active when
VF reset is completed.

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
v2:
* Modify the abbreviation to be clearer.
* Move variables' declaration up to the begin of function.

 drivers/net/i40e/i40e_pf.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 100f8dc..2c3c835 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -167,6 +167,9 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)
 		PMD_DRV_LOG(ERR, "VF reset timeout");
 		return -ETIMEDOUT;
 	}
+
+	vf->state = I40E_VF_ACTIVE;
+
 	/* This is not first time to do reset, do cleanup job first */
 	if (vf->vsi) {
 		/* Disable queues */
@@ -1193,6 +1196,9 @@ void
 i40e_notify_vf_link_status(struct rte_eth_dev *dev, struct i40e_pf_vf *vf)
 {
 	struct virtchnl_pf_event event;
+	uint32_t tval, rval;
+	uint16_t vf_id;
+	struct i40e_hw *hw;
 
 	event.event = VIRTCHNL_EVENT_LINK_CHANGE;
 	event.event_data.link_event.link_status =
@@ -1224,8 +1230,18 @@ i40e_notify_vf_link_status(struct rte_eth_dev *dev, struct i40e_pf_vf *vf)
 		break;
 	}
 
-	i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_EVENT,
-		I40E_SUCCESS, (uint8_t *)&event, sizeof(event));
+	hw = I40E_PF_TO_HW(vf->pf);
+	vf_id = vf->vf_idx;
+
+	tval = I40E_READ_REG(hw, I40E_VF_ATQLEN(vf_id));
+	rval = I40E_READ_REG(hw, I40E_VF_ARQLEN(vf_id));
+
+	if (tval & I40E_VF_ATQLEN_ATQLEN_MASK ||
+		tval & I40E_VF_ATQLEN_ATQENABLE_MASK ||
+		rval & I40E_VF_ARQLEN_ARQLEN_MASK ||
+		rval & I40E_VF_ARQLEN_ARQENABLE_MASK)
+		i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_EVENT,
+			I40E_SUCCESS, (uint8_t *)&event, sizeof(event));
 }
 
 void
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v3] net/i40e: fix PF notify issue when VF is not up
  2017-08-15  7:06 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
@ 2017-08-15  7:39   ` Xiaoyun Li
  2017-08-15  9:06     ` Xing, Beilei
  0 siblings, 1 reply; 6+ messages in thread
From: Xiaoyun Li @ 2017-08-15  7:39 UTC (permalink / raw)
  To: beilei.xing; +Cc: jingjing.wu, dev, Xiaoyun Li, stable

This patch stops PF from sending message to VF when VF's admin queue
isn't enabled, namely VF isn't up.

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
v3:
* Modify the code to be more concise.
* Don't modify vf's state since it isn't used in this patch.

 drivers/net/i40e/i40e_pf.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 100f8dc..fe89027 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -1192,7 +1192,10 @@ i40e_pf_host_process_cmd_cfg_pvid(struct i40e_pf_vf *vf,
 void
 i40e_notify_vf_link_status(struct rte_eth_dev *dev, struct i40e_pf_vf *vf)
 {
+	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	struct virtchnl_pf_event event;
+	uint16_t vf_id = vf->vf_idx;
+	uint32_t tval, rval;
 
 	event.event = VIRTCHNL_EVENT_LINK_CHANGE;
 	event.event_data.link_event.link_status =
@@ -1224,8 +1227,15 @@ i40e_notify_vf_link_status(struct rte_eth_dev *dev, struct i40e_pf_vf *vf)
 		break;
 	}
 
-	i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_EVENT,
-		I40E_SUCCESS, (uint8_t *)&event, sizeof(event));
+	tval = I40E_READ_REG(hw, I40E_VF_ATQLEN(vf_id));
+	rval = I40E_READ_REG(hw, I40E_VF_ARQLEN(vf_id));
+
+	if (tval & I40E_VF_ATQLEN_ATQLEN_MASK ||
+	    tval & I40E_VF_ATQLEN_ATQENABLE_MASK ||
+	    rval & I40E_VF_ARQLEN_ARQLEN_MASK ||
+	    rval & I40E_VF_ARQLEN_ARQENABLE_MASK)
+		i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_EVENT,
+			I40E_SUCCESS, (uint8_t *)&event, sizeof(event));
 }
 
 void
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v3] net/i40e: fix PF notify issue when VF is not up
  2017-08-15  7:39   ` [dpdk-dev] [PATCH v3] " Xiaoyun Li
@ 2017-08-15  9:06     ` Xing, Beilei
  2017-08-18 16:22       ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  0 siblings, 1 reply; 6+ messages in thread
From: Xing, Beilei @ 2017-08-15  9:06 UTC (permalink / raw)
  To: Li, Xiaoyun; +Cc: Wu, Jingjing, dev, stable



> -----Original Message-----
> From: Li, Xiaoyun
> Sent: Tuesday, August 15, 2017 3:40 PM
> To: Xing, Beilei <beilei.xing@intel.com>
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org; Li, Xiaoyun
> <xiaoyun.li@intel.com>; stable@dpdk.org
> Subject: [PATCH v3] net/i40e: fix PF notify issue when VF is not up
> 
> This patch stops PF from sending message to VF when VF's admin queue isn't
> enabled, namely VF isn't up.
> 
> Fixes: 4861cde46116 ("i40e: new poll mode driver")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>

Acked-by: Beilei Xing <beilei.xing@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v3] net/i40e: fix PF notify issue when VF is not up
  2017-08-15  9:06     ` Xing, Beilei
@ 2017-08-18 16:22       ` Ferruh Yigit
  0 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2017-08-18 16:22 UTC (permalink / raw)
  To: Xing, Beilei, Li, Xiaoyun; +Cc: Wu, Jingjing, dev, stable

On 8/15/2017 10:06 AM, Xing, Beilei wrote:
> 
> 
>> -----Original Message-----
>> From: Li, Xiaoyun
>> Sent: Tuesday, August 15, 2017 3:40 PM
>> To: Xing, Beilei <beilei.xing@intel.com>
>> Cc: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org; Li, Xiaoyun
>> <xiaoyun.li@intel.com>; stable@dpdk.org
>> Subject: [PATCH v3] net/i40e: fix PF notify issue when VF is not up
>>
>> This patch stops PF from sending message to VF when VF's admin queue isn't
>> enabled, namely VF isn't up.
>>
>> Fixes: 4861cde46116 ("i40e: new poll mode driver")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> 
> Acked-by: Beilei Xing <beilei.xing@intel.com>

Applied to dpdk-next-net/master, thanks. (again :) )

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-08-18 16:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-15  3:33 [dpdk-dev] [PATCH] net/i40e: fix PF notify issue when VF is not up Xiaoyun Li
2017-08-15  5:26 ` Xing, Beilei
2017-08-15  7:06 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
2017-08-15  7:39   ` [dpdk-dev] [PATCH v3] " Xiaoyun Li
2017-08-15  9:06     ` Xing, Beilei
2017-08-18 16:22       ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).