From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 44C7FA04DD for ; Wed, 28 Oct 2020 11:47:10 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3CF2A2BFE; Wed, 28 Oct 2020 11:47:09 +0100 (CET) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 3A8F7C8F8 for ; Wed, 28 Oct 2020 11:47:06 +0100 (CET) Received: by mail-wr1-f67.google.com with SMTP id b8so5180081wrn.0 for ; Wed, 28 Oct 2020 03:47:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=623qzxnKk2pi3O2vCbLtaE8NpPH5umms6aY3Sk/qIYk=; b=HOVX6hR/tP8N4/Pk1OXm1lyEolRljMSyUr+LvhKgQ8PBETH1kD95PsxtTr61NocfG2 kVBtuqMgtD9E9ia8W9s41NT/DbiI0VRDD4Pk7yy2nwIz+t7ODdCUSXKIebMATwj3DuJg q6sMjInfQ7J6j0+URMoSVlx4W4Bln6JeF1izc1fgZc+OHo7sb18h8JqMck1wLUVeSk2t uWvuhW4SFp4MGums2Hvworcgd4HnV9vt+EOS7GmFGt9QWn6+r1wrs5vYEkG6VPxz1Uug RAx8R92FSzBSbFdScWW2DcJ+r7+MUUHAfZmeMq4bds7Q/r6fz9vnUVesDF9Oyks+5cS1 tLQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=623qzxnKk2pi3O2vCbLtaE8NpPH5umms6aY3Sk/qIYk=; b=kiOlR5oZAwQq6IoosXhTylsIPpSZvol292m2rdK3NPzVIE177OvrmOxRRIALbrnpkS zBChRZJz7pQ5SarrV8yDnUEJe0EchP8oInm75AYV3scp+jgt1yIasL2ux8fvUtovr4BA wpxE6HvBZj2NXX80kAV6fsqoxMYGGit4QlJHL4whW2CEoWAsAf6kQQntRTCosSJBw3u6 rBJ7r9FE/7LNftYXw8CskV5vhsNtYog14nw3JvP2RVdS3SBNy5TCyRHRoO/vOqNBWuO9 7tlkAMf5QdG/JmXa3e2RtUQPYD4YfW1BO3vSfvLiQpjGOCe4ZdVT9jg0yh89mqW0kE8p IhoQ== X-Gm-Message-State: AOAM532B23mBra6tCTdeR/pv9PIO910OWpOla0pPnmeIXuGf2Ei7pCZg VGHwVTHrfxHMM7nYdqqu+hQEmd0dJOf4XQ== X-Google-Smtp-Source: ABdhPJz1TP8q2N/SepSA2yAX6zzFNMFtRFgNuCdQNrxTE96hvhELzpkaIXDrdILMzDzd3OjVJ+NdWQ== X-Received: by 2002:adf:e685:: with SMTP id r5mr8752247wrm.340.1603882024840; Wed, 28 Oct 2020 03:47:04 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id w6sm6035624wmb.28.2020.10.28.03.47.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:47:04 -0700 (PDT) From: luca.boccassi@gmail.com To: Guinan Sun Cc: Jeff Guo , Jiaqi Min , dpdk stable Date: Wed, 28 Oct 2020 10:42:58 +0000 Message-Id: <20201028104606.3504127-19-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/i40e: fix link status' has been queued to stable release 19.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/30/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 75fe6aae29505468861f6486e82081386831b0fa Mon Sep 17 00:00:00 2001 From: Guinan Sun Date: Fri, 4 Sep 2020 06:21:54 +0000 Subject: [PATCH] net/i40e: fix link status [ 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") Signed-off-by: Guinan Sun Acked-by: Jeff Guo Tested-by: Jiaqi Min --- 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 0ec84e9dae..acd7b7eb88 100644 --- a/drivers/net/i40e/base/virtchnl.h +++ b/drivers/net/i40e/base/virtchnl.h @@ -233,7 +233,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) @@ -522,10 +523,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 0381ba64e1..9feed6222e 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -468,7 +468,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 { @@ -1362,8 +1363,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; + } + break; case VIRTCHNL_EVENT_PF_DRIVER_CLOSE: PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_PF_DRIVER_CLOSE event"); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:12.385382736 +0000 +++ 0019-net-i40e-fix-link-status.patch 2020-10-28 10:35:11.440829082 +0000 @@ -1,13 +1,14 @@ -From 3db12449e119587648adf0b189c0e45502b71285 Mon Sep 17 00:00:00 2001 +From 75fe6aae29505468861f6486e82081386831b0fa Mon Sep 17 00:00:00 2001 From: Guinan Sun Date: Fri, 4 Sep 2020 06:21:54 +0000 Subject: [PATCH] net/i40e: fix link status +[ 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 Signed-off-by: Guinan Sun Acked-by: Jeff Guo @@ -18,10 +19,10 @@ 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/virtchnl.h -index 4f498ca456..9c64fd4690 100644 +index 0ec84e9dae..acd7b7eb88 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); +@@ -233,7 +233,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 @@ -31,7 +32,7 @@ #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 { +@@ -522,10 +523,23 @@ enum virtchnl_event_codes { struct virtchnl_pf_event { enum virtchnl_event_codes event; union { @@ -56,10 +57,10 @@ int severity; diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c -index ac6c25b7cb..b755350cd2 100644 +index 0381ba64e1..9feed6222e 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) +@@ -468,7 +468,8 @@ i40evf_get_vf_resource(struct rte_eth_dev *dev) VIRTCHNL_VF_OFFLOAD_RSS_AQ | VIRTCHNL_VF_OFFLOAD_RSS_REG | VIRTCHNL_VF_OFFLOAD_VLAN | @@ -69,7 +70,7 @@ 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, +@@ -1362,8 +1363,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"); @@ -116,9 +117,9 @@ + 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); + break; + case VIRTCHNL_EVENT_PF_DRIVER_CLOSE: + PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_PF_DRIVER_CLOSE event"); -- 2.20.1