1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2020 Mellanox Technologies, Ltd
9 #include <rte_byteorder.h>
16 * eCPRI Protocol Revision 1.0, 1.1, 1.2, 2.0: 0001b
17 * Other values are reserved for future
19 #define RTE_ECPRI_REV_UP_TO_20 1
22 * eCPRI message types in specifications
23 * IWF* types will only be supported from rev.2
24 * 12-63: Reserved for future revision
25 * 64-255: Vendor Specific
27 #define RTE_ECPRI_MSG_TYPE_IQ_DATA 0
28 #define RTE_ECPRI_MSG_TYPE_BIT_SEQ 1
29 #define RTE_ECPRI_MSG_TYPE_RTC_CTRL 2
30 #define RTE_ECPRI_MSG_TYPE_GEN_DATA 3
31 #define RTE_ECPRI_MSG_TYPE_RM_ACC 4
32 #define RTE_ECPRI_MSG_TYPE_DLY_MSR 5
33 #define RTE_ECPRI_MSG_TYPE_RMT_RST 6
34 #define RTE_ECPRI_MSG_TYPE_EVT_IND 7
35 #define RTE_ECPRI_MSG_TYPE_IWF_UP 8
36 #define RTE_ECPRI_MSG_TYPE_IWF_OPT 9
37 #define RTE_ECPRI_MSG_TYPE_IWF_MAP 10
38 #define RTE_ECPRI_MSG_TYPE_IWF_DCTRL 11
41 * Event Type of Message Type #7: Event Indication
42 * 0x00: Fault(s) Indication
43 * 0x01: Fault(s) Indication Acknowledge
44 * 0x02: Notification(s) Indication
45 * 0x03: Synchronization Request
46 * 0x04: Synchronization Acknowledge
47 * 0x05: Synchronization End Indication
48 * 0x06...0xFF: Reserved
50 #define RTE_ECPRI_EVT_IND_FAULT_IND 0x00
51 #define RTE_ECPRI_EVT_IND_FAULT_ACK 0x01
52 #define RTE_ECPRI_EVT_IND_NTFY_IND 0x02
53 #define RTE_ECPRI_EVT_IND_SYNC_REQ 0x03
54 #define RTE_ECPRI_EVT_IND_SYNC_ACK 0x04
55 #define RTE_ECPRI_EVT_IND_SYNC_END 0x05
61 struct rte_ecpri_common_hdr {
63 rte_be32_t u32; /**< 4B common header in BE */
65 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
66 uint32_t size:16; /**< Payload Size */
67 uint32_t type:8; /**< Message Type */
68 uint32_t c:1; /**< Concatenation Indicator */
69 uint32_t res:3; /**< Reserved */
70 uint32_t revision:4; /**< Protocol Revision */
71 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
72 uint32_t revision:4; /**< Protocol Revision */
73 uint32_t res:3; /**< Reserved */
74 uint32_t c:1; /**< Concatenation Indicator */
75 uint32_t type:8; /**< Message Type */
76 uint32_t size:16; /**< Payload Size */
83 * eCPRI Message Header of Type #0: IQ Data
85 struct rte_ecpri_msg_iq_data {
86 rte_be16_t pc_id; /**< Physical channel ID */
87 rte_be16_t seq_id; /**< Sequence ID */
91 * eCPRI Message Header of Type #1: Bit Sequence
93 struct rte_ecpri_msg_bit_seq {
94 rte_be16_t pc_id; /**< Physical channel ID */
95 rte_be16_t seq_id; /**< Sequence ID */
99 * eCPRI Message Header of Type #2: Real-Time Control Data
101 struct rte_ecpri_msg_rtc_ctrl {
102 rte_be16_t rtc_id; /**< Real-Time Control Data ID */
103 rte_be16_t seq_id; /**< Sequence ID */
107 * eCPRI Message Header of Type #3: Generic Data Transfer
109 struct rte_ecpri_msg_gen_data {
110 rte_be32_t pc_id; /**< Physical channel ID */
111 rte_be32_t seq_id; /**< Sequence ID */
115 * eCPRI Message Header of Type #4: Remote Memory Access
118 struct rte_ecpri_msg_rm_access {
119 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
120 uint32_t ele_id:16; /**< Element ID */
121 uint32_t rr:4; /**< Req/Resp */
122 uint32_t rw:4; /**< Read/Write */
123 uint32_t rma_id:8; /**< Remote Memory Access ID */
124 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
125 uint32_t rma_id:8; /**< Remote Memory Access ID */
126 uint32_t rw:4; /**< Read/Write */
127 uint32_t rr:4; /**< Req/Resp */
128 uint32_t ele_id:16; /**< Element ID */
130 uint8_t addr[6]; /**< 48-bits address */
131 rte_be16_t length; /**< number of bytes */
135 * eCPRI Message Header of Type #5: One-Way Delay Measurement
137 struct rte_ecpri_msg_delay_measure {
138 uint8_t msr_id; /**< Measurement ID */
139 uint8_t act_type; /**< Action Type */
143 * eCPRI Message Header of Type #6: Remote Reset
145 struct rte_ecpri_msg_remote_reset {
146 rte_be16_t rst_id; /**< Reset ID */
147 uint8_t rst_op; /**< Reset Code Op */
151 * eCPRI Message Header of Type #7: Event Indication
153 struct rte_ecpri_msg_event_ind {
154 uint8_t evt_id; /**< Event ID */
155 uint8_t evt_type; /**< Event Type */
156 uint8_t seq; /**< Sequence Number */
157 uint8_t number; /**< Number of Faults/Notif */
161 * eCPRI Combined Message Header Format: Common Header + Message Types
164 struct rte_ecpri_combined_msg_hdr {
165 struct rte_ecpri_common_hdr common;
167 struct rte_ecpri_msg_iq_data type0;
168 struct rte_ecpri_msg_bit_seq type1;
169 struct rte_ecpri_msg_rtc_ctrl type2;
170 struct rte_ecpri_msg_bit_seq type3;
171 struct rte_ecpri_msg_rm_access type4;
172 struct rte_ecpri_msg_delay_measure type5;
173 struct rte_ecpri_msg_remote_reset type6;
174 struct rte_ecpri_msg_event_ind type7;
183 #endif /* _RTE_ECPRI_H_ */