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

Function new_device

dpdk/drivers/net/vhost/rte_eth_vhost.c:813–872  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

811}
812
813static int
814new_device(int vid)
815{
816 struct rte_eth_dev *eth_dev;
817 struct internal_list *list;
818 struct pmd_internal *internal;
819 struct rte_eth_conf *dev_conf;
820 unsigned i;
821 char ifname[PATH_MAX];
822#ifdef RTE_LIBRTE_VHOST_NUMA
823 int newnode;
824#endif
825
826 rte_vhost_get_ifname(vid, ifname, sizeof(ifname));
827 list = find_internal_resource(ifname);
828 if (list == NULL) {
829 VHOST_LOG(INFO, "Invalid device name: %s\n", ifname);
830 return -1;
831 }
832
833 eth_dev = list->eth_dev;
834 internal = eth_dev->data->dev_private;
835 dev_conf = &eth_dev->data->dev_conf;
836
837#ifdef RTE_LIBRTE_VHOST_NUMA
838 newnode = rte_vhost_get_numa_node(vid);
839 if (newnode >= 0)
840 eth_dev->data->numa_node = newnode;
841#endif
842
843 if (rte_vhost_get_negotiated_features(vid, &internal->features)) {
844 VHOST_LOG(ERR, "Failed to get device features\n");
845 return -1;
846 }
847
848 internal->vid = vid;
849 if (rte_atomic32_read(&internal->started) == 1) {
850 queue_setup(eth_dev, internal);
851 if (dev_conf->intr_conf.rxq)
852 eth_vhost_configure_intr(eth_dev);
853 }
854
855 for (i = 0; i < rte_vhost_get_vring_num(vid); i++)
856 rte_vhost_enable_guest_notification(vid, i, 0);
857
858 rte_vhost_get_mtu(vid, &eth_dev->data->mtu);
859
860 eth_dev->data->dev_link.link_status = RTE_ETH_LINK_UP;
861
862 vhost_dev_csum_configure(eth_dev);
863
864 rte_atomic32_set(&internal->dev_attached, 1);
865 update_queuing_status(eth_dev, false);
866
867 VHOST_LOG(INFO, "Vhost device %d created\n", vid);
868
869 rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
870

Callers

nothing calls this directly

Calls 14

rte_vhost_get_ifnameFunction · 0.85
rte_vhost_get_numa_nodeFunction · 0.85
rte_atomic32_readFunction · 0.85
queue_setupFunction · 0.85
eth_vhost_configure_intrFunction · 0.85
rte_vhost_get_vring_numFunction · 0.85
rte_vhost_get_mtuFunction · 0.85
vhost_dev_csum_configureFunction · 0.85
rte_atomic32_setFunction · 0.85
update_queuing_statusFunction · 0.85

Tested by

no test coverage detected