[1/5] net: add PDCP header
Checks
Commit Message
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
Comments
22/12/2022 10:25, Anoob Joseph:
> --- /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_
No need of extra underscores before and after.
Sorry I cannot review the rest of this, it is out of my knowledge :)
Hi Thomas,
Please see inline.
Thanks,
Anoob
> Subject: [EXT] Re: [PATCH 1/5] net: add PDCP header
>
> External Email
>
> ----------------------------------------------------------------------
> 22/12/2022 10:25, Anoob Joseph:
> > --- /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_
>
> No need of extra underscores before and after.
[Anoob] I was following the example quoted in https://doc.dpdk.org/guides/contributing/coding_style.html. Also, other files such as rte_esp.h, rte_udp.h, etc. follow the same.
Isn't it better to have a uniform coding style?
18/01/2023 18:39, Anoob Joseph:
> > 22/12/2022 10:25, Anoob Joseph:
> > > --- /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_
> >
> > No need of extra underscores before and after.
>
> [Anoob] I was following the example quoted in https://doc.dpdk.org/guides/contributing/coding_style.html.
Oh thanks for the reference, I will fix it.
> Also, other files such as rte_esp.h, rte_udp.h, etc. follow the same.
Some other files don't have underscores.
> Isn't it better to have a uniform coding style?
No really I prefer no underscores,
they are supposed to be used for standard libraries.
Hi Thomas,
Please see inline.
Thanks,
Anoob
> Subject: Re: [EXT] Re: [PATCH 1/5] net: add PDCP header
>
> 18/01/2023 18:39, Anoob Joseph:
> > > 22/12/2022 10:25, Anoob Joseph:
> > > > --- /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_
> > >
> > > No need of extra underscores before and after.
> >
> > [Anoob] I was following the example quoted in
> https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__doc.dpdk.org_guides_contributing_coding-
> 5Fstyle.html&d=DwICAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=jPfB8rwwviRSxyL
> Ws2n6B-WYLn1v9SyTMrT5EQqh2TU&m=Btr0wWqHo_dHGchyRWTnjO6xY-
> 7p33pUSKSBLIXtL4DOAv-GsZmL2lZ2OHyJWoiZ&s=-
> AQhSWF0bWFXTyxL0rPCW6fz6I7GYhwyQ9qjYG3FFn0&e= .
>
> Oh thanks for the reference, I will fix it.
>
> > Also, other files such as rte_esp.h, rte_udp.h, etc. follow the same.
>
> Some other files don't have underscores.
>
> > Isn't it better to have a uniform coding style?
>
> No really I prefer no underscores,
> they are supposed to be used for standard libraries.
[Anoob] I see that most of the files do have underscores. While I do not have any personal preference, I would really prefer new code to not stand out from the rest. If you have considered this already, then I'll make the change in next version. Please confirm.
23/01/2023 10:21, Anoob Joseph:
> Hi Thomas,
>
> Please see inline.
>
> Thanks,
> Anoob
>
> > Subject: Re: [EXT] Re: [PATCH 1/5] net: add PDCP header
> >
> > 18/01/2023 18:39, Anoob Joseph:
> > > > 22/12/2022 10:25, Anoob Joseph:
> > > > > --- /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_
> > > >
> > > > No need of extra underscores before and after.
> > >
> > > [Anoob] I was following the example quoted in
> > https://urldefense.proofpoint.com/v2/url?u=https-
> > 3A__doc.dpdk.org_guides_contributing_coding-
> > 5Fstyle.html&d=DwICAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=jPfB8rwwviRSxyL
> > Ws2n6B-WYLn1v9SyTMrT5EQqh2TU&m=Btr0wWqHo_dHGchyRWTnjO6xY-
> > 7p33pUSKSBLIXtL4DOAv-GsZmL2lZ2OHyJWoiZ&s=-
> > AQhSWF0bWFXTyxL0rPCW6fz6I7GYhwyQ9qjYG3FFn0&e= .
> >
> > Oh thanks for the reference, I will fix it.
> >
> > > Also, other files such as rte_esp.h, rte_udp.h, etc. follow the same.
> >
> > Some other files don't have underscores.
> >
> > > Isn't it better to have a uniform coding style?
> >
> > No really I prefer no underscores,
> > they are supposed to be used for standard libraries.
>
> [Anoob] I see that most of the files do have underscores. While I do not have any personal preference, I would really prefer new code to not stand out from the rest. If you have considered this already, then I'll make the change in next version. Please confirm.
I prefer no underscore, and I will probably propose to change all files
while updating the contributing guide.
For new patch, I gave my opinion, now you can choose it is not a big deal.
@@ -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),
@@ -22,6 +22,7 @@ headers = files(
'rte_geneve.h',
'rte_l2tpv2.h',
'rte_ppp.h',
+ 'rte_pdcp_hdr.h',
)
sources = files(
new file mode 100644
@@ -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_ */