DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dengdui Huang <huangdengdui@huawei.com>
To: <dev@dpdk.org>
Cc: <stephen@networkplumber.org>, <lihuisong@huawei.com>,
	<fengchengwen@huawei.com>, <haijie1@huawei.com>,
	<liuyonglong@huawei.com>
Subject: [PATCH] mbuf: add packet offload Rx flag for keep CRC
Date: Fri, 24 Jan 2025 17:59:57 +0800	[thread overview]
Message-ID: <20250124095957.3496874-1-huangdengdui@huawei.com> (raw)

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 <huangdengdui@huawei.com>
---
 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


             reply	other threads:[~2025-01-24 10:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-24  9:59 Dengdui Huang [this message]
2025-01-24 14:34 ` Morten Brørup
2025-01-24 17:34 ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250124095957.3496874-1-huangdengdui@huawei.com \
    --to=huangdengdui@huawei.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=haijie1@huawei.com \
    --cc=lihuisong@huawei.com \
    --cc=liuyonglong@huawei.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).