Commit 817e5cbc authored by Manish's avatar Manish

Read C/U plane dpdk device from config file

parent d4afd251
......@@ -21,6 +21,20 @@
#include "xran_lib_wrap.hpp"
#include <fstream>
json read_json_from_file(const std::string &filename)
{
json result;
std::ifstream json_stream(filename);
if(!json_stream.is_open())
throw missing_config_file_exception();
json_stream >> result;
return result;
}
......@@ -383,8 +397,6 @@ xranLibWraper::xranLibWraper()
// From xran_io_cfg of xran_fh_o_du.h
uint8_t id_ = 0;
uint8_t num_vfs_ = 2;
const char* VF_UPlane = "0000:b3:02.0"; // why not m_dpdk_dev_up ?
const char* VF_CPlane = "0000:b3:02.1"; // why not m_dpdk_dev_cp ?
// From xran_eaxcid_config of xran_fh_o_du.h
uint8_t bit_cuPortId_ = 12; //(??) bitnum_bandsec + bitnum_ccid + bitnum_ruport;
......@@ -407,11 +419,11 @@ xranLibWraper::xranLibWraper()
// Independent
m_nSlots = 20; // If mu=0 is 10, if mu=1 is 20
m_du_mac[0]=0x00; m_du_mac[1]=0x11; m_du_mac[2]=0x22; m_du_mac[3]=0x33; m_du_mac[4]=0x44; m_du_mac[5]=0x55;
m_ru_mac[0]=0x00; m_ru_mac[1]=0x11; m_ru_mac[2]=0x22; m_ru_mac[3]=0x33; m_ru_mac[4]=0x44; m_ru_mac[5]=0x66;
// m_ru_mac[0]=0x00; m_ru_mac[1]=0x11; m_ru_mac[2]=0x22; m_ru_mac[3]=0x33; m_ru_mac[4]=0x44; m_ru_mac[5]=0x66;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
int i, temp;
int i, temp, j;
std::string tmpstr;
unsigned int tmp_mac[6];
......@@ -424,9 +436,10 @@ xranLibWraper::xranLibWraper()
/* DPDK configuration */
m_dpdk_dev_up = get_globalcfg<std::string>(XRAN_UT_KEY_GLOBALCFG_IO, "dpdk_dev_up");
m_dpdk_dev_cp = get_globalcfg<std::string>(XRAN_UT_KEY_GLOBALCFG_IO, "dpdk_dev_cp");
m_xranInit.io_cfg.dpdk_dev[XRAN_CP_VF] = (m_dpdk_dev_cp == "") ? NULL : (char *)&m_dpdk_dev_cp[0];
m_xranInit.io_cfg.dpdk_dev[XRAN_UP_VF] = (m_dpdk_dev_cp == "") ? NULL : (char *)&m_dpdk_dev_up[0];
std::cout << "UP_VF [" << m_xranInit.io_cfg.dpdk_dev[XRAN_UP_VF] << "], CP_VF [" << m_xranInit.io_cfg.dpdk_dev[XRAN_CP_VF] << "]" << std::endl;
m_xranInit.io_cfg.num_vfs = num_vfs_;
m_xranInit.io_cfg.dpdk_dev[XRAN_UP_VF] = const_cast<char*>(VF_UPlane);
m_xranInit.io_cfg.dpdk_dev[XRAN_CP_VF] = const_cast<char*>(VF_CPlane);
printf("wrapper.hpp: m_xranInit.io_cfg.dpdk_dev[%d] =%s, m_xranInit.io_cfg.dpdk_dev[%d]=%s\n",XRAN_UP_VF,m_xranInit.io_cfg.dpdk_dev[XRAN_UP_VF],XRAN_CP_VF,m_xranInit.io_cfg.dpdk_dev[XRAN_CP_VF]);
......@@ -467,8 +480,10 @@ xranLibWraper::xranLibWraper()
std::sscanf(ru_mac_str.c_str(), "%02x:%02x:%02x:%02x:%02x:%02x",
&tmp_mac[0], &tmp_mac[1], &tmp_mac[2],
&tmp_mac[3], &tmp_mac[4], &tmp_mac[5]);
for(j = 0; j < XRAN_VF_MAX; j++) {
for(i=0; i<6; i++)
m_ru_mac[i] = (uint8_t)tmp_mac[i];
m_ru_mac[j][i] = (uint8_t)tmp_mac[i];
}
m_xranInit.p_o_du_addr = (int8_t *)m_du_mac;
m_xranInit.p_o_ru_addr = (int8_t *)m_ru_mac;
m_xranInit.cp_vlan_tag = get_globalcfg<int>(XRAN_UT_KEY_GLOBALCFG_IO, "cp_vlan_tag");
......
......@@ -104,7 +104,7 @@ protected:
void *m_xranhandle;
uint8_t m_du_mac[6]; // = { 0x00,0x11, 0x22, 0x33, 0x44, 0x55 }; // Sofia: this is hard coded here and then it is read from the conf file
uint8_t m_ru_mac[6]; //= { 0x00,0x11, 0x22, 0x33, 0x44, 0x66 }; // Sofia: this is hard coded here and then it is read from the conf file
uint8_t m_ru_mac[XRAN_VF_MAX][6]; //= { 0x00,0x11, 0x22, 0x33, 0x44, 0x66 }; // Sofia: this is hard coded here and then it is read from the conf file
bool m_bSub6;
uint32_t m_nSlots; // = 20;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment