O-RAN E Maintenance Release contribution for ODULOW
[o-du/phy.git] / fhi_lib / test / test_xran / c_plane_tests.cc
index b9f7cf6..df6bd43 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-*   Copyright (c) 2019 Intel.
+*   Copyright (c) 2020 Intel.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 
 #include <stdint.h>
 
-#define DELETE_ARRAY(x)     { if(x) { delete[] x; x = nullptr; } }
+#define DELETE_ARRAY(x)         { if(x) { delete[] x; x = nullptr; } }
+
+#define XRAN_MAX_BUFLEN_EXT11   (MAX_RX_LEN -                                           \
+                                    (RTE_PKTMBUF_HEADROOM                               \
+                                     + sizeof(struct xran_ecpri_hdr)                    \
+                                     + sizeof(struct xran_cp_radioapp_common_header)    \
+                                     + sizeof(struct xran_cp_radioapp_section1)         \
+                                     + sizeof(union xran_cp_radioapp_section_ext6)     \
+                                     + sizeof(union xran_cp_radioapp_section_ext10)    \
+                                     ))
 
 const std::string module_name = "C-Plane";
 
@@ -38,13 +47,23 @@ extern "C"
 {
 
 /* wrapper function for performace tests to reset mbuf */
-int xran_ut_prepare_cp(struct rte_mbuf *mbuf, struct xran_cp_gen_params *params,
+int xran_ut_prepare_cp(struct xran_cp_gen_params *params,
                         uint8_t cc_id, uint8_t ant_id, uint8_t seq_id)
 {
-    rte_pktmbuf_reset(mbuf);
-    return(xran_prepare_ctrl_pkt(mbuf, params, cc_id, ant_id, seq_id));
-}
+    register int ret;
+    register struct rte_mbuf *mbuf;
 
+    mbuf = xran_ethdi_mbuf_alloc();
+    if(mbuf == NULL) {
+        printf("Failed to allocate buffer!\n");
+        return (-1);
+        }
+
+    ret = xran_prepare_ctrl_pkt(mbuf, params, cc_id, ant_id, seq_id);
+    rte_pktmbuf_free(mbuf);
+
+    return (ret);
+}
 
 void cput_fh_rx_callback(void *pCallbackTag, xran_status_t status)
 {
@@ -64,7 +83,7 @@ class C_plane: public KernelTests
 {
 private:
     struct xran_section_gen_info *m_pSectGenInfo = NULL;
-    struct xran_section_gen_info *m_pSectResult = NULL;
+    struct xran_section_recv_info *m_pSectResult = NULL;
 
     struct sectinfo {
         uint16_t    sectionId;
@@ -88,6 +107,12 @@ private:
             struct xran_sectionext3_info ext3;
             struct xran_sectionext4_info ext4;
             struct xran_sectionext5_info ext5;
+            struct xran_sectionext6_info ext6;
+            struct xran_sectionext7_info ext7;
+            struct xran_sectionext8_info ext8;
+            struct xran_sectionext9_info ext9;
+            struct xran_sectionext10_info ext10;
+            struct xran_sectionext11_info ext11;
             } u;
         };
 
@@ -95,11 +120,11 @@ protected:
     int m_maxSections = 8;  /*  not used */
     int m_numSections;
 
-    struct rte_mbuf *m_pTestBuffer;
+    struct rte_mbuf *m_pTestBuffer = nullptr;
 
     struct xran_cp_gen_params m_params;
     struct xran_recv_packet_info m_pktInfo;
-    struct xran_cp_gen_params m_result;
+    struct xran_cp_recv_params m_result;
 
     struct xran_sectionext1_info m_temp_ext1[XRAN_MAX_PRBS];
 
@@ -129,12 +154,19 @@ protected:
 
     struct xran_sectionext1_info m_ext1;
 
-    int16_t m_bfwIQ[XRAN_MAX_BFW_N*2];
-
+    int         m_antElmTRx;
+    struct rte_mbuf_ext_shared_info m_extSharedInfo;
+    uint8_t     *m_pBfwIQ_ext = nullptr;
+    int16_t     *m_pBfw_src[XRAN_MAX_SET_BFWS];
+    int16_t     m_pBfw_rx[XRAN_MAX_SET_BFWS][MAX_RX_LEN];
+    struct xran_ext11_bfw_info m_bfwInfo[XRAN_MAX_SET_BFWS];
 
     void SetUp() override
     {
         int i, j;
+        bool flag_skip;
+        int ext_type;
+        std::string ext_name;
 
         init_test("C_Plane");
 
@@ -196,24 +228,38 @@ protected:
             m_sections[i].exts      = get_input_parameter<std::vector<uint8_t>>("sections", i, "exts");
             }
 
+        /* allocate and prepare required data storage */
+        m_pSectGenInfo      = new struct xran_section_gen_info [m_numSections];
+        ASSERT_NE(m_pSectGenInfo, nullptr);
+        m_params.sections   = m_pSectGenInfo;
+
+        m_pSectResult       = new struct xran_section_recv_info [m_numSections];
+        ASSERT_NE(m_pSectResult, nullptr);
+        m_result.sections   = m_pSectResult;
+
         /* reading configurations of section extension */
         m_nextcfgs = get_input_subsection_size("extensions");
         if(m_nextcfgs) {
             m_extcfgs = new struct extcfginfo [m_nextcfgs];
 
+            flag_skip = false;
             for(i=0; i < m_nextcfgs; i++) {
-                std::vector<uint16_t> csf;
-                std::vector<uint16_t> mcScaleReMask;
-                std::vector<uint16_t> mcScaleOffset;
-
-                m_extcfgs[i].type   = get_input_parameter<int>("extensions", i, "type");
-                m_extcfgs[i].name   = get_input_parameter<std::string>("extensions", i, "name");
+                std::vector<uint16_t> beamIDs;
 
-                switch(m_extcfgs[i].type) {
+                ext_type    = get_input_parameter<int>("extensions", i, "type");
+                switch(ext_type) {
                     case XRAN_CP_SECTIONEXTCMD_1:
-                        /* Skip section extension type 1 since it has separate function */
-                        std::cout << "### Skip Extension 1 configuration !!\n" << std::endl;
-                        continue;
+                        /* if section extension type 1 is present, then ignore other extensions */
+                        if(i != 0 && m_nextcfgs != 1) {
+                            std::cout << "### Extension 1 configuration, ignore other extensions !!\n" << std::endl;
+                            }
+                        flag_skip = true;
+                        m_nextcfgs = 1;
+                        i = 0;
+                        m_extcfgs[i].u.ext1.bfwCompMeth = get_input_parameter<uint8_t> ("extensions", i, "bfwCompMeth");
+                        m_extcfgs[i].u.ext1.bfwIqWidth  = get_input_parameter<uint8_t> ("extensions", i, "bfwIqWidth");
+                        m_antElmTRx                     = get_input_parameter<uint8_t> ("extensions", i, "antelm_trx");
+                        break;
 
                     case XRAN_CP_SECTIONEXTCMD_2:
                         m_extcfgs[i].u.ext2.bfAzPtWidth  = get_input_parameter<uint8_t>("extensions", i, "bfAzPtWidth") & 0x7;
@@ -248,6 +294,11 @@ protected:
                         break;
 
                     case XRAN_CP_SECTIONEXTCMD_5:
+                        {
+                        std::vector<uint16_t> csf;
+                        std::vector<uint16_t> mcScaleReMask;
+                        std::vector<uint16_t> mcScaleOffset;
+
                         m_extcfgs[i].u.ext5.num_sets     = get_input_parameter<uint8_t>("extensions", i, "num_sets");
                         if(m_extcfgs[i].u.ext5.num_sets > XRAN_MAX_MODCOMP_ADDPARMS)
                             FAIL() << "Invalid number of sets in extension 5!";
@@ -261,39 +312,115 @@ protected:
                                 || mcScaleOffset.size() != m_extcfgs[i].u.ext5.num_sets)
                             FAIL() << "Invalid configuration in extension 5 - different size!";
 
-                        for(int ii=0; ii < m_extcfgs[i].u.ext5.num_sets; ii++) {
-                            m_extcfgs[i].u.ext5.mc[ii].csf           = csf[ii];
-                            m_extcfgs[i].u.ext5.mc[ii].mcScaleReMask = mcScaleReMask[ii];
-                            m_extcfgs[i].u.ext5.mc[ii].mcScaleOffset = mcScaleOffset[ii];
+                        for(j=0; j < m_extcfgs[i].u.ext5.num_sets; j++) {
+                            m_extcfgs[i].u.ext5.mc[j].csf           = csf[j];
+                            m_extcfgs[i].u.ext5.mc[j].mcScaleReMask = mcScaleReMask[j];
+                            m_extcfgs[i].u.ext5.mc[j].mcScaleOffset = mcScaleOffset[j];
                             }
+                        }
+                        break;
+
+                    case XRAN_CP_SECTIONEXTCMD_6:
+                        m_extcfgs[i].u.ext6.rbgSize     = get_input_parameter<uint8_t> ("extensions", i, "rbgSize");
+                        m_extcfgs[i].u.ext6.rbgMask     = get_input_parameter<uint32_t>("extensions", i, "rbgMask");
+                        m_extcfgs[i].u.ext6.symbolMask  = get_input_parameter<uint16_t>("extensions", i, "symbolMask");
+                        break;
+
+                    case XRAN_CP_SECTIONEXTCMD_10:
+                        m_extcfgs[i].u.ext10.numPortc   = get_input_parameter<uint8_t> ("extensions", i, "numPortc");
+                        m_extcfgs[i].u.ext10.beamGrpType= get_input_parameter<uint8_t> ("extensions", i, "beamGrpType");
+                        switch(m_extcfgs[i].u.ext10.beamGrpType) {
+                            case XRAN_BEAMGT_COMMON:
+                            case XRAN_BEAMGT_MATRIXIND:
+                                break;
+                            case XRAN_BEAMGT_VECTORLIST:
+                                beamIDs = get_input_parameter<std::vector<uint16_t>>("extensions", i, "beamID");
+                                for(j=0; j < m_extcfgs[i].u.ext10.numPortc; j++)
+                                    m_extcfgs[i].u.ext10.beamID[j] = beamIDs[j];
+                                break;
+                            default:
+                                FAIL() << "Invalid Beam Group Type - " << m_extcfgs[i].u.ext10.beamGrpType << std::endl;
+                            }
+                        break;
+
+                    case XRAN_CP_SECTIONEXTCMD_11:
+                        {
+                        int temp;
+                        /* if section extension type 11 is present, then ignore other extensions */
+                        if(i != 0 && m_nextcfgs != 1) {
+                            std::cout << "### Extension 11 configuration, ignore other extensions !!\n" << std::endl;
+                            }
+                        flag_skip = true;
+                        m_nextcfgs = 1;
+                        i = 0;
+
+                        m_extcfgs[i].u.ext11.RAD            = get_input_parameter<uint8_t> ("extensions", i, "RAD");
+                        m_extcfgs[i].u.ext11.disableBFWs    = get_input_parameter<uint8_t> ("extensions", i, "disableBFWs");
+                        m_extcfgs[i].u.ext11.numBundPrb     = get_input_parameter<uint8_t> ("extensions", i, "numBundPrb");
+                        m_extcfgs[i].u.ext11.bfwCompMeth    = get_input_parameter<uint8_t> ("extensions", i, "bfwCompMeth");
+                        m_extcfgs[i].u.ext11.bfwIqWidth     = get_input_parameter<uint8_t> ("extensions", i, "bfwIqWidth");
+                        m_extcfgs[i].u.ext11.numSetBFWs     = get_input_parameter<uint8_t> ("extensions", i, "numSetBFWs");
+                        m_antElmTRx                         = get_input_parameter<uint8_t> ("extensions", i, "antelm_trx");
+                        beamIDs = get_input_parameter<std::vector<uint16_t>>("extensions", i, "beamID");
+
+                        /* Allocate buffers */
+                        m_extcfgs[i].u.ext11.maxExtBufSize  = MAX_RX_LEN;
+                        m_pBfwIQ_ext = (uint8_t *)xran_malloc(m_extcfgs[i].u.ext11.maxExtBufSize);
+                        m_extcfgs[i].u.ext11.pExtBuf = m_pBfwIQ_ext;
+
+                        for(j = 0; j < XRAN_MAX_SET_BFWS; j++) {
+                            m_pBfw_src[j]    = new int16_t [XRAN_MAX_BFW_N];
+                            memset(m_pBfw_src[j], j+1, XRAN_MAX_BFW_N);
+                            }
+
+                        for(j=0; j < m_extcfgs[i].u.ext11.numSetBFWs; j++) {
+                            m_bfwInfo[j].pBFWs  = (uint8_t *)(m_pBfw_src[j]);
+                            m_bfwInfo[j].beamId = beamIDs[j];
+                            }
+
+                        /* Initialize Shared information for external buffer */
+                        m_extSharedInfo.free_cb     = NULL;
+                        m_extSharedInfo.fcb_opaque  = NULL;
+                        rte_mbuf_ext_refcnt_update(&m_extSharedInfo, 0);
+                        m_extcfgs[i].u.ext11.pExtBufShinfo  = &m_extSharedInfo;
+
+                        /* Check all BFWs can be fit with given buffer */
+                        temp = xran_cp_estimate_max_set_bfws(m_antElmTRx, m_extcfgs[i].u.ext11.bfwIqWidth,
+                                            m_extcfgs[i].u.ext11.bfwCompMeth, m_extcfgs[i].u.ext11.maxExtBufSize);
+                        if(m_extcfgs[i].u.ext11.numSetBFWs > temp) {
+                            FAIL() << "Too many sets of BFWs - " << m_extcfgs[i].u.ext11.numSetBFWs
+                                    << "  (max " << temp << " for " << m_extcfgs[i].u.ext11.maxExtBufSize << std::endl;
+                            }
+
+                        temp = xran_cp_prepare_ext11_bfws(m_extcfgs[i].u.ext11.numSetBFWs, m_antElmTRx,
+                                            m_extcfgs[i].u.ext11.bfwIqWidth, m_extcfgs[i].u.ext11.bfwCompMeth,
+                                            m_pBfwIQ_ext, XRAN_MAX_BUFLEN_EXT11, m_bfwInfo);
+                        if(temp < 0) {
+                            FAIL() << "Fail to prepare BFWs!" << std::endl;
+                            };
+                        m_extcfgs[i].u.ext11.totalBfwIQLen = temp;
+                        }
                         break;
 
                     default:
-                       FAIL() << "Invalid Section Type Extension - " << m_extcfgs[i].type << std::endl;
+                       FAIL() << "Invalid Section Type Extension - " << ext_type << std::endl;
                        continue;
-                    } /* switch(m_extcfgs[i].type) */
+                    } /* switch(ext_type) */
+
+                m_extcfgs[i].type   = ext_type;
+                m_extcfgs[i].name   = get_input_parameter<std::string>("extensions", i, "name");
+
+                if(flag_skip)
+                    break;
                 } /* for(i=0; i < m_nextcfgs; i++) */
             }
         else {
             m_extcfgs = nullptr;
             }
 
-        /* allocate and prepare required data storage */
-        m_pSectGenInfo      = new struct xran_section_gen_info [m_numSections];
-        ASSERT_NE(m_pSectGenInfo, nullptr);
-        m_params.sections   = m_pSectGenInfo;
-
-        m_pSectResult       = new struct xran_section_gen_info [m_numSections];
-        ASSERT_NE(m_pSectResult, nullptr);
-        m_result.sections   = m_pSectResult;
-
         m_ext1_dst_len      = 9600;
         m_p_ext1_dst        = new int8_t [m_ext1_dst_len];
         m_p_bfw_iq_src      = new int16_t [9600/2];
-
-        /* allocating an mbuf for packet generatrion */
-        m_pTestBuffer       = xran_ethdi_mbuf_alloc();
-        ASSERT_FALSE(m_pTestBuffer == nullptr);
     }
 
     void TearDown() override
@@ -303,6 +430,14 @@ protected:
             m_pTestBuffer = nullptr;
             }
 
