[dpdk-stable] [PATCH v2] net/i40e: fix PF notify issue when VF is not up

Xiaoyun Li xiaoyun.li at intel.com
Tue Aug 15 09:06:29 CEST 2017


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 at dpdk.org

Signed-off-by: Xiaoyun Li <xiaoyun.li at 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



More information about the stable mailing list