[PATCH 01/14] doc/guides/bbdevs: add ark baseband device documentation

2022-10-26 Thread John Miller
Add new ark baseband device documentation.

This is the first patch in the series that introduces
the Arkville baseband PMD.

First we create a common/ark directory and move common files
from net/ark to share with the new baseband/ark device.

Next we create baseband/ark and introduce the Arkville baseband PMD,
including documentation.

Finally we modify the build system to support the changes.

Signed-off-by: John Miller 
---
 doc/guides/bbdevs/ark.rst | 52 +++
 1 file changed, 52 insertions(+)
 create mode 100644 doc/guides/bbdevs/ark.rst

diff --git a/doc/guides/bbdevs/ark.rst b/doc/guides/bbdevs/ark.rst
new file mode 100644
index 00..09afcb0f31
--- /dev/null
+++ b/doc/guides/bbdevs/ark.rst
@@ -0,0 +1,52 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright (c) 2015-2022 Atomic Rules LLC
+
+=
+ Atomic Rules LLC, Baseband Poll Mode Driver
+=
+
+The Atomic Rules, Arkville Baseband poll model driver supports the data
+movement portion of a baseband device implemented within an FPGA.
+The specifics of the encode or decode functions within the FPGA are
+outside the scope of Arkville's data movement. Hence this PMD requires and
+provides for the customization needed to advertise its
+features and support for out-of-band (or meta data) to accompany packet
+data between the FPGA device and the host software.
+
+
+==
+ Features
+==
+
+* Support for LDPC encode and decode operations.
+* Support for Turbo encode and decode operations.
+* Support for scatter/gather.
+* Support Mbuf data room sizes up to 32K bytes for improved performance.
+* Support for up to 64 queues
+* Support for runtime switching of Mbuf size, per queue, for improved 
perormance.
+* Support for PCIe Gen3x16, Gen4x16, and Gen5x8 endpoints.
+
+
+=
+ Required Customization Functions
+=
+
+The following customization functions are required:
+  * Set the capabilities structure for the device `ark_bbdev_info_get()`
+  * An optional device start function `rte_pmd_ark_bbdev_start()`
+  * An optional device stop function `rte_pmd_ark_bbdev_stop()`
+  * Functions for defining meta data format shared between
+the host and FPGA.
+`rte_pmd_ark_bbdev_enqueue_ldpc_dec()`,
+`rte_pmd_ark_bbdev_dequeue_ldpc_dec()`,
+`rte_pmd_ark_bbdev_enqueue_ldpc_enc()`,
+`rte_pmd_ark_bbdev_dequeue_ldpc_enc()`.
+
+
+=
+ Limitations
+=
+
+* MBufs for the output data from the operation must be sized exactly
+   to hold the result based on DATAROOM sizes.
+* Side-band or meta data accompaning packet data is limited to 20 Bytes.
-- 
2.25.1



[PATCH 03/14] common/ark: move common files to common subdirectory

2022-10-26 Thread John Miller
Add common ark files to drivers/common directory in
preparation to support Arkville baseband device.

Signed-off-by: John Miller 
---
 drivers/common/ark/ark_common.c |  9 
 drivers/common/ark/ark_common.h | 47 
 drivers/common/ark/meson.build  | 19 +++
 drivers/common/ark/version.map  | 95 +
 4 files changed, 170 insertions(+)
 create mode 100644 drivers/common/ark/ark_common.c
 create mode 100644 drivers/common/ark/ark_common.h
 create mode 100644 drivers/common/ark/meson.build
 create mode 100644 drivers/common/ark/version.map

diff --git a/drivers/common/ark/ark_common.c b/drivers/common/ark/ark_common.c
new file mode 100644
index 00..abc169fd14
--- /dev/null
+++ b/drivers/common/ark/ark_common.c
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2020-2021 Atomic Rules LLC
+ */
+
+#include "ark_common.h"
+
+int ark_common_logtype;
+
+RTE_LOG_REGISTER_DEFAULT(ark_common_logtype, NOTICE);
diff --git a/drivers/common/ark/ark_common.h b/drivers/common/ark/ark_common.h
new file mode 100644
index 00..ba4c70f804
--- /dev/null
+++ b/drivers/common/ark/ark_common.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2015-2018 Atomic Rules LLC
+ */
+
+#ifndef _ARK_COMMON_H_
+#define _ARK_COMMON_H_
+
+#include 
+#include 
+
+/* system camel case definition changed to upper case */
+#define PRIU32 PRIu32
+#define PRIU64 PRIu64
+
+/* Atomic Rules vendor id */
+#define AR_VENDOR_ID 0x1d6c
+
+/*
+ * This structure is used to statically define the capabilities
+ * of supported devices.
+ * Capabilities:
+ *  rqpacing -
+ * Some HW variants require that PCIe read-requests be correctly throttled.
+ * This is called "rqpacing" and has to do with credit and flow control
+ * on certain Arkville implementations.
+ */
+struct ark_caps {
+   bool rqpacing;
+};
+struct ark_dev_caps {
+   uint32_t  device_id;
+   struct ark_caps  caps;
+};
+#define SET_DEV_CAPS(id, rqp) \
+   {id, {.rqpacing = rqp} }
+
+/* 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"
+
+extern int ark_common_logtype;
+#define ARK_PMD_LOG(level, fmt, args...)   \
+   rte_log(RTE_LOG_ ##level, ark_common_logtype, "ARK_COMMON: " fmt, ## 
args)
+
+#endif
diff --git a/drivers/common/ark/meson.build b/drivers/common/ark/meson.build
new file mode 100644
index 00..a54acf5e3a
--- /dev/null
+++ b/drivers/common/ark/meson.build
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2019 Mellanox Technologies, Ltd
+
+if is_windows
+build = false
+reason = 'not supported on Windows'
+subdir_done()
+endif
+
+sources += files(
+   'ark_ddm.c',
+   'ark_common.c',
+   'ark_mpu.c',
+   'ark_pktchkr.c',
+   'ark_pktdir.c',
+   'ark_pktgen.c',
+   'ark_rqp.c',
+   'ark_udm.c'
+)
diff --git a/drivers/common/ark/version.map b/drivers/common/ark/version.map
new file mode 100644
index 00..74d9f4b668
--- /dev/null
+++ b/drivers/common/ark/version.map
@@ -0,0 +1,95 @@
+DPDK_22 {
+   local: *;
+};
+
+INTERNAL {
+   global:
+
+   ark_api_num_queues;
+   ark_api_num_queues_per_port;
+
+   ark_ddm_dump_stats;
+   ark_ddm_queue_byte_count;
+   ark_ddm_queue_pkt_count;
+   ark_ddm_queue_reset_stats;
+   ark_ddm_stats_reset;
+   ark_ddm_verify;
+
+   ark_mpu_configure;
+   ark_mpu_dump;
+   ark_mpu_dump_setup;
+   ark_mpu_reset;
+   ark_mpu_start;
+   ark_mpu_stop;
+   ark_mpu_verify;
+
+   ark_pktchkr_dump_stats;
+   ark_pktchkr_get_pkts_sent;
+   ark_pktchkr_init;
+   ark_pktchkr_is_running;
+   ark_pktchkr_parse;
+   ark_pktchkr_run;
+   ark_pktchkr_set_dst_mac_addr;
+   ark_pktchkr_set_eth_type;
+   ark_pktchkr_set_hdr_dW;
+   ark_pktchkr_set_num_pkts;
+   ark_pktchkr_set_payload_byte;
+   ark_pktchkr_set_pkt_size_incr;
+   ark_pktchkr_set_pkt_size_max;
+   ark_pktchkr_set_pkt_size_min;
+   ark_pktchkr_set_src_mac_addr;
+   ark_pktchkr_setup;
+   ark_pktchkr_stop;
+   ark_pktchkr_stopped;
+   ark_pktchkr_uninit;
+   ark_pktchkr_wait_done;
+   ark_pktdir_init;
+   ark_pktdir_setup;
+   ark_pktdir_stall_cnt;
+   ark_pktdir_status;
+   ark_pktdir_uninit;
+
+   ark_pktgen_get_pkts_sent;
+   ark_pktgen_init;
+   ark_pktgen_is_gen_forever;
+   ark_pktgen_is_running;
+   ark_pktgen_parse;
+   ark_pktgen_pause;
+   ark_pktgen_paused;
+   ark_pktgen_reset;
+   ark_pktgen_run;
+   ark_pktgen_set_dst_mac_addr;

[PATCH 02/14] common/ark: create common subdirectory for baseband support

2022-10-26 Thread John Miller
Create a common directory in drivers/common and move common
ark files to prepare support for Arkville baseband device.

Signed-off-by: John Miller 
---
 MAINTAINERS   |  1 +
 drivers/{net => common}/ark/ark_ddm.c |  2 +-
 drivers/{net => common}/ark/ark_ddm.h |  0
 drivers/{net => common}/ark/ark_mpu.c |  2 +-
 drivers/{net => common}/ark/ark_mpu.h |  0
 drivers/{net => common}/ark/ark_pktchkr.c |  2 +-
 drivers/{net => common}/ark/ark_pktchkr.h | 22 ++
 drivers/{net => common}/ark/ark_pktdir.c  |  5 +++--
 drivers/{net => common}/ark/ark_pktdir.h  |  7 ++
 drivers/{net => common}/ark/ark_pktgen.c  |  2 +-
 drivers/{net => common}/ark/ark_pktgen.h  | 27 +++
 drivers/{net => common}/ark/ark_rqp.c |  2 +-
 drivers/{net => common}/ark/ark_rqp.h |  0
 drivers/{net => common}/ark/ark_udm.c |  2 +-
 drivers/{net => common}/ark/ark_udm.h | 13 +--
 15 files changed, 77 insertions(+), 10 deletions(-)
 rename drivers/{net => common}/ark/ark_ddm.c (98%)
 rename drivers/{net => common}/ark/ark_ddm.h (100%)
 rename drivers/{net => common}/ark/ark_mpu.c (99%)
 rename drivers/{net => common}/ark/ark_mpu.h (100%)
 rename drivers/{net => common}/ark/ark_pktchkr.c (99%)
 rename drivers/{net => common}/ark/ark_pktchkr.h (88%)
 rename drivers/{net => common}/ark/ark_pktdir.c (95%)
 rename drivers/{net => common}/ark/ark_pktdir.h (89%)
 rename drivers/{net => common}/ark/ark_pktgen.c (99%)
 rename drivers/{net => common}/ark/ark_pktgen.h (86%)
 rename drivers/{net => common}/ark/ark_rqp.c (98%)
 rename drivers/{net => common}/ark/ark_rqp.h (100%)
 rename drivers/{net => common}/ark/ark_udm.c (99%)
 rename drivers/{net => common}/ark/ark_udm.h (95%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2bd4a55f1b..b2e192d001 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -642,6 +642,7 @@ M: Shepard Siegel 
 M: Ed Czeck 
 M: John Miller 
 F: drivers/net/ark/
+F: drivers/common/ark/
 F: doc/guides/nics/ark.rst
 F: doc/guides/nics/features/ark.ini
 
diff --git a/drivers/net/ark/ark_ddm.c b/drivers/common/ark/ark_ddm.c
similarity index 98%
rename from drivers/net/ark/ark_ddm.c
rename to drivers/common/ark/ark_ddm.c
index eb88349b7b..7875a7cabb 100644
--- a/drivers/net/ark/ark_ddm.c
+++ b/drivers/common/ark/ark_ddm.c
@@ -4,7 +4,7 @@
 
 #include 
 
-#include "ark_logs.h"
+#include "ark_common.h"
 #include "ark_ddm.h"
 
 static_assert(sizeof(union ark_tx_meta) == 8, "Unexpected struct size 
ark_tx_meta");
diff --git a/drivers/net/ark/ark_ddm.h b/drivers/common/ark/ark_ddm.h
similarity index 100%
rename from drivers/net/ark/ark_ddm.h
rename to drivers/common/ark/ark_ddm.h
diff --git a/drivers/net/ark/ark_mpu.c b/drivers/common/ark/ark_mpu.c
similarity index 99%
rename from drivers/net/ark/ark_mpu.c
rename to drivers/common/ark/ark_mpu.c
index 9d5ee7841b..1112974e59 100644
--- a/drivers/net/ark/ark_mpu.c
+++ b/drivers/common/ark/ark_mpu.c
@@ -4,7 +4,7 @@
 
 #include 
 
-#include "ark_logs.h"
+#include "ark_common.h"
 #include "ark_mpu.h"
 
 uint16_t
diff --git a/drivers/net/ark/ark_mpu.h b/drivers/common/ark/ark_mpu.h
similarity index 100%
rename from drivers/net/ark/ark_mpu.h
rename to drivers/common/ark/ark_mpu.h
diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/common/ark/ark_pktchkr.c
similarity index 99%
rename from drivers/net/ark/ark_pktchkr.c
rename to drivers/common/ark/ark_pktchkr.c
index e1f336c73c..18454e66f0 100644
--- a/drivers/net/ark/ark_pktchkr.c
+++ b/drivers/common/ark/ark_pktchkr.c
@@ -9,7 +9,7 @@
 #include 
 
 #include "ark_pktchkr.h"
-#include "ark_logs.h"
+#include "ark_common.h"
 
 static int set_arg(char *arg, char *val);
 static int ark_pktchkr_is_gen_forever(ark_pkt_chkr_t handle);
diff --git a/drivers/net/ark/ark_pktchkr.h b/drivers/common/ark/ark_pktchkr.h
similarity index 88%
rename from drivers/net/ark/ark_pktchkr.h
rename to drivers/common/ark/ark_pktchkr.h
index b362281776..a166f98586 100644
--- a/drivers/net/ark/ark_pktchkr.h
+++ b/drivers/common/ark/ark_pktchkr.h
@@ -5,6 +5,8 @@
 #ifndef _ARK_PKTCHKR_H_
 #define _ARK_PKTCHKR_H_
 
+#include 
+#include 
 #include 
 #include 
 
@@ -64,25 +66,45 @@ struct ark_pkt_chkr_inst {
 };
 
 /*  packet checker functions */
+__rte_internal
 ark_pkt_chkr_t ark_pktchkr_init(void *addr, int ord, int l2_mode);
+__rte_internal
 void ark_pktchkr_uninit(ark_pkt_chkr_t handle);
+__rte_internal
 void ark_pktchkr_run(ark_pkt_chkr_t handle);
+__rte_internal
 int ark_pktchkr_stopped(ark_pkt_chkr_t handle);
+__rte_internal
 void ark_pktchkr_stop(ark_pkt_chkr_t handle);
+__rte_internal
 int ark_pktchkr_is_running(ark_pkt_chkr_t handle);
+__rte_internal
 int ark_pktchkr_get_pkts_sent(ark_pkt_chkr_t handle);
+__rte_internal
 void ark_pktchkr_set_payload_byte(ark_pkt_chkr_t handle, uint32_t b);
+__rt

[PATCH 05/14] net/ark: remove build files moved to common

2022-10-26 Thread John Miller
Remove build files moved to common.

Signed-off-by: John Miller 
---
 drivers/net/ark/meson.build | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ark/meson.build b/drivers/net/ark/meson.build
index 8d87744c22..c48044b8ee 100644
--- a/drivers/net/ark/meson.build
+++ b/drivers/net/ark/meson.build
@@ -7,15 +7,13 @@ if is_windows
 subdir_done()
 endif
 
+deps += ['common_ark']
+
 sources = files(
-'ark_ddm.c',
 'ark_ethdev.c',
 'ark_ethdev_rx.c',
 'ark_ethdev_tx.c',
-'ark_mpu.c',
-'ark_pktchkr.c',
-'ark_pktdir.c',
-'ark_pktgen.c',
-'ark_rqp.c',
-'ark_udm.c',
+'ark_ethdev_logs.c',
 )
+
+includes += include_directories('../../common/ark')
-- 
2.25.1



[PATCH 04/14] common/meson.build:

2022-10-26 Thread John Miller
Add common ark to build system.

Signed-off-by: John Miller 
---
 drivers/common/meson.build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/common/meson.build b/drivers/common/meson.build