+        if(m_pBfwIQ_ext){
+            xran_free(m_pBfwIQ_ext);
+            m_pBfwIQ_ext = nullptr;
+            }
+        for(int i = 0; i < XRAN_MAX_SET_BFWS; i++) {
+            DELETE_ARRAY(m_pBfw_src[i]);
+            }
+
         DELETE_ARRAY(m_extcfgs);
         DELETE_ARRAY(m_sections);
         DELETE_ARRAY(m_p_bfw_iq_src);
@@ -315,13 +450,14 @@ protected:
     int prepare_extensions(void);
     void verify_sections(void);
 
+    void test_ext1(void);
 };
 
 
 
 int C_plane::prepare_extensions()
 {
-    int i, numext, sect_num;
+    int i, j, numext, sect_num;
     int ext_id;
 
     for(sect_num=0; sect_num < m_numSections; sect_num++) {
@@ -337,7 +473,7 @@ int C_plane::prepare_extensions()
 
             switch(m_extcfgs[ext_id].type) {
                 case XRAN_CP_SECTIONEXTCMD_1:
-                    std::cout << "Skip Extension 1 !!" << std::endl;
+//                    std::cout << "Skip Extension 1 !!" << std::endl;
                     continue;
                 case XRAN_CP_SECTIONEXTCMD_2:
                     m_params.sections[sect_num].exData[numext].len  = sizeof(m_extcfgs[ext_id].u.ext2);
@@ -354,6 +490,23 @@ int C_plane::prepare_extensions()
                 case XRAN_CP_SECTIONEXTCMD_5:
                     m_params.sections[sect_num].exData[numext].len  = sizeof(m_extcfgs[ext_id].u.ext5);
                     m_params.sections[sect_num].exData[numext].data = &m_extcfgs[ext_id].u.ext5;
+                    break;
+                case XRAN_CP_SECTIONEXTCMD_6:
+                    m_params.sections[sect_num].exData[numext].len  = sizeof(m_extcfgs[ext_id].u.ext6);
+                    m_params.sections[sect_num].exData[numext].data = &m_extcfgs[ext_id].u.ext6;
+                    break;
+                case XRAN_CP_SECTIONEXTCMD_10:
+                    m_params.sections[sect_num].exData[numext].len  = sizeof(m_extcfgs[ext_id].u.ext10);
+                    m_params.sections[sect_num].exData[numext].data = &m_extcfgs[ext_id].u.ext10;
+                    break;
+                case XRAN_CP_SECTIONEXTCMD_11:
+                    m_params.sections[sect_num].exData[numext].len  = sizeof(m_extcfgs[ext_id].u.ext11);
+                    m_params.sections[sect_num].exData[numext].data = &m_extcfgs[ext_id].u.ext11;
+
+                    m_result.sections[sect_num].exts[numext].type   = m_extcfgs[ext_id].type;
+                    for(j=0 ; j < XRAN_MAX_SET_BFWS; j++)
+                        m_result.sections[sect_num].exts[numext].u.ext11.bundInfo[j].pBFWs = (uint8_t *)m_pBfw_rx[j];
+
                     break;
                 default:
                     std::cout << "Invalid Section Extension Type - " << (int)m_extcfgs[ext_id].type << std::endl;
@@ -411,10 +564,10 @@ int C_plane::prepare_sections(void)
         }
 
     for(numsec=0; numsec < m_numSections; numsec++) {
-        m_params.sections[numsec].info.type         = m_params.sectionType;       // for database
-        m_params.sections[numsec].info.startSymId   = m_params.hdr.startSymId;    // for database
-        m_params.sections[numsec].info.iqWidth      = m_params.hdr.iqWidth;       // for database
-        m_params.sections[numsec].info.compMeth     = m_params.hdr.compMeth;      // for database
+        m_params.sections[numsec].info.type         = m_params.sectionType;
+        m_params.sections[numsec].info.startSymId   = m_params.hdr.startSymId;
+        m_params.sections[numsec].info.iqWidth      = m_params.hdr.iqWidth;
+        m_params.sections[numsec].info.compMeth     = m_params.hdr.compMeth;
         m_params.sections[numsec].info.id           = m_sections[numsec].sectionId;
         m_params.sections[numsec].info.rb           = m_sections[numsec].rb;
         m_params.sections[numsec].info.symInc       = m_sections[numsec].symInc;
@@ -435,7 +588,7 @@ int C_plane::prepare_sections(void)
             default:
                 return (-1);
             }
-        }
+    }
 
     m_params.numSections        = numsec;
 
