From: Steve Yang <stevex.yang@intel.com>
To: stable@dpdk.org
Cc: beilei.xing@intel.com, jia.guo@intel.com,
Guinan Sun <guinanx.sun@intel.com>
Subject: [dpdk-stable] [DPDK 18.11] net/i40e: fix link status
Date: Fri, 11 Dec 2020 09:01:03 +0000 [thread overview]
Message-ID: <20201211090105.28432-3-stevex.yang@intel.com> (raw)
In-Reply-To: <20201211090105.28432-1-stevex.yang@intel.com>
From: Guinan Sun <guinanx.sun@intel.com>
[ upstream commit 3db12449e119587648adf0b189c0e45502b71285 ]
If the PF driver supports the new speed reporting capabilities
then use link_event_adv instead of link_event to get the speed.
Fixes: 2a73125b7041 ("i40evf: fix link info update")
Cc: stable@dpdk.org
Acked-by: Jeff Guo <jia.guo@intel.com>
Tested-by: Jiaqi Min <jiaqix.min@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
drivers/net/i40e/base/virtchnl.h | 16 ++++++++++++-
drivers/net/i40e/i40e_ethdev_vf.c | 38 ++++++++++++++++++++++++++++---
2 files changed, 50 insertions(+), 4 deletions(-)
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 483020d4e5..09efd878a2 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -229,7 +229,8 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
#define VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000
#define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000
#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM 0X00400000
-
+/* Define below the capability flags that are not offloads */
+#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED 0x00000080
#define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
VIRTCHNL_VF_OFFLOAD_VLAN | \
VIRTCHNL_VF_OFFLOAD_RSS_PF)
@@ -518,10 +519,23 @@ enum virtchnl_event_codes {
struct virtchnl_pf_event {
enum virtchnl_event_codes event;
union {
+ /* If the PF driver does not support the new speed reporting
+ * capabilities then use link_event else use link_event_adv to
+ * get the speed and link information. The ability to understand
+ * new speeds is indicated by setting the capability flag
+ * VIRTCHNL_VF_CAP_ADV_LINK_SPEED in vf_cap_flags parameter
+ * in virtchnl_vf_resource struct and can be used to determine
+ * which link event struct to use below.
+ */
struct {
enum virtchnl_link_speed link_speed;
bool link_status;
} link_event;
+ struct {
+ /* link_speed provided in Mbps */
+ u32 link_speed;
+ u8 link_status;
+ } link_event_adv;
} event_data;
int severity;
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 51d5830cfa..c12780727c 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -455,7 +455,8 @@ i40evf_get_vf_resource(struct rte_eth_dev *dev)
VIRTCHNL_VF_OFFLOAD_RSS_AQ |
VIRTCHNL_VF_OFFLOAD_RSS_REG |
VIRTCHNL_VF_OFFLOAD_VLAN |
- VIRTCHNL_VF_OFFLOAD_RX_POLLING;
+ VIRTCHNL_VF_OFFLOAD_RX_POLLING |
+ VIRTCHNL_VF_CAP_ADV_LINK_SPEED;
args.in_args = (uint8_t *)∩︀
args.in_args_size = sizeof(caps);
} else {
@@ -1301,8 +1302,39 @@ i40evf_handle_pf_event(struct rte_eth_dev *dev, uint8_t *msg,
break;
case VIRTCHNL_EVENT_LINK_CHANGE:
PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event");
- vf->link_up = pf_msg->event_data.link_event.link_status;
- vf->link_speed = pf_msg->event_data.link_event.link_speed;
+ if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_ADV_LINK_SPEED) {
+ vf->link_up =
+ pf_msg->event_data.link_event_adv.link_status;
+
+ switch (pf_msg->event_data.link_event_adv.link_speed) {
+ case ETH_SPEED_NUM_100M:
+ vf->link_speed = VIRTCHNL_LINK_SPEED_100MB;
+ break;
+ case ETH_SPEED_NUM_1G:
+ vf->link_speed = VIRTCHNL_LINK_SPEED_1GB;
+ break;
+ case ETH_SPEED_NUM_10G:
+ vf->link_speed = VIRTCHNL_LINK_SPEED_10GB;
+ break;
+ case ETH_SPEED_NUM_20G:
+ vf->link_speed = VIRTCHNL_LINK_SPEED_20GB;
+ break;
+ case ETH_SPEED_NUM_25G:
+ vf->link_speed = VIRTCHNL_LINK_SPEED_25GB;
+ break;
+ case ETH_SPEED_NUM_40G:
+ vf->link_speed = VIRTCHNL_LINK_SPEED_40GB;
+ break;
+ default:
+ vf->link_speed = VIRTCHNL_LINK_SPEED_UNKNOWN;
+ break;
+ }
+ } else {
+ vf->link_up =
+ pf_msg->event_data.link_event.link_status;
+ vf->link_speed =
+ pf_msg->event_data.link_event.link_speed;
+ }
break;
case VIRTCHNL_EVENT_PF_DRIVER_CLOSE:
PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_PF_DRIVER_CLOSE event");
--
2.17.1
next prev parent reply other threads:[~2020-12-11 9:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 9:01 [dpdk-stable] [DPDK 18.11] net/i40e: fix filter pctype Steve Yang
2020-12-11 9:01 ` [dpdk-stable] [DPDK 18.11] net/i40e: fix flow director initialisation Steve Yang
2020-12-11 9:46 ` Kevin Traynor
2020-12-11 9:01 ` Steve Yang [this message]
2020-12-11 9:46 ` [dpdk-stable] [DPDK 18.11] net/i40e: fix link status Kevin Traynor
2020-12-11 9:01 ` [dpdk-stable] [DPDK 18.11] net/i40e: fix queue region in RSS flow Steve Yang
2020-12-11 9:44 ` Kevin Traynor
2020-12-11 9:01 ` [dpdk-stable] [DPDK 18.11] net/i40e: fix recreating flexible flow director rule Steve Yang
2020-12-11 9:47 ` Kevin Traynor
2020-12-11 9:46 ` [dpdk-stable] [DPDK 18.11] net/i40e: fix filter pctype Kevin Traynor
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=20201211090105.28432-3-stevex.yang@intel.com \
--to=stevex.yang@intel.com \
--cc=beilei.xing@intel.com \
--cc=guinanx.sun@intel.com \
--cc=jia.guo@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).