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 81096A04E7 for ; Wed, 4 Nov 2020 07:05:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B6CABE87; Wed, 4 Nov 2020 07:05:03 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 02556BE87; Wed, 4 Nov 2020 07:05:00 +0100 (CET) From: Bill Zhou To: viacheslavo@nvidia.com, matan@nvidia.com Cc: stable@dpdk.org, dev@dpdk.org, rasland@nvidia.com, Bill Zhou Date: Wed, 4 Nov 2020 08:04:55 +0200 Message-Id: <1604469895-418435-1-git-send-email-dongz@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-stable] [PATCH] net/mlx5: fix switch port id when representor in bonding 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" From: Bill Zhou In the bonding configurations the port switch id for representors was composed of pf index in bonding as the 1 msb and the representor's index as the remaining 15 lsbs. The special corner case for the host PF representor on BF setups with representor id 0xFFFF was missed as well. The new switch port id consists of 4 msbs for the pf bonding index and the remaining 12 lsbs for the representor index. The switch port id ranges for each type of representors are as follows: Uplink representor(AKA master): 0xFFFF Host PF representor: 0xFFF VF representor: 0x[0-FFE] Fixes: bee57a0a3565 ("net/mlx5: update switch port id in bonding configuration") Cc: stable@dpdk.org Signed-off-by: Bill Zhou Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_defs.h | 2 +- drivers/net/mlx5/mlx5_ethdev.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h index 4980352..f8f8a1f 100644 --- a/drivers/net/mlx5/mlx5_defs.h +++ b/drivers/net/mlx5/mlx5_defs.h @@ -50,7 +50,7 @@ /* Switch port ID parameters for bonding configurations. */ #define MLX5_PORT_ID_BONDING_PF_MASK 0xf -#define MLX5_PORT_ID_BONDING_PF_SHIFT 0xf +#define MLX5_PORT_ID_BONDING_PF_SHIFT 12 /* Alarm timeout. */ #define MLX5_ALARM_TIMEOUT_US 100000 diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index ee97480..a3910cf 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -338,14 +338,22 @@ * representors (more than 4K) or PFs (more than 15) * this approach must be reconsidered. */ - if ((info->switch_info.port_id >> - MLX5_PORT_ID_BONDING_PF_SHIFT) || + /* Switch port ID for VF representors: 0 - 0xFFE */ + if ((info->switch_info.port_id != 0xffff && + info->switch_info.port_id >= + ((1 << MLX5_PORT_ID_BONDING_PF_SHIFT) - 1)) || priv->pf_bond > MLX5_PORT_ID_BONDING_PF_MASK) { DRV_LOG(ERR, "can't update switch port ID" " for bonding device"); MLX5_ASSERT(false); return -ENODEV; } + /* + * Switch port ID for Host PF representor + * (representor_id is -1) , set to 0xFFF + */ + if (info->switch_info.port_id == 0xffff) + info->switch_info.port_id = 0xfff; info->switch_info.port_id |= priv->pf_bond << MLX5_PORT_ID_BONDING_PF_SHIFT; } -- 1.8.3.1