@@ -445,7 +598,7 @@ int C_plane::prepare_sections(void)
 
 void C_plane::verify_sections(void)
 {
-  int i,j;
+  int i,j,k;
 
     /* Verify the result */
     EXPECT_TRUE(m_result.dir            == m_params.dir);
@@ -502,10 +655,10 @@ void C_plane::verify_sections(void)
 
         if(m_params.sections[i].info.ef) {
             //printf("[%d] %d ==  %d\n",i,  m_result.sections[i].exDataSize, m_params.sections[i].exDataSize);
-            EXPECT_TRUE(m_result.sections[i].exDataSize == m_params.sections[i].exDataSize);
+            EXPECT_TRUE(m_result.sections[i].numExts == m_params.sections[i].exDataSize);
 
             for(j=0; j < m_params.sections[i].exDataSize; j++) {
-                EXPECT_TRUE(m_result.sections[i].exData[j].type == m_params.sections[i].exData[j].type);
+                EXPECT_TRUE(m_result.sections[i].exts[j].type == m_params.sections[i].exData[j].type);
 
                 switch(m_params.sections[i].exData[j].type) {
                     case XRAN_CP_SECTIONEXTCMD_1:
@@ -514,9 +667,9 @@ void C_plane::verify_sections(void)
                         int iq_size, parm_size, N;
 
                         ext1_params = (struct xran_sectionext1_info *)m_params.sections[i].exData[j].data;
-                        ext1_result = (struct xran_sectionext1_info *)m_result.sections[i].exData[j].data;
+                        ext1_result = &m_result.sections[i].exts[j].u.ext1;
 
-                        EXPECT_TRUE(ext1_result->bfwiqWidth  == ext1_params->bfwiqWidth);
+                        EXPECT_TRUE(ext1_result->bfwIqWidth  == ext1_params->bfwIqWidth);
                         EXPECT_TRUE(ext1_result->bfwCompMeth == ext1_params->bfwCompMeth);
 
                         N = ext1_params->bfwNumber;
@@ -541,7 +694,7 @@ void C_plane::verify_sections(void)
                             }
 
                         /* Get the number of BF weights */
-                        iq_size = N*ext1_params->bfwiqWidth*2;  // total in bits
+                        iq_size = N*ext1_params->bfwIqWidth*2;  // total in bits
                         parm_size = iq_size>>3;                 // total in bytes (/8)
                         if(iq_size%8) parm_size++;              // round up
                         EXPECT_FALSE(std::memcmp(ext1_result->p_bfwIQ, ext1_params->p_bfwIQ, parm_size));
@@ -553,7 +706,7 @@ void C_plane::verify_sections(void)
                         struct xran_sectionext2_info *ext2_params, *ext2_result;
 
                         ext2_params = (struct xran_sectionext2_info *)m_params.sections[i].exData[j].data;
-                        ext2_result = (struct xran_sectionext2_info *)m_result.sections[i].exData[j].data;
+                        ext2_result = &m_result.sections[i].exts[j].u.ext2;
 
                         if(ext2_params->bfAzPtWidth) {
                             EXPECT_TRUE(ext2_result->bfAzPtWidth    == ext2_params->bfAzPtWidth);
@@ -583,7 +736,7 @@ void C_plane::verify_sections(void)
                         struct xran_sectionext3_info *ext3_params, *ext3_result;
 
                         ext3_params = (struct xran_sectionext3_info *)m_params.sections[i].exData[j].data;
-                        ext3_result = (struct xran_sectionext3_info *)m_result.sections[i].exData[j].data;
+                        ext3_result = &m_result.sections[i].exts[j].u.ext3;
 
                         EXPECT_TRUE(ext3_result->layerId    == ext3_params->layerId);
                         EXPECT_TRUE(ext3_result->codebookIdx== ext3_params->codebookIdx);
@@ -613,7 +766,7 @@ void C_plane::verify_sections(void)
                         struct xran_sectionext4_info *ext4_params, *ext4_result;
 
                         ext4_params = (struct xran_sectionext4_info *)m_params.sections[i].exData[j].data;
-                        ext4_result = (struct xran_sectionext4_info *)m_result.sections[i].exData[j].data;
+                        ext4_result = &m_result.sections[i].exts[j].u.ext4;
 
                         EXPECT_TRUE(ext4_result->csf            == ext4_params->csf);
                         EXPECT_TRUE(ext4_result->modCompScaler  == ext4_params->modCompScaler);
@@ -626,7 +779,7 @@ void C_plane::verify_sections(void)
                         int idx;
 
                         ext5_params = (struct xran_sectionext5_info *)m_params.sections[i].exData[j].data;
-                        ext5_result = (struct xran_sectionext5_info *)m_result.sections[i].exData[j].data;
+                        ext5_result = &m_result.sections[i].exts[j].u.ext5;
 
                         EXPECT_TRUE(ext5_result->num_sets == ext5_params->num_sets);
                         for(idx=0; idx < ext5_params->num_sets; idx++) {
@@ -636,150 +789,83 @@ void C_plane::verify_sections(void)
                             }
                         }
                         break;
-                    }
-                }
-            }
-        }
-
-    return;
-}
-
-
-/***************************************************************************
- * Functional Test cases
- ***************************************************************************/
-
-TEST_P(C_plane, Section_Ext1)
-{
-    int i = 0, idRb;
-    int16_t *ptr = NULL;
-    int32_t nRbs = 36;
-    int32_t nAntElm = 64;
-    int8_t  iqWidth = 16;
-    int8_t  compMethod = XRAN_COMPMETHOD_NONE;
-    int8_t  *p_ext1_dst  = NULL;
-    int8_t  *bfw_payload = NULL;
-    int32_t expected_len = (3+1)*nRbs + nAntElm*nRbs*4;
-
-    int16_t  ext_len       = 9600;
-    int16_t  ext_sec_total = 0;
-    int8_t * ext_buf       = nullptr;
-    int8_t * ext_buf_init  = nullptr;
-
-    struct xran_section_gen_info* loc_pSectGenInfo = m_params.sections;
-    struct xran_sectionext1_info m_prep_ext1;
-    struct xran_cp_radioapp_section_ext1 *p_ext1;
-    struct rte_mbuf_ext_shared_info  share_data;
-    struct rte_mbuf *mbuf = NULL;
-
-    /* Configure section information */
-    if(prepare_sections() < 0) {
-        FAIL() << "Invalid Section configuration\n";
-    }
+                    case XRAN_CP_SECTIONEXTCMD_6:
+                        {
+                        struct xran_sectionext6_info *ext6_params, *ext6_result;
 
-    if(prepare_extensions() < 0) {
-        FAIL() << "Invalid Section extension configuration\n";
-    }
+                        ext6_params = (struct xran_sectionext6_info *)m_params.sections[i].exData[j].data;
+                        ext6_result = &m_result.sections[i].exts[j].u.ext6;
 
-    if(loc_pSectGenInfo->info.type == XRAN_CP_SECTIONTYPE_1) {
-            /* extType 1 only with Section 1 for now */
+                        EXPECT_TRUE(ext6_result->rbgSize    == ext6_params->rbgSize);
+                        EXPECT_TRUE(ext6_result->rbgMask    == ext6_params->rbgMask);
+                        EXPECT_TRUE(ext6_result->symbolMask == ext6_params->symbolMask);
+                        }
+                        break;
+                    case XRAN_CP_SECTIONEXTCMD_10:
+                        {
+                        struct xran_sectionext10_info *ext10_params, *ext10_result;
+                        int idx;
 
-        ext_buf  = ext_buf_init = (int8_t*) xran_malloc(ext_len);
-        if (ext_buf) {
-            ptr = m_p_bfw_iq_src;
+                        ext10_params = (struct xran_sectionext10_info *)m_params.sections[i].exData[j].data;
+                        ext10_result = &m_result.sections[i].exts[j].u.ext10;
 
-            for (idRb =0; idRb < nRbs*nAntElm*2; idRb++){
-                ptr[idRb] = i;
-                i++;
+                        EXPECT_TRUE(ext10_result->numPortc      == ext10_params->numPortc);
+                        EXPECT_TRUE(ext10_result->beamGrpType   == ext10_params->beamGrpType);
+                        if(ext10_result->beamGrpType == XRAN_BEAMGT_VECTORLIST) {
+                            for(idx=0; idx < ext10_result->numPortc; idx++)
+                                EXPECT_TRUE(ext10_result->beamID[idx] == ext10_params->beamID[idx]);
+                            }
+                        }
+                        break;
+                    case XRAN_CP_SECTIONEXTCMD_11:
+                        {
+                        struct xran_sectionext11_info *ext11_params;
+                        struct xran_sectionext11_recv_info *ext11_result;
+
+                        ext11_params = (struct xran_sectionext11_info *)m_params.sections[i].exData[j].data;
+                        ext11_result = &m_result.sections[i].exts[j].u.ext11;
+
+                        EXPECT_TRUE(ext11_result->RAD           == ext11_params->RAD);
+                        EXPECT_TRUE(ext11_result->disableBFWs   == ext11_params->disableBFWs);
+                        EXPECT_TRUE(ext11_result->numBundPrb    == ext11_params->numBundPrb);
+                        EXPECT_TRUE(ext11_result->bfwCompMeth   == ext11_params->bfwCompMeth);
+                        EXPECT_TRUE(ext11_result->bfwIqWidth    == ext11_params->bfwIqWidth);
+
+
+                        EXPECT_TRUE(ext11_result->numSetBFWs    == ext11_params->numSetBFWs);
+                        for(k=0; k < ext11_result->numSetBFWs; k++) {
+                            EXPECT_TRUE(ext11_result->bundInfo[k].beamId    == m_bfwInfo[k].beamId);
+#if 0
+                            EXPECT_TRUE(ext11_result->bundInfo[k].BFWSize   == ext11_params->BFWSize);
+
+                            if(ext11_result->bundInfo[k].pBFWs)
+                                EXPECT_TRUE(memcmp(ext11_result->bundInfo[k].pBFWs,
+                                                ext11_params->bundInfo[k].pBFWs + ext11_params->bundInfo[k].offset + 4,
+                                                ext11_result->bundInfo[k].BFWSize) == 0);
+                            switch(ext11_result->bfwCompMeth) {
+                                case XRAN_BFWCOMPMETHOD_NONE:
+                                    break;
+
+                                case XRAN_BFWCOMPMETHOD_BLKFLOAT:
+                                    EXPECT_TRUE(ext11_result->bundInfo[k].bfwCompParam.exponent == ext11_params->bundInfo[k].bfwCompParam.exponent);
+                                    break;
+
+                                default:
+                                    FAIL() << "Invalid BfComp method - %d" << ext11_result->bfwCompMeth << std::endl;
+                                }
+#endif
+                            }
+                        }
+                        break;
+                    }
+                }
             }
-
-            ext_buf += (RTE_PKTMBUF_HEADROOM +
-                       sizeof (struct xran_ecpri_hdr) +
-                       sizeof(struct xran_cp_radioapp_common_header) +
-                       sizeof(struct xran_cp_radioapp_section1));
-
-            ext_len -= (RTE_PKTMBUF_HEADROOM +
-                        sizeof(struct xran_ecpri_hdr) +
-                        sizeof(struct xran_cp_radioapp_common_header) +
-                        sizeof(struct xran_cp_radioapp_section1));
-
-            ext_sec_total = xran_cp_populate_section_ext_1((int8_t *)ext_buf,
-                                                 ext_len,
-                                                 m_p_bfw_iq_src,
-                                                 nRbs,
-                                                 nAntElm,
-                                                 iqWidth,
-                                                 compMethod);
-
-            ASSERT_TRUE(ext_sec_total == expected_len);
-            p_ext1_dst = ext_buf;
-
-            memset(&m_temp_ext1[0], 0, sizeof (struct xran_sectionext1_info)*XRAN_MAX_PRBS);
-
-            idRb = 0;
-            do {
-                p_ext1 = (struct xran_cp_radioapp_section_ext1 *)p_ext1_dst;
-                bfw_payload = (int8_t*)(p_ext1+1);
-                p_ext1_dst += p_ext1->extLen*XRAN_SECTIONEXT_ALIGN;
-
-                m_temp_ext1[idRb].bfwNumber      = nAntElm;
-                m_temp_ext1[idRb].bfwiqWidth     = iqWidth;
-                m_temp_ext1[idRb].bfwCompMeth    = compMethod;
-                m_temp_ext1[idRb].p_bfwIQ               = (int16_t*)bfw_payload;
-                m_temp_ext1[idRb].bfwIQ_sz              = p_ext1->extLen*XRAN_SECTIONEXT_ALIGN;
-
-                loc_pSectGenInfo->exData[idRb].type = XRAN_CP_SECTIONEXTCMD_1;
-                loc_pSectGenInfo->exData[idRb].len  = sizeof(m_temp_ext1[idRb]);
-                loc_pSectGenInfo->exData[idRb].data = &m_temp_ext1[idRb];
-
-                idRb++;
-            }while(p_ext1->ef != XRAN_EF_F_LAST);
-            ASSERT_TRUE(idRb == nRbs);
-
-            mbuf = xran_attach_cp_ext_buf(ext_buf_init, ext_buf, ext_sec_total, &share_data);
-
-            /* Update section information */
-            memset(&m_prep_ext1, 0, sizeof (struct xran_sectionext1_info));
-            m_prep_ext1.bfwNumber      = nAntElm;
-            m_prep_ext1.bfwiqWidth     = iqWidth;
-            m_prep_ext1.bfwCompMeth    = compMethod;
-            m_prep_ext1.p_bfwIQ        = (int16_t*)ext_buf;
-            m_prep_ext1.bfwIQ_sz       = ext_sec_total;
-
-
-            loc_pSectGenInfo->exData[0].type = XRAN_CP_SECTIONEXTCMD_1;
-            loc_pSectGenInfo->exData[0].len  = sizeof(m_prep_ext1);
-            loc_pSectGenInfo->exData[0].data = &m_prep_ext1;
-
-            loc_pSectGenInfo->info.ef       = 1;
-            loc_pSectGenInfo->exDataSize    = 1; /* append all extType1 as one shot
-                                                    (as generated via xran_cp_populate_section_ext_1)*/
-
-            m_params.numSections    = 1;
-
-            /* Generating C-Plane packet */
-            ASSERT_TRUE(xran_prepare_ctrl_pkt(/*m_pTestBuffer*/mbuf, &m_params, m_ccId, m_antId, m_seqId) == XRAN_STATUS_SUCCESS);
-
-            /** to match O-RU parsing */
-            loc_pSectGenInfo->exDataSize = nRbs;
-            loc_pSectGenInfo->exData[0].len  = sizeof(m_temp_ext1[0]);
-            loc_pSectGenInfo->exData[0].data = &m_temp_ext1[0];
-
-            /* Parsing generated packet */
-            EXPECT_TRUE(xran_parse_cp_pkt(/*m_pTestBuffer*/mbuf, &m_result, &m_pktInfo) == XRAN_STATUS_SUCCESS);
-        } else {
-            FAIL() << "xran_malloc failed\n";
         }
 
