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

Function i40e_fdir_setup

dpdk/drivers/net/i40e/i40e_fdir.c:155–276  ·  view source on GitHub ↗

* i40e_fdir_setup - reserve and initialize the Flow Director resources * @pf: board private structure */

Source from the content-addressed store, hash-verified

153 * @pf: board private structure
154 */
155int
156i40e_fdir_setup(struct i40e_pf *pf)
157{
158 struct i40e_hw *hw = I40E_PF_TO_HW(pf);
159 struct i40e_vsi *vsi;
160 int err = I40E_SUCCESS;
161 char z_name[RTE_MEMZONE_NAMESIZE];
162 const struct rte_memzone *mz = NULL;
163 struct rte_eth_dev *eth_dev = &rte_eth_devices[pf->dev_data->port_id];
164 uint16_t i;
165
166 if ((pf->flags & I40E_FLAG_FDIR) == 0) {
167 PMD_INIT_LOG(ERR, "HW doesn't support FDIR");
168 return I40E_NOT_SUPPORTED;
169 }
170
171 PMD_DRV_LOG(INFO, "FDIR HW Capabilities: num_filters_guaranteed = %u,"
172 " num_filters_best_effort = %u.",
173 hw->func_caps.fd_filters_guaranteed,
174 hw->func_caps.fd_filters_best_effort);
175
176 vsi = pf->fdir.fdir_vsi;
177 if (vsi) {
178 PMD_DRV_LOG(INFO, "FDIR initialization has been done.");
179 return I40E_SUCCESS;
180 }
181
182 /* make new FDIR VSI */
183 vsi = i40e_vsi_setup(pf, I40E_VSI_FDIR, pf->main_vsi, 0);
184 if (!vsi) {
185 PMD_DRV_LOG(ERR, "Couldn't create FDIR VSI.");
186 return I40E_ERR_NO_AVAILABLE_VSI;
187 }
188 pf->fdir.fdir_vsi = vsi;
189
190 /*Fdir tx queue setup*/
191 err = i40e_fdir_setup_tx_resources(pf);
192 if (err) {
193 PMD_DRV_LOG(ERR, "Failed to setup FDIR TX resources.");
194 goto fail_setup_tx;
195 }
196
197 /*Fdir rx queue setup*/
198 err = i40e_fdir_setup_rx_resources(pf);
199 if (err) {
200 PMD_DRV_LOG(ERR, "Failed to setup FDIR RX resources.");
201 goto fail_setup_rx;
202 }
203
204 err = i40e_tx_queue_init(pf->fdir.txq);
205 if (err) {
206 PMD_DRV_LOG(ERR, "Failed to do FDIR TX initialization.");
207 goto fail_mem;
208 }
209
210 /* need switch on before dev start*/
211 err = i40e_switch_tx_queue(hw, vsi->base_queue, TRUE);
212 if (err) {

Callers 1

Calls 14

i40e_vsi_setupFunction · 0.85
i40e_tx_queue_initFunction · 0.85
i40e_switch_tx_queueFunction · 0.85
i40e_fdir_rx_queue_initFunction · 0.85
i40e_switch_rx_queueFunction · 0.85
snprintfFunction · 0.85
i40e_memzone_reserveFunction · 0.85
i40e_rx_queue_releaseFunction · 0.85

Tested by

no test coverage detected