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

Function ixgbe_pf_host_init

dpdk/drivers/net/ixgbe/ixgbe_pf.c:69–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69int ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
70{
71 struct ixgbe_vf_info **vfinfo =
72 IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
73 struct ixgbe_uta_info *uta_info =
74 IXGBE_DEV_PRIVATE_TO_UTA(eth_dev->data->dev_private);
75 struct ixgbe_hw *hw =
76 IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
77 uint16_t vf_num;
78 uint8_t nb_queue;
79 int ret = 0;
80
81 PMD_INIT_FUNC_TRACE();
82
83 RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
84 vf_num = dev_num_vf(eth_dev);
85 if (vf_num == 0)
86 return ret;
87
88 *vfinfo = rte_zmalloc("vf_info", sizeof(struct ixgbe_vf_info) * vf_num, 0);
89 if (*vfinfo == NULL) {
90 PMD_INIT_LOG(ERR,
91 "Cannot allocate memory for private VF data");
92 return -ENOMEM;
93 }
94
95 ret = rte_eth_switch_domain_alloc(&(*vfinfo)->switch_domain_id);
96 if (ret) {
97 PMD_INIT_LOG(ERR,
98 "failed to allocate switch domain for device %d", ret);
99 rte_free(*vfinfo);
100 *vfinfo = NULL;
101 return ret;
102 }
103
104 memset(uta_info, 0, sizeof(struct ixgbe_uta_info));
105 hw->mac.mc_filter_type = 0;
106
107 if (vf_num >= RTE_ETH_32_POOLS) {
108 nb_queue = 2;
109 RTE_ETH_DEV_SRIOV(eth_dev).active = RTE_ETH_64_POOLS;
110 } else if (vf_num >= RTE_ETH_16_POOLS) {
111 nb_queue = 4;
112 RTE_ETH_DEV_SRIOV(eth_dev).active = RTE_ETH_32_POOLS;
113 } else {
114 nb_queue = 8;
115 RTE_ETH_DEV_SRIOV(eth_dev).active = RTE_ETH_16_POOLS;
116 }
117
118 RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = nb_queue;
119 RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = vf_num;
120 RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = (uint16_t)(vf_num * nb_queue);
121
122 ixgbe_vf_perm_addr_gen(eth_dev, vf_num);
123
124 /* init_mailbox_params */
125 hw->mbx.ops.init_params(hw);
126

Callers 1

eth_ixgbe_dev_initFunction · 0.85

Calls 7

rte_zmallocFunction · 0.85
rte_freeFunction · 0.85
memsetFunction · 0.85
ixgbe_vf_perm_addr_genFunction · 0.85
ixgbe_mb_intr_setupFunction · 0.85
dev_num_vfFunction · 0.70

Tested by

no test coverage detected