-        /* Verify the result */
-        verify_sections();
-
-        if(ext_buf_init)
-            xran_free(ext_buf_init);
-    }
+    return;
 }
 
-TEST_P(C_plane, Section_Ext1_9bit)
+void C_plane::test_ext1(void)
 {
     int i = 0, idRb;
     int16_t *ptr = NULL;
@@ -803,14 +889,23 @@ TEST_P(C_plane, Section_Ext1_9bit)
     struct rte_mbuf_ext_shared_info  share_data;
     struct rte_mbuf *mbuf = NULL;
 
-    /* Configure section information */
-    if(prepare_sections() < 0) {
-        FAIL() << "Invalid Section configuration\n";
-    }
 
-    if(prepare_extensions() < 0) {
-        FAIL() << "Invalid Section extension configuration\n";
-    }
+    nAntElm     = m_antElmTRx;
+    nRbs        = m_params.sections[0].info.numPrbc;
+    iqWidth     = m_extcfgs[0].u.ext1.bfwIqWidth;
+    compMethod  = m_extcfgs[0].u.ext1.bfwCompMeth;
+
+    switch(compMethod) {
+        case XRAN_BFWCOMPMETHOD_NONE:
+            expected_len = (3+1)*nRbs + nAntElm*nRbs*4;
+            break;
+        case XRAN_BFWCOMPMETHOD_BLKFLOAT:
+            expected_len = ((nAntElm/16*4*iqWidth)+1)*nRbs + /* bfwCompParam + IQ = */
+                            sizeof(struct xran_cp_radioapp_section_ext1)*nRbs; /* ext1 Headers */
+            break;
+        default:
+            FAIL() << "Unsupported Compression Method - " << compMethod << std::endl;
+        }
 
     if(loc_pSectGenInfo->info.type == XRAN_CP_SECTIONTYPE_1) {
         /* extType 1 only with Section 1 for now */
@@ -822,7 +917,7 @@ TEST_P(C_plane, Section_Ext1_9bit)
             for (idRb =0; idRb < nRbs*nAntElm*2; idRb++){
                 ptr[idRb] = i;
                 i++;
-            }
+                }
 
             ext_buf += (RTE_PKTMBUF_HEADROOM +
                        sizeof (struct xran_ecpri_hdr) +
@@ -854,10 +949,12 @@ TEST_P(C_plane, Section_Ext1_9bit)
                 p_ext1_dst += p_ext1->extLen*XRAN_SECTIONEXT_ALIGN;
 
                 m_temp_ext1[idRb].bfwNumber      = nAntElm;
-                m_temp_ext1[idRb].bfwiqWidth     = iqWidth;
+                m_temp_ext1[idRb].bfwIqWidth     = iqWidth;
                 m_temp_ext1[idRb].bfwCompMeth    = compMethod;
 
-                m_temp_ext1[idRb].bfwCompParam.exponent = *bfw_payload++ & 0xF;
+                if(compMethod == XRAN_BFWCOMPMETHOD_BLKFLOAT) {
+                    m_temp_ext1[idRb].bfwCompParam.exponent = *bfw_payload++ & 0xF;
+                    }
 
                 m_temp_ext1[idRb].p_bfwIQ               = (int16_t*)bfw_payload;
                 m_temp_ext1[idRb].bfwIQ_sz              = p_ext1->extLen*XRAN_SECTIONEXT_ALIGN;
@@ -867,15 +964,16 @@ TEST_P(C_plane, Section_Ext1_9bit)
                 loc_pSectGenInfo->exData[idRb].data = &m_temp_ext1[idRb];
 
                 idRb++;
-            }while(p_ext1->ef != XRAN_EF_F_LAST);
+            } while(p_ext1->ef != XRAN_EF_F_LAST);
+
             ASSERT_TRUE(idRb == nRbs);
 
