4 * Copyright (c) 2015-2017 Atomic Rules LLC
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of copyright holder nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #ifndef _ARK_GLOBAL_H_
35 #define _ARK_GLOBAL_H_
41 #include <rte_ethdev.h>
42 #include <rte_malloc.h>
43 #include <rte_memcpy.h>
44 #include <rte_string_fns.h>
45 #include <rte_cycles.h>
46 #include <rte_kvargs.h>
48 #include <rte_version.h>
50 #include "ark_pktdir.h"
51 #include "ark_pktgen.h"
52 #include "ark_pktchkr.h"
54 #define ETH_ARK_ARG_MAXLEN 64
55 #define ARK_SYSCTRL_BASE 0x0
56 #define ARK_PKTGEN_BASE 0x10000
57 #define ARK_MPU_RX_BASE 0x20000
58 #define ARK_UDM_BASE 0x30000
59 #define ARK_MPU_TX_BASE 0x40000
60 #define ARK_DDM_BASE 0x60000
61 #define ARK_CMAC_BASE 0x80000
62 #define ARK_PKTDIR_BASE 0xa0000
63 #define ARK_PKTCHKR_BASE 0x90000
64 #define ARK_RCPACING_BASE 0xb0000
65 #define ARK_EXTERNAL_BASE 0x100000
66 #define ARK_MPU_QOFFSET 0x00100
67 #define ARK_MAX_PORTS RTE_MAX_ETHPORTS
70 #define offset16(n) ((n) / 2)
71 #define offset32(n) ((n) / 4)
72 #define offset64(n) ((n) / 8)
74 /* Maximum length of arg list in bytes */
75 #define ARK_MAX_ARG_LEN 256
78 * Structure to store private data for each PF/VF instance.
80 #define def_ptr(type, name) \
90 void *(*dev_init)(struct rte_eth_dev *, void *abar, int port_id);
91 void (*dev_uninit)(struct rte_eth_dev *, void *);
92 int (*dev_get_port_count)(struct rte_eth_dev *, void *);
93 int (*dev_configure)(struct rte_eth_dev *, void *);
94 int (*dev_start)(struct rte_eth_dev *, void *);
95 void (*dev_stop)(struct rte_eth_dev *, void *);
96 void (*dev_close)(struct rte_eth_dev *, void *);
97 int (*link_update)(struct rte_eth_dev *, int wait_to_complete, void *);
98 int (*dev_set_link_up)(struct rte_eth_dev *, void *);
99 int (*dev_set_link_down)(struct rte_eth_dev *, void *);
100 void (*stats_get)(struct rte_eth_dev *, struct rte_eth_stats *, void *);
101 void (*stats_reset)(struct rte_eth_dev *, void *);
102 void (*mac_addr_add)(struct rte_eth_dev *,
107 void (*mac_addr_remove)(struct rte_eth_dev *, uint32_t, void *);
108 void (*mac_addr_set)(struct rte_eth_dev *, struct ether_addr *, void *);
109 int (*set_mtu)(struct rte_eth_dev *, uint16_t, void *);
113 /* User extension private data */
114 void *user_data[ARK_MAX_PORTS];
116 /* Pointers to packet generator and checker */
124 /* Packet generator/checker args */
125 char pkt_gen_args[ARK_MAX_ARG_LEN];
126 char pkt_chkr_args[ARK_MAX_ARG_LEN];
130 struct rte_eth_dev *eth_dev;
133 struct ark_user_ext user_ext;
138 /* Application Bar */
141 /* Arkville demo block offsets */
142 def_ptr(sys_ctrl, sysctrl);
143 def_ptr(pkt_gen, pktgen);
144 def_ptr(mpu_rx, mpurx);
146 def_ptr(mpu_tx, mputx);
149 def_ptr(external, external);
150 def_ptr(pkt_dir, pktdir);
151 def_ptr(pkt_chkr, pktchkr);
157 struct ark_rqpace_t *rqpacing;
160 typedef uint32_t *ark_t;