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

Function check_sp_sa_bulk

dpdk/examples/ipsec-secgw/ipsec_worker.c:192–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192static inline void
193check_sp_sa_bulk(struct sp_ctx *sp, struct sa_ctx *sa_ctx,
194 struct traffic_type *ip)
195{
196 struct ipsec_sa *sa;
197 uint32_t i, j, res;
198 struct rte_mbuf *m;
199
200 if (unlikely(sp == NULL || ip->num == 0))
201 return;
202
203 rte_acl_classify((struct rte_acl_ctx *)sp, ip->data, ip->res, ip->num,
204 DEFAULT_MAX_CATEGORIES);
205
206 j = 0;
207 for (i = 0; i < ip->num; i++) {
208 m = ip->pkts[i];
209 res = ip->res[i];
210 if (unlikely(res == DISCARD))
211 free_pkts(&m, 1);
212 else if (res == BYPASS)
213 ip->pkts[j++] = m;
214 else {
215 sa = *(struct ipsec_sa **)rte_security_dynfield(m);
216 if (sa == NULL) {
217 free_pkts(&m, 1);
218 continue;
219 }
220
221 /* SPI on the packet should match with the one in SA */
222 if (unlikely(sa->spi != sa_ctx->sa[res - 1].spi)) {
223 free_pkts(&m, 1);
224 continue;
225 }
226
227 ip->pkts[j++] = m;
228 }
229 }
230 ip->num = j;
231}
232
233static inline void
234ipv4_pkt_l3_len_set(struct rte_mbuf *pkt)

Callers 1

Calls 3

rte_acl_classifyFunction · 0.85
rte_security_dynfieldFunction · 0.85
free_pktsFunction · 0.70

Tested by

no test coverage detected