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

Function sfc_sriov_vswitch_create

dpdk/drivers/net/sfc/sfc_sriov.c:104–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104int
105sfc_sriov_vswitch_create(struct sfc_adapter *sa)
106{
107 struct sfc_sriov *sriov = &sa->sriov;
108 efx_vport_config_t *vport_config = sriov->vport_config;
109 int rc;
110
111 sfc_log_init(sa, "entry");
112
113 if (sa->switchdev) {
114 sfc_log_init(sa, "don't create vswitch in switchdev mode");
115 goto done;
116 }
117
118 if (sriov->num_vfs == 0) {
119 sfc_log_init(sa, "no VFs enabled");
120 goto done;
121 }
122
123 rc = efx_evb_init(sa->nic);
124 if (rc != 0) {
125 sfc_err(sa, "EVB init failed %d", rc);
126 goto fail_evb_init;
127 }
128
129 RTE_BUILD_BUG_ON(sizeof(sa->port.default_mac_addr) !=
130 sizeof(vport_config[0].evc_mac_addr));
131 rte_ether_addr_copy(&sa->port.default_mac_addr,
132 (struct rte_ether_addr *)vport_config[0].evc_mac_addr);
133
134 rc = efx_evb_vswitch_create(sa->nic, sriov->num_vfs + 1,
135 vport_config, &sriov->vswitch);
136 if (rc != 0) {
137 sfc_err(sa, "EVB vSwitch create failed %d", rc);
138 goto fail_evb_vswitch_create;
139 }
140
141done:
142 sfc_log_init(sa, "done");
143 return 0;
144
145fail_evb_vswitch_create:
146 efx_evb_fini(sa->nic);
147
148fail_evb_init:
149 return rc;
150}
151
152void
153sfc_sriov_vswitch_destroy(struct sfc_adapter *sa)

Callers 2

sfc_startFunction · 0.85
sfc_attachFunction · 0.85

Calls 4

efx_evb_initFunction · 0.85
rte_ether_addr_copyFunction · 0.85
efx_evb_vswitch_createFunction · 0.85
efx_evb_finiFunction · 0.85

Tested by

no test coverage detected