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

Function sfc_dev_close

dpdk/drivers/net/sfc/sfc_ethdev.c:345–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343}
344
345static int
346sfc_dev_close(struct rte_eth_dev *dev)
347{
348 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
349
350 sfc_log_init(sa, "entry");
351
352 if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
353 sfc_eth_dev_secondary_clear_ops(dev);
354 return 0;
355 }
356
357 sfc_pre_detach(sa);
358
359 sfc_adapter_lock(sa);
360 switch (sa->state) {
361 case SFC_ETHDEV_STARTED:
362 sfc_stop(sa);
363 SFC_ASSERT(sa->state == SFC_ETHDEV_CONFIGURED);
364 /* FALLTHROUGH */
365 case SFC_ETHDEV_CONFIGURED:
366 sfc_close(sa);
367 SFC_ASSERT(sa->state == SFC_ETHDEV_INITIALIZED);
368 /* FALLTHROUGH */
369 case SFC_ETHDEV_INITIALIZED:
370 break;
371 default:
372 sfc_err(sa, "unexpected adapter state %u on close", sa->state);
373 break;
374 }
375
376 /*
377 * Cleanup all resources.
378 * Rollback primary process sfc_eth_dev_init() below.
379 */
380
381 sfc_eth_dev_clear_ops(dev);
382
383 sfc_nic_dma_detach(sa);
384 sfc_detach(sa);
385 sfc_unprobe(sa);
386
387 sfc_kvargs_cleanup(sa);
388
389 sfc_adapter_unlock(sa);
390 sfc_adapter_lock_fini(sa);
391
392 sfc_log_init(sa, "done");
393
394 /* Required for logging, so cleanup last */
395 sa->eth_dev = NULL;
396
397 free(sa);
398
399 return 0;
400}
401
402static int

Callers 1

sfc_eth_dev_uninitFunction · 0.85

Calls 12

sfc_adapter_by_eth_devFunction · 0.85
rte_eal_process_typeFunction · 0.85
sfc_pre_detachFunction · 0.85
sfc_stopFunction · 0.85
sfc_closeFunction · 0.85
sfc_eth_dev_clear_opsFunction · 0.85
sfc_nic_dma_detachFunction · 0.85
sfc_detachFunction · 0.85
sfc_unprobeFunction · 0.85
sfc_kvargs_cleanupFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected