net/ark: stub PMD for Atomic Rules Arkville
[dpdk.git] / drivers / net / ark / ark_global.h
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright (c) 2015-2017 Atomic Rules LLC
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
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
16  * distribution.
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.
20  *
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.
32  */
33
34 #ifndef _ARK_GLOBAL_H_
35 #define _ARK_GLOBAL_H_
36
37 #include <time.h>
38 #include <assert.h>
39
40 #include <rte_mbuf.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>
47 #include <rte_dev.h>
48 #include <rte_version.h>
49
50 #define ETH_ARK_ARG_MAXLEN      64
51 #define ARK_SYSCTRL_BASE  0x0
52 #define ARK_PKTGEN_BASE   0x10000
53 #define ARK_MPU_RX_BASE   0x20000
54 #define ARK_UDM_BASE      0x30000
55 #define ARK_MPU_TX_BASE   0x40000
56 #define ARK_DDM_BASE      0x60000
57 #define ARK_CMAC_BASE     0x80000
58 #define ARK_PKTDIR_BASE   0xa0000
59 #define ARK_PKTCHKR_BASE  0x90000
60 #define ARK_RCPACING_BASE 0xb0000
61 #define ARK_EXTERNAL_BASE 0x100000
62 #define ARK_MPU_QOFFSET   0x00100
63 #define ARK_MAX_PORTS     8
64
65 #define offset8(n)     n
66 #define offset16(n)   ((n) / 2)
67 #define offset32(n)   ((n) / 4)
68 #define offset64(n)   ((n) / 8)
69
70 /* Maximum length of arg list in bytes */
71 #define ARK_MAX_ARG_LEN 256
72
73 /*
74  * Structure to store private data for each PF/VF instance.
75  */
76 #define def_ptr(type, name) \
77         union type {               \
78                 uint64_t *t64;     \
79                 uint32_t *t32;     \
80                 uint16_t *t16;     \
81                 uint8_t  *t8;      \
82                 void     *v;       \
83         } name
84
85 struct ark_adapter {
86         /* User extension private data */
87         void *user_data;
88
89         int num_ports;
90
91         /* Packet generator/checker args */
92         char pkt_gen_args[ARK_MAX_ARG_LEN];
93         char pkt_chkr_args[ARK_MAX_ARG_LEN];
94         uint32_t pkt_dir_v;
95
96         /* eth device */
97         struct rte_eth_dev *eth_dev;
98
99         void *d_handle;
100
101         /* Our Bar 0 */
102         uint8_t *bar0;
103
104         /* Application Bar */
105         uint8_t *a_bar;
106 };
107
108 typedef uint32_t *ark_t;
109
110 #endif