index ea261dd70a..5514f4ba83 100644
--- a/drivers/common/meson.build
+++ b/drivers/common/meson.build
@@ -3,6 +3,7 @@
 
 std_deps = ['eal']
 drivers = [
+'ark',
 'cpt',
 'dpaax',
 'iavf',
-- 
2.25.1



[PATCH 07/14] common/ark: avoid exporting internal functions

2022-10-26 Thread John Miller
Add __rte_internal to all internal functions


Signed-off-by: John Miller 
---
 drivers/common/ark/ark_ddm.h | 8 
 drivers/common/ark/ark_mpu.h | 8 +++-
 drivers/common/ark/ark_rqp.h | 3 +++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/common/ark/ark_ddm.h b/drivers/common/ark/ark_ddm.h
index 84beeb063a..9d10c131a7 100644
--- a/drivers/common/ark/ark_ddm.h
+++ b/drivers/common/ark/ark_ddm.h
@@ -103,13 +103,21 @@ struct ark_ddm_t {
 };
 
 /* DDM function prototype */
+__rte_internal
 int ark_ddm_verify(struct ark_ddm_t *ddm);
+__rte_internal
 void ark_ddm_stats_reset(struct ark_ddm_t *ddm);
+__rte_internal
 void ark_ddm_queue_setup(struct ark_ddm_t *ddm, rte_iova_t cons_addr);
+__rte_internal
 void ark_ddm_dump_stats(struct ark_ddm_t *ddm, const char *msg);
+__rte_internal
 uint64_t ark_ddm_queue_byte_count(struct ark_ddm_t *ddm);
+__rte_internal
 uint64_t ark_ddm_queue_pkt_count(struct ark_ddm_t *ddm);
+__rte_internal
 void ark_ddm_queue_reset_stats(struct ark_ddm_t *ddm);
+__rte_internal
 void ark_ddm_queue_enable(struct ark_ddm_t *ddm, int enable);
 
 #endif
diff --git a/drivers/common/ark/ark_mpu.h b/drivers/common/ark/ark_mpu.h
index 9d2b70d35f..04824db080 100644
--- a/drivers/common/ark/ark_mpu.h
+++ b/drivers/common/ark/ark_mpu.h
@@ -80,14 +80,20 @@ struct ark_mpu_t {
 uint16_t ark_api_num_queues(struct ark_mpu_t *mpu);
 uint16_t ark_api_num_queues_per_port(struct ark_mpu_t *mpu,
 uint16_t ark_ports);
+__rte_internal
 int ark_mpu_verify(struct ark_mpu_t *mpu, uint32_t obj_size);
+__rte_internal
 void ark_mpu_stop(struct ark_mpu_t *mpu);
+__rte_internal
 void ark_mpu_start(struct ark_mpu_t *mpu);
+__rte_internal
 int ark_mpu_reset(struct ark_mpu_t *mpu);
+__rte_internal
 int ark_mpu_configure(struct ark_mpu_t *mpu, rte_iova_t ring,
  uint32_t ring_size, int is_tx);
-
+__rte_internal
 void ark_mpu_dump(struct ark_mpu_t *mpu, const char *msg, uint16_t idx);
+__rte_internal
 void ark_mpu_dump_setup(struct ark_mpu_t *mpu, uint16_t qid);
 
 /*  this action is in a performance critical path */
diff --git a/drivers/common/ark/ark_rqp.h b/drivers/common/ark/ark_rqp.h
index d09f242e1e..c3d2ba739b 100644
--- a/drivers/common/ark/ark_rqp.h
+++ b/drivers/common/ark/ark_rqp.h
@@ -52,7 +52,10 @@ struct ark_rqpace_t {
volatile uint32_t cmpl_errors;
 };
 
+__rte_internal
 void ark_rqp_dump(struct ark_rqpace_t *rqp);
+__rte_internal
 void ark_rqp_stats_reset(struct ark_rqpace_t *rqp);
+__rte_internal
 int ark_rqp_lasped(struct ark_rqpace_t *rqp);
 #endif
-- 
2.25.1



[PATCH 06/14] common/ark: update version map file

2022-10-26 Thread John Miller
Update the version map file with new common functions.

Signed-off-by: John Miller 
---
 drivers/common/ark/version.map | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/common/ark/version.map b/drivers/common/ark/version.map
index 74d9f4b668..64d78cff24 100644
--- a/drivers/common/ark/version.map
+++ b/drivers/common/ark/version.map
@@ -1,18 +1,21 @@
-DPDK_22 {
-   local: *;
-};
-
-INTERNAL {
+EXTERNAL {
global:
 
ark_api_num_queues;
ark_api_num_queues_per_port;
 
+};
+
+INTERNAL {
+   global:
+
ark_ddm_dump_stats;
ark_ddm_queue_byte_count;
ark_ddm_queue_pkt_count;
ark_ddm_queue_reset_stats;
ark_ddm_stats_reset;
+   ark_ddm_queue_setup;
+   ark_ddm_queue_enable;
ark_ddm_verify;
 
ark_mpu_configure;
-- 
2.25.1



[PATCH 09/14] common/ark: add VF support to caps record

2022-10-26 Thread John Miller
Some HW variants support sr-iov, add this to the device
capabilities record.

Signed-off-by: John Miller 
---
 drivers/common/ark/ark_common.h | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/common/ark/ark_common.h b/drivers/common/ark/ark_common.h
index ba4c70f804..b940f31ea6 100644
--- a/drivers/common/ark/ark_common.h
+++ b/drivers/common/ark/ark_common.h
@@ -23,16 +23,19 @@
  * Some HW variants require that PCIe read-requests be correctly throttled.
  * This is called "rqpacing" and has to do with credit and flow control
  * on certain Arkville implementations.
+ *  isvf -
+ * Some HW variants support sr-iov virtual functions.
  */
 struct ark_caps {
bool rqpacing;
+   bool isvf;
 };
 struct ark_dev_caps {
uint32_t  device_id;
struct ark_caps  caps;
 };
-#define SET_DEV_CAPS(id, rqp) \
-   {id, {.rqpacing = rqp} }
+#define SET_DEV_CAPS(id, rqp, vf)  \
+   {id, {.rqpacing = rqp, .isvf = vf} }
 
 /* Format specifiers for string data pairs */
 #define ARK_SU32  "\n\t%-20s%'20" PRIU32
-- 
2.25.1



[PATCH 08/14] net/ark: add ark PMD log interface

2022-10-26 Thread John Miller
Added ark PMD log interface for use in arkville devices.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c  | 86 ---
 drivers/net/ark/ark_ethdev_logs.c |  8 +++
 drivers/net/ark/ark_ethdev_logs.h | 25 +
 drivers/net/ark/ark_ethdev_rx.c   | 36 ++---
 drivers/net/ark/ark_ethdev_tx.c   | 10 ++--
 drivers/net/ark/ark_logs.h| 34 
 6 files changed, 89 insertions(+), 110 deletions(-)
 create mode 100644 drivers/net/ark/ark_ethdev_logs.c
 create mode 100644 drivers/net/ark/ark_ethdev_logs.h
 delete mode 100644 drivers/net/ark/ark_logs.h

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index c654a229f7..3c8a952a6c 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -11,7 +11,7 @@
 #include 
 
 #include "ark_global.h"
-#include "ark_logs.h"
+#include "ark_ethdev_logs.h"
 #include "ark_ethdev_tx.h"
 #include "ark_ethdev_rx.h"
 #include "ark_mpu.h"
@@ -102,26 +102,6 @@ static const struct rte_pci_id pci_id_ark_map[] = {
{.vendor_id = 0, /* sentinel */ },
 };
 
-/*
- * This structure is used to statically define the capabilities
- * of supported devices.
- * Capabilities:
- *  rqpacing -
- * Some HW variants require that PCIe read-requests be correctly throttled.
- * This is called "rqpacing" and has to do with credit and flow control
- * on certain Arkville implementations.
- */
-struct ark_caps {
-   bool rqpacing;
-   bool isvf;
-};
-struct ark_dev_caps {
-   uint32_t  device_id;
-   struct ark_caps  caps;
-};
-#define SET_DEV_CAPS(id, rqp, vf)  \
-   {id, {.rqpacing = rqp, .isvf = vf} }
-
 static const struct ark_dev_caps
 ark_device_caps[] = {
 SET_DEV_CAPS(0x100d, true, false),
@@ -211,26 +191,26 @@ check_for_ext(struct ark_adapter *ark)
const char *dllpath = getenv("ARK_EXT_PATH");
 
if (dllpath == NULL) {
-   ARK_PMD_LOG(DEBUG, "EXT NO dll path specified\n");
+   ARK_ETHDEV_LOG(DEBUG, "EXT NO dll path specified\n");
return 0;
}
-   ARK_PMD_LOG(NOTICE, "EXT found dll path at %s\n", dllpath);
+   ARK_ETHDEV_LOG(NOTICE, "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) {
-   ARK_PMD_LOG(ERR, "Could not load user extension %s\n",
+   ARK_ETHDEV_LOG(ERR, "Could not load user extension %s\n",
dllpath);
return -1;
}
-   ARK_PMD_LOG(DEBUG, "SUCCESS: loaded user extension %s\n",
+   ARK_ETHDEV_LOG(DEBUG, "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, "rte_pmd_ark_dev_init");
-   ARK_PMD_LOG(DEBUG, "device ext init pointer = %p\n",
+   ARK_ETHDEV_LOG(DEBUG, "device ext init pointer = %p\n",
  ark->user_ext.dev_init);
ark->user_ext.dev_get_port_count =
(int (*)(struct rte_eth_dev *, void *))
@@ -303,7 +283,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 
ark->eth_dev = dev;
 
-   ARK_PMD_LOG(DEBUG, "\n");
+   ARK_ETHDEV_LOG(DEBUG, "\n");
 
/* Check to see if there is an extension that we need to load */
ret = check_for_ext(ark);
@@ -351,15 +331,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
ark->started = 0;
ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
-   ARK_PMD_LOG(INFO, "Sys Ctrl Const = 0x%x  HW Commit_ID: %08x\n",
+   ARK_ETHDEV_LOG(INFO, "Sys Ctrl Const = 0x%x  HW Commit_ID: %08x\n",
  ark->sysctrl.t32[4],
  rte_be_to_cpu_32(ark->sysctrl.t32[0x20 / 4]));
-   ARK_PMD_LOG(NOTICE, "Arkville HW Commit_ID: %08x\n",
+   ARK_ETHDEV_LOG(NOTICE, "Arkville 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) {
-   ARK_PMD_LOG(ERR,
+   ARK_ETHDEV_LOG(ERR,
"HW Sanity test has failed, expected constant"
" 0x%x, read 0x%x (%s)\n",
0xcafef00d,
@@ -369,16 +349,16 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
if (ark->sysctrl.t32[3] != 0) {
if (ark->rqpacing) {
 

[PATCH 10/14] baseband/ark: introduce ark baseband driver

2022-10-26 Thread John Miller
This patch introduces the Arkville baseband device driver.

Signed-off-by: John Miller 
---
 drivers/baseband/ark/ark_bbdev.c | 1127 ++
 drivers/baseband/ark/ark_bbext.h |  163 +
 2 files changed, 1290 insertions(+)
 create mode 100644 drivers/baseband/ark/ark_bbdev.c
 create mode 100644 drivers/baseband/ark/ark_bbext.h

diff --git a/drivers/baseband/ark/ark_bbdev.c b/drivers/baseband/ark/ark_bbdev.c
new file mode 100644
index 00..8736d170d1
--- /dev/null
+++ b/drivers/baseband/ark/ark_bbdev.c
@@ -0,0 +1,1127 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016-2021 Atomic Rules LLC
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ark_common.h"
+#include "ark_bbdev_common.h"
+#include "ark_bbdev_custom.h"
+#include "ark_ddm.h"
+#include "ark_mpu.h"
+#include "ark_rqp.h"
+#include "ark_udm.h"
+#include "ark_bbext.h"
+
+#define DRIVER_NAME baseband_ark
+
+#define ARK_SYSCTRL_BASE  0x0
+#define ARK_PKTGEN_BASE   0x1
+#define ARK_MPU_RX_BASE   0x2
+#define ARK_UDM_BASE  0x3
+#define ARK_MPU_TX_BASE   0x4
+#define ARK_DDM_BASE  0x6
+#define ARK_PKTDIR_BASE   0xa
+#define ARK_PKTCHKR_BASE  0x9
+#define ARK_RCPACING_BASE 0xb
+#define ARK_MPU_QOFFSET   0x00100
+
+#define BB_ARK_TX_Q_FACTOR 4
+
+#define ARK_RX_META_SIZE 32
+#define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
+#define ARK_RX_MAX_NOCHAIN (RTE_MBUF_DEFAULT_DATAROOM)
+
+static_assert(sizeof(struct ark_rx_meta) == ARK_RX_META_SIZE, "Unexpected 
struct size ark_rx_meta");
+static_assert(sizeof(union ark_tx_meta) == 8, "Unexpected struct size 
ark_tx_meta");
+
+static struct rte_pci_id pci_id_ark[] = {
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1015)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1016)},
+   {.device_id = 0},
+};
+
+static const struct ark_dev_caps
+ark_device_caps[] = {
+SET_DEV_CAPS(0x1015, true, false),
+SET_DEV_CAPS(0x1016, true, false),
+{.device_id = 0,}
+};
+
+
+/* Forward declarations */
+static const struct rte_bbdev_ops ark_bbdev_pmd_ops;
+
+static int
+check_for_ext(struct ark_bbdevice *ark)
+{
+   /* Get the env */
+   const char *dllpath = getenv("ARK_BBEXT_PATH");
+
+   if (dllpath == NULL) {
+   ARK_BBDEV_LOG(DEBUG, "EXT NO dll path specified\n");
+   return 0;
+   }
+   ARK_BBDEV_LOG(NOTICE, "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) {
+   ARK_BBDEV_LOG(ERR, "Could not load user extension %s\n",
+   dllpath);
+   return -1;
+   }
+   ARK_BBDEV_LOG(DEBUG, "SUCCESS: loaded user extension %s\n",
+   dllpath);
+
+   /* Get the entry points */
+   ark->user_ext.dev_init =
+   (void *(*)(struct rte_bbdev *, void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_init");
+
+   ark->user_ext.dev_uninit =
+   (int (*)(struct rte_bbdev *, void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_dev_uninit");
+   ark->user_ext.dev_start =
+   (int (*)(struct rte_bbdev *, void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_start");
+   ark->user_ext.dev_stop =
+   (int (*)(struct rte_bbdev *, void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_stop");
+   ark->user_ext.dequeue_ldpc_dec  =
+   (int (*)(struct rte_bbdev *,
+struct rte_bbdev_dec_op *,
+uint32_t *,
+void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_dequeue_ldpc_dec");
+   ark->user_ext.enqueue_ldpc_dec  =
+   (int (*)(struct rte_bbdev *,
+struct rte_bbdev_dec_op *,
+uint32_t *,
+uint8_t *,
+void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_enqueue_ldpc_dec");
+   ark->user_ext.dequeue_ldpc_enc  =
+   (int (*)(struct rte_bbdev *,
+struct rte_bbdev_enc_op *,
+uint32_t *,
+void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_dequeue_ldpc_enc");
+   ark->user_ext.enqueue_ldpc_enc  =
+   (int (*)(struct rte_bbdev *,
+struct rte_bbdev_enc_op *,
+uint32_t *,
+uint8_t *,
+ 

[PATCH 11/14] baseband/ark: introduce ark baseband driver custom functions

2022-10-26 Thread John Miller
This patch introduces the Arkville baseband device driver custom functions.

Signed-off-by: John Miller 
---
 drivers/baseband/ark/ark_bbdev_custom.c | 201 
 drivers/baseband/ark/ark_bbdev_custom.h |  30 
 2 files changed, 231 insertions(+)
 create mode 100644 drivers/baseband/ark/ark_bbdev_custom.c
 create mode 100644 drivers/baseband/ark/ark_bbdev_custom.h

diff --git a/drivers/baseband/ark/ark_bbdev_custom.c 
b/drivers/baseband/ark/ark_bbdev_custom.c
new file mode 100644
index 00..6b1553abe1
--- /dev/null
+++ b/drivers/baseband/ark/ark_bbdev_custom.c
@@ -0,0 +1,201 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016-2021 Atomic Rules LLC
+ */
+
+#include 
+#include 
+
+#include 
+#include/* For debug */
+
+
+#include "ark_bbdev_common.h"
+#include "ark_bbdev_custom.h"
+
+/* It is expected that functions in this file will be modified based on
+ * specifics of the FPGA hardware beyond the core Arkville
+ * components.
+ */
+
+/* bytyes must be range of 0 to 20 */
+static inline
+uint8_t ark_bb_cvt_bytes_meta_cnt(size_t bytes)
+{
+   return (bytes + 3) / 8;
+}
+
+void
+ark_bbdev_info_get(struct rte_bbdev *dev,
+  struct rte_bbdev_driver_info *dev_info)
+{
+   struct ark_bbdevice *ark_bb =  dev->data->dev_private;
+
+   static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
+   {
+   .type = RTE_BBDEV_OP_LDPC_DEC,
+   .cap.ldpc_dec = {
+   .capability_flags =
+   RTE_BBDEV_LDPC_CRC_24B_ATTACH |
+   RTE_BBDEV_LDPC_RATE_MATCH,
+   .num_buffers_src =
+   RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+   .num_buffers_hard_out =
+   RTE_BBDEV_LDPC_MAX_CODE_BLOCKS
+   }
+   },
+   {
+   .type = RTE_BBDEV_OP_LDPC_ENC,
+   .cap.ldpc_enc = {
+   .capability_flags =
+   RTE_BBDEV_LDPC_CRC_24B_ATTACH |
+   RTE_BBDEV_LDPC_RATE_MATCH,
+   .num_buffers_src =
+   RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+   .num_buffers_dst =
+   RTE_BBDEV_LDPC_MAX_CODE_BLOCKS
+   }
+   },
+   RTE_BBDEV_END_OF_CAPABILITIES_LIST(),
+   };
+
+   static struct rte_bbdev_queue_conf default_queue_conf = {
+   .queue_size = RTE_BBDEV_QUEUE_SIZE_LIMIT,
+   };
+
+   default_queue_conf.socket = dev->data->socket_id;
+
+   dev_info->driver_name = RTE_STR(DRIVER_NAME);
+   dev_info->max_num_queues = ark_bb->max_nb_queues;
+   dev_info->queue_size_lim = RTE_BBDEV_QUEUE_SIZE_LIMIT;
+   dev_info->hardware_accelerated = true;
+   dev_info->max_dl_queue_priority = 0;
+   dev_info->max_ul_queue_priority = 0;
+   dev_info->default_queue_conf = default_queue_conf;
+   dev_info->capabilities = bbdev_capabilities;
+   dev_info->cpu_flag_reqs = NULL;
+   dev_info->min_alignment = 4;
+
+}
+
+/* Structure defining layout of the ldpc command struct */
+struct ark_bb_ldpc_enc_meta {
+   uint16_t header;
+   uint8_t rv_index:2,
+   basegraph:1,
+   code_block_mode:1,
+   rfu_71_68:4;
+
+   uint8_t q_m;
+   uint32_t e_ea;
+   uint32_t eb;
+   uint8_t c;
+   uint8_t cab;
+   uint16_t n_cb;
+   uint16_t pad;
+   uint16_t trailer;
+} __rte_packed;
+
+/* The size must be less then 20 Bytes */
+static_assert(sizeof(struct ark_bb_ldpc_enc_meta) <= 20, "struct size");
+
+/* Custom operation on equeue ldpc operation  */
+/* Do these function need queue number? */
+/* Maximum of 20 bytes */
+int
+ark_bb_user_enqueue_ldpc_enc(struct rte_bbdev_enc_op *enc_op,
+ uint32_t *meta, uint8_t *meta_cnt)
+{
+   struct rte_bbdev_op_ldpc_enc *ldpc_enc_op = &enc_op->ldpc_enc;
+   struct ark_bb_ldpc_enc_meta *src = (struct ark_bb_ldpc_enc_meta *)meta;
+
+   src->header = 0x4321;   /* For testings */
+   src->trailer = 0xFEDC;
+
+   src->rv_index = ldpc_enc_op->rv_index;
+   src->basegraph = ldpc_enc_op->basegraph;
+   src->code_block_mode = ldpc_enc_op->code_block_mode;
+
+   src->q_m = ldpc_enc_op->q_m;
+   src->e_ea = 0xABCD;
+   src->eb = ldpc_enc_op->tb_params.eb;
+   src->c = ldpc_enc_op->tb_params.c;
+   src->cab = ldpc_enc_op->tb_params.cab;
+
+   src->n_cb = 0;
+
+   meta[0] = 0x1110;
+   meta[1] = 0x2220

[PATCH 12/14] baseband/ark: introduce ark baseband driver common functions

2022-10-26 Thread John Miller
This patch introduces the Arkville baseband device driver common functions.

Signed-off-by: John Miller 
---
 drivers/baseband/ark/ark_bbdev_common.c | 109 
 drivers/baseband/ark/ark_bbdev_common.h | 100 ++
 2 files changed, 209 insertions(+)
 create mode 100644 drivers/baseband/ark/ark_bbdev_common.c
 create mode 100644 drivers/baseband/ark/ark_bbdev_common.h

diff --git a/drivers/baseband/ark/ark_bbdev_common.c 
b/drivers/baseband/ark/ark_bbdev_common.c
new file mode 100644
index 00..b980dd7159
--- /dev/null
+++ b/drivers/baseband/ark/ark_bbdev_common.c
@@ -0,0 +1,109 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016-2021 Atomic Rules LLC
+ */
+
+#include 
+
+#include 
+#include 
+
+#include "ark_bbdev_common.h"
+
+int ark_bbdev_logtype;
+RTE_LOG_REGISTER_DEFAULT(ark_bbdev_logtype, DEBUG);
+
+static const char * const ark_bbdev_valid_params[] = {
+   ARK_BBDEV_PKTDIR_ARG,
+   ARK_BBDEV_PKTGEN_ARG,
+   ARK_BBDEV_PKTCHKR_ARG,
+   NULL
+};
+
+static inline int
+process_pktdir_arg(const char *key, const char *value,
+  void *extra_args)
+{
+   uint32_t *u32 = extra_args;
+   ARK_BBDEV_LOG(DEBUG, "key = %s, value = %s", key, value);
+
+   *u32 = strtol(value, NULL, 0);
+   ARK_BBDEV_LOG(DEBUG, "pkt_dir_v = 0x%x", *u32);
+   return 0;
+}
+
+static inline int
+process_file_args(const char *key, const char *value, void *extra_args)
+{
+   char *args = (char *)extra_args;
+   ARK_BBDEV_LOG(DEBUG, "key = %s, value = %s", key, value);
+
+   /* Open the configuration file */
+   FILE *file = fopen(value, "r");
+   char line[ARK_MAX_ARG_LEN];
+   int  size = 0;
+   int first = 1;
+
+   if (file == NULL) {
+   ARK_BBDEV_LOG(ERR, "Unable to open config file %s",
+ value);
+   return -1;
+   }
+
+   while (fgets(line, sizeof(line), file)) {
+   size += strlen(line);
+   if (size >= ARK_MAX_ARG_LEN) {
+   ARK_BBDEV_LOG(ERR, "Unable to parse file %s args, "
+ "parameter list is too long", value);
+   fclose(file);
+   return -1;
+   }
+   if (first) {
+   strncpy(args, line, ARK_MAX_ARG_LEN);
+   first = 0;
+   } else {
+   strncat(args, line, ARK_MAX_ARG_LEN);
+   }
+   }
+   ARK_BBDEV_LOG(DEBUG, "file = %s", args);
+   fclose(file);
+   return 0;
+}
+
+
+/* Parse parameters used to create device */
+int
+parse_ark_bbdev_params(const char *input_args,
+  struct ark_bbdevice *ark_bb)
+{
+   struct rte_kvargs *kvlist = NULL;
+   int ret = 0;
+
+   if (ark_bb == NULL)
+   return -EINVAL;
+   if (input_args == NULL)
+   return ret;
+
+   kvlist = rte_kvargs_parse(input_args, ark_bbdev_valid_params);
+   if (kvlist == NULL)
+   return -EFAULT;
+
+   ret = rte_kvargs_process(kvlist, ARK_BBDEV_PKTDIR_ARG,
+ &process_pktdir_arg, &ark_bb->pkt_dir_v);
+   if (ret < 0)
+   goto exit;
+
+   ret = rte_kvargs_process(kvlist, ARK_BBDEV_PKTGEN_ARG,
+&process_file_args, &ark_bb->pkt_gen_args);
+   if (ret < 0)
+   goto exit;
+
+   ret = rte_kvargs_process(kvlist, ARK_BBDEV_PKTCHKR_ARG,
+&process_file_args, &ark_bb->pkt_chkr_args);
+   if (ret < 0)
+   goto exit;
+
+ exit:
+   if (kvlist)
+   rte_kvargs_free(kvlist);
+   return ret;
+}
diff --git a/drivers/baseband/ark/ark_bbdev_common.h 
b/drivers/baseband/ark/ark_bbdev_common.h
new file mode 100644
index 00..9240a11669
--- /dev/null
+++ b/drivers/baseband/ark/ark_bbdev_common.h
@@ -0,0 +1,100 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016-2021 Atomic Rules LLC
+ */
+
+#ifndef _ARK_BBDEV_COMMON_H_
+#define _ARK_BBDEV_COMMON_H_
+
+#include "ark_pktchkr.h"
+#include "ark_pktdir.h"
+#include "ark_pktgen.h"
+#include "ark_bbext.h"
+
+#define ARK_MAX_ARG_LEN 256
+
+/* Acceptable params for ark BBDEV devices */
+/*
+ * The packet generator is a functional block used to generate packet
+ * patterns for testing.  It is not intended for nominal use.
+ */
+#define ARK_BBDEV_PKTGEN_ARG "Pkt_gen"
+
+/*
+ * The packet checker is a functional block used to verify packet
+ * patterns for testing.  It is not intended for nominal use.
+ */
+#define ARK_BBDEV_PKTCHKR_ARG "Pkt_chkr"
+
+/*
+ * The packet director is used to select the internal ingress and
+ * egress packets paths during t

[PATCH 13/14] baseband/ark: introduce ark baseband build files

2022-10-26 Thread John Miller
This patch introduces the Arkville baseband device driver build files.

Signed-off-by: John Miller 
---
 drivers/baseband/ark/meson.build | 11 +++
 drivers/baseband/ark/version.map |  3 +++
 2 files changed, 14 insertions(+)
 create mode 100644 drivers/baseband/ark/meson.build
 create mode 100644 drivers/baseband/ark/version.map

diff --git a/drivers/baseband/ark/meson.build b/drivers/baseband/ark/meson.build
new file mode 100644
index 00..b876f05c6e
--- /dev/null
+++ b/drivers/baseband/ark/meson.build
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Luca Boccassi 
+
+deps += ['common_ark', 'bbdev', 'bus_pci', 'pci', 'ring']
+sources = files(
+   'ark_bbdev.c',
+   'ark_bbdev_common.c',
+   'ark_bbdev_custom.c'
+   )
+
+includes += include_directories('../../common/ark')
diff --git a/drivers/baseband/ark/version.map b/drivers/baseband/ark/version.map
new file mode 100644
index 00..4a76d1d52d
--- /dev/null
+++ b/drivers/baseband/ark/version.map
@@ -0,0 +1,3 @@
+DPDK_21 {
+   local: *;
+};
-- 
2.25.1



[PATCH 14/14] baseband/meson.build:

2022-10-26 Thread John Miller
Add ark baseband device to build system.

Signed-off-by: John Miller 
---
 drivers/baseband/meson.build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 686e98b2ed..084ff46155 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -6,6 +6,7 @@ if is_windows
 endif
 
 drivers = [
+'ark',
 'acc100',
 'fpga_5gnr_fec',
 'fpga_lte_fec',
-- 
2.25.1



[PATCH 1/4] net/ark: add device capabilities record

2022-01-19 Thread John Miller
Add static record of supported device capabilities.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c | 58 +---
 1 file changed, 48 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index b618cba3f0..0414c78bb5 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -96,6 +96,26 @@ static const struct rte_pci_id pci_id_ark_map[] = {
{.vendor_id = 0, /* sentinel */ },
 };
 
+struct ark_caps {
+   bool rqpacing;
+};
+struct ark_dev_caps {
+   uint32_t  device_id;
+   struct ark_caps  caps;
+};
+static const struct ark_dev_caps
+ark_device_caps[] = {
+{0x100d, {.rqpacing = true} },
+{0x100e, {.rqpacing = true} },
+{0x100f, {.rqpacing = true} },
+{0x1010, {.rqpacing = false} },
+{0x1017, {.rqpacing = true} },
+{0x1018, {.rqpacing = true} },
+{0x1019, {.rqpacing = true} },
+{0x101e, {.rqpacing = false} },
+{.device_id = 0,}
+};
+
 static int
 eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
struct rte_pci_device *pci_dev)
@@ -256,6 +276,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
int ret;
int port_count = 1;
int p;
+   bool rqpacing = false;
 
ark->eth_dev = dev;
 
@@ -270,6 +291,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
rte_eth_copy_pci_info(dev, pci_dev);
dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
+   p = 0;
+   while (ark_device_caps[p].device_id != 0) {
+   if (pci_dev->id.device_id == ark_device_caps[p].device_id) {
+   rqpacing = ark_device_caps[p].caps.rqpacing;
+   break;
+   }
+   p++;
+   }
+
/* Use dummy function until setup */
dev->rx_pkt_burst = ð_ark_recv_pkts_noop;
dev->tx_pkt_burst = ð_ark_xmit_pkts_noop;
@@ -288,8 +318,12 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
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);
+   if (rqpacing) {
+   ark->rqpacing =
+   (struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
+   } else {
+   ark->rqpacing = NULL;
+   }
ark->started = 0;
ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
@@ -309,13 +343,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
return -1;
}
if (ark->sysctrl.t32[3] != 0) {
-   if (ark_rqp_lasped(ark->rqpacing)) {
-   ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
-   "Timer has Expired\n");
-   return -1;
+   if (ark->rqpacing) {
+   if (ark_rqp_lasped(ark->rqpacing)) {
+   ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
+   "Timer has Expired\n");
+   return -1;
+   }
+   ARK_PMD_LOG(WARNING, "Arkville Evaluation System - "
+   "Timer is Running\n");
}
-   ARK_PMD_LOG(WARNING, "Arkville Evaluation System - "
-   "Timer is Running\n");
}
 
ARK_PMD_LOG(DEBUG,
@@ -499,7 +535,8 @@ ark_config_device(struct rte_eth_dev *dev)
ark_ddm_stats_reset(ark->ddm.v);
 
ark_ddm_stop(ark->ddm.v, 0);
-   ark_rqp_stats_reset(ark->rqpacing);
+   if (ark->rqpacing)
+   ark_rqp_stats_reset(ark->rqpacing);
 
return 0;
 }
@@ -695,7 +732,8 @@ eth_ark_dev_close(struct rte_eth_dev *dev)
/*
 * TODO This should only be called once for the device during shutdown
 */
-   ark_rqp_dump(ark->rqpacing);
+   if (ark->rqpacing)
+   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]);
-- 
2.25.1



[PATCH 2/4] net/ark: support arbitrary mbuf size

2022-01-19 Thread John Miller
Support arbitrary mbuf size per queue.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c|  8 
 drivers/net/ark/ark_ethdev_rx.c | 23 +++
 drivers/net/ark/ark_udm.h   |  2 +-
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 0414c78bb5..b9843414b1 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -511,14 +511,6 @@ ark_config_device(struct rte_eth_dev *dev)
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))
ARK_PMD_LOG(ERR, "Unable to stop DDM\n");
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 98658ce621..1000f50be0 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -12,7 +12,6 @@
 
 #define ARK_RX_META_SIZE 32
 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
-#define ARK_RX_MAX_NOCHAIN (RTE_MBUF_DEFAULT_DATAROOM)
 
 /* Forward declarations */
 struct ark_rx_queue;
@@ -41,6 +40,9 @@ struct ark_rx_queue {
rx_user_meta_hook_fn rx_user_meta_hook;
void *ext_user_data;
 
+   uint32_t dataroom;
+   uint32_t headroom;
+
uint32_t queue_size;
uint32_t queue_mask;
 
@@ -164,6 +166,9 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 
/* NOTE zmalloc is used, no need to 0 indexes, etc. */
queue->mb_pool = mb_pool;
+   queue->dataroom = rte_pktmbuf_data_room_size(mb_pool) -
+   RTE_PKTMBUF_HEADROOM;
+   queue->headroom = RTE_PKTMBUF_HEADROOM;
queue->phys_qid = qidx;
queue->queue_index = queue_idx;
queue->queue_size = nb_desc;
@@ -196,6 +201,15 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
queue->udm = RTE_PTR_ADD(ark->udm.v, qidx * ARK_UDM_QOFFSET);
queue->mpu = RTE_PTR_ADD(ark->mpurx.v, qidx * ARK_MPU_QOFFSET);
 
+   /* Configure UDM per queue */
+   ark_udm_stop(queue->udm, 0);
+   ark_udm_configure(queue->udm,
+ RTE_PKTMBUF_HEADROOM,
+ queue->dataroom,
+ ARK_RX_WRITE_TIME_NS);
+   ark_udm_stats_reset(queue->udm);
+   ark_udm_stop(queue->udm, 0);
+
/* populate mbuf reserve */
status = eth_ark_rx_seed_mbufs(queue);
 
@@ -276,6 +290,7 @@ eth_ark_recv_pkts(void *rx_queue,
mbuf->data_len = meta->pkt_len;
 
if (ARK_DEBUG_CORE) {   /* debug sanity checks */
+
if ((meta->pkt_len > (1024 * 16)) ||
(meta->pkt_len == 0)) {
ARK_PMD_LOG(DEBUG, "RX: Bad Meta Q: %u"
@@ -304,7 +319,7 @@ eth_ark_recv_pkts(void *rx_queue,
}
}
 
-   if (unlikely(meta->pkt_len > ARK_RX_MAX_NOCHAIN))
+   if (unlikely(meta->pkt_len > queue->dataroom))
cons_index = eth_ark_rx_jumbo
(queue, meta, mbuf, cons_index + 1);
else
@@ -345,14 +360,14 @@ eth_ark_rx_jumbo(struct ark_rx_queue *queue,
/* first buf populated by called */
mbuf_prev = mbuf0;
segments = 1;
-   data_len = RTE_MIN(meta->pkt_len, RTE_MBUF_DEFAULT_DATAROOM);
+   data_len = RTE_MIN(meta->pkt_len, queue->dataroom);
remaining = meta->pkt_len - data_len;
mbuf0->data_len = data_len;
 
/* HW guarantees that the data does not exceed prod_index! */
while (remaining != 0) {
data_len = RTE_MIN(remaining,
-  RTE_MBUF_DEFAULT_DATAROOM);
+  queue->dataroom);
 
remaining -= data_len;
segments += 1;
diff --git a/drivers/net/ark/ark_udm.h b/drivers/net/ark/ark_udm.h
index 4e51a5e82c..1cbcd94a98 100644
--- a/drivers/net/ark/ark_udm.h
+++ b/drivers/net/ark/ark_udm.h
@@ -33,7 +33,7 @@ struct ark_rx_meta {
 #define ARK_RX_WRITE_TIME_NS 2500
 #define ARK_UDM_SETUP 0
 #define ARK_UDM_CONST2 0xbACECACE
-#define ARK_UDM_CONST3 0x334d4455
+#define ARK_UDM_CONST3 0x344d4455
 #define ARK_UDM_CONST ARK_UDM_CONST3
 struct ark_udm_setup_t {
uint32_t r0;
-- 
2.25.1



[PATCH 3/4] net/ark: publish include file for external access

2022-01-19 Thread John Miller
publish rte_pmd_ark.h for external access to extension

Signed-off-by: John Miller 
---
 doc/guides/nics/ark.rst  | 4 ++--
 drivers/net/ark/meson.build  | 2 ++
 drivers/net/ark/{ark_ext.h => rte_pmd_ark.h} | 8 ++--
 3 files changed, 10 insertions(+), 4 deletions(-)
 rename drivers/net/ark/{ark_ext.h => rte_pmd_ark.h} (97%)

diff --git a/doc/guides/nics/ark.rst b/doc/guides/nics/ark.rst
index da61814b5d..bcc3babd53 100644
--- a/doc/guides/nics/ark.rst
+++ b/doc/guides/nics/ark.rst
@@ -143,7 +143,7 @@ object file contains extension (or hook) functions that are 
registered
 and then called during PMD operations.
 
 The allowable set of extension functions are defined and documented in
-``ark_ext.h``, only the initialization function,
+``rte_pmd_ark.h``, only the initialization function,
 ``rte_pmd_ark_dev_init()``, is required; all others are optional. The
 following sections give a small extension example along with
 instructions for compiling and using the extension.
@@ -157,7 +157,7 @@ during RX from user meta data coming from FPGA hardware.
 
 .. code-block:: c
 
-   #include 
+   #include 
#include 
#include 
#include 
diff --git a/drivers/net/ark/meson.build b/drivers/net/ark/meson.build
index 8d87744c22..83488d87a8 100644
--- a/drivers/net/ark/meson.build
+++ b/drivers/net/ark/meson.build
@@ -7,6 +7,8 @@ if is_windows
 subdir_done()
 endif
 
+headers = files('rte_pmd_ark.h')
+
 sources = files(
 'ark_ddm.c',
 'ark_ethdev.c',
diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/rte_pmd_ark.h
similarity index 97%
rename from drivers/net/ark/ark_ext.h
rename to drivers/net/ark/rte_pmd_ark.h
index d235d0ff85..f77c36eb2d 100644
--- a/drivers/net/ark/ark_ext.h
+++ b/drivers/net/ark/rte_pmd_ark.h
@@ -5,7 +5,11 @@
 #ifndef _ARK_EXT_H_
 #define _ARK_EXT_H_
 
-#include 
+#include 
+struct rte_eth_dev;
+struct rte_mbuf;
+struct rte_ether_addr;
+struct rte_eth_stats;
 
 /* The following section lists function prototypes for Arkville's
  * dynamic PMD extension. User's who create an extension
@@ -55,7 +59,7 @@ void rte_pmd_ark_dev_uninit(struct rte_eth_dev *dev, void 
*user_data);
  *   user argument from dev_init() call.
  * @return (0) if successful.
  */
-uint8_t dev_get_port_count(struct rte_eth_dev *dev, void *user_data);
+uint8_t rte_pmd_ark_dev_get_port_count(struct rte_eth_dev *dev, void 
*user_data);
 
 /**
  * Extension prototype, optional implementation.
-- 
2.25.1



[PATCH 4/4] net/ark: support chunk DMA transfers

2022-01-19 Thread John Miller
Add support for chunk DMA transfers.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ddm.c   |  1 +
 drivers/net/ark/ark_ethdev_rx.c | 16 +---
 drivers/net/ark/ark_mpu.c   |  1 +
 drivers/net/ark/ark_pktchkr.c   |  2 +-
 drivers/net/ark/ark_pktgen.c|  2 +-
 drivers/net/ark/ark_udm.c   |  3 +++
 6 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ark/ark_ddm.c b/drivers/net/ark/ark_ddm.c
index 2321371572..b16c739d50 100644
--- a/drivers/net/ark/ark_ddm.c
+++ b/drivers/net/ark/ark_ddm.c
@@ -55,6 +55,7 @@ ark_ddm_stop(struct ark_ddm_t *ddm, const int wait)
int cnt = 0;
 
ddm->cfg.command = 2;
+   rte_wmb();
while (wait && (ddm->cfg.stop_flushed & 0x01) == 0) {
if (cnt++ > 1000)
return 1;
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 1000f50be0..49134ea08f 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -12,6 +12,7 @@
 
 #define ARK_RX_META_SIZE 32
 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
+#define ARK_RX_MPU_CHUNK (64U)
 
 /* Forward declarations */
 struct ark_rx_queue;
@@ -104,7 +105,7 @@ static inline void
 eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index)
 {
queue->cons_index = cons_index;
-   if ((cons_index + queue->queue_size - queue->seed_index) >= 64U) {
+   if ((cons_index + queue->queue_size - queue->seed_index) >= 
ARK_RX_MPU_CHUNK) {
eth_ark_rx_seed_mbufs(queue);
ark_mpu_set_producer(queue->mpu, queue->seed_index);
}
@@ -179,12 +180,12 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
queue->reserve_q =
rte_zmalloc_socket("Ark_rx_queue mbuf",
   nb_desc * sizeof(struct rte_mbuf *),
-  64,
+  512,
   socket_id);
queue->paddress_q =
rte_zmalloc_socket("Ark_rx_queue paddr",
   nb_desc * sizeof(rte_iova_t),
-  64,
+  512,
   socket_id);
 
if (queue->reserve_q == 0 || queue->paddress_q == 0) {
@@ -455,7 +456,8 @@ eth_ark_rx_stop_queue(struct rte_eth_dev *dev, uint16_t 
queue_id)
 static inline int
 eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 {
-   uint32_t limit = queue->cons_index + queue->queue_size;
+   uint32_t limit = (queue->cons_index & ~(ARK_RX_MPU_CHUNK - 1)) +
+   queue->queue_size;
uint32_t seed_index = queue->seed_index;
 
uint32_t count = 0;
@@ -618,14 +620,14 @@ eth_ark_udm_force_close(struct rte_eth_dev *dev)
 
ark_mpu_start(queue->mpu);
/* Add some buffers */
-   index = 10 + queue->seed_index;
+   index = ARK_RX_MPU_CHUNK + queue->seed_index;
ark_mpu_set_producer(queue->mpu, index);
}
/* Wait to allow data to pass */
usleep(100);
 
-   ARK_PMD_LOG(DEBUG, "UDM forced flush attempt, stopped = %d\n",
-   ark_udm_is_flushed(ark->udm.v));
+   ARK_PMD_LOG(NOTICE, "UDM forced flush attempt, stopped = %d\n",
+   ark_udm_is_flushed(ark->udm.v));
}
ark_udm_reset(ark->udm.v);
 }
diff --git a/drivers/net/ark/ark_mpu.c b/drivers/net/ark/ark_mpu.c
index 8160c1de7b..b8e94b6ed3 100644
--- a/drivers/net/ark/ark_mpu.c
+++ b/drivers/net/ark/ark_mpu.c
@@ -68,6 +68,7 @@ ark_mpu_reset(struct ark_mpu_t *mpu)
int cnt = 0;
 
mpu->cfg.command = MPU_CMD_RESET;
+   rte_wmb();
 
while (mpu->cfg.command != MPU_CMD_IDLE) {
if (cnt++ > 1000)
diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c
index 84bb567a41..12a5abb2f7 100644
--- a/drivers/net/ark/ark_pktchkr.c
+++ b/drivers/net/ark/ark_pktchkr.c
@@ -113,7 +113,7 @@ ark_pktchkr_stopped(ark_pkt_chkr_t handle)
struct ark_pkt_chkr_inst *inst = (struct ark_pkt_chkr_inst *)handle;
uint32_t r = inst->sregs->pkt_start_stop;
 
-   return (((r >> 16) & 1) == 1);
+   return (((r >> 16) & 1) == 1) || (r == 0);
 }
 
 void
diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
index 515bfe461c..6195ef997f 100644
--- a/drivers/net/ark/ark_pktgen.c
+++ b/drivers/net/ark/ark_pktgen.c
@@ -107,7 +107,7 @@ ark_pktgen_paused(ark_pkt_gen_t handle)
struct ark_pkt_gen_inst *inst = (struct ark_pkt_gen_inst *)handle;
uint32_t r = inst->regs->pkt_start_stop;
 
-   retur

[PATCH v2 1/3] net/ark: add device capabilities record

2022-02-10 Thread John Miller
---

v2:
Certain variants require that PCIe read-requests be correctly
throttled. This is called "rqpacing" in Arkville, and has to do
with credit and flow control on certain Arkville implementations.

Improved code readability and comments.

---


Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c | 88 +---
 1 file changed, 71 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index b618cba3f0..9f5f375174 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -85,17 +85,53 @@ static const char * const valid_arguments[] = {
NULL
 };
 
+#define AR_VENDOR_ID 0x1d6c
 static const struct rte_pci_id pci_id_ark_map[] = {
-   {RTE_PCI_DEVICE(0x1d6c, 0x100d)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x100e)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x100f)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x1010)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x1017)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x1018)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x1019)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100d)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100e)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100f)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1010)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1017)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1018)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1019)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101e)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101f)},
{.vendor_id = 0, /* sentinel */ },
 };
 
+/*
+ * This structure is used to statically define the capabilities
+ * of supported devices.
+ * Capabilities:
+ *  rqpacing -
+ * Some HW variants require that PCIe read-requests be correctly throttled.
+ * This is called "rqpacing" and has to do with credit and flow control
+ * on certain Arkville implementations.
+ */
+struct ark_caps {
+   bool rqpacing;
+};
+struct ark_dev_caps {
+   uint32_t  device_id;
+   struct ark_caps  caps;
+};
+#define SET_DEV_CAPS(id, rqp) \
+   {id, {.rqpacing = rqp} }
+
+static const struct ark_dev_caps
+ark_device_caps[] = {
+SET_DEV_CAPS(0x100d, true),
+SET_DEV_CAPS(0x100e, true),
+SET_DEV_CAPS(0x100f, true),
+SET_DEV_CAPS(0x1010, false),
+SET_DEV_CAPS(0x1017, true),
+SET_DEV_CAPS(0x1018, true),
+SET_DEV_CAPS(0x1019, true),
+SET_DEV_CAPS(0x101e, false),
+SET_DEV_CAPS(0x101f, false),
+{.device_id = 0,}
+};
+
 static int
 eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
struct rte_pci_device *pci_dev)
@@ -256,6 +292,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
int ret;
int port_count = 1;
int p;
+   bool rqpacing = false;
 
ark->eth_dev = dev;
 
@@ -270,6 +307,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
rte_eth_copy_pci_info(dev, pci_dev);
dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
+   p = 0;
+   while (ark_device_caps[p].device_id != 0) {
+   if (pci_dev->id.device_id == ark_device_caps[p].device_id) {
+   rqpacing = ark_device_caps[p].caps.rqpacing;
+   break;
+   }
+   p++;
+   }
+
/* Use dummy function until setup */
dev->rx_pkt_burst = ð_ark_recv_pkts_noop;
dev->tx_pkt_burst = ð_ark_xmit_pkts_noop;
@@ -288,8 +334,12 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
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);
+   if (rqpacing) {
+   ark->rqpacing =
+   (struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
+   } else {
+   ark->rqpacing = NULL;
+   }
ark->started = 0;
ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
@@ -309,13 +359,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
return -1;
}
if (ark->sysctrl.t32[3] != 0) {
-   if (ark_rqp_lasped(ark->rqpacing)) {
-   ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
-   "Timer has Expired\n");
-   return -1;
+   if (ark->rqpacing) {
+   if (ark_rqp_lasped(ark->rqpacing)) {
+   ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
+   "Timer has Expired\n");
+   return -1;
+   }
+   ARK_PMD_LOG(WARNING, "Arkville Evaluation System - "

[PATCH v2 2/3] net/ark: support arbitrary mbuf size

2022-02-10 Thread John Miller
---

v2:
Added arbitrary mbuf size per queue capability.

Updated ARK_UDM_CONST3 value to reflect the version number
read from the HW that is required to support this change.

---

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c|  8 
 drivers/net/ark/ark_ethdev_rx.c | 23 +++
 drivers/net/ark/ark_udm.h   |  2 +-
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 9f5f375174..e2c0adf8cb 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -527,14 +527,6 @@ ark_config_device(struct rte_eth_dev *dev)
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))
ARK_PMD_LOG(ERR, "Unable to stop DDM\n");
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 98658ce621..1000f50be0 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -12,7 +12,6 @@
 
 #define ARK_RX_META_SIZE 32
 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
-#define ARK_RX_MAX_NOCHAIN (RTE_MBUF_DEFAULT_DATAROOM)
 
 /* Forward declarations */
 struct ark_rx_queue;
@@ -41,6 +40,9 @@ struct ark_rx_queue {
rx_user_meta_hook_fn rx_user_meta_hook;
void *ext_user_data;
 
+   uint32_t dataroom;
+   uint32_t headroom;
+
uint32_t queue_size;
uint32_t queue_mask;
 
@@ -164,6 +166,9 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 
/* NOTE zmalloc is used, no need to 0 indexes, etc. */
queue->mb_pool = mb_pool;
+   queue->dataroom = rte_pktmbuf_data_room_size(mb_pool) -
+   RTE_PKTMBUF_HEADROOM;
+   queue->headroom = RTE_PKTMBUF_HEADROOM;
queue->phys_qid = qidx;
queue->queue_index = queue_idx;
queue->queue_size = nb_desc;
@@ -196,6 +201,15 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
queue->udm = RTE_PTR_ADD(ark->udm.v, qidx * ARK_UDM_QOFFSET);
queue->mpu = RTE_PTR_ADD(ark->mpurx.v, qidx * ARK_MPU_QOFFSET);
 
+   /* Configure UDM per queue */
+   ark_udm_stop(queue->udm, 0);
+   ark_udm_configure(queue->udm,
+ RTE_PKTMBUF_HEADROOM,
+ queue->dataroom,
+ ARK_RX_WRITE_TIME_NS);
+   ark_udm_stats_reset(queue->udm);
+   ark_udm_stop(queue->udm, 0);
+
/* populate mbuf reserve */
status = eth_ark_rx_seed_mbufs(queue);
 
@@ -276,6 +290,7 @@ eth_ark_recv_pkts(void *rx_queue,
mbuf->data_len = meta->pkt_len;
 
if (ARK_DEBUG_CORE) {   /* debug sanity checks */
+
if ((meta->pkt_len > (1024 * 16)) ||
(meta->pkt_len == 0)) {
ARK_PMD_LOG(DEBUG, "RX: Bad Meta Q: %u"
@@ -304,7 +319,7 @@ eth_ark_recv_pkts(void *rx_queue,
}
}
 
-   if (unlikely(meta->pkt_len > ARK_RX_MAX_NOCHAIN))
+   if (unlikely(meta->pkt_len > queue->dataroom))
cons_index = eth_ark_rx_jumbo
(queue, meta, mbuf, cons_index + 1);
else
@@ -345,14 +360,14 @@ eth_ark_rx_jumbo(struct ark_rx_queue *queue,
/* first buf populated by called */
mbuf_prev = mbuf0;
segments = 1;
-   data_len = RTE_MIN(meta->pkt_len, RTE_MBUF_DEFAULT_DATAROOM);
+   data_len = RTE_MIN(meta->pkt_len, queue->dataroom);
remaining = meta->pkt_len - data_len;
mbuf0->data_len = data_len;
 
/* HW guarantees that the data does not exceed prod_index! */
while (remaining != 0) {
data_len = RTE_MIN(remaining,
-  RTE_MBUF_DEFAULT_DATAROOM);
+  queue->dataroom);
 
remaining -= data_len;
segments += 1;
diff --git a/drivers/net/ark/ark_udm.h b/drivers/net/ark/ark_udm.h
index 4e51a5e82c..1cbcd94a98 100644
--- a/drivers/net/ark/ark_udm.h
+++ b/drivers/net/ark/ark_udm.h
@@ -33,7 +33,7 @@ struct ark_rx_meta {
 #define ARK_RX_WRITE_TIME_NS 2500
 #define ARK_UDM_SETUP 0
 #define ARK_UDM_CONST2 0xbACECACE
-#define ARK_UDM_CONST3 0x334d4455
+#define ARK_UDM_CONST3 0x344d4455
 #define ARK_UDM_CONST ARK_UDM_CONST3
 struct ark_udm_setup_t {
uint32_t r0;
-- 
2.25.1



[PATCH v2 3/3] net/ark: support chunk DMA transfers

2022-02-10 Thread John Miller
---

v2:
Various performance optimizations and behavior fixes

- Chunk mpu transfer use 64 objects (512 byte)  to maintain memory
  read alignment
- Align mpu memory allocation to be at 512 byte boundaries
- Reduce force-close allocation from 1 objects to 64 objects
- Add memory write barriers for read and wait status functions
  in ddm, udm and mpu.
- Configuration status updates for internal packet checker and generator.

---

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ddm.c   |  1 +
 drivers/net/ark/ark_ethdev_rx.c | 16 +---
 drivers/net/ark/ark_mpu.c   |  1 +
 drivers/net/ark/ark_pktchkr.c   |  2 +-
 drivers/net/ark/ark_pktgen.c|  2 +-
 drivers/net/ark/ark_udm.c   |  3 +++
 6 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ark/ark_ddm.c b/drivers/net/ark/ark_ddm.c
index 2321371572..b16c739d50 100644
--- a/drivers/net/ark/ark_ddm.c
+++ b/drivers/net/ark/ark_ddm.c
@@ -55,6 +55,7 @@ ark_ddm_stop(struct ark_ddm_t *ddm, const int wait)
int cnt = 0;
 
ddm->cfg.command = 2;
+   rte_wmb();
while (wait && (ddm->cfg.stop_flushed & 0x01) == 0) {
if (cnt++ > 1000)
return 1;
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 1000f50be0..49134ea08f 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -12,6 +12,7 @@
 
 #define ARK_RX_META_SIZE 32
 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
+#define ARK_RX_MPU_CHUNK (64U)
 
 /* Forward declarations */
 struct ark_rx_queue;
@@ -104,7 +105,7 @@ static inline void
 eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index)
 {
queue->cons_index = cons_index;
-   if ((cons_index + queue->queue_size - queue->seed_index) >= 64U) {
+   if ((cons_index + queue->queue_size - queue->seed_index) >= 
ARK_RX_MPU_CHUNK) {
eth_ark_rx_seed_mbufs(queue);
ark_mpu_set_producer(queue->mpu, queue->seed_index);
}
@@ -179,12 +180,12 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
queue->reserve_q =
rte_zmalloc_socket("Ark_rx_queue mbuf",
   nb_desc * sizeof(struct rte_mbuf *),
-  64,
+  512,
   socket_id);
queue->paddress_q =
rte_zmalloc_socket("Ark_rx_queue paddr",
   nb_desc * sizeof(rte_iova_t),
-  64,
+  512,
   socket_id);
 
if (queue->reserve_q == 0 || queue->paddress_q == 0) {
@@ -455,7 +456,8 @@ eth_ark_rx_stop_queue(struct rte_eth_dev *dev, uint16_t 
queue_id)
 static inline int
 eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 {
-   uint32_t limit = queue->cons_index + queue->queue_size;
+   uint32_t limit = (queue->cons_index & ~(ARK_RX_MPU_CHUNK - 1)) +
+   queue->queue_size;
uint32_t seed_index = queue->seed_index;
 
uint32_t count = 0;
@@ -618,14 +620,14 @@ eth_ark_udm_force_close(struct rte_eth_dev *dev)
 
ark_mpu_start(queue->mpu);
/* Add some buffers */
-   index = 10 + queue->seed_index;
+   index = ARK_RX_MPU_CHUNK + queue->seed_index;
ark_mpu_set_producer(queue->mpu, index);
}
/* Wait to allow data to pass */
usleep(100);
 
-   ARK_PMD_LOG(DEBUG, "UDM forced flush attempt, stopped = %d\n",
-   ark_udm_is_flushed(ark->udm.v));
+   ARK_PMD_LOG(NOTICE, "UDM forced flush attempt, stopped = %d\n",
+   ark_udm_is_flushed(ark->udm.v));
}
ark_udm_reset(ark->udm.v);
 }
diff --git a/drivers/net/ark/ark_mpu.c b/drivers/net/ark/ark_mpu.c
index 8160c1de7b..b8e94b6ed3 100644
--- a/drivers/net/ark/ark_mpu.c
+++ b/drivers/net/ark/ark_mpu.c
@@ -68,6 +68,7 @@ ark_mpu_reset(struct ark_mpu_t *mpu)
int cnt = 0;
 
mpu->cfg.command = MPU_CMD_RESET;
+   rte_wmb();
 
while (mpu->cfg.command != MPU_CMD_IDLE) {
if (cnt++ > 1000)
diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c
index 84bb567a41..12a5abb2f7 100644
--- a/drivers/net/ark/ark_pktchkr.c
+++ b/drivers/net/ark/ark_pktchkr.c
@@ -113,7 +113,7 @@ ark_pktchkr_stopped(ark_pkt_chkr_t handle)
struct ark_pkt_chkr_inst *inst = (struct ark_pkt_chkr_inst *)handle;
uint32_t r = inst->sregs->pkt_start_stop;
 
-   return (((r >> 16) & 1) == 1);
+   return (((r >> 16) & 1) == 1) || (r == 0

[PATCH v2 1/3] net/ark: add device capabilities record

2022-02-11 Thread John Miller
Add a device capabilities record for supported features.
Certain variants require that PCIe read-requests be correctly
throttled. This is called "rqpacing" in Arkville, and has to do
with credit and flow control on certain Arkville implementations.

Signed-off-by: John Miller 

---
v2:
- Improved code readability and comments.
---
 drivers/net/ark/ark_ethdev.c | 88 +---
 1 file changed, 71 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index b618cba3f0..9f5f375174 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -85,17 +85,53 @@ static const char * const valid_arguments[] = {
NULL
 };
 
+#define AR_VENDOR_ID 0x1d6c
 static const struct rte_pci_id pci_id_ark_map[] = {
-   {RTE_PCI_DEVICE(0x1d6c, 0x100d)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x100e)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x100f)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x1010)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x1017)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x1018)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x1019)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100d)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100e)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100f)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1010)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1017)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1018)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1019)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101e)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101f)},
{.vendor_id = 0, /* sentinel */ },
 };
 
+/*
+ * This structure is used to statically define the capabilities
+ * of supported devices.
+ * Capabilities:
+ *  rqpacing -
+ * Some HW variants require that PCIe read-requests be correctly throttled.
+ * This is called "rqpacing" and has to do with credit and flow control
+ * on certain Arkville implementations.
+ */
+struct ark_caps {
+   bool rqpacing;
+};
+struct ark_dev_caps {
+   uint32_t  device_id;
+   struct ark_caps  caps;
+};
+#define SET_DEV_CAPS(id, rqp) \
+   {id, {.rqpacing = rqp} }
+
+static const struct ark_dev_caps
+ark_device_caps[] = {
+SET_DEV_CAPS(0x100d, true),
+SET_DEV_CAPS(0x100e, true),
+SET_DEV_CAPS(0x100f, true),
+SET_DEV_CAPS(0x1010, false),
+SET_DEV_CAPS(0x1017, true),
+SET_DEV_CAPS(0x1018, true),
+SET_DEV_CAPS(0x1019, true),
+SET_DEV_CAPS(0x101e, false),
+SET_DEV_CAPS(0x101f, false),
+{.device_id = 0,}
+};
+
 static int
 eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
struct rte_pci_device *pci_dev)
@@ -256,6 +292,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
int ret;
int port_count = 1;
int p;
+   bool rqpacing = false;
 
ark->eth_dev = dev;
 
@@ -270,6 +307,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
rte_eth_copy_pci_info(dev, pci_dev);
dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
+   p = 0;
+   while (ark_device_caps[p].device_id != 0) {
+   if (pci_dev->id.device_id == ark_device_caps[p].device_id) {
+   rqpacing = ark_device_caps[p].caps.rqpacing;
+   break;
+   }
+   p++;
+   }
+
/* Use dummy function until setup */
dev->rx_pkt_burst = ð_ark_recv_pkts_noop;
dev->tx_pkt_burst = ð_ark_xmit_pkts_noop;
@@ -288,8 +334,12 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
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);
+   if (rqpacing) {
+   ark->rqpacing =
+   (struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
+   } else {
+   ark->rqpacing = NULL;
+   }
ark->started = 0;
ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
@@ -309,13 +359,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
return -1;
}
if (ark->sysctrl.t32[3] != 0) {
-   if (ark_rqp_lasped(ark->rqpacing)) {
-   ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
-   "Timer has Expired\n");
-   return -1;
+   if (ark->rqpacing) {
+   if (ark_rqp_lasped(ark->rqpacing)) {
+   ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
+   "Timer has Expired\n");
+   return -1;
+   }
+

[PATCH v2 2/3] net/ark: support arbitrary mbuf size

2022-02-11 Thread John Miller
Added arbitrary mbuf size per queue capability.
Updated ARK_UDM_CONST3 value to reflect the version number
read from the HW that is required to support this change.

Signed-off-by: John Miller 

---
v2:
- Added more details to the git log.
---
 drivers/net/ark/ark_ethdev.c|  8 
 drivers/net/ark/ark_ethdev_rx.c | 23 +++
 drivers/net/ark/ark_udm.h   |  2 +-
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 9f5f375174..e2c0adf8cb 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -527,14 +527,6 @@ ark_config_device(struct rte_eth_dev *dev)
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))
ARK_PMD_LOG(ERR, "Unable to stop DDM\n");
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 98658ce621..1000f50be0 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -12,7 +12,6 @@
 
 #define ARK_RX_META_SIZE 32
 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
-#define ARK_RX_MAX_NOCHAIN (RTE_MBUF_DEFAULT_DATAROOM)
 
 /* Forward declarations */
 struct ark_rx_queue;
@@ -41,6 +40,9 @@ struct ark_rx_queue {
rx_user_meta_hook_fn rx_user_meta_hook;
void *ext_user_data;
 
+   uint32_t dataroom;
+   uint32_t headroom;
+
uint32_t queue_size;
uint32_t queue_mask;
 
@@ -164,6 +166,9 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 
/* NOTE zmalloc is used, no need to 0 indexes, etc. */
queue->mb_pool = mb_pool;
+   queue->dataroom = rte_pktmbuf_data_room_size(mb_pool) -
+   RTE_PKTMBUF_HEADROOM;
+   queue->headroom = RTE_PKTMBUF_HEADROOM;
queue->phys_qid = qidx;
queue->queue_index = queue_idx;
queue->queue_size = nb_desc;
@@ -196,6 +201,15 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
queue->udm = RTE_PTR_ADD(ark->udm.v, qidx * ARK_UDM_QOFFSET);
queue->mpu = RTE_PTR_ADD(ark->mpurx.v, qidx * ARK_MPU_QOFFSET);
 
+   /* Configure UDM per queue */
+   ark_udm_stop(queue->udm, 0);
+   ark_udm_configure(queue->udm,
+ RTE_PKTMBUF_HEADROOM,
+ queue->dataroom,
+ ARK_RX_WRITE_TIME_NS);
+   ark_udm_stats_reset(queue->udm);
+   ark_udm_stop(queue->udm, 0);
+
/* populate mbuf reserve */
status = eth_ark_rx_seed_mbufs(queue);
 
@@ -276,6 +290,7 @@ eth_ark_recv_pkts(void *rx_queue,
mbuf->data_len = meta->pkt_len;
 
if (ARK_DEBUG_CORE) {   /* debug sanity checks */
+
if ((meta->pkt_len > (1024 * 16)) ||
(meta->pkt_len == 0)) {
ARK_PMD_LOG(DEBUG, "RX: Bad Meta Q: %u"
@@ -304,7 +319,7 @@ eth_ark_recv_pkts(void *rx_queue,
}
}
 
-   if (unlikely(meta->pkt_len > ARK_RX_MAX_NOCHAIN))
+   if (unlikely(meta->pkt_len > queue->dataroom))
cons_index = eth_ark_rx_jumbo
(queue, meta, mbuf, cons_index + 1);
else
@@ -345,14 +360,14 @@ eth_ark_rx_jumbo(struct ark_rx_queue *queue,
/* first buf populated by called */
mbuf_prev = mbuf0;
segments = 1;
-   data_len = RTE_MIN(meta->pkt_len, RTE_MBUF_DEFAULT_DATAROOM);
+   data_len = RTE_MIN(meta->pkt_len, queue->dataroom);
remaining = meta->pkt_len - data_len;
mbuf0->data_len = data_len;
 
/* HW guarantees that the data does not exceed prod_index! */
while (remaining != 0) {
data_len = RTE_MIN(remaining,
-  RTE_MBUF_DEFAULT_DATAROOM);
+  queue->dataroom);
 
remaining -= data_len;
segments += 1;
diff --git a/drivers/net/ark/ark_udm.h b/drivers/net/ark/ark_udm.h
index 4e51a5e82c..1cbcd94a98 100644
--- a/drivers/net/ark/ark_udm.h
+++ b/drivers/net/ark/ark_udm.h
@@ -33,7 +33,7 @@ struct ark_rx_meta {
 #define ARK_RX_WRITE_TIME_NS 2500
 #define ARK_UDM_SETUP 0
 #define ARK_UDM_CONST2 0xbACECACE
-#define ARK_UDM_CONST3 0x334d4455
+#define ARK_UDM_CONST3 0x344d4455
 #define ARK_UDM_CONST ARK_UDM_CONST3
 struct ark_udm_setup_t {
uint32_t r0;
-- 
2.25.1



[PATCH v2 3/3] net/ark: support chunk DMA transfers

2022-02-11 Thread John Miller
Add support for chunk DMA transfers.
Various performance optimizations and behavior fixes.
Chunk mpu transfer use 64 objects (512 byte) to maintain memory
read alignment.
Align mpu memory allocation to be at 512 byte boundaries.
Reduce force-close allocation from 1 objects to 64 objects.
Add memory write barriers for read and wait status functions
in ddm, udm and mpu.
Configuration status updates for internal packet checker and
generator.

Signed-off-by: John Miller 

---
v2:
- Added more details to the git log.
---
 drivers/net/ark/ark_ddm.c   |  1 +
 drivers/net/ark/ark_ethdev_rx.c | 16 +---
 drivers/net/ark/ark_mpu.c   |  1 +
 drivers/net/ark/ark_pktchkr.c   |  2 +-
 drivers/net/ark/ark_pktgen.c|  2 +-
 drivers/net/ark/ark_udm.c   |  3 +++
 6 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ark/ark_ddm.c b/drivers/net/ark/ark_ddm.c
index 2321371572..b16c739d50 100644
--- a/drivers/net/ark/ark_ddm.c
+++ b/drivers/net/ark/ark_ddm.c
@@ -55,6 +55,7 @@ ark_ddm_stop(struct ark_ddm_t *ddm, const int wait)
int cnt = 0;
 
ddm->cfg.command = 2;
+   rte_wmb();
while (wait && (ddm->cfg.stop_flushed & 0x01) == 0) {
if (cnt++ > 1000)
return 1;
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 1000f50be0..49134ea08f 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -12,6 +12,7 @@
 
 #define ARK_RX_META_SIZE 32
 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
+#define ARK_RX_MPU_CHUNK (64U)
 
 /* Forward declarations */
 struct ark_rx_queue;
@@ -104,7 +105,7 @@ static inline void
 eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index)
 {
queue->cons_index = cons_index;
-   if ((cons_index + queue->queue_size - queue->seed_index) >= 64U) {
+   if ((cons_index + queue->queue_size - queue->seed_index) >= 
ARK_RX_MPU_CHUNK) {
eth_ark_rx_seed_mbufs(queue);
ark_mpu_set_producer(queue->mpu, queue->seed_index);
}
@@ -179,12 +180,12 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
queue->reserve_q =
rte_zmalloc_socket("Ark_rx_queue mbuf",
   nb_desc * sizeof(struct rte_mbuf *),
-  64,
+  512,
   socket_id);
queue->paddress_q =
rte_zmalloc_socket("Ark_rx_queue paddr",
   nb_desc * sizeof(rte_iova_t),
-  64,
+  512,
   socket_id);
 
if (queue->reserve_q == 0 || queue->paddress_q == 0) {
@@ -455,7 +456,8 @@ eth_ark_rx_stop_queue(struct rte_eth_dev *dev, uint16_t 
queue_id)
 static inline int
 eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 {
-   uint32_t limit = queue->cons_index + queue->queue_size;
+   uint32_t limit = (queue->cons_index & ~(ARK_RX_MPU_CHUNK - 1)) +
+   queue->queue_size;
uint32_t seed_index = queue->seed_index;
 
uint32_t count = 0;
@@ -618,14 +620,14 @@ eth_ark_udm_force_close(struct rte_eth_dev *dev)
 
ark_mpu_start(queue->mpu);
/* Add some buffers */
-   index = 10 + queue->seed_index;
+   index = ARK_RX_MPU_CHUNK + queue->seed_index;
ark_mpu_set_producer(queue->mpu, index);
}
/* Wait to allow data to pass */
usleep(100);
 
-   ARK_PMD_LOG(DEBUG, "UDM forced flush attempt, stopped = %d\n",
-   ark_udm_is_flushed(ark->udm.v));
+   ARK_PMD_LOG(NOTICE, "UDM forced flush attempt, stopped = %d\n",
+   ark_udm_is_flushed(ark->udm.v));
}
ark_udm_reset(ark->udm.v);
 }
diff --git a/drivers/net/ark/ark_mpu.c b/drivers/net/ark/ark_mpu.c
index 8160c1de7b..b8e94b6ed3 100644
--- a/drivers/net/ark/ark_mpu.c
+++ b/drivers/net/ark/ark_mpu.c
@@ -68,6 +68,7 @@ ark_mpu_reset(struct ark_mpu_t *mpu)
int cnt = 0;
 
mpu->cfg.command = MPU_CMD_RESET;
+   rte_wmb();
 
while (mpu->cfg.command != MPU_CMD_IDLE) {
if (cnt++ > 1000)
diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c
index 84bb567a41..12a5abb2f7 100644
--- a/drivers/net/ark/ark_pktchkr.c
+++ b/drivers/net/ark/ark_pktchkr.c
@@ -113,7 +113,7 @@ ark_pktchkr_stopped(ark_pkt_chkr_t handle)
struct ark_pkt_chkr_inst *inst = (struct ark_pkt_chkr_inst *)handle;
uint32_t r = inst->sregs->pkt_start_stop;
 
-   return (((r >> 16) & 1) == 1)

Re: [PATCH 11/14] baseband/ark: introduce ark baseband driver custom functions

2022-11-04 Thread John Miller
Hi Nicolas,

I spoke with the code author and this file was not intended to be upstreamed. 
It will be removed in V2.

-John


> On Oct 26, 2022, at 7:22 PM, Chautru, Nicolas  
> wrote:
> 
> Hi John, 
> 
>> -Original Message-
>> From: John Miller > <mailto:john.mil...@atomicrules.com>>
>> Sent: Wednesday, October 26, 2022 12:46 PM
>> To: Chautru, Nicolas > <mailto:nicolas.chau...@intel.com>>
>> Cc: dev@dpdk.org <mailto:dev@dpdk.org>; ed.cz...@atomicrules.com 
>> <mailto:ed.cz...@atomicrules.com>; Shepard Siegel
>> mailto:shepard.sie...@atomicrules.com>>; 
>> John Miller
>> mailto:john.mil...@atomicrules.com>>
>> Subject: [PATCH 11/14] baseband/ark: introduce ark baseband driver custom
>> functions
>> 
>> This patch introduces the Arkville baseband device driver custom functions.
>> 
>> Signed-off-by: John Miller 
>> ---
>> drivers/baseband/ark/ark_bbdev_custom.c | 201 
>> drivers/baseband/ark/ark_bbdev_custom.h |  30 
>> 2 files changed, 231 insertions(+)
>> create mode 100644 drivers/baseband/ark/ark_bbdev_custom.c
>> create mode 100644 drivers/baseband/ark/ark_bbdev_custom.h
>> 
>> diff --git a/drivers/baseband/ark/ark_bbdev_custom.c
>> b/drivers/baseband/ark/ark_bbdev_custom.c
>> new file mode 100644
>> index 00..6b1553abe1
>> --- /dev/null
>> +++ b/drivers/baseband/ark/ark_bbdev_custom.c
>> @@ -0,0 +1,201 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(c) 2016-2021 Atomic Rules LLC  */
>> +
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include /* For debug */
>> +
>> +
>> +#include "ark_bbdev_common.h"
>> +#include "ark_bbdev_custom.h"
>> +
>> +/* It is expected that functions in this file will be modified based on
>> + * specifics of the FPGA hardware beyond the core Arkville
>> + * components.
>> + */
>> +
>> +/* bytyes must be range of 0 to 20 */
>> +static inline
>> +uint8_t ark_bb_cvt_bytes_meta_cnt(size_t bytes) {
>> +return (bytes + 3) / 8;
>> +}
>> +
>> +void
>> +ark_bbdev_info_get(struct rte_bbdev *dev,
>> +   struct rte_bbdev_driver_info *dev_info) {
>> +struct ark_bbdevice *ark_bb =  dev->data->dev_private;
>> +
> 
> In your documentation in first commit you mentioned this
> * Support for LDPC encode and decode operations.
> * Support for Turbo encode and decode operations.
> But I only see LDPC below. More generally not really matching the doc I 
> think. Good to have the code and docs in same commits for that reason. 
> 
>> +static const struct rte_bbdev_op_cap bbdev_capabilities[] = {
>> +{
>> +.type = RTE_BBDEV_OP_LDPC_DEC,
>> +.cap.ldpc_dec = {
>> +.capability_flags =
>> +RTE_BBDEV_LDPC_CRC_24B_ATTACH
>> |
>> +RTE_BBDEV_LDPC_RATE_MATCH,
> 
> It doesn't look right
> Basically there se flags are not for LDPC_DEC but for the encoder
> There is no HARQ combine etc?
> I would have expected scatter gather here as well based on your documentation
> 
>> +.num_buffers_src =
>> +
>>  RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
>> +.num_buffers_hard_out =
>> +
>>  RTE_BBDEV_LDPC_MAX_CODE_BLOCKS
>> +}
>> +},
>> +{
>> +.type = RTE_BBDEV_OP_LDPC_ENC,
>> +.cap.ldpc_enc = {
>> +.capability_flags =
>> +RTE_BBDEV_LDPC_CRC_24B_ATTACH
>> |
>> +RTE_BBDEV_LDPC_RATE_MATCH,
>> +.num_buffers_src =
>> +
>>  RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
>> +.num_buffers_dst =
>> +
>>  RTE_BBDEV_LDPC_MAX_CODE_BLOCKS
>> +}
>> +},
>> +RTE_BBDEV_END_OF_CAPABILITIES_LIST(),
>> +};
>> +
>> +static struct rte_bbdev_queue_conf default_queue_conf = {
>> +.queue_size = RTE_BBDEV_QUEUE_SIZE_LIMIT,
>> +};
>> +
>> +default_queue_conf.socket = dev->data->socket_id;
>> +
>> +dev_info->driver_name = RTE_STR(DRIVER_NAME);
>> +dev_info->max_num_queues = ark_bb->max_nb_queues;
>> 

[PATCH v3 1/7] net/ark: add device capabilities record

2022-02-15 Thread John Miller
Add a device capabilities record for supported features.
Certain variants require that PCIe read-requests be correctly
throttled. This is called "rqpacing" in Arkville, and has to do
with credit and flow control on certain Arkville implementations.

Signed-off-by: John Miller 

---
v2:
- Improved code readability and comments.

v3:
- Split patch to separate new supported devices.
---
 drivers/net/ark/ark_ethdev.c | 84 
 1 file changed, 67 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 230a1272e9..d2b1cb083b 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -85,17 +85,49 @@ static const char * const valid_arguments[] = {
NULL
 };
 
+#define AR_VENDOR_ID 0x1d6c
 static const struct rte_pci_id pci_id_ark_map[] = {
-   {RTE_PCI_DEVICE(0x1d6c, 0x100d)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x100e)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x100f)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x1010)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x1017)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x1018)},
-   {RTE_PCI_DEVICE(0x1d6c, 0x1019)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100d)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100e)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100f)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1010)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1017)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1018)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1019)},
{.vendor_id = 0, /* sentinel */ },
 };
 
+/*
+ * This structure is used to statically define the capabilities
+ * of supported devices.
+ * Capabilities:
+ *  rqpacing -
+ * Some HW variants require that PCIe read-requests be correctly throttled.
+ * This is called "rqpacing" and has to do with credit and flow control
+ * on certain Arkville implementations.
+ */
+struct ark_caps {
+   bool rqpacing;
+};
+struct ark_dev_caps {
+   uint32_t  device_id;
+   struct ark_caps  caps;
+};
+#define SET_DEV_CAPS(id, rqp) \
+   {id, {.rqpacing = rqp} }
+
+static const struct ark_dev_caps
+ark_device_caps[] = {
+SET_DEV_CAPS(0x100d, true),
+SET_DEV_CAPS(0x100e, true),
+SET_DEV_CAPS(0x100f, true),
+SET_DEV_CAPS(0x1010, false),
+SET_DEV_CAPS(0x1017, true),
+SET_DEV_CAPS(0x1018, true),
+SET_DEV_CAPS(0x1019, true),
+{.device_id = 0,}
+};
+
 static int
 eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
struct rte_pci_device *pci_dev)
@@ -256,6 +288,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
int ret;
int port_count = 1;
int p;
+   bool rqpacing = false;
 
ark->eth_dev = dev;
 
@@ -270,6 +303,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
rte_eth_copy_pci_info(dev, pci_dev);
dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
+   p = 0;
+   while (ark_device_caps[p].device_id != 0) {
+   if (pci_dev->id.device_id == ark_device_caps[p].device_id) {
+   rqpacing = ark_device_caps[p].caps.rqpacing;
+   break;
+   }
+   p++;
+   }
+
/* Use dummy function until setup */
dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
@@ -288,8 +330,12 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
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);
+   if (rqpacing) {
+   ark->rqpacing =
+   (struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
+   } else {
+   ark->rqpacing = NULL;
+   }
ark->started = 0;
ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
@@ -309,13 +355,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
return -1;
}
if (ark->sysctrl.t32[3] != 0) {
-   if (ark_rqp_lasped(ark->rqpacing)) {
-   ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
-   "Timer has Expired\n");
-   return -1;
+   if (ark->rqpacing) {
+   if (ark_rqp_lasped(ark->rqpacing)) {
+   ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
+   "Timer has Expired\n");
+   return -1;
+   }
+   ARK_PMD_LOG(WARNING, "Arkville Evaluation System - "
+   "Timer is Running\n");
}
- 

[PATCH v3 2/7] net/ark: add support for new devices

2022-02-15 Thread John Miller
Add two new supported device ID's.
Add documentation for new devices.

Signed-off-by: John Miller 

---
v3:
- Split patch and added documentation
---
 doc/guides/nics/ark.rst  | 2 ++
 drivers/net/ark/ark_ethdev.c | 4 
 2 files changed, 6 insertions(+)

diff --git a/doc/guides/nics/ark.rst b/doc/guides/nics/ark.rst
index da61814b5d..60b61e08e8 100644
--- a/doc/guides/nics/ark.rst
+++ b/doc/guides/nics/ark.rst
@@ -297,6 +297,8 @@ ARK PMD supports the following Arkville RTL PCIe instances 
including:
 * ``1d6c:1017`` - AR-ARK-FX1 [Arkville 64B Multi-Homed Primary Endpoint]
 * ``1d6c:1018`` - AR-ARK-FX1 [Arkville 64B Multi-Homed Secondary Endpoint]
 * ``1d6c:1019`` - AR-ARK-FX1 [Arkville 64B Multi-Homed Tertiary Endpoint]
+* ``1d6c:101e`` - AR-ARKA-FX1 [Arkville 64B DPDK Data Mover for Agilex R-Tile]
+* ``1d6c:101f`` - AR-TK242 [2x100GbE Packet Capture Device]
 
 Supported Operating Systems
 ---
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index d2b1cb083b..a13f74718b 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -94,6 +94,8 @@ static const struct rte_pci_id pci_id_ark_map[] = {
{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1017)},
{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1018)},
{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1019)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101e)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101f)},
{.vendor_id = 0, /* sentinel */ },
 };
 
