From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 58D4D43B7D
	for <public@inbox.dpdk.org>; Tue,  5 Mar 2024 10:59:08 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 514154026B;
	Tue,  5 Mar 2024 10:59:08 +0100 (CET)
Received: from NAM10-MW2-obe.outbound.protection.outlook.com
 (mail-mw2nam10on2041.outbound.protection.outlook.com [40.107.94.41])
 by mails.dpdk.org (Postfix) with ESMTP id CE1FD4026B
 for <stable@dpdk.org>; Tue,  5 Mar 2024 10:59:06 +0100 (CET)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=DR+Ag2nGpLYleLVUdAT1cZ/pM0VmpyMMsrM5crLcQ6u2eQIQCuHrGYICAsZCABISVQNocx8b273x6Bh+eHBAu2nAqgLXGmox5A+oDGnkcvdU/jZk9qdJu6wNa1GQwhz8oXv3GHcMOJdJ0m4lNjSmEF3wmCxI6fon1hpS1mHkitBKsLZ6JvpbWMraiKgcMl+9LwDNLe+rXrae5f7FEuPBFwCeKLGY7+y7p51OVd/jugg5g68Ah3cvJrfhGfarDIsaHpDtr9+g+DzO9hstTSyAyNIHxeoPtZ95OQ1RO2HmK27FClA5UMwmuW7HUInHFg+CIomM6R5FZluf3+i8hOeWPA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=zcUheTH/CfySrTYvDVRsd5yZGj2lt+p4tTq1r17QXnI=;
 b=Vz7C7oZvdHNvLtkHMbIURdRMWj6ewO3btfFnDtK8y2LsyXaCMeSXRGB+I8jVjJyX+kAVqqNwhWdnKQ3Kxgu0rwPr7G7h5ZQXQG84JQV+TvfmyQMka3hybJ+3gsnL73H7xmq986Hh3shqtaQm8vyaDFE40f3SSNp+l1ZxwjuFEj5or603iqYdJPyyjoLg3edXtLc24FXmJooTOtyQOQWaKy+rPE14jHVthMAE2xDNsYdonnp+mLs2tvdSkNhKRFaNGohITHlKLrE8MYNtxpkpigP0qoeMlJ0WrIO0nHVQIDHpPRFJEB8PJGi/ZWhiXUGz3SKonDTzssaPRCzbZMBjzg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is
 216.228.117.161) smtp.rcpttodomain=marvell.com smtp.mailfrom=nvidia.com;
 dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com;
 dkim=none (message not signed); arc=none (0)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=zcUheTH/CfySrTYvDVRsd5yZGj2lt+p4tTq1r17QXnI=;
 b=mr/NAC3dGzU6YvXrLxZ/dQgQuQCF693PXbcwQ8ikq3RAys3vJUAZyXxzFVP2ZqfoVgnLF10vTvM03i9X34n4afNc4Puqsoq4lUe9Krh3UnWPo41/CinbxwDc3QcAHHLGZGuqKmIBNJgdZspAl7wvoTP1gaVlXW8d+mqftMtjemjBkiD3+SWbiwiJwfXpNZTxx72NIECPjT1ysHfsRsZEeqfLqhR2GvHcDSrYJrwTz0jtko7azW0FKF+BxrbWq2AdWEryyaP82gACCy8hnDednRRLZp0eDu9uG8+Og2wp/BgEup1Ev0Upn8Gmp32v4bzDeUDwyhZViLaHyVfd7bskUw==
Received: from CY5PR14CA0001.namprd14.prod.outlook.com (2603:10b6:930:2::13)
 by PH7PR12MB7889.namprd12.prod.outlook.com (2603:10b6:510:27f::10) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38; Tue, 5 Mar
 2024 09:59:04 +0000
Received: from CY4PEPF0000EDD4.namprd03.prod.outlook.com
 (2603:10b6:930:2:cafe::c7) by CY5PR14CA0001.outlook.office365.com
 (2603:10b6:930:2::13) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39 via Frontend
 Transport; Tue, 5 Mar 2024 09:59:03 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161)
 smtp.mailfrom=nvidia.com;
 dkim=none (message not signed)
 header.d=none;dmarc=pass action=none header.from=nvidia.com;
Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates
 216.228.117.161 as permitted sender) receiver=protection.outlook.com;
 client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C
