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

Function ngbe_pf_host_init

dpdk/drivers/net/ngbe/ngbe_pf.c:54–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54int ngbe_pf_host_init(struct rte_eth_dev *eth_dev)
55{
56 struct ngbe_vf_info **vfinfo = NGBE_DEV_VFDATA(eth_dev);
57 struct ngbe_uta_info *uta_info = NGBE_DEV_UTA_INFO(eth_dev);
58 struct ngbe_hw *hw = ngbe_dev_hw(eth_dev);
59 uint16_t vf_num;
60 uint8_t nb_queue = 1;
61 int ret = 0;
62
63 PMD_INIT_FUNC_TRACE();
64
65 RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
66 vf_num = dev_num_vf(eth_dev);
67 if (vf_num == 0)
68 return ret;
69
70 *vfinfo = rte_zmalloc("vf_info",
71 sizeof(struct ngbe_vf_info) * vf_num, 0);
72 if (*vfinfo == NULL) {
73 PMD_INIT_LOG(ERR,
74 "Cannot allocate memory for private VF data");
75 return -ENOMEM;
76 }
77
78 ret = rte_eth_switch_domain_alloc(&(*vfinfo)->switch_domain_id);
79 if (ret) {
80 PMD_INIT_LOG(ERR,
81 "failed to allocate switch domain for device %d", ret);
82 rte_free(*vfinfo);
83 *vfinfo = NULL;
84 return ret;
85 }
86
87 memset(uta_info, 0, sizeof(struct ngbe_uta_info));
88 hw->mac.mc_filter_type = 0;
89
90 RTE_ETH_DEV_SRIOV(eth_dev).active = RTE_ETH_8_POOLS;
91 RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = nb_queue;
92 RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx =
93 (uint16_t)(vf_num * nb_queue);
94
95 ngbe_vf_perm_addr_gen(eth_dev, vf_num);
96
97 /* init_mailbox_params */
98 hw->mbx.init_params(hw);
99
100 /* set mb interrupt mask */
101 ngbe_mb_intr_setup(eth_dev);
102
103 return ret;
104}
105
106void ngbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
107{

Callers 1

eth_ngbe_dev_initFunction · 0.85

Calls 8

ngbe_dev_hwFunction · 0.85
rte_zmallocFunction · 0.85
rte_freeFunction · 0.85
memsetFunction · 0.85
ngbe_vf_perm_addr_genFunction · 0.85
ngbe_mb_intr_setupFunction · 0.85
dev_num_vfFunction · 0.70

Tested by

no test coverage detected