2d18989ba3a5e35591145103098709af34801aef
[dpdk.git] / drivers / net / szedata2 / szedata2_iobuf.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 CESNET
3  */
4
5 #include <stdint.h>
6
7 #include <rte_common.h>
8
9 #include "szedata2_iobuf.h"
10
11 /*
12  * IBUFs and OBUFs can generally be located at different offsets in different
13  * firmwares (modes).
14  * This part defines base offsets of IBUFs and OBUFs for various cards
15  * and firmwares (modes).
16  * Type of firmware (mode) is set through configuration option
17  * CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS.
18  * Possible values are:
19  * 0 - for cards (modes):
20  *     NFB-100G1 (100G1)
21  *
22  * 1 - for cards (modes):
23  *     NFB-100G2Q (100G1)
24  *
25  * 2 - for cards (modes):
26  *     NFB-40G2 (40G2)
27  *     NFB-100G2C (100G2)
28  *     NFB-100G2Q (40G2)
29  *
30  * 3 - for cards (modes):
31  *     NFB-40G2 (10G8)
32  *     NFB-100G2Q (10G8)
33  *
34  * 4 - for cards (modes):
35  *     NFB-100G1 (10G10)
36  *
37  * 5 - for experimental firmwares and future use
38  */
39 #if !defined(RTE_LIBRTE_PMD_SZEDATA2_AS)
40 #error "RTE_LIBRTE_PMD_SZEDATA2_AS has to be defined"
41 #elif RTE_LIBRTE_PMD_SZEDATA2_AS == 0
42
43 /*
44  * Cards (modes):
45  *     NFB-100G1 (100G1)
46  */
47
48 const uint32_t szedata2_ibuf_base_table[] = {
49         0x8000
50 };
51 const uint32_t szedata2_obuf_base_table[] = {
52         0x9000
53 };
54
55 #elif RTE_LIBRTE_PMD_SZEDATA2_AS == 1
56
57 /*
58  * Cards (modes):
59  *     NFB-100G2Q (100G1)
60  */
61
62 const uint32_t szedata2_ibuf_base_table[] = {
63         0x8800
64 };
65 const uint32_t szedata2_obuf_base_table[] = {
66         0x9800
67 };
68
69 #elif RTE_LIBRTE_PMD_SZEDATA2_AS == 2
70
71 /*
72  * Cards (modes):
73  *     NFB-40G2 (40G2)
74  *     NFB-100G2C (100G2)
75  *     NFB-100G2Q (40G2)
76  */
77
78 const uint32_t szedata2_ibuf_base_table[] = {
79         0x8000,
80         0x8800
81 };
82 const uint32_t szedata2_obuf_base_table[] = {
83         0x9000,
84         0x9800
85 };
86
87 #elif RTE_LIBRTE_PMD_SZEDATA2_AS == 3
88
89 /*
90  * Cards (modes):
91  *     NFB-40G2 (10G8)
92  *     NFB-100G2Q (10G8)
93  */
94
95 const uint32_t szedata2_ibuf_base_table[] = {
96         0x8000,
97         0x8200,
98         0x8400,
99         0x8600,
100         0x8800,
101         0x8A00,
102         0x8C00,
103         0x8E00
104 };
105 const uint32_t szedata2_obuf_base_table[] = {
106         0x9000,
107         0x9200,
108         0x9400,
109         0x9600,
110         0x9800,
111         0x9A00,
112         0x9C00,
113         0x9E00
114 };
115
116 #elif RTE_LIBRTE_PMD_SZEDATA2_AS == 4
117
118 /*
119  * Cards (modes):
120  *     NFB-100G1 (10G10)
121  */
122
123 const uint32_t szedata2_ibuf_base_table[] = {
124         0x8000,
125         0x8200,
126         0x8400,
127         0x8600,
128         0x8800,
129         0x8A00,
130         0x8C00,
131         0x8E00,
132         0x9000,
133         0x9200
134 };
135 const uint32_t szedata2_obuf_base_table[] = {
136         0xA000,
137         0xA200,
138         0xA400,
139         0xA600,
140         0xA800,
141         0xAA00,
142         0xAC00,
143         0xAE00,
144         0xB000,
145         0xB200
146 };
147
148 #elif RTE_LIBRTE_PMD_SZEDATA2_AS == 5
149
150 /*
151  * Future use and experimental firmwares.
152  */
153
154 const uint32_t szedata2_ibuf_base_table[] = {
155         0x8000,
156         0x8200,
157         0x8400,
158         0x8600,
159         0x8800
160 };
161 const uint32_t szedata2_obuf_base_table[] = {
162         0x9000,
163         0x9200,
164         0x9400,
165         0x9600,
166         0x9800
167 };
168
169 #else
170 #error "RTE_LIBRTE_PMD_SZEDATA2_AS has wrong value, see comments in config file"
171 #endif
172
173 const uint32_t szedata2_ibuf_count = RTE_DIM(szedata2_ibuf_base_table);
174 const uint32_t szedata2_obuf_count = RTE_DIM(szedata2_obuf_base_table);