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

Function eth_hn_dev_init

dpdk/drivers/net/netvsc/hn_ethdev.c:1267–1396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1265};
1266
1267static int
1268eth_hn_dev_init(struct rte_eth_dev *eth_dev)
1269{
1270 struct hn_data *hv = eth_dev->data->dev_private;
1271 struct rte_device *device = eth_dev->device;
1272 struct rte_vmbus_device *vmbus;
1273 uint32_t mtu;
1274 unsigned int rxr_cnt;
1275 int err, max_chan;
1276
1277 PMD_INIT_FUNC_TRACE();
1278
1279 rte_spinlock_init(&hv->hotadd_lock);
1280 LIST_INIT(&hv->hotadd_list);
1281
1282 vmbus = container_of(device, struct rte_vmbus_device, device);
1283 eth_dev->dev_ops = &hn_eth_dev_ops;
1284 eth_dev->rx_queue_count = hn_dev_rx_queue_count;
1285 eth_dev->rx_descriptor_status = hn_dev_rx_queue_status;
1286 eth_dev->tx_descriptor_status = hn_dev_tx_descriptor_status;
1287 eth_dev->tx_pkt_burst = &hn_xmit_pkts;
1288 eth_dev->rx_pkt_burst = &hn_recv_pkts;
1289
1290 /*
1291 * for secondary processes, we don't initialize any further as primary
1292 * has already done this work.
1293 */
1294 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
1295 return 0;
1296
1297 eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
1298
1299 /* Since Hyper-V only supports one MAC address */
1300 eth_dev->data->mac_addrs = rte_calloc("hv_mac", HN_MAX_MAC_ADDRS,
1301 sizeof(struct rte_ether_addr), 0);
1302 if (eth_dev->data->mac_addrs == NULL) {
1303 PMD_INIT_LOG(ERR,
1304 "Failed to allocate memory store MAC addresses");
1305 return -ENOMEM;
1306 }
1307
1308 hv->vmbus = vmbus;
1309 hv->rxbuf_res = vmbus->resource[HV_RECV_BUF_MAP];
1310 hv->chim_res = vmbus->resource[HV_SEND_BUF_MAP];
1311 hv->port_id = eth_dev->data->port_id;
1312 hv->latency = HN_CHAN_LATENCY_NS;
1313 hv->rx_copybreak = HN_RXCOPY_THRESHOLD;
1314 hv->tx_copybreak = HN_TXCOPY_THRESHOLD;
1315 hv->rx_extmbuf_enable = HN_RX_EXTMBUF_ENABLE;
1316 hv->max_queues = 1;
1317
1318 rte_rwlock_init(&hv->vf_lock);
1319 hv->vf_ctx.vf_vsc_switched = false;
1320 hv->vf_ctx.vf_vsp_reported = false;
1321 hv->vf_ctx.vf_attached = false;
1322 hv->vf_ctx.vf_state = vf_unknown;
1323
1324 err = hn_parse_args(eth_dev);

Callers 1

eth_hn_probeFunction · 0.85

Calls 15

rte_spinlock_initFunction · 0.85
rte_eal_process_typeFunction · 0.85
rte_callocFunction · 0.85
rte_rwlock_initFunction · 0.85
hn_parse_argsFunction · 0.85
rte_eth_dev_owner_newFunction · 0.85
rte_vmbus_chan_openFunction · 0.85
rte_vmbus_set_latencyFunction · 0.85
hn_rx_queue_allocFunction · 0.85
hn_attachFunction · 0.85
hn_chim_initFunction · 0.85
hn_rndis_get_mtuFunction · 0.85

Tested by

no test coverage detected