From: Alice Michael <alice.michael@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next PATCH S7 4/9] i40e: don't report link up for a VF who hasn't enabled queues
Date: Tue, 2 Jul 2019 08:22:54 -0400 [thread overview]
Message-ID: <20190702122259.79070-4-alice.michael@intel.com> (raw)
In-Reply-To: <20190702122259.79070-1-alice.michael@intel.com>
From: Jacob Keller <jacob.e.keller@intel.com>
Commit d3d657a90850 ("i40e: update VFs of link state after
GET_VF_RESOURCES") modified the PF driver to notify a VF of
its link status immediately after it requests resources.
This was intended to fix reporting on VF drivers, so that they would
properly report link status.
However, some older VF drivers do not respond well to receiving a link
up notification before queues are enabled. This can cause their state
machine to think that it is safe to send traffic. This results in a Tx
hang on the VF.
More recent versions of the old i40evf and all versions of iavf are
resilient to these early link status messages. However, if a VM happens
to run an older version of the VF driver, this can be problematic.
Record whether the PF has actually enabled queues for the VF. When
reporting link status, always report link down if the queues aren't
enabled. In this way, the VF driver will never receive a link up
notification until after its queues are enabled.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 13 ++++++++++++-
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 1 +
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 21f7ac514d1f..bffdea629982 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -55,7 +55,12 @@ static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf)
pfe.event = VIRTCHNL_EVENT_LINK_CHANGE;
pfe.severity = PF_EVENT_SEVERITY_INFO;
- if (vf->link_forced) {
+
+ /* Always report link is down if the VF queues aren't enabled */
+ if (!vf->queues_enabled) {
+ pfe.event_data.link_event.link_status = false;
+ pfe.event_data.link_event.link_speed = 0;
+ } else if (vf->link_forced) {
pfe.event_data.link_event.link_status = vf->link_up;
pfe.event_data.link_event.link_speed =
(vf->link_up ? VIRTCHNL_LINK_SPEED_40GB : 0);
@@ -65,6 +70,7 @@ static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf)
pfe.event_data.link_event.link_speed =
i40e_virtchnl_link_speed(ls->link_speed);
}
+
i40e_aq_send_msg_to_vf(hw, abs_vf_id, VIRTCHNL_OP_EVENT,
0, (u8 *)&pfe, sizeof(pfe), NULL);
}
@@ -2364,6 +2370,8 @@ static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg)
}
}
+ vf->queues_enabled = true;
+
error_param:
/* send the response to the VF */
return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ENABLE_QUEUES,
@@ -2385,6 +2393,9 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg)
struct i40e_pf *pf = vf->pf;
i40e_status aq_ret = 0;
+ /* Immediately mark queues as disabled */
+ vf->queues_enabled = false;
+
if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
aq_ret = I40E_ERR_PARAM;
goto error_param;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
index f65cc0c16550..7164b9bb294f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
@@ -99,6 +99,7 @@ struct i40e_vf {
unsigned int tx_rate; /* Tx bandwidth limit in Mbps */
bool link_forced;
bool link_up; /* only valid if VF link is forced */
+ bool queues_enabled; /* true if the VF queues are enabled */
bool spoofchk;
u16 num_mac;
u16 num_vlan;
--
2.21.0
next prev parent reply other threads:[~2019-07-02 12:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-02 12:22 [Intel-wired-lan] [next PATCH S7 1/9] i40e: fix incorrect ethtool statistics veb and veb.tc_ Alice Michael
2019-07-02 12:22 ` [Intel-wired-lan] [next PATCH S7 2/9] i40e: make visible changed vf mac on host Alice Michael
2019-07-03 21:37 ` Bowers, AndrewX
2019-07-02 12:22 ` [Intel-wired-lan] [next PATCH S7 3/9] i40e: Log disable-fw-lldp flag change by ethtool Alice Michael
2019-07-03 21:39 ` Bowers, AndrewX
2019-07-02 12:22 ` Alice Michael [this message]
2019-07-03 21:40 ` [Intel-wired-lan] [next PATCH S7 4/9] i40e: don't report link up for a VF who hasn't enabled queues Bowers, AndrewX
2019-07-02 12:22 ` [Intel-wired-lan] [next PATCH S7 5/9] i40e: fix code comments Alice Michael
2019-07-03 21:41 ` Bowers, AndrewX
2019-07-02 12:22 ` [Intel-wired-lan] [next PATCH S7 6/9] i40e: Update visual effect for advertised FEC mode Alice Michael
2019-07-03 21:41 ` Bowers, AndrewX
2019-07-02 12:22 ` [Intel-wired-lan] [next PATCH S7 7/9] i40e: Log info when PF is entering and leaving Allmulti mode Alice Michael
2019-07-03 21:42 ` Bowers, AndrewX
2019-07-02 12:22 ` [Intel-wired-lan] [next PATCH S7 8/9] i40e: verify string count matches even on early return Alice Michael
2019-07-03 21:42 ` Bowers, AndrewX
2019-07-02 12:22 ` [Intel-wired-lan] [next PATCH S7 9/9] i40e: Remove unicast log when VF is leaving multicast mode Alice Michael
2019-07-03 21:43 ` Bowers, AndrewX
2019-07-03 21:33 ` [Intel-wired-lan] [next PATCH S7 1/9] i40e: fix incorrect ethtool statistics veb and veb.tc_ Bowers, AndrewX
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=20190702122259.79070-4-alice.michael@intel.com \
--to=alice.michael@intel.com \
--cc=intel-wired-lan@osuosl.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