From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-2.cisco.com (alln-iport-2.cisco.com [173.37.142.89]) by dpdk.org (Postfix) with ESMTP id 95F965693 for ; Mon, 1 Jun 2015 14:42:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=21439; q=dns/txt; s=iport; t=1433162580; x=1434372180; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=WUrD6VbJ0VCHGF2iTmq+mZ4sxp66D42De9i/S71n7cw=; b=gLDQdbR0VVubgRt69FTyyToInlgIaGEqjg8G2cg3BMyC+h5gfXX88zRH eJzS5vZDEPofZ27NgNORC9qyVSVxbfcHjX7lQYFPM+SYgYnc0lvgAwLEz 3+/uOWaCWwPlP6xRQylAKUwzzHGwkXgjLhP2LAr9SIYvQfAFPU8+MQLzd k=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0D9AwC8UmxV/4wNJK1cgxBUXga+UgmBUoV/AoEsOBQBAQEBAQEBgQqEIgEBAQQnEz8MBAIBCBEEAQELFAkHMhQJCAIEAQ0FCIgl1kkBAQEBAQEBAQEBAQEBAQEBAQEBAQEXi0OELSgxBwaDEYEWAQSLVQqHK4Q1hEqCFIEoE44Wh2AjYYEpHIFSb4EDAh4HHIEBAQEB X-IronPort-AV: E=Sophos;i="5.13,532,1427760000"; d="scan'208";a="155146380" Received: from alln-core-7.cisco.com ([173.36.13.140]) by alln-iport-2.cisco.com with ESMTP; 01 Jun 2015 12:42:58 +0000 Received: from xhc-aln-x06.cisco.com (xhc-aln-x06.cisco.com [173.36.12.80]) by alln-core-7.cisco.com (8.14.5/8.14.5) with ESMTP id t51CgvwH002141 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 1 Jun 2015 12:42:57 GMT Received: from xmb-aln-x05.cisco.com ([169.254.11.78]) by xhc-aln-x06.cisco.com ([173.36.12.80]) with mapi id 14.03.0195.001; Mon, 1 Jun 2015 07:42:57 -0500 From: "David Harton (dharton)" To: Liang-Min Larry Wang , "dev@dpdk.org" Thread-Topic: [PATCH 2/2] ethtool: add new library to provide ethtool-alike APIs Thread-Index: AQHQmnDpYoXp7RgIMUaTOHUL+OZ8Pp2Xm39Q Date: Mon, 1 Jun 2015 12:42:56 +0000 Message-ID: References: <1432946276-9424-1-git-send-email-liang-min.wang@intel.com> <1432946276-9424-3-git-send-email-liang-min.wang@intel.com> In-Reply-To: <1432946276-9424-3-git-send-email-liang-min.wang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.82.245.115] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 2/2] ethtool: add new library to provide ethtool-alike APIs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jun 2015 12:43:00 -0000 Acked-by: David Harton (dharton) > -----Original Message----- > From: Liang-Min Larry Wang [mailto:liang-min.wang@intel.com] > Sent: Friday, May 29, 2015 8:38 PM > To: dev@dpdk.org > Cc: bruce.richardson@intel.com; konstantin.ananyev@intel.com; David Harto= n > (dharton); Andrew Harvey (agh); Liang-Min Larry Wang > Subject: [PATCH 2/2] ethtool: add new library to provide ethtool-alike > APIs >=20 > adding a new library based upon ethdev APIs to provide API's that bear > the same functionality as ethtool_ops (linux/ethtool.h) and net_device_op= s > (linux/netdevice.h). >=20 > Signed-off-by: Liang-Min Larry Wang > --- > MAINTAINERS | 4 + > config/common_linuxapp | 5 + > lib/Makefile | 1 + > lib/librte_ethtool/Makefile | 56 +++++++ > lib/librte_ethtool/rte_ethtool.c | 155 +++++++++++++++++ > lib/librte_ethtool/rte_ethtool.h | 257 > +++++++++++++++++++++++++++++ > lib/librte_ethtool/rte_ethtool_version.map | 18 ++ > mk/rte.app.mk | 1 + > 8 files changed, 497 insertions(+) > create mode 100644 lib/librte_ethtool/Makefile > create mode 100644 lib/librte_ethtool/rte_ethtool.c > create mode 100644 lib/librte_ethtool/rte_ethtool.h > create mode 100644 lib/librte_ethtool/rte_ethtool_version.map >=20 > diff --git a/MAINTAINERS b/MAINTAINERS > index 9362c19..b8b481f 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -186,6 +186,10 @@ M: Thomas Monjalon > F: lib/librte_ether/ > F: scripts/test-null.sh >=20 > +Ethtool API > +M: Liang-Min Larry Wang > +F: lib/librte_ethtool/ > + >=20 > Drivers > ------- > diff --git a/config/common_linuxapp b/config/common_linuxapp > index 0078dc9..f5759fd 100644 > --- a/config/common_linuxapp > +++ b/config/common_linuxapp > @@ -129,6 +129,11 @@ CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=3Dy > CONFIG_RTE_LIBRTE_KVARGS=3Dy >=20 > # > +# Compile user-space ethtool library > +# > +CONFIG_RTE_LIBRTE_ETHTOOL=3Dy > + > +# > # Compile generic ethernet library > # > CONFIG_RTE_LIBRTE_ETHER=3Dy > diff --git a/lib/Makefile b/lib/Makefile > index 5f480f9..a6c7375 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -41,6 +41,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_TIMER) +=3D librte_timer > DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) +=3D librte_cfgfile > DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) +=3D librte_cmdline > DIRS-$(CONFIG_RTE_LIBRTE_ETHER) +=3D librte_ether > +DIRS-$(CONFIG_RTE_LIBRTE_ETHTOOL) +=3D librte_ethtool > DIRS-$(CONFIG_RTE_LIBRTE_VHOST) +=3D librte_vhost > DIRS-$(CONFIG_RTE_LIBRTE_HASH) +=3D librte_hash > DIRS-$(CONFIG_RTE_LIBRTE_LPM) +=3D librte_lpm > diff --git a/lib/librte_ethtool/Makefile b/lib/librte_ethtool/Makefile > new file mode 100644 > index 0000000..1d981f6 > --- /dev/null > +++ b/lib/librte_ethtool/Makefile > @@ -0,0 +1,56 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without > +# modification, are permitted provided that the following conditions > +# are met: > +# > +# * Redistributions of source code must retain the above copyright > +# notice, this list of conditions and the following disclaimer. > +# * Redistributions in binary form must reproduce the above copyrigh= t > +# notice, this list of conditions and the following disclaimer in > +# the documentation and/or other materials provided with the > +# distribution. > +# * Neither the name of Intel Corporation nor the names of its > +# contributors may be used to endorse or promote products derived > +# from this software without specific prior written permission. > +# > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FO= R > +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL= , > +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE= , > +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON AN= Y > +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE US= E > +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + > +include $(RTE_SDK)/mk/rte.vars.mk > + > +# > +# library name > +# > +LIB =3D librte_ethtool.a > + > +CFLAGS +=3D -O3 > +CFLAGS +=3D $(WERROR_FLAGS) > + > +EXPORT_MAP :=3D rte_ethtool_version.map > + > +LIBABIVER :=3D 1 > + > +SRCS-y +=3D rte_ethtool.c > + > +# > +# Export include files > +# > +SYMLINK-y-include +=3D rte_ethtool.h > + > +# this lib depends upon: > +DEPDIRS-y +=3D lib/librte_ether > + > +include $(RTE_SDK)/mk/rte.lib.mk > diff --git a/lib/librte_ethtool/rte_ethtool.c > b/lib/librte_ethtool/rte_ethtool.c > new file mode 100644 > index 0000000..2ccf06f > --- /dev/null > +++ b/lib/librte_ethtool/rte_ethtool.c > @@ -0,0 +1,155 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above > copyright > + * notice, this list of conditions and the following disclaimer in > + * the documentation and/or other materials provided with the > + * distribution. > + * * Neither the name of Intel Corporation nor the names of its > + * contributors may be used to endorse or promote products derived > + * from this software without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS > FOR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGH= T > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF > USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON > ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE > USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE= . > + */ > +#include > +#include > +#include > +#include > +#include > +#include "rte_ethtool.h" > + > +int > +rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo= ) > +{ > + struct rte_eth_dev_info dev_info; > + > + memset(&dev_info, 0, sizeof(dev_info)); > + rte_eth_dev_info_get(port_id, &dev_info); > + > + snprintf(drvinfo->driver, sizeof(drvinfo->driver), "%s", > + dev_info.driver_name); > + snprintf(drvinfo->version, sizeof(drvinfo->version), "%s", > + rte_version()); > + snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), > + "%04x:%02x:%02x.%x", > + dev_info.pci_dev->addr.domain, dev_info.pci_dev->addr.bus, > + dev_info.pci_dev->addr.devid, dev_info.pci_dev- > >addr.function); > + > + drvinfo->n_stats =3D sizeof(struct rte_eth_stats) / sizeof(uint64_t); > + drvinfo->testinfo_len =3D 0; > + > + return 0; > +} > + > +int > +rte_ethtool_get_link(uint8_t port_id) > +{ > + struct rte_eth_link link; > + > + rte_eth_link_get(port_id, &link); > + return link.link_status; > +} > + > +int > +rte_ethtool_net_open(uint8_t port_id) > +{ > + rte_eth_dev_stop(port_id); > + > + return rte_eth_dev_start(port_id); > +} > + > +int > +rte_ethtool_net_stop(uint8_t port_id) > +{ > + rte_eth_dev_stop(port_id); > + > + return 0; > +} > + > +int > +rte_ethtool_net_get_mac_addr(uint8_t port_id, struct ether_addr *addr) > +{ > + rte_eth_macaddr_get(port_id, addr); > + > + return 0; > +} > + > +int > +rte_ethtool_net_set_mac_addr(uint8_t port_id, struct ether_addr *addr) > +{ > + return rte_eth_dev_default_mac_addr_set(port_id, addr); > +} > + > +int > +rte_ethtool_net_validate_addr(uint8_t port_id __rte_unused, > + struct ether_addr *addr) > +{ > + return is_valid_assigned_ether_addr(addr); > +} > + > +int > +rte_ethtool_net_set_config(uint8_t port_id, void *config __rte_unused) > +{ > + struct rte_eth_link link; > + > + memset(&link, 0, sizeof(link)); > + rte_eth_link_get(port_id, &link); > + if (link.link_status =3D=3D 1) > + return -EINVAL; > + return 0; > +} > + > +int > +rte_ethtool_net_change_mtu(uint8_t port_id, int mtu) > +{ > + return rte_eth_dev_set_mtu(port_id, (uint16_t)mtu); > +} > + > +int > +rte_ethtool_net_get_stats64(uint8_t port_id, struct rte_eth_stats *stats= ) > +{ > + return rte_eth_stats_get(port_id, stats); > +} > + > +int > +rte_ethtool_net_vlan_rx_add_vid(uint8_t port_id, uint16_t vid) > +{ > + return rte_eth_dev_vlan_filter(port_id, vid, 1); > +} > + > +int > +rte_ethtool_net_vlan_rx_kill_vid(uint8_t port_id, uint16_t vid) > +{ > + return rte_eth_dev_vlan_filter(port_id, vid, 0); > +} > + > +int > +rte_ethtool_net_set_rx_mode(uint8_t port_id __rte_unused) > +{ > + /* > + * The set_rx_mode op is part of pmd driver start operation, and > + * the ethdev api maintains software configuration parameters and > under- > + * line hardware states consistent, so no operation is needed for > + * rte_ethtool_net_set_rx_mode(). > + */ > + return 0; > +} > diff --git a/lib/librte_ethtool/rte_ethtool.h > b/lib/librte_ethtool/rte_ethtool.h > new file mode 100644 > index 0000000..cb68d94 > --- /dev/null > +++ b/lib/librte_ethtool/rte_ethtool.h > @@ -0,0 +1,257 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above > copyright > + * notice, this list of conditions and the following disclaimer in > + * the documentation and/or other materials provided with the > + * distribution. > + * * Neither the name of Intel Corporation nor the names of its > + * contributors may be used to endorse or promote products derived > + * from this software without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS > FOR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGH= T > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF > USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON > ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE > USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE= . > + */ > + > +#ifndef _RTE_ETHTOOL_H_ > +#define _RTE_ETHTOOL_H_ > + > +/* > + * This new interface is designed to provide a user-space shim layer for > + * Ethtool and Netdevice op API. > + * > + * rte_ethtool_get_driver: ethtool_ops::get_driverinfo > + * rte_ethtool_get_link: ethtool_ops::get_link > + * > + * rte_ethtool_net_open: net_device_ops::ndo_open > + * rte_ethtool_net_stop: net_device_ops::ndo_stop > + * rte_ethtool_net_set_mac_addr: net_device_ops::ndo_set_mac_address > + * rte_ethtool_net_validate_addr: net_device_ops::ndo_validate_addr > + * rte_ethtool_net_set_config: net_device_ops::ndo_set_config > + * rte_ethtool_net_change_mtu: net_device_ops::ndo_net_change_mtu > + * rte_ethtool_net_get_stats64: net_device_ops::ndo_get_stats64 > + * rte_ethtool_net_vlan_rx_add_vid net_device_ops::ndo_vlan_rx_add_vid > + * rte_ethtool_net_vlan_rx_kill_vid net_device_ops::ndo_vlan_rx_kill_vid > + * rte_ethtool_net_set_rx_mode net_device_ops::ndo_set_rx_mode > + * > + */ > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +#include > +#include > +#include > + > +/** > + * Retrieve the Ethernet device driver information according to > attributes described by > + * ethtool data structure, ethtool_drvinfo > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param drvinfo > + * A pointer to get driver information > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo > *drvinfo); > + > +/** > + * Retrieve the Ethernet device link status > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @return > + * - (1) if link up. > + * - (0) if link down. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_get_link(uint8_t port_id); > + > +/** > + * Start the Ethernet device. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_net_open(uint8_t port_id); > + > +/** > + * Stop the Ethernet device. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_net_stop(uint8_t port_id); > + > +/** > + * Get the Ethernet device MAC address. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param addr > + * MAC address of the Ethernet device. > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_net_get_mac_addr(uint8_t port_id, struct ether_addr > *addr); > + > +/** > + * Setting the Ethernet device MAC address. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param addr > + * The new MAC addr. > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_net_set_mac_addr(uint8_t port_id, struct ether_addr > *addr); > + > +/** > + * Validate if the provided MAC address is valid unicast address > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param addr > + * A pointer to a buffer (6-byte, 48bit) for the target MAC address > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_net_validate_addr(uint8_t port_id, struct ether_addr > *addr); > + > +/** > + * Setting the Ethernet device configuration. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param config > + * A opintr to a configuration parameter. > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_net_set_config(uint8_t port_id, void *config); > + > +/** > + * Setting the Ethernet device maximum Tx unit. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param mtu > + * New MTU > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_net_change_mtu(uint8_t port_id, int mtu); > + > +/** > + * Retrieve the Ethernet device traffic statistics > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param stats > + * A pointer to struct rte_eth_stats for statistics parameters > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_net_get_stats64(uint8_t port_id, struct rte_eth_stats > *stats); > + > +/** > + * Update the Ethernet device VLAN filter with new vid > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param vid > + * A new VLAN id > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_net_vlan_rx_add_vid(uint8_t port_id, uint16_t vid); > + > +/** > + * Remove VLAN id from Ethernet device. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param vid > + * A new VLAN id > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_net_vlan_rx_kill_vid(uint8_t port_id, uint16_t vid); > + > +/** > + * Setting the Ethernet device rx mode. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if hardware doesn't support. > + * - (-ENODEV) if *port_id* invalid. > + * - others depends on the specific operations implementation. > + */ > +int rte_ethtool_net_set_rx_mode(uint8_t port_id); > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _RTE_ETHTOOL_H_ */ > diff --git a/lib/librte_ethtool/rte_ethtool_version.map > b/lib/librte_ethtool/rte_ethtool_version.map > new file mode 100644 > index 0000000..82fc0d3 > --- /dev/null > +++ b/lib/librte_ethtool/rte_ethtool_version.map > @@ -0,0 +1,18 @@ > +DPDK_2.0 { > + global: > + > + rte_ethtool_net_open; > + rte_ethtool_net_stop; > + rte_ethtool_net_get_mac_addr; > + rte_ethtool_net_get_mac_addr; > + rte_ethtool_net_validate_addr; > + rte_ethtool_net_set_config; > + rte_ethtool_net_change_mtu; > + rte_ethtool_net_get_stats64; > + rte_ethtool_net_vlan_rx_add_vid; > + rte_ethtool_net_vlan_rx_kill_vid; > + rte_ethtool_get_drvinfo; > + rte_ethtool_get_link; > + > + local: *; > +}; > diff --git a/mk/rte.app.mk b/mk/rte.app.mk > index 1a2043a..86867a6 100644 > --- a/mk/rte.app.mk > +++ b/mk/rte.app.mk > @@ -105,6 +105,7 @@ ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n) > _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS) +=3D -lrte_kvargs > _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF) +=3D -lrte_mbuf > _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) +=3D -lrte_ip_frag > +_LDLIBS-$(CONFIG_RTE_LIBRTE_ETHTOOL) +=3D -lrte_ethtool > _LDLIBS-$(CONFIG_RTE_LIBRTE_ETHER) +=3D -lethdev > _LDLIBS-$(CONFIG_RTE_LIBRTE_MALLOC) +=3D -lrte_malloc > _LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=3D -lrte_mempool > -- > 2.1.4