Received: from mail.nvidia.com (216.228.117.161) by
 CY4PEPF0000EDD4.mail.protection.outlook.com (10.167.241.208) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.7362.11 via Frontend Transport; Tue, 5 Mar 2024 09:59:03 +0000
Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com
 (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 5 Mar 2024
 01:58:53 -0800
Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com
 (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 5 Mar
 2024 01:58:51 -0800
From: Xueming Li <xuemingl@nvidia.com>
To: Hanumanth Pothula <hpothula@marvell.com>
CC: dpdk stable <stable@dpdk.org>
Subject: patch 'net/thunderx: fix DMAC control register update' has been
 queued to stable release 23.11.1
Date: Tue, 5 Mar 2024 17:47:42 +0800
Message-ID: <20240305094757.439387-122-xuemingl@nvidia.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20240305094757.439387-1-xuemingl@nvidia.com>
References: <20240305094757.439387-1-xuemingl@nvidia.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [10.126.231.35]
X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To
 rnnvmail201.nvidia.com (10.129.68.8)
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD4:EE_|PH7PR12MB7889:EE_
X-MS-Office365-Filtering-Correlation-Id: 8d4cc4d7-e0c2-447f-b145-08dc3cfae396
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: Ctt8B4E6M8KQPVmkt79jWJv781ceCHjU/PjA7RSYir1meph2RrlznGnET2pQl+70oXKlRuqmDrpy6c5uormKb7VBTePZ177b5JtSUlzDMlW9NxKDu8W0V84+truXwmaf59hJv4Zwkb3n53jPHItTwJElaGpT+u9vOUTZ/E3Z5xIg8Pn0K/xBH7l/Jd6OGiS3UM9u1YPG4mcIzA9/toyWDYwj55EBAa481a1oEzF29HNUpXTEmjU3uwHrEgil7FYNRV2bPh5kKnOPtzKUF99AqcD4nLgYU6kFU+JdfttKtVs8/s2C/OocOhSQOhKqRPDwHMP8qu5OTltAt+ZQITDC9VTgg4shEida2nuhULueUgNc+irO8Y5lThiltpNMxpMzjEIHBZepptlqA6SIj/VZhAZ8HNYGugNyiyuIeAJHpw5OZ9bWm5TQ+3RIYaHh93UiXsoq3sfZLlTw/WxEMuA01q7XZ6hStonPjXKhzk4MjwvGIU5KnO2rLt9JuXxvMQODJRadFm7nEkiI+8Rias+CeCYQa21Ex8MeSW1n2GK7pgGJpXw7l95RmtNs2WvOBo6wA+AapZ0VDuk/g8NqMP1UednH0HN6fg94heCYzuhOLjQhFp7chvSsqFQ8LxgweZs9w1kCK2XAValyNSP5g9oMsotQSuPYRABuj22u3QfLGhrElY1XhRg8L0RyY3fuwALheVtNGuBdb9p+gCsWpYq6iDGwCaSPUGMxLrwftnB0qwe+k7WkXQwoG6+6oI+Bpifi
X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE;
 SFS:(13230031)(82310400014)(36860700004)(376005); DIR:OUT; SFP:1101; 
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 09:59:03.6468 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 8d4cc4d7-e0c2-447f-b145-08dc3cfae396
X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161];
 Helo=[mail.nvidia.com]
X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EDD4.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7889
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org

Hi,

FYI, your patch has been queued to stable release 23.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/31/24. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=0e5798d30b0a7c87e4c43a554d798d7799cf6824

Thanks.

Xueming Li <xuemingl@nvidia.com>

---
>From 0e5798d30b0a7c87e4c43a554d798d7799cf6824 Mon Sep 17 00:00:00 2001
From: Hanumanth Pothula <hpothula@marvell.com>
Date: Thu, 21 Dec 2023 16:49:59 +0530
Subject: [PATCH] net/thunderx: fix DMAC control register update
Cc: Xueming Li <xuemingl@nvidia.com>

[ upstream commit 44a8635459cbc83cde94b64971faee34ca9be19d ]

By default dmac control register is set to reject packets
on mac address match, leading all unicast packets to drop.
Update DMAC control register to allow packets on MAC address
match rather than dropping.

Fixes: e438796617dc ("net/thunderx: add PMD skeleton")

Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>
---
 drivers/net/thunderx/base/nicvf_mbox.c | 12 ++++++++++++
 drivers/net/thunderx/base/nicvf_mbox.h | 10 ++++++++++
 drivers/net/thunderx/nicvf_ethdev.c    | 26 ++++++++++++++++++++++++++
 3 files changed, 48 insertions(+)

diff --git a/drivers/net/thunderx/base/nicvf_mbox.c b/drivers/net/thunderx/base/nicvf_mbox.c
index 5993eec4e6..0e0176974d 100644
--- a/drivers/net/thunderx/base/nicvf_mbox.c
+++ b/drivers/net/thunderx/base/nicvf_mbox.c
@@ -485,3 +485,15 @@ nicvf_mbox_reset_xcast(struct nicvf *nic)
 	mbx.msg.msg = NIC_MBOX_MSG_RESET_XCAST;
 	nicvf_mbox_send_msg_to_pf(nic, &mbx);
 }
+
+int
+nicvf_mbox_set_xcast(struct nicvf *nic, uint8_t  mode, uint64_t mac)
+{
+	struct nic_mbx mbx = { .msg = { 0 } };
+
+	mbx.xcast.msg = NIC_MBOX_MSG_SET_XCAST;
+	mbx.xcast.mode = mode;
+	mbx.xcast.mac = mac;
+
+	return nicvf_mbox_send_msg_to_pf(nic, &mbx);
+}
diff --git a/drivers/net/thunderx/base/nicvf_mbox.h b/drivers/net/thunderx/base/nicvf_mbox.h
index 322c8159cb..47f3d13755 100644
--- a/drivers/net/thunderx/base/nicvf_mbox.h
+++ b/drivers/net/thunderx/base/nicvf_mbox.h
@@ -45,6 +45,8 @@
 #define	NIC_MBOX_MSG_CFG_DONE		0xF0	/* VF configuration done */
 #define	NIC_MBOX_MSG_SHUTDOWN		0xF1	/* VF is being shutdown */
 #define NIC_MBOX_MSG_RESET_XCAST	0xF2    /* Reset DCAM filtering mode */
