X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fnetvsc%2Fhn_ethdev.c;h=35503df32565fdb6c6c0465ac5a16ce251f41ced;hb=6d13ea8e8e49ab957deae2bba5ecf4a4bfe747d1;hp=8e728d639000333269a285d560048c7dad8e317e;hpb=9ba102f6b0453e1a8f13b5940fa6268824c68471;p=dpdk.git diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index 8e728d6390..35503df325 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -112,26 +112,20 @@ eth_dev_vmbus_allocate(struct rte_vmbus_device *dev, size_t private_data_size) eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC; eth_dev->intr_handle = &dev->intr_handle; + /* allow ethdev to remove on close */ + eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; + return eth_dev; } static void eth_dev_vmbus_release(struct rte_eth_dev *eth_dev) { + /* mac_addrs must not be freed alone because part of dev_private */ + eth_dev->data->mac_addrs = NULL; /* free ether device */ rte_eth_dev_release_port(eth_dev); - if (rte_eal_process_type() == RTE_PROC_PRIMARY) - rte_free(eth_dev->data->dev_private); - - eth_dev->data->dev_private = NULL; - - /* - * Secondary process will check the name to attach. - * Clear this field to avoid attaching a released ports. - */ - eth_dev->data->name[0] = '\0'; - eth_dev->device = NULL; eth_dev->intr_handle = NULL; } @@ -298,7 +292,7 @@ hn_dev_allmulticast_disable(struct rte_eth_dev *dev) static int hn_dev_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { /* No filtering on the synthetic path, but can do it on VF */ @@ -387,6 +381,8 @@ static int hn_dev_configure(struct rte_eth_dev *dev) return -EINVAL; } + hv->vlan_strip = !!(rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP); + err = hn_rndis_conf_offload(hv, txmode->offloads, rxmode->offloads); if (err) { @@ -639,11 +635,12 @@ hn_dev_stop(struct rte_eth_dev *dev) } static void -hn_dev_close(struct rte_eth_dev *dev __rte_unused) +hn_dev_close(struct rte_eth_dev *dev) { - PMD_INIT_LOG(DEBUG, "close"); + PMD_INIT_FUNC_TRACE(); hn_vf_close(dev); + hn_dev_free_queues(dev); } static const struct eth_dev_ops hn_eth_dev_ops = { @@ -741,6 +738,8 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev) hv->chim_res = &vmbus->resource[HV_SEND_BUF_MAP]; hv->port_id = eth_dev->data->port_id; hv->latency = HN_CHAN_LATENCY_NS; + hv->max_queues = 1; + hv->vf_port = HN_INVALID_PORT; err = hn_parse_args(eth_dev); if (err) @@ -779,6 +778,10 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev) if (err) goto failed; + /* Multi queue requires later versions of windows server */ + if (hv->nvs_ver < NVS_VERSION_5) + return 0; + max_chan = rte_vmbus_max_channels(vmbus); PMD_INIT_LOG(DEBUG, "VMBus max channels %d", max_chan); if (max_chan <= 0) @@ -790,12 +793,12 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev) hv->max_queues = RTE_MIN(rxr_cnt, (unsigned int)max_chan); /* If VF was reported but not added, do it now */ - if (hv->vf_present && !hv->vf_dev) { + if (hv->vf_present && !hn_vf_attached(hv)) { PMD_INIT_LOG(DEBUG, "Adding VF device"); err = hn_vf_add(eth_dev, hv); if (err) - goto failed; + hv->vf_present = 0; } return 0; @@ -803,6 +806,7 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev) failed: PMD_INIT_LOG(NOTICE, "device init failed"); + hn_tx_pool_uninit(eth_dev); hn_detach(hv); return err; } @@ -825,12 +829,11 @@ eth_hn_dev_uninit(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = NULL; hn_detach(hv); + hn_tx_pool_uninit(eth_dev); rte_vmbus_chan_close(hv->primary->chan); rte_free(hv->primary); rte_eth_dev_owner_delete(hv->owner.id); - eth_dev->data->mac_addrs = NULL; - return 0; } @@ -890,9 +893,7 @@ static struct rte_vmbus_driver rte_netvsc_pmd = { RTE_PMD_REGISTER_VMBUS(net_netvsc, rte_netvsc_pmd); RTE_PMD_REGISTER_KMOD_DEP(net_netvsc, "* uio_hv_generic"); -RTE_INIT(hn_init_log); -static void -hn_init_log(void) +RTE_INIT(hn_init_log) { hn_logtype_init = rte_log_register("pmd.net.netvsc.init"); if (hn_logtype_init >= 0)