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

Function rte_eth_dev_release_port

dpdk/lib/ethdev/ethdev_driver.c:225–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225int
226rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
227{
228 int ret;
229
230 if (eth_dev == NULL)
231 return -EINVAL;
232
233 rte_spinlock_lock(rte_mcfg_ethdev_get_lock());
234 if (eth_dev_shared_data_prepare() == NULL)
235 ret = -EINVAL;
236 else
237 ret = 0;
238 rte_spinlock_unlock(rte_mcfg_ethdev_get_lock());
239 if (ret != 0)
240 return ret;
241
242 if (eth_dev->state != RTE_ETH_DEV_UNUSED)
243 rte_eth_dev_callback_process(eth_dev,
244 RTE_ETH_EVENT_DESTROY, NULL);
245
246 eth_dev_fp_ops_reset(rte_eth_fp_ops + eth_dev->data->port_id);
247
248 rte_spinlock_lock(rte_mcfg_ethdev_get_lock());
249
250 eth_dev->state = RTE_ETH_DEV_UNUSED;
251 eth_dev->device = NULL;
252 eth_dev->process_private = NULL;
253 eth_dev->intr_handle = NULL;
254 eth_dev->rx_pkt_burst = NULL;
255 eth_dev->tx_pkt_burst = NULL;
256 eth_dev->tx_pkt_prepare = NULL;
257 eth_dev->rx_queue_count = NULL;
258 eth_dev->rx_descriptor_status = NULL;
259 eth_dev->tx_descriptor_status = NULL;
260 eth_dev->dev_ops = NULL;
261
262 if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
263 rte_free(eth_dev->data->rx_queues);
264 rte_free(eth_dev->data->tx_queues);
265 rte_free(eth_dev->data->mac_addrs);
266 rte_free(eth_dev->data->hash_mac_addrs);
267 rte_free(eth_dev->data->dev_private);
268 pthread_mutex_destroy(&eth_dev->data->flow_ops_mutex);
269 memset(eth_dev->data, 0, sizeof(struct rte_eth_dev_data));
270 eth_dev->data = NULL;
271
272 eth_dev_shared_data->allocated_ports--;
273 eth_dev_shared_data_release();
274 }
275
276 rte_spinlock_unlock(rte_mcfg_ethdev_get_lock());
277
278 return 0;
279}
280
281int
282rte_eth_dev_create(struct rte_device *device, const char *name,

Callers 15

rte_eth_dev_closeFunction · 0.85
rte_eth_dev_pci_allocateFunction · 0.85
rte_eth_vdev_allocateFunction · 0.85
rte_eth_dev_createFunction · 0.85
rte_eth_dev_destroyFunction · 0.85
eth_ark_pci_probeFunction · 0.85
rte_pmd_ring_removeFunction · 0.85
mlx4_dev_closeFunction · 0.85
mlx4_pci_probeFunction · 0.85
virtio_user_eth_dev_freeFunction · 0.85

Calls 11

rte_mcfg_ethdev_get_lockFunction · 0.85
eth_dev_fp_ops_resetFunction · 0.85
rte_eal_process_typeFunction · 0.85
rte_freeFunction · 0.85
pthread_mutex_destroyFunction · 0.85
memsetFunction · 0.85
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by

no test coverage detected