-            mbuf = xran_attach_cp_ext_buf(ext_buf_init, ext_buf, ext_sec_total, &share_data);
+            mbuf = xran_attach_cp_ext_buf(0, ext_buf_init, ext_buf, ext_sec_total, &share_data);
 
             /* Update section information */
             memset(&m_prep_ext1, 0, sizeof (struct xran_sectionext1_info));
             m_prep_ext1.bfwNumber      = nAntElm;
-            m_prep_ext1.bfwiqWidth     = iqWidth;
+            m_prep_ext1.bfwIqWidth     = iqWidth;
             m_prep_ext1.bfwCompMeth    = compMethod;
             m_prep_ext1.p_bfwIQ        = (int16_t*)ext_buf;
             m_prep_ext1.bfwIQ_sz       = ext_sec_total;
@@ -901,50 +999,65 @@ TEST_P(C_plane, Section_Ext1_9bit)
 
             /* Parsing generated packet */
             EXPECT_TRUE(xran_parse_cp_pkt(/*m_pTestBuffer*/mbuf, &m_result, &m_pktInfo) == XRAN_STATUS_SUCCESS);
-        } else {
+            }
+        else {
             FAIL() << "xran_malloc failed\n";
-        }
+            }
 
         /* Verify the result */
         verify_sections();
 
         if(ext_buf_init)
             xran_free(ext_buf_init);
