From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id EC204A034C;
	Thu, 22 Dec 2022 10:25:35 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id CDDD140698;
	Thu, 22 Dec 2022 10:25:35 +0100 (CET)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com
 [67.231.156.173])
 by mails.dpdk.org (Postfix) with ESMTP id 23CCE400D7
 for <dev@dpdk.org>; Thu, 22 Dec 2022 10:25:34 +0100 (CET)
Received: from pps.filterd (m0045851.ppops.net [127.0.0.1])
 by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 2BM9MmSk003965; Thu, 22 Dec 2022 01:25:32 -0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=7UN7hyZbpClUaMs2DD4h49eA1uaQH+YgQw8x3NDf/jo=;
 b=dL/47QEvC3l9fXQ30+6C7iT0bnjUQMxrkItLN2hj8DyFalaGOD6KHfg+OVEdWMNzMbd+
 /x5Y31js6fqDi4P77Bsj4aiJovp492gAHyblq46/Yeb1RwctHeXzKXLTzEEU5wZwWHA+
 7snR5XI2qlaEFp/vuQ0xWCVCu9JCRjaOpnjZPXRPYRnCNEnuVouhtDO5ybBH7HHfPR+K
 IaZ2uYF0ugNppk1slurXXrgRkBt/ELTeOt6inAz0qSvecfh0DPCEPt3kvBOI/KIOVTGV
 idx2cqNo7v4jVrQVpDZFESAnTkLplHlsKRSCW+7tGBy4VaxjNigaB0ZiUu4elfzRHb9f Jg== 
Received: from dc5-exch01.marvell.com ([199.233.59.181])
 by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3mhe5rstv1-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Thu, 22 Dec 2022 01:25:32 -0800
Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42;
 Thu, 22 Dec 2022 01:25:30 -0800
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend
 Transport; Thu, 22 Dec 2022 01:25:30 -0800
Received: from BG-LT92004.corp.innovium.com (unknown [10.193.66.59])
 by maili.marvell.com (Postfix) with ESMTP id D5D2F3F706C;
 Thu, 22 Dec 2022 01:25:26 -0800 (PST)
From: Anoob Joseph <anoobj@marvell.com>
To: Thomas Monjalon <thomas@monjalon.net>, Akhil Goyal <gakhil@marvell.com>,
 Jerin Jacob <jerinj@marvell.com>, Konstantin Ananyev
 <konstantin.v.ananyev@yandex.ru>, Bernard Iremonger
 <bernard.iremonger@intel.com>, Olivier Matz <olivier.matz@6wind.com>
CC: Volodymyr Fialko <vfialko@marvell.com>, Hemant Agrawal
 <hemant.agrawal@nxp.com>, =?UTF-8?q?Mattias=20R=C3=B6nnblom?=
 <mattias.ronnblom@ericsson.com>,
 Kiran Kumar K <kirankumark@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 1/5] net: add PDCP header
Date: Thu, 22 Dec 2022 14:55:18 +0530
Message-ID: <20221222092522.1628-2-anoobj@marvell.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20221222092522.1628-1-anoobj@marvell.com>
References: <20221027052140.155-1-anoobj@marvell.com>
 <20221222092522.1628-1-anoobj@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-GUID: dVSEOiPw7yHJECq5Ysl9RRcX6C9_wSRE
X-Proofpoint-ORIG-GUID: dVSEOiPw7yHJECq5Ysl9RRcX6C9_wSRE
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1
 definitions=2022-12-22_04,2022-12-21_01,2022-06-22_01
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Volodymyr Fialko <vfialko@marvell.com>

Added PDCP protocol header to be used for supporting PDCP protocol
processing.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
 doc/api/doxy-api-index.md |  3 +-
 lib/net/meson.build       |  1 +
 lib/net/rte_pdcp_hdr.h    | 93 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+), 1 deletion(-)
 create mode 100644 lib/net/rte_pdcp_hdr.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index de488c7abf..ae4b107240 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -125,7 +125,8 @@ The public API headers are grouped by topics:
   [Geneve](@ref rte_geneve.h),
   [eCPRI](@ref rte_ecpri.h),
   [L2TPv2](@ref rte_l2tpv2.h),
