| 223 | } |
| 224 | |
| 225 | int |
| 226 | rte_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(ð_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 | |
| 281 | int |
| 282 | rte_eth_dev_create(struct rte_device *device, const char *name, |
no test coverage detected