a9b971916e1df63bd3392313af399b47c99a9e1f
[o-du/phy.git] / fhi_lib / lib / api / xran_transport.h
1 /******************************************************************************\r
2 *\r
3 *   Copyright (c) 2019 Intel.\r
4 *\r
5 *   Licensed under the Apache License, Version 2.0 (the "License");\r
6 *   you may not use this file except in compliance with the License.\r
7 *   You may obtain a copy of the License at\r
8 *\r
9 *       http://www.apache.org/licenses/LICENSE-2.0\r
10 *\r
11 *   Unless required by applicable law or agreed to in writing, software\r
12 *   distributed under the License is distributed on an "AS IS" BASIS,\r
13 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14 *   See the License for the specific language governing permissions and\r
15 *   limitations under the License.\r
16 *\r
17 *******************************************************************************/\r
18 \r
19 /**\r
20  * @brief This file provides the definitions for Transport layer (eCPRI) API.\r
21  *\r
22  * @file xran_transport.h\r
23  * @ingroup group_lte_source_xran\r
24  * @author Intel Corporation\r
25  *\r
26  **/\r
27 \r
28 #ifndef _XRAN_TRANSPORT_H_\r
29 #define _XRAN_TRANSPORT_H_\r
30 \r
31 #ifdef __cplusplus\r
32 extern "C" {\r
33 #endif\r
34 \r
35 #include <rte_common.h>\r
36 #include <rte_mbuf.h>\r
37 \r
38 #include "xran_pkt.h"\r
39 \r
40 struct xran_eaxc_info {\r
41     uint8_t cuPortId;\r
42     uint8_t bandSectorId;\r
43     uint8_t ccId;\r
44     uint8_t ruPortId;\r
45 };\r
46 \r
47 struct xran_recv_packet_info {\r
48     int ecpri_version;\r
49     enum ecpri_msg_type msg_type;\r
50     int payload_len;\r
51     struct xran_eaxc_info eaxc;\r
52     int seq_id;\r
53     int subseq_id;\r
54     int ebit;\r
55 };\r
56 \r
57 \r
58 int xran_get_ecpri_hdr_size(void);\r
59 void xran_update_ecpri_payload_size(struct rte_mbuf *mbuf, int size);\r
60 \r
61 uint16_t xran_compose_cid(uint8_t CU_Port_ID, uint8_t BandSector_ID, uint8_t CC_ID, uint8_t Ant_ID);\r
62 void xran_decompose_cid(uint16_t cid, struct xran_eaxc_info *result);\r
63 \r
64 int xran_build_ecpri_hdr(struct rte_mbuf *mbuf,\r
65                         uint8_t CC_ID, uint8_t Ant_ID,\r
66                         uint8_t seq_id,\r
67                         struct xran_ecpri_hdr **ecpri_hdr);\r
68 \r
69 int xran_parse_ecpri_hdr(struct rte_mbuf *mbuf,\r
70                         struct xran_ecpri_hdr **ecpri_hdr,\r
71                         struct xran_recv_packet_info *pkt_info);\r
72 \r
73 #ifdef __cplusplus\r
74 }\r
75 #endif\r
76 \r
77 #endif\r
78 \r