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

Function i40e_pf_setup

dpdk/drivers/net/i40e/i40e_ethdev.c:6251–6324  ·  view source on GitHub ↗

PF setup */

Source from the content-addressed store, hash-verified

6249
6250/* PF setup */
6251static int
6252i40e_pf_setup(struct i40e_pf *pf)
6253{
6254 struct i40e_hw *hw = I40E_PF_TO_HW(pf);
6255 struct i40e_filter_control_settings settings;
6256 struct i40e_vsi *vsi;
6257 int ret;
6258
6259 /* Clear all stats counters */
6260 pf->offset_loaded = FALSE;
6261 memset(&pf->stats, 0, sizeof(struct i40e_hw_port_stats));
6262 memset(&pf->stats_offset, 0, sizeof(struct i40e_hw_port_stats));
6263 memset(&pf->internal_stats, 0, sizeof(struct i40e_eth_stats));
6264 memset(&pf->internal_stats_offset, 0, sizeof(struct i40e_eth_stats));
6265 pf->rx_err1 = 0;
6266 pf->rx_err1_offset = 0;
6267
6268 ret = i40e_pf_get_switch_config(pf);
6269 if (ret != I40E_SUCCESS) {
6270 PMD_DRV_LOG(ERR, "Could not get switch config, err %d", ret);
6271 return ret;
6272 }
6273
6274 ret = rte_eth_switch_domain_alloc(&pf->switch_domain_id);
6275 if (ret)
6276 PMD_INIT_LOG(WARNING,
6277 "failed to allocate switch domain for device %d", ret);
6278
6279 if (pf->flags & I40E_FLAG_FDIR) {
6280 /* make queue allocated first, let FDIR use queue pair 0*/
6281 ret = i40e_res_pool_alloc(&pf->qp_pool, I40E_DEFAULT_QP_NUM_FDIR);
6282 if (ret != I40E_FDIR_QUEUE_ID) {
6283 PMD_DRV_LOG(ERR,
6284 "queue allocation fails for FDIR: ret =%d",
6285 ret);
6286 pf->flags &= ~I40E_FLAG_FDIR;
6287 }
6288 }
6289 /* main VSI setup */
6290 vsi = i40e_vsi_setup(pf, I40E_VSI_MAIN, NULL, 0);
6291 if (!vsi) {
6292 PMD_DRV_LOG(ERR, "Setup of main vsi failed");
6293 return I40E_ERR_NOT_READY;
6294 }
6295 pf->main_vsi = vsi;
6296
6297 /* Configure filter control */
6298 memset(&settings, 0, sizeof(settings));
6299 if (hw->func_caps.rss_table_size == RTE_ETH_RSS_RETA_SIZE_128)
6300 settings.hash_lut_size = I40E_HASH_LUT_SIZE_128;
6301 else if (hw->func_caps.rss_table_size == RTE_ETH_RSS_RETA_SIZE_512)
6302 settings.hash_lut_size = I40E_HASH_LUT_SIZE_512;
6303 else {
6304 PMD_DRV_LOG(ERR, "Hash lookup table size (%u) not supported",
6305 hw->func_caps.rss_table_size);
6306 return I40E_ERR_PARAM;
6307 }
6308 PMD_DRV_LOG(INFO, "Hardware capability of hash lookup table size: %u",

Callers 1

eth_i40e_dev_initFunction · 0.85

Calls 7

memsetFunction · 0.85
i40e_res_pool_allocFunction · 0.85
i40e_vsi_setupFunction · 0.85
i40e_set_filter_controlFunction · 0.85
i40e_update_flow_controlFunction · 0.85

Tested by

no test coverage detected