@@ -125,6 +127,8 @@ ark_device_caps[] = {
 SET_DEV_CAPS(0x1017, true),
 SET_DEV_CAPS(0x1018, true),
 SET_DEV_CAPS(0x1019, true),
+SET_DEV_CAPS(0x101e, false),
+SET_DEV_CAPS(0x101f, false),
 {.device_id = 0,}
 };
 
-- 
2.25.1



[PATCH v3 3/7] net/ark: support arbitrary mbuf size

2022-02-15 Thread John Miller
Added arbitrary mbuf size per queue capability.
Updated ARK_UDM_CONST3 value to reflect the version number
read from the HW that is required to support this change.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c|  8 
 drivers/net/ark/ark_ethdev_rx.c | 23 +++
 drivers/net/ark/ark_udm.h   |  2 +-
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index a13f74718b..51b9e04701 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -527,14 +527,6 @@ ark_config_device(struct rte_eth_dev *dev)
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))
ARK_PMD_LOG(ERR, "Unable to stop DDM\n");
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 37a88cbede..0478702cbe 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -12,7 +12,6 @@
 
 #define ARK_RX_META_SIZE 32
 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
-#define ARK_RX_MAX_NOCHAIN (RTE_MBUF_DEFAULT_DATAROOM)
 
 /* Forward declarations */
 struct ark_rx_queue;