-  [PPP](@ref rte_ppp.h)
+  [PPP](@ref rte_ppp.h),
+  [PDCP hdr](@ref rte_pdcp_hdr.h)
 
 - **QoS**:
   [metering](@ref rte_meter.h),
diff --git a/lib/net/meson.build b/lib/net/meson.build
index 379d161ee0..bd56f91c22 100644
--- a/lib/net/meson.build
+++ b/lib/net/meson.build
@@ -22,6 +22,7 @@ headers = files(
         'rte_geneve.h',
         'rte_l2tpv2.h',
         'rte_ppp.h',
+        'rte_pdcp_hdr.h',
 )
 
 sources = files(
diff --git a/lib/net/rte_pdcp_hdr.h b/lib/net/rte_pdcp_hdr.h
new file mode 100644
index 0000000000..f9b8258949
--- /dev/null
+++ b/lib/net/rte_pdcp_hdr.h
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2022 Marvell.
+ */
+
+#ifndef _RTE_PDCP_HDR_H_
+#define _RTE_PDCP_HDR_H_
+
+/**
+ * @file
+ *
+ * PDCP-related defines
+ *
+ * Based on - ETSI TS 138 323 V17.1.0 (2022-08)
+ * https://www.etsi.org/deliver/etsi_ts/138300_138399/138323/17.01.00_60/ts_138323v170100p.pdf
+ */
+
+#include <rte_byteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * 6.2.2.1 Data PDU for SRBs
+ */
+__extension__
+struct rte_pdcp_cp_data_pdu_sn_12_hdr {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
+	uint8_t r : 4;		/**< Reserved */
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint8_t r : 4;		/**< Reserved */
+	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
+#endif
+	uint8_t sn_7_0;		/**< Sequence number bits 0-7 */
+};
+
+/**
+ * 6.2.2.2 Data PDU for DRBs and MRBs with 12 bits PDCP SN
+ */
+__extension__
+struct rte_pdcp_up_data_pdu_sn_12_hdr {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
+	uint8_t r : 3;		/**< Reserved */
+	uint8_t d_c : 1;	/**< D/C bit */
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint8_t d_c : 1;	/**< D/C bit */
+	uint8_t r : 3;		/**< Reserved */
+	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
+#endif
+	uint8_t sn_7_0;		/**< Sequence number bits 0-7 */
+};
+
+/**
+ * 6.2.2.3 Data PDU for DRBs and MRBs with 18 bits PDCP SN
+ */
+__extension__
+struct rte_pdcp_up_data_pdu_sn_18_hdr {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint8_t sn_17_16 : 2;	/**< Sequence number bits 16-17 */
+	uint8_t r : 5;		/**< Reserved */
+	uint8_t d_c : 1;	/**< D/C bit */
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint8_t d_c : 1;	/**< D/C bit */
+	uint8_t r : 5;		/**< Reserved */
+	uint8_t sn_17_16 : 2;	/**< Sequence number bits 16-17 */
+#endif
+	uint8_t sn_15_8;	/**< Sequence number bits 8-15 */
+	uint8_t sn_7_0;		/**< Sequence number bits 0-7 */
+};
+
+/**
+ * 6.2.3.1 Control PDU for PDCP status report
+ */
+__extension__
+struct rte_pdcp_up_ctrl_pdu_hdr {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint8_t r : 4;		/**< Reserved */
+	uint8_t pdu_type : 3;	/**< Control PDU type */
+	uint8_t d_c : 1;	/**< D/C bit */
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint8_t d_c : 1;	/**< D/C bit */
+	uint8_t pdu_type : 3;	/**< Control PDU type */
+	uint8_t r : 4;		/**< Reserved */
+#endif
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PDCP_HDR_H_ */
-- 
2.25.1