From: Ed Czeck Date: Mon, 15 Oct 2018 12:53:26 +0000 (-0400) Subject: net/ark: support updated hardware and Tx meta data X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=589876bff13400b7f30a2df570454720593e35e7;p=dpdk.git net/ark: support updated hardware and Tx meta data Support for version 2 of DDM hardware and user tx meta data. Verify version during initialization. Signed-off-by: Ed Czeck --- diff --git a/drivers/net/ark/ark_ddm.c b/drivers/net/ark/ark_ddm.c index eea388a1e6..57026f8d12 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 b37d1e090b..5456b4b5cc 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 552ca01a69..c26f0769ec 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 57188c2405..94da5f9580 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; }