@@ -41,6 +40,9 @@ struct ark_rx_queue {
rx_user_meta_hook_fn rx_user_meta_hook;
void *ext_user_data;
 
+   uint32_t dataroom;
+   uint32_t headroom;
+
uint32_t queue_size;
uint32_t queue_mask;
 
@@ -164,6 +166,9 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 
/* NOTE zmalloc is used, no need to 0 indexes, etc. */
queue->mb_pool = mb_pool;
+   queue->dataroom = rte_pktmbuf_data_room_size(mb_pool) -
+   RTE_PKTMBUF_HEADROOM;
+   queue->headroom = RTE_PKTMBUF_HEADROOM;
queue->phys_qid = qidx;
queue->queue_index = queue_idx;
queue->queue_size = nb_desc;
@@ -196,6 +201,15 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
queue->udm = RTE_PTR_ADD(ark->udm.v, qidx * ARK_UDM_QOFFSET);
queue->mpu = RTE_PTR_ADD(ark->mpurx.v, qidx * ARK_MPU_QOFFSET);
 
+   /* Configure UDM per queue */
+   ark_udm_stop(queue->udm, 0);
+   ark_udm_configure(queue->udm,
+ RTE_PKTMBUF_HEADROOM,
+ queue->dataroom,
+ ARK_RX_WRITE_TIME_NS);
+   ark_udm_stats_reset(queue->udm);
+   ark_udm_stop(queue->udm, 0);
+
/* populate mbuf reserve */
status = eth_ark_rx_seed_mbufs(queue);
 
@@ -267,6 +281,7 @@ eth_ark_recv_pkts(void *rx_queue,
mbuf->data_len = meta->pkt_len;
 
if (ARK_DEBUG_CORE) {   /* debug sanity checks */
+
if ((meta->pkt_len > (1024 * 16)) ||
(meta->pkt_len == 0)) {
ARK_PMD_LOG(DEBUG, "RX: Bad Meta Q: %u"
@@ -295,7 +310,7 @@ eth_ark_recv_pkts(void *rx_queue,
}
}
 
-   if (unlikely(meta->pkt_len > ARK_RX_MAX_NOCHAIN))
+   if (unlikely(meta->pkt_len > queue->dataroom))
cons_index = eth_ark_rx_jumbo
(queue, meta, mbuf, cons_index + 1);
else
@@ -336,14 +351,14 @@ eth_ark_rx_jumbo(struct ark_rx_queue *queue,
/* first buf populated by called */
mbuf_prev = mbuf0;
segments = 1;
-   data_len = RTE_MIN(meta->pkt_len, RTE_MBUF_DEFAULT_DATAROOM);
+   data_len = RTE_MIN(meta->pkt_len, queue->dataroom);
remaining = meta->pkt_len - data_len;
mbuf0->data_len = data_len;
 
/* HW guarantees that the data does not exceed prod_index! */
while (remaining != 0) {
data_len = RTE_MIN(remaining,
-  RTE_MBUF_DEFAULT_DATAROOM);
+  queue->dataroom);
 
remaining -= data_len;
segments += 1;
diff --git a/drivers/net/ark/ark_udm.h b/drivers/net/ark/ark_udm.h
index 4e51a5e82c..1cbcd94a98 100644
--- a/drivers/net/ark/ark_udm.h
+++ b/drivers/net/ark/ark_udm.h
@@ -33,7 +33,7 @@ struct ark_rx_meta {
 #define ARK_RX_WRITE_TIME_NS 2500
 #define ARK_UDM_SETUP 0
 #define ARK_UDM_CONST2 0xbACECACE
-#define ARK_UDM_CONST3 0x334d4455
+#define ARK_UDM_CONST3 0x344d4455
 #define ARK_UDM_CONST ARK_UDM_CONST3
 struct ark_udm_setup_t {
uint32_t r0;
-- 
2.25.1



[PATCH v3 4/7] net/ark: packet generator and checker status update

2022-02-15 Thread John Miller
Configuration status updates for internal packet checker and
generator.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_pktchkr.c | 2 +-
 drivers/net/ark/ark_pktgen.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c
index 84bb567a41..12a5abb2f7 100644
--- a/drivers/net/ark/ark_pktchkr.c
+++ b/drivers/net/ark/ark_pktchkr.c
@@ -113,7 +113,7 @@ ark_pktchkr_stopped(ark_pkt_chkr_t handle)
struct ark_pkt_chkr_inst *inst = (struct ark_pkt_chkr_inst *)handle;
uint32_t r = inst->sregs->pkt_start_stop;
 
-   return (((r >> 16) & 1) == 1);
+   return (((r >> 16) & 1) == 1) || (r == 0);
 }
 
 void
diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
index 515bfe461c..6195ef997f 100644
--- a/drivers/net/ark/ark_pktgen.c
+++ b/drivers/net/ark/ark_pktgen.c
@@ -107,7 +107,7 @@ ark_pktgen_paused(ark_pkt_gen_t handle)
struct ark_pkt_gen_inst *inst = (struct ark_pkt_gen_inst *)handle;
uint32_t r = inst->regs->pkt_start_stop;
 
-   return (((r >> 16) & 1) == 1);
+   return (((r >> 24) & 1) == 1) || (((r >> 16) & 1) == 1)  || (r == 0);
 }
 
 void
-- 
2.25.1



[PATCH v3 5/7] net/ark: support chunk DMA transfers

2022-02-15 Thread John Miller
Add support for chunk DMA transfers.

Chunk mpu transfer use 64 objects (512 byte) to maintain memory
read alignment.

Align mpu memory allocation to be at 512 byte boundaries.

Reduce force-close allocation from 1 objects to 64 objects.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev_rx.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 0478702cbe..0fbb2603db 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -12,6 +12,7 @@
 
 #define ARK_RX_META_SIZE 32
 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
+#define ARK_RX_MPU_CHUNK (64U)
 
 /* Forward declarations */
 struct ark_rx_queue;
@@ -104,7 +105,7 @@ static inline void
 eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index)
 {
queue->cons_index = cons_index;
-   if ((cons_index + queue->queue_size - queue->seed_index) >= 64U) {
+   if ((cons_index + queue->queue_size - queue->seed_index) >= 
ARK_RX_MPU_CHUNK) {
eth_ark_rx_seed_mbufs(queue);
ark_mpu_set_producer(queue->mpu, queue->seed_index);
}
@@ -179,12 +180,12 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
queue->reserve_q =
rte_zmalloc_socket("Ark_rx_queue mbuf",
   nb_desc * sizeof(struct rte_mbuf *),
-  64,
+  512,
   socket_id);
queue->paddress_q =
rte_zmalloc_socket("Ark_rx_queue paddr",
   nb_desc * sizeof(rte_iova_t),
-  64,
+  512,
   socket_id);
 
if (queue->reserve_q == 0 || queue->paddress_q == 0) {
@@ -446,7 +447,8 @@ eth_ark_rx_stop_queue(struct rte_eth_dev *dev, uint16_t 
queue_id)
 static inline int
 eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 {
-   uint32_t limit = queue->cons_index + queue->queue_size;
+   uint32_t limit = (queue->cons_index & ~(ARK_RX_MPU_CHUNK - 1)) +
+   queue->queue_size;
uint32_t seed_index = queue->seed_index;
 
uint32_t count = 0;
@@ -609,14 +611,14 @@ eth_ark_udm_force_close(struct rte_eth_dev *dev)
 
ark_mpu_start(queue->mpu);
/* Add some buffers */
-   index = 10 + queue->seed_index;
+   index = ARK_RX_MPU_CHUNK + queue->seed_index;
ark_mpu_set_producer(queue->mpu, index);
}
/* Wait to allow data to pass */
usleep(100);
 
-   ARK_PMD_LOG(DEBUG, "UDM forced flush attempt, stopped = %d\n",
-   ark_udm_is_flushed(ark->udm.v));
+   ARK_PMD_LOG(NOTICE, "UDM forced flush attempt, stopped = %d\n",
+   ark_udm_is_flushed(ark->udm.v));
}
ark_udm_reset(ark->udm.v);
 }
-- 
2.25.1



[PATCH v3 7/7] net/ark: add performance optimizations

2022-02-15 Thread John Miller
Added software register writes for hw optimization and
performance fixes.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_udm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ark/ark_udm.c b/drivers/net/ark/ark_udm.c
index cb3cf5c941..9ebed89627 100644
--- a/drivers/net/ark/ark_udm.c
+++ b/drivers/net/ark/ark_udm.c
@@ -33,6 +33,7 @@ ark_udm_stop(struct ark_udm_t *udm, const int wait)
 {
int cnt = 0;
 
+   udm->setup.r0 = 0;
udm->cfg.command = 2;
rte_wmb();
 
@@ -71,6 +72,7 @@ ark_udm_reset(struct ark_udm_t *udm)
 void
 ark_udm_start(struct ark_udm_t *udm)
 {
+   udm->setup.r0 = 0x100;
udm->cfg.command = 1;
 }
 
-- 
2.25.1



[PATCH v3 6/7] net/ark: add memory write barriers in critical code paths

2022-02-15 Thread John Miller
Add memory write barriers for read and wait status functions
in ddm, udm and mpu.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ddm.c | 1 +
 drivers/net/ark/ark_mpu.c | 1 +
 drivers/net/ark/ark_udm.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/drivers/net/ark/ark_ddm.c b/drivers/net/ark/ark_ddm.c
index 2321371572..b16c739d50 100644
--- a/drivers/net/ark/ark_ddm.c
+++ b/drivers/net/ark/ark_ddm.c
@@ -55,6 +55,7 @@ ark_ddm_stop(struct ark_ddm_t *ddm, const int wait)
int cnt = 0;
 
ddm->cfg.command = 2;
+   rte_wmb();
while (wait && (ddm->cfg.stop_flushed & 0x01) == 0) {
if (cnt++ > 1000)
return 1;
diff --git a/drivers/net/ark/ark_mpu.c b/drivers/net/ark/ark_mpu.c
index 8160c1de7b..b8e94b6ed3 100644
--- a/drivers/net/ark/ark_mpu.c
+++ b/drivers/net/ark/ark_mpu.c
@@ -68,6 +68,7 @@ ark_mpu_reset(struct ark_mpu_t *mpu)
int cnt = 0;
 
mpu->cfg.command = MPU_CMD_RESET;
+   rte_wmb();
 
while (mpu->cfg.command != MPU_CMD_IDLE) {
if (cnt++ > 1000)
diff --git a/drivers/net/ark/ark_udm.c b/drivers/net/ark/ark_udm.c
index 28c4500a2c..cb3cf5c941 100644
--- a/drivers/net/ark/ark_udm.c
+++ b/drivers/net/ark/ark_udm.c
@@ -34,6 +34,7 @@ ark_udm_stop(struct ark_udm_t *udm, const int wait)
int cnt = 0;
 
udm->cfg.command = 2;
+   rte_wmb();
 
while (wait && (udm->cfg.stop_flushed & 0x01) == 0) {
if (cnt++ > 1000)
-- 
2.25.1



[PATCH] net/ark: support multi-port pkt generation

2022-02-26 Thread John Miller
Added support for packet generation in
multi-port Arkville implementations. The packet
generator is a singleton within the device but is
capable of generating packets for any port within
one device.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c | 4 +++-
 drivers/net/ark/ark_global.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 230a1272e9..980e1a4a3b 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -441,6 +441,7 @@ ark_config_device(struct rte_eth_dev *dev)
 * known state
 */
ark->start_pg = 0;
+   ark->pg_running = 0;
ark->pg = ark_pktgen_init(ark->pktgen.v, 0, 1);
if (ark->pg == NULL)
return -1;
@@ -562,7 +563,7 @@ eth_ark_dev_start(struct rte_eth_dev *dev)
if (ark->start_pg)
ark_pktchkr_run(ark->pc);
 
-   if (ark->start_pg && (dev->data->port_id == 0)) {
+   if (ark->start_pg && !ark->pg_running) {
pthread_t thread;
 
/* Delay packet generatpr start allow the hardware to be ready
@@ -574,6 +575,7 @@ eth_ark_dev_start(struct rte_eth_dev *dev)
"starter thread\n");
return -1;
}
+   ark->pg_running = 1;
}
 
if (ark->user_ext.dev_start)
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 49193ac5b3..3c3a712bc8 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -107,6 +107,7 @@ struct ark_adapter {
 
/* Pointers to packet generator and checker */
int start_pg;
+   uint16_t pg_running;
ark_pkt_gen_t pg;
ark_pkt_chkr_t pc;
ark_pkt_dir_t pd;
-- 
2.25.1



[PATCH v2] net/ark: support multi-port pkt generation

2022-03-02 Thread John Miller
Added support for packet generation in
multi-port Arkville implementations. The packet
generator is a singleton within the device but is
capable of generating packets for any port within
one device.

Signed-off-by: John Miller 

---
v2:
- Incorporated changes from Ferruh's comments.
---
 drivers/net/ark/ark_ethdev.c | 14 +++---
 drivers/net/ark/ark_global.h |  1 +
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 51b9e04701..76b88c62d0 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -493,6 +493,7 @@ ark_config_device(struct rte_eth_dev *dev)
 * known state
 */
ark->start_pg = 0;
+   ark->pg_running = 0;
ark->pg = ark_pktgen_init(ark->pktgen.v, 0, 1);
if (ark->pg == NULL)
return -1;
@@ -607,18 +608,23 @@ eth_ark_dev_start(struct rte_eth_dev *dev)
if (ark->start_pg)
ark_pktchkr_run(ark->pc);
 
-   if (ark->start_pg && (dev->data->port_id == 0)) {
+   if (ark->start_pg && !ark->pg_running) {
pthread_t thread;
 
/* Delay packet generatpr start allow the hardware to be ready
 * This is only used for sanity checking with internal generator
 */
-   if (rte_ctrl_thread_create(&thread, "ark-delay-pg", NULL,
+   char tname[32];
+   snprintf(tname, sizeof(tname), "ark-delay-pg-%d",
+dev->data->port_id);
+
+   if (rte_ctrl_thread_create(&thread, tname, NULL,
   ark_pktgen_delay_start, ark->pg)) {
ARK_PMD_LOG(ERR, "Could not create pktgen "
"starter thread\n");
return -1;
}
+   ark->pg_running = 1;
}
 
if (ark->user_ext.dev_start)
@@ -647,8 +653,10 @@ eth_ark_dev_stop(struct rte_eth_dev *dev)
   ark->user_data[dev->data->port_id]);
 
/* Stop the packet generator */
-   if (ark->start_pg)
+   if (ark->start_pg && ark->pg_running) {
ark_pktgen_pause(ark->pg);
+   ark->pg_running = 0;
+   }
 
dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 49193ac5b3..3c3a712bc8 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -107,6 +107,7 @@ struct ark_adapter {
 
/* Pointers to packet generator and checker */
int start_pg;
+   uint16_t pg_running;
ark_pkt_gen_t pg;
ark_pkt_chkr_t pc;
ark_pkt_dir_t pd;
-- 
2.25.1



[PATCH 01/10] doc/guides/bbdevs: add ark baseband device documentation

2022-04-21 Thread John Miller
Add new ark baseband device documentation.

This is the first patch in the series that introduces
the Arkville baseband PMD.

First we create a common/ark directory and move common files
from net/ark to share with the new baseband/ark device.

Next we create baseband/ark and introduce the Arkville baseband PMD,
including documentation.

Finally we modify the build system to support the changes.

Signed-off-by: John Miller 
---
 doc/guides/bbdevs/ark.rst | 54 +++
 1 file changed, 54 insertions(+)
 create mode 100644 doc/guides/bbdevs/ark.rst

diff --git a/doc/guides/bbdevs/ark.rst b/doc/guides/bbdevs/ark.rst
new file mode 100644
index 00..3bbe885e75
--- /dev/null
+++ b/doc/guides/bbdevs/ark.rst
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2015-2022 Atomic Rules LLC
+ */
+
+
+=
+ Atomic Rules LLC, Baseband Poll Mode Driver
+=
+
+The Atomic Rules, Arkville Baseband poll model driver supports the data
+movement portion of a baseband device implemented within an FPGA.
+The specifics of the encode or decode functions within the FPGA are
+outside the scope of Arkville's data movement. Hence this PMD requires and
+provides for the customization needed to advertise its
+features and support for out-of-band (or meta data) to accompany packet
+data between the FPGA device and the host software.
+
+
+==
+ Features
+==
+
+* Support for LDPC encode and decode operations.
+* Support for Turbo encode and decode operations.
+* Support for scatter/gather.
+* Support Mbuf data room sizes upto 32K bytes for improved performance.
+* Support for upto 64 queues
+* Support for runtime switching of Mbuf size, per queue, for improved 
perormance.
+* Support for PCIe Gen3x16, Gen4x16, and Gen5x8 endpoints.
+
+
+=
+ Required Customization Functions
+=
+
+The following customization functions are required:
+  * Set the capabilities structure for the device `ark_bbdev_info_get()`
+  * An optional device start function `rte_pmd_ark_bbdev_start()`
+  * An optional device stop function `rte_pmd_ark_bbdev_stop()`
+  * Functions for defining meta data format shared between
+the host and FPGA.
+`rte_pmd_ark_bbdev_enqueue_ldpc_dec()`,
+`rte_pmd_ark_bbdev_dequeue_ldpc_dec()`,
+`rte_pmd_ark_bbdev_enqueue_ldpc_enc()`,
+`rte_pmd_ark_bbdev_dequeue_ldpc_enc()`.
+
+
+=
+ Limitations
+=
+
+* MBufs for the output data from the operation must be sized exactly
+   to hold the result based on DATAROOM sizes.
+* Side-band or meta data accompaning packet data is limited to 20 Bytes.
-- 
2.25.1



[PATCH 02/10] common/ark: create common subdirectory for baseband support

2022-04-21 Thread John Miller
Create a common directory in drivers/common and move common
ark files to prepare support for Arkville baseband device.

Signed-off-by: John Miller 
---
 MAINTAINERS   |  1 +
 drivers/{net => common}/ark/ark_ddm.c |  2 +-
 drivers/{net => common}/ark/ark_ddm.h | 12 ++
 drivers/{net => common}/ark/ark_mpu.c |  2 +-
 drivers/{net => common}/ark/ark_mpu.h | 10 +
 drivers/{net => common}/ark/ark_pktchkr.c |  2 +-
 drivers/{net => common}/ark/ark_pktchkr.h | 22 ++
 drivers/{net => common}/ark/ark_pktdir.c  |  5 +++--
 drivers/{net => common}/ark/ark_pktdir.h  |  7 ++
 drivers/{net => common}/ark/ark_pktgen.c  |  2 +-
 drivers/{net => common}/ark/ark_pktgen.h  | 27 +++
 drivers/{net => common}/ark/ark_rqp.c |  2 +-
 drivers/{net => common}/ark/ark_rqp.h |  3 +++
 drivers/{net => common}/ark/ark_udm.c |  2 +-
 drivers/{net => common}/ark/ark_udm.h | 18 +++
 15 files changed, 109 insertions(+), 8 deletions(-)
 rename drivers/{net => common}/ark/ark_ddm.c (99%)
 rename drivers/{net => common}/ark/ark_ddm.h (96%)
 rename drivers/{net => common}/ark/ark_mpu.c (99%)
 rename drivers/{net => common}/ark/ark_mpu.h (95%)
 rename drivers/{net => common}/ark/ark_pktchkr.c (99%)
 rename drivers/{net => common}/ark/ark_pktchkr.h (88%)
 rename drivers/{net => common}/ark/ark_pktdir.c (95%)
 rename drivers/{net => common}/ark/ark_pktdir.h (89%)
 rename drivers/{net => common}/ark/ark_pktgen.c (99%)
 rename drivers/{net => common}/ark/ark_pktgen.h (86%)
 rename drivers/{net => common}/ark/ark_rqp.c (98%)
 rename drivers/{net => common}/ark/ark_rqp.h (97%)
 rename drivers/{net => common}/ark/ark_udm.c (99%)
 rename drivers/{net => common}/ark/ark_udm.h (94%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7c4f541dba..4716c92e78 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -632,6 +632,7 @@ M: Shepard Siegel 
 M: Ed Czeck 
 M: John Miller 
 F: drivers/net/ark/
+F: drivers/common/ark/
 F: doc/guides/nics/ark.rst
 F: doc/guides/nics/features/ark.ini
 
diff --git a/drivers/net/ark/ark_ddm.c b/drivers/common/ark/ark_ddm.c
similarity index 99%
rename from drivers/net/ark/ark_ddm.c
rename to drivers/common/ark/ark_ddm.c
index b16c739d50..16060156a4 100644
--- a/drivers/net/ark/ark_ddm.c
+++ b/drivers/common/ark/ark_ddm.c
@@ -4,7 +4,7 @@
 
 #include 
 
-#include "ark_logs.h"
+#include "ark_common.h"
 #include "ark_ddm.h"
 
 static_assert(sizeof(union ark_tx_meta) == 8, "Unexpected struct size 
ark_tx_meta");
diff --git a/drivers/net/ark/ark_ddm.h b/drivers/common/ark/ark_ddm.h
similarity index 96%
rename from drivers/net/ark/ark_ddm.h
rename to drivers/common/ark/ark_ddm.h
index 687ff2519a..bdc9b8cfb7 100644
--- a/drivers/net/ark/ark_ddm.h
+++ b/drivers/common/ark/ark_ddm.h
@@ -140,18 +140,30 @@ struct ark_ddm_t {
 
 
 /* DDM function prototype */
+__rte_internal
 int ark_ddm_verify(struct ark_ddm_t *ddm);
+__rte_internal
 void ark_ddm_start(struct ark_ddm_t *ddm);
+__rte_internal
 int ark_ddm_stop(struct ark_ddm_t *ddm, const int wait);
+__rte_internal
 void ark_ddm_reset(struct ark_ddm_t *ddm);
+__rte_internal
 void ark_ddm_stats_reset(struct ark_ddm_t *ddm);
+__rte_internal
 void ark_ddm_setup(struct ark_ddm_t *ddm, rte_iova_t cons_addr,
   uint32_t interval);
+__rte_internal
 void ark_ddm_dump_stats(struct ark_ddm_t *ddm, const char *msg);
+__rte_internal
 void ark_ddm_dump(struct ark_ddm_t *ddm, const char *msg);
+__rte_internal
 int ark_ddm_is_stopped(struct ark_ddm_t *ddm);
+__rte_internal
 uint64_t ark_ddm_queue_byte_count(struct ark_ddm_t *ddm);
+__rte_internal
 uint64_t ark_ddm_queue_pkt_count(struct ark_ddm_t *ddm);
+__rte_internal
 void ark_ddm_queue_reset_stats(struct ark_ddm_t *ddm);
 
 #endif
diff --git a/drivers/net/ark/ark_mpu.c b/drivers/common/ark/ark_mpu.c
similarity index 99%
rename from drivers/net/ark/ark_mpu.c
rename to drivers/common/ark/ark_mpu.c
index b8e94b6ed3..8182745be3 100644
--- a/drivers/net/ark/ark_mpu.c
+++ b/drivers/common/ark/ark_mpu.c
@@ -4,7 +4,7 @@
 
 #include 
 
-#include "ark_logs.h"
+#include "ark_common.h"
 #include "ark_mpu.h"
 
 uint16_t
diff --git a/drivers/net/ark/ark_mpu.h b/drivers/common/ark/ark_mpu.h
similarity index 95%
rename from drivers/net/ark/ark_mpu.h
rename to drivers/common/ark/ark_mpu.h
index 92c3e67c86..d9544edf4a 100644
--- a/drivers/net/ark/ark_mpu.h
+++ b/drivers/common/ark/ark_mpu.h
@@ -101,18 +101,28 @@ struct ark_mpu_t {
struct ark_mpu_debug_t debug;
 };
 
+__rte_internal
 uint16_t ark_api_num_queues(struct ark_mpu_t *mpu);
+__rte_internal
 uint16_t ark_api_num_queues_per_port(struct ark_mpu_t *mpu,
 uint16_t ark_ports);
+__rte_internal
 int ark_mpu_verify(struct ark_mpu_t *mpu, uint32_t obj_size);
+__rte_internal
 void

[PATCH 03/10] common/ark: move common files to common subdirectory

2022-04-21 Thread John Miller
Add common ark files to drivers/common directory in
preparation to support Arkville baseband device.

Signed-off-by: John Miller 
---
 drivers/common/ark/ark_common.c |   7 ++
 drivers/common/ark/ark_common.h |  48 ++
 drivers/common/ark/meson.build  |  13 
 drivers/common/ark/version.map  | 109 
 4 files changed, 177 insertions(+)
 create mode 100644 drivers/common/ark/ark_common.c
 create mode 100644 drivers/common/ark/ark_common.h
 create mode 100644 drivers/common/ark/meson.build
 create mode 100644 drivers/common/ark/version.map

diff --git a/drivers/common/ark/ark_common.c b/drivers/common/ark/ark_common.c
new file mode 100644
index 00..18d1832ede
--- /dev/null
+++ b/drivers/common/ark/ark_common.c
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2020-2021 Atomic Rules LLC
+ */
+
+#include "ark_common.h"
+
+RTE_LOG_REGISTER_DEFAULT(ark_common_logtype, NOTICE);
diff --git a/drivers/common/ark/ark_common.h b/drivers/common/ark/ark_common.h
new file mode 100644
index 00..6bb168098b
--- /dev/null
+++ b/drivers/common/ark/ark_common.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2015-2018 Atomic Rules LLC
+ */
+
+#ifndef _ARK_COMMON_H_
+#define _ARK_COMMON_H_
+
+#include 
+#include 
+
+/* system camel case definition changed to upper case */
+#define PRIU32 PRIu32
+#define PRIU64 PRIu64
+
+/* Atomic Rules vendor id */
+#define AR_VENDOR_ID 0x1d6c
+
+/*
+ * This structure is used to statically define the capabilities
+ * of supported devices.
+ * Capabilities:
+ *  rqpacing -
+ * Some HW variants require that PCIe read-requests be correctly throttled.
+ * This is called "rqpacing" and has to do with credit and flow control
+ * on certain Arkville implementations.
+ */
+struct ark_caps {
+   bool rqpacing;
+};
+struct ark_dev_caps {
+   uint32_t  device_id;
+   struct ark_caps  caps;
+};
+#define SET_DEV_CAPS(id, rqp) \
+   {id, {.rqpacing = rqp} }
+
+/* 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"
+
+extern int ark_common_logtype;
+
+#define ARK_PMD_LOG(level, fmt, args...)   \
+   rte_log(RTE_LOG_ ##level, ark_common_logtype, "ARK_COMMON: " fmt, ## 
args)
+
+#endif
diff --git a/drivers/common/ark/meson.build b/drivers/common/ark/meson.build
new file mode 100644
index 00..fbdfceecea
--- /dev/null
+++ b/drivers/common/ark/meson.build
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2019 Mellanox Technologies, Ltd
+
+sources += files(
+   'ark_ddm.c',
+   'ark_common.c',
+   'ark_mpu.c',
+   'ark_pktchkr.c',
+   'ark_pktdir.c',
+   'ark_pktgen.c',
+   'ark_rqp.c',
+   'ark_udm.c'
+)
diff --git a/drivers/common/ark/version.map b/drivers/common/ark/version.map
new file mode 100644
index 00..063d065df2
--- /dev/null
+++ b/drivers/common/ark/version.map
@@ -0,0 +1,109 @@
+DPDK_22 {
+   local: *;
+};
+
+INTERNAL {
+   global:
+
+   ark_api_num_queues;
+   ark_api_num_queues_per_port;
+
+   ark_ddm_dump;
+   ark_ddm_dump_stats;
+   ark_ddm_is_stopped;
+   ark_ddm_queue_byte_count;
+   ark_ddm_queue_pkt_count;
+   ark_ddm_queue_reset_stats;
+   ark_ddm_reset;
+   ark_ddm_setup;
+   ark_ddm_start;
+   ark_ddm_stats_reset;
+   ark_ddm_stop;
+   ark_ddm_verify;
+
+   ark_mpu_configure;
+   ark_mpu_dump;
+   ark_mpu_dump_setup;
+   ark_mpu_reset;
+   ark_mpu_reset_stats;
+   ark_mpu_start;
+   ark_mpu_stop;
+   ark_mpu_verify;
+
+   ark_pktchkr_dump_stats;
+   ark_pktchkr_get_pkts_sent;
+   ark_pktchkr_init;
+   ark_pktchkr_is_running;
+   ark_pktchkr_parse;
+   ark_pktchkr_run;
+   ark_pktchkr_set_dst_mac_addr;
+   ark_pktchkr_set_eth_type;
+   ark_pktchkr_set_hdr_dW;
+   ark_pktchkr_set_num_pkts;
+   ark_pktchkr_set_payload_byte;
+   ark_pktchkr_set_pkt_size_incr;
+   ark_pktchkr_set_pkt_size_max;
+   ark_pktchkr_set_pkt_size_min;
+   ark_pktchkr_set_src_mac_addr;
+   ark_pktchkr_setup;
+   ark_pktchkr_stop;
+   ark_pktchkr_stopped;
+   ark_pktchkr_uninit;
+   ark_pktchkr_wait_done;
+   ark_pktdir_init;
+   ark_pktdir_setup;
+   ark_pktdir_stall_cnt;
+   ark_pktdir_status;
+   ark_pktdir_uninit;
+
+   ark_pktgen_get_pkts_sent;
+   ark_pktgen_init;
+   ark_pktgen_is_gen_forever;
+   ark_pktgen_is_running;
+   ark_pktgen_parse;
+   ark_pktgen_pause;
+   ark_pktgen_paused;
+   ark_pktgen_reset;
+   ark_pktgen_run;
+   a

[PATCH 04/10] common/meson.build:

2022-04-21 Thread John Miller
Add common ark to build system.

Signed-off-by: John Miller 
---
 drivers/common/meson.build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/common/meson.build b/drivers/common/meson.build
index ea261dd70a..5514f4ba83 100644
--- a/drivers/common/meson.build
+++ b/drivers/common/meson.build
@@ -3,6 +3,7 @@
 
 std_deps = ['eal']
 drivers = [
+'ark',
 'cpt',
 'dpaax',
 'iavf',
-- 
2.25.1



[PATCH 05/10] baseband/ark: add ark baseband device

2022-04-21 Thread John Miller
Add new ark baseband device.

Signed-off-by: John Miller 
---
 drivers/baseband/ark/ark_bbdev.c| 1064 +++
 drivers/baseband/ark/ark_bbdev_common.c |  125 +++
 drivers/baseband/ark/ark_bbdev_common.h |   92 ++
 drivers/baseband/ark/ark_bbdev_custom.c |  201 +
 drivers/baseband/ark/ark_bbdev_custom.h |   30 +
 drivers/baseband/ark/meson.build|   11 +
 drivers/baseband/ark/version.map|3 +
 7 files changed, 1526 insertions(+)
 create mode 100644 drivers/baseband/ark/ark_bbdev.c
 create mode 100644 drivers/baseband/ark/ark_bbdev_common.c
 create mode 100644 drivers/baseband/ark/ark_bbdev_common.h
 create mode 100644 drivers/baseband/ark/ark_bbdev_custom.c
 create mode 100644 drivers/baseband/ark/ark_bbdev_custom.h
 create mode 100644 drivers/baseband/ark/meson.build
 create mode 100644 drivers/baseband/ark/version.map

diff --git a/drivers/baseband/ark/ark_bbdev.c b/drivers/baseband/ark/ark_bbdev.c
new file mode 100644
index 00..b23bbd44d1
--- /dev/null
+++ b/drivers/baseband/ark/ark_bbdev.c
@@ -0,0 +1,1064 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016-2021 Atomic Rules LLC
+ */
+
+#include "ark_common.h"
+#include "ark_bbdev_common.h"
+#include "ark_bbdev_custom.h"
+#include "ark_ddm.h"
+#include "ark_mpu.h"
+#include "ark_rqp.h"
+#include "ark_udm.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define DRIVER_NAME baseband_ark
+
+RTE_LOG_REGISTER_DEFAULT(ark_bbdev_logtype, DEBUG);
+
+#define ARK_SYSCTRL_BASE  0x0
+#define ARK_PKTGEN_BASE   0x1
+#define ARK_MPU_RX_BASE   0x2
+#define ARK_UDM_BASE  0x3
+#define ARK_MPU_TX_BASE   0x4
+#define ARK_DDM_BASE  0x6
+#define ARK_PKTDIR_BASE   0xa
+#define ARK_PKTCHKR_BASE  0x9
+#define ARK_RCPACING_BASE 0xb
+#define ARK_MPU_QOFFSET   0x00100
+
+#define BB_ARK_TX_Q_FACTOR 4
+
+/* TODO move to UDM, verify configuration */
+#define ARK_RX_META_SIZE 32
+#define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
+#define ARK_RX_MAX_NOCHAIN (RTE_MBUF_DEFAULT_DATAROOM)
+
+static_assert(sizeof(struct ark_rx_meta) == ARK_RX_META_SIZE, "Unexpected 
struct size ark_rx_meta");
+static_assert(sizeof(union ark_tx_meta) == 8, "Unexpected struct size 
ark_tx_meta");
+
+static struct rte_pci_id pci_id_ark[] = {
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1015)},
+   {RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1016)},
+   {.device_id = 0},
+};
+
+static const struct ark_dev_caps
+ark_device_caps[] = {
+SET_DEV_CAPS(0x1015, true),
+SET_DEV_CAPS(0x1016, true),
+{.device_id = 0,}
+};
+
+
+/* Forward declarations */
+static const struct rte_bbdev_ops ark_bbdev_pmd_ops;
+
+
+/* queue */
+struct ark_bbdev_queue {
+   struct rte_ring *active_ops;  /* Ring for processed packets */
+
+   /* RX components */
+   /* array of physical addresses of the mbuf data pointer */
+   rte_iova_t *rx_paddress_q;
+   struct ark_udm_t *udm;
+   struct ark_mpu_t *rx_mpu;
+
+   /* TX components */
+   union ark_tx_meta *tx_meta_q;
+   struct ark_mpu_t *tx_mpu;
+   struct ark_ddm_t *ddm;
+
+   /*  */
+   uint32_t tx_queue_mask;
+   uint32_t rx_queue_mask;
+
+   int32_t rx_seed_index;  /* step 1 set with empty mbuf */
+   int32_t rx_cons_index;  /* step 3 consumed by driver */
+
+   /* 3 indexes to the paired data rings. */
+   int32_t tx_prod_index;  /* where to put the next one */
+   int32_t tx_free_index;  /* local copy of tx_cons_index */
+
+   /* separate cache line -- written by FPGA -- RX announce */
+   RTE_MARKER cacheline1 __rte_cache_min_aligned;
+   volatile int32_t rx_prod_index; /* step 2 filled by FPGA */
+
+   /* Separate cache line -- written by FPGA -- RX completion */
+   RTE_MARKER cacheline2 __rte_cache_min_aligned;
+   volatile int32_t tx_cons_index; /* hw is done, can be freed */
+} __rte_cache_aligned;
+
+static int
+ark_bb_hw_q_setup(struct rte_bbdev *bbdev, uint16_t q_id, uint16_t queue_size)
+{
+   struct ark_bbdev_queue *q = bbdev->data->queues[q_id].queue_private;
+
+   rte_iova_t queue_base;
+   rte_iova_t phys_addr_q_base;
+   rte_iova_t phys_addr_prod_index;
+   rte_iova_t phys_addr_cons_index;
+
+   uint32_t write_interval_ns = 500; /* TODO this seems big */
+
+   if (ark_mpu_verify(q->rx_mpu, sizeof(rte_iova_t))) {
+   ARK_BBDEV_LOG(ERR, "Illegal hw/sw configuration RX queue");
+   return -1;
+   }
+   ARK_BBDEV_LOG(DEBUG, "ark_bb_q setup %u:%u",
+ bbdev->data->dev_id, q_id);
+
+   /* RX MPU */
+   phys_addr_q_base = rte_malloc_virt2iova(q->rx_paddress_q);
+   /* Force TX mode on MPU to matc

[PATCH 06/10] net/ark: add ark PMD log interface

2022-04-21 Thread John Miller
Added ark PMD log interface for use in arkville devices.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c  | 93 ---
 drivers/net/ark/ark_ethdev_logs.c |  7 +++
 drivers/net/ark/ark_ethdev_logs.h | 25 +
 drivers/net/ark/ark_ethdev_rx.c   | 40 ++---
 drivers/net/ark/ark_ethdev_tx.c   | 10 ++--
 drivers/net/ark/ark_logs.h| 34 ---
 6 files changed, 94 insertions(+), 115 deletions(-)
 create mode 100644 drivers/net/ark/ark_ethdev_logs.c
 create mode 100644 drivers/net/ark/ark_ethdev_logs.h
 delete mode 100644 drivers/net/ark/ark_logs.h

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 76b88c62d0..22cf598593 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -11,7 +11,7 @@
 #include 
 
 #include "ark_global.h"
-#include "ark_logs.h"
+#include "ark_ethdev_logs.h"
 #include "ark_ethdev_tx.h"
 #include "ark_ethdev_rx.h"
 #include "ark_mpu.h"
@@ -99,25 +99,6 @@ static const struct rte_pci_id pci_id_ark_map[] = {
{.vendor_id = 0, /* sentinel */ },
 };
 
-/*
- * This structure is used to statically define the capabilities
- * of supported devices.
- * Capabilities:
- *  rqpacing -
- * Some HW variants require that PCIe read-requests be correctly throttled.
- * This is called "rqpacing" and has to do with credit and flow control
- * on certain Arkville implementations.
- */
-struct ark_caps {
-   bool rqpacing;
-};
-struct ark_dev_caps {
-   uint32_t  device_id;
-   struct ark_caps  caps;
-};
-#define SET_DEV_CAPS(id, rqp) \
-   {id, {.rqpacing = rqp} }
-
 static const struct ark_dev_caps
 ark_device_caps[] = {
 SET_DEV_CAPS(0x100d, true),
@@ -204,26 +185,26 @@ check_for_ext(struct ark_adapter *ark)
const char *dllpath = getenv("ARK_EXT_PATH");
 
if (dllpath == NULL) {
-   ARK_PMD_LOG(DEBUG, "EXT NO dll path specified\n");
+   ARK_ETHDEV_LOG(DEBUG, "EXT NO dll path specified\n");
return 0;
}
-   ARK_PMD_LOG(NOTICE, "EXT found dll path at %s\n", dllpath);
+   ARK_ETHDEV_LOG(NOTICE, "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) {
-   ARK_PMD_LOG(ERR, "Could not load user extension %s\n",
+   ARK_ETHDEV_LOG(ERR, "Could not load user extension %s\n",
dllpath);
return -1;
}
-   ARK_PMD_LOG(DEBUG, "SUCCESS: loaded user extension %s\n",
+   ARK_ETHDEV_LOG(DEBUG, "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, "rte_pmd_ark_dev_init");
-   ARK_PMD_LOG(DEBUG, "device ext init pointer = %p\n",
+   ARK_ETHDEV_LOG(DEBUG, "device ext init pointer = %p\n",
  ark->user_ext.dev_init);
ark->user_ext.dev_get_port_count =
(int (*)(struct rte_eth_dev *, void *))
@@ -296,7 +277,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 
ark->eth_dev = dev;
 
-   ARK_PMD_LOG(DEBUG, "\n");
+   ARK_ETHDEV_LOG(DEBUG, "\n");
 
/* Check to see if there is an extension that we need to load */
ret = check_for_ext(ark);
@@ -343,15 +324,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
ark->started = 0;
ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
-   ARK_PMD_LOG(INFO, "Sys Ctrl Const = 0x%x  HW Commit_ID: %08x\n",
+   ARK_ETHDEV_LOG(INFO, "Sys Ctrl Const = 0x%x  HW Commit_ID: %08x\n",
  ark->sysctrl.t32[4],
  rte_be_to_cpu_32(ark->sysctrl.t32[0x20 / 4]));
-   ARK_PMD_LOG(NOTICE, "Arkville HW Commit_ID: %08x\n",
+   ARK_ETHDEV_LOG(NOTICE, "Arkville 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) {
-   ARK_PMD_LOG(ERR,
+   ARK_ETHDEV_LOG(ERR,
"HW Sanity test has failed, expected constant"
" 0x%x, read 0x%x (%s)\n",
0xcafef00d,
@@ -361,16 +342,16 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
if (ark->sysctrl.t32[3] != 0) {
if (ark->rqpacing) {
if (ark_rqp_lasped(ark->rqpacing)) {
-   ARK_PMD_LOG(ERR, "Ar

[PATCH 07/10] maintainers: add baseband ark maintainers

2022-04-21 Thread John Miller
Add Atomic Rules ARK baseband device.

Signed-off-by: John Miller 
---
 MAINTAINERS | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4716c92e78..380dd204a6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1330,6 +1330,13 @@ F: drivers/baseband/la12xx/
 F: doc/guides/bbdevs/la12xx.rst
 F: doc/guides/bbdevs/features/la12xx.ini
 
+Atomic Rules ARK
+M: Shepard Siegel 
+M: Ed Czeck 
+M: John Miller 
+F: drivers/baseband/ark/
+F: doc/guides/bbdevs/ark.rst
+
 
 GPU Drivers
 ---
-- 
2.25.1



[PATCH 08/10] baseband/ark: add ark baseband user extensions

2022-04-21 Thread John Miller
Add ark baseband user extensions.

Signed-off-by: John Miller 
---
 drivers/baseband/ark/ark_bbdev.c| 146 +++--
 drivers/baseband/ark/ark_bbdev_common.h |   8 ++
 drivers/baseband/ark/ark_bbext.h| 163 
 3 files changed, 306 insertions(+), 11 deletions(-)
 create mode 100644 drivers/baseband/ark/ark_bbext.h

diff --git a/drivers/baseband/ark/ark_bbdev.c b/drivers/baseband/ark/ark_bbdev.c
index b23bbd44d1..7cccaef49a 100644
--- a/drivers/baseband/ark/ark_bbdev.c
+++ b/drivers/baseband/ark/ark_bbdev.c
@@ -2,6 +2,10 @@
  * Copyright(c) 2016-2021 Atomic Rules LLC
  */
 
+#include 
+#include 
+#include 
+
 #include "ark_common.h"
 #include "ark_bbdev_common.h"
 #include "ark_bbdev_custom.h"
@@ -9,6 +13,7 @@
 #include "ark_mpu.h"
 #include "ark_rqp.h"
 #include "ark_udm.h"
+#include "ark_bbext.h"
 
 #include 
 #include 
@@ -22,6 +27,7 @@
 
 #define DRIVER_NAME baseband_ark
 
+int ark_common_logtype;
 RTE_LOG_REGISTER_DEFAULT(ark_bbdev_logtype, DEBUG);
 
 #define ARK_SYSCTRL_BASE  0x0
@@ -62,9 +68,77 @@ ark_device_caps[] = {
 /* Forward declarations */
 static const struct rte_bbdev_ops ark_bbdev_pmd_ops;
 
+static int
+check_for_ext(struct ark_bbdevice *ark)
+{
+   /* Get the env */
+   const char *dllpath = getenv("ARK_BBEXT_PATH");
+
+   if (dllpath == NULL) {
+   ARK_PMD_LOG(DEBUG, "EXT NO dll path specified\n");
+   return 0;
+   }
+   ARK_PMD_LOG(NOTICE, "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) {
+   ARK_PMD_LOG(ERR, "Could not load user extension %s\n",
+   dllpath);
+   return -1;
+   }
+   ARK_PMD_LOG(DEBUG, "SUCCESS: loaded user extension %s\n",
+   dllpath);
+
+   /* Get the entry points */
+   ark->user_ext.dev_init =
+   (void *(*)(struct rte_bbdev *, void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_init");
+
+   ark->user_ext.dev_uninit =
+   (int (*)(struct rte_bbdev *, void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_dev_uninit");
+   ark->user_ext.dev_start =
+   (int (*)(struct rte_bbdev *, void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_start");
+   ark->user_ext.dev_stop =
+   (int (*)(struct rte_bbdev *, void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_stop");
+   ark->user_ext.dequeue_ldpc_dec  =
+   (int (*)(struct rte_bbdev *,
+struct rte_bbdev_dec_op *,
+uint32_t *,
+void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_dequeue_ldpc_dec");
+   ark->user_ext.enqueue_ldpc_dec  =
+   (int (*)(struct rte_bbdev *,
+struct rte_bbdev_dec_op *,
+uint32_t *,
+uint8_t *,
+void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_enqueue_ldpc_dec");
+   ark->user_ext.dequeue_ldpc_enc  =
+   (int (*)(struct rte_bbdev *,
+struct rte_bbdev_enc_op *,
+uint32_t *,
+void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_dequeue_ldpc_enc");
+   ark->user_ext.enqueue_ldpc_enc  =
+   (int (*)(struct rte_bbdev *,
+struct rte_bbdev_enc_op *,
+uint32_t *,
+uint8_t *,
+void *))
+   dlsym(ark->d_handle, "rte_pmd_ark_bbdev_enqueue_ldpc_enc");
+
+   return 0;
+}
+
 
 /* queue */
 struct ark_bbdev_queue {
+   struct ark_bbdevice *ark_bbdev;
+
struct rte_ring *active_ops;  /* Ring for processed packets */
 
/* RX components */
@@ -182,6 +256,7 @@ ark_bb_q_setup(struct rte_bbdev *bbdev, uint16_t q_id,
return -ENOMEM;
}
bbdev->data->queues[q_id].queue_private = q;
+   q->ark_bbdev = ark_bb;
 
/* RING */
snprintf(ring_name, RTE_RING_NAMESIZE, RTE_STR(DRIVER_NAME) "%u:%u",
@@ -273,6 +348,11 @@ ark_bbdev_start(struct rte_bbdev *bbdev)
if (ark_bb->started)
return 0;
 
+   /* User start hook */
+   if (ark_bb->user_ext.dev_start)
+   ark_bb->user_ext.dev_start(bbdev,
+   ark_bb->user_data);
+
/* start UDM */
ark_udm_start(ark_bb->udm.v);
 
@@ -368,6 +448,12 @@ ark_bbdev_stop(struct rte_bbdev *bbdev

[PATCH 09/10] baseband/meson.build:

2022-04-21 Thread John Miller
Add ark baseband device to build system.

Signed-off-by: John Miller 
---
 drivers/baseband/meson.build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build
index 686e98b2ed..084ff46155 100644
--- a/drivers/baseband/meson.build
+++ b/drivers/baseband/meson.build
@@ -6,6 +6,7 @@ if is_windows
 endif
 
 drivers = [
+'ark',
 'acc100',
 'fpga_5gnr_fec',
 'fpga_lte_fec',
-- 
2.25.1



[PATCH 10/10] net/ark: repair meson dependency format

2022-04-21 Thread John Miller
Repair meson dependency format.

Signed-off-by: John Miller 
---
 drivers/net/ark/meson.build | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ark/meson.build b/drivers/net/ark/meson.build
index 8d87744c22..c48044b8ee 100644
--- a/drivers/net/ark/meson.build
+++ b/drivers/net/ark/meson.build
@@ -7,15 +7,13 @@ if is_windows
 subdir_done()
 endif
 
+deps += ['common_ark']
+
 sources = files(
-'ark_ddm.c',
 'ark_ethdev.c',
 'ark_ethdev_rx.c',
 'ark_ethdev_tx.c',
-'ark_mpu.c',
-'ark_pktchkr.c',
-'ark_pktdir.c',
-'ark_pktgen.c',
-'ark_rqp.c',
-'ark_udm.c',
+'ark_ethdev_logs.c',
 )
+
+includes += include_directories('../../common/ark')
-- 
2.25.1



[dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls

2017-06-22 Thread John Miller
Provide unique user data pointer in the extension calls for
each port.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c | 71 +---
 drivers/net/ark/ark_ext.h|  4 +++
 drivers/net/ark/ark_global.h |  5 ++--
 3 files changed, 60 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index c061f7b..55e6b24 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -77,6 +77,7 @@ static int eth_ark_macaddr_add(struct rte_eth_dev *dev,
   uint32_t pool);
 static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
   uint32_t index);
+static int  eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size);
 
 /*
  * The packet generator is a functional block used to generate packet
@@ -179,6 +180,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
.mac_addr_add = eth_ark_macaddr_add,
.mac_addr_remove = eth_ark_macaddr_remove,
.mac_addr_set = eth_ark_set_default_mac_addr,
+
+   .mtu_set = eth_ark_set_mtu,
 };
 
 static int
@@ -256,6 +259,10 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
(void (*)(struct rte_eth_dev *, struct ether_addr *,
  void *))
dlsym(ark->d_handle, "mac_addr_set");
+   ark->user_ext.set_mtu =
+   (int (*)(struct rte_eth_dev *, uint16_t,
+ void *))
+   dlsym(ark->d_handle, "set_mtu");
 
return found;
 }
@@ -346,8 +353,9 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
}
 
if (ark->user_ext.dev_init) {
-   ark->user_data = ark->user_ext.dev_init(dev, ark->a_bar, 0);
-   if (!ark->user_data) {
+   ark->user_data[dev->data->port_id] =
+   ark->user_ext.dev_init(dev, ark->a_bar, 0);
+   if (!ark->user_data[dev->data->port_id]) {
PMD_DRV_LOG(INFO,
"Failed to initialize PMD extension!"
" continuing without it\n");
@@ -369,7 +377,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 */
if (ark->user_ext.dev_get_port_count)
port_count =
-   ark->user_ext.dev_get_port_count(dev, ark->user_data);
+   ark->user_ext.dev_get_port_count(dev,
+ark->user_data[dev->data->port_id]);
ark->num_ports = port_count;
 
for (p = 0; p < port_count; p++) {
@@ -410,9 +419,10 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
goto error;
}
 
-   if (ark->user_ext.dev_init)
-   ark->user_data =
+   if (ark->user_ext.dev_init) {
+   ark->user_data[eth_dev->data->port_id] =
ark->user_ext.dev_init(dev, ark->a_bar, p);
+   }
}
 
return ret;
@@ -508,7 +518,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
return 0;
 
if (ark->user_ext.dev_uninit)
-   ark->user_ext.dev_uninit(dev, ark->user_data);
+   ark->user_ext.dev_uninit(dev,
+ark->user_data[dev->data->port_id]);
 
ark_pktgen_uninit(ark->pg);
ark_pktchkr_uninit(ark->pc);
@@ -529,7 +540,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 
eth_ark_dev_set_link_up(dev);
if (ark->user_ext.dev_configure)
-   return ark->user_ext.dev_configure(dev, ark->user_data);
+   return ark->user_ext.dev_configure(dev,
+  ark->user_data[dev->data->port_id]);
return 0;
 }
 
@@ -592,7 +604,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
}
 
if (ark->user_ext.dev_start)
-   ark->user_ext.dev_start(dev, ark->user_data);
+   ark->user_ext.dev_start(dev,
+   ark->user_data[dev->data->port_id]);
 
return 0;
 }
@@ -614,7 +627,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 
/* Stop the extension first */
if (ark->user_ext.dev_stop)
-   ark->user_ext.dev_stop(dev, ark->user_data);
+   ark->user_ext.dev_stop(dev,
+  ark->user_data[dev->data->port_id]);
 
/* Stop the packet generator */
if (ark->start_pg)
@@ -697,7 +711,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
uint16_t i;
 
if (ark->user_ext.dev_close)
-   ark->

[dpdk-dev] [PATCH 2/2] net/ark: fix bug in stats_reset operation

2017-06-22 Thread John Miller
Repairs a bug in the stats_reset where the wrong queue was
being passed into tx reset.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 55e6b24..fff2d8a 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -842,7 +842,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
(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]);
+   eth_tx_queue_stats_reset(dev->data->tx_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)
-- 
1.9.1



[dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix

2017-06-28 Thread John Miller
v2:
* Split the user extension private data per port patch and the
  set_mtu patch into separate patches.
* Add better description to per port private data patch
* stats_reset patch untouched from V1

John Miller (3):
  net/ark: allow unique user data for each port in extension calls
  net/ark: add set_mtu call to user extension API
  net/ark: fix bug in stats_reset operation

 drivers/net/ark/ark_ethdev.c | 72 
 drivers/net/ark/ark_ext.h|  4 +++
 drivers/net/ark/ark_global.h |  5 +--
 3 files changed, 60 insertions(+), 21 deletions(-)

-- 
1.9.1



[dpdk-dev] [PATCH v2 2/3] net/ark: add set_mtu call to user extension API

2017-06-28 Thread John Miller
Allows a user extension to set a callback for the set_mtu
operation.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c | 19 +++
 drivers/net/ark/ark_ext.h|  4 
 drivers/net/ark/ark_global.h |  1 +
 3 files changed, 24 insertions(+)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index e5a8ff7..5733ba3 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -77,6 +77,7 @@ static int eth_ark_macaddr_add(struct rte_eth_dev *dev,
   uint32_t pool);
 static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
   uint32_t index);
+static int  eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size);
 
 /*
  * The packet generator is a functional block used to generate packet
@@ -180,6 +181,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
.mac_addr_remove = eth_ark_macaddr_remove,
.mac_addr_set = eth_ark_set_default_mac_addr,
 
+   .mtu_set = eth_ark_set_mtu,
 };
 
 static int
@@ -257,6 +259,10 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
(void (*)(struct rte_eth_dev *, struct ether_addr *,
  void *))
dlsym(ark->d_handle, "mac_addr_set");
+   ark->user_ext.set_mtu =
+   (int (*)(struct rte_eth_dev *, uint16_t,
+ void *))
+   dlsym(ark->d_handle, "set_mtu");
 
return found;
 }
@@ -887,6 +893,19 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
   ark->user_data[dev->data->port_id]);
 }
 
+static int
+eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t  size)
+{
+   struct ark_adapter *ark =
+   (struct ark_adapter *)dev->data->dev_private;
+
+   if (ark->user_ext.set_mtu)
+   return ark->user_ext.set_mtu(dev, size,
+ark->user_data[dev->data->port_id]);
+
+   return -ENOTSUP;
+}
+
 static inline int
 process_pktdir_arg(const char *key, const char *value,
   void *extra_args)
diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/ark_ext.h
index f805f64..63b7a26 100644
--- a/drivers/net/ark/ark_ext.h
+++ b/drivers/net/ark/ark_ext.h
@@ -112,4 +112,8 @@ void mac_addr_set(struct rte_eth_dev *dev,
  struct ether_addr *mac_addr,
  void *user_data);
 
+int set_mtu(struct rte_eth_dev *dev,
+   uint16_t size,
+   void *user_data);
+
 #endif
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 58af8db..2a6375f 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -106,6 +106,7 @@ struct ark_user_ext {
 void *);
void (*mac_addr_remove)(struct rte_eth_dev *, uint32_t, void *);
void (*mac_addr_set)(struct rte_eth_dev *, struct ether_addr *, void *);
+   int (*set_mtu)(struct rte_eth_dev *, uint16_t, void *);
 };
 
 struct ark_adapter {
-- 
1.9.1



[dpdk-dev] [PATCH v2 1/3] net/ark: allow unique user data for each port in extension calls

2017-06-28 Thread John Miller
This change allows a user extension to provide unique private
callback data for all ports.

Arkville is a single-function multi-port device.  User_data resides
in the singleton Arkville structure.  This structure is shared across
all ports devices (eth_dev) which are created one per port.  For the
command extension callback we provide an opaque user pointer, which is
currently implemented in the singleton Arkville structure.

With this patch, we are providing a unique user pointer for each port
rather than a common pointer across multiple ports.  The pointers are
stored in an array of size RTE_MAX_ETHPORTS in the arkville structure and
are indexed by port_id in the PMD. The motivation for this change is that
users of the arkville PMD extension have a unique pointer per port rather
then one per function.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c | 51 
 drivers/net/ark/ark_global.h |  4 ++--
 2 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index c061f7b..e5a8ff7 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -179,6 +179,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
.mac_addr_add = eth_ark_macaddr_add,
.mac_addr_remove = eth_ark_macaddr_remove,
.mac_addr_set = eth_ark_set_default_mac_addr,
+
 };
 
 static int
@@ -346,8 +347,9 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
}
 
if (ark->user_ext.dev_init) {
-   ark->user_data = ark->user_ext.dev_init(dev, ark->a_bar, 0);
-   if (!ark->user_data) {
+   ark->user_data[dev->data->port_id] =
+   ark->user_ext.dev_init(dev, ark->a_bar, 0);
+   if (!ark->user_data[dev->data->port_id]) {
PMD_DRV_LOG(INFO,
"Failed to initialize PMD extension!"
" continuing without it\n");
@@ -369,7 +371,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 */
if (ark->user_ext.dev_get_port_count)
port_count =
-   ark->user_ext.dev_get_port_count(dev, ark->user_data);
+   ark->user_ext.dev_get_port_count(dev,
+ark->user_data[dev->data->port_id]);
ark->num_ports = port_count;
 
for (p = 0; p < port_count; p++) {
@@ -410,9 +413,10 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
goto error;
}
 
-   if (ark->user_ext.dev_init)
-   ark->user_data =
+   if (ark->user_ext.dev_init) {
+   ark->user_data[eth_dev->data->port_id] =
ark->user_ext.dev_init(dev, ark->a_bar, p);
+   }
}
 
return ret;
@@ -508,7 +512,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
return 0;
 
if (ark->user_ext.dev_uninit)
-   ark->user_ext.dev_uninit(dev, ark->user_data);
+   ark->user_ext.dev_uninit(dev,
+ark->user_data[dev->data->port_id]);
 
ark_pktgen_uninit(ark->pg);
ark_pktchkr_uninit(ark->pc);
@@ -529,7 +534,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 
eth_ark_dev_set_link_up(dev);
if (ark->user_ext.dev_configure)
-   return ark->user_ext.dev_configure(dev, ark->user_data);
+   return ark->user_ext.dev_configure(dev,
+  ark->user_data[dev->data->port_id]);
return 0;
 }
 
@@ -592,7 +598,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
}
 
if (ark->user_ext.dev_start)
-   ark->user_ext.dev_start(dev, ark->user_data);
+   ark->user_ext.dev_start(dev,
+   ark->user_data[dev->data->port_id]);
 
return 0;
 }
@@ -614,7 +621,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
 
/* Stop the extension first */
if (ark->user_ext.dev_stop)
-   ark->user_ext.dev_stop(dev, ark->user_data);
+   ark->user_ext.dev_stop(dev,
+  ark->user_data[dev->data->port_id]);
 
/* Stop the packet generator */
if (ark->start_pg)
@@ -697,7 +705,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
uint16_t i;
 
if (ark->user_ext.dev_close)
-   ark->user_ext.dev_close(dev, ark->user_data);
+   ark->user_ext.dev_close(dev,
+ark->user_data[dev->data->port_id]);
 
eth_ar

[dpdk-dev] [PATCH v2 3/3] net/ark: fix bug in stats_reset operation

2017-06-28 Thread John Miller
Repairs a bug in the stats_reset where the wrong queue was
being passed into tx reset.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 5733ba3..6db362b 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -842,7 +842,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
(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]);
+   eth_tx_queue_stats_reset(dev->data->tx_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)
-- 
1.9.1



Re: [dpdk-dev] [PATCH 1/2] net/ark: update packet Rx path to set mbuf time stamp field

2017-04-11 Thread john miller

> On Apr 10, 2017, at 8:26 AM, Ed Czeck  wrote:
> 
> Time stamp was carried in the packet meta data, but not
> place in the mbuf. The new time stamp field is the proper
> destination.
> 
> Remove the setting of data offset since this is done by
> rte_pktmbuf_free()
> 
> Signed-off-by: Ed Czeck 

Acked-by: John Miller mailto:john.mil...@atomicrules.com>>






[dpdk-dev] error in testpmd when CONFIG_RTE_BUILD_SHARED_LIB=y

2017-04-11 Thread john miller

We are seeing an issue when running from the head of the master branch in 
dpdk-next-net and building with CONFIG_RTE_BUILD_SHARED_LIB=y.   When we run 
testpmd using  -d to point to our PMD we get this error

EAL: Error - exiting with code: 1
  Cause: Creation of mbuf pool for socket 0 failed: Invalid argument

This error occurs as a result of the rte mempool ops table having 0 entries.  
This table is populated from a call to rte_mempool_register_ops().  This 
function gets called in rte_mempool_ring.c via the static initialization MACRO 
MEMPOOL_REGISTER_OPS and exists in librte_mempool_ring.so.  However this 
library is not loaded when the rte_eal_init() gets called so the static 
initializers are not yet loaded.   

I am requesting advice on the proper way to repair this.

Thank you,
-John




Re: [dpdk-dev] [PATCH v2 2/2] net/ark: report hardware status during PMD init

2017-04-11 Thread john miller

> On Apr 11, 2017, at 11:41 AM, Ed Czeck  wrote:
> 
> Expose additional fpga status registers.
> Report hardware status during PMD init.
> 
> Signed-off-by: Ed Czeck 

Acked-by: John Miller mailto:john.mil...@atomicrules.com>>




Re: [dpdk-dev] [PATCH 2/2] net/ark: fix FreeBSD compilation

2017-04-20 Thread john miller

> On Apr 20, 2017, at 12:32 PM, Bruce Richardson  
> wrote:
> 
> On FreeBSD it's not necessary to use -ldl to link apps which use
> dlopen. This error only showed up with a shared library gcc build,
> not standard build using static libs.
> 
> Fixes: 1131cbf0fb2b ("net/ark: stub PMD for Atomic Rules Arkville")
> 
> Signed-off-by: Bruce Richardson 


Thanks Bruce.

Acked-by: John Miller mailto:john.mil...@atomicrules.com>>




[dpdk-dev] [PATCH] net/ark: fix kvargs memory leak

2017-05-01 Thread john miller
Coverity issue: 1428042
Fixes: 1131cbf0fb2b ("net/ark: stub PMD for Atomic Rules Arkville")

Signed-off-by: Ferruh Yigit 

Acked-by: John Miller mailto:john.mil...@atomicrules.com>>




[dpdk-dev] [PATCH] net/ark: fix for Coverity issues

2017-05-11 Thread John Miller
Fixes: 9c7188a68d7b ("net/ark: provide API for hardware modules pktchkr and 
pktgen")
Coverity issue: 144513

Fixes: 727b3fe292bc ("net/ark: integrate PMD")
Coverity issue: 144514

Fixes: 9c7188a68d7b ("net/ark: provide API for hardware modules pktchkr and 
pktgen")
Coverity issue: 144512

Fixes: 1131cbf0fb2b ("net/ark: stub PMD for Atomic Rules Arkville")
Coverity issue: 144517

Fixes: 727b3fe292bc ("net/ark: integrate PMD")
Coverity issue: 144520

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c  | 18 --
 drivers/net/ark/ark_pktchkr.c |  3 ++-
 drivers/net/ark/ark_pktgen.c  |  3 ++-
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 995c93d..5f00a02 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -516,11 +516,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
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);
-
+   rte_free(dev->data->mac_addrs);
return 0;
 }
 
@@ -588,7 +584,11 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
/* 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 (pthread_create(&thread, NULL, delay_pg_start, ark)) {
+   PMD_DRV_LOG(ERR, "Could not create pktgen "
+   "starter thread\n");
+   return -1;
+   }
}
 
if (ark->user_ext.dev_start)
@@ -899,6 +899,12 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
int  size = 0;
int first = 1;
 
+   if (file == NULL) {
+   PMD_DRV_LOG(ERR, "Unable to open, "
+   "config file %s\n", value);
+   return -1;
+   }
+
while (fgets(line, sizeof(line), file)) {
size += strlen(line);
if (size >= ARK_MAX_ARG_LEN) {
diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c
index 62b3673..e933026 100644
--- a/drivers/net/ark/ark_pktchkr.c
+++ b/drivers/net/ark/ark_pktchkr.c
@@ -372,7 +372,8 @@ struct OPTIONS {
o->v.INT = atoll(val);
break;
case OTSTRING:
-   strncpy(o->v.STR, val, ARK_MAX_STR_LEN);
+   strncpy(o->v.STR, val, ARK_MAX_STR_LEN - 1);
+   o->v.STR[ARK_MAX_STR_LEN - 1] = 0;
break;
}
return 1;
diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
index bdac054..7308f14 100644
--- a/drivers/net/ark/ark_pktgen.c
+++ b/drivers/net/ark/ark_pktgen.c
@@ -354,7 +354,8 @@ struct OPTIONS {
o->v.INT = atoll(val);
break;
case OTSTRING:
-   strncpy(o->v.STR, val, ARK_MAX_STR_LEN);
+   strncpy(o->v.STR, val, ARK_MAX_STR_LEN - 1);
+   o->v.STR[ARK_MAX_STR_LEN - 1] = 0;
break;
}
return 1;
-- 
1.9.1



Re: [dpdk-dev] [PATCH] net/ark: fix for Coverity issues

2017-05-13 Thread john miller
Hi Ferruh,

Thank you for your review.
I will create a new patchset for these fixes with all of the changes you 
requested.

-John

> On May 12, 2017, at 7:11 AM, Ferruh Yigit  wrote:
> 
> On 5/11/2017 12:02 PM, John Miller wrote:
>> Fixes: 9c7188a68d7b ("net/ark: provide API for hardware modules pktchkr and 
>> pktgen")
>> Coverity issue: 144513
>> 
>> Fixes: 727b3fe292bc ("net/ark: integrate PMD")
>> Coverity issue: 144514
>> 
>> Fixes: 9c7188a68d7b ("net/ark: provide API for hardware modules pktchkr and 
>> pktgen")
>> Coverity issue: 144512
>> 
>> Fixes: 1131cbf0fb2b ("net/ark: stub PMD for Atomic Rules Arkville")
>> Coverity issue: 144517
> 
> The convention is Coverity line first, Fixes line later.
> 
>> 
>> Fixes: 727b3fe292bc ("net/ark: integrate PMD")
>> Coverity issue: 144520
> 
> Hi John,
> 
> Thanks for fixing coverity issues.
> 
> Can you please split patch into a patchset with multiple patches,
> grouped to same kind of fixes?
> 
> And instead of having "coverity fix" in patch title, can you please
> describe what is really fixed, like "fix not null terminated buffer" or
> "fix missing function return check" etc ...
> 
> Thanks,
> ferruh
> 
>> Signed-off-by: John Miller 
> 
> <...>
> 
>> --- a/drivers/net/ark/ark_pktgen.c
>> +++ b/drivers/net/ark/ark_pktgen.c
>> @@ -354,7 +354,8 @@ struct OPTIONS {
>>  o->v.INT = atoll(val);
>>  break;
>>  case OTSTRING:
>> -strncpy(o->v.STR, val, ARK_MAX_STR_LEN);
>> +strncpy(o->v.STR, val, ARK_MAX_STR_LEN - 1);
>> +o->v.STR[ARK_MAX_STR_LEN - 1] = 0;
> 
> This also works, but you can prefer to switch snprintf(), which
> guaranties the null termination.
> 
>>  break;
>>  }
>>  return 1;
>> 
> 



[dpdk-dev] [PATCH 1/4] net/ark: fix for buffer not null terminated

2017-05-16 Thread John Miller
Coverity issue: 144512
Coverity issue: 144513
Fixes: 9c7188a68d7b ("net/ark: provide API for hardware modules pktchkr and 
pktgen")

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_pktchkr.c | 2 +-
 drivers/net/ark/ark_pktgen.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c
index 62b3673..c3040af 100644
--- a/drivers/net/ark/ark_pktchkr.c
+++ b/drivers/net/ark/ark_pktchkr.c
@@ -372,7 +372,7 @@ struct OPTIONS {
o->v.INT = atoll(val);
break;
case OTSTRING:
-   strncpy(o->v.STR, val, ARK_MAX_STR_LEN);
+   snprintf(o->v.STR, ARK_MAX_STR_LEN, "%s", val);
break;
}
return 1;
diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
index bdac054..8c7a8a2 100644
--- a/drivers/net/ark/ark_pktgen.c
+++ b/drivers/net/ark/ark_pktgen.c
@@ -354,7 +354,7 @@ struct OPTIONS {
o->v.INT = atoll(val);
break;
case OTSTRING:
-   strncpy(o->v.STR, val, ARK_MAX_STR_LEN);
+   snprintf(o->v.STR, ARK_MAX_STR_LEN, "%s", val);
break;
}
return 1;
-- 
1.9.1



[dpdk-dev] [PATCH 2/4] net/ark: fix return code not checked

2017-05-16 Thread John Miller
Coverity issue: 144514
Fixes: 727b3fe292bc ("net/ark: integrate PMD")

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 995c93d..9143fc4 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -588,7 +588,11 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
/* 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 (pthread_create(&thread, NULL, delay_pg_start, ark)) {
+   PMD_DRV_LOG(ERR, "Could not create pktgen "
+   "starter thread\n");
+   return -1;
+   }
}
 
if (ark->user_ext.dev_start)
-- 
1.9.1



[dpdk-dev] [PATCH 3/4] net/ark: fix null pointer dereference

2017-05-16 Thread John Miller
Coverity issue: 144520
Fixes: 727b3fe292bc ("net/ark: integrate PMD")

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 9143fc4..f8fb359 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -516,11 +516,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
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);
-
+   rte_free(dev->data->mac_addrs);
return 0;
 }
 
-- 
1.9.1



[dpdk-dev] [PATCH 4/4] net/ark: fix return value of null not checked

2017-05-16 Thread John Miller
Coverity issue: 144517
Fixes: 1131cbf0fb2b ("net/ark: stub PMD for Atomic Rules Arkville")

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index f8fb359..017817e 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -899,6 +899,12 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
int  size = 0;
int first = 1;
 
+   if (file == NULL) {
+   PMD_DRV_LOG(ERR, "Unable to open "
+   "config file %s\n", value);
+   return -1;
+   }
+
while (fgets(line, sizeof(line), file)) {
size += strlen(line);
if (size >= ARK_MAX_ARG_LEN) {
-- 
1.9.1



Re: [dpdk-dev] [PATCH] net/ark: Add missing call to probe_finish for first device

2018-05-21 Thread john miller


> On May 21, 2018, at 3:29 PM, Ed Czeck  wrote:
> 
> Fix on commit fbe90cdd776c ("ethdev: add probing finish function")
> 
> Signed-off-by: Ed Czeck 
> ---
> drivers/net/ark/ark_ethdev.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
> index 62e4fd3..834d8a9 100644
> --- a/drivers/net/ark/ark_ethdev.c
> +++ b/drivers/net/ark/ark_ethdev.c
> @@ -390,6 +390,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
>   if (p == 0) {
>   /* First port is already allocated by DPDK */
>   eth_dev = ark->eth_dev;
> + rte_eth_dev_probing_finish(eth_dev);
>   continue;
>   }
> 
> -- 
> 2.7.4
> 

Acked-by: John Miller  mailto:john.mil...@atomicrules.com>>

[dpdk-dev] [PATCH] net/ark: repair incorrect loop counter

2017-10-06 Thread John Miller
Change loop counter that should be based on the number
of rx queues, not tx queues.  This only affects debug
output.

Signed-off-by: John Miller 
---
 drivers/net/ark/ark_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ba25a9d..7130dca 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -698,7 +698,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
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++)
+   for (i = 0; i < dev->data->nb_rx_queues; i++)
eth_ark_rx_dump_queue(dev, i, __func__);
 
/* Stop the packet checker if it is running */
-- 
1.9.1



[dpdk-dev] 17.11 release candidate tag

2017-10-13 Thread john miller

Hello,

Is there a release candidate available for 17.11 ?I could not find a tag in 
the dpdk-next-net repo.

Thank you,
-John



[dpdk-dev] CentOS support for 17.11

2017-10-16 Thread john miller
Hello,

We have been testing the dpdk-17.11-rc1 candidate on our Ubuntu platforms. We 
just tried to compile it on one of our CentOS platform and get this error.  

== Build lib/librte_eal/linuxapp/igb_uio
  CC [M]  
/projects/dpdk/dpdk-17.11-rc1/build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.o
/projects/dpdk/dpdk-17.11-rc1/build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.c:
 In function ‘igbuio_pci_irqhandler’:
/projects/dpdk/dpdk-17.11-rc1/build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.c:213:30:
 error: dereferencing pointer to incomplete type
  struct uio_info *info = idev->info;




Description:CentOS Linux release 7.2.1511 (Core) 

Is CentOS 7.2 still supported ?
Has anyone else run into this issue ?

I was not able to find the supported platforms doc for 17.11 online.

Thank you,
-John