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

Function create_lookaside_session

dpdk/examples/ipsec-secgw/ipsec.c:238–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238int
239create_lookaside_session(struct ipsec_ctx *ipsec_ctx_lcore[],
240 struct socket_ctx *skt_ctx, const struct eventmode_conf *em_conf,
241 struct ipsec_sa *sa, struct rte_ipsec_session *ips)
242{
243 uint16_t cdev_id = RTE_CRYPTO_MAX_DEVS;
244 enum rte_crypto_op_sess_type sess_type;
245 struct rte_cryptodev_info cdev_info;
246 enum rte_crypto_op_type op_type;
247 unsigned long cdev_id_qp = 0;
248 struct ipsec_ctx *ipsec_ctx;
249 struct cdev_key key = { 0 };
250 void *sess = NULL;
251 uint32_t lcore_id;
252 int32_t ret = 0;
253
254 RTE_LCORE_FOREACH(lcore_id) {
255 ipsec_ctx = ipsec_ctx_lcore[lcore_id];
256
257 /* Core is not bound to any cryptodev, skip it */
258 if (ipsec_ctx->cdev_map == NULL)
259 continue;
260
261 /* Looking for cryptodev, which can handle this SA */
262 key.lcore_id = lcore_id;
263 key.cipher_algo = (uint8_t)sa->cipher_algo;
264 key.auth_algo = (uint8_t)sa->auth_algo;
265 key.aead_algo = (uint8_t)sa->aead_algo;
266
267 ret = rte_hash_lookup_data(ipsec_ctx->cdev_map, &key,
268 (void **)&cdev_id_qp);
269 if (ret == -ENOENT)
270 continue;
271 if (ret < 0) {
272 RTE_LOG(ERR, IPSEC,
273 "No cryptodev: core %u, cipher_algo %u, "
274 "auth_algo %u, aead_algo %u\n",
275 key.lcore_id,
276 key.cipher_algo,
277 key.auth_algo,
278 key.aead_algo);
279 return ret;
280 }
281
282 /* Verify that all cores are using same cryptodev for current
283 * algorithm combination, required by SA.
284 * Current cryptodev mapping process will map SA to the first
285 * cryptodev that matches requirements, so it's a double check,
286 * not an additional restriction.
287 */
288 if (cdev_id == RTE_CRYPTO_MAX_DEVS)
289 cdev_id = ipsec_ctx->tbl[cdev_id_qp].id;
290 else if (cdev_id != ipsec_ctx->tbl[cdev_id_qp].id) {
291 struct rte_cryptodev_info dev_info_1, dev_info_2;
292 rte_cryptodev_info_get(cdev_id, &dev_info_1);
293 rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id,
294 &dev_info_2);
295 if (dev_info_1.driver_id == dev_info_2.driver_id) {

Callers 2

sa_add_rulesFunction · 0.85
ipsec_sa_initFunction · 0.85

Calls 10

rte_hash_lookup_dataFunction · 0.85
rte_cryptodev_info_getFunction · 0.85
set_ipsec_confFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected