* Stop device. */
| 314 | * Stop device. |
| 315 | */ |
| 316 | int cxgbe_dev_close(struct rte_eth_dev *eth_dev) |
| 317 | { |
| 318 | struct port_info *temp_pi, *pi = eth_dev->data->dev_private; |
| 319 | struct adapter *adapter = pi->adapter; |
| 320 | u8 i; |
| 321 | |
| 322 | CXGBE_FUNC_TRACE(); |
| 323 | |
| 324 | if (rte_eal_process_type() != RTE_PROC_PRIMARY) |
| 325 | return 0; |
| 326 | |
| 327 | if (!(adapter->flags & FULL_INIT_DONE)) |
| 328 | return 0; |
| 329 | |
| 330 | if (!pi->viid) |
| 331 | return 0; |
| 332 | |
| 333 | cxgbe_down(pi); |
| 334 | t4_sge_eth_release_queues(pi); |
| 335 | t4_free_vi(adapter, adapter->mbox, adapter->pf, 0, pi->viid); |
| 336 | pi->viid = 0; |
| 337 | |
| 338 | /* Free up the adapter-wide resources only after all the ports |
| 339 | * under this PF have been closed. |
| 340 | */ |
| 341 | for_each_port(adapter, i) { |
| 342 | temp_pi = adap2pinfo(adapter, i); |
| 343 | if (temp_pi->viid) |
| 344 | return 0; |
| 345 | } |
| 346 | |
| 347 | cxgbe_close(adapter); |
| 348 | rte_free(adapter); |
| 349 | |
| 350 | return 0; |
| 351 | } |
| 352 | |
| 353 | /* Start the device. |
| 354 | * It returns 0 on success. |
nothing calls this directly
no test coverage detected