1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /*Reference: SCF225_5G_NFAPI_SPECIFICATION, v225.2.1, Issue Date: 23 Nov 2021*/
21 #ifndef _NFAPI_INTERFACE_H
22 #define _NFAPI_INTERFACE_H
24 #include "fapi_interface.h"
25 /*Table 2-7 Dedicated NFAPI message IDs*/
28 #define NFAPI_PNF_PARAM_REQ 0x0100
29 #define NFAPI_PNF_PARAM_RESP 0x0101
30 #define NFAPI_PNF_CONFIG_REQ 0x0102
31 #define NFAPI_PNF_CONFIG_RESP 0x0103
32 #define NFAPI_PNF_START_REQ 0x0104
33 #define NFAPI_PNF_START_RESP 0x0105
34 #define NFAPI_PNF_STOP_REQ 0x0106
35 #define NFAPI_PNF_STOP_RESP 0x0107
36 #define NFAPI_START_RESPONSE 0x0108
37 #define NFAPI_PNF_READY_IND 0x0109
39 /*Reserved for P5 Dedicated NFAPI Messages 0x010A - 0x017F */
42 #define NFAPI_DL_NODE_SYNC 0x0180
43 #define NFAPI_UL_NODE_SYNC 0x0181
44 #define NFAPI_TIMING_INFO 0x0182
46 /*Reserved for P7 Dedicated NFAPI Messages 0x0183 - 0x01ff*/
47 /*RESERVED for Vendor Extension messages 0x0300 - 0x03ff*/
49 /*Table 3-16 nFAPI TLVs included in PARAM.response and
50 *Table 3-19 nFAPI TLVs included in CONFIG.request*/
51 //PNF and VNF Parameters
52 #define NFAPI_P7_VNF_ADD_IPV4 0x0100
53 #define NFAPI_P7_VNF_ADD_IPV6 0x0101
54 #define NFAPI_P7_VNF_PORT 0x0102
55 #define NFAPI_P7_PNF_ADD_IPV4 0x0103
56 #define NFAPI_P7_PNF_ADD_IPV6 0x0104
57 #define NFAPI_P7_PNF_PORT 0x0105
58 //TTI Related Parameters
59 #define NFAPI_DL_TTI_TIMING_OFFSET 0x0106
60 #define NFAPI_UL_TTI_TIMING_OFFSET 0x0107
61 #define NFAPI_UL_DCI_TIMING_OFFSET 0x0108
62 #define NFAPI_TX_DATA_TIMING_OFFSET 0x0109
63 //Timing Related Parameters
64 #define NFAPI_TIMING_WINDOW 0x011E
65 #define NFAPI_TIMING_INFO_MODE 0x011F
66 #define NFAPI_TIMING_INFO_PERIOD 0x0120
67 //P7 Transport Related Parameters
68 #define NFAPI_P7_IP_FRAGMENTATION_ALLOWED 0x0121
69 #define NFAPI_P7_TRANSPORT 0x0122
70 #define NFAPI_P7_PNF_ETHERNET_ADD 0x0123
71 #define NFAPI_P7_VNF_ETHERNET_ADD 0x0124
72 //CPRI Related Parameters
73 #define NFAPI_ECPRI_MSG_TYPE 0x0125
74 #define NFAPI_ECPRI_PHY_TRANSPORT_ID 0x0126
76 #define NFAPI_5G_FAPI_MSG_BODY 0x0F00
79 #define NFAPI_PNF_PARAM_GENERAL 0x1000
81 /*As per Table 3-15 and Table 3-17*/
82 #define MAX_NUM_TLV_IN_PARAM_RESP 19
84 #define MAX_NUM_TLV_IN_CONFIG_REQ 9
92 /*Table 3-4 and Table 3-7*/
95 NFAPI_MSG_INVALID_STATE,
96 NFAPI_MSG_INVALID_CONFIG
99 /*Table 3-21: "Timing info mode"*/
101 NFAPI_TIMING_INFO_MODE_DISABLE = 0,
102 NFAPI_TIMING_INFO_MODE_PERIODIC,
103 NFAPI_TIMING_INFO_MODE_APERIODIC,
104 NFAPI_TIMING_INFO_MODE_PERIODIC_APERIODIC
105 }nFapi_timing_info_mode;
109 typedef struct nFapi_p5_hdr_t{
110 uint16_t seg_len; /*Segment Length*/
111 uint8_t more_segNum; /*Combination of MORE(1 bit = MSB) and SEGMENT NUMBER(7 bits)*/
112 uint8_t seq_num; /*Sequence Number*/
113 uint32_t timeStamp; /*Transit TimeStamp*/
117 typedef struct nFapi_p7_hdr_t{
118 uint16_t seq_num; /*Sequence Number*/
119 uint16_t pad; /*Padding for Byte alignment*/
120 uint32_t tot_SDU_len; /*Total SDU length*/
121 uint32_t byteOffset; /*Byte Offset: Offset specifying the start of a segment*/
122 uint32_t timeStamp; /*Transit TimeStamp*/
126 typedef struct nFapi_msg_header_t{
127 uint8_t sRU_termination_type; /*RU termination Type: 0x01 = P5/P7 msgs*/
128 uint8_t phy_id; /*PHY instance: [1..ā€¯Maximum Number Of PHYs]*/
129 uint16_t msg_id; /*msg ID of FAPI or NFAPI msg*/
130 uint32_t length; /*len of msg body in octets excluding msg hdr.*/
139 //Section 2.1.1 P5 PNF Procedures
141 typedef struct nFapi_pnf_ready_ind_t{
142 nFapi_p5_hdr nFapiP5Hdr;
143 nFapi_msg_header nFapiMsghdr;
144 uint32_t versionInfo;
145 }nFapi_pnf_ready_ind;
147 typedef struct nFapi_pnf_param_req_t{
148 nFapi_p5_hdr nFapiP5Hdr;
149 nFapi_msg_header nFapiMsghdr;
150 }nFapi_pnf_param_req;
153 typedef struct nFapi_pnf_param_general_t{
154 uint8_t nFapi_sync_mode;
156 uint8_t *loc_coordinates; /*Spec 38.455, 'NG-RANAccessPointPosition'*/
157 uint16_t max_num_phy;
159 uint16_t numRfInstances;
160 uint16_t numDfeInstances;
161 }nFapi_pnf_param_general;
164 typedef struct nFapi_pnf_param_resp_t{
165 nFapi_p5_hdr nFapiP5Hdr;
166 nFapi_msg_header nFapiMsghdr;
167 nFapi_error_code errCode;
169 nFapi_tlv tlvs[1]; /*As per Spec only 1 TLV is defined (nFapi_pnf_param_general)*/
170 }nFapi_pnf_param_resp;
173 typedef struct nFapi_pnf_config_req_t{
174 nFapi_p5_hdr nFapiP5Hdr;
175 nFapi_msg_header nFapiMsghdr;
177 }nFapi_pnf_config_req;
180 typedef struct nFapi_pnf_config_resp_t{
181 nFapi_p5_hdr nFapiP5Hdr;
182 nFapi_msg_header nFapiMsghdr;
183 nFapi_error_code errCode;
184 }nFapi_pnf_config_resp;
186 typedef struct nFapi_pnf_start_req_t{
187 nFapi_p5_hdr nFapiP5Hdr;
188 nFapi_msg_header nFapiMsghdr;
189 }nFapi_pnf_start_req;
192 typedef struct nFapi_pnf_start_resp_t{
193 nFapi_p5_hdr nFapiP5Hdr;
194 nFapi_msg_header nFapiMsghdr;
195 nFapi_error_code errCode;
196 }nFapi_pnf_start_resp;
198 typedef struct nFapi_pnf_stop_req_t{
199 nFapi_p5_hdr nFapiP5Hdr;
200 nFapi_msg_header nFapiMsghdr;
204 typedef struct nFapi_pnf_stop_resp_t{
205 nFapi_p5_hdr nFapiP5Hdr;
206 nFapi_msg_header nFapiMsghdr;
207 nFapi_error_code errCode;
208 }nFapi_pnf_stop_resp;
210 //Section 2.1.2 P5 PHY Procedures
211 typedef struct nFapi_param_req_t{
212 nFapi_p5_hdr nFapiP5Hdr;
213 nFapi_msg_header nFapiMsghdr;
214 uint8_t *fapiMsgBody; /*SCF222 v222.10.03, Table 3-5*/
218 typedef struct nFapi_param_resp_t{
219 nFapi_p5_hdr nFapiP5Hdr;
220 nFapi_msg_header nFapiMsghdr;
221 nFapi_error_code errCode;
223 nFapi_tlv tlvs[MAX_NUM_TLV_IN_PARAM_RESP];
227 typedef struct nFapi_config_req_t{
228 nFapi_p5_hdr nFapiP5Hdr;
229 nFapi_msg_header nFapiMsghdr;
231 nFapi_tlv tlvs[MAX_NUM_TLV_IN_CONFIG_REQ];
234 typedef struct nFapi_config_resp_t{
235 nFapi_p5_hdr nFapiP5Hdr;
236 nFapi_msg_header nFapiMsghdr;
237 uint8_t *fapiMsgBody; /*SCF222 v222.10.03, Table 3-27*/
240 typedef struct nFapi_start_req_t{
241 nFapi_p5_hdr nFapiP5Hdr;
242 nFapi_msg_header nFapiMsghdr;
243 uint8_t *fapiMsgBody; /*SCF222 v222.10.03, Sec 3.3.4.1*/
247 typedef struct nFapi_start_resp_t{
248 nFapi_p5_hdr nFapiP5Hdr;
249 nFapi_msg_header nFapiMsghdr;
250 nFapi_error_code errCode;
253 typedef struct nFapi_error_ind_t{
254 nFapi_p5_hdr nFapiP5Hdr;
255 nFapi_msg_header nFapiMsghdr;
256 uint8_t *fapiMsgBody; /*SCF222 v222.10.03, Sec 3.3.6.1*/
259 typedef struct nFapi_stop_req_t{
260 nFapi_p5_hdr nFapiP5Hdr;
261 nFapi_msg_header nFapiMsghdr;
262 uint8_t *fapiMsgBody; /*SCF222 v222.10.03, Sec 3.3.5.1*/
265 typedef struct nFapi_stop_ind_t{
266 nFapi_p5_hdr nFapiP5Hdr;
267 nFapi_msg_header nFapiMsghdr;
268 uint8_t *fapiMsgBody; /*SCF222 v222.10.03, Sec 3.3.5.2*/
273 typedef struct nFapi_dl_node_sync_info_t{
274 uint32_t t1; /*In micro-sec, timeDiff between [VNF's SFN 0/0] and [DL NodeSYnc Tx time]*/
275 int32_t delta_sfnSlot;
277 }nFapi_dl_node_sync_info;
279 typedef struct nFapi_dl_node_sync_t{
280 nFapi_p7_hdr nFapiP7Hdr;
281 nFapi_msg_header nFapiMsghdr;
282 nFapi_dl_node_sync_info dlNodeSyncInfo;
286 typedef struct nFapi_ul_node_sync_info_t{
287 uint32_t t1; /*In micro-sec, timeDiff between [VNF's SFN 0/0] and [DL NodeSYnc Tx time]*/
288 uint32_t t2; /*In micro-sec, timeDiff between [PNF's SFN 0/0] and [DL NodeSYnc Rx time]*/
289 uint32_t t3; /*In micro-sec, timeDiff between [PNF's SFN 0/0] and [UL NodeSYnc Tx time]*/
290 }nFapi_ul_node_sync_info;
292 typedef struct nFapi_ul_node_sync_t{
293 nFapi_p7_hdr nFapiP7Hdr;
294 nFapi_msg_header nFapiMsghdr;
295 nFapi_ul_node_sync_info ulNodeSyncInfo;
299 typedef struct nFapi_timing_parameter_t{
302 uint32_t time_elapsed; /*In ms, Time since the last timing Info*/
303 uint32_t dl_tti_jitter; /*Units: micro-sec(ms)*/
304 uint32_t tx_data_jitter; /*Units: ms*/
305 uint32_t ul_tti_jitter; /*Units: ms*/
306 uint32_t ul_dci_jitter; /*Units: ms*/
307 int32_t dl_tti_latest_delay; /*Units: ms*/
308 int32_t tx_data_latest_delay;
309 int32_t ul_tti_latest_delay; /*Units: ms*/
310 int32_t ul_dci_latest_delay; /*Units: ms*/
311 int32_t dl_tti_early_arr; /*Units: ms*/
312 int32_t tx_data_early_arr; /*Units: ms*/
313 int32_t ul_tti_early_arr; /*Units: ms*/
314 int32_t ul_dci_early_arr; /*Units: ms*/
315 uint8_t subCarrierSpacing;
316 }nFapi_timing_parameter;
318 typedef struct nFapi_timing_info_t{
319 nFapi_p7_hdr nFapiP7Hdr;
320 nFapi_msg_header nFapiMsghdr;
321 nFapi_timing_parameter timingParam;
324 /*SCF222 v222.10.03, Table 3-54*/
325 typedef struct fapi_dl_tti_req_msg_body_t{
331 fapi_dl_tti_req_pdu_t pdus[FAPI_MAX_PDUS_PER_SLOT]; // 5G FAPI Table 3-35
332 fapi_ue_info_t ue_grp_info[FAPI_MAX_NUMBER_OF_GROUPS_PER_TTI];
333 }fapi_dl_tti_req_msg_body;
335 typedef struct nFapi_dl_tti_req_t{
336 nFapi_p7_hdr nFapiP7Hdr;
337 nFapi_msg_header nFapiMsghdr;
338 fapi_dl_tti_req_msg_body fapiMsgBody;
341 typedef struct nFapi_dl_tti_resp_t{
342 nFapi_p7_hdr nFapiP7Hdr;
343 nFapi_msg_header nFapiMsghdr;
344 uint8_t *fapiMsgBody; /*TODO: In fapi_interface.h, dl_tti_resp not present*/
347 typedef struct fapi_ul_tti_req_msg_body_t{
356 fapi_ul_tti_req_pdu_t pdus[FAPI_MAX_NUMBER_UL_PDUS_PER_TTI]; // 5G FAPI Table 3-44
357 fapi_ue_info_t ueGrpInfo[FAPI_MAX_NUMBER_OF_GROUPS_PER_TTI];
358 }fapi_ul_tti_req_msg_body;
360 typedef struct nFapi_ul_tti_req_t{
361 nFapi_p7_hdr nFapiP7Hdr;
362 nFapi_msg_header nFapiMsghdr;
363 fapi_ul_tti_req_msg_body fapiMsgBody;
366 typedef struct fapi_ul_dci_req_msg_body_t{
371 fapi_dci_pdu_t pdus[FAPI_MAX_NUMBER_UCI_PDUS_PER_SLOT]; // 5G FAPI Table 3-54
372 }fapi_ul_dci_req_msg_body;
374 typedef struct nFapi_ul_dci_req_t{
375 nFapi_p7_hdr nFapiP7Hdr;
376 nFapi_msg_header nFapiMsghdr;
377 fapi_ul_dci_req_msg_body fapiMsgBody;
380 typedef struct fapi_tx_data_req_msg_body_t{
385 fapi_tx_pdu_desc_t pdu_desc[FAPI_MAX_NUMBER_DL_PDUS_PER_TTI]; // 5G FAPI Table 3-58
386 }fapi_tx_data_req_msg_body;
388 typedef struct nFapi_tx_data_req_t{
389 nFapi_p7_hdr nFapiP7Hdr;
390 nFapi_msg_header nFapiMsghdr;
391 fapi_tx_data_req_msg_body fapiMsgBody;
394 typedef struct fapi_rx_data_ind_msg_body_t{
399 fapi_pdu_ind_info_t pdus[FAPI_MAX_NUMBER_OF_ULSCH_PDUS_PER_SLOT]; // 5G FAPI Table 3-61
400 }fapi_rx_data_ind_msg_body;
402 typedef struct nFapi_rx_data_ind_t{
403 nFapi_p7_hdr nFapiP7Hdr;
404 nFapi_msg_header nFapiMsghdr;
405 fapi_rx_data_ind_msg_body fapiMsgBody;
408 typedef struct fapi_crc_ind_msg_body_t{
413 fapi_crc_ind_info_t crc[FAPI_MAX_NUMBER_OF_CRCS_PER_SLOT]; // 5G FAPI Table 3-62
414 }fapi_crc_ind_msg_body;
416 typedef struct nFapi_crc_ind_t{
417 nFapi_p7_hdr nFapiP7Hdr;
418 nFapi_msg_header nFapiMsghdr;
419 fapi_crc_ind_msg_body fapiMsgBody;
422 typedef struct fapi_uci_ind_msg_body_t{
425 uint16_t numUcis; // 5G FAPI Table 3-63
427 fapi_uci_pdu_info_t uciPdu[FAPI_MAX_NUMBER_UCI_PDUS_PER_SLOT];
428 }fapi_uci_ind_msg_body;
430 typedef struct nFapi_uci_ind_t{
431 nFapi_p7_hdr nFapiP7Hdr;
432 nFapi_msg_header nFapiMsghdr;
433 fapi_uci_ind_msg_body fapiMsgBody;
436 typedef struct fapi_srs_ind_msg_body_t{
441 fapi_srs_pdu_t srsPdus[FAPI_MAX_NUMBER_SRS_PDUS_PER_SLOT]; // 5G FAPI Table 3-73
442 }fapi_srs_ind_msg_body;
444 typedef struct nFapi_srs_ind_t{
445 nFapi_p7_hdr nFapiP7Hdr;
446 nFapi_msg_header nFapiMsghdr;
447 fapi_srs_ind_msg_body fapiMsgBody;
450 typedef struct fapi_rach_ind_msg_body_t{
455 fapi_rach_pdu_t rachPdu[FAPI_MAX_NUMBER_RACH_PDUS_PER_SLOT]; // 5G FAPI Table 3-74
456 }fapi_rach_ind_msg_body;
458 typedef struct nFapi_rach_ind_t{
459 nFapi_p7_hdr nFapiP7Hdr;
460 nFapi_msg_header nFapiMsghdr;
461 fapi_rach_ind_msg_body fapiMsgBody;