From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 8FFFD1C0B for ; Tue, 22 May 2018 13:01:55 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2018 04:01:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,430,1520924400"; d="scan'208";a="230755767" Received: from unknown (HELO saesrv02-S2600CWR.intel.com) ([10.224.122.203]) by fmsmga006.fm.intel.com with ESMTP; 22 May 2018 04:01:52 -0700 From: Vipin Varghese To: dev@dpdk.org, ferruh.yigit@intel.com, keith.wiles@intel.com Cc: pascal.mazon@6wind.com, zhihong.wang@intel.com, Vipin Varghese Date: Tue, 22 May 2018 16:31:54 +0530 Message-Id: <1526986914-31856-1-git-send-email-vipin.varghese@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526107055-26637-1-git-send-email-vipin.varghese@intel.com> References: <1526107055-26637-1-git-send-email-vipin.varghese@intel.com> Subject: [dpdk-dev] [PATCH v2] net/tap: fix the vdev data sharing for tun X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2018 11:01:57 -0000 Fixes: ee27edbe0c10 ("drivers/net: share vdev data to secondary process") Enables TUN PMD sharing by attaching the port from the shared data. Cc: zhihong.wang@intel.com Cc: ferruh.yigit@intel.com Signed-off-by: Vipin Varghese --- Changes in V2: - removal of To Do comment - Keith Wiles, Ferruh Yigit --- drivers/net/tap/rte_eth_tap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 8d8f67b..41300a6 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1650,6 +1650,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"); @@ -1657,6 +1658,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++); -- 2.7.4