MCPcopy Create free account
hub / github.com/F-Stack/f-stack / copy_to_trf

Function copy_to_trf

dpdk/examples/ipsec-secgw/ipsec_process.c:126–160  ·  view source on GitHub ↗

* helper function, splits processed packets into ipv4/ipv6 traffic. */

Source from the content-addressed store, hash-verified

124 * helper function, splits processed packets into ipv4/ipv6 traffic.
125 */
126static inline void
127copy_to_trf(struct ipsec_traffic *trf, uint64_t satp, struct rte_mbuf *mb[],
128 uint32_t num)
129{
130 uint32_t j, ofs, s;
131 struct traffic_type *out;
132
133 /*
134 * determine traffic type(ipv4/ipv6) and offset for ACL classify
135 * based on SA type
136 */
137 if ((satp & RTE_IPSEC_SATP_DIR_MASK) == RTE_IPSEC_SATP_DIR_IB) {
138 if ((satp & RTE_IPSEC_SATP_IPV_MASK) == RTE_IPSEC_SATP_IPV4) {
139 out = &trf->ip4;
140 ofs = offsetof(struct ip, ip_p);
141 } else {
142 out = &trf->ip6;
143 ofs = offsetof(struct ip6_hdr, ip6_nxt);
144 }
145 } else if (SATP_OUT_IPV4(satp)) {
146 out = &trf->ip4;
147 ofs = offsetof(struct ip, ip_p);
148 } else {
149 out = &trf->ip6;
150 ofs = offsetof(struct ip6_hdr, ip6_nxt);
151 }
152
153 for (j = 0, s = out->num; j != num; j++) {
154 out->data[s + j] = rte_pktmbuf_mtod_offset(mb[j],
155 void *, ofs);
156 out->pkts[s + j] = mb[j];
157 }
158
159 out->num += num;
160}
161
162static uint32_t
163ipsec_prepare_crypto_group(struct ipsec_ctx *ctx, struct ipsec_sa *sa,

Callers 3

ipsec_process_cpu_groupFunction · 0.85
ipsec_cqp_processFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected