[dpdk-dev,v3] net/i40e: fix PF notify issue when VF is not up

Message ID 1502782776-18669-1-git-send-email-xiaoyun.li@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Li, Xiaoyun Aug. 15, 2017, 7:39 a.m. UTC
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(-)
  

Comments

Xing, Beilei Aug. 15, 2017, 9:06 a.m. UTC | #1
> -----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>
  
Ferruh Yigit Aug. 18, 2017, 4:22 p.m. UTC | #2
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 :) )
  

Patch

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