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 <ed.czeck@atomicrules.com>
This commit is contained in:
Ed Czeck 2018-10-15 08:53:26 -04:00 committed by Ferruh Yigit
parent 0c5b65f45c
commit 589876bff1
4 changed files with 19 additions and 5 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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;
}