net/ark: PMD for Atomic Rules Arkville driver stub
PATCH v3 1/7 net/ark: PMD for Atomic Rules Arkville driver stub
Enable Arkville on supported configurations
Add overview documentation
Minimum driver support for valid compile
--- MAINTAINERS | 8 + config/common_base | 11 ++ config/defconfig_arm-armv7a-linuxapp-gcc | 1 + config/defconfig_ppc_64-power8-linuxapp-gcc | 1 + doc/guides/nics/ark.rst | 237 +++++++++++++++++++++++ doc/guides/nics/features/ark.ini | 15 ++ doc/guides/nics/index.rst | 1 + drivers/net/Makefile | 1 + drivers/net/ark/Makefile | 63 +++++++ drivers/net/ark/ark_debug.h | 74 ++++++++ drivers/net/ark/ark_ethdev.c | 281 ++++++++++++++++++++++++++++ drivers/net/ark/ark_ethdev.h | 39 ++++ drivers/net/ark/ark_global.h | 108 +++++++++++ drivers/net/ark/rte_pmd_ark_version.map | 4 + mk/rte.app.mk | 1 + 15 files changed, 845 insertions(+) create mode 100644 doc/guides/nics/ark.rst create mode 100644 doc/guides/nics/features/ark.ini create mode 100644 drivers/net/ark/Makefile create mode 100644 drivers/net/ark/ark_debug.h create mode 100644 drivers/net/ark/ark_ethdev.c create mode 100644 drivers/net/ark/ark_ethdev.h create mode 100644 drivers/net/ark/ark_global.h create mode 100644 drivers/net/ark/rte_pmd_ark_version.map
MAINTAINERS +8 -0
@@ -278,6 +278,14 @@ M: Evgeny Schemeilin <[email protected]> F: drivers/net/ena/ F: doc/guides/nics/ena.rst +Atomic Rules ark +M: Shepard Siegel <[email protected]> +M: Ed Czeck <[email protected]> +M: John Miller <[email protected]> +F: /drivers/net/ark/ +F: doc/guides/nics/ark.rst +F: doc/guides/nics/features/ark.ini + Broadcom bnxt M: Stephen Hurd <[email protected]> M: Ajit Khaparde <[email protected]>
config/common_base +11 -0
@@ -353,6 +353,17 @@ CONFIG_RTE_LIBRTE_QEDE_FW="" CONFIG_RTE_LIBRTE_PMD_AF_PACKET=n # +# Compile ARK PMD +# +CONFIG_RTE_LIBRTE_ARK_PMD=y +CONFIG_RTE_LIBRTE_ARK_PAD_TX=y +CONFIG_RTE_LIBRTE_ARK_DEBUG_RX=n +CONFIG_RTE_LIBRTE_ARK_DEBUG_TX=n +CONFIG_RTE_LIBRTE_ARK_DEBUG_STATS=n +CONFIG_RTE_LIBRTE_ARK_DEBUG_TRACE=n + + +# # Compile the TAP PMD # It is enabled by default for Linux only. #
config/defconfig_arm-armv7a-linuxapp-gcc +1 -0
@@ -61,6 +61,7 @@ CONFIG_RTE_SCHED_VECTOR=n # cannot use those on ARM CONFIG_RTE_KNI_KMOD=n +CONFIG_RTE_LIBRTE_ARK_PMD=n CONFIG_RTE_LIBRTE_EM_PMD=n CONFIG_RTE_LIBRTE_IGB_PMD=n CONFIG_RTE_LIBRTE_CXGBE_PMD=n
config/defconfig_ppc_64-power8-linuxapp-gcc +1 -0
@@ -48,6 +48,7 @@ CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=n # Note: Initially, all of the PMD drivers compilation are turned off on Power # Will turn on them only after the successful testing on Power +CONFIG_RTE_LIBRTE_ARK_PMD=n CONFIG_RTE_LIBRTE_IXGBE_PMD=n CONFIG_RTE_LIBRTE_I40E_PMD=n CONFIG_RTE_LIBRTE_VIRTIO_PMD=y
doc/guides/nics/ark.rst new file +237 -0
237 lines not on this page · raw message
doc/guides/nics/features/ark.ini new file +15 -0
@@ -0,0 +1,15 @@ +; +; Supported features of the 'ark' poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Queue start/stop = Y +Jumbo frame = Y +Scattered Rx = Y +Basic stats = Y +Stats per queue = Y +FW version = Y +Linux UIO = Y +x86-64 = Y +Usage doc = Y
doc/guides/nics/index.rst +1 -0
@@ -36,6 +36,7 @@ Network Interface Controller Drivers :numbered: overview + ark bnx2x bnxt cxgbe
drivers/net/Makefile +1 -0
@@ -32,6 +32,7 @@ include $(RTE_SDK)/mk/rte.vars.mk DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet +DIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark DIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += bonding DIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe
drivers/net/ark/Makefile new file +63 -0
63 lines not on this page · raw message
drivers/net/ark/ark_debug.h new file +74 -0
74 lines not on this page · raw message
drivers/net/ark/ark_ethdev.c new file +281 -0
281 lines not on this page · raw message
drivers/net/ark/ark_ethdev.h new file +39 -0
@@ -0,0 +1,39 @@ +/*- +* BSD LICENSE +* +* Copyright (c) 2015-2017 Atomic Rules LLC +* 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 copyright holder 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 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 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 _ARK_ETHDEV_H_ +#define _ARK_ETHDEV_H_ + +/* STUB */ + +#endif
drivers/net/ark/ark_global.h new file +108 -0
108 lines not on this page · raw message
drivers/net/ark/rte_pmd_ark_version.map new file +4 -0
@@ -0,0 +1,4 @@ +DPDK_2.0 { + local: *; + +};
mk/rte.app.mk +1 -0
@@ -104,6 +104,7 @@ ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) # plugins (link only if static libraries) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet +_LDLIBS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += -lrte_pmd_ark _LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x -lz _LDLIBS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += -lrte_pmd_bnxt _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond
Signature · 1 line
1.9.1
PATCH v3 2/7 net/ark: HW API part 1 of 3
Provide C-level interface for Arkville's internal HW resources mpu, pktdir, and rqp modules
--- drivers/net/ark/Makefile | 3 + drivers/net/ark/ark_mpu.c | 181 +++++++++++++++++++++++++++++++++++++++++++ drivers/net/ark/ark_mpu.h | 143 ++++++++++++++++++++++++++++++++++ drivers/net/ark/ark_pktdir.c | 83 ++++++++++++++++++++ drivers/net/ark/ark_pktdir.h | 68 ++++++++++++++++ drivers/net/ark/ark_rqp.c | 91 ++++++++++++++++++++++ drivers/net/ark/ark_rqp.h | 75 ++++++++++++++++++ 7 files changed, 644 insertions(+) create mode 100644 drivers/net/ark/ark_mpu.c create mode 100644 drivers/net/ark/ark_mpu.h create mode 100644 drivers/net/ark/ark_pktdir.c create mode 100644 drivers/net/ark/ark_pktdir.h create mode 100644 drivers/net/ark/ark_rqp.c create mode 100644 drivers/net/ark/ark_rqp.h
drivers/net/ark/Makefile +3 -0
@@ -48,6 +48,9 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_pktdir.c +SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_mpu.c +SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_rqp.c # this lib depends upon:
drivers/net/ark/ark_mpu.c new file +181 -0
181 lines not on this page · raw message
drivers/net/ark/ark_mpu.h new file +143 -0
143 lines not on this page · raw message
drivers/net/ark/ark_pktdir.c new file +83 -0
83 lines not on this page · raw message
drivers/net/ark/ark_pktdir.h new file +68 -0
68 lines not on this page · raw message
drivers/net/ark/ark_rqp.c new file +91 -0
91 lines not on this page · raw message
drivers/net/ark/ark_rqp.h new file +75 -0
75 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 3/7 net/ark: HW API part 2 of 3
In reply to Ed CzeckProvide C-level interface for Arkville's internal HW resources ddm and udm modules
--- drivers/net/ark/Makefile | 2 + drivers/net/ark/ark_ddm.c | 151 +++++++++++++++++++++++++++++++ drivers/net/ark/ark_ddm.h | 154 +++++++++++++++++++++++++++++++ drivers/net/ark/ark_udm.c | 226 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/net/ark/ark_udm.h | 184 +++++++++++++++++++++++++++++++++++++ 5 files changed, 717 insertions(+) create mode 100644 drivers/net/ark/ark_ddm.c create mode 100644 drivers/net/ark/ark_ddm.h create mode 100644 drivers/net/ark/ark_udm.c create mode 100644 drivers/net/ark/ark_udm.h
drivers/net/ark/Makefile +2 -0
@@ -50,6 +50,8 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_pktdir.c SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_mpu.c +SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_ddm.c +SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_udm.c SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_rqp.c
drivers/net/ark/ark_ddm.c new file +151 -0
151 lines not on this page · raw message
drivers/net/ark/ark_ddm.h new file +154 -0
154 lines not on this page · raw message
drivers/net/ark/ark_udm.c new file +226 -0
226 lines not on this page · raw message
drivers/net/ark/ark_udm.h new file +184 -0
184 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 4/7 net/ark: HW API part 3 of 3
In reply to Ed CzeckProvide C-level interface for Arkville's internal HW resources pktgen and pktchk modules
--- drivers/net/ark/Makefile | 2 + drivers/net/ark/ark_pktchkr.c | 472 ++++++++++++++++++++++++++++++++++++++++ drivers/net/ark/ark_pktchkr.h | 114 ++++++++++ drivers/net/ark/ark_pktgen.c | 491 ++++++++++++++++++++++++++++++++++++++++++ drivers/net/ark/ark_pktgen.h | 106 +++++++++ 5 files changed, 1185 insertions(+) create mode 100644 drivers/net/ark/ark_pktchkr.c create mode 100644 drivers/net/ark/ark_pktchkr.h create mode 100644 drivers/net/ark/ark_pktgen.c create mode 100644 drivers/net/ark/ark_pktgen.h
drivers/net/ark/Makefile +2 -0
@@ -48,6 +48,8 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_pktgen.c +SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_pktchkr.c SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_pktdir.c SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_mpu.c SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_ddm.c
drivers/net/ark/ark_pktchkr.c new file +472 -0
472 lines not on this page · raw message
drivers/net/ark/ark_pktchkr.h new file +114 -0
114 lines not on this page · raw message
drivers/net/ark/ark_pktgen.c new file +491 -0
491 lines not on this page · raw message
drivers/net/ark/ark_pktgen.h new file +106 -0
106 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 5/7 net/ark: Packet TX support initial version
In reply to Ed Czeck* Core TX packet moving functions
* Flesh out ark_adapter struct to support TX code
(not all fields used at this patch
--- drivers/net/ark/Makefile | 1 + drivers/net/ark/ark_ethdev.c | 14 ++ drivers/net/ark/ark_ethdev.h | 2 +- drivers/net/ark/ark_ethdev_tx.c | 501 ++++++++++++++++++++++++++++++++++++++++ drivers/net/ark/ark_ethdev_tx.h | 62 +++++ drivers/net/ark/ark_global.h | 28 +++ 6 files changed, 607 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ark/ark_ethdev_tx.c create mode 100644 drivers/net/ark/ark_ethdev_tx.h
drivers/net/ark/Makefile +1 -0
@@ -48,6 +48,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_ethdev_tx.c SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_pktgen.c SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_pktchkr.c SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_pktdir.c
drivers/net/ark/ark_ethdev.c +14 -0
@@ -98,6 +98,20 @@ static void eth_ark_dev_info_get(struct rte_eth_dev *dev, }; +int +ark_get_port_id (struct rte_eth_dev *dev,struct ark_adapter *ark) +{ +int n = ark->num_ports; +int i; + +/* There has to be a smarter way to do this ... */ +for (i =0 ; i < n; i++) { +if (ark->port[i].eth_dev == dev) +return i; + } +ARK_DEBUG_TRACE ("ARK: Device is NOT associated with a port !!" ); +return -1 ; +}static int eth_ark_dev_init(struct rte_eth_dev *dev __rte_unused)
drivers/net/ark/ark_ethdev.h +1 -1
@@ -34,6 +34,6 @@#ifndef _ARK_ETHDEV_H_#define _ARK_ETHDEV_H_ -/* STUB */ +int ark_get_port_id (struct rte_eth_dev *dev,struct ark_adapter *ark);#endif
drivers/net/ark/ark_ethdev_tx.c new file +501 -0
501 lines not on this page · raw message
drivers/net/ark/ark_ethdev_tx.h new file +62 -0
62 lines not on this page · raw message
drivers/net/ark/ark_global.h +28 -0
@@ -47,6 +47,10 @@#include <rte_dev.h> #include <rte_version.h> +#include "ark_pktdir.h" +#include "ark_pktgen.h" +#include "ark_pktchkr.h" +#define ETH_ARK_ARG_MAXLEN 64#define ARK_SYSCTRL_BASE 0x0#define ARK_PKTGEN_BASE 0x10000
@@ -88,6 +92,12 @@ struct ark_adapter {/* User extension private data */ void *user_data; +/* Pointers to packet generator and checker */ +int start_pg; +ark_pkt_gen_t pg; +ark_pkt_chkr_t pc; +ark_pkt_dir_t pd; +struct ark_port port[ARK_MAX_PORTS ];int num_ports;
@@ -101,6 +111,24 @@ struct ark_adapter {/* Application Bar */ uint8_t *a_bar; + +/* Arkville demo block offsets */ +def_ptr (sys_ctrl, sysctrl); +def_ptr (pkt_gen, pktgen); +def_ptr (mpu_rx, mpurx); +def_ptr (UDM , udm); +def_ptr (mpu_tx, mputx); +def_ptr (DDM , ddm); +def_ptr (CMAC , cmac); +def_ptr (external, external); +def_ptr (pkt_dir, pktdir); +def_ptr (pkt_chkr, pktchkr); + +int started; +uint16_t rx_queues; +uint16_t tx_queues; + +struct ark_rqpace_t *rqpacing; };typedef uint32_t *ark_t ;
Signature · 1 line
1.9.1
PATCH v3 6/7 net/ark: Packet RX support initial version
In reply to Ed Czeck* Core RX packet moving functions
--- drivers/net/ark/Makefile | 1 + drivers/net/ark/ark_ethdev_rx.c | 681 ++++++++++++++++++++++++++++++++++++++++ drivers/net/ark/ark_ethdev_rx.h | 67 ++++ 3 files changed, 749 insertions(+) create mode 100644 drivers/net/ark/ark_ethdev_rx.c create mode 100644 drivers/net/ark/ark_ethdev_rx.h
drivers/net/ark/Makefile +1 -0
@@ -48,6 +48,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_ethdev_rx.c SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_ethdev_tx.c SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_pktgen.c SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_pktchkr.c
drivers/net/ark/ark_ethdev_rx.c new file +681 -0
681 lines not on this page · raw message
drivers/net/ark/ark_ethdev_rx.h new file +67 -0
67 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 7/7 net/ark: Arkville PMD component integration
In reply to Ed Czeck* Flesh out device configuration
* Add links dev_ops
* allow dynamic extension loading
--- drivers/net/ark/ark_ethdev.c | 737 ++++++++++++++++++++++++++++++++++++++++++- drivers/net/ark/ark_ext.h | 79 +++++ drivers/net/ark/ark_global.h | 23 ++ 3 files changed, 836 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ark/ark_ext.h
drivers/net/ark/ark_ethdev.c +734 -3
@@ -41,15 +41,42 @@#include "ark_global.h" #include "ark_debug.h" #include "ark_ethdev.h" +#include "ark_ethdev_tx.h" +#include "ark_ethdev_rx.h" +#include "ark_mpu.h" +#include "ark_ddm.h" +#include "ark_udm.h" +#include "ark_rqp.h" +#include "ark_pktdir.h" +#include "ark_pktgen.h" +#include "ark_pktchkr.h" /* Internal prototypes */ static int eth_ark_check_args (const char *params);static int eth_ark_dev_init (struct rte_eth_dev *dev); +static int ark_config_device (struct rte_eth_dev *dev);static int eth_ark_dev_uninit (struct rte_eth_dev *eth_dev);static int eth_ark_dev_configure (struct rte_eth_dev *dev); +static int eth_ark_dev_start (struct rte_eth_dev *dev); +static void eth_ark_dev_stop (struct rte_eth_dev *dev); +static void eth_ark_dev_close (struct rte_eth_dev *dev);static void eth_ark_dev_info_get (struct rte_eth_dev *dev,struct rte_eth_dev_info *dev_info); - +static int eth_ark_dev_link_update (struct rte_eth_dev *dev, +int wait_to_complete); +static int eth_ark_dev_set_link_up (struct rte_eth_dev *dev); +static int eth_ark_dev_set_link_down (struct rte_eth_dev *dev); +static void eth_ark_dev_stats_get (struct rte_eth_dev *dev, +struct rte_eth_stats *stats); +static void eth_ark_dev_stats_reset (struct rte_eth_dev *dev); +static void eth_ark_set_default_mac_addr (struct rte_eth_dev *dev, +struct ether_addr *mac_addr); +static void eth_ark_macaddr_add (struct rte_eth_dev *dev, +struct ether_addr *mac_addr, +uint32_t index, +uint32_t pool); +static void eth_ark_macaddr_remove (struct rte_eth_dev *dev, +uint32_t index);#define ARK_DEV_TO_PCI (eth_dev) \ RTE_DEV_TO_PCI((eth_dev)->device)
@@ -94,8 +121,33 @@ static void eth_ark_dev_info_get(struct rte_eth_dev *dev,static const struct eth_dev_ops ark_eth_dev_ops = { .dev_configure = eth_ark_dev_configure, + .dev_start = eth_ark_dev_start, + .dev_stop = eth_ark_dev_stop, + .dev_close = eth_ark_dev_close, + .dev_infos_get = eth_ark_dev_info_get, + .rx_queue_setup = eth_ark_dev_rx_queue_setup, + .rx_queue_count = eth_ark_dev_rx_queue_count, + .tx_queue_setup = eth_ark_tx_queue_setup, + + .link_update = eth_ark_dev_link_update, + .dev_set_link_up = eth_ark_dev_set_link_up, + .dev_set_link_down = eth_ark_dev_set_link_down, + + .rx_queue_start = eth_ark_rx_start_queue, + .rx_queue_stop = eth_ark_rx_stop_queue, + + .tx_queue_start = eth_ark_tx_queue_start, + .tx_queue_stop = eth_ark_tx_queue_stop, + + .stats_get = eth_ark_dev_stats_get, + .stats_reset = eth_ark_dev_stats_reset, + + .mac_addr_add = eth_ark_macaddr_add, + .mac_addr_remove = eth_ark_macaddr_remove, + .mac_addr_set = eth_ark_set_default_mac_addr, + };int
@@ -113,22 +165,366 @@ static void eth_ark_dev_info_get(struct rte_eth_dev *dev,return -1 ; } +static +int +check_for_ext(struct rte_eth_dev *dev __rte_unused, + struct ark_adapter *ark __rte_unused) +{ +int found =0 ; + +/* Get the env */ +const char *dllpath =getenv ("ARK_EXT_PATH" ); + +if (dllpath ==NULL ) { +ARK_DEBUG_TRACE ("ARK EXT NO dll path specified\n" ); +return 0 ; + } +ARK_DEBUG_TRACE ("ARK EXT found dll path at %s\n" , dllpath); + +/* Open and load the .so */ + ark->d_handle =dlopen (dllpath,RTLD_LOCAL |RTLD_LAZY ); +if (ark->d_handle ==NULL ) +PMD_DRV_LOG (ERR ,"Could not load user extension %s\n" , dllpath); +else +ARK_DEBUG_TRACE ("SUCCESS: loaded user extension %s\n" , dllpath); + +/* Get the entry points */ + ark->user_ext.dev_init = + (void *(*)(struct rte_eth_dev *,void *,int )) +dlsym (ark->d_handle,"dev_init" ); +ARK_DEBUG_TRACE ("device ext init pointer = %p\n" , + ark->user_ext.dev_init); + ark->user_ext.dev_get_port_count = + (int (*)(struct rte_eth_dev *,void *)) +dlsym (ark->d_handle,"dev_get_port_count" ); + ark->user_ext.dev_uninit = + (void (*)(struct rte_eth_dev *,void *)) +dlsym (ark->d_handle,"dev_uninit" ); + ark->user_ext.dev_configure = + (int (*)(struct rte_eth_dev *,void *)) +dlsym (ark->d_handle,"dev_configure" ); + ark->user_ext.dev_start = + (int (*)(struct rte_eth_dev *,void *)) +dlsym (ark->d_handle,"dev_start" ); + ark->user_ext.dev_stop = + (void (*)(struct rte_eth_dev *,void *)) +dlsym (ark->d_handle,"dev_stop" ); + ark->user_ext.dev_close = + (void (*)(struct rte_eth_dev *,void *)) +dlsym (ark->d_handle,"dev_close" ); + ark->user_ext.link_update = + (int (*)(struct rte_eth_dev *,int ,void *)) +dlsym (ark->d_handle,"link_update" ); + ark->user_ext.dev_set_link_up = + (int (*)(struct rte_eth_dev *,void *)) +dlsym (ark->d_handle,"dev_set_link_up" ); + ark->user_ext.dev_set_link_down = + (int (*)(struct rte_eth_dev *,void *)) +dlsym (ark->d_handle,"dev_set_link_down" ); + ark->user_ext.stats_get = + (void (*)(struct rte_eth_dev *,struct rte_eth_stats *, +void *)) +dlsym (ark->d_handle,"stats_get" ); + ark->user_ext.stats_reset = + (void (*)(struct rte_eth_dev *,void *)) +dlsym (ark->d_handle,"stats_reset" ); + ark->user_ext.mac_addr_add = + (void (*)(struct rte_eth_dev *,struct ether_addr *,uint32_t , +uint32_t ,void *)) +dlsym (ark->d_handle,"mac_addr_add" ); + ark->user_ext.mac_addr_remove = + (void (*)(struct rte_eth_dev *,uint32_t ,void *)) +dlsym (ark->d_handle,"mac_addr_remove" ); + ark->user_ext.mac_addr_set = + (void (*)(struct rte_eth_dev *,struct ether_addr *, +void *)) +dlsym (ark->d_handle,"mac_addr_set" ); + +return found; +} +static int -eth_ark_dev_init(struct rte_eth_dev *dev __rte_unused) +eth_ark_dev_init (struct rte_eth_dev *dev) { -return -1 ;/* STUB */ +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; +struct rte_pci_device *pci_dev; +int ret; + + ark->eth_dev = dev; + +ARK_DEBUG_TRACE ("eth_ark_dev_init(struct rte_eth_dev *dev)\n" ); + gark[0 ] = ark; + +/* Check to see if there is an extension that we need to load */ +check_for_ext (dev, ark); + pci_dev =ARK_DEV_TO_PCI (dev); +rte_eth_copy_pci_info (dev, pci_dev); + +if (pci_dev->device.devargs) +eth_ark_check_args (pci_dev->device.devargs->args); +else +PMD_DRV_LOG (INFO ,"No Device args found\n" ); + +/* Use dummy function until setup */ + dev->rx_pkt_burst = ð_ark_recv_pkts_noop; + dev->tx_pkt_burst = ð_ark_xmit_pkts_noop; + + ark->bar0 = (uint8_t *)pci_dev->mem_resource[0 ].addr; + ark->a_bar = (uint8_t *)pci_dev->mem_resource[2 ].addr; + + ark->sysctrl.v = (void *)&ark->bar0[ARK_SYSCTRL_BASE ]; + ark->mpurx.v = (void *)&ark->bar0[ARK_MPU_RX_BASE ]; + ark->udm.v = (void *)&ark->bar0[ARK_UDM_BASE ]; + ark->mputx.v = (void *)&ark->bar0[ARK_MPU_TX_BASE ]; + ark->ddm.v = (void *)&ark->bar0[ARK_DDM_BASE ]; + ark->cmac.v = (void *)&ark->bar0[ARK_CMAC_BASE ]; + ark->external.v = (void *)&ark->bar0[ARK_EXTERNAL_BASE ]; + ark->pktdir.v = (void *)&ark->bar0[ARK_PKTDIR_BASE ]; + ark->pktgen.v = (void *)&ark->bar0[ARK_PKTGEN_BASE ]; + ark->pktchkr.v = (void *)&ark->bar0[ARK_PKTCHKR_BASE ]; + + ark->rqpacing = + (struct ark_rqpace_t *)(ark->bar0 +ARK_RCPACING_BASE ); + ark->started =0 ; + +ARK_DEBUG_TRACE + ("Sys Ctrl Const = 0x%x HW Commit_ID: %08x\n" , + ark->sysctrl.t32[4 ], +rte_be_to_cpu_32 (ark->sysctrl.t32[0x20 /4 ])); +PMD_DRV_LOG (INFO ,"ARKP PMD HW Commit_ID: %08x\n" , +rte_be_to_cpu_32 (ark->sysctrl.t32[0x20 /4 ])); + +/* If HW sanity test fails, return an error */ +if (ark->sysctrl.t32[4 ] !=0xcafef00d ) { +PMD_DRV_LOG (ERR , +"HW Sanity test has failed, expected constant" +" 0x%x, read 0x%x (%s)\n" , +0xcafef00d , + ark->sysctrl.t32[4 ], __func__); +return -1 ; + } + +PMD_DRV_LOG (INFO , +"HW Sanity test has PASSED, expected constant" +" 0x%x, read 0x%x (%s)\n" , +0xcafef00d , ark->sysctrl.t32[4 ], __func__); + +/* We are a single function multi-port device. */ +const unsigned int numa_node =rte_socket_id (); +struct ether_addr adr; + + ret =ark_config_device (dev); + dev->dev_ops = &ark_eth_dev_ops; + + dev->data->mac_addrs =rte_zmalloc ("ark" ,ETHER_ADDR_LEN ,0 ); +if (!dev->data->mac_addrs) { +PMD_DRV_LOG (ERR , +"Failed to allocated memory for storing mac address" + ); + } +ether_addr_copy ((struct ether_addr *)&adr, &dev->data->mac_addrs[0 ]); + +if (ark->user_ext.dev_init) { + ark->user_data = ark->user_ext.dev_init (dev, ark->a_bar,0 ); +if (!ark->user_data) { +PMD_DRV_LOG (INFO , +"Failed to initialize PMD extension!" +" continuing without it\n" ); +memset (&ark->user_ext,0 ,sizeof (struct ark_user_ext )); +dlclose (ark->d_handle); + } + } + +/* +* We will create additional devices based on the number of requested +* ports +*/ +int pc =1 ; +int p; + +if (ark->user_ext.dev_get_port_count) { + pc = ark->user_ext.dev_get_port_count (dev, ark->user_data); + ark->num_ports = pc; + }else { + ark->num_ports =1 ; + } +for (p =0 ; p < pc; p++) { +struct ark_port *port; + + port = &ark->port[p]; +struct rte_eth_dev_data *data =NULL ; + + port->id = p; + +char name[RTE_ETH_NAME_MAX_LEN ]; + +snprintf (name,sizeof (name),"arketh%d" , + dev->data->port_id + p); + +if (p ==0 ) { +/* First port is already allocated by DPDK */ + port->eth_dev = ark->eth_dev; +continue ; + } + +/* reserve an ethdev entry */ + port->eth_dev =rte_eth_dev_allocate (name); +if (!port->eth_dev) { +PMD_DRV_LOG (ERR , +"Could not allocate eth_dev for port %d\n" , + p); + goto error; + } + + data =rte_zmalloc_socket (name,sizeof (*data),0 , numa_node); +if (!data) { +PMD_DRV_LOG (ERR , +"Could not allocate eth_dev for port %d\n" , + p); + goto error; + } + data->port_id = ark->eth_dev->data->port_id + p; + port->eth_dev->data = data; + port->eth_dev->device = &pci_dev->device; + port->eth_dev->data->dev_private = ark; + port->eth_dev->driver = ark->eth_dev->driver; + port->eth_dev->dev_ops = ark->eth_dev->dev_ops; + port->eth_dev->tx_pkt_burst = ark->eth_dev->tx_pkt_burst; + port->eth_dev->rx_pkt_burst = ark->eth_dev->rx_pkt_burst; + +rte_eth_copy_pci_info (port->eth_dev, pci_dev); + + port->eth_dev->data->mac_addrs = +rte_zmalloc (name,ETHER_ADDR_LEN ,0 ); +if (!port->eth_dev->data->mac_addrs) { +PMD_DRV_LOG (ERR , +"Memory allocation for MAC failed!" +" Exiting.\n" ); + goto error; + } +ether_addr_copy (&adr, + &port->eth_dev->data->mac_addrs[0 ]); + +if (ark->user_ext.dev_init) + ark->user_data = + ark->user_ext.dev_init (dev, ark->a_bar, p); + } + +return ret; + + error: +if (dev->data->mac_addrs) +rte_free (dev->data->mac_addrs); + +for (p =0 ; p < pc; p++) { +if (ark->port[p].eth_dev->data) +rte_free (ark->port[p].eth_dev->data); +if (ark->port[p].eth_dev->data->mac_addrs) +rte_free (ark->port[p].eth_dev->data->mac_addrs); + } + +return -1 ; } +/* +*Initial device configuration when device is opened +* setup the DDM, and UDM +* Called once per PCIE device +*/ +static int +ark_config_device (struct rte_eth_dev *dev) +{ +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; +uint16_t num_q, i; +struct ark_mpu_t *mpu; + +/* +* Make sure that the packet director, generator and checker are in a +* known state +*/ + ark->start_pg =0 ; + ark->pg =ark_pktgen_init (ark->pktgen.v,0 ,1 ); +ark_pktgen_reset (ark->pg); + ark->pc =ark_pktchkr_init (ark->pktchkr.v,0 ,1 ); +ark_pktchkr_stop (ark->pc); + ark->pd =ark_pktdir_init (ark->pktdir.v); + +/* Verify HW */ +if (ark_udm_verify (ark->udm.v)) +return -1 ; +if (ark_ddm_verify (ark->ddm.v)) +return -1 ; + +/* UDM */ +if (ark_udm_reset (ark->udm.v)) { +PMD_DRV_LOG (ERR ,"Unable to stop and reset UDM\n" ); +return -1 ; + } +/* Keep in reset until the MPU are cleared */ + +/* MPU reset */ + mpu = ark->mpurx.v; + num_q =ark_api_num_queues (mpu); + ark->rx_queues = num_q; +for (i =0 ; i < num_q; i++) { +ark_mpu_reset (mpu); + mpu =RTE_PTR_ADD (mpu,ARK_MPU_QOFFSET ); + } + +ark_udm_stop (ark->udm.v,0 ); +ark_udm_configure (ark->udm.v, +RTE_PKTMBUF_HEADROOM , +RTE_MBUF_DEFAULT_DATAROOM , +ARK_RX_WRITE_TIME_NS ); +ark_udm_stats_reset (ark->udm.v); +ark_udm_stop (ark->udm.v,0 ); + +/* TX -- DDM */ +if (ark_ddm_stop (ark->ddm.v,1 )) +PMD_DRV_LOG (ERR ,"Unable to stop DDM\n" ); + + mpu = ark->mputx.v; + num_q =ark_api_num_queues (mpu); + ark->tx_queues = num_q; +for (i =0 ; i < num_q; i++) { +ark_mpu_reset (mpu); + mpu =RTE_PTR_ADD (mpu,ARK_MPU_QOFFSET ); + } + +ark_ddm_reset (ark->ddm.v); +ark_ddm_stats_reset (ark->ddm.v); + +ark_ddm_stop (ark->ddm.v,0 ); +ark_rqp_stats_reset (ark->rqpacing); + +return 0 ; +}static int eth_ark_dev_uninit (struct rte_eth_dev *dev) { +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; +if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; +if (ark->user_ext.dev_uninit) + ark->user_ext.dev_uninit (dev, ark->user_data); + +ark_pktgen_uninit (ark->pg); +ark_pktchkr_uninit (ark->pc); + dev->dev_ops =NULL ; dev->rx_pkt_burst =NULL ; dev->tx_pkt_burst =NULL ; +if (dev->data->mac_addrs) +rte_free (dev->data->mac_addrs); +if (dev->data) +rte_free (dev->data); +return 0 ; }
@@ -136,16 +532,214 @@ static void eth_ark_dev_info_get(struct rte_eth_dev *dev, eth_ark_dev_configure(struct rte_eth_dev *dev __rte_unused) {ARK_DEBUG_TRACE ("ARKP: In %s\n" , __func__); +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; + +eth_ark_dev_set_link_up (dev); +if (ark->user_ext.dev_configure) +return ark->user_ext.dev_configure (dev, ark->user_data); +return 0 ; +} + +static void * +delay_pg_start (void *arg) +{ +struct ark_adapter *ark = (struct ark_adapter *)arg; + +/* This function is used exclusively for regression testing, We +* perform a blind sleep here to ensure that the external test +* application has time to setup the test before we generate packets +*/ +usleep (100000 ); +ark_pktgen_run (ark->pg); +return NULL ; +} + +static int +eth_ark_dev_start (struct rte_eth_dev *dev) +{ +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; +int i; + +ARK_DEBUG_TRACE ("ARKP: In eth_ark_dev_start\n" ); + +/* RX Side */ +/* start UDM */ +ark_udm_start (ark->udm.v); + +for (i =0 ; i < dev->data->nb_rx_queues; i++) +eth_ark_rx_start_queue (dev, i); + +/* TX Side */ +for (i =0 ; i < dev->data->nb_tx_queues; i++) +eth_ark_tx_queue_start (dev, i); + +/* start DDM */ +ark_ddm_start (ark->ddm.v); + + ark->started =1 ; +/* set xmit and receive function */ + dev->rx_pkt_burst = ð_ark_recv_pkts; + dev->tx_pkt_burst = ð_ark_xmit_pkts; + +if (ark->start_pg) +ark_pktchkr_run (ark->pc); + +if (ark->start_pg && (ark_get_port_id (dev, ark) ==0 )) { +pthread_t thread; + +/* Delay packet generatpr start allow the hardware to be ready +* This is only used for sanity checking with internal generator +*/ +pthread_create (&thread,NULL , delay_pg_start, ark); + } + +if (ark->user_ext.dev_start) + ark->user_ext.dev_start (dev, ark->user_data); +return 0 ; }static void +eth_ark_dev_stop (struct rte_eth_dev *dev) +{ +uint16_t i; +int status; +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; +struct ark_mpu_t *mpu; + +ARK_DEBUG_TRACE ("ARKP: In eth_ark_dev_stop\n" ); + +if (ark->started ==0 ) +return ; + ark->started =0 ; + +/* Stop the extension first */ +if (ark->user_ext.dev_stop) + ark->user_ext.dev_stop (dev, ark->user_data); + +/* Stop the packet generator */ +if (ark->start_pg) +ark_pktgen_pause (ark->pg); + + dev->rx_pkt_burst = ð_ark_recv_pkts_noop; + dev->tx_pkt_burst = ð_ark_xmit_pkts_noop; + +/* STOP TX Side */ +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + status =eth_ark_tx_queue_stop (dev, i); +if (status !=0 ) { +uint8_t port = dev->data->port_id; +PMD_DRV_LOG (ERR , +"ARKP tx_queue stop anomaly" +" port %u, queue %u\n" , + port, i); + } + } + +/* Stop DDM */ +/* Wait up to 0.1 second. each stop is upto 1000 * 10 useconds */ +for (i =0 ; i <10 ; i++) { + status =ark_ddm_stop (ark->ddm.v,1 ); +if (status ==0 ) +break ; + } +if (status || i !=0 ) { +PMD_DRV_LOG (ERR ,"DDM stop anomaly. status:" +" %d iter: %u. (%s)\n" , + status, + i, + __func__); +ark_ddm_dump (ark->ddm.v,"Stop anomaly" ); + + mpu = ark->mputx.v; +for (i =0 ; i < ark->tx_queues; i++) { +ark_mpu_dump (mpu,"DDM failure dump" , i); + mpu =RTE_PTR_ADD (mpu,ARK_MPU_QOFFSET ); + } + } + +/* STOP RX Side */ +/* Stop UDM multiple tries attempted */ +for (i =0 ; i <10 ; i++) { + status =ark_udm_stop (ark->udm.v,1 ); +if (status ==0 ) +break ; + } +if (status || i !=0 ) { +PMD_DRV_LOG (ERR ,"UDM stop anomaly. status %d iter: %u. (%s)\n" , + status, i, __func__); +ark_udm_dump (ark->udm.v,"Stop anomaly" ); + + mpu = ark->mpurx.v; +for (i =0 ; i < ark->rx_queues; i++) { +ark_mpu_dump (mpu,"UDM Stop anomaly" , i); + mpu =RTE_PTR_ADD (mpu,ARK_MPU_QOFFSET ); + } + } + +ark_udm_dump_stats (ark->udm.v,"Post stop" ); +ark_udm_dump_perf (ark->udm.v,"Post stop" ); + +for (i =0 ; i < dev->data->nb_tx_queues; i++) +eth_ark_rx_dump_queue (dev, i, __func__); + +/* Stop the packet checker if it is running */ +if (ark->start_pg) { +ark_pktchkr_dump_stats (ark->pc); +ark_pktchkr_stop (ark->pc); + } +} + +static void +eth_ark_dev_close (struct rte_eth_dev *dev) +{ +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; +uint16_t i; + +if (ark->user_ext.dev_close) + ark->user_ext.dev_close (dev, ark->user_data); + +eth_ark_dev_stop (dev); +eth_ark_udm_force_close (dev); + +/* +* TODO This should only be called once for the device during shutdown +*/ +ark_rqp_dump (ark->rqpacing); + +for (i =0 ; i < dev->data->nb_tx_queues; i++) { +eth_ark_tx_queue_release (dev->data->tx_queues[i]); + dev->data->tx_queues[i] =0 ; + } + +for (i =0 ; i < dev->data->nb_rx_queues; i++) { +eth_ark_dev_rx_queue_release (dev->data->rx_queues[i]); + dev->data->rx_queues[i] =0 ; + } +} + +static void eth_ark_dev_info_get (struct rte_eth_dev *dev,struct rte_eth_dev_info *dev_info) { +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; +struct ark_mpu_t *tx_mpu =RTE_PTR_ADD (ark->bar0,ARK_MPU_TX_BASE ); +struct ark_mpu_t *rx_mpu =RTE_PTR_ADD (ark->bar0,ARK_MPU_RX_BASE ); + +uint16_t ports = ark->num_ports; +/* device specific configuration */ memset (dev_info,0 ,sizeof (*dev_info)); + dev_info->max_rx_queues =ark_api_num_queues_per_port (rx_mpu, ports); + dev_info->max_tx_queues =ark_api_num_queues_per_port (tx_mpu, ports); + dev_info->max_mac_addrs =0 ; + dev_info->if_index =0 ; dev_info->max_rx_pktlen = (16 *1024 ) -128 ; dev_info->min_rx_bufsize =1024 ; dev_info->rx_offload_capa =0 ;
@@ -175,6 +769,120 @@ static void eth_ark_dev_info_get(struct rte_eth_dev *dev, dev_info->driver_name = dev->data->drv_name; } +static int +eth_ark_dev_link_update (struct rte_eth_dev *dev,int wait_to_complete) +{ +ARK_DEBUG_TRACE ("ARKP: link status = %d\n" , + dev->data->dev_link.link_status); +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; + +if (ark->user_ext.link_update) { +return ark->user_ext.link_update + (dev, wait_to_complete, + ark->user_data); + } +return 0 ; +} + +static int +eth_ark_dev_set_link_up (struct rte_eth_dev *dev) +{ + dev->data->dev_link.link_status =1 ; +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; + +if (ark->user_ext.dev_set_link_up) +return ark->user_ext.dev_set_link_up (dev, ark->user_data); +return 0 ; +} + +static int +eth_ark_dev_set_link_down (struct rte_eth_dev *dev) +{ + dev->data->dev_link.link_status =0 ; +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; + +if (ark->user_ext.dev_set_link_down) +return ark->user_ext.dev_set_link_down (dev, ark->user_data); +return 0 ; +} + +static void +eth_ark_dev_stats_get (struct rte_eth_dev *dev,struct rte_eth_stats *stats) +{ +uint16_t i; +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; + + stats->ipackets =0 ; + stats->ibytes =0 ; + stats->opackets =0 ; + stats->obytes =0 ; + stats->imissed =0 ; + stats->oerrors =0 ; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) +eth_tx_queue_stats_get (dev->data->tx_queues[i], stats); +for (i =0 ; i < dev->data->nb_rx_queues; i++) +eth_rx_queue_stats_get (dev->data->rx_queues[i], stats); +if (ark->user_ext.stats_get) + ark->user_ext.stats_get (dev, stats, ark->user_data); +} + +static void +eth_ark_dev_stats_reset (struct rte_eth_dev *dev) +{ +uint16_t i; +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) +eth_tx_queue_stats_reset (dev->data->rx_queues[i]); +for (i =0 ; i < dev->data->nb_rx_queues; i++) +eth_rx_queue_stats_reset (dev->data->rx_queues[i]); +if (ark->user_ext.stats_reset) + ark->user_ext.stats_reset (dev, ark->user_data); +} + +static void +eth_ark_macaddr_add (struct rte_eth_dev *dev, +struct ether_addr *mac_addr, +uint32_t index, +uint32_t pool) +{ +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; + +if (ark->user_ext.mac_addr_add) + ark->user_ext.mac_addr_add (dev, + mac_addr, + index, + pool, + ark->user_data); +} + +static void +eth_ark_macaddr_remove (struct rte_eth_dev *dev,uint32_t index) +{ +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; + +if (ark->user_ext.mac_addr_remove) + ark->user_ext.mac_addr_remove (dev, index, ark->user_data); +} + +static void +eth_ark_set_default_mac_addr (struct rte_eth_dev *dev, +struct ether_addr *mac_addr) +{ +struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; + +if (ark->user_ext.mac_addr_set) + ark->user_ext.mac_addr_set (dev, mac_addr, ark->user_data); +} static inline int process_pktdir_arg(const char *key, const char *value,
@@ -220,6 +928,12 @@ static void eth_ark_dev_info_get(struct rte_eth_dev *dev,unsigned int k_idx;struct rte_kvargs_pair *pair =NULL ; +/* +* TODO: the index of gark[index] should be associated with phy dev +* map +*/ +struct ark_adapter *ark = gark[0 ]; + kvlist =rte_kvargs_parse (params, valid_arguments);if (kvlist ==NULL )return 0 ;
@@ -254,8 +968,25 @@ static void eth_ark_dev_info_get(struct rte_eth_dev *dev,PMD_DRV_LOG (ERR ,"Unable to parse arg %s\n" ,ARK_PKTCHKR_ARG ); } +/* Setup the packet director */ +ark_pktdir_setup (ark->pd, pkt_dir_v);ARK_DEBUG_TRACE ("INFO: packet director set to 0x%x\n" , pkt_dir_v); +/* Setup the packet generator */ +if (pkt_gen_args[0 ]) { +PMD_DRV_LOG (INFO ,"Setting up the packet generator\n" ); +ark_pktgen_parse (pkt_gen_args); +ark_pktgen_reset (ark->pg); +ark_pktgen_setup (ark->pg); + ark->start_pg =1 ; + } + +/* Setup the packet checker */ +if (pkt_chkr_args[0 ]) { +ark_pktchkr_parse (pkt_chkr_args); +ark_pktchkr_setup (ark->pc); + } +return 1 ; }
drivers/net/ark/ark_ext.h new file +79 -0
79 lines not on this page · raw message
drivers/net/ark/ark_global.h +23 -0
@@ -88,6 +88,28 @@ struct ark_port {int id; }; +struct ark_user_ext { +void *(*dev_init)(struct rte_eth_dev *,void *abar,int port_id); +void (*dev_uninit)(struct rte_eth_dev *,void *); +int (*dev_get_port_count)(struct rte_eth_dev *,void *); +int (*dev_configure)(struct rte_eth_dev *,void *); +int (*dev_start)(struct rte_eth_dev *,void *); +void (*dev_stop)(struct rte_eth_dev *,void *); +void (*dev_close)(struct rte_eth_dev *,void *); +int (*link_update)(struct rte_eth_dev *,int wait_to_complete,void *); +int (*dev_set_link_up)(struct rte_eth_dev *,void *); +int (*dev_set_link_down)(struct rte_eth_dev *,void *); +void (*stats_get)(struct rte_eth_dev *,struct rte_eth_stats *,void *); +void (*stats_reset)(struct rte_eth_dev *,void *); +void (*mac_addr_add)(struct rte_eth_dev *, +struct ether_addr *, +uint32_t , +uint32_t , +void *); +void (*mac_addr_remove)(struct rte_eth_dev *,uint32_t ,void *); +void (*mac_addr_set)(struct rte_eth_dev *,struct ether_addr *,void *); +}; +struct ark_adapter {/* User extension private data */ void *user_data;
@@ -105,6 +127,7 @@ struct ark_adapter {struct rte_eth_dev *eth_dev;void *d_handle; +struct ark_user_ext user_ext;/* Our Bar 0 */ uint8_t *bar0;
Signature · 1 line
1.9.1
Re: [PATCH v3 2/7] net/ark: HW API part 1 of 3
In reply to Ed Czeckdrivers/net/ark/ark_rqp.h line 47
Quoted 3 lines · On Tue, 21 Mar 2017 17:43:36 -0400 Ed Czeck <[email protected]> wrote:
drivers/net/ark/ark_rqp.h new file +3
-0+volatile uint32_t ctrl; +volatile uint32_t stats_clear; +volatile uint32_t cplh_max;
You are using a lot of 'volatile' in this driver.
In general volatile should be reserved for known software shared data structures rather than every device register and statistics. I.e volatile is an inefficient replacement for proper use of barriers. The DPDK is not as stringent as Linux kernel (the kernel community considers almost all use of volatile a bug). See kernel document. process/volatile-considered-harmful.rst
Do you understand that volatile requires compiler to generate the most paranoid code possible. Basically every reference turns into a barrier.
Re: [PATCH v3 2/7] net/ark: HW API part 1 of 3
Hi Stephen,
Yes I understand the paranoid issue of volatile modifier, which is the reason it was coded in this manner.
The struct with volatile are memory mapped IO structures. These structure are not instantiated in memory and hence do not incur concurrent (host) software access. The a vast majority of the fields as read-only (as viewed by the host.) The concurrency model is that hardware is the producer, and the host the consumer. There is no handshake other than the host must not expect the memory location to remain constant -- that is optimization off.
As for performance, these structures are not in any critical path, so he optimization path is correctness not performance.
Do you have a recommendation for changing this code without using the volatile modifier? I have requirements from the hardware in the pattern of:
write a 1 to location x
read from location y until it become 0
write a 0 to location x
How can this work without a volatile modified on x and y?
Best,
Ed.
Re: [PATCH v3 2/7] net/ark: HW API part 1 of 3
Quoted 22 lines · On Tue, 21 Mar 2017 20:13:48 -0400 Ed Czeck <[email protected]> wrote:
Hi Stephen,
Yes I understand the paranoid issue of volatile modifier, which is the reason it was coded in this manner.
The struct with volatile are memory mapped IO structures. These structure are not instantiated in memory and hence do not incur concurrent (host) software access. The a vast majority of the fields as read-only (as viewed by the host.) The concurrency model is that hardware is the producer, and the host the consumer. There is no handshake other than the host must not expect the memory location to remain constant -- that is optimization off.
As for performance, these structures are not in any critical path, so he optimization path is correctness not performance.
Do you have a recommendation for changing this code without using the volatile modifier? I have requirements from the hardware in the pattern of:
write a 1 to location x
read from location y until it become 0
write a 0 to location x
How can this work without a volatile modified on x and y?
Quoted 2 lines
Best,
Ed.
Learn to use explicit memory barriers. DPDK has rmb()/wmb() just like kernel.
Once again good explanation of memory barriers in kernel doc.
Re: [PATCH v3 2/7] net/ark: HW API part 1 of 3
Hi Stephen,
The issue is not ordering or synchronizing IO read and write operations, so memory barriers are not the solution and will not address the compile optimizations which the volatile qualifier avoids. The linux kernel guide
states: "The volatile storage class was originally meant for memory-mapped I/O registers." This is the usage in this case.
The use of rte_read32() and other functions in that family are merely wrappers to casts to volatile. These functions and other wrappers are used throughout the drivers/net code. However, the use of these functions requires that every access point be manually decided and checked. By adding the volatile qualifier to the struct definition, there is no need to use these wrappers, since the struct definition is true to the physical hardware implementation.
Quoted 39 lines · Stephen Hemminger
Quoted 6 lines · On Tue, 21 Mar 2017 20:13:48 -0400 Ed Czeck <[email protected]> wrote:
Hi Stephen,
Yes I understand the paranoid issue of volatile modifier, which is the reason it was coded in this manner.
The struct with volatile are memory mapped IO structures. These
structure
Quoted 2 lines
are not instantiated in memory and hence do not incur concurrent (host) software access. The a vast majority of the fields as read-only (as
viewed
Quoted 1 line
by the host.) The concurrency model is that hardware is the producer,
and
Quoted 1 line
the host the consumer. There is no handshake other than the host must
not
Quoted 1 line
expect the memory location to remain constant -- that is optimization
off.
Quoted 6 lines
As for performance, these structures are not in any critical path, so he optimization path is correctness not performance.
Do you have a recommendation for changing this code without using the volatile modifier? I have requirements from the hardware in the pattern
of:
Quoted 7 lines
write a 1 to location x
read from location y until it become 0
write a 0 to location x
How can this work without a volatile modified on x and y?Best,
Ed.Learn to use explicit memory barriers. DPDK has rmb()/wmb() just like kernel.
Once again good explanation of memory barriers in kernel doc.
Quoted 37 lines · Ed Czeck
Enable Arkville on supported configurations
Add overview documentation
Minimum driver support for valid compileSigned-off-by Ed Czeck <[email protected]>--- MAINTAINERS | 8 + config/common_base | 11 ++ config/defconfig_arm-armv7a-linuxapp-gcc | 1 + config/defconfig_ppc_64-power8-linuxapp-gcc | 1 + doc/guides/nics/ark.rst | 237 +++++++++++++++++++++++ doc/guides/nics/features/ark.ini | 15 ++ doc/guides/nics/index.rst | 1 + drivers/net/Makefile | 1 + drivers/net/ark/Makefile | 63 +++++++ drivers/net/ark/ark_debug.h | 74 ++++++++ drivers/net/ark/ark_ethdev.c | 281 ++++++++++++++++++++++++++++ drivers/net/ark/ark_ethdev.h | 39 ++++ drivers/net/ark/ark_global.h | 108 +++++++++++ drivers/net/ark/rte_pmd_ark_version.map | 4 + mk/rte.app.mk | 1 + 15 files changed, 845 insertions(+) create mode 100644 doc/guides/nics/ark.rst create mode 100644 doc/guides/nics/features/ark.ini create mode 100644 drivers/net/ark/Makefile create mode 100644 drivers/net/ark/ark_debug.h create mode 100644 drivers/net/ark/ark_ethdev.c create mode 100644 drivers/net/ark/ark_ethdev.h create mode 100644 drivers/net/ark/ark_global.h create mode 100644 drivers/net/ark/rte_pmd_ark_version.mapMAINTAINERS +0
-0
MAINTAINERS M: Evgeny Schemeilin <[email protected]> · line 281
Quoted 4 lines
MAINTAINERS +1
-0@@ -278,6 +278,14 @@ M: Evgeny Schemeilin <[email protected]> F: drivers/net/ena/ F: doc/guides/nics/ena.rst +Atomic Rules ark
Should prefer uppercase "ARK" here?
MAINTAINERS M: Evgeny Schemeilin <[email protected]> · line 285
Quoted 4 lines
MAINTAINERS +4
-0+M: Shepard Siegel <[email protected]> +M: Ed Czeck <[email protected]> +M: John Miller <[email protected]> +F: /drivers/net/ark/
Can you please drop the leading "/". There is a script "check-maintainers.sh", which is broken with that.
Quoted 14 lines
MAINTAINERS +3
-0+F: doc/guides/nics/ark.rst +F: doc/guides/nics/features/ark.ini + Broadcom bnxt M: Stephen Hurd <[email protected]> M: Ajit Khaparde <[email protected]>config/common_base +0
-0@@ -353,6 +353,17 @@ CONFIG_RTE_LIBRTE_QEDE_FW="" CONFIG_RTE_LIBRTE_PMD_AF_PACKET=n #
config/common_base CONFIG_RTE_LIBRTE_QEDE_FW="" · line 365
Quoted 10 lines
config/common_base +10
-0+# Compile ARK PMD +# +CONFIG_RTE_LIBRTE_ARK_PMD=y +CONFIG_RTE_LIBRTE_ARK_PAD_TX=y +CONFIG_RTE_LIBRTE_ARK_DEBUG_RX=n +CONFIG_RTE_LIBRTE_ARK_DEBUG_TX=n +CONFIG_RTE_LIBRTE_ARK_DEBUG_STATS=n +CONFIG_RTE_LIBRTE_ARK_DEBUG_TRACE=n + +
Extra line
Quoted 21 lines
config/common_base +1
-0+# # Compile the TAP PMD # It is enabled by default for Linux only. #config/defconfig_arm-armv7a-linuxapp-gcc +1
-0@@ -61,6 +61,7 @@ CONFIG_RTE_SCHED_VECTOR=n # cannot use those on ARM CONFIG_RTE_KNI_KMOD=n +CONFIG_RTE_LIBRTE_ARK_PMD=n CONFIG_RTE_LIBRTE_EM_PMD=n CONFIG_RTE_LIBRTE_IGB_PMD=n CONFIG_RTE_LIBRTE_CXGBE_PMD=nconfig/defconfig_ppc_64-power8-linuxapp-gcc +0
-0
config/defconfig_ppc_64-power8-linuxapp-gcc CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=n · line 51
Quoted 4 lines
config/defconfig_ppc_64-power8-linuxapp-gcc +1
-0@@ -48,6 +48,7 @@ CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=n # Note: Initially, all of the PMD drivers compilation are turned off on Power # Will turn on them only after the successful testing on Power +CONFIG_RTE_LIBRTE_ARK_PMD=n
Is it not tested or known that it is not supported?
Quoted 105 lines
config/defconfig_ppc_64-power8-linuxapp-gcc +0
-0CONFIG_RTE_LIBRTE_IXGBE_PMD=n CONFIG_RTE_LIBRTE_I40E_PMD=n CONFIG_RTE_LIBRTE_VIRTIO_PMD=ydoc/guides/nics/ark.rst new file +96
-0@@ -0,0 +1,237 @@ +.. BSD LICENSE + + Copyright (c) 2015-2017 Atomic Rules LLC + 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 Atomic Rules LLC 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 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 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. + +ARK Poll Mode Driver +==================== + +The ARK PMD is a DPDK poll-mode driver for the Atomic Rules Arkville +(ARK) family of devices. + +More information can be found at the `Atomic Rules website +<http://atomicrules.com>`_. + +Overview +-------- + +The Atomic Rules Arkville product is DPDK and AXI compliant product +that marshals packets across a PCIe conduit between host DPDK mbufs and +FPGA AXI streams. + +The ARK PMD, and the spirit of the overall Arkville product, +has been to take the DPDK API/ABI as a fixed specification; +then implement much of the business logic in FPGA RTL circuits. +The approach of *working backwards* from the DPDK API/ABI and having +the GPP host software *dictate*, while the FPGA hardware *copes*, +results in significant performance gains over a naive implementation. + +While this document describes the ARK PMD software, it is helpful to +understand what the FPGA hardware is and is not. The Arkville RTL +component provides a single PCIe Physical Function (PF) supporting +some number of RX/Ingress and TX/Egress Queues. The ARK PMD controls +the Arkville core through a dedicated opaque Core BAR (CBAR). +To allow users full freedom for their own FPGA application IP, +an independent FPGA Application BAR (ABAR) is provided. + +One popular way to imagine Arkville's FPGA hardware aspect is as the +FPGA PCIe-facing side of a so-called Smart NIC. The Arkville core does +not contain any MACs, and is link-speed independent, as well as +agnostic to the number of physical ports the application chooses to +use. The ARK driver exposes the familiar PMD interface to allow packet +movement to and from mbufs across multiple queues. + +However FPGA RTL applications could contain a universe of added +functionality that an Arkville RTL core does not provide or can +not anticipate. To allow for this expectation of user-defined +innovation, the ARK PMD provides a dynamic mechanism of adding +capabilities without having to modify the ARK PMD. + +The ARK PMD is intended to support all instances of the Arkville +RTL Core, regardless of configuration, FPGA vendor, or target +board. While specific capabilities such as number of physical +hardware queue-pairs are negotiated; the driver is designed to +remain constant over a broad and extendable feature set. + +Intentionally, Arkville by itself DOES NOT provide common NIC +capabilities such as offload or receive-side scaling (RSS). +These capabilities would be viewed as a gate-level "tax" on +Green-box FPGA applications that do not require such function. +Instead, they can be added as needed with essentially no +overhead to the FPGA Application. + +Data Path Interface +------------------- + +Ingress RX and Egress TX operation is by the nominal DPDK API . +The driver supports single-port, multi-queue for both RX and TX. + +Refer to ``ark_ethdev.h`` for the list of supported methods to +act upon RX and TX Queues.
doc/guides/nics/ark.rst line 106
Quoted 10 lines
doc/guides/nics/ark.rst new file +10
-0+ +Configuration Information +------------------------- + +**DPDK Configuration Parameters** + + The following configuration options are available for the ARK PMD: + + * **CONFIG_RTE_LIBRTE_ARK_PMD** (default y): Enables or disables inclusion + of the ARK PMD driver in the DPDK compilation.
Missing "CONFIG_RTE_LIBRTE_ARK_PAD_TX"
Quoted 5 lines
doc/guides/nics/ark.rst new file +5
-0+ + * **CONFIG_RTE_LIBRTE_ARK_DEBUG_RX** (default n): Enables or disables debug + logging and internal checking of RX ingress logic within the ARK PMD driver. + + * **CONFIG_RTE_LIBRTE_ARK_DEBUG_TX** (default n): Enables or disables debug
doc/guides/nics/ark.rst line 121
Quoted 10 lines
doc/guides/nics/ark.rst new file +10
-0+ logging and internal checking of TX egress logic within the ARK PMD driver. + + * **CONFIG_RTE_LIBRTE_ARK_DEBUG_STATS** (default n): Enables or disables debug + logging of detailed packet and performance statistics gathered in + the PMD and FPGA. + + * **CONFIG_RTE_LIBRTE_ARK_DEBUG_TRACE** (default n): Enables or disables debug + logging of detailed PMD events and status. + +
Can you also please document the device arguments in this file?
Quoted 124 lines
doc/guides/nics/ark.rst new file +116
-0+Building DPDK +------------- + +See the :ref:`DPDK Getting Started Guide for Linux <linux_gsg>` for +instructions on how to build DPDK. + +By default the ARK PMD library will be built into the DPDK library. + +For configuring and using UIO and VFIO frameworks, please also refer :ref:`the +documentation that comes with DPDK suite <linux_gsg>`. + +Supported ARK RTL PCIe Instances +-------------------------------- + +ARK PMD supports the following Arkville RTL PCIe instances including: + +* ``1d6c:100d`` - AR-ARKA-FX0 [Arkville 32B DPDK Data Mover] +* ``1d6c:100e`` - AR-ARKA-FX1 [Arkville 64B DPDK Data Mover] + +Supported Operating Systems +--------------------------- + +Any Linux distribution fulfilling the conditions described in ``System Requirements`` +section of :ref:`the DPDK documentation <linux_gsg>` or refer to *DPDK Release Notes*. + +Supported Features +------------------ + +* Dynamic ARK PMD extensions +* Multiple receive and transmit queues +* Jumbo frames up to 9K +* Hardware Statistics + +Unsupported Features +-------------------- + +Features that may be part of, or become part of, the Arkville RTL IP that are +not currently supported or exposed by the ARK PMD include: + +* PCIe SR-IOV Virtual Functions (VFs) +* Arkville's Packet Generator Control and Status +* Arkville's Packet Director Control and Status +* Arkville's Packet Checker Control and Status +* Arkville's Timebase Management + +Pre-Requisites +-------------- + +#. Prepare the system as recommended by DPDK suite. This includes environment + variables, hugepages configuration, tool-chains and configuration + +#. Insert igb_uio kernel module using the command 'modprobe igb_uio' + +#. Bind the intended ARK device to igb_uio module + +At this point the system should be ready to run DPDK applications. Once the +application runs to completion, the ARK PMD can be detached from igb_uio if necessary. + +Usage Example +------------- + +This section demonstrates how to launch **testpmd** with Atomic Rules ARK +devices managed by librte_pmd_ark. + +#. Load the kernel modules: + + .. code-block:: console + + modprobe uio + insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko + + .. note:: + + The ARK PMD driver depends upon the igb_uio user space I/O kernel module + +#. Mount and request huge pages: + + .. code-block:: console + + mount -t hugetlbfs nodev /mnt/huge + echo 256 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages + +#. Bind UIO driver to ARK device at 0000:01:00.0 (using dpdk-devbind.py): + + .. code-block:: console + + ./usertools/dpdk-devbind.py --bind=igb_uio 0000:01:00.0 + + .. note:: + + The last argument to dpdk-devbind.py is the 4-tuple that indentifies a specific PCIe + device. You can use lspci -d 1d6c: to indentify all Atomic Rules devices in the system, + and thus determine the correct 4-tuple argument to dpdk-devbind.py + +#. Start testpmd with basic parameters: + + .. code-block:: console + + ./x86_64-native-linuxapp-gcc/app/testpmd -l 0-3 -n 4 -- -i + + Example output: + + .. code-block:: console + + [...] + EAL: PCI device 0000:01:00.0 on NUMA socket -1 + EAL: probe driver: 1d6c:100e rte_ark_pmd + EAL: PCI memory mapped at 0x7f9b6c400000 + PMD: eth_ark_dev_init(): Initializing 0:2:0.1 + ARKP PMD CommitID: 378f3a67 + Configuring Port 0 (socket 0) + Port 0: DC:3C:F6:00:00:01 + Checking link statuses... + Port 0 Link Up - speed 100000 Mbps - full-duplex + Done + testpmd>doc/guides/nics/features/ark.ini new file +2
-0@@ -0,0 +1,15 @@ +; +; Supported features of the 'ark' poll mode driver.
doc/guides/nics/features/ark.ini line 12
Quoted 10 lines
doc/guides/nics/features/ark.ini new file +10
-0+; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Queue start/stop = Y +Jumbo frame = Y +Scattered Rx = Y +Basic stats = Y +Stats per queue = Y +FW version = Y
Features can be added with the patch that adds functionality. I believe above features not supported with current patch.
Quoted 70 lines
doc/guides/nics/features/ark.ini new file +3
-0+Linux UIO = Y +x86-64 = Y +Usage doc = Ydoc/guides/nics/index.rst +1
-0@@ -36,6 +36,7 @@ Network Interface Controller Drivers :numbered: overview + ark bnx2x bnxt cxgbedrivers/net/Makefile +1
-0@@ -32,6 +32,7 @@ include $(RTE_SDK)/mk/rte.vars.mk DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet +DIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark DIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += bonding DIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbedrivers/net/ark/Makefile new file +37
-0@@ -0,0 +1,63 @@ +# BSD LICENSE +# +# Copyright (c) 2015-2017 Atomic Rules LLC +# 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 copyright holder 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 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 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 $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_ark.a
drivers/net/ark/Makefile line 47
Quoted 10 lines
drivers/net/ark/Makefile new file +10
-0+ +CFLAGS += -O3 -I./ +CFLAGS += $(WERROR_FLAGS) + +EXPORT_MAP := rte_pmd_ark_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD)
No need to put config option to comment, SRCS-y looks more proper.
Quoted 4 lines
drivers/net/ark/Makefile new file +4
-0+# + +SRCS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark_ethdev.c +
drivers/net/ark/Makefile line 60
Quoted 10 lines
drivers/net/ark/Makefile new file +9
-0+ +# this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += lib/librte_mbuf +DEPDIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += lib/librte_ether +DEPDIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += lib/librte_kvargs +DEPDIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += lib/librte_eal +DEPDIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += lib/librte_mempool +DEPDIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += lib/libpthread +DEPDIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += lib/libdl
DEPDIRS is for internal library dependencies. Please use LDLIBS for external dependencies, like:
LDLIBS += -lpthread
LDLIBS += -ldl
Quoted 65 lines
drivers/net/ark/Makefile new file +3
-0+ + +include $(RTE_SDK)/mk/rte.lib.mkdrivers/net/ark/ark_debug.h new file +56
-0@@ -0,0 +1,74 @@ +/*- +* BSD LICENSE +* +* Copyright (c) 2015-2017 Atomic Rules LLC +* 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 copyright holder 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 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 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 _ARK_DEBUG_H_ +#define _ARK_DEBUG_H_ + +#include <inttypes.h> +#include <rte_log.h> + +/* Format specifiers for string data pairs */ +#define ARK_SU32 "\n\t%-20s %'20" PRIu32 +#define ARK_SU64 "\n\t%-20s %'20" PRIu64 +#define ARK_SU64X "\n\t%-20s %#20" PRIx64 +#define ARK_SPTR "\n\t%-20s %20p" + +#define ARK_TRACE_ON (fmt, ...) \ + PMD_DRV_LOG(ERR, fmt, ##__VA_ARGS__) + +#define ARK_TRACE_OFF (fmt, ...) \ + do {if (0) PMD_DRV_LOG(ERR, fmt, ##__VA_ARGS__); } while (0) + +/* Debug macro for reporting Packet stats */ +#ifdef RTE_LIBRTE_ARK_DEBUG_STATS +#define ARK_DEBUG_STATS (fmt, ...) ARK_TRACE_ON(fmt, ##__VA_ARGS__) +#else +#define ARK_DEBUG_STATS (fmt, ...) ARK_TRACE_OFF(fmt, ##__VA_ARGS__)
drivers/net/ark/ark_debug.h line 66
Quoted 10 lines
drivers/net/ark/ark_debug.h new file +10
-0+#endif + +/* Debug macro for tracing full behavior*/ +#ifdef RTE_LIBRTE_ARK_DEBUG_TRACE +#define ARK_DEBUG_TRACE (fmt, ...) ARK_TRACE_ON(fmt, ##__VA_ARGS__) +#else +#define ARK_DEBUG_TRACE (fmt, ...) ARK_TRACE_OFF(fmt, ##__VA_ARGS__) +#endif + +#ifdef ARK_STD_LOG
How this define passed? Should it be something like RTE_LIBRTE_ARK_DEBUG_DRIVER config option?
drivers/net/ark/ark_debug.h line 68
Quoted 2 lines
drivers/net/ark/ark_debug.h new file +2
-0+#define PMD_DRV_LOG(level, fmt, args...) \ + fprintf(stderr, fmt, args)
It is possible to use rte log functions instead of fprintf to stderr.
drivers/net/ark/ark_debug.h line 74
Quoted 6 lines
drivers/net/ark/ark_debug.h new file +6
-0+#else +#define PMD_DRV_LOG(level, fmt, args...) \ + RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args) +#endif + +#endif
CONFIG_RTE_LIBRTE_ARK_DEBUG_RX, CONFIG_RTE_LIBRTE_ARK_DEBUG_TX not used, if so can be removed.
Quoted 60 lines
drivers/net/ark/ark_ethdev.c new file +54
-0@@ -0,0 +1,281 @@ +/*- +* BSD LICENSE +* +* Copyright (c) 2015-2017 Atomic Rules LLC +* 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 copyright holder 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 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 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 <unistd.h> +#include <sys/stat.h> +#include <dlfcn.h> + +#include <rte_kvargs.h> +#include <rte_vdev.h> + +#include "ark_global.h" +#include "ark_debug.h" +#include "ark_ethdev.h" + +/* Internal prototypes */ +static int eth_ark_check_args (const char *params); +static int eth_ark_dev_init (struct rte_eth_dev *dev); +static int eth_ark_dev_uninit (struct rte_eth_dev *eth_dev); +static int eth_ark_dev_configure (struct rte_eth_dev *dev); +static void eth_ark_dev_info_get (struct rte_eth_dev *dev, +struct rte_eth_dev_info *dev_info); + + +#define ARK_DEV_TO_PCI (eth_dev) \
drivers/net/ark/ark_ethdev.c line 64
Quoted 10 lines
drivers/net/ark/ark_ethdev.c new file +10
-0+ RTE_DEV_TO_PCI((eth_dev)->device) + +#define ARK_MAX_ARG_LEN 256 +static uint32_t pkt_dir_v; +static char pkt_gen_args[ARK_MAX_ARG_LEN ]; +static char pkt_chkr_args[ARK_MAX_ARG_LEN ]; + +#define ARK_PKTGEN_ARG "Pkt_gen" +#define ARK_PKTCHKR_ARG "Pkt_chkr" +#define ARK_PKTDIR_ARG "Pkt_dir"
Is it possible to add one line comments to device arguments. For example what "Pkt_dir" (packet director) is for?
drivers/net/ark/ark_ethdev.c line 70
Quoted 6 lines
drivers/net/ark/ark_ethdev.c new file +6
-0+ +static const char *const valid_arguments[] = { +ARK_PKTGEN_ARG , +ARK_PKTCHKR_ARG , +ARK_PKTDIR_ARG , +"iface" ,
Why not make this one too a define?
Quoted 18 lines
drivers/net/ark/ark_ethdev.c new file +18
-0+NULL +}; + +#define MAX_ARK_PHYS 16 +struct ark_adapter *gark[MAX_ARK_PHYS ]; + +static const struct rte_pci_id pci_id_ark_map[] = { + {RTE_PCI_DEVICE (0x1d6c ,0x100d )}, + {RTE_PCI_DEVICE (0x1d6c ,0x100e )}, + {.vendor_id =0 ,/* sentinel */ }, +}; + +static struct eth_driver rte_ark_pmd = { + .pci_drv = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + .id_table = pci_id_ark_map, + .drv_flags =RTE_PCI_DRV_NEED_MAPPING |RTE_PCI_DRV_INTR_LSC
drivers/net/ark/ark_ethdev.c line 98
Quoted 10 lines
drivers/net/ark/ark_ethdev.c new file +10
-0+ }, + .eth_dev_init = eth_ark_dev_init, + .eth_dev_uninit = eth_ark_dev_uninit, + .dev_private_size = sizeof(struct ark_adapter), +}; + +static const struct eth_dev_ops ark_eth_dev_ops = { + .dev_configure = eth_ark_dev_configure, + .dev_infos_get = eth_ark_dev_info_get, +
Extra line.
drivers/net/ark/ark_ethdev.c line 76
Quoted 3 lines
drivers/net/ark/ark_ethdev.c new file +3
-0+}; + +
Extra line.
drivers/net/ark/ark_ethdev.c line 105
Quoted 4 lines
drivers/net/ark/ark_ethdev.c new file +4
-0+static int +eth_ark_dev_init(struct rte_eth_dev *dev __rte_unused) +{ +return -1 ;/* STUB */
You may want to set ark_eth_dev_ops here, since they already implemented.
And for proper .dev_infos_get implementation, you may want to have [1] here:
[1]rte_eth_copy_pci_info(eth_dev, pci_dev); eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
Also you may want to parse device arguments in this stage.
Quoted 18 lines
drivers/net/ark/ark_ethdev.c new file +18
-0+} + + +static int +eth_ark_dev_uninit (struct rte_eth_dev *dev) +{ +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +return 0 ; + + dev->dev_ops =NULL ; + dev->rx_pkt_burst =NULL ; + dev->tx_pkt_burst =NULL ; +return 0 ; +} + +static int +eth_ark_dev_configure(struct rte_eth_dev *dev __rte_unused) +{
drivers/net/ark/ark_ethdev.c line 133
Quoted 10 lines
drivers/net/ark/ark_ethdev.c new file +10
-0+ARK_DEBUG_TRACE ("ARKP: In %s\n" , __func__); +return 0 ; +} + +static void +eth_ark_dev_info_get (struct rte_eth_dev *dev, +struct rte_eth_dev_info *dev_info) +{ +/* device specific configuration */ +memset (dev_info,0 ,sizeof (*dev_info));
memset not required, since already done by ethdev abstraction layer, specially desc_lim values already overwritten below.
drivers/net/ark/ark_ethdev.c line 136
Quoted 3 lines
drivers/net/ark/ark_ethdev.c new file +3
-0+ + dev_info->max_rx_pktlen = (16 *1024 ) -128 ; + dev_info->min_rx_bufsize =1024 ;
Using some macros instead of hardcoded values helps to understand values.
Quoted 5 lines
drivers/net/ark/ark_ethdev.c new file +5
-0+ dev_info->rx_offload_capa =0 ; + dev_info->tx_offload_capa =0 ; + + dev_info->rx_desc_lim = (struct rte_eth_desc_lim ) { + .nb_max =4096 *4 ,
drivers/net/ark/ark_ethdev.c line 151
Quoted 10 lines
drivers/net/ark/ark_ethdev.c new file +10
-0+ .nb_min = 512, /* HW Q size for RX */ + .nb_align = 2,}; + + dev_info->tx_desc_lim = (struct rte_eth_desc_lim ) { + .nb_max =4096 *4 , + .nb_min =256 ,/* HW Q size for TX */ + .nb_align =2 ,}; + + dev_info->rx_offload_capa =0 ; + dev_info->tx_offload_capa =0 ;
Dublication, please check ~10 lines above. Also not required to set 0 at all because of memset.
drivers/net/ark/ark_ethdev.c line 161
Quoted 10 lines
drivers/net/ark/ark_ethdev.c new file +10
-0+ +/* ARK PMD supports all line rates, how do we indicate that here ?? */ + dev_info->speed_capa = (ETH_LINK_SPEED_1G | +ETH_LINK_SPEED_10G | +ETH_LINK_SPEED_25G | +ETH_LINK_SPEED_40G | +ETH_LINK_SPEED_50G | +ETH_LINK_SPEED_100G ); + dev_info->pci_dev =ARK_DEV_TO_PCI (dev); + dev_info->driver_name = dev->data->drv_name;
setting driver_name not required, ethdev layer will overwrite this value.
And to have driver_name correct, rte_eth_copy_pci_info() should be called, please check above [1].
drivers/net/ark/ark_ethdev.c line 170
Quoted 9 lines
drivers/net/ark/ark_ethdev.c new file +9
-0+} + + +static inline int +process_pktdir_arg (const char *key,const char *value, + void *extra_args __rte_unused) +{ +ARK_DEBUG_TRACE ("In process_pktdir_arg, key = %s, value = %s\n" , + key, value);
The general usage of DEBUG_TRACE is providing backtrace log, function enterance / exit informations. I guess, that is why it has been controlled by different config option.
Here what you need looks like regular debugging functions, PMD_DRV_LOG / RTE_LOG variant.
Quoted 9 lines
drivers/net/ark/ark_ethdev.c new file +9
-0+ pkt_dir_v =strtol (value,NULL ,16 ); +ARK_DEBUG_TRACE ("pkt_dir_v = 0x%x\n" , pkt_dir_v); +return 0 ; +} + +static inline int +process_file_args (const char *key,const char *value,void *extra_args) +{ + ARK_DEBUG_TRACE("**** IN process_pktgen_arg, key = %s, value = %s\n",
drivers/net/ark/ark_ethdev.c line 189
Quoted 10 lines
drivers/net/ark/ark_ethdev.c new file +10
-0+ key, value); +char *args = (char *)extra_args; + +/* Open the configuration file */ +FILE *file =fopen (value,"r" ); +char line[256 ]; +int first =1 ; + +while (fgets (line,sizeof (line), file)) { +/* ARK_DEBUG_TRACE("%s\n", line); */
Please remove dead code.
drivers/net/ark/ark_ethdev.c line 191
Quoted 2 lines
drivers/net/ark/ark_ethdev.c new file +2
-0+if (first) { +strncpy (args, line,ARK_MAX_ARG_LEN );
Can this overflow args variable? Any way to prevent possible crash?
Quoted 40 lines
drivers/net/ark/ark_ethdev.c new file +40
-0+ first =0 ; + }else { +strncat (args, line,ARK_MAX_ARG_LEN ); + } + } +ARK_DEBUG_TRACE ("file = %s\n" , args); +fclose (file); +return 0 ; +} + +static int +eth_ark_check_args (const char *params) +{ +struct rte_kvargs *kvlist; +unsigned int k_idx; +struct rte_kvargs_pair *pair =NULL ; + + kvlist =rte_kvargs_parse (params, valid_arguments); +if (kvlist ==NULL ) +return 0 ; + + pkt_gen_args[0 ] =0 ; + pkt_chkr_args[0 ] =0 ; + +for (k_idx =0 ; k_idx < kvlist->count; k_idx++) { + pair = &kvlist->pairs[k_idx]; +ARK_DEBUG_TRACE ("**** Arg passed to PMD = %s:%s\n" , pair->key, + pair->value); + } + +if (rte_kvargs_process (kvlist, +ARK_PKTDIR_ARG , + &process_pktdir_arg, +NULL ) !=0 ) { +PMD_DRV_LOG (ERR ,"Unable to parse arg %s\n" ,ARK_PKTDIR_ARG ); + } + + if (rte_kvargs_process(kvlist, + ARK_PKTGEN_ARG, + &process_file_args,
drivers/net/ark/ark_ethdev.c line 241
Quoted 10 lines
drivers/net/ark/ark_ethdev.c new file +10
-0+ pkt_gen_args) != 0) { +PMD_DRV_LOG (ERR ,"Unable to parse arg %s\n" ,ARK_PKTGEN_ARG ); + } + +if (rte_kvargs_process (kvlist, +ARK_PKTCHKR_ARG , + &process_file_args, + pkt_chkr_args) !=0 ) { +PMD_DRV_LOG (ERR ,"Unable to parse arg %s\n" ,ARK_PKTCHKR_ARG ); + }
Not processing "iface" device argument?
drivers/net/ark/ark_ethdev.c line 250
Quoted 9 lines
drivers/net/ark/ark_ethdev.c new file +9
-0+ +ARK_DEBUG_TRACE ("INFO: packet director set to 0x%x\n" , pkt_dir_v); + +return 1 ; +} + + +/* +* PCIE
Can you elaborate this comment?
Quoted 15 lines
drivers/net/ark/ark_ethdev.c new file +15
-0+*/ +static int +pmd_ark_probe (const char *name,const char *params) +{ +RTE_LOG (INFO ,PMD ,"Initializing pmd_ark for %s params = %s\n" , name, + params); + +/* Parse off the v index */ + +eth_ark_check_args (params); +return 0 ; +} + +static int +pmd_ark_remove (const char *name)
drivers/net/ark/ark_ethdev.c line 275
Quoted 10 lines
drivers/net/ark/ark_ethdev.c new file +10
-0+{ +RTE_LOG (INFO ,PMD ,"Closing ark %s ethdev on numa socket %u\n" , name, +rte_socket_id ()); +return 1 ; +} + +static struct rte_vdev_driver pmd_ark_drv = { + .probe = pmd_ark_probe, + .remove = pmd_ark_remove, +};
Sorry, I am confused here.
Why both virtual and physical initialization routine exists together? This PMD for physical PCI device, right?
drivers/net/ark/ark_ethdev.c line 281
Quoted 6 lines
drivers/net/ark/ark_ethdev.c new file +6
-0+ +RTE_PMD_REGISTER_VDEV (net_ark, pmd_ark_drv); +RTE_PMD_REGISTER_ALIAS (net_ark, eth_ark); +RTE_PMD_REGISTER_PCI (eth_ark, rte_ark_pmd.pci_drv); +RTE_PMD_REGISTER_KMOD_DEP (net_ark,"* igb_uio | uio_pci_generic " ); +RTE_PMD_REGISTER_PCI_TABLE (eth_ark, pci_id_ark_map);
Can add RTE_PMD_REGISTER_PARAM_STRING macro.
Quoted 165 lines
drivers/net/ark/ark_ethdev.h new file +39
-0@@ -0,0 +1,39 @@ +/*- +* BSD LICENSE +* +* Copyright (c) 2015-2017 Atomic Rules LLC +* 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 copyright holder 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 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 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 _ARK_ETHDEV_H_ +#define _ARK_ETHDEV_H_ + +/* STUB */ + +#endif drivers/net/ark/ark_global.h new file +108
-0@@ -0,0 +1,108 @@ +/*- +* BSD LICENSE +* +* Copyright (c) 2015-2017 Atomic Rules LLC +* 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 copyright holder 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 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 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 _ARK_GLOBAL_H_ +#define _ARK_GLOBAL_H_ + +#include <time.h> +#include <assert.h> + +#include <rte_mbuf.h> +#include <rte_ethdev.h> +#include <rte_malloc.h> +#include <rte_memcpy.h> +#include <rte_string_fns.h> +#include <rte_cycles.h> +#include <rte_kvargs.h> +#include <rte_dev.h> +#include <rte_version.h> + +#define ETH_ARK_ARG_MAXLEN 64 +#define ARK_SYSCTRL_BASE 0x0 +#define ARK_PKTGEN_BASE 0x10000 +#define ARK_MPU_RX_BASE 0x20000 +#define ARK_UDM_BASE 0x30000 +#define ARK_MPU_TX_BASE 0x40000 +#define ARK_DDM_BASE 0x60000 +#define ARK_CMAC_BASE 0x80000 +#define ARK_PKTDIR_BASE 0xa0000 +#define ARK_PKTCHKR_BASE 0x90000 +#define ARK_RCPACING_BASE 0xb0000 +#define ARK_EXTERNAL_BASE 0x100000 +#define ARK_MPU_QOFFSET 0x00100 +#define ARK_MAX_PORTS 8 + +#define offset8 (n) n +#define offset16 (n) ((n) / 2) +#define offset32 (n) ((n) / 4) +#define offset64 (n) ((n) / 8) + +/* +* Structure to store private data for each PF/VF instance. +*/ +#define def_ptr (type, name) \ + union type { \ + uint64_t *t64; \ + uint32_t *t32; \ + uint16_t *t16; \ + uint8_t *t8; \ + void *v; \ + } name + +struct ark_port { +struct rte_eth_dev *eth_dev; +int id; +}; + +struct ark_adapter { +/* User extension private data */ +void *user_data; + +struct ark_port port[ARK_MAX_PORTS ]; +int num_ports; + +/* Common for both PF and VF */ +struct rte_eth_dev *eth_dev; + +void *d_handle; + +/* Our Bar 0 */ +uint8_t *bar0; + +/* Application Bar */ +uint8_t *a_bar; +}; + +typedef uint32_t *ark_t ; + +#endif drivers/net/ark/rte_pmd_ark_version.map new file +0
-0
drivers/net/ark/rte_pmd_ark_version.map line 1
Quoted 1 line
drivers/net/ark/rte_pmd_ark_version.map new file +1
-0@@ -0,0 +1,4 @@ +DPDK_2.0 {
DPDK_17.05
Quoted 16 lines
drivers/net/ark/rte_pmd_ark_version.map new file +3
-0+ local: *; + +};mk/rte.app.mk +1
-0@@ -104,6 +104,7 @@ ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) # plugins (link only if static libraries) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet +_LDLIBS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += -lrte_pmd_ark _LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x -lz _LDLIBS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += -lrte_pmd_bnxt _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond
Thank you Furruh,
A new patch series has been uploaded.
Ed.