- u32dptr = (uint32_t*)(ptr);
- rte_memcpy(u32dptr, pos, pXranConf->nDLRBs*N_SC_PER_PRB*4);
-#ifdef DEBUG_XRAN_BUFFERS
- uint8_t *ptr_temp = (uint8_t *)ptr;
- ptr_temp[0] = tti; // TTI
- ptr_temp[1] = cc_id; // Sec
- ptr_temp[2] = ant_id; // Ant
- ptr_temp[3] = sym_id; // sym
-#endif
+ int idxElm = 0;
+ u8dptr = (uint8_t*)ptr;
+ int16_t payload_len = 0;
+
+ uint8_t *dst = (uint8_t *)u8dptr;
+ uint8_t *src = (uint8_t *)pos;
+ struct xran_prb_elm* p_prbMapElm = &pRbMap->prbMap[idxElm];
+ dst = xran_add_hdr_offset(dst, p_prbMapElm->compMethod);
+ for (idxElm = 0; idxElm < pRbMap->nPrbElm; idxElm++) {
+ struct xran_section_desc *p_sec_desc = NULL;
+ p_prbMapElm = &pRbMap->prbMap[idxElm];
+ p_sec_desc = p_prbMapElm->p_sec_desc[sym_id];
+
+ if(p_sec_desc == NULL){
+ printf ("p_sec_desc == NULL\n");
+ exit(-1);
+ }
+ src = (uint8_t *)(pos + p_prbMapElm->nRBStart*N_SC_PER_PRB*4L);
+
+ if(p_prbMapElm->compMethod == XRAN_COMPMETHOD_NONE) {
+ payload_len = p_prbMapElm->nRBSize*N_SC_PER_PRB*4L;
+ rte_memcpy(dst, src, payload_len);
+
+ } else if (p_prbMapElm->compMethod == XRAN_COMPMETHOD_BLKFLOAT) {
+ struct xranlib_compress_request bfp_com_req;
+ struct xranlib_compress_response bfp_com_rsp;
+
+ memset(&bfp_com_req, 0, sizeof(struct xranlib_compress_request));
+ memset(&bfp_com_rsp, 0, sizeof(struct xranlib_compress_response));
+
+ bfp_com_req.data_in = (int16_t*)src;
+ bfp_com_req.numRBs = p_prbMapElm->nRBSize;
+ bfp_com_req.len = p_prbMapElm->nRBSize*N_SC_PER_PRB*4L;
+ bfp_com_req.compMethod = p_prbMapElm->compMethod;
+ bfp_com_req.iqWidth = p_prbMapElm->iqWidth;
+
+ bfp_com_rsp.data_out = (int8_t*)dst;
+ bfp_com_rsp.len = 0;
+
+ if(xranlib_compress_avx512(&bfp_com_req, &bfp_com_rsp) < 0){
+ printf ("compression failed [%d]\n",
+ p_prbMapElm->compMethod);
+ exit(-1);
+ } else {
+ payload_len = bfp_com_rsp.len;
+ }
+ }else {
+ printf ("p_prbMapElm->compMethod == %d is not supported\n",
+ p_prbMapElm->compMethod);
+ exit(-1);
+ }
+
+ /* update RB map for given element */
+ p_sec_desc->iq_buffer_offset = RTE_PTR_DIFF(dst, u8dptr);
+ p_sec_desc->iq_buffer_len = payload_len;
+
+ /* add headroom for ORAN headers between IQs for chunk of RBs*/
+ dst += payload_len;
+ dst = xran_add_hdr_offset(dst, p_prbMapElm->compMethod);
+ }