DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xiaoyun Li <xiaoyun.li@intel.com>
To: beilei.xing@intel.com
Cc: jingjing.wu@intel.com, dev@dpdk.org,
	Xiaoyun Li <xiaoyun.li@intel.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2] net/i40e: fix PF notify issue when VF is not up
Date: Tue, 15 Aug 2017 15:06:29 +0800	[thread overview]
Message-ID: <1502780789-17352-1-git-send-email-xiaoyun.li@intel.com> (raw)
In-Reply-To: <1502768028-187875-1-git-send-email-xiaoyun.li@intel.com>

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

  parent reply	other threads:[~2017-08-15  7:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15  3:33 [dpdk-dev] [PATCH] " Xiaoyun Li
2017-08-15  5:26 ` Xing, Beilei
2017-08-15  7:06 ` Xiaoyun Li [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502780789-17352-1-git-send-email-xiaoyun.li@intel.com \
    --to=xiaoyun.li@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).