Userspace Network Control Interface (UNCI), (formerly KCP). When a NIC bound to the DPDK, it can't be controlled by Linux tools.
This patch creates a virtual network interface for each DPDK port, initial target is to get some data from those interfaces, in next step target is to control DPDK ports using virtual interfaces. KNI control path already provides this capability and this work is based on KNI, but current KNI only supports some devices and requires application changes. UNCI is improved KNI control related part. Control messages to the virtual interface moved to the underlying PMD and response moved back to Linux: +-------+ | dpdk0 | +---^---+ | | netlink v +-------------------+ | control interface | +--------------+ | +------------+ | | | ethtool lib| | | +------------+ +----+ +-------------------+ | ethdev | +-------------------+ | +---------+ | Any PMD | +---------+ First patch in the set is moving DPDK ethtool library from sample application folder to the lib. This library provides ethtool commands on top of ethdev library. Second patch introduces a control library, which gets some commands via netlink and converts these into ethtool or ethdev APIs. A background thread created to listen commands. Third patch implements a kernel module, similar to KNI, which is a simple virtual network driver with netlink communication capability. This driver pass through all control commands to userspace via netlink. Forth patch adds control interface create and destroy APIs for ethdev. This will create Linux interfaces automatically if rte_unci kernel module is inserted. Will work as it is if module is not inserted. The intension is to upstream the Linux kernel module, please provide comments to make it ready for upstream. Samples: Run testpmd with no extra arguments: "testpmd -- -i" If the rte_unci module inserted two new interfaces will show up: $ ifconfig dpdk0 && ifconfig dpdk1 dpdk0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether 90:e2:ba:0e:49:b8 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=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether 00:1b:21:76:fa:20 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 The MAC address information already get from actual HW. (Interfaces are shown down by default) When data transfer start in testpmd, stats updated accordingly: $ ifconfig dpdk0 && ifconfig dpdk1 dpdk0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether 90:e2:ba:0e:49:b8 txqueuelen 1000 (Ethernet) RX packets 9662125409 bytes 553368167417 (515.3 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 9605125821 bytes 518893560100 (483.2 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 dpdk1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether 00:1b:21:76:fa:20 txqueuelen 1000 (Ethernet) RX packets 9605137856 bytes 552991297017 (515.0 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 9662138670 bytes 518732030928 (483.1 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 Or able to get same data via ethtool: $ ethtool -i dpdk0 driver: net_ixgbe version: DPDK 17.08.0-rc0 firmware-version: 0x61bf0001 expansion-rom-version: bus-info: 0000:08:00.0 supports-statistics: no supports-test: no supports-eeprom-access: yes supports-register-dump: yes supports-priv-flags: no $ ethtool -g dpdk0 Ring parameters for dpdk0: Pre-set maximums: RX: 4096 RX Mini: 0 RX Jumbo: 0 TX: 4096 Current hardware settings: RX: 128 RX Mini: 0 RX Jumbo: 0 TX: 512 Ferruh Yigit (4): ethtool: move from sample folder to lib folder unci: add kernel control path kernel module rte_ctrl_if: add control interface library ethdev: add control interface support MAINTAINERS | 5 + config/common_base | 16 + config/common_linuxapp | 3 + doc/api/doxy-api-index.md | 4 +- doc/api/doxy-api.conf | 2 + doc/guides/prog_guide/ctrl_if_lib.rst | 52 +++ doc/guides/prog_guide/ethtool_lib.rst | 62 ++++ doc/guides/prog_guide/index.rst | 2 + doc/guides/rel_notes/release_17_08.rst | 10 + doc/guides/sample_app_ug/ethtool.rst | 36 +- examples/ethtool/Makefile | 24 +- examples/ethtool/{ethtool-app => }/ethapp.c | 2 +- examples/ethtool/{ethtool-app => }/ethapp.h | 2 +- examples/ethtool/{ethtool-app => }/main.c | 0 lib/Makefile | 4 + lib/librte_ctrl_if/Makefile | 56 +++ lib/librte_ctrl_if/rte_ctrl_ethtool.c | 390 +++++++++++++++++++++ lib/librte_ctrl_if/rte_ctrl_ethtool.h | 54 +++ lib/librte_ctrl_if/rte_ctrl_if.c | 347 ++++++++++++++++++ lib/librte_ctrl_if/rte_ctrl_if.h | 88 +++++ lib/librte_ctrl_if/rte_ctrl_if_version.map | 10 + lib/librte_ctrl_if/rte_nl.c | 291 +++++++++++++++ lib/librte_ctrl_if/rte_nl.h | 48 +++ lib/librte_eal/common/include/rte_log.h | 1 + lib/librte_eal/linuxapp/Makefile | 4 +- lib/librte_eal/linuxapp/eal/Makefile | 1 + .../eal/include/exec-env/rte_unci_common.h | 109 ++++++ lib/librte_eal/linuxapp/unci/Makefile | 54 +++ lib/librte_eal/linuxapp/unci/unci_dev.h | 56 +++ lib/librte_eal/linuxapp/unci/unci_ethtool.c | 293 ++++++++++++++++ lib/librte_eal/linuxapp/unci/unci_net.c | 217 ++++++++++++ lib/librte_eal/linuxapp/unci/unci_nl.c | 220 ++++++++++++ lib/librte_ether/rte_ethdev_pci.h | 15 +- .../ethtool/lib => lib/librte_ethtool}/Makefile | 35 +- .../lib => lib/librte_ethtool}/rte_ethtool.c | 12 - .../lib => lib/librte_ethtool}/rte_ethtool.h | 59 ++-- lib/librte_ethtool/rte_ethtool_version.map | 28 ++ mk/rte.app.mk | 2 + 38 files changed, 2504 insertions(+), 110 deletions(-) create mode 100644 doc/guides/prog_guide/ctrl_if_lib.rst create mode 100644 doc/guides/prog_guide/ethtool_lib.rst rename examples/ethtool/{ethtool-app => }/ethapp.c (99%) rename examples/ethtool/{ethtool-app => }/ethapp.h (96%) rename examples/ethtool/{ethtool-app => }/main.c (100%) create mode 100644 lib/librte_ctrl_if/Makefile create mode 100644 lib/librte_ctrl_if/rte_ctrl_ethtool.c create mode 100644 lib/librte_ctrl_if/rte_ctrl_ethtool.h create mode 100644 lib/librte_ctrl_if/rte_ctrl_if.c create mode 100644 lib/librte_ctrl_if/rte_ctrl_if.h create mode 100644 lib/librte_ctrl_if/rte_ctrl_if_version.map create mode 100644 lib/librte_ctrl_if/rte_nl.c create mode 100644 lib/librte_ctrl_if/rte_nl.h create mode 100644 lib/librte_eal/linuxapp/eal/include/exec-env/rte_unci_common.h create mode 100644 lib/librte_eal/linuxapp/unci/Makefile create mode 100644 lib/librte_eal/linuxapp/unci/unci_dev.h create mode 100644 lib/librte_eal/linuxapp/unci/unci_ethtool.c create mode 100644 lib/librte_eal/linuxapp/unci/unci_net.c create mode 100644 lib/librte_eal/linuxapp/unci/unci_nl.c rename {examples/ethtool/lib => lib/librte_ethtool}/Makefile (74%) rename {examples/ethtool/lib => lib/librte_ethtool}/rte_ethtool.c (97%) rename {examples/ethtool/lib => lib/librte_ethtool}/rte_ethtool.h (91%) create mode 100644 lib/librte_ethtool/rte_ethtool_version.map -- 2.13.0