Commit 0e5033f1 authored by Robert Schmidt's avatar Robert Schmidt

Transform app_io_xran_buffers_max_sz_set() to readable code

parent 8ecf9754
......@@ -38,9 +38,38 @@
#include "common/utils/assertions.h"
/* buffers size */
uint32_t nFpgaToSW_FTH_RxBufferLen;
uint32_t nSW_ToFpga_FTH_TxBufferLen;
uint32_t get_nSW_ToFpga_FTH_TxBufferLen(int mu, int sections)
{
uint32_t xran_max_sections_per_slot = RTE_MAX(sections, XRAN_MIN_SECTIONS_PER_SLOT);
uint32_t overhead = xran_max_sections_per_slot
* (RTE_PKTMBUF_HEADROOM + sizeof(struct rte_ether_hdr) + sizeof(struct xran_ecpri_hdr)
+ sizeof(struct radio_app_common_hdr) + sizeof(struct data_section_hdr));
if (mu <= 1) {
return 13168 + overhead; /* 273*12*4 + 64* + ETH AND ORAN HDRs */
} else if (mu == 3) {
return 3328 + overhead;
} else {
assert(false && "numerology not supported\n");
}
}
uint32_t get_nFpgaToSW_FTH_RxBufferLen(int mu)
{
/* note: previous code checked MTU:
* mu <= 1: return mtu > XRAN_MTU_DEFAULT ? 13168 : XRAN_MTU_DEFAULT;
* mu == 3: return mtu > XRAN_MTU_DEFAULT ? 3328 : XRAN_MTU_DEFAULT;
* but I don't understand the interest: if the buffer is a big bigger, there
* is no problem, or we could just set the MTU size as buffer size?!
* Go with Max for the moment
*/
if (mu <= 1) {
return 13168; /* 273*12*4 + 64*/
} else if (mu == 3) {
return 3328;
} else {
assert(false && "numerology not supported\n");
}
}
static struct bbu_xran_io_if *p_app_io_xran_if;
......@@ -108,6 +137,9 @@ app_io_xran_fh_rx_prach_callback(void *pCallbackTag, xran_status_t status)
int32_t
app_io_xran_interface(uint32_t o_xu_id, RuntimeConfig *p_o_xu_cfg, UsecaseConfig* p_use_cfg)
{
uint32_t nFpgaToSW_FTH_RxBufferLen = get_nFpgaToSW_FTH_RxBufferLen(p_o_xu_cfg->mu_number);
uint32_t nSW_ToFpga_FTH_TxBufferLen = get_nSW_ToFpga_FTH_TxBufferLen(p_o_xu_cfg->mu_number, p_o_xu_cfg->max_sections_per_slot);
xran_status_t status;
struct bbu_xran_io_if *psBbuIo = app_io_xran_if_get();
struct xran_io_shared_ctrl *psIoCtrl = app_io_xran_if_ctrl_get(o_xu_id);
......@@ -399,34 +431,3 @@ void app_io_xran_if_stop(void)
iAssert(status == XRAN_STATUS_SUCCESS);
}
}
int32_t
app_io_xran_buffers_max_sz_set (RuntimeConfig* p_o_xu_cfg)
{
uint32_t xran_max_sections_per_slot = RTE_MAX(p_o_xu_cfg->max_sections_per_slot, XRAN_MIN_SECTIONS_PER_SLOT);
uint32_t overhead = xran_max_sections_per_slot
* (RTE_PKTMBUF_HEADROOM + sizeof(struct rte_ether_hdr) + sizeof(struct xran_ecpri_hdr)
+ sizeof(struct radio_app_common_hdr) + sizeof(struct data_section_hdr));
if (p_o_xu_cfg->mu_number <= 1){
nSW_ToFpga_FTH_TxBufferLen = 13168 + /* 273*12*4 + 64* + ETH AND ORAN HDRs */
overhead;
if (p_o_xu_cfg->mtu > XRAN_MTU_DEFAULT) {
nFpgaToSW_FTH_RxBufferLen = 13168; /* 273*12*4 + 64*/
} else {
nFpgaToSW_FTH_RxBufferLen = XRAN_MTU_DEFAULT; /* 273*12*4 + 64*/
}
} else if (p_o_xu_cfg->mu_number == 3) {
nSW_ToFpga_FTH_TxBufferLen = 3328 + overhead;
if (p_o_xu_cfg->mtu > XRAN_MTU_DEFAULT) {
nFpgaToSW_FTH_RxBufferLen = 3328;
} else {
nFpgaToSW_FTH_RxBufferLen = XRAN_MTU_DEFAULT;
}
} else {
printf("given numerology is not supported %d\n", p_o_xu_cfg->mu_number);
exit(-1);
}
printf("nSW_ToFpga_FTH_TxBufferLen %d\n", nSW_ToFpga_FTH_TxBufferLen);
return 0;
}
......@@ -125,10 +125,12 @@ void app_io_xran_if_free(void);
struct xran_io_shared_ctrl * app_io_xran_if_ctrl_get(uint32_t o_xu_id);
int32_t app_io_xran_interface(uint32_t o_xu_id, RuntimeConfig *p_o_xu_cfg, UsecaseConfig* p_use_cfg);
int32_t app_io_xran_buffers_max_sz_set (RuntimeConfig* p_o_xu_cfg);
void app_io_xran_if_stop(void);
uint32_t get_nSW_ToFpga_FTH_TxBufferLen(int mu, int sections);
uint32_t get_nFpgaToSW_FTH_RxBufferLen(int mu);
#ifdef __cplusplus
}
#endif
......
......@@ -603,8 +603,6 @@ int *oai_main(int argc, char *argv[])
/** process all the O-RU|O-DU for use case */
for (o_xu_id = 0; o_xu_id < p_usecaseConfiguration->oXuNum; o_xu_id++) {
RuntimeConfig* p_o_xu_cfg = p_startupConfiguration[o_xu_id];
if (o_xu_id == 0)
app_io_xran_buffers_max_sz_set(p_o_xu_cfg);
if (p_o_xu_cfg->ant_file[0] == NULL) {
printf("it looks like test vector for antennas were not provided\n");
......
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