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

Function create_sa

dpdk/app/test/test_ipsec_perf.c:226–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226static int
227create_sa(enum rte_security_session_action_type action_type,
228 struct ipsec_sa *sa)
229{
230 void *dummy_ses = NULL;
231 size_t sz;
232 int rc;
233
234 memset(&sa->ss[0], 0, sizeof(sa->ss[0]));
235
236 rc = fill_ipsec_param(sa);
237 if (rc != 0) {
238 printf("failed to fill ipsec param\n");
239 return TEST_FAILED;
240 }
241
242 sz = rte_ipsec_sa_size(&sa->sa_prm);
243 TEST_ASSERT(sz > 0, "rte_ipsec_sa_size() failed\n");
244
245 sa->ss[0].sa = rte_zmalloc(NULL, sz, RTE_CACHE_LINE_SIZE);
246 TEST_ASSERT_NOT_NULL(sa->ss[0].sa,
247 "failed to allocate memory for rte_ipsec_sa\n");
248
249 sa->ss[0].type = action_type;
250 sa->ss[0].crypto.ses = dummy_ses;
251
252 rc = rte_ipsec_sa_init(sa->ss[0].sa, &sa->sa_prm, sz);
253 rc = (rc > 0 && (uint32_t)rc <= sz) ? 0 : -EINVAL;
254
255 if (rc == 0)
256 rc = rte_ipsec_session_prepare(&sa->ss[0]);
257 else
258 return TEST_FAILED;
259
260 return TEST_SUCCESS;
261}
262
263static int
264packet_prepare(struct rte_mbuf **buf, struct ipsec_sa *sa,

Callers 1

init_sa_sessionFunction · 0.70

Calls 7

memsetFunction · 0.85
rte_ipsec_sa_sizeFunction · 0.85
rte_zmallocFunction · 0.85
rte_ipsec_sa_initFunction · 0.85
fill_ipsec_paramFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected