cc51ec021ad55bd01716cb5277af2377c3007676
[dpdk.git] / lib / librte_net / rte_higig.h
1
2 /* SPDX-License-Identifier: BSD-3-Clause
3  * Copyright(C) 2019 Marvell International Ltd.
4  */
5
6 #ifndef _RTE_HIGIG_H_
7 #define _RTE_HIGIG_H_
8
9 /**
10  * @file
11  *
12  * HIGIG2 headers definition.
13  *
14  * It is a layer 2.5 protocol and used in Broadcom switches.
15  */
16
17 #include <stdint.h>
18 #include <rte_byteorder.h>
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 /**
25  *
26  * higig2 frc header.
27  */
28 struct rte_higig2_frc {
29 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
30         uint32_t ksop:8;
31         uint32_t tc:4;
32         uint32_t mcst:1;
33         uint32_t resv:3;
34         uint32_t dst_modid:8;
35         uint32_t dst_pid:8;
36         uint32_t src_modid:8;
37         uint32_t src_pid:8;
38         uint32_t lbid:8;
39         uint32_t ppd_type:3;
40         uint32_t resv1:3;
41         uint32_t dp:2;
42 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
43         uint32_t ksop:8;
44         uint32_t resv:3;
45         uint32_t mcst:1;
46         uint32_t tc:4;
47         uint32_t dst_modid:8;
48         uint32_t dst_pid:8;
49         uint32_t src_modid:8;
50         uint32_t src_pid:8;
51         uint32_t lbid:8;
52         uint32_t dp:2;
53         uint32_t resv1:3;
54         uint32_t ppd_type:3;
55 #endif
56 };
57
58
59 /**
60  *
61  * higig2 ppt type0 header
62  */
63 struct rte_higig2_ppt_type0 {
64 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
65         uint32_t mirror:1;
66         uint32_t mirror_done:1;
67         uint32_t mirror_only:1;
68         uint32_t ingress_tagged:1;
69         uint32_t dst_tgid:3;
70         uint32_t dst_t:1;
71         uint32_t vc_label2:4;
72         uint32_t label_present:1;
73         uint32_t l3:1;
74         uint32_t res:2;
75         uint32_t vc_label1:8;
76         uint32_t vc_label0:8;
77         uint32_t vid_high:8;
78         uint32_t vid_low:8;
79         uint32_t opc:3;
80         uint32_t res1:2;
81         uint32_t srce_t:1;
82         uint32_t pf:2;
83         uint32_t res2:5;
84         uint32_t hdr_ext_length:3;
85 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
86         uint32_t dst_t:1;
87         uint32_t dst_tgid:3;
88         uint32_t ingress_tagged:1;
89         uint32_t mirror_only:1;
90         uint32_t mirror_done:1;
91         uint32_t mirror:1;
92         uint32_t res:2;
93         uint32_t l3:1;
94         uint32_t label_present:1;
95         uint32_t vc_label2:4;
96         uint32_t vc_label1:8;
97         uint32_t vc_label0:8;
98         uint32_t vid_high:8;
99         uint32_t vid_low:8;
100         uint32_t pf:2;
101         uint32_t srce_t:1;
102         uint32_t res1:2;
103         uint32_t opc:3;
104         uint32_t hdr_ext_length:3;
105         uint32_t res2:5;
106 #endif
107 };
108
109
110 /**
111  *
112  * higig2 ppt type1 header.
113  */
114 __extension__
115 struct rte_higig2_ppt_type1 {
116         uint16_t classification;
117         uint16_t resv;
118         uint16_t vid;
119 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
120         uint16_t opcode:3;
121         uint16_t resv1:2;
122         uint16_t src_t:1;
123         uint16_t pfm:2;
124         uint16_t resv2:5;
125         uint16_t hdr_ext_len:3;
126 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
127         uint16_t pfm:2;
128         uint16_t src_t:1;
129         uint16_t resv1:2;
130         uint16_t opcode:3;
131         uint16_t hdr_ext_len:3;
132         uint16_t resv2:5;
133 #endif
134 };
135
136 /**
137  *
138  * higig2 header
139  */
140 RTE_STD_C11
141 struct rte_higig2_hdr {
142         struct rte_higig2_frc fcr;
143         union {
144                 struct rte_higig2_ppt_type0 ppt0;
145                 struct rte_higig2_ppt_type1 ppt1;
146         };
147 };
148
149 #ifdef __cplusplus
150 }
151 #endif
152
153 #endif /* RTE_HIGIG_H_ */