-    }
+        }
 }
 
+/***************************************************************************
+ * Functional Test cases
+ ***************************************************************************/
 
-TEST_P(C_plane, PacketGen)
+TEST_P(C_plane, CPacketGen)
 {
     /* Configure section information */
     if(prepare_sections() < 0) {
         FAIL() << "Invalid Section configuration\n";
-        }
+    }
     if(prepare_extensions() < 0) {
         FAIL() << "Invalid Section extension configuration\n";
+    }
+    if(m_nextcfgs) {
+        if(m_extcfgs[0].type == XRAN_CP_SECTIONEXTCMD_1) {
+            test_ext1();
+            return;
         }
-
-    /* Generating C-Plane packet */
-    ASSERT_TRUE(xran_prepare_ctrl_pkt(m_pTestBuffer, &m_params, m_ccId, m_antId, m_seqId) == XRAN_STATUS_SUCCESS);
-
-    /* Parsing generated packet */
-    EXPECT_TRUE(xran_parse_cp_pkt(m_pTestBuffer, &m_result, &m_pktInfo) == XRAN_STATUS_SUCCESS);
-
-    /* Verify the result */
-    verify_sections();
-}
-
-
-TEST_P(C_plane, PacketGen_Ext)
-{
-    /* Configure section information */
-    if(prepare_sections() < 0) {
-        FAIL() << "Invalid Section configuration\n";
+        else if(m_extcfgs[0].type == XRAN_CP_SECTIONEXTCMD_11) {
+            /* use large buffer to linearize external buffer for parsing */
+            m_pTestBuffer = xran_ethdi_mbuf_alloc();
+            ASSERT_FALSE(m_pTestBuffer == nullptr);
+
+            if(xran_cp_attach_ext_buf(m_pTestBuffer,
+                                m_pBfwIQ_ext,
+                                m_extcfgs[0].u.ext11.maxExtBufSize,
+                                &m_extSharedInfo) < 0) {
+                rte_pktmbuf_free(m_pTestBuffer);
+                m_pTestBuffer = nullptr;
+                FAIL() << "Failed to attach external buffer !!\n";
+            }
+            rte_mbuf_ext_refcnt_update(&m_extSharedInfo, 0);
         }
+    }
+
+    if(m_pTestBuffer == nullptr) {
+        m_pTestBuffer = xran_ethdi_mbuf_alloc();
+        ASSERT_FALSE(m_pTestBuffer == nullptr);
+    }
 
     /* Generating C-Plane packet */
     ASSERT_TRUE(xran_prepare_ctrl_pkt(m_pTestBuffer, &m_params, m_ccId, m_antId, m_seqId) == XRAN_STATUS_SUCCESS);
 
+    /* Linearize data in the chain of mbufs to parse generated packet*/
+    ASSERT_TRUE(rte_pktmbuf_linearize(m_pTestBuffer) == 0);
+
     /* Parsing generated packet */
     EXPECT_TRUE(xran_parse_cp_pkt(m_pTestBuffer, &m_result, &m_pktInfo) == XRAN_STATUS_SUCCESS);
 
@@ -952,7 +1065,6 @@ TEST_P(C_plane, PacketGen_Ext)
     verify_sections();
 }
 
-
 /***************************************************************************
  * Performance Test cases
  ***************************************************************************/
@@ -969,21 +1081,10 @@ TEST_P(C_plane, Perf)
 
     /* using wrapper function to reset mbuf */
     performance("C", module_name,
-            &xran_ut_prepare_cp, m_pTestBuffer, &m_params, m_ccId, m_antId, m_seqId);
+            &xran_ut_prepare_cp, &m_params, m_ccId, m_antId, m_seqId);
 }
 
 
-TEST_P(C_plane, Perf_Ext)
-{
-    /* Configure section information */
-    if(prepare_sections() < 0) {
-        FAIL() << "Invalid Section configuration\n";
-        }
-
-    /* using wrapper function to reset mbuf */
-    performance("C", module_name,
-            &xran_ut_prepare_cp, m_pTestBuffer, &m_params, m_ccId, m_antId, m_seqId);
-}
 
 INSTANTIATE_TEST_CASE_P(UnitTest, C_plane,
         testing::ValuesIn(get_sequence(C_plane::get_number_of_cases("C_Plane"))));