From: Vipin Varghese Date: Tue, 22 May 2018 11:01:54 +0000 (+0530) Subject: net/tap: fix vdev data sharing for tun X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d8dc42fab62b96a6fe55087d7b9c091603ae17c3;p=dpdk.git net/tap: fix vdev data sharing for tun Enables TUN PMD sharing by attaching the port from the shared data. Fixes: ee27edbe0c10 ("drivers/net: share vdev data to secondary process") Signed-off-by: Vipin Varghese Acked-by: Keith Wiles --- diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 6bb7962bb4..310c7d8e8f 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1653,6 +1653,7 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) struct rte_kvargs *kvlist = NULL; char tun_name[RTE_ETH_NAME_MAX_LEN]; char remote_iface[RTE_ETH_NAME_MAX_LEN]; + struct rte_eth_dev *eth_dev; strcpy(tuntap_name, "TUN"); @@ -1660,6 +1661,17 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) params = rte_vdev_device_args(dev); memset(remote_iface, 0, RTE_ETH_NAME_MAX_LEN); + if (rte_eal_process_type() == RTE_PROC_SECONDARY && + strlen(params) == 0) { + eth_dev = rte_eth_dev_attach_secondary(name); + if (!eth_dev) { + TAP_LOG(ERR, "Failed to probe %s", name); + return -1; + } + eth_dev->dev_ops = &ops; + return 0; + } + snprintf(tun_name, sizeof(tun_name), "%s%u", DEFAULT_TUN_NAME, tun_unit++);