+#define	NIC_MBOX_MSG_ADD_MCAST		0xF3	/* ADD MAC to DCAM filters */
+#define	NIC_MBOX_MSG_SET_XCAST		0xF4	/* Set MCAST/BCAST Rx mode */
 #define	NIC_MBOX_MSG_MAX		0x100	/* Maximum number of messages */

 /* Get vNIC VF configuration */
@@ -190,6 +192,12 @@ struct change_link_mode_msg {

 };

+struct xcast {
+	uint8_t    msg;
+	uint8_t    mode;
+	uint64_t   mac:48;
+};
+
 struct nic_mbx {
 /* 128 bit shared memory between PF and each VF */
 union {
@@ -209,6 +217,7 @@ union {
 	struct reset_stat_cfg	reset_stat;
 	struct set_link_state	set_link;
 	struct change_link_mode_msg mode;
+	struct xcast xcast;
 };
 };

@@ -239,5 +248,6 @@ void nicvf_mbox_cfg_done(struct nicvf *nic);
 void nicvf_mbox_link_change(struct nicvf *nic);
 void nicvf_mbox_reset_xcast(struct nicvf *nic);
 int nicvf_mbox_change_mode(struct nicvf *nic, struct change_link_mode *cfg);
+int nicvf_mbox_set_xcast(struct nicvf *nic, uint8_t  mode, uint64_t mac);

 #endif /* __THUNDERX_NICVF_MBOX__ */
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 5a0c3dc4a6..ba2ef4058e 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -58,6 +58,10 @@ RTE_LOG_REGISTER_SUFFIX(nicvf_logtype_driver, driver, NOTICE);
 #define NICVF_QLM_MODE_SGMII  7
 #define NICVF_QLM_MODE_XFI   12

+#define BCAST_ACCEPT      0x01
+#define CAM_ACCEPT        (1 << 3)
+#define BGX_MCAST_MODE(x) ((x) << 1)
+
 enum nicvf_link_speed {
 	NICVF_LINK_SPEED_SGMII,
 	NICVF_LINK_SPEED_XAUI,
@@ -2185,9 +2189,22 @@ nicvf_eth_dev_uninit(struct rte_eth_dev *dev)
 	nicvf_dev_close(dev);
 	return 0;
 }
+
+static inline uint64_t ether_addr_to_u64(uint8_t *addr)
+{
+	uint64_t u = 0;
+	int i;
+
+	for (i = 0; i < RTE_ETHER_ADDR_LEN; i++)
+		u = u << 8 | addr[i];
+
+	return u;
+}
+
 static int
 nicvf_eth_dev_init(struct rte_eth_dev *eth_dev)
 {
+	uint8_t dmac_ctrl_reg = 0;
 	int ret;
 	struct rte_pci_device *pci_dev;
 	struct nicvf *nic = nicvf_pmd_priv(eth_dev);
@@ -2311,6 +2328,15 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev)
 		goto malloc_fail;
 	}

+	/* set DMAC CTRL reg to allow MAC */
+	dmac_ctrl_reg = BCAST_ACCEPT | BGX_MCAST_MODE(2) | CAM_ACCEPT;
+	ret = nicvf_mbox_set_xcast(nic, dmac_ctrl_reg,
+			ether_addr_to_u64(nic->mac_addr));
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to set mac addr");
+		goto malloc_fail;
+	}
+
 	ret = nicvf_set_first_skip(eth_dev);
 	if (ret) {
 		PMD_INIT_LOG(ERR, "Failed to configure first skip");
--
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-03-05 17:39:34.599785720 +0800
+++ 0121-net-thunderx-fix-DMAC-control-register-update.patch	2024-03-05 17:39:30.963566499 +0800
@@ -1 +1 @@
-From 44a8635459cbc83cde94b64971faee34ca9be19d Mon Sep 17 00:00:00 2001
+From 0e5798d30b0a7c87e4c43a554d798d7799cf6824 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl@nvidia.com>
+
+[ upstream commit 44a8635459cbc83cde94b64971faee34ca9be19d ]
@@ -12 +14,0 @@
-Cc: stable@dpdk.org
@@ -83 +85 @@
-index ddcc52770e..609d95dcfa 100644
+index 5a0c3dc4a6..ba2ef4058e 100644
@@ -97 +99 @@
-@@ -2182,9 +2186,22 @@ nicvf_eth_dev_uninit(struct rte_eth_dev *dev)
+@@ -2185,9 +2189,22 @@ nicvf_eth_dev_uninit(struct rte_eth_dev *dev)
@@ -120 +122 @@
-@@ -2308,6 +2325,15 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev)
+@@ -2311,6 +2328,15 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev)