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 E056643B80; Tue, 5 Mar 2024 03:30:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 141C6410E7; Tue, 5 Mar 2024 03:29:57 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2132.outbound.protection.outlook.com [40.107.212.132]) by mails.dpdk.org (Postfix) with ESMTP id 5AA15410E8 for ; Tue, 5 Mar 2024 03:29:55 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hXNcEs8I8GcVatzAaaCJhHVvlw/JMggr9oCmgF+/XyPHqeUXLL7/1eu3kdNo3F9rh9qnISFRst8yJ35QNtOcND56dHB8LnV3PMNA/ubiOB4a7GK7JsrRk7xv4BePdY99TIubHrYB0NHNaJNSYqpRS+ClM7RjJbmxQ1Sitct/uD7+C2JLm+NYrqfaXbbdBTF5upOsKICWMP9TWLr3yJuoUTz5IzmGCfquf6p9dU2HqCLJBshMccafGI4eWw9FKHIfEthI9Zb1arNSIYIGII3huc5rJCQGandchr0Of9RO4n9qTUS3+IamqZ8GMktyMSGxS7csnFUM9yLX1JKiYFOdgQ== 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=ND9/gJ4ecdeLd2q0AeUvLFJCkG98Vt0QyJqYU3Wjrm4=; b=MamOXv1fXpbtI+UvdJGftGgXIzFcKOudxuYAn1c7KufrHH8jcnwgre8yKpA/p6v7v+qsW0UKcbpEfgY/nHn/3M6wMySCPbUdythPF41sPFA1BqQY0rF2hkllOXAlyjBqZQ1HBuZUg5td4dshjkkltvCO4Yp9LFhJT40cNBfAQyGNZv7tu61WfdNAWxPGgl59n+hkCjOyQol1sm6gk1M6RRXPLZYj3q8s4fSYp9R7GK3dKUhLfZ0bIWWwLhaOhNVN96q1TkEsD0G1DsZwox9smzLBBi941qHxl4Ob/AOp97506JMpiPcHWtKYg93BSTbPXCmLcubNeCU5WMhb9kL1xg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ND9/gJ4ecdeLd2q0AeUvLFJCkG98Vt0QyJqYU3Wjrm4=; b=cJl+PKbwfFxKCL8UTczlhm1/2MadV2E/d0hk83KPE/PhuvkMOsXtphkhlfeLT/Rpik/nKkZ1yPJ4dyi2+BIASWYFZJwwdaz9bJEqDE1bIOM0cPrFLWPKbskMsC9Bx/dYSpHClaEiektuz4EAzrenU1oPVQjaMpL9gIlQ9ved4IA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by DS7PR13MB4768.namprd13.prod.outlook.com (2603:10b6:5:3a6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Tue, 5 Mar 2024 02:29:52 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e%5]) with mapi id 15.20.7339.035; Tue, 5 Mar 2024 02:29:52 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He Subject: [PATCH 5/5] net/nfp: use big-endian meta data for packet Date: Tue, 5 Mar 2024 10:29:23 +0800 Message-Id: <20240305022923.891544-6-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240305022923.891544-1-chaoyong.he@corigine.com> References: <20240305022923.891544-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BY5PR04CA0028.namprd04.prod.outlook.com (2603:10b6:a03:1d0::38) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DS7PR13MB4768:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b0ce773-ca41-4c79-7779-08dc3cbc2260 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jVSUUBNySLCrqZh34p8oo10xPGR+WxCo/cl2kta66QFn1FqXsGrL35mqhO8T8Ys7tmpUTGNjBZTzeXt2+Qfdx4yGpeEEKan/Cg1Bm/PSdteaEg+tYpglvAeXVmbqKWzdFz/JOAmVufgj99Nwb08B+T5y/pHtsNlb4cQJwsJ/xsJ07CnD/jR01Vq7TfBrYraDaeI+CGPb1QrKlPf9Q96YixNZSIlK3UyI8daY3THQ6LQipQHzMyydGTAQcjgP7j+le9h4LaQ8/k3dn189zsK7rI7S7HfrXJft5HJVguCaIqWLKgywSRrNeX/Es/IyeJHeY7/tacHItJSSKTLV2OZ9zcIuMifKytd510UcIBRQ5kBWeiT2BcsFhmnI/D0wDsMTmjAOG4FbyBBeYthwvy+nfhMhA+Sq7Sit7pUxpN4asoXqifeZq4+jIt8gR6K1WX/BKfOIExjZIGrzuXDBJU9UmsOu/6wy6Ha7hOJ9QlCLx0NsCEKwnPsYW6lnQoDxuowCjIdLggAbOS5JDulFf54pm36p6hrHqLJKu9yHkY+sEWRgvl8HGJWvmvxd3iYZq0zglg/u1s0WFHRhpSGlGQN0UHQCF0AH7qmIRnCLe1s7u09avoBUfvOkfxLIVyySlNZxgzRTxh6xkZ+kOS12aeJjUDyUIoMWOGVZGkJjThENULaS21s84EIneCOR4Yt2atzndsVeSXkm5SD4HA/Yp7w22OrZCMVRBbvqysfTUhLMfcg= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?XA1BwcO1J91AaaZbMZNrfSwLyvW9DT8AiB/0B771mt2NATBKKWF7PEjQzGqO?= =?us-ascii?Q?0prZN6997trE62vr8Ym5oNSRZJcq6lE1NFjpEuP3jptR/5wQPQZPEH2jalE/?= =?us-ascii?Q?mzbFP19ippqNRKNMllo3QZ4DDgtZpjQTxHgtXjRneWaBN/lXI5HnCs2xcTfp?= =?us-ascii?Q?FPXBVJrf7YqDGmag6AMNtaHAEGMH9WV1lTEACHvvoMmV5/VuTiRbzy3GujrO?= =?us-ascii?Q?Yl03HuMxbuzgr/tzcp0wSNVW0ux/wW67ESwToMEjRmV+ap3V5Kq6aR729fGV?= =?us-ascii?Q?ZSTOq0ZMSHH0pui+GVHlu0Li3rHKpKDcWfCOCEhUd8H1uXILrJKoRh3gDmJB?= =?us-ascii?Q?RqKSmgUaYynnM1InBvzJUm7OQ//bgGqSi+CvcCahNo04zn2/EuxZSx2pfwTm?= =?us-ascii?Q?irkdps1hkEaYajX9K4aiXmLyCfqUHRl5HkpsxOoqAiXMcgOxAgZQDI1n2q+o?= =?us-ascii?Q?lLkgeeoMu0zaJfRvXq8Up07MEUGtEg6TKE4JHxInGYQ1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AV7WLgYf9YnWe/3P2JGENShkNgjDWUNkjsJ3H0?= =?us-ascii?Q?w6QyKwjJR7qdZlglS8tNHgoYmUV37Hw6P/ERHKvATv4CPVPM6dtSM3Axr7vW?= =?us-ascii?Q?qb9q9KU6KKkhEh2MwlQMgaF4Xys9i5fyfGkvJ7ep/VXe1OzVTfHfx1QCjkV0?= =?us-ascii?Q?bkSGXexRNkY6XKnU9yjyPb706IyA29xk4Jg+vEICqQahQq5j3t/cqsqpf7We?= =?us-ascii?Q?yA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b0ce773-ca41-4c79-7779-08dc3cbc2260 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 02:29:51.1044 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AJjFDqhBN07IwZ/M8b/j6o8oTSS06JT+q5bHhxeml6t+HkFh7Tp3MIp1NiBqxmL5/w3pnxTQMYMC6POvJV0DRNszOWGVBbhLsCc/zgLf3WU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR13MB4768 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Long Wu Make sure all kinds of meta data are CPU-endian in process logic and transform them to big-endian when prepend into packet. Signed-off-by: Long Wu Reviewed-by: Chaoyong He --- drivers/net/nfp/nfd3/nfp_nfd3_dp.c | 5 ++--- drivers/net/nfp/nfdk/nfp_nfdk_dp.c | 5 ++--- drivers/net/nfp/nfp_net_meta.c | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c index 7e281ae498..253872f4a1 100644 --- a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c +++ b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c @@ -181,9 +181,8 @@ nfp_net_nfd3_set_meta_data(struct nfp_net_meta_raw *meta_data, return 0; meta_info = meta_data->header; - meta_data->header = rte_cpu_to_be_32(meta_data->header); meta = rte_pktmbuf_prepend(pkt, meta_data->length); - memcpy(meta, &meta_data->header, sizeof(meta_data->header)); + *(rte_be32_t *)meta = rte_cpu_to_be_32(meta_data->header); meta += NFP_NET_META_HEADER_SIZE; for (; meta_info != 0; meta_info >>= NFP_NET_META_FIELD_SIZE, layer++, @@ -211,7 +210,7 @@ nfp_net_nfd3_set_meta_data(struct nfp_net_meta_raw *meta_data, return -ENOTSUP; } - memcpy(meta, &meta_data->data[layer], sizeof(meta_data->data[layer])); + *(rte_be32_t *)meta = rte_cpu_to_be_32(meta_data->data[layer]); } return 0; diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c index b8592b1767..1911736e2b 100644 --- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c +++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c @@ -215,9 +215,8 @@ nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt, meta_type = meta_data.header; header_offset = meta_type << NFP_NET_META_NFDK_LENGTH; meta_data.header = header_offset | meta_data.length; - meta_data.header = rte_cpu_to_be_32(meta_data.header); meta = rte_pktmbuf_prepend(pkt, meta_data.length); - memcpy(meta, &meta_data.header, sizeof(meta_data.header)); + *(rte_be32_t *)meta = rte_cpu_to_be_32(meta_data.header); meta += NFP_NET_META_HEADER_SIZE; for (; meta_type != 0; meta_type >>= NFP_NET_META_FIELD_SIZE, layer++, @@ -245,7 +244,7 @@ nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt, return -ENOTSUP; } - memcpy(meta, &meta_data.data[layer], sizeof(meta_data.data[layer])); + *(rte_be32_t *)meta = rte_cpu_to_be_32(meta_data.data[layer]); } *metadata = NFDK_DESC_TX_CHAIN_META; diff --git a/drivers/net/nfp/nfp_net_meta.c b/drivers/net/nfp/nfp_net_meta.c index b39c55a868..fa7e0d3d00 100644 --- a/drivers/net/nfp/nfp_net_meta.c +++ b/drivers/net/nfp/nfp_net_meta.c @@ -300,7 +300,7 @@ nfp_net_meta_set_vlan(struct nfp_net_meta_raw *meta_data, tpid = RTE_ETHER_TYPE_VLAN; vlan_tci = pkt->vlan_tci; - meta_data->data[layer] = rte_cpu_to_be_32(tpid << 16 | vlan_tci); + meta_data->data[layer] = tpid << 16 | vlan_tci; } void -- 2.39.1