[3/3] net/ark: support for updated Tx hardware with user meta data
diff mbox series

Message ID 1539033410-21422-3-git-send-email-ed.czeck@atomicrules.com
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • [1/3] net/ark: add recovery code for lack of mbufs during runtime
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ed Czeck Oct. 8, 2018, 9:16 p.m. UTC
Support for version 2 of DDM hardware.
Add configurable setup for using DDM user meta data via
CONFIG_RTE_LIBRTE_ARK_DDM_USER_META
defaults to 0 for the meta data compatible with v1 hardware.
Set to 1 use uudata64.

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 config/common_base              |  1 +
 drivers/net/ark/ark_ddm.c       |  5 ++++-
 drivers/net/ark/ark_ddm.h       |  7 +++++--
 drivers/net/ark/ark_ethdev_tx.c | 11 ++++++++++-
 4 files changed, 20 insertions(+), 4 deletions(-)

Comments

Ferruh Yigit Oct. 9, 2018, 3:59 p.m. UTC | #1
On 10/8/2018 10:16 PM, Ed Czeck wrote:
> Support for version 2 of DDM hardware.
> Add configurable setup for using DDM user meta data via
> CONFIG_RTE_LIBRTE_ARK_DDM_USER_META
> defaults to 0 for the meta data compatible with v1 hardware.
> Set to 1 use uudata64.
> 
> Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
> ---
>  config/common_base              |  1 +
>  drivers/net/ark/ark_ddm.c       |  5 ++++-
>  drivers/net/ark/ark_ddm.h       |  7 +++++--
>  drivers/net/ark/ark_ethdev_tx.c | 11 ++++++++++-
>  4 files changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/config/common_base b/config/common_base
> index 4bcbaf9..c346229 100644
> --- a/config/common_base
> +++ b/config/common_base
> @@ -162,6 +162,7 @@ CONFIG_RTE_LIBRTE_ARK_DEBUG_RX=n
>  CONFIG_RTE_LIBRTE_ARK_DEBUG_TX=n
>  CONFIG_RTE_LIBRTE_ARK_DEBUG_STATS=n
>  CONFIG_RTE_LIBRTE_ARK_DEBUG_TRACE=n
> +CONFIG_RTE_LIBRTE_ARK_DDM_USER_META=0

Hi Ed,

We are trying to reduce our compile time configuration, what do you think
providing same functionality with devargs?

Patch
diff mbox series

diff --git a/config/common_base b/config/common_base
index 4bcbaf9..c346229 100644
--- a/config/common_base
+++ b/config/common_base
@@ -162,6 +162,7 @@  CONFIG_RTE_LIBRTE_ARK_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_ARK_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_ARK_DEBUG_STATS=n
 CONFIG_RTE_LIBRTE_ARK_DEBUG_TRACE=n
+CONFIG_RTE_LIBRTE_ARK_DDM_USER_META=0
 
 #
 # Compile AMD PMD
diff --git a/drivers/net/ark/ark_ddm.c b/drivers/net/ark/ark_ddm.c
index eea388a..70910d5 100644
--- a/drivers/net/ark/ark_ddm.c
+++ b/drivers/net/ark/ark_ddm.c
@@ -11,13 +11,16 @@ 
 int
 ark_ddm_verify(struct ark_ddm_t *ddm)
 {
+	uint32_t hw_const;
 	if (sizeof(struct ark_ddm_t) != ARK_DDM_EXPECTED_SIZE) {
 		PMD_DRV_LOG(ERR, "ARK: DDM structure looks incorrect %d vs %zd\n",
 			    ARK_DDM_EXPECTED_SIZE, sizeof(struct ark_ddm_t));
 		return -1;
 	}
 
-	if (ddm->cfg.const0 != ARK_DDM_CONST) {
+	hw_const = ddm->cfg.const0;
+	if (hw_const != ARK_DDM_CONST1 &&
+	    hw_const != ARK_DDM_CONST2) {
 		PMD_DRV_LOG(ERR, "ARK: DDM module not found as expected 0x%08x\n",
 			    ddm->cfg.const0);
 		return -1;
diff --git a/drivers/net/ark/ark_ddm.h b/drivers/net/ark/ark_ddm.h
index b37d1e0..5456b4b 100644
--- a/drivers/net/ark/ark_ddm.h
+++ b/drivers/net/ark/ark_ddm.h
@@ -19,7 +19,7 @@ 
 /* struct defining Tx meta data --  fixed in FPGA -- 16 bytes */
 struct ark_tx_meta {
 	uint64_t physaddr;
-	uint32_t delta_ns;
+	uint32_t user1;
 	uint16_t data_len;		/* of this MBUF */
 #define   ARK_DDM_EOP   0x01
 #define   ARK_DDM_SOP   0x02
@@ -34,7 +34,10 @@  struct ark_tx_meta {
  * structs will never be instantiated in ram memory
  */
 #define ARK_DDM_CFG 0x0000
-#define ARK_DDM_CONST 0xfacecafe
+/* Set unique HW ID for hardware version */
+#define ARK_DDM_CONST2 (0x324d4444)
+#define ARK_DDM_CONST1 (0xfacecafe)
+
 struct ark_ddm_cfg_t {
 	uint32_t r0;
 	volatile uint32_t tlp_stats_clear;
diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c
index 57188c2..ad5ab06 100644
--- a/drivers/net/ark/ark_ethdev_tx.c
+++ b/drivers/net/ark/ark_ethdev_tx.c
@@ -14,6 +14,15 @@ 
 #define ARK_TX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_TX_META_SIZE)
 #define ARK_TX_MAX_NOCHAIN (RTE_MBUF_DEFAULT_DATAROOM)
 
+/* Define source for TX meta data, const 0, from udata64 or user defined */
+#ifndef RTE_LIBRTE_ARK_DDM_USER_META
+#define ARK_DDM_USER_META 0
+#elseif RTE_LIBRTE_ARK_DDM_USER_META == 1
+#define  ARK_DDM_USER_META ((uint32_t)mbuf->udata64)
+#else
+#define  ARK_DDM_USER_META RTE_LIBRTE_ARK_DDM_USER_META
+#endif
+
 
 /* ************************************************************************* */
 struct ark_tx_queue {
@@ -65,7 +74,7 @@  eth_ark_tx_meta_from_mbuf(struct ark_tx_meta *meta,
 			  uint8_t flags)
 {
 	meta->physaddr = rte_mbuf_data_iova(mbuf);
-	meta->delta_ns = 0;
+	meta->user1 = ARK_DDM_USER_META;
 	meta->data_len = rte_pktmbuf_data_len(mbuf);
 	meta->flags = flags;
 }