MCPcopy Index your code
hub / github.com/F-Stack/f-stack / ut_setup_security_rx_inject

Function ut_setup_security_rx_inject

dpdk/app/test/test_cryptodev.c:1432–1517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1430}
1431
1432static int
1433ut_setup_security_rx_inject(void)
1434{
1435 struct rte_mempool *mbuf_pool = rte_mempool_lookup("CRYPTO_MBUFPOOL");
1436 struct crypto_testsuite_params *ts_params = &testsuite_params;
1437 struct rte_eth_conf port_conf = {
1438 .rxmode = {
1439 .offloads = RTE_ETH_RX_OFFLOAD_CHECKSUM |
1440 RTE_ETH_RX_OFFLOAD_SECURITY,
1441 },
1442 .txmode = {
1443 .offloads = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE,
1444 },
1445 .lpbk_mode = 1, /* Enable loopback */
1446 };
1447 struct rte_cryptodev_info dev_info;
1448 struct rte_eth_rxconf rx_conf = {
1449 .rx_thresh = {
1450 .pthresh = 8,
1451 .hthresh = 8,
1452 .wthresh = 8,
1453 },
1454 .rx_free_thresh = 32,
1455 };
1456 uint16_t nb_ports;
1457 void *sec_ctx;
1458 int ret;
1459
1460 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
1461 if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_SECURITY_RX_INJECT) ||
1462 !(dev_info.feature_flags & RTE_CRYPTODEV_FF_SECURITY)) {
1463 RTE_LOG(INFO, USER1,
1464 "Feature requirements for IPsec Rx inject test case not met\n");
1465 return TEST_SKIPPED;
1466 }
1467
1468 sec_ctx = rte_cryptodev_get_sec_ctx(ts_params->valid_devs[0]);
1469 if (sec_ctx == NULL)
1470 return TEST_SKIPPED;
1471
1472 nb_ports = rte_eth_dev_count_avail();
1473 if (nb_ports == 0)
1474 return TEST_SKIPPED;
1475
1476 ret = rte_eth_dev_configure(0 /* port_id */,
1477 1 /* nb_rx_queue */,
1478 0 /* nb_tx_queue */,
1479 &port_conf);
1480 if (ret) {
1481 printf("Could not configure ethdev port 0 [err=%d]\n", ret);
1482 return TEST_SKIPPED;
1483 }
1484
1485 /* Rx queue setup */
1486 ret = rte_eth_rx_queue_setup(0 /* port_id */,
1487 0 /* rx_queue_id */,
1488 1024 /* nb_rx_desc */,
1489 SOCKET_ID_ANY,

Callers

nothing calls this directly

Calls 11

rte_mempool_lookupFunction · 0.85
rte_cryptodev_info_getFunction · 0.85
rte_eth_dev_count_availFunction · 0.85
rte_eth_dev_configureFunction · 0.85
rte_eth_rx_queue_setupFunction · 0.85
rte_eth_dev_startFunction · 0.85
dev_configure_and_startFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected