* [dpdk-dev] [PATCH] net/i40e: fix link status
@ 2020-07-30 8:25 Guinan Sun
2020-07-30 9:12 ` Jeff Guo
` (4 more replies)
0 siblings, 5 replies; 22+ messages in thread
From: Guinan Sun @ 2020-07-30 8:25 UTC (permalink / raw)
To: Beilei Xing, Jeff Guo, dev; +Cc: Guinan Sun, stable
The PF driver supports to use link_event_adv or link_event to get
the link speed. However, when using link_event_adv to get link speed,
there is a lack of logic to convert between link speed type
(I40E_LINK_SPEED_XXX) and mbps type (SPEED_XXX).
As a result, the mbps type is not recognized, so the link status down
problem occurs. This patch is used for type replacement between speed
types.
Fixes: 2a73125b7041 ("i40evf: fix link info update")
Cc: stable@dpdk.org
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
drivers/net/i40e/base/virtchnl.h | 8 +++++-
drivers/net/i40e/i40e_ethdev_vf.c | 42 +++++++++++++++++++++++++++++--
drivers/net/i40e/i40e_pf.c | 4 +++
3 files changed, 51 insertions(+), 3 deletions(-)
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 4f498ca45..90c404fb8 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -240,7 +240,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)
@@ -540,6 +541,11 @@ struct virtchnl_pf_event {
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 69cab8e73..f8cf45fbe 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1386,8 +1386,46 @@ 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 = I40E_LINK_SPEED_100MB;
+ break;
+ case ETH_SPEED_NUM_1G:
+ vf->link_speed = I40E_LINK_SPEED_1GB;
+ break;
+ case ETH_SPEED_NUM_2_5G:
+ vf->link_speed = I40E_LINK_SPEED_2_5GB;
+ break;
+ case ETH_SPEED_NUM_5G:
+ vf->link_speed = I40E_LINK_SPEED_5GB;
+ break;
+ case ETH_SPEED_NUM_10G:
+ vf->link_speed = I40E_LINK_SPEED_10GB;
+ break;
+ case ETH_SPEED_NUM_20G:
+ vf->link_speed = I40E_LINK_SPEED_20GB;
+ break;
+ case ETH_SPEED_NUM_25G:
+ vf->link_speed = I40E_LINK_SPEED_25GB;
+ break;
+ case ETH_SPEED_NUM_40G:
+ vf->link_speed = I40E_LINK_SPEED_40GB;
+ break;
+ default:
+ vf->link_speed = I40E_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");
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 7bf1e7941..33af30bbb 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -320,6 +320,10 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, uint8_t *msg,
else
vf->request_caps = *(uint32_t *)msg;
+#ifdef VIRTCHNL_VF_CAP_ADV_LINK_SPEED
+ vf_res->vf_cap_flags |= VIRTCHNL_VF_CAP_ADV_LINK_SPEED;
+#endif /* VIRTCHNL_VF_CAP_ADV_LINK_SPEED */
+
/* enable all RSS by default,
* doesn't support hena setting by virtchnnl yet.
*/
--
2.17.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH] net/i40e: fix link status
2020-07-30 8:25 [dpdk-dev] [PATCH] net/i40e: fix link status Guinan Sun
@ 2020-07-30 9:12 ` Jeff Guo
2020-07-30 9:26 ` Sun, GuinanX
2020-07-30 10:25 ` [dpdk-dev] [PATCH v2] " Guinan Sun
` (3 subsequent siblings)
4 siblings, 1 reply; 22+ messages in thread
From: Jeff Guo @ 2020-07-30 9:12 UTC (permalink / raw)
To: Guinan Sun, Beilei Xing, dev; +Cc: stable
hi, guinan
On 7/30/2020 4:25 PM, Guinan Sun wrote:
> The PF driver supports to use link_event_adv or link_event to get
> the link speed. However, when using link_event_adv to get link speed,
> there is a lack of logic to convert between link speed type
> (I40E_LINK_SPEED_XXX) and mbps type (SPEED_XXX).
> As a result, the mbps type is not recognized, so the link status down
> problem occurs. This patch is used for type replacement between speed
> types.
>
> Fixes: 2a73125b7041 ("i40evf: fix link info update")
> Cc: stable@dpdk.org
>
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---
> drivers/net/i40e/base/virtchnl.h | 8 +++++-
> drivers/net/i40e/i40e_ethdev_vf.c | 42 +++++++++++++++++++++++++++++--
> drivers/net/i40e/i40e_pf.c | 4 +++
> 3 files changed, 51 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
> index 4f498ca45..90c404fb8 100644
> --- a/drivers/net/i40e/base/virtchnl.h
> +++ b/drivers/net/i40e/base/virtchnl.h
> @@ -240,7 +240,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)
> @@ -540,6 +541,11 @@ struct virtchnl_pf_event {
> 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 69cab8e73..f8cf45fbe 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -1386,8 +1386,46 @@ 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 = I40E_LINK_SPEED_100MB;
> + break;
> + case ETH_SPEED_NUM_1G:
> + vf->link_speed = I40E_LINK_SPEED_1GB;
> + break;
> + case ETH_SPEED_NUM_2_5G:
> + vf->link_speed = I40E_LINK_SPEED_2_5GB;
> + break;
> + case ETH_SPEED_NUM_5G:
> + vf->link_speed = I40E_LINK_SPEED_5GB;
> + break;
> + case ETH_SPEED_NUM_10G:
> + vf->link_speed = I40E_LINK_SPEED_10GB;
> + break;
> + case ETH_SPEED_NUM_20G:
> + vf->link_speed = I40E_LINK_SPEED_20GB;
> + break;
> + case ETH_SPEED_NUM_25G:
> + vf->link_speed = I40E_LINK_SPEED_25GB;
> + break;
> + case ETH_SPEED_NUM_40G:
> + vf->link_speed = I40E_LINK_SPEED_40GB;
> + break;
> + default:
> + vf->link_speed = I40E_LINK_SPEED_UNKNOWN;
> + break;
> + }
> + } else {
> + vf->link_up =
> + pf_msg->event_data.link_event.link_status;
Is the link_status the same of processing whatever adv speed cap?
> + 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");
> diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
> index 7bf1e7941..33af30bbb 100644
> --- a/drivers/net/i40e/i40e_pf.c
> +++ b/drivers/net/i40e/i40e_pf.c
> @@ -320,6 +320,10 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, uint8_t *msg,
> else
> vf->request_caps = *(uint32_t *)msg;
>
> +#ifdef VIRTCHNL_VF_CAP_ADV_LINK_SPEED
> + vf_res->vf_cap_flags |= VIRTCHNL_VF_CAP_ADV_LINK_SPEED;
> +#endif /* VIRTCHNL_VF_CAP_ADV_LINK_SPEED */
> +
Below code is after your change here, be careful to use "|=" please.
vf_res->vf_cap_flags = vf->request_caps &
I40E_VIRTCHNL_OFFLOAD_CAPS;
> /* enable all RSS by default,
> * doesn't support hena setting by virtchnnl yet.
> */
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH] net/i40e: fix link status
2020-07-30 9:12 ` Jeff Guo
@ 2020-07-30 9:26 ` Sun, GuinanX
0 siblings, 0 replies; 22+ messages in thread
From: Sun, GuinanX @ 2020-07-30 9:26 UTC (permalink / raw)
To: Guo, Jia, Xing, Beilei, dev; +Cc: stable
Hi Jeff
> -----Original Message-----
> From: Guo, Jia
> Sent: Thursday, July 30, 2020 5:12 PM
> To: Sun, GuinanX <guinanx.sun@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: Re: [PATCH] net/i40e: fix link status
>
> hi, guinan
>
> On 7/30/2020 4:25 PM, Guinan Sun wrote:
> > The PF driver supports to use link_event_adv or link_event to get the
> > link speed. However, when using link_event_adv to get link speed,
> > there is a lack of logic to convert between link speed type
> > (I40E_LINK_SPEED_XXX) and mbps type (SPEED_XXX).
> > As a result, the mbps type is not recognized, so the link status down
> > problem occurs. This patch is used for type replacement between speed
> > types.
> >
> > Fixes: 2a73125b7041 ("i40evf: fix link info update")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> > ---
> > drivers/net/i40e/base/virtchnl.h | 8 +++++-
> > drivers/net/i40e/i40e_ethdev_vf.c | 42 +++++++++++++++++++++++++++++-
> -
> > drivers/net/i40e/i40e_pf.c | 4 +++
> > 3 files changed, 51 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/i40e/base/virtchnl.h
> > b/drivers/net/i40e/base/virtchnl.h
> > index 4f498ca45..90c404fb8 100644
> > --- a/drivers/net/i40e/base/virtchnl.h
> > +++ b/drivers/net/i40e/base/virtchnl.h
> > @@ -240,7 +240,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) @@ -540,6
> +541,11 @@ struct
> > virtchnl_pf_event {
> > 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 69cab8e73..f8cf45fbe 100644
> > --- a/drivers/net/i40e/i40e_ethdev_vf.c
> > +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> > @@ -1386,8 +1386,46 @@ 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 = I40E_LINK_SPEED_100MB;
> > + break;
> > + case ETH_SPEED_NUM_1G:
> > + vf->link_speed = I40E_LINK_SPEED_1GB;
> > + break;
> > + case ETH_SPEED_NUM_2_5G:
> > + vf->link_speed = I40E_LINK_SPEED_2_5GB;
> > + break;
> > + case ETH_SPEED_NUM_5G:
> > + vf->link_speed = I40E_LINK_SPEED_5GB;
> > + break;
> > + case ETH_SPEED_NUM_10G:
> > + vf->link_speed = I40E_LINK_SPEED_10GB;
> > + break;
> > + case ETH_SPEED_NUM_20G:
> > + vf->link_speed = I40E_LINK_SPEED_20GB;
> > + break;
> > + case ETH_SPEED_NUM_25G:
> > + vf->link_speed = I40E_LINK_SPEED_25GB;
> > + break;
> > + case ETH_SPEED_NUM_40G:
> > + vf->link_speed = I40E_LINK_SPEED_40GB;
> > + break;
> > + default:
> > + vf->link_speed =
> I40E_LINK_SPEED_UNKNOWN;
> > + break;
> > + }
> > + } else {
> > + vf->link_up =
> > + pf_msg->event_data.link_event.link_status;
>
>
> Is the link_status the same of processing whatever adv speed cap?
They are not the same process, so it's no need to change.
>
>
> > + 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"); diff
> > --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index
> > 7bf1e7941..33af30bbb 100644
> > --- a/drivers/net/i40e/i40e_pf.c
> > +++ b/drivers/net/i40e/i40e_pf.c
> > @@ -320,6 +320,10 @@ i40e_pf_host_process_cmd_get_vf_resource(struct
> i40e_pf_vf *vf, uint8_t *msg,
> > else
> > vf->request_caps = *(uint32_t *)msg;
> >
> > +#ifdef VIRTCHNL_VF_CAP_ADV_LINK_SPEED
> > + vf_res->vf_cap_flags |= VIRTCHNL_VF_CAP_ADV_LINK_SPEED; #endif
> /*
> > +VIRTCHNL_VF_CAP_ADV_LINK_SPEED */
> > +
>
>
> Below code is after your change here, be careful to use "|=" please.
Yes, you are right, Iwill take care of it.
But there is a problem with the logic of this code, which will be removed later.
>
> vf_res->vf_cap_flags = vf->request_caps &
> I40E_VIRTCHNL_OFFLOAD_CAPS;
>
>
> > /* enable all RSS by default,
> > * doesn't support hena setting by virtchnnl yet.
> > */
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-dev] [PATCH v2] net/i40e: fix link status
2020-07-30 8:25 [dpdk-dev] [PATCH] net/i40e: fix link status Guinan Sun
2020-07-30 9:12 ` Jeff Guo
@ 2020-07-30 10:25 ` Guinan Sun
2020-07-30 10:51 ` Wang, ShougangX
2020-07-31 2:29 ` Xing, Beilei
2020-08-06 8:16 ` [dpdk-dev] [PATCH v3] " Guinan Sun
` (2 subsequent siblings)
4 siblings, 2 replies; 22+ messages in thread
From: Guinan Sun @ 2020-07-30 10:25 UTC (permalink / raw)
To: Beilei Xing, Jeff Guo, dev; +Cc: Guinan Sun, stable
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
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
v2:
* Modify commit log.
* Add code comments.
* Delete useless codes.
---
drivers/net/i40e/base/virtchnl.h | 16 +++++++++++-
drivers/net/i40e/i40e_ethdev_vf.c | 42 +++++++++++++++++++++++++++++--
2 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 4f498ca45..9c64fd469 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -240,7 +240,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)
@@ -536,10 +537,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 69cab8e73..f8cf45fbe 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1386,8 +1386,46 @@ 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 = I40E_LINK_SPEED_100MB;
+ break;
+ case ETH_SPEED_NUM_1G:
+ vf->link_speed = I40E_LINK_SPEED_1GB;
+ break;
+ case ETH_SPEED_NUM_2_5G:
+ vf->link_speed = I40E_LINK_SPEED_2_5GB;
+ break;
+ case ETH_SPEED_NUM_5G:
+ vf->link_speed = I40E_LINK_SPEED_5GB;
+ break;
+ case ETH_SPEED_NUM_10G:
+ vf->link_speed = I40E_LINK_SPEED_10GB;
+ break;
+ case ETH_SPEED_NUM_20G:
+ vf->link_speed = I40E_LINK_SPEED_20GB;
+ break;
+ case ETH_SPEED_NUM_25G:
+ vf->link_speed = I40E_LINK_SPEED_25GB;
+ break;
+ case ETH_SPEED_NUM_40G:
+ vf->link_speed = I40E_LINK_SPEED_40GB;
+ break;
+ default:
+ vf->link_speed = I40E_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
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/i40e: fix link status
2020-07-30 10:25 ` [dpdk-dev] [PATCH v2] " Guinan Sun
@ 2020-07-30 10:51 ` Wang, ShougangX
2020-07-30 10:57 ` Jeff Guo
2020-07-31 2:29 ` Xing, Beilei
1 sibling, 1 reply; 22+ messages in thread
From: Wang, ShougangX @ 2020-07-30 10:51 UTC (permalink / raw)
To: Sun, GuinanX, Xing, Beilei, Guo, Jia, dev; +Cc: Sun, GuinanX, stable
Tested-by: Shougang Wang <shougangx.wang@intel.com>
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Guinan Sun
> Sent: Thursday, July 30, 2020 6:25 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia <jia.guo@intel.com>;
> dev@dpdk.org
> Cc: Sun, GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix link status
>
> 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
>
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---
> v2:
> * Modify commit log.
> * Add code comments.
> * Delete useless codes.
> ---
> drivers/net/i40e/base/virtchnl.h | 16 +++++++++++-
> drivers/net/i40e/i40e_ethdev_vf.c | 42
> +++++++++++++++++++++++++++++--
> 2 files changed, 55 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/i40e/base/virtchnl.h
> b/drivers/net/i40e/base/virtchnl.h
> index 4f498ca45..9c64fd469 100644
> --- a/drivers/net/i40e/base/virtchnl.h
> +++ b/drivers/net/i40e/base/virtchnl.h
> @@ -240,7 +240,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)
> @@ -536,10 +537,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 69cab8e73..f8cf45fbe 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -1386,8 +1386,46 @@ 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 = I40E_LINK_SPEED_100MB;
> + break;
> + case ETH_SPEED_NUM_1G:
> + vf->link_speed = I40E_LINK_SPEED_1GB;
> + break;
> + case ETH_SPEED_NUM_2_5G:
> + vf->link_speed = I40E_LINK_SPEED_2_5GB;
> + break;
> + case ETH_SPEED_NUM_5G:
> + vf->link_speed = I40E_LINK_SPEED_5GB;
> + break;
> + case ETH_SPEED_NUM_10G:
> + vf->link_speed = I40E_LINK_SPEED_10GB;
> + break;
> + case ETH_SPEED_NUM_20G:
> + vf->link_speed = I40E_LINK_SPEED_20GB;
> + break;
> + case ETH_SPEED_NUM_25G:
> + vf->link_speed = I40E_LINK_SPEED_25GB;
> + break;
> + case ETH_SPEED_NUM_40G:
> + vf->link_speed = I40E_LINK_SPEED_40GB;
> + break;
> + default:
> + vf->link_speed =
> I40E_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
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/i40e: fix link status
2020-07-30 10:51 ` Wang, ShougangX
@ 2020-07-30 10:57 ` Jeff Guo
0 siblings, 0 replies; 22+ messages in thread
From: Jeff Guo @ 2020-07-30 10:57 UTC (permalink / raw)
To: Wang, ShougangX, Sun, GuinanX, Xing, Beilei, dev; +Cc: stable
Acked-by: Jeff Guo <jia.guo@intel.com>
On 7/30/2020 6:51 PM, Wang, ShougangX wrote:
> Tested-by: Shougang Wang <shougangx.wang@intel.com>
>
>> -----Original Message-----
>> From: dev <dev-bounces@dpdk.org> On Behalf Of Guinan Sun
>> Sent: Thursday, July 30, 2020 6:25 PM
>> To: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia <jia.guo@intel.com>;
>> dev@dpdk.org
>> Cc: Sun, GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
>> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix link status
>>
>> 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
>>
>> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
>> ---
>> v2:
>> * Modify commit log.
>> * Add code comments.
>> * Delete useless codes.
>> ---
>> drivers/net/i40e/base/virtchnl.h | 16 +++++++++++-
>> drivers/net/i40e/i40e_ethdev_vf.c | 42
>> +++++++++++++++++++++++++++++--
>> 2 files changed, 55 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/i40e/base/virtchnl.h
>> b/drivers/net/i40e/base/virtchnl.h
>> index 4f498ca45..9c64fd469 100644
>> --- a/drivers/net/i40e/base/virtchnl.h
>> +++ b/drivers/net/i40e/base/virtchnl.h
>> @@ -240,7 +240,8 @@ VIRTCHNL_CHECK_STRUCT_LEN(16,
>> virtchnl_vsi_resource);
>> #define VIRTCHNL_VF_OFFLOAD_ENCAP0X00100000
>> #define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM0X00200000
>> #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM0X00400000
>> -
>> +/* Define below the capability flags that are not offloads */
>> +#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED0x00000080
>> #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
>> VIRTCHNL_VF_OFFLOAD_VLAN | \
>> VIRTCHNL_VF_OFFLOAD_RSS_PF)
>> @@ -536,10 +537,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 69cab8e73..f8cf45fbe 100644
>> --- a/drivers/net/i40e/i40e_ethdev_vf.c
>> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
>> @@ -1386,8 +1386,46 @@ 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 = I40E_LINK_SPEED_100MB;
>> +break;
>> +case ETH_SPEED_NUM_1G:
>> +vf->link_speed = I40E_LINK_SPEED_1GB;
>> +break;
>> +case ETH_SPEED_NUM_2_5G:
>> +vf->link_speed = I40E_LINK_SPEED_2_5GB;
>> +break;
>> +case ETH_SPEED_NUM_5G:
>> +vf->link_speed = I40E_LINK_SPEED_5GB;
>> +break;
>> +case ETH_SPEED_NUM_10G:
>> +vf->link_speed = I40E_LINK_SPEED_10GB;
>> +break;
>> +case ETH_SPEED_NUM_20G:
>> +vf->link_speed = I40E_LINK_SPEED_20GB;
>> +break;
>> +case ETH_SPEED_NUM_25G:
>> +vf->link_speed = I40E_LINK_SPEED_25GB;
>> +break;
>> +case ETH_SPEED_NUM_40G:
>> +vf->link_speed = I40E_LINK_SPEED_40GB;
>> +break;
>> +default:
>> +vf->link_speed =
>> I40E_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
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/i40e: fix link status
2020-07-30 10:25 ` [dpdk-dev] [PATCH v2] " Guinan Sun
2020-07-30 10:51 ` Wang, ShougangX
@ 2020-07-31 2:29 ` Xing, Beilei
2020-07-31 2:37 ` Wang, ShougangX
1 sibling, 1 reply; 22+ messages in thread
From: Xing, Beilei @ 2020-07-31 2:29 UTC (permalink / raw)
To: Sun, GuinanX, Guo, Jia, dev; +Cc: Sun, GuinanX, stable
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Guinan Sun
> Sent: Thursday, July 30, 2020 6:25 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia <jia.guo@intel.com>;
> dev@dpdk.org
> Cc: Sun, GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix link status
>
> 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
>
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---
> v2:
> * Modify commit log.
> * Add code comments.
> * Delete useless codes.
> ---
> drivers/net/i40e/base/virtchnl.h | 16 +++++++++++-
> drivers/net/i40e/i40e_ethdev_vf.c | 42 +++++++++++++++++++++++++++++--
> 2 files changed, 55 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
> index 4f498ca45..9c64fd469 100644
> --- a/drivers/net/i40e/base/virtchnl.h
> +++ b/drivers/net/i40e/base/virtchnl.h
> @@ -240,7 +240,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
You defined the new capability VIRTCHNL_VF_CAP_ADV_LINK_SPEED in the patch,
but didn't request the capability for i40evf?
> #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
> VIRTCHNL_VF_OFFLOAD_VLAN | \
> VIRTCHNL_VF_OFFLOAD_RSS_PF)
> @@ -536,10 +537,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 69cab8e73..f8cf45fbe 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -1386,8 +1386,46 @@ 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 = I40E_LINK_SPEED_100MB;
> + break;
> + case ETH_SPEED_NUM_1G:
> + vf->link_speed = I40E_LINK_SPEED_1GB;
> + break;
> + case ETH_SPEED_NUM_2_5G:
> + vf->link_speed = I40E_LINK_SPEED_2_5GB;
> + break;
> + case ETH_SPEED_NUM_5G:
> + vf->link_speed = I40E_LINK_SPEED_5GB;
> + break;
> + case ETH_SPEED_NUM_10G:
> + vf->link_speed = I40E_LINK_SPEED_10GB;
> + break;
> + case ETH_SPEED_NUM_20G:
> + vf->link_speed = I40E_LINK_SPEED_20GB;
> + break;
> + case ETH_SPEED_NUM_25G:
> + vf->link_speed = I40E_LINK_SPEED_25GB;
> + break;
> + case ETH_SPEED_NUM_40G:
> + vf->link_speed = I40E_LINK_SPEED_40GB;
> + break;
> + default:
> + vf->link_speed =
> I40E_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
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/i40e: fix link status
2020-07-31 2:29 ` Xing, Beilei
@ 2020-07-31 2:37 ` Wang, ShougangX
2020-07-31 3:50 ` Xing, Beilei
0 siblings, 1 reply; 22+ messages in thread
From: Wang, ShougangX @ 2020-07-31 2:37 UTC (permalink / raw)
To: Xing, Beilei, Sun, GuinanX, Guo, Jia, dev; +Cc: Sun, GuinanX, stable
Hi Beilei
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xing, Beilei
> Sent: Friday, July 31, 2020 10:30 AM
> To: Sun, GuinanX <guinanx.sun@intel.com>; Guo, Jia <jia.guo@intel.com>;
> dev@dpdk.org
> Cc: Sun, GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix link status
>
>
>
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Guinan Sun
> > Sent: Thursday, July 30, 2020 6:25 PM
> > To: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia
> > <jia.guo@intel.com>; dev@dpdk.org
> > Cc: Sun, GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> > Subject: [dpdk-dev] [PATCH v2] net/i40e: fix link status
> >
> > 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
> >
> > Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> > ---
> > v2:
> > * Modify commit log.
> > * Add code comments.
> > * Delete useless codes.
> > ---
> > drivers/net/i40e/base/virtchnl.h | 16 +++++++++++-
> > drivers/net/i40e/i40e_ethdev_vf.c | 42
> +++++++++++++++++++++++++++++--
> > 2 files changed, 55 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/i40e/base/virtchnl.h
> > b/drivers/net/i40e/base/virtchnl.h
> > index 4f498ca45..9c64fd469 100644
> > --- a/drivers/net/i40e/base/virtchnl.h
> > +++ b/drivers/net/i40e/base/virtchnl.h
> > @@ -240,7 +240,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
>
> You defined the new capability VIRTCHNL_VF_CAP_ADV_LINK_SPEED in the
> patch, but didn't request the capability for i40evf?
This capability is given by i40e kernel pf if VIRTCHNL_VF_CAP_ADV_LINK_SPEED is defined. So vf doesn't need to request it.
Thanks.
Shougang
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/i40e: fix link status
2020-07-31 2:37 ` Wang, ShougangX
@ 2020-07-31 3:50 ` Xing, Beilei
2020-07-31 4:09 ` Sun, GuinanX
0 siblings, 1 reply; 22+ messages in thread
From: Xing, Beilei @ 2020-07-31 3:50 UTC (permalink / raw)
To: Wang, ShougangX, Sun, GuinanX, Guo, Jia, dev; +Cc: Sun, GuinanX, stable
> -----Original Message-----
> From: Wang, ShougangX <shougangx.wang@intel.com>
> Sent: Friday, July 31, 2020 10:38 AM
> To: Xing, Beilei <beilei.xing@intel.com>; Sun, GuinanX
> <guinanx.sun@intel.com>; Guo, Jia <jia.guo@intel.com>; dev@dpdk.org
> Cc: Sun, GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2] net/i40e: fix link status
>
> Hi Beilei
>
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Xing, Beilei
> > Sent: Friday, July 31, 2020 10:30 AM
> > To: Sun, GuinanX <guinanx.sun@intel.com>; Guo, Jia
> > <jia.guo@intel.com>; dev@dpdk.org
> > Cc: Sun, GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix link status
> >
> >
> >
> > > -----Original Message-----
> > > From: dev <dev-bounces@dpdk.org> On Behalf Of Guinan Sun
> > > Sent: Thursday, July 30, 2020 6:25 PM
> > > To: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia
> > > <jia.guo@intel.com>; dev@dpdk.org
> > > Cc: Sun, GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> > > Subject: [dpdk-dev] [PATCH v2] net/i40e: fix link status
> > >
> > > 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
> > >
> > > Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> > > ---
> > > v2:
> > > * Modify commit log.
> > > * Add code comments.
> > > * Delete useless codes.
> > > ---
> > > drivers/net/i40e/base/virtchnl.h | 16 +++++++++++-
> > > drivers/net/i40e/i40e_ethdev_vf.c | 42
> > +++++++++++++++++++++++++++++--
> > > 2 files changed, 55 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/net/i40e/base/virtchnl.h
> > > b/drivers/net/i40e/base/virtchnl.h
> > > index 4f498ca45..9c64fd469 100644
> > > --- a/drivers/net/i40e/base/virtchnl.h
> > > +++ b/drivers/net/i40e/base/virtchnl.h
> > > @@ -240,7 +240,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
> >
> > You defined the new capability VIRTCHNL_VF_CAP_ADV_LINK_SPEED in the
> > patch, but didn't request the capability for i40evf?
>
> This capability is given by i40e kernel pf if
> VIRTCHNL_VF_CAP_ADV_LINK_SPEED is defined. So vf doesn't need to request
> it.
All the capabilities for VF is required by VF, please check i40evf_get_vf_resource.
>
> Thanks.
> Shougang
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/i40e: fix link status
2020-07-31 3:50 ` Xing, Beilei
@ 2020-07-31 4:09 ` Sun, GuinanX
0 siblings, 0 replies; 22+ messages in thread
From: Sun, GuinanX @ 2020-07-31 4:09 UTC (permalink / raw)
To: Xing, Beilei, Wang, ShougangX, Guo, Jia, dev; +Cc: stable
Hi Beilei
> -----Original Message-----
> From: Xing, Beilei
> Sent: Friday, July 31, 2020 11:50 AM
> To: Wang, ShougangX <shougangx.wang@intel.com>; Sun, GuinanX
> <guinanx.sun@intel.com>; Guo, Jia <jia.guo@intel.com>; dev@dpdk.org
> Cc: Sun, GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2] net/i40e: fix link status
>
>
>
> > -----Original Message-----
> > From: Wang, ShougangX <shougangx.wang@intel.com>
> > Sent: Friday, July 31, 2020 10:38 AM
> > To: Xing, Beilei <beilei.xing@intel.com>; Sun, GuinanX
> > <guinanx.sun@intel.com>; Guo, Jia <jia.guo@intel.com>; dev@dpdk.org
> > Cc: Sun, GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> > Subject: RE: [dpdk-dev] [PATCH v2] net/i40e: fix link status
> >
> > Hi Beilei
> >
> > > -----Original Message-----
> > > From: dev <dev-bounces@dpdk.org> On Behalf Of Xing, Beilei
> > > Sent: Friday, July 31, 2020 10:30 AM
> > > To: Sun, GuinanX <guinanx.sun@intel.com>; Guo, Jia
> > > <jia.guo@intel.com>; dev@dpdk.org
> > > Cc: Sun, GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix link status
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: dev <dev-bounces@dpdk.org> On Behalf Of Guinan Sun
> > > > Sent: Thursday, July 30, 2020 6:25 PM
> > > > To: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia
> > > > <jia.guo@intel.com>; dev@dpdk.org
> > > > Cc: Sun, GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> > > > Subject: [dpdk-dev] [PATCH v2] net/i40e: fix link status
> > > >
> > > > 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
> > > >
> > > > Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> > > > ---
> > > > v2:
> > > > * Modify commit log.
> > > > * Add code comments.
> > > > * Delete useless codes.
> > > > ---
> > > > drivers/net/i40e/base/virtchnl.h | 16 +++++++++++-
> > > > drivers/net/i40e/i40e_ethdev_vf.c | 42
> > > +++++++++++++++++++++++++++++--
> > > > 2 files changed, 55 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/drivers/net/i40e/base/virtchnl.h
> > > > b/drivers/net/i40e/base/virtchnl.h
> > > > index 4f498ca45..9c64fd469 100644
> > > > --- a/drivers/net/i40e/base/virtchnl.h
> > > > +++ b/drivers/net/i40e/base/virtchnl.h
> > > > @@ -240,7 +240,8 @@ VIRTCHNL_CHECK_STRUCT_LEN(16,
> > > > virtchnl_vsi_resource); #define
> > > > VIRTCHNL_VF_OFFLOAD_ENCAP0X00100000
> > > > #define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM0X00200000
> > > > #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM0X00400000
> > > > -
> > > > +/* Define below the capability flags that are not offloads */
> > > > +#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED0x00000080
> > >
> > > You defined the new capability VIRTCHNL_VF_CAP_ADV_LINK_SPEED in the
> > > patch, but didn't request the capability for i40evf?
> >
> > This capability is given by i40e kernel pf if
> > VIRTCHNL_VF_CAP_ADV_LINK_SPEED is defined. So vf doesn't need to
> > request it.
>
> All the capabilities for VF is required by VF, please check
> i40evf_get_vf_resource.
I will double check for it.
New Patch will fix it.
Thank you.
>
> >
> > Thanks.
> > Shougang
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-dev] [PATCH v3] net/i40e: fix link status
2020-07-30 8:25 [dpdk-dev] [PATCH] net/i40e: fix link status Guinan Sun
2020-07-30 9:12 ` Jeff Guo
2020-07-30 10:25 ` [dpdk-dev] [PATCH v2] " Guinan Sun
@ 2020-08-06 8:16 ` Guinan Sun
2020-08-06 9:46 ` Wang, ShougangX
` (2 more replies)
2020-09-02 8:06 ` [dpdk-dev] [PATCH v4] " Guinan Sun
2020-09-04 6:21 ` [dpdk-dev] [PATCH v5] " Guinan Sun
4 siblings, 3 replies; 22+ messages in thread
From: Guinan Sun @ 2020-08-06 8:16 UTC (permalink / raw)
To: dev; +Cc: Beilei Xing, Jeff Guo, Guinan Sun, stable
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
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
v3:
* request the capability for i40evf
v2:
* modify commit log
* add code comments
* delete useless code
---
drivers/net/i40e/base/virtchnl.h | 16 ++++++++++-
drivers/net/i40e/i40e_ethdev_vf.c | 45 ++++++++++++++++++++++++++++---
2 files changed, 57 insertions(+), 4 deletions(-)
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 4f498ca45..9c64fd469 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -240,7 +240,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)
@@ -536,10 +537,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 69cab8e73..ccf5d8c57 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -469,7 +469,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 {
@@ -1386,8 +1387,46 @@ 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 = I40E_LINK_SPEED_100MB;
+ break;
+ case ETH_SPEED_NUM_1G:
+ vf->link_speed = I40E_LINK_SPEED_1GB;
+ break;
+ case ETH_SPEED_NUM_2_5G:
+ vf->link_speed = I40E_LINK_SPEED_2_5GB;
+ break;
+ case ETH_SPEED_NUM_5G:
+ vf->link_speed = I40E_LINK_SPEED_5GB;
+ break;
+ case ETH_SPEED_NUM_10G:
+ vf->link_speed = I40E_LINK_SPEED_10GB;
+ break;
+ case ETH_SPEED_NUM_20G:
+ vf->link_speed = I40E_LINK_SPEED_20GB;
+ break;
+ case ETH_SPEED_NUM_25G:
+ vf->link_speed = I40E_LINK_SPEED_25GB;
+ break;
+ case ETH_SPEED_NUM_40G:
+ vf->link_speed = I40E_LINK_SPEED_40GB;
+ break;
+ default:
+ vf->link_speed = I40E_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
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v3] net/i40e: fix link status
2020-08-06 8:16 ` [dpdk-dev] [PATCH v3] " Guinan Sun
@ 2020-08-06 9:46 ` Wang, ShougangX
2020-08-06 10:08 ` Xing, Beilei
2020-08-31 13:24 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2 siblings, 0 replies; 22+ messages in thread
From: Wang, ShougangX @ 2020-08-06 9:46 UTC (permalink / raw)
To: Sun, GuinanX, dev; +Cc: Xing, Beilei, Guo, Jia, Sun, GuinanX, stable
Tested-by: Shougang Wang <shougangx.wang@intel.com>
Thanks.
Shougang
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Guinan Sun
> Sent: Thursday, August 6, 2020 4:17 PM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia <jia.guo@intel.com>; Sun,
> GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v3] net/i40e: fix link status
>
> 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
>
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---
> v3:
> * request the capability for i40evf
> v2:
> * modify commit log
> * add code comments
> * delete useless code
> ---
> drivers/net/i40e/base/virtchnl.h | 16 ++++++++++-
> drivers/net/i40e/i40e_ethdev_vf.c | 45
> ++++++++++++++++++++++++++++---
> 2 files changed, 57 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/i40e/base/virtchnl.h
> b/drivers/net/i40e/base/virtchnl.h
> index 4f498ca45..9c64fd469 100644
> --- a/drivers/net/i40e/base/virtchnl.h
> +++ b/drivers/net/i40e/base/virtchnl.h
> @@ -240,7 +240,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)
> @@ -536,10 +537,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 69cab8e73..ccf5d8c57 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -469,7 +469,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 {
> @@ -1386,8 +1387,46 @@ 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 = I40E_LINK_SPEED_100MB;
> + break;
> + case ETH_SPEED_NUM_1G:
> + vf->link_speed = I40E_LINK_SPEED_1GB;
> + break;
> + case ETH_SPEED_NUM_2_5G:
> + vf->link_speed = I40E_LINK_SPEED_2_5GB;
> + break;
> + case ETH_SPEED_NUM_5G:
> + vf->link_speed = I40E_LINK_SPEED_5GB;
> + break;
> + case ETH_SPEED_NUM_10G:
> + vf->link_speed = I40E_LINK_SPEED_10GB;
> + break;
> + case ETH_SPEED_NUM_20G:
> + vf->link_speed = I40E_LINK_SPEED_20GB;
> + break;
> + case ETH_SPEED_NUM_25G:
> + vf->link_speed = I40E_LINK_SPEED_25GB;
> + break;
> + case ETH_SPEED_NUM_40G:
> + vf->link_speed = I40E_LINK_SPEED_40GB;
> + break;
> + default:
> + vf->link_speed =
> I40E_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
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v3] net/i40e: fix link status
2020-08-06 8:16 ` [dpdk-dev] [PATCH v3] " Guinan Sun
2020-08-06 9:46 ` Wang, ShougangX
@ 2020-08-06 10:08 ` Xing, Beilei
2020-08-07 2:09 ` Jeff Guo
2020-08-31 0:52 ` Zhang, Qi Z
2020-08-31 13:24 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2 siblings, 2 replies; 22+ messages in thread
From: Xing, Beilei @ 2020-08-06 10:08 UTC (permalink / raw)
To: Sun, GuinanX, dev; +Cc: Guo, Jia, stable
> -----Original Message-----
> From: Sun, GuinanX <guinanx.sun@intel.com>
> Sent: Thursday, August 6, 2020 4:17 PM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia <jia.guo@intel.com>; Sun,
> GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> Subject: [PATCH v3] net/i40e: fix link status
>
> 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
>
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v3] net/i40e: fix link status
2020-08-06 10:08 ` Xing, Beilei
@ 2020-08-07 2:09 ` Jeff Guo
2020-08-31 0:52 ` Zhang, Qi Z
1 sibling, 0 replies; 22+ messages in thread
From: Jeff Guo @ 2020-08-07 2:09 UTC (permalink / raw)
To: Xing, Beilei, Sun, GuinanX, dev; +Cc: stable
On 8/6/2020 6:08 PM, Xing, Beilei wrote:
>
>> -----Original Message-----
>> From: Sun, GuinanX <guinanx.sun@intel.com>
>> Sent: Thursday, August 6, 2020 4:17 PM
>> To: dev@dpdk.org
>> Cc: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia <jia.guo@intel.com>; Sun,
>> GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
>> Subject: [PATCH v3] net/i40e: fix link status
>>
>> 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
>>
>> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> Acked-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v3] net/i40e: fix link status
2020-08-06 10:08 ` Xing, Beilei
2020-08-07 2:09 ` Jeff Guo
@ 2020-08-31 0:52 ` Zhang, Qi Z
1 sibling, 0 replies; 22+ messages in thread
From: Zhang, Qi Z @ 2020-08-31 0:52 UTC (permalink / raw)
To: Xing, Beilei, Sun, GuinanX, dev; +Cc: Guo, Jia, stable
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xing, Beilei
> Sent: Thursday, August 6, 2020 6:08 PM
> To: Sun, GuinanX <guinanx.sun@intel.com>; dev@dpdk.org
> Cc: Guo, Jia <jia.guo@intel.com>; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3] net/i40e: fix link status
>
>
>
> > -----Original Message-----
> > From: Sun, GuinanX <guinanx.sun@intel.com>
> > Sent: Thursday, August 6, 2020 4:17 PM
> > To: dev@dpdk.org
> > Cc: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia
> > <jia.guo@intel.com>; Sun, GuinanX <guinanx.sun@intel.com>;
> > stable@dpdk.org
> > Subject: [PATCH v3] net/i40e: fix link status
> >
> > 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
> >
> > Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> Acked-by: Beilei Xing <beilei.xing@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v3] net/i40e: fix link status
2020-08-06 8:16 ` [dpdk-dev] [PATCH v3] " Guinan Sun
2020-08-06 9:46 ` Wang, ShougangX
2020-08-06 10:08 ` Xing, Beilei
@ 2020-08-31 13:24 ` Ferruh Yigit
2020-09-01 8:52 ` Sun, GuinanX
2 siblings, 1 reply; 22+ messages in thread
From: Ferruh Yigit @ 2020-08-31 13:24 UTC (permalink / raw)
To: Guinan Sun, dev; +Cc: Beilei Xing, Jeff Guo, stable
On 8/6/2020 9:16 AM, Guinan Sun wrote:
> 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
>
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---
> v3:
> * request the capability for i40evf
> v2:
> * modify commit log
> * add code comments
> * delete useless code
> ---
> drivers/net/i40e/base/virtchnl.h | 16 ++++++++++-
> drivers/net/i40e/i40e_ethdev_vf.c | 45 ++++++++++++++++++++++++++++---
> 2 files changed, 57 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
> index 4f498ca45..9c64fd469 100644
> --- a/drivers/net/i40e/base/virtchnl.h
> +++ b/drivers/net/i40e/base/virtchnl.h
> @@ -240,7 +240,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)
> @@ -536,10 +537,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 69cab8e73..ccf5d8c57 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -469,7 +469,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 {
> @@ -1386,8 +1387,46 @@ 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 = I40E_LINK_SPEED_100MB;
> + break;
> + case ETH_SPEED_NUM_1G:
> + vf->link_speed = I40E_LINK_SPEED_1GB;
> + break;
> + case ETH_SPEED_NUM_2_5G:
> + vf->link_speed = I40E_LINK_SPEED_2_5GB;
> + break;
> + case ETH_SPEED_NUM_5G:
> + vf->link_speed = I40E_LINK_SPEED_5GB;
> + break;
> + case ETH_SPEED_NUM_10G:
> + vf->link_speed = I40E_LINK_SPEED_10GB;
> + break;
> + case ETH_SPEED_NUM_20G:
> + vf->link_speed = I40E_LINK_SPEED_20GB;
> + break;
> + case ETH_SPEED_NUM_25G:
> + vf->link_speed = I40E_LINK_SPEED_25GB;
> + break;
> + case ETH_SPEED_NUM_40G:
> + vf->link_speed = I40E_LINK_SPEED_40GB;
> + break;
> + default:
> + vf->link_speed = I40E_LINK_SPEED_UNKNOWN;
> + break;
Hi Guinan,
These assignments are causing build error [1] because of different types.
'vf->link_speed' is "enum virtchnl_link_speed", but the values
('I40E_LINK_SPEED_100MB' etc..) are "enum i40e_aq_link_speed"
[1]
http://mails.dpdk.org/archives/test-report/2020-August/148030.html
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v3] net/i40e: fix link status
2020-08-31 13:24 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
@ 2020-09-01 8:52 ` Sun, GuinanX
0 siblings, 0 replies; 22+ messages in thread
From: Sun, GuinanX @ 2020-09-01 8:52 UTC (permalink / raw)
To: Yigit, Ferruh, dev; +Cc: Xing, Beilei, Guo, Jia, stable
Hi Ferruh
> -----Original Message-----
> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> Sent: Monday, August 31, 2020 9:24 PM
> To: Sun, GuinanX <guinanx.sun@intel.com>; dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia <jia.guo@intel.com>;
> stable@dpdk.org
> Subject: Re: [dpdk-stable] [PATCH v3] net/i40e: fix link status
>
> On 8/6/2020 9:16 AM, Guinan Sun wrote:
> > 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
> >
> > Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> > ---
> > v3:
> > * request the capability for i40evf
> > v2:
> > * modify commit log
> > * add code comments
> > * delete useless code
> > ---
> > drivers/net/i40e/base/virtchnl.h | 16 ++++++++++-
> > drivers/net/i40e/i40e_ethdev_vf.c | 45 ++++++++++++++++++++++++++++---
> > 2 files changed, 57 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/i40e/base/virtchnl.h
> > b/drivers/net/i40e/base/virtchnl.h
> > index 4f498ca45..9c64fd469 100644
> > --- a/drivers/net/i40e/base/virtchnl.h
> > +++ b/drivers/net/i40e/base/virtchnl.h
> > @@ -240,7 +240,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) @@ -536,10
> +537,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 69cab8e73..ccf5d8c57 100644
> > --- a/drivers/net/i40e/i40e_ethdev_vf.c
> > +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> > @@ -469,7 +469,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 {
> > @@ -1386,8 +1387,46 @@ 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 = I40E_LINK_SPEED_100MB;
> > + break;
> > + case ETH_SPEED_NUM_1G:
> > + vf->link_speed = I40E_LINK_SPEED_1GB;
> > + break;
> > + case ETH_SPEED_NUM_2_5G:
> > + vf->link_speed = I40E_LINK_SPEED_2_5GB;
> > + break;
> > + case ETH_SPEED_NUM_5G:
> > + vf->link_speed = I40E_LINK_SPEED_5GB;
> > + break;
> > + case ETH_SPEED_NUM_10G:
> > + vf->link_speed = I40E_LINK_SPEED_10GB;
> > + break;
> > + case ETH_SPEED_NUM_20G:
> > + vf->link_speed = I40E_LINK_SPEED_20GB;
> > + break;
> > + case ETH_SPEED_NUM_25G:
> > + vf->link_speed = I40E_LINK_SPEED_25GB;
> > + break;
> > + case ETH_SPEED_NUM_40G:
> > + vf->link_speed = I40E_LINK_SPEED_40GB;
> > + break;
> > + default:
> > + vf->link_speed =
> I40E_LINK_SPEED_UNKNOWN;
> > + break;
>
>
> Hi Guinan,
>
> These assignments are causing build error [1] because of different types.
>
> 'vf->link_speed' is "enum virtchnl_link_speed", but the values
> ('I40E_LINK_SPEED_100MB' etc..) are "enum i40e_aq_link_speed"
>
> [1]
> http://mails.dpdk.org/archives/test-report/2020-August/148030.html
I will fix the problem you mentioned in the new patch.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-dev] [PATCH v4] net/i40e: fix link status
2020-07-30 8:25 [dpdk-dev] [PATCH] net/i40e: fix link status Guinan Sun
` (2 preceding siblings ...)
2020-08-06 8:16 ` [dpdk-dev] [PATCH v3] " Guinan Sun
@ 2020-09-02 8:06 ` Guinan Sun
2020-09-03 8:38 ` Jeff Guo
2020-09-04 6:21 ` [dpdk-dev] [PATCH v5] " Guinan Sun
4 siblings, 1 reply; 22+ messages in thread
From: Guinan Sun @ 2020-09-02 8:06 UTC (permalink / raw)
To: dev; +Cc: Beilei Xing, Jeff Guo, Guinan Sun, stable
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
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Tested-by: Shougang Wang <shougangx.wang@intel.com>
---
v4:
* fix compilation issue in meson build
v3:
* request the capability for i40evf
v2:
* modify commit log
* add code comments
* delete useless code
---
drivers/net/i40e/base/virtchnl.h | 16 ++++++++++-
drivers/net/i40e/i40e_ethdev_vf.c | 45 ++++++++++++++++++++++++++++---
2 files changed, 57 insertions(+), 4 deletions(-)
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 4f498ca45..9c64fd469 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -240,7 +240,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)
@@ -536,10 +537,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 69cab8e73..664de5e5e 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -469,7 +469,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 {
@@ -1386,8 +1387,46 @@ 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_2_5G:
+ vf->link_speed = VIRTCHNL_LINK_SPEED_2_5GB;
+ break;
+ case ETH_SPEED_NUM_5G:
+ vf->link_speed = VIRTCHNL_LINK_SPEED_5GB;
+ 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
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v4] net/i40e: fix link status
2020-09-02 8:06 ` [dpdk-dev] [PATCH v4] " Guinan Sun
@ 2020-09-03 8:38 ` Jeff Guo
2020-09-03 8:43 ` Min, JiaqiX
0 siblings, 1 reply; 22+ messages in thread
From: Jeff Guo @ 2020-09-03 8:38 UTC (permalink / raw)
To: Guinan Sun, dev; +Cc: Beilei Xing, stable
Acked-by: Jeff Guo <jia.guo@intel.com>
On 9/2/2020 4:06 PM, Guinan Sun wrote:
> 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
>
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> Tested-by: Shougang Wang <shougangx.wang@intel.com>
> ---
> v4:
> * fix compilation issue in meson build
> v3:
> * request the capability for i40evf
> v2:
> * modify commit log
> * add code comments
> * delete useless code
> ---
> drivers/net/i40e/base/virtchnl.h | 16 ++++++++++-
> drivers/net/i40e/i40e_ethdev_vf.c | 45 ++++++++++++++++++++++++++++---
> 2 files changed, 57 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
> index 4f498ca45..9c64fd469 100644
> --- a/drivers/net/i40e/base/virtchnl.h
> +++ b/drivers/net/i40e/base/virtchnl.h
> @@ -240,7 +240,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)
> @@ -536,10 +537,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 69cab8e73..664de5e5e 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -469,7 +469,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 {
> @@ -1386,8 +1387,46 @@ 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_2_5G:
> + vf->link_speed = VIRTCHNL_LINK_SPEED_2_5GB;
> + break;
> + case ETH_SPEED_NUM_5G:
> + vf->link_speed = VIRTCHNL_LINK_SPEED_5GB;
> + 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");
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v4] net/i40e: fix link status
2020-09-03 8:38 ` Jeff Guo
@ 2020-09-03 8:43 ` Min, JiaqiX
0 siblings, 0 replies; 22+ messages in thread
From: Min, JiaqiX @ 2020-09-03 8:43 UTC (permalink / raw)
To: Guo, Jia, Sun, GuinanX, dev; +Cc: Xing, Beilei, stable
Tested-by: Jiaqi Min <jiaqix.min@intel.com>
-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Jeff Guo
Sent: Thursday, September 3, 2020 4:39 PM
To: Sun, GuinanX <guinanx.sun@intel.com>; dev@dpdk.org
Cc: Xing, Beilei <beilei.xing@intel.com>; stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v4] net/i40e: fix link status
Acked-by: Jeff Guo <jia.guo@intel.com>
On 9/2/2020 4:06 PM, Guinan Sun wrote:
> 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
>
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> Tested-by: Shougang Wang <shougangx.wang@intel.com>
> ---
> v4:
> * fix compilation issue in meson build
> v3:
> * request the capability for i40evf
> v2:
> * modify commit log
> * add code comments
> * delete useless code
> ---
> drivers/net/i40e/base/virtchnl.h | 16 ++++++++++-
> drivers/net/i40e/i40e_ethdev_vf.c | 45 ++++++++++++++++++++++++++++---
> 2 files changed, 57 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/i40e/base/virtchnl.h
> b/drivers/net/i40e/base/virtchnl.h
> index 4f498ca45..9c64fd469 100644
> --- a/drivers/net/i40e/base/virtchnl.h
> +++ b/drivers/net/i40e/base/virtchnl.h
> @@ -240,7 +240,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) @@ -536,10 +537,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 69cab8e73..664de5e5e 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -469,7 +469,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 {
> @@ -1386,8 +1387,46 @@ 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_2_5G:
> + vf->link_speed = VIRTCHNL_LINK_SPEED_2_5GB;
> + break;
> + case ETH_SPEED_NUM_5G:
> + vf->link_speed = VIRTCHNL_LINK_SPEED_5GB;
> + 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");
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-dev] [PATCH v5] net/i40e: fix link status
2020-07-30 8:25 [dpdk-dev] [PATCH] net/i40e: fix link status Guinan Sun
` (3 preceding siblings ...)
2020-09-02 8:06 ` [dpdk-dev] [PATCH v4] " Guinan Sun
@ 2020-09-04 6:21 ` Guinan Sun
2020-09-07 5:04 ` Zhang, Qi Z
4 siblings, 1 reply; 22+ messages in thread
From: Guinan Sun @ 2020-09-04 6:21 UTC (permalink / raw)
To: dev; +Cc: Beilei Xing, Jeff Guo, Guinan Sun, stable
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
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Tested-by: Jiaqi Min <jiaqix.min@intel.com>
---
v5:
* code rebase
v4:
* fix compilation issue in meson build
v3:
* request the capability for i40evf
v2:
* modify commit log
* add code comments
* delete useless code
---
drivers/net/i40e/base/virtchnl.h | 16 ++++++++++-
drivers/net/i40e/i40e_ethdev_vf.c | 46 +++++++++++++++++++++++++++++--
2 files changed, 58 insertions(+), 4 deletions(-)
diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h
index 4f498ca45..9c64fd469 100644
--- a/drivers/net/i40e/base/virtchnl.h
+++ b/drivers/net/i40e/base/virtchnl.h
@@ -240,7 +240,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)
@@ -536,10 +537,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 b4e42939e..5f86bb6f5 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -469,7 +469,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 {
@@ -1386,8 +1387,47 @@ 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_2_5G:
+ vf->link_speed = VIRTCHNL_LINK_SPEED_2_5GB;
+ break;
+ case ETH_SPEED_NUM_5G:
+ vf->link_speed = VIRTCHNL_LINK_SPEED_5GB;
+ 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;
+ }
+
i40evf_dev_link_update(dev, 0);
_rte_eth_dev_callback_process(dev,
RTE_ETH_EVENT_INTR_LSC, NULL);
--
2.17.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v5] net/i40e: fix link status
2020-09-04 6:21 ` [dpdk-dev] [PATCH v5] " Guinan Sun
@ 2020-09-07 5:04 ` Zhang, Qi Z
0 siblings, 0 replies; 22+ messages in thread
From: Zhang, Qi Z @ 2020-09-07 5:04 UTC (permalink / raw)
To: Sun, GuinanX, dev; +Cc: Xing, Beilei, Guo, Jia, Sun, GuinanX, stable
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Guinan Sun
> Sent: Friday, September 4, 2020 2:22 PM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Guo, Jia <jia.guo@intel.com>; Sun,
> GuinanX <guinanx.sun@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v5] net/i40e: fix link status
>
> 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
>
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> Acked-by: Jeff Guo <jia.guo@intel.com>
> Tested-by: Jiaqi Min <jiaqix.min@intel.com>
Applied to dpdk-next-inet-intel.
Thanks
Qi
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2020-09-07 5:05 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 8:25 [dpdk-dev] [PATCH] net/i40e: fix link status Guinan Sun
2020-07-30 9:12 ` Jeff Guo
2020-07-30 9:26 ` Sun, GuinanX
2020-07-30 10:25 ` [dpdk-dev] [PATCH v2] " Guinan Sun
2020-07-30 10:51 ` Wang, ShougangX
2020-07-30 10:57 ` Jeff Guo
2020-07-31 2:29 ` Xing, Beilei
2020-07-31 2:37 ` Wang, ShougangX
2020-07-31 3:50 ` Xing, Beilei
2020-07-31 4:09 ` Sun, GuinanX
2020-08-06 8:16 ` [dpdk-dev] [PATCH v3] " Guinan Sun
2020-08-06 9:46 ` Wang, ShougangX
2020-08-06 10:08 ` Xing, Beilei
2020-08-07 2:09 ` Jeff Guo
2020-08-31 0:52 ` Zhang, Qi Z
2020-08-31 13:24 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2020-09-01 8:52 ` Sun, GuinanX
2020-09-02 8:06 ` [dpdk-dev] [PATCH v4] " Guinan Sun
2020-09-03 8:38 ` Jeff Guo
2020-09-03 8:43 ` Min, JiaqiX
2020-09-04 6:21 ` [dpdk-dev] [PATCH v5] " Guinan Sun
2020-09-07 5:04 ` Zhang, Qi Z
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).