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 55B1D43B86 for ; Tue, 5 Mar 2024 10:55:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44A954026B; Tue, 5 Mar 2024 10:55:53 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2056.outbound.protection.outlook.com [40.107.223.56]) by mails.dpdk.org (Postfix) with ESMTP id 0BD064014F for ; Tue, 5 Mar 2024 10:55:52 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=li0kDrBCgrfdVq6wWsYOhEDz02dZJV/+Q9QPV9AAeOhJzhBWBX9hN7722ftRBoWy6GHjuYJMuD6MIyEYRGrIU4tHH0ckKgusmbsgW283SVku4RUn4/rM493jROwAy2YG1K2AfSoIopkpBgVKV7LFAm+Ws7kYBNengpCqsggi9jfkudU+0uba1jSbHBsO8hiIu0nxlCeJP0yzS9mAI5Y4ozq72pMqUYCuam9E1tBlC5Ute5FyQ4NEAVgT5G7ovbDgpgQ1PuMoPPkWAvAXGLnbLWTuV64s6nWjK+XE2Ww5xA0IZLtahaTc3qbqLLwQop5TktVdc8tQwHNsHwazBJWlpQ== 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=3ezmaofKt26bqHBMzjFMkQwPPHQeoByURyC9FohC7Do=; b=PThpfV2M2c+NqMFrogAqmkKSLnBnrNHuA6OjFeJXkQKMtLrGzjzk9wDceuQh3AbW4sYuu1AOfByEHyihVDXL8m4Tcs7jFrqLJxNWG+xZVU53WUBrJ+jrELBzbCLWOwDrpTfPjvO+wRwgHP3obTI9mqhPJmqyOqTAFvvNA7ra6Q5tFE3nnKqosQqZR2WIk/02Gk/Lg1BTfKYMd8oDTZ72iAn1EMy6CXWIDEn6hVsxtXhr+6cIexvhh+awljEbhHmuFTFjUH3ksigWWUjDJWu8VuNctXfgPfk+b4fClI+ScWhFKe1NKnCgDFSaveyPWChSyZhhqeIsQPmQ2hEBMgOmhg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=huawei.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=3ezmaofKt26bqHBMzjFMkQwPPHQeoByURyC9FohC7Do=; b=cAargP765MdNMgFvhLE6hYRCn3O8fnylThbVtGLnEtZ7gAAO1JiMegwncWH4uu7ZAaPh76xj64z9xPGI2S9rdMkTiQv/xmY66ZMb1FSDQeTd32bhdSgIZbfeSqB8DLJNF+9HLe8KM/JgidDDNhvSDwGmS4R578kOoL/TeR0TxdguExMq8EjtwRFvAGBw9jFGNtVZ7a0Yfressvq+HdwOSc88q5zM0zlnQK1azWLELdG0xbW69ad3k7h/BjVwQVlEYc794tOwoqTU6CdVigE5JTJEKB78xQfgb1tiOtcFA8xexw4ntqUKtPPoj5WZGfabBGtY9FtaK3Thi3jrb2JqmQ== Received: from MW4PR04CA0387.namprd04.prod.outlook.com (2603:10b6:303:81::32) by IA1PR12MB7519.namprd12.prod.outlook.com (2603:10b6:208:418::22) 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:55:49 +0000 Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:303:81:cafe::9) by MW4PR04CA0387.outlook.office365.com (2603:10b6:303:81::32) 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:55:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.38) 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:55:44 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) 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:55:26 -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:55:25 -0800 From: Xueming Li To: Dengdui Huang CC: Jie Hai , dpdk stable Subject: patch 'net/hns3: refactor PF mailbox message struct' has been queued to stable release 23.11.1 Date: Tue, 5 Mar 2024 17:47:04 +0800 Message-ID: <20240305094757.439387-84-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: CO1PEPF000042A9:EE_|IA1PR12MB7519:EE_ X-MS-Office365-Filtering-Correlation-Id: 873c73e7-9767-4444-cb7b-08dc3cfa6cd9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Jf0YGyDNf2FQ8PjzEadq9GmiORq/5pMScINSIv5XZWsywdnB3vDN/Agk5FaEuyNX/0Hialq7ngfHVXEcHEAKPP9X6e39ZOvk77ObfvHfOaUv7ppX5+YldZzxeGCv3E+4S4qL4dnKEfSKVkc0fzgd8M7NBSELMKYgjD1Hx3t72yAitsnQtosgWxKPUnfGAquEIBtAOt/pMTPtQXLq8UisbBhgkOEF/xioBwF0RnOsIpFTZIIovYJZ7MJtMazCsKpTelQWk3aY0SwCkqSCFUaOahjyMWWYSOmgIYZw62eDZl/X5j0h5L27LNjFnjA/EnM7EYiiu1ScXhXnD7MUpMk4s5WOeYr+XV9byAbjf85DiLAhlwJob21Ny7OWpf1WFmZpDjIR0a6Y0MYr/r9NZoFOFW7q2eDYcaIa4muAT68n2uZnKbkJr4BPJfuPetRYADrg0NC0deAiiuQKK1TvzPGx/fw6VA6EaiscPkrBjcqqB/eA9qU+BRjgm/+8LQV12Aimb8sM4dj+piog1EHMsGhROMKcyg4bcaB0esFkWWu9Quxc5P4DO9o9Era6/cJMsvzuzOzOdhzzQlcNebTwpYHhdavjb1G6ZFCenKV1eO+p116P5WPQ9eSU7SjFIMyc4DqKgilrZ0IQNj2ZPP/0FFfF/NsQxFYD0GlDpbBWWSbH2nqEbes3iuBWsHqKbqOeRBiVPeTwd9Vda5PbB8hyIUCY0RJ8OLIRmdSAus3kFjTYLCS789T2fOV1Dic7LaXrkGfC X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.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:55:44.4064 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 873c73e7-9767-4444-cb7b-08dc3cfa6cd9 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000042A9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7519 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 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=f876981e54a106d1212164d8f93eb895fb184ce3 Thanks. Xueming Li --- >From f876981e54a106d1212164d8f93eb895fb184ce3 Mon Sep 17 00:00:00 2001 From: Dengdui Huang Date: Fri, 8 Dec 2023 14:55:06 +0800 Subject: [PATCH] net/hns3: refactor PF mailbox message struct Cc: Xueming Li [ upstream commit 4d534598d922130d12c244d3237652fbfdad0f4b ] The data region in PF to VF mbx memssage command is used to communicate with VF driver. And this data region exists as an array. As a result, some complicated feature commands, like mailbox response, link change event, close promisc mode, reset request and update pvid state, have to use magic number to set them. This isn't good for maintenance of driver. So this patch refactors these messages by extracting an hns3_pf_to_vf_msg structure. Fixes: 463e748964f5 ("net/hns3: support mailbox") Signed-off-by: Dengdui Huang Signed-off-by: Jie Hai --- drivers/net/hns3/hns3_mbx.c | 38 ++++++++++++++++++------------------- drivers/net/hns3/hns3_mbx.h | 25 +++++++++++++++++++++++- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c index ad5ec555b3..c90f5d59ba 100644 --- a/drivers/net/hns3/hns3_mbx.c +++ b/drivers/net/hns3/hns3_mbx.c @@ -192,17 +192,17 @@ static void hns3vf_handle_link_change_event(struct hns3_hw *hw, struct hns3_mbx_pf_to_vf_cmd *req) { + struct hns3_mbx_link_status *link_info = + (struct hns3_mbx_link_status *)req->msg.msg_data; uint8_t link_status, link_duplex; - uint16_t *msg_q = req->msg; uint8_t support_push_lsc; uint32_t link_speed; - memcpy(&link_speed, &msg_q[2], sizeof(link_speed)); - link_status = rte_le_to_cpu_16(msg_q[1]); - link_duplex = (uint8_t)rte_le_to_cpu_16(msg_q[4]); - hns3vf_update_link_status(hw, link_status, link_speed, - link_duplex); - support_push_lsc = (*(uint8_t *)&msg_q[5]) & 1u; + link_status = (uint8_t)rte_le_to_cpu_16(link_info->link_status); + link_speed = rte_le_to_cpu_32(link_info->speed); + link_duplex = (uint8_t)rte_le_to_cpu_16(link_info->duplex); + hns3vf_update_link_status(hw, link_status, link_speed, link_duplex); + support_push_lsc = (link_info->flag) & 1u; hns3vf_update_push_lsc_cap(hw, support_push_lsc); } @@ -211,7 +211,6 @@ hns3_handle_asserting_reset(struct hns3_hw *hw, struct hns3_mbx_pf_to_vf_cmd *req) { enum hns3_reset_level reset_level; - uint16_t *msg_q = req->msg; /* * PF has asserted reset hence VF should go in pending @@ -219,7 +218,7 @@ hns3_handle_asserting_reset(struct hns3_hw *hw, * has been completely reset. After this stack should * eventually be re-initialized. */ - reset_level = rte_le_to_cpu_16(msg_q[1]); + reset_level = rte_le_to_cpu_16(req->msg.reset_level); hns3_atomic_set_bit(reset_level, &hw->reset.pending); hns3_warn(hw, "PF inform reset level %d", reset_level); @@ -241,8 +240,9 @@ hns3_handle_mbx_response(struct hns3_hw *hw, struct hns3_mbx_pf_to_vf_cmd *req) * to match the request. */ if (req->match_id == resp->match_id) { - resp->resp_status = hns3_resp_to_errno(req->msg[3]); - memcpy(resp->additional_info, &req->msg[4], + resp->resp_status = + hns3_resp_to_errno(req->msg.resp_status); + memcpy(resp->additional_info, &req->msg.resp_data, HNS3_MBX_MAX_RESP_DATA_SIZE); rte_io_wmb(); resp->received_match_resp = true; @@ -255,7 +255,8 @@ hns3_handle_mbx_response(struct hns3_hw *hw, struct hns3_mbx_pf_to_vf_cmd *req) * support copy request's match_id to its response. So VF follows the * original scheme to process. */ - msg_data = (uint32_t)req->msg[1] << HNS3_MBX_RESP_CODE_OFFSET | req->msg[2]; + msg_data = (uint32_t)req->msg.vf_mbx_msg_code << + HNS3_MBX_RESP_CODE_OFFSET | req->msg.vf_mbx_msg_subcode; if (resp->req_msg_data != msg_data) { hns3_warn(hw, "received response tag (%u) is mismatched with requested tag (%u)", @@ -263,8 +264,8 @@ hns3_handle_mbx_response(struct hns3_hw *hw, struct hns3_mbx_pf_to_vf_cmd *req) return; } - resp->resp_status = hns3_resp_to_errno(req->msg[3]); - memcpy(resp->additional_info, &req->msg[4], + resp->resp_status = hns3_resp_to_errno(req->msg.resp_status); + memcpy(resp->additional_info, &req->msg.resp_data, HNS3_MBX_MAX_RESP_DATA_SIZE); rte_io_wmb(); resp->received_match_resp = true; @@ -305,8 +306,7 @@ static void hns3_update_port_base_vlan_info(struct hns3_hw *hw, struct hns3_mbx_pf_to_vf_cmd *req) { -#define PVID_STATE_OFFSET 1 - uint16_t new_pvid_state = req->msg[PVID_STATE_OFFSET] ? + uint16_t new_pvid_state = req->msg.pvid_state ? HNS3_PORT_BASE_VLAN_ENABLE : HNS3_PORT_BASE_VLAN_DISABLE; /* * Currently, hardware doesn't support more than two layers VLAN offload @@ -355,7 +355,7 @@ hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw) while (next_to_use != tail) { desc = &crq->desc[next_to_use]; req = (struct hns3_mbx_pf_to_vf_cmd *)desc->data; - opcode = req->msg[0] & 0xff; + opcode = req->msg.code & 0xff; flag = rte_le_to_cpu_16(crq->desc[next_to_use].flag); if (!hns3_get_bit(flag, HNS3_CMDQ_RX_OUTVLD_B)) @@ -428,7 +428,7 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) desc = &crq->desc[crq->next_to_use]; req = (struct hns3_mbx_pf_to_vf_cmd *)desc->data; - opcode = req->msg[0] & 0xff; + opcode = req->msg.code & 0xff; flag = rte_le_to_cpu_16(crq->desc[crq->next_to_use].flag); if (unlikely(!hns3_get_bit(flag, HNS3_CMDQ_RX_OUTVLD_B))) { @@ -484,7 +484,7 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) * hns3 PF kernel driver, VF driver will receive this * mailbox message from PF driver. */ - hns3_handle_promisc_info(hw, req->msg[1]); + hns3_handle_promisc_info(hw, req->msg.promisc_en); break; default: hns3_err(hw, "received unsupported(%u) mbx msg", diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h index 59fb73abcc..09780fcebd 100644 --- a/drivers/net/hns3/hns3_mbx.h +++ b/drivers/net/hns3/hns3_mbx.h @@ -118,6 +118,13 @@ struct hns3_mbx_vlan_filter { uint16_t proto; } __rte_packed; +struct hns3_mbx_link_status { + uint16_t link_status; + uint32_t speed; + uint16_t duplex; + uint8_t flag; +} __rte_packed; + #define HNS3_MBX_MSG_MAX_DATA_SIZE 14 #define HNS3_MBX_MAX_RING_CHAIN_PARAM_NUM 4 struct hns3_vf_to_pf_msg { @@ -146,6 +153,22 @@ struct hns3_vf_to_pf_msg { }; }; +struct hns3_pf_to_vf_msg { + uint16_t code; + union { + struct { + uint16_t vf_mbx_msg_code; + uint16_t vf_mbx_msg_subcode; + uint16_t resp_status; + uint8_t resp_data[HNS3_MBX_MAX_RESP_DATA_SIZE]; + }; + uint16_t promisc_en; + uint16_t reset_level; + uint16_t pvid_state; + uint8_t msg_data[HNS3_MBX_MSG_MAX_DATA_SIZE]; + }; +}; + struct errno_respcode_map { uint16_t resp_code; int err_no; @@ -170,7 +193,7 @@ struct hns3_mbx_pf_to_vf_cmd { uint8_t msg_len; uint8_t rsv1; uint16_t match_id; - uint16_t msg[8]; + struct hns3_pf_to_vf_msg msg; }; struct hns3_pf_rst_done_cmd { -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-05 17:39:33.514800484 +0800 +++ 0083-net-hns3-refactor-PF-mailbox-message-struct.patch 2024-03-05 17:39:30.833566495 +0800 @@ -1 +1 @@ -From 4d534598d922130d12c244d3237652fbfdad0f4b Mon Sep 17 00:00:00 2001 +From f876981e54a106d1212164d8f93eb895fb184ce3 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 4d534598d922130d12c244d3237652fbfdad0f4b ] @@ -16 +18,0 @@ -Cc: stable@dpdk.org