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

Function pmd_pcap_probe

dpdk/drivers/net/pcap/pcap_ethdev.c:1404–1628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1402}
1403
1404static int
1405pmd_pcap_probe(struct rte_vdev_device *dev)
1406{
1407 const char *name;
1408 struct rte_kvargs *kvlist;
1409 struct pmd_devargs pcaps = {0};
1410 struct pmd_devargs dumpers = {0};
1411 struct rte_eth_dev *eth_dev = NULL;
1412 struct pmd_internals *internal;
1413 int ret = 0;
1414
1415 struct pmd_devargs_all devargs_all = {
1416 .single_iface = 0,
1417 .is_tx_pcap = 0,
1418 .is_tx_iface = 0,
1419 .infinite_rx = 0,
1420 };
1421
1422 name = rte_vdev_device_name(dev);
1423 PMD_LOG(INFO, "Initializing pmd_pcap for %s", name);
1424
1425 timespec_get(&start_time, TIME_UTC);
1426 start_cycles = rte_get_timer_cycles();
1427 hz = rte_get_timer_hz();
1428
1429 ret = rte_mbuf_dyn_rx_timestamp_register(&timestamp_dynfield_offset,
1430 &timestamp_rx_dynflag);
1431 if (ret != 0) {
1432 PMD_LOG(ERR, "Failed to register Rx timestamp field/flag");
1433 return -1;
1434 }
1435
1436 if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
1437 eth_dev = rte_eth_dev_attach_secondary(name);
1438 if (!eth_dev) {
1439 PMD_LOG(ERR, "Failed to probe %s", name);
1440 return -1;
1441 }
1442
1443 internal = eth_dev->data->dev_private;
1444
1445 kvlist = rte_kvargs_parse(internal->devargs, valid_arguments);
1446 if (kvlist == NULL)
1447 return -1;
1448 } else {
1449 kvlist = rte_kvargs_parse(rte_vdev_device_args(dev),
1450 valid_arguments);
1451 if (kvlist == NULL)
1452 return -1;
1453 }
1454
1455 /*
1456 * If iface argument is passed we open the NICs and use them for
1457 * reading / writing
1458 */
1459 if (rte_kvargs_count(kvlist, ETH_PCAP_IFACE_ARG) == 1) {
1460
1461 ret = rte_kvargs_process(kvlist, ETH_PCAP_IFACE_ARG,

Callers

nothing calls this directly

Calls 14

rte_vdev_device_nameFunction · 0.85
rte_eal_process_typeFunction · 0.85
rte_kvargs_parseFunction · 0.85
rte_vdev_device_argsFunction · 0.85
rte_kvargs_countFunction · 0.85
rte_kvargs_processFunction · 0.85
rte_zmallocFunction · 0.85
eth_from_pcapsFunction · 0.85
rte_kvargs_freeFunction · 0.85

Tested by

no test coverage detected