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

Function rte_eth_dev_attach_secondary

dpdk/lib/ethdev/ethdev_driver.c:149–177  ·  view source on GitHub ↗

* Attach to a port already registered by the primary process, which * makes sure that the same device would have the same port ID both * in the primary and secondary process. */

Source from the content-addressed store, hash-verified

147 * in the primary and secondary process.
148 */
149struct rte_eth_dev *
150rte_eth_dev_attach_secondary(const char *name)
151{
152 uint16_t i;
153 struct rte_eth_dev *eth_dev = NULL;
154
155 /* Synchronize port attachment to primary port creation and release. */
156 rte_spinlock_lock(rte_mcfg_ethdev_get_lock());
157
158 if (eth_dev_shared_data_prepare() == NULL)
159 goto unlock;
160
161 for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
162 if (strcmp(eth_dev_shared_data->data[i].name, name) == 0)
163 break;
164 }
165 if (i == RTE_MAX_ETHPORTS) {
166 RTE_ETHDEV_LOG(ERR,
167 "Device %s is not driven by the primary process\n",
168 name);
169 } else {
170 eth_dev = eth_dev_get(i);
171 RTE_ASSERT(eth_dev->data->port_id == i);
172 }
173
174unlock:
175 rte_spinlock_unlock(rte_mcfg_ethdev_get_lock());
176 return eth_dev;
177}
178
179int
180rte_eth_dev_callback_process(struct rte_eth_dev *dev,

Callers 15

rte_eth_dev_pci_allocateFunction · 0.85
rte_eth_dev_createFunction · 0.85
rte_pmd_memif_probeFunction · 0.85
rte_pmd_ring_probeFunction · 0.85
mlx4_pci_probeFunction · 0.85
virtio_user_pmd_probeFunction · 0.85
rte_pmd_null_probeFunction · 0.85
mana_probe_portFunction · 0.85
rte_pmd_af_xdp_probeFunction · 0.85
rte_pmd_af_packet_probeFunction · 0.85

Calls 6

rte_mcfg_ethdev_get_lockFunction · 0.85
strcmpFunction · 0.85
eth_dev_getFunction · 0.85
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by 1

run_pdump_client_testsFunction · 0.68