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

Function sfc_repr_dev_close

dpdk/drivers/net/sfc/sfc_repr.c:777–834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

775}
776
777static int
778sfc_repr_dev_close(struct rte_eth_dev *dev)
779{
780 struct sfc_repr *sr = sfc_repr_by_eth_dev(dev);
781 struct sfc_repr_shared *srs = sfc_repr_shared_by_eth_dev(dev);
782 unsigned int i;
783
784 sfcr_info(sr, "entry");
785
786 sfc_repr_lock(sr);
787 switch (sr->state) {
788 case SFC_ETHDEV_STARTED:
789 sfc_repr_stop(dev);
790 SFC_ASSERT(sr->state == SFC_ETHDEV_CONFIGURED);
791 /* FALLTHROUGH */
792 case SFC_ETHDEV_CONFIGURED:
793 sfc_repr_close(sr);
794 SFC_ASSERT(sr->state == SFC_ETHDEV_INITIALIZED);
795 /* FALLTHROUGH */
796 case SFC_ETHDEV_INITIALIZED:
797 break;
798 default:
799 sfcr_err(sr, "unexpected adapter state %u on close", sr->state);
800 break;
801 }
802
803 for (i = 0; i < dev->data->nb_rx_queues; i++) {
804 sfc_repr_rx_queue_release(dev, i);
805 dev->data->rx_queues[i] = NULL;
806 }
807
808 for (i = 0; i < dev->data->nb_tx_queues; i++) {
809 sfc_repr_tx_queue_release(dev, i);
810 dev->data->tx_queues[i] = NULL;
811 }
812
813 /*
814 * Cleanup all resources.
815 * Rollback primary process sfc_repr_eth_dev_init() below.
816 */
817
818 (void)sfc_repr_proxy_del_port(srs->pf_port_id, srs->repr_id);
819
820 sfc_mae_clear_switch_port(srs->switch_domain_id, srs->switch_port_id);
821
822 dev->rx_pkt_burst = NULL;
823 dev->tx_pkt_burst = NULL;
824 dev->dev_ops = NULL;
825
826 sfc_repr_unlock(sr);
827 sfc_repr_lock_fini(sr);
828
829 sfcr_info(sr, "done");
830
831 free(sr);
832
833 return 0;
834}

Callers

nothing calls this directly

Calls 9

sfc_repr_by_eth_devFunction · 0.85
sfc_repr_stopFunction · 0.85
sfc_repr_closeFunction · 0.85
sfc_repr_proxy_del_portFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected