DPDK  24.03.0
rte_pdcp_group.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2023 Marvell.
3  */
4 
5 #ifndef RTE_PDCP_GROUP_H
6 #define RTE_PDCP_GROUP_H
7 
18 #include <rte_common.h>
19 #include <rte_crypto.h>
20 #include <rte_cryptodev.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
30  union {
31  uint64_t val;
32  void *ptr;
33  } id;
34  struct rte_mbuf **m;
35  uint32_t cnt;
36  int32_t rc;
37 };
38 
49 static inline struct rte_pdcp_entity *
51 {
52  void *sess = cop->sym[0].session;
53 
54  return (struct rte_pdcp_entity *)(uintptr_t)
56 }
57 
82 static inline uint16_t
83 rte_pdcp_pkt_crypto_group(struct rte_crypto_op *cop[], struct rte_mbuf *mb[],
84  struct rte_pdcp_group grp[], uint16_t num)
85 {
86  uint32_t i, j = 0, n = 0;
87  void *ns, *ps = NULL;
88  struct rte_mbuf *m;
89 
90  for (i = 0; i != num; i++) {
91  m = cop[i]->sym[0].m_src;
92  ns = cop[i]->sym[0].session;
93 
95  if (cop[i]->status != RTE_CRYPTO_OP_STATUS_SUCCESS)
97 
98  /* Different entity */
99  if (ps != ns) {
100 
101  /* Finalize open group and start a new one */
102  if (ps != NULL) {
103  grp[n].cnt = mb + j - grp[n].m;
104  n++;
105  }
106 
107  /* Start new group */
108  grp[n].m = mb + j;
109  ps = ns;
110  grp[n].id.ptr = rte_pdcp_en_from_cop(cop[i]);
111  }
112 
113  mb[j++] = m;
114  rte_crypto_op_free(cop[i]);
115  }
116 
117  /* Finalize last group */
118  if (ps != NULL) {
119  grp[n].cnt = mb + j - grp[n].m;
120  n++;
121  }
122 
123  return n;
124 }
125 
126 #ifdef __cplusplus
127 }
128 #endif
129 
130 #endif /* RTE_PDCP_GROUP_H */
union rte_pdcp_group::@338 id
struct rte_mbuf * m_src
struct rte_mbuf ** m
#define RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED
static struct rte_pdcp_entity * rte_pdcp_en_from_cop(const struct rte_crypto_op *cop)
static void rte_crypto_op_free(struct rte_crypto_op *op)
Definition: rte_crypto.h:398
uint64_t ol_flags
#define RTE_MBUF_F_RX_SEC_OFFLOAD
static uint16_t rte_pdcp_pkt_crypto_group(struct rte_crypto_op *cop[], struct rte_mbuf *mb[], struct rte_pdcp_group grp[], uint16_t num)
static uint64_t rte_cryptodev_sym_session_opaque_data_get(void *sess)
struct rte_crypto_sym_op sym[0]
Definition: rte_crypto.h:178