1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2015-2018 Atomic Rules LLC
12 #include <rte_ethdev_driver.h>
13 #include <rte_malloc.h>
14 #include <rte_memcpy.h>
15 #include <rte_string_fns.h>
16 #include <rte_cycles.h>
17 #include <rte_kvargs.h>
19 #include <rte_version.h>
21 #include "ark_pktdir.h"
22 #include "ark_pktgen.h"
23 #include "ark_pktchkr.h"
25 #define ETH_ARK_ARG_MAXLEN 64
26 #define ARK_SYSCTRL_BASE 0x0
27 #define ARK_PKTGEN_BASE 0x10000
28 #define ARK_MPU_RX_BASE 0x20000
29 #define ARK_UDM_BASE 0x30000
30 #define ARK_MPU_TX_BASE 0x40000
31 #define ARK_DDM_BASE 0x60000
32 #define ARK_CMAC_BASE 0x80000
33 #define ARK_PKTDIR_BASE 0xa0000
34 #define ARK_PKTCHKR_BASE 0x90000
35 #define ARK_RCPACING_BASE 0xb0000
36 #define ARK_EXTERNAL_BASE 0x100000
37 #define ARK_MPU_QOFFSET 0x00100
38 #define ARK_MAX_PORTS RTE_MAX_ETHPORTS
41 #define offset16(n) ((n) / 2)
42 #define offset32(n) ((n) / 4)
43 #define offset64(n) ((n) / 8)
45 /* Maximum length of arg list in bytes */
46 #define ARK_MAX_ARG_LEN 256
49 * Structure to store private data for each PF/VF instance.
51 #define def_ptr(type, name) \
61 void *(*dev_init)(struct rte_eth_dev *, void *abar, int port_id);
62 void (*dev_uninit)(struct rte_eth_dev *, void *);
63 int (*dev_get_port_count)(struct rte_eth_dev *, void *);
64 int (*dev_configure)(struct rte_eth_dev *, void *);
65 int (*dev_start)(struct rte_eth_dev *, void *);
66 void (*dev_stop)(struct rte_eth_dev *, void *);
67 void (*dev_close)(struct rte_eth_dev *, void *);
68 int (*link_update)(struct rte_eth_dev *, int wait_to_complete, void *);
69 int (*dev_set_link_up)(struct rte_eth_dev *, void *);
70 int (*dev_set_link_down)(struct rte_eth_dev *, void *);
71 int (*stats_get)(struct rte_eth_dev *, struct rte_eth_stats *, void *);
72 void (*stats_reset)(struct rte_eth_dev *, void *);
73 void (*mac_addr_add)(struct rte_eth_dev *,
74 struct rte_ether_addr *,
78 void (*mac_addr_remove)(struct rte_eth_dev *, uint32_t, void *);
79 void (*mac_addr_set)(struct rte_eth_dev *, struct rte_ether_addr *,
81 int (*set_mtu)(struct rte_eth_dev *, uint16_t, void *);
85 /* User extension private data */
86 void *user_data[ARK_MAX_PORTS];
88 /* Pointers to packet generator and checker */
96 /* Packet generator/checker args */
97 char pkt_gen_args[ARK_MAX_ARG_LEN];
98 char pkt_chkr_args[ARK_MAX_ARG_LEN];
102 struct rte_eth_dev *eth_dev;
105 struct ark_user_ext user_ext;
110 /* Application Bar */
113 /* Arkville demo block offsets */
114 def_ptr(sys_ctrl, sysctrl);
115 def_ptr(pkt_gen, pktgen);
116 def_ptr(mpu_rx, mpurx);
118 def_ptr(mpu_tx, mputx);
121 def_ptr(external, external);
122 def_ptr(pkt_dir, pktdir);
123 def_ptr(pkt_chkr, pktchkr);
129 struct ark_rqpace_t *rqpacing;
132 typedef uint32_t *ark_t;