[v2,3/3] net/ark: support for updated hardware and Tx meta data
diff mbox series

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

Checks

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

Commit Message

Ed Czeck Oct. 15, 2018, 12:53 p.m. UTC
Support for version 2 of DDM hardware and user tx meta data.
Verify version during initialization.

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ddm.c       | 12 ++++++++++--
 drivers/net/ark/ark_ddm.h       |  7 +++++--
 drivers/net/ark/ark_ethdev.c    |  3 +++
 drivers/net/ark/ark_ethdev_tx.c |  2 +-
 4 files changed, 19 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/ark/ark_ddm.c b/drivers/net/ark/ark_ddm.c
index eea388a..57026f8 100644
--- a/drivers/net/ark/ark_ddm.c
+++ b/drivers/net/ark/ark_ddm.c
@@ -11,14 +11,22 @@ 
 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) {
-		PMD_DRV_LOG(ERR, "ARK: DDM module not found as expected 0x%08x\n",
+	hw_const = ddm->cfg.const0;
+	if (hw_const == ARK_DDM_CONST1) {
+		PMD_DRV_LOG(ERR,
+			    "ARK: DDM module is version 1, "
+			    "PMD expects version 2\n");
+		return -1;
+	} else if (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.c b/drivers/net/ark/ark_ethdev.c
index 552ca01..c26f076 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -313,6 +313,9 @@  eth_ark_dev_init(struct rte_eth_dev *dev)
 
 	/* We are a single function multi-port device. */
 	ret = ark_config_device(dev);
+	if (ret)
+		return -1;
+
 	dev->dev_ops = &ark_eth_dev_ops;
 
 	dev->data->mac_addrs = rte_zmalloc("ark", ETHER_ADDR_LEN, 0);
diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c
index 57188c2..94da5f9 100644
--- a/drivers/net/ark/ark_ethdev_tx.c
+++ b/drivers/net/ark/ark_ethdev_tx.c
@@ -65,7 +65,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 = (uint32_t)mbuf->udata64;
 	meta->data_len = rte_pktmbuf_data_len(mbuf);
 	meta->flags = flags;
 }