summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVipin Varghese <vipin.varghese@intel.com>2018-05-22 16:31:54 +0530
committerFerruh Yigit <ferruh.yigit@intel.com>2018-05-23 00:35:01 +0200
commitd8dc42fab62b96a6fe55087d7b9c091603ae17c3 (patch)
tree7a0d007e02a5ea132647182a2fe78a759a8489d5
parentd1883bf1de0778b5443b5d42a81adb8908b99088 (diff)
downloaddpdk-d8dc42fab62b96a6fe55087d7b9c091603ae17c3.zip
dpdk-d8dc42fab62b96a6fe55087d7b9c091603ae17c3.tar.gz
dpdk-d8dc42fab62b96a6fe55087d7b9c091603ae17c3.tar.xz
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 <vipin.varghese@intel.com> Acked-by: Keith Wiles <keith.wiles@intel.com>
-rw-r--r--drivers/net/tap/rte_eth_tap.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 6bb7962..310c7d8 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++);