29 #include <arpa/inet.h> 40 #include "../src/xran_printf.h" 49 struct rte_mbuf *mbuf,
67 struct rte_mbuf *mbuf,
84 struct rte_mbuf *mbuf,
101 struct rte_mbuf *mbuf,
147 static int symbol_total_bytes = 0;
153 uint8_t frame_id = 0;
154 uint8_t subframe_id = 0;
164 uint8_t compMeth = 0;
167 void *pHandle = NULL;
170 uint32_t mb_free = 0;
171 int32_t valid_res = 0;
196 print_err(
"num_bytes is wrong [%d]\n", num_bytes);
218 print_err(
"valid_res is wrong [%d] ant %u (%u : %u : %u : %u) seq %u num_bytes %d\n", valid_res, Ant_ID, frame_id, subframe_id, slot_id, symb_id, seq.
seq_id, num_bytes);
225 symbol_total_bytes += num_bytes;
227 if (seq.
e_bit == 1) {
228 print_dbg(
"Completed receiving symbol %d, size=%d bytes\n",
229 symb_id, symbol_total_bytes);
231 if (symbol_total_bytes) {
249 if(res == symbol_total_bytes) {
252 print_err(
"res != symbol_total_bytes\n");
255 symbol_total_bytes = 0;
258 print_dbg(
"Transport layer fragmentation (eCPRI) is not supported\n");
264 symbol_total_bytes += num_bytes;
265 if (seq.
e_bit == 1) {
266 print_dbg(
"Completed receiving PRACH symbol %d, size=%d bytes\n",
269 if (symbol_total_bytes) {
286 if(res == symbol_total_bytes) {
289 print_err(
"res != symbol_total_bytes\n");
292 symbol_total_bytes = 0;
294 print_dbg(
"Transport layer fragmentation (eCPRI) is not supported\n");
298 symbol_total_bytes += num_bytes;
300 if (seq.
e_bit == 1) {
301 print_dbg(
"Completed receiving symbol %d, size=%d bytes\n",
302 symb_id, symbol_total_bytes);
304 if (symbol_total_bytes) {
321 if(res == symbol_total_bytes) {
324 print_err(
"res != symbol_total_bytes\n");
327 symbol_total_bytes = 0;
329 print_dbg(
"Transport layer fragmentation (eCPRI) is not supported\n");
368 n_bytes = ((iqWidth == 0) || (iqWidth == 16)) ? n_bytes : ((3 * iqWidth + 1 ) * prb_num);
372 int16_t nPktSize =
sizeof(
struct ether_hdr) + sizeof(struct xran_ecpri_hdr) +
373 sizeof(struct radio_app_common_hdr)+ sizeof(struct data_section_hdr) + n_bytes;
410 errx(1,
"out of mbufs after %d packets", 1);
423 errx(1,
"failed preparing symbol");
425 rte_pktmbuf_pkt_len(mb) = nPktSize;
426 rte_pktmbuf_data_len(mb) = nPktSize;
429 printf(
"Symbol %2d prep_bytes (%d packets, %d bytes)\n", symbol_no, i, n_bytes);
451 uint32_t do_copy = 0;
460 errx(1,
"out of mbufs after %d packets", 1);
465 errx(1,
"incorrect mbuf size %d packets", 1);
467 pChar = rte_pktmbuf_prepend(mb,
sizeof(
struct ether_hdr));
470 errx(1,
"incorrect mbuf size %d packets", 1);
474 rte_pktmbuf_refcnt_update(mb, 1);
504 printf(
"Symbol %2d sent (%d packets, %d bytes)\n", symbol_no, i, n_bytes);
513 int ret = 0, nsection, i;
517 uint8_t dir = params->
dir;
523 struct ether_hdr *
const h = (
void *)rte_pktmbuf_prepend(mbuf,
sizeof(*h));
527 for(i=0; i<nsection; i++)
530 §_geninfo[i].info);
536 enum xran_pkt_dir dir, uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id,
537 uint8_t startsym, uint8_t numsym, uint16_t prb_start, uint16_t prb_num,int16_t iq_buffer_offset, int16_t iq_buffer_len,
538 uint16_t beam_id, uint8_t cc_id, uint8_t ru_port_id, uint8_t comp_method, uint8_t iqWidth, uint8_t seq_id, uint8_t
symInc)
540 int ret = 0, nsection, i, loc_sym;
572 sect_geninfo[nsection].
info.
ef = 0;
580 if(unlikely(mbuf == NULL)) {
587 print_err(
"Fail to build control plane packet - [%d:%d:%d] dir=%d\n",
588 frame_id, subframe_id, slot_id, dir);
589 rte_pktmbuf_free(mbuf);
596 uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id,
597 uint16_t beam_id, uint8_t cc_id, uint8_t prach_port_id, uint8_t seq_id)
599 int i, nsection, ret;
604 if(unlikely(mbuf == NULL)) {
609 printf(
"%d:%d:%d:%d - filter=%d, startSym=%d[%d:%d], numSym=%d, occasions=%d, freqOff=%d\n",
610 frame_id, subframe_id, slot_id, prach_port_id,
620 timeOffset = timeOffset >> nNumerology;
623 timeOffset += (pPrachCPConfig->
startSymId * 2048) >> nNumerology;
659 sect_geninfo[nsection].
info.
ef = 0;
669 print_err(
"Fail to build prach control packet - [%d:%d:%d]\n", frame_id, subframe_id, slot_id);
670 rte_pktmbuf_free(mbuf);
684 const uint16_t dequeued = rte_ring_dequeue_burst(r, (
void **)mbufs,
685 RTE_DIM(mbufs), &remaining);
691 for (i = 0; i < dequeued; ++i) {
693 rte_pktmbuf_free(mbufs[i]);
744 struct sched_param sched_param;
747 printf(
"%s [CPU %2d] [PID: %6d]\n", __FUNCTION__, rte_lcore_id(), getpid());
749 if ((res = pthread_setschedparam(pthread_self(), SCHED_FIFO, &sched_param))){
750 printf(
"priority is not changed: coreId = %d, result1 = %d\n",rte_lcore_id(), res);
757 puts(
"Pkt processing thread finished.");
int xran_cp_add_section_info(void *pHandle, uint8_t dir, uint8_t cc_id, uint8_t ruport_id, uint8_t ctx_id, struct xran_section_info *info)
Add a section information of C-Plane to dabase.
int generate_cpmsg_prach(void *pHandle, struct xran_cp_gen_params *params, struct xran_section_gen_info *sect_geninfo, struct rte_mbuf *mbuf, struct xran_device_ctx *pxran_lib_ctx, uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id, uint16_t beam_id, uint8_t cc_id, uint8_t prach_port_id, uint8_t seq_id)
#define MAX_N_FULLBAND_SC
uint16_t xran_alloc_sectionid(void *pHandle, uint8_t dir, uint8_t cc_id, uint8_t ant_id, uint8_t slot_id)
uint8_t xran_get_conf_fftsize(void *pHandle)
Get the configuration of FFT size for RU.
struct rte_mbuf * xran_ethdi_mbuf_alloc(void)
uint8_t xran_get_num_eAxc(void *pHandle)
Get the configuration of the number of antenna for UL.
int prach_last_symbol[XRAN_MAX_SECTOR_NR]
struct xran_srs_config srs_cfg
#define print_dbg(fmt, args...)
struct radio_app_common_hdr app_params
enum xran_if_state xran_if_current_state
int32_t ring_processing_func(void)
struct cb_elem_entry * xran_create_cb(XranSymCallbackFn cb_fn, void *cb_data)
xran_ethdi_mbuf_send_fn send_upmbuf2ring
int xran_process_prach_sym(void *arg, struct rte_mbuf *mbuf, void *iq_data_start, uint16_t size, uint8_t CC_ID, uint8_t Ant_ID, uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id, uint8_t symb_id, uint16_t num_prbu, uint16_t start_prbu, uint16_t sym_inc, uint16_t rb, uint16_t sect_id, uint32_t *mb_free)
int xran_process_rx_sym(void *arg, struct rte_mbuf *mbuf, void *iq_data_start, uint16_t size, uint8_t CC_ID, uint8_t Ant_ID, uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id, uint8_t symb_id, uint16_t num_prbu, uint16_t start_prbu, uint16_t sym_inc, uint16_t rb, uint16_t sect_id, uint32_t *mb_free)
union radio_app_common_hdr::@5 sf_slot_sym
struct xran_section_info info
xran_ethdi_mbuf_send_fn send_cpmbuf2ring
struct compression_hdr ud_comp_hdr
int send_cpmsg(void *pHandle, struct rte_mbuf *mbuf, struct xran_cp_gen_params *params, struct xran_section_gen_info *sect_geninfo, uint8_t cc_id, uint8_t ru_port_id, uint8_t seq_id)
int xran_ethdi_filter_packet(struct rte_mbuf *pkt, uint64_t rx_time)
#define XRAN_MAX_SECTIONDB_CTX
uint8_t xran_get_conf_prach_scs(void *pHandle)
Get the configuration of subcarrier spacing for PRACH.
struct xran_fh_config fh_cfg
int32_t prepare_symbol_ex(enum xran_pkt_dir direction, uint16_t section_id, struct rte_mbuf *mb, struct rb_map *data, uint8_t compMeth, uint8_t iqWidth, const enum xran_input_byte_order iq_buf_byte_order, uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id, uint8_t symbol_no, int prb_start, int prb_num, uint8_t CC_ID, uint8_t RU_Port_ID, uint8_t seq_id, uint32_t do_copy)
uint8_t occassionsInPrachSlot
struct rte_ring * rx_ring[ETHDI_VF_MAX]
int32_t xran_pkt_validate(void *arg, struct rte_mbuf *mbuf, void *iq_data_start, uint16_t size, uint8_t CC_ID, uint8_t Ant_ID, uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id, uint8_t symb_id, struct ecpri_seq_id *seq_id, uint16_t num_prbu, uint16_t start_prbu, uint16_t sym_inc, uint16_t rb, uint16_t sect_id)
int xran_destroy_cb(struct cb_elem_entry *cb_elm)
#define print_err(fmt, args...)
struct xran_frame_config frame_conf
struct xran_device_ctx * xran_dev_get_ctx(void)
phy_decoder_poll_fn bbdev_dec
#define PID_PROCESS_UP_PKT
int ring_processing_thread(void *args)
struct xran_cp_header_params hdr
void(* XranSymCallbackFn)(struct rte_timer *tim, void *arg)
struct data_section_hdr sec_hdr
This file has all definitions for the Ethernet Data Interface Layer.
This file provides the definitions for User Plane Messages APIs.
uint8_t xran_get_conf_compmethod(void *pHandle)
Get the configuration of compression method for RU.
int generate_cpmsg_dlul(void *pHandle, struct xran_cp_gen_params *params, struct xran_section_gen_info *sect_geninfo, struct rte_mbuf *mbuf, enum xran_pkt_dir dir, uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id, uint8_t startsym, uint8_t numsym, uint16_t prb_start, uint16_t prb_num, int16_t iq_buffer_offset, int16_t iq_buffer_len, uint16_t beam_id, uint8_t cc_id, uint8_t ru_port_id, uint8_t comp_method, uint8_t iqWidth, uint8_t seq_id, uint8_t symInc)
XRAN layer common functionality for both lls-CU and RU as well as C-plane and U-plane.
struct xran_ru_config ru_conf
#define XRAN_MAX_MBUF_LEN
int32_t xran_process_srs_sym(void *arg, struct rte_mbuf *mbuf, void *iq_data_start, uint16_t size, uint8_t CC_ID, uint8_t Ant_ID, uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id, uint8_t symb_id, uint16_t num_prbu, uint16_t start_prbu, uint16_t sym_inc, uint16_t rb, uint16_t sect_id, uint32_t *mb_free)
struct xran_fh_init fh_init
#define XRAN_NUM_OF_SYMBOL_PER_SLOT
int xran_prepare_ctrl_pkt(struct rte_mbuf *mbuf, struct xran_cp_gen_params *params, uint8_t CC_ID, uint8_t Ant_ID, uint8_t seq_id)
Create a C-Plane packet Transport layer fragmentation is not supported.
Definitions and support functions to process XRAN packet.
uint8_t xran_get_conf_iqwidth(void *pHandle)
Get the configuration of IQ bit width for RU.
Definitions and support functions to process XRAN packet.
#define SLOTNUM_PER_SUBFRAME
struct xran_prach_cp_config PrachCPConfig
struct xran_section_desc sec_desc[XRAN_NUM_OF_SYMBOL_PER_SLOT]
XranSymCallbackFn pSymCallback
#define PID_XRAN_BBDEV_UL_POLL
struct xran_section_gen_info * sections
#define MLogTask(w, x, y)
#define PID_XRAN_BBDEV_DL_POLL
int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, void **iq_data_start, uint8_t *CC_ID, uint8_t *Ant_ID, uint8_t *frame_id, uint8_t *subframe_id, uint8_t *slot_id, uint8_t *symb_id, struct ecpri_seq_id *seq_id, uint16_t *num_prbu, uint16_t *start_prbu, uint16_t *sym_inc, uint16_t *rb, uint16_t *sect_id, int8_t expect_comp, uint8_t *compMeth, uint8_t *iqWidth)
Function extracts IQ samples from received mbuf packet.
int process_ring(struct rte_ring *r)
union data_section_hdr::@18 fields
int process_mbuf(struct rte_mbuf *pkt)
#define XRAN_THREAD_DEFAULT_PRIO
int xran_prepare_iq_symbol_portion(struct rte_mbuf *mbuf, const void *iq_data_start, const enum xran_input_byte_order iq_buf_byte_order, const uint32_t iq_data_num_bytes, struct xran_up_pkt_gen_params *params, uint8_t CC_ID, uint8_t Ant_ID, uint8_t seq_id, uint32_t do_copy)
Function for starting preparion of IQ samples portions to be sent in xRAN packet. ...
struct data_section_compression_hdr compr_hdr_param
int send_symbol_ex(enum xran_pkt_dir direction, uint16_t section_id, struct rte_mbuf *mb, struct rb_map *data, const enum xran_input_byte_order iq_buf_byte_order, uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id, uint8_t symbol_no, int prb_start, int prb_num, uint8_t CC_ID, uint8_t RU_Port_ID, uint8_t seq_id)
phy_encoder_poll_fn bbdev_enc