From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6C5D9A0350 for ; Tue, 1 Mar 2022 11:45:59 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3FDC2426DE; Tue, 1 Mar 2022 11:45:59 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 91C4E426DC for ; Tue, 1 Mar 2022 11:45:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646131557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wik3Mn0NdQ/bU8W53e/URTaawScPpx4ai/X0GRR1EUU=; b=eXq6ZWVa/rE8y9wsUNDrMduiLa1IgQob7OP1MqbeV4zh3lKlwmZPINztpTnibMKcqNNHAt X7vHC/hGGBT8uhsq7ji+fQ/IRyQjV5tPDrInwC8XuaLCGP2GNXv8R/ucIkJtH6nUBu51vb 8X1iM6yihPhFthNUqanKiZbOj7MRuto= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-264-PUyo7OwJNgKEIwsKPDVJZg-1; Tue, 01 Mar 2022 05:45:52 -0500 X-MC-Unique: PUyo7OwJNgKEIwsKPDVJZg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB644801AB2; Tue, 1 Mar 2022 10:45:51 +0000 (UTC) Received: from rh.Home (unknown [10.39.194.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id E90E5721DF; Tue, 1 Mar 2022 10:45:50 +0000 (UTC) From: Kevin Traynor To: Shun Hao Cc: Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: fix E-Switch manager vport ID' has been queued to stable release 21.11.1 Date: Tue, 1 Mar 2022 10:42:40 +0000 Message-Id: <20220301104300.334382-84-ktraynor@redhat.com> In-Reply-To: <20220301104300.334382-1-ktraynor@redhat.com> References: <20220301104300.334382-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 21.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/06/22. 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. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/036220c967eee9a9638b06fc1cb64590b52c91a6 Thanks. Kevin --- >From 036220c967eee9a9638b06fc1cb64590b52c91a6 Mon Sep 17 00:00:00 2001 From: Shun Hao Date: Tue, 22 Feb 2022 17:07:16 +0200 Subject: [PATCH] net/mlx5: fix E-Switch manager vport ID [ upstream commit 38eb5c9f35433f5d133f6490d97319e05bde317d ] One of the E-Switch vports plays the special role - it is assigned as "E-Switch manager" and has some special exclusive rights and duties - it maintains all the representors, manages FDB domain flows, etc. By default, the E-Switch vport index was supposed to be zero on standalone NICs (regular ConnectX) and 0xFFFE SmartNIC (BlueField), but that was not always correct - this index can be assigned with any value by kernel/hypervisor. Currently the E-Switch manager vport id is supposed to be default - 0 for standalone NICs, and 0xFFFE for the SmartNICs, and is deduced from the device PCI id. To handle this and do not suggest any default values, can use DevX API to query E-Switch manager vport ID directly from the firmware during initialization, and use that value by default. If the new method is not provided (legacy firmware), fallback to use the PCI id approach. Fixes: a564038699f9 ("net/mlx5: support E-Switch manager egress traffic match") Signed-off-by: Shun Hao Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/mlx5_devx_cmds.c | 12 ++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 2 ++ drivers/common/mlx5/mlx5_prm.h | 12 ++++++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 4 ++++ 4 files changed, 30 insertions(+) diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 7732613c69..70a430f134 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -1131,4 +1131,16 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, } } + if (attr->eswitch_manager) { + hcattr = mlx5_devx_get_hca_cap(ctx, in, out, &rc, + MLX5_SET_HCA_CAP_OP_MOD_ESW | + MLX5_HCA_CAP_OPMOD_GET_CUR); + if (!hcattr) + return rc; + attr->esw_mgr_vport_id_valid = + MLX5_GET(esw_cap, hcattr, + esw_manager_vport_number_valid); + attr->esw_mgr_vport_id = + MLX5_GET(esw_cap, hcattr, esw_manager_vport_number); + } return 0; error: diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h index 37821b493e..4373761c29 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -253,4 +253,6 @@ struct mlx5_hca_attr { uint32_t umr_indirect_mkey_disabled:1; uint32_t log_min_stride_wqe_sz:5; + uint32_t esw_mgr_vport_id_valid:1; /* E-Switch Mgr vport ID is valid. */ + uint16_t esw_mgr_vport_id; /* E-Switch Mgr vport ID . */ uint16_t max_wqe_sz_sq; }; diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 495b63191a..b9e39aa717 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -1265,4 +1265,5 @@ enum { MLX5_GET_HCA_CAP_OP_MOD_ROCE = 0x4 << 1, MLX5_GET_HCA_CAP_OP_MOD_NIC_FLOW_TABLE = 0x7 << 1, + MLX5_SET_HCA_CAP_OP_MOD_ESW = 0x9 << 1, MLX5_GET_HCA_CAP_OP_MOD_VDPA_EMULATION = 0x13 << 1, MLX5_GET_HCA_CAP_OP_MOD_PARSE_GRAPH_NODE_CAP = 0x1C << 1, @@ -1927,4 +1928,14 @@ struct mlx5_ifc_cmd_hca_cap_2_bits { }; +struct mlx5_ifc_esw_cap_bits { + u8 reserved_at_0[0x60]; + + u8 esw_manager_vport_number_valid[0x1]; + u8 reserved_at_61[0xf]; + u8 esw_manager_vport_number[0x10]; + + u8 reserved_at_80[0x780]; +}; + union mlx5_ifc_hca_cap_union_bits { struct mlx5_ifc_cmd_hca_cap_bits cmd_hca_cap; @@ -1935,4 +1946,5 @@ union mlx5_ifc_hca_cap_union_bits { struct mlx5_ifc_virtio_emulation_cap_bits vdpa_caps; struct mlx5_ifc_flow_table_nic_cap_bits flow_table_nic_cap; + struct mlx5_ifc_esw_cap_bits esw_cap; struct mlx5_ifc_roce_caps_bits roce_caps; u8 reserved_at_0[0x8000]; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index c7f43c9ab4..5225978a3b 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -98,4 +98,8 @@ flow_dv_get_esw_manager_vport_id(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_common_device *cdev = priv->sh->cdev; + + if (cdev->config.hca_attr.esw_mgr_vport_id_valid) + return (int16_t)cdev->config.hca_attr.esw_mgr_vport_id; if (priv->pci_dev == NULL) -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-03-01 10:41:03.744905033 +0000 +++ 0084-net-mlx5-fix-E-Switch-manager-vport-ID.patch 2022-03-01 10:41:01.447244127 +0000 @@ -1 +1 @@ -From 38eb5c9f35433f5d133f6490d97319e05bde317d Mon Sep 17 00:00:00 2001 +From 036220c967eee9a9638b06fc1cb64590b52c91a6 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 38eb5c9f35433f5d133f6490d97319e05bde317d ] + @@ -24 +25,0 @@ -Cc: stable@dpdk.org @@ -99 +100 @@ -index 689b191748..abd1c27538 100644 +index c7f43c9ab4..5225978a3b 100644