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 9C3524611C; Fri, 24 Jan 2025 11:00:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 50B29410F6; Fri, 24 Jan 2025 11:00:03 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id A5C39410E7 for ; Fri, 24 Jan 2025 11:00:01 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4YfYB710S3zcb0M; Fri, 24 Jan 2025 17:56:47 +0800 (CST) Received: from kwepemo500011.china.huawei.com (unknown [7.202.195.194]) by mail.maildlp.com (Postfix) with ESMTPS id 5D48C1401E9; Fri, 24 Jan 2025 17:59:59 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by kwepemo500011.china.huawei.com (7.202.195.194) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 24 Jan 2025 17:59:58 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH] mbuf: add packet offload Rx flag for keep CRC Date: Fri, 24 Jan 2025 17:59:57 +0800 Message-ID: <20250124095957.3496874-1-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemo500011.china.huawei.com (7.202.195.194) 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 After discussion[1], the drivers do not include the CRC in the packet length calculation. This will cause users to be confused about whether the mbuf contains CRC data. This patch adds a packet offload Rx flag, indicating that CRC data exists at the end of the mbuf chain. [1] https://inbox.dpdk.org/dev/20240206011030.2007689-1-haijie1@huawei.com/ Signed-off-by: Dengdui Huang --- lib/mbuf/rte_mbuf.c | 3 ++- lib/mbuf/rte_mbuf_core.h | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/mbuf/rte_mbuf.c b/lib/mbuf/rte_mbuf.c index 559d5ad8a7..c828200ea1 100644 --- a/lib/mbuf/rte_mbuf.c +++ b/lib/mbuf/rte_mbuf.c @@ -771,7 +771,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) case RTE_MBUF_F_RX_OUTER_L4_CKSUM_GOOD: return "RTE_MBUF_F_RX_OUTER_L4_CKSUM_GOOD"; case RTE_MBUF_F_RX_OUTER_L4_CKSUM_INVALID: return "RTE_MBUF_F_RX_OUTER_L4_CKSUM_INVALID"; - + case RTE_MBUF_F_RX_KEEP_CRC: return "RTE_MBUF_F_RX_KEEP_CRC"; default: return NULL; } } @@ -818,6 +818,7 @@ rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen) NULL }, { RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN, RTE_MBUF_F_RX_OUTER_L4_CKSUM_MASK, "RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN" }, + { RTE_MBUF_F_RX_KEEP_CRC, RTE_MBUF_F_RX_KEEP_CRC, NULL }, }; const char *name; unsigned int i; diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h index a0df265b5d..0c57b929b7 100644 --- a/lib/mbuf/rte_mbuf_core.h +++ b/lib/mbuf/rte_mbuf_core.h @@ -180,9 +180,15 @@ extern "C" { #define RTE_MBUF_F_RX_OUTER_L4_CKSUM_GOOD (1ULL << 22) #define RTE_MBUF_F_RX_OUTER_L4_CKSUM_INVALID ((1ULL << 21) | (1ULL << 22)) +/** + * Indicates that there is CRC data at the end of the mbuf chain. + * Note: pkt_len and date_len fields are not adjusted for CRC data. + */ +#define RTE_MBUF_F_RX_KEEP_CRC (1ULL << 23) + /* add new RX flags here, don't forget to update RTE_MBUF_F_FIRST_FREE */ -#define RTE_MBUF_F_FIRST_FREE (1ULL << 23) +#define RTE_MBUF_F_FIRST_FREE (1ULL << 24) #define RTE_MBUF_F_LAST_FREE (1ULL << 40) /* add new TX flags here, don't forget to update RTE_MBUF_F_LAST_FREE */ -- 2.33.0