Commit 530f9627 authored by Robert Schmidt's avatar Robert Schmidt Committed by Teodora

Rearrange FHI architecture to support M-plane

Co-authored-by: default avatarTeodora <teodora.vladic@openairinterface.org>
parent 5d1c0aaa
...@@ -560,7 +560,7 @@ uint8_t *get_ether_addr(const char *addr, struct rte_ether_addr *ether_addr) ...@@ -560,7 +560,7 @@ uint8_t *get_ether_addr(const char *addr, struct rte_ether_addr *ether_addr)
return NULL; return NULL;
} }
bool set_fh_init(struct xran_fh_init *fh_init) static bool set_fh_init(struct xran_fh_init *fh_init)
{ {
memset(fh_init, 0, sizeof(*fh_init)); memset(fh_init, 0, sizeof(*fh_init));
...@@ -765,7 +765,7 @@ static bool set_maxmin_pd(const paramdef_t *pd, int num, const char *name, uint1 ...@@ -765,7 +765,7 @@ static bool set_maxmin_pd(const paramdef_t *pd, int num, const char *name, uint1
} }
extern uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw); extern uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
bool set_fh_config(int ru_idx, int num_rus, const openair0_config_t *oai0, struct xran_fh_config *fh_config) static bool set_fh_config(int ru_idx, int num_rus, const openair0_config_t *oai0, struct xran_fh_config *fh_config)
{ {
AssertFatal(num_rus == 1 || num_rus == 2, "only support 1 or 2 RUs as of now\n"); AssertFatal(num_rus == 1 || num_rus == 2, "only support 1 or 2 RUs as of now\n");
AssertFatal(ru_idx < num_rus, "illegal ru_idx %d: must be < %d\n", ru_idx, num_rus); AssertFatal(ru_idx < num_rus, "illegal ru_idx %d: must be < %d\n", ru_idx, num_rus);
...@@ -886,3 +886,20 @@ bool set_fh_config(int ru_idx, int num_rus, const openair0_config_t *oai0, struc ...@@ -886,3 +886,20 @@ bool set_fh_config(int ru_idx, int num_rus, const openair0_config_t *oai0, struc
return true; return true;
} }
bool get_xran_config(const openair0_config_t *openair0_cfg, struct xran_fh_init *fh_init, struct xran_fh_config *fh_config)
{
if (!set_fh_init(fh_init)) {
printf("could not read FHI 7.2/ORAN config\n");
return false;
}
for (int32_t o_xu_id = 0; o_xu_id < fh_init->xran_ports; o_xu_id++) {
if (!set_fh_config(o_xu_id, fh_init->xran_ports, openair0_cfg, &fh_config[o_xu_id])) {
printf("could not read FHI 7.2/RU-specific config\n");
return false;
}
}
return true;
}
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
#include "stdint.h" #include "stdint.h"
struct xran_fh_init; struct xran_fh_init;
void print_fh_init(const struct xran_fh_init *fh_init);
struct xran_fh_config; struct xran_fh_config;
void print_fh_config(const struct xran_fh_config *fh_config);
bool set_fh_init(struct xran_fh_init *fh_init);
struct openair0_config; struct openair0_config;
bool set_fh_config(int ru_idx, int num_rus, const struct openair0_config *oai0_cfg, struct xran_fh_config *fh_config);
bool get_xran_config(const struct openair0_config *openair0_cfg, struct xran_fh_init *fh_init, struct xran_fh_config *fh_config);
void print_fh_init(const struct xran_fh_init *fh_init);
void print_fh_config(const struct xran_fh_config *fh_config);
// hack to workaround LiteOn limitation // hack to workaround LiteOn limitation
extern int g_kbar; extern int g_kbar;
......
...@@ -396,35 +396,20 @@ static void oran_allocate_buffers(void *handle, ...@@ -396,35 +396,20 @@ static void oran_allocate_buffers(void *handle,
xran_5g_prach_req(pi->instanceHandle, prach, prachdecomp, oai_xran_fh_rx_prach_callback, &portInstances->prach_tag); xran_5g_prach_req(pi->instanceHandle, prach, prachdecomp, oai_xran_fh_rx_prach_callback, &portInstances->prach_tag);
} }
int *oai_oran_initialize(const openair0_config_t *openair0_cfg) int *oai_oran_initialize(struct xran_fh_init *xran_fh_init, struct xran_fh_config *xran_fh_config)
{ {
int32_t xret = 0; int32_t xret = 0;
struct xran_fh_init init = {0}; print_fh_init(xran_fh_init);
if (!set_fh_init(&init)) { xret = xran_init(0, NULL, xran_fh_init, NULL, &gxran_handle);
printf("could not read FHI 7.2/ORAN config\n");
return NULL;
}
print_fh_init(&init);
/* read all configuration before starting anything */
struct xran_fh_config xran_fh_config[XRAN_PORTS_NUM] = {0};
for (int32_t o_xu_id = 0; o_xu_id < init.xran_ports; o_xu_id++) {
if (!set_fh_config(o_xu_id, init.xran_ports, openair0_cfg, &xran_fh_config[o_xu_id])) {
printf("could not read FHI 7.2/RU-specific config\n");
return NULL;
}
print_fh_config(&xran_fh_config[o_xu_id]);
}
xret = xran_init(0, NULL, &init, NULL, &gxran_handle);
if (xret != XRAN_STATUS_SUCCESS) { if (xret != XRAN_STATUS_SUCCESS) {
printf("xran_init failed %d\n", xret); printf("xran_init failed %d\n", xret);
exit(-1); exit(-1);
} }
/** process all the O-RU|O-DU for use case */ /** process all the O-RU|O-DU for use case */
for (int32_t o_xu_id = 0; o_xu_id < init.xran_ports; o_xu_id++) { for (int32_t o_xu_id = 0; o_xu_id < xran_fh_init->xran_ports; o_xu_id++) {
print_fh_config(&xran_fh_config[o_xu_id]);
xret = xran_open(gxran_handle, &xran_fh_config[o_xu_id]); xret = xran_open(gxran_handle, &xran_fh_config[o_xu_id]);
if (xret != XRAN_STATUS_SUCCESS) { if (xret != XRAN_STATUS_SUCCESS) {
printf("xran_open failed %d\n", xret); printf("xran_open failed %d\n", xret);
...@@ -432,7 +417,7 @@ int *oai_oran_initialize(const openair0_config_t *openair0_cfg) ...@@ -432,7 +417,7 @@ int *oai_oran_initialize(const openair0_config_t *openair0_cfg)
} }
int sector = 0; int sector = 0;
printf("Initialize ORAN port instance %d (%d) sector %d\n", o_xu_id, init.xran_ports, sector); printf("Initialize ORAN port instance %d (%d) sector %d\n", o_xu_id, xran_fh_init->xran_ports, sector);
oran_port_instance_t *pi = &gPortInst[o_xu_id][sector]; oran_port_instance_t *pi = &gPortInst[o_xu_id][sector];
struct xran_cb_tag tag = {.cellId = sector, .oXuId = o_xu_id}; struct xran_cb_tag tag = {.cellId = sector, .oXuId = o_xu_id};
pi->prach_tag = tag; pi->prach_tag = tag;
......
...@@ -57,7 +57,6 @@ typedef struct oran_port_instance_t { ...@@ -57,7 +57,6 @@ typedef struct oran_port_instance_t {
extern struct xran_fh_config gxran_fh_config[XRAN_PORTS_NUM]; extern struct xran_fh_config gxran_fh_config[XRAN_PORTS_NUM];
extern void *gxran_handle; extern void *gxran_handle;
struct openair0_config; int *oai_oran_initialize(struct xran_fh_init *fh_init, struct xran_fh_config *fh_config);
int *oai_oran_initialize(const struct openair0_config *openair0_cfg);
#endif /* ORAN_INIT_H */ #endif /* ORAN_INIT_H */
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "openair1/PHY/defs_gNB.h" #include "openair1/PHY/defs_gNB.h"
#include "common/utils/threadPool/thread-pool.h" #include "common/utils/threadPool/thread-pool.h"
#include "oaioran.h" #include "oaioran.h"
#include "oran-config.h"
// include the following file for VERSIONX, version of xran lib, to print it during // include the following file for VERSIONX, version of xran lib, to print it during
// startup. Only relevant for printing, if it ever makes problem, remove this // startup. Only relevant for printing, if it ever makes problem, remove this
...@@ -317,7 +318,16 @@ __attribute__((__visibility__("default"))) int transport_init(openair0_device *d ...@@ -317,7 +318,16 @@ __attribute__((__visibility__("default"))) int transport_init(openair0_device *d
LOG_I(HW, "Initializing O-RAN 7.2 FH interface through xran library (compiled against headers of %s)\n", VERSIONX); LOG_I(HW, "Initializing O-RAN 7.2 FH interface through xran library (compiled against headers of %s)\n", VERSIONX);
initNotifiedFIFO(&oran_sync_fifo); initNotifiedFIFO(&oran_sync_fifo);
eth->oran_priv = oai_oran_initialize(openair0_cfg);
struct xran_fh_init fh_init = {0};
struct xran_fh_config fh_config[XRAN_PORTS_NUM] = {0};
#ifndef OAI_MPLANE_SUPPORT
bool success = get_xran_config(openair0_cfg, &fh_init, fh_config);
AssertFatal(success, "cannot get configuration for xran\n");
#else
/* TODO: M-plane integration */
#endif
eth->oran_priv = oai_oran_initialize(&fh_init, fh_config);
AssertFatal(eth->oran_priv != NULL, "can not initialize fronthaul"); AssertFatal(eth->oran_priv != NULL, "can not initialize fronthaul");
// create message queues for ORAN sync // create message queues for ORAN sync
return 0; return 0;
......
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