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

Function rte_pmd_null_probe

dpdk/drivers/net/null/rte_eth_null.c:661–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

659}
660
661static int
662rte_pmd_null_probe(struct rte_vdev_device *dev)
663{
664 const char *name, *params;
665 struct pmd_options args = {
666 .packet_copy = default_packet_copy,
667 .packet_size = default_packet_size,
668 .no_rx = default_no_rx,
669 };
670 struct rte_kvargs *kvlist = NULL;
671 struct rte_eth_dev *eth_dev;
672 int ret;
673
674 if (!dev)
675 return -EINVAL;
676
677 name = rte_vdev_device_name(dev);
678 params = rte_vdev_device_args(dev);
679 PMD_LOG(INFO, "Initializing pmd_null for %s", name);
680
681 if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
682 struct pmd_internals *internals;
683 eth_dev = rte_eth_dev_attach_secondary(name);
684 if (!eth_dev) {
685 PMD_LOG(ERR, "Failed to probe %s", name);
686 return -1;
687 }
688 /* TODO: request info from primary to set up Rx and Tx */
689 eth_dev->dev_ops = &ops;
690 eth_dev->device = &dev->device;
691 internals = eth_dev->data->dev_private;
692 if (internals->packet_copy) {
693 eth_dev->rx_pkt_burst = eth_null_copy_rx;
694 eth_dev->tx_pkt_burst = eth_null_copy_tx;
695 } else if (internals->no_rx) {
696 eth_dev->rx_pkt_burst = eth_null_no_rx;
697 eth_dev->tx_pkt_burst = eth_null_tx;
698 } else {
699 eth_dev->rx_pkt_burst = eth_null_rx;
700 eth_dev->tx_pkt_burst = eth_null_tx;
701 }
702 rte_eth_dev_probing_finish(eth_dev);
703 return 0;
704 }
705
706 if (params != NULL) {
707 kvlist = rte_kvargs_parse(params, valid_arguments);
708 if (kvlist == NULL)
709 return -1;
710
711 ret = rte_kvargs_process(kvlist,
712 ETH_NULL_PACKET_SIZE_ARG,
713 &get_packet_size_arg, &args.packet_size);
714 if (ret < 0)
715 goto free_kvlist;
716
717
718 ret = rte_kvargs_process(kvlist,

Callers

nothing calls this directly

Calls 9

rte_vdev_device_nameFunction · 0.85
rte_vdev_device_argsFunction · 0.85
rte_eal_process_typeFunction · 0.85
rte_kvargs_parseFunction · 0.85
rte_kvargs_processFunction · 0.85
eth_dev_null_createFunction · 0.85
rte_kvargs_freeFunction · 0.85

Tested by

no test coverage detected