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 78AC9A04DC; Sun, 22 Nov 2020 11:04:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0F223C8E6; Sun, 22 Nov 2020 11:04:27 +0100 (CET) Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by dpdk.org (Postfix) with ESMTP id 6B363C8E4 for ; Sun, 22 Nov 2020 11:04:24 +0100 (CET) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Sun, 22 Nov 2020 02:04:26 -0800 Received: from nvidia.com (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 22 Nov 2020 10:04:17 +0000 From: Raslan Darawsheh To: CC: , , , =?UTF-8?q?Beno=C3=AEt=20Ganne?= , =?UTF-8?q?Beno=C3=AEt=20Ganne?= Date: Sun, 22 Nov 2020 12:04:04 +0200 Message-ID: <20201122100404.8612-1-rasland@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201119142018.25277-1-rasland@nvidia.com> References: <20201119142018.25277-1-rasland@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1606039466; bh=300d/TY22a2ySqhDG9PT7FTCFwDpS6XQgr9c7Y8Nux4=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding: X-Originating-IP:X-ClientProxiedBy; b=FPHi0MjtYNiqkepQokMt29RLtc59ROJ6hnk+ogJBNh+OAm3x4KazOMIhhn4lJnKht 3UE5fT0AnmlzpE2NJG3KWqjBPckoybkjY+GEX9BDVoWx4LyKE0tUC2JfzNvdgnc6uJ /mSROXzrW7R8CWJuhYTyhXNGN1TW1Wvgzqi2pdootHfT6U/BT7ayhC8h5P1xLFfK8+ 6CgkDYK9t4zJPelhX9+b0Ba1iAPAb9xA2aokqWuuq9PtPmWcVXO9AkUU4CswZXdFnm 1Rjg5GeXDIJIXOJx/HRImBSs0VcxZtLwrrUdWsDJzBwUE1WvS0bP7CqQK9USDZkTMH BJs0YDF1UyQpg== Subject: [dpdk-dev] [PATCH v3] net/mlx5: allow unknown link speed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Beno=C3=AEt Ganne mlx5 PMD refuses to update link state if link speed is defined but status is down or if link speed is undefined but status is up, even if the ioctl() succeeded. This prevents application to detect link up/down event, especially when the link speed is not correctly detected. Commit [1] allowed returning unknown link speed, so now pmd allow the return of unknown link speed in the above case. Due to some old kernel driver bug, link speed wasn't detected properly. [1] http://git.dpdk.org/dpdk/commit/?id=3D810b17d116f03 Signed-off-by: Beno=C3=AEt Ganne Signed-off-by: Raslan Darawsheh Acked-by: Matan Azrad --- v2: rebase the code and add doc update v3: reword commit log, and return correct link speed --- doc/guides/rel_notes/release_20_11.rst | 1 + drivers/net/mlx5/linux/mlx5_ethdev_os.c | 16 +++------------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/= release_20_11.rst index 1c262d39a5..75b4ebc84b 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -207,6 +207,7 @@ New Features by rte_flow API. * Added support of Age action query. * Added support of multi-ports hairpin. + * Allow unknown link speed. =20 Updated Mellanox mlx5 vDPA driver: =20 diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/lin= ux/mlx5_ethdev_os.c index 19b281925f..8f9f14156b 100644 --- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -405,7 +405,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev, } link_speed =3D ethtool_cmd_speed(&edata); if (link_speed =3D=3D -1) - dev_link.link_speed =3D ETH_SPEED_NUM_NONE; + dev_link.link_speed =3D ETH_SPEED_NUM_UNKNOWN; else dev_link.link_speed =3D link_speed; priv->link_speed_capa =3D 0; @@ -425,11 +425,6 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev= , ETH_LINK_HALF_DUPLEX : ETH_LINK_FULL_DUPLEX); dev_link.link_autoneg =3D !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); - if (((dev_link.link_speed && !dev_link.link_status) || - (!dev_link.link_speed && dev_link.link_status))) { - rte_errno =3D EAGAIN; - return -rte_errno; - } *link =3D dev_link; return 0; } @@ -517,8 +512,8 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, dev->data->port_id, strerror(rte_errno)); return ret; } - dev_link.link_speed =3D (ecmd->speed =3D=3D UINT32_MAX) ? ETH_SPEED_NUM_N= ONE : - ecmd->speed; + dev_link.link_speed =3D (ecmd->speed =3D=3D UINT32_MAX) ? + ETH_SPEED_NUM_UNKNOWN : ecmd->speed; sc =3D ecmd->link_mode_masks[0] | ((uint64_t)ecmd->link_mode_masks[1] << 32); priv->link_speed_capa =3D 0; @@ -571,11 +566,6 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, ETH_LINK_HALF_DUPLEX : ETH_LINK_FULL_DUPLEX); dev_link.link_autoneg =3D !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); - if (((dev_link.link_speed && !dev_link.link_status) || - (!dev_link.link_speed && dev_link.link_status))) { - rte_errno =3D EAGAIN; - return -rte_errno; - } *link =3D dev_link; return 0; } --=20 2.17.1