From patchwork Fri Jun 30 16:51:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 26132 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id BB0A47D0A; Fri, 30 Jun 2017 18:54:00 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id D3BDA37A6 for ; Fri, 30 Jun 2017 18:52:14 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jun 2017 09:52:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,287,1496127600"; d="scan'208";a="103233413" Received: from silpixa00372839.ir.intel.com (HELO silpixa00372839.ger.corp.intel.com) ([10.237.222.154]) by orsmga004.jf.intel.com with ESMTP; 30 Jun 2017 09:52:13 -0700 From: Ferruh Yigit To: dev@dpdk.org Cc: Ferruh Yigit , Stephen Hemminger , Bruce Richardson , Anatoly Burakov Date: Fri, 30 Jun 2017 17:51:40 +0100 Message-Id: <20170630165140.59594-21-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170630165140.59594-1-ferruh.yigit@intel.com> References: <20170621110651.75299-1-ferruh.yigit@intel.com> <20170630165140.59594-1-ferruh.yigit@intel.com> Subject: [dpdk-dev] [PATCH v9 20/20] ethdev: add control interface support 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" To have the support corresponding kernel module (UNCI) needs to be inserted. If kernel module is not there, application will run as it is without kernel control path support. When UNCI module inserted, running application creates a virtual Linux network interface (dpdk$) per DPDK port. This interface can be used by traditional Linux tools. If Userspace Network Control Interface (UNCI) kernel module (rte_unci.ko) inserted, virtual interfaces created for each DPDK port for control purposes. Created interfaces are named as dpdk#, like: $ ifconfig dpdk0; ifconfig dpdk1 dpdk0: flags=4099 mtu 1500 ether 90:e2:ba:0e:49:b9 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 dpdk1: flags=4099 mtu 1500 ether 00:1b:21:76:fa:21 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 Regular Linux commands can be issued on interfaces: $ ethtool -i dpdk0 driver: net_ixgbe version: DPDK 17.08.0-rc0 firmware-version: 0x61bf0001 expansion-rom-version: bus-info: 0000:08:00.1 supports-statistics: no supports-test: no supports-eeprom-access: yes supports-register-dump: yes supports-priv-flags: no Signed-off-by: Ferruh Yigit --- v9: * fix shared build --- drivers/net/Makefile | 4 ++++ lib/librte_ether/rte_ethdev_pci.h | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 35ed8135a..cdabc2349 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -39,6 +39,10 @@ endif core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether core-libs += librte_net librte_kvargs +ifeq ($(CONFIG_RTE_LIBRTE_CTRL_IF),y) +core-libs += librte_ctrl_if +endif + DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet DEPDIRS-af_packet = $(core-libs) DIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark diff --git a/lib/librte_ether/rte_ethdev_pci.h b/lib/librte_ether/rte_ethdev_pci.h index 69aab03fb..278c0301f 100644 --- a/lib/librte_ether/rte_ethdev_pci.h +++ b/lib/librte_ether/rte_ethdev_pci.h @@ -38,6 +38,13 @@ #include #include +#ifdef RTE_LIBRTE_CTRL_IF +#include +#else +#define rte_eth_control_interface_create_one(port_id) do { } while (0) +#define rte_eth_control_interface_destroy_one(port_id) do { } while (0) +#endif + /** * Copy pci device info to the Ethernet device data. * @@ -157,8 +164,12 @@ rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev, RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL); ret = dev_init(eth_dev); - if (ret) + if (ret) { rte_eth_dev_pci_release(eth_dev); + return ret; + } + + rte_eth_control_interface_create_one(eth_dev->data->port_id); return ret; } @@ -179,6 +190,8 @@ rte_eth_dev_pci_generic_remove(struct rte_pci_device *pci_dev, if (!eth_dev) return -ENODEV; + rte_eth_control_interface_destroy_one(eth_dev->data->port_id); + if (dev_uninit) { ret = dev_uninit(eth_dev); if (ret)