Files
openairinterface5g/radio/fhi_72/mplane/ru-mplane-api.h
T
Teodora 19bb463049 Properly free the memory
1. Create a free_ru_session_list() function to free the memory allocated for the connected RUs
before closing the nr-softmodem.
2. xmlReadMemory() and xmlNodeGetContent() were causing serious memory leakages,
and now all is properly freed using xmlFreeDoc() and xmlFree().
2025-10-30 17:22:40 +01:00

200 lines
4.9 KiB
C

/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef RU_MPLANE_API_H
#define RU_MPLANE_API_H
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "common/utils/LOG/log.h"
#define MP_LOG_I(x, args...) LOG_I(HW, "[MPLANE] " x, ##args)
#define MP_LOG_W(x, args...) LOG_W(HW, "[MPLANE] " x, ##args)
#define OPER_STATE \
X(ENABLED_OPER, "enabled") \
X(DISABLED_OPER, "disabled")
typedef enum {
#define X(name, str) name,
OPER_STATE
#undef X
OPER_COUNT
} oper_state_e;
oper_state_e str_to_enum_oper(const char* value);
#define ADMIN_STATE \
X(UNLOCKED_ADMIN, "unlocked") \
X(SHUTTING_DOWN_ADMIN, "shutting-down") \
X(LOCKED_ADMIN, "locked")
typedef enum {
#define X(name, str) name,
ADMIN_STATE
#undef X
ADMIN_COUNT
} admin_state_e;
admin_state_e str_to_enum_admin(const char* value);
#define AVAIL_STATE \
X(NORMAL_AVAIL, "NORMAL") \
X(DEGRADED_AVAIL, "DEGRADED") \
X(FAULTY_AVAIL, "FAULTY")
typedef enum {
#define X(name, str) name,
AVAIL_STATE
#undef X
AVAIL_COUNT
} avail_state_e;
avail_state_e str_to_enum_avail(const char* value);
typedef struct {
oper_state_e oper_state; // "enabled", "disabled"
admin_state_e admin_state; // "unlocked", "shutting-down", "locked"
avail_state_e avail_state; // "NORMAL", "DEGRADED", "FAULTY"
} hardware_notif_t;
#define PTP_STATE \
X(LOCKED_PTP, "LOCKED") \
X(FREERUN_PTP, "FREERUN") \
X(HOLDOVER_PTP, "HOLDOVER")
typedef enum {
#define X(name, str) name,
PTP_STATE
#undef X
PTP_COUNT
} ptp_state_e;
ptp_state_e str_to_enum_ptp(const char* value);
#define CARRIER_STATE \
X(READY_CARRIER, "READY") \
X(DISABLED_CARRIER, "DISABLED") \
X(BUSY_CARRIER, "BUSY")
typedef enum {
#define X(name, str) name,
CARRIER_STATE
#undef X
CARRIER_COUNT
} carrier_state_e;
carrier_state_e str_to_enum_carrier(const char* value);
typedef struct {
hardware_notif_t hardware;
ptp_state_e ptp_state; // "LOCKED", "FREERUN", "HOLDOVER"
carrier_state_e rx_carrier_state; // "READY", "DISABLED", "BUSY"
carrier_state_e tx_carrier_state; // "READY", "DISABLED", "BUSY"
bool config_change;
// to be extended with any notification callback
} ru_notif_t;
typedef struct {
char *ru_mac_addr;
uint32_t mtu;
int16_t iq_width;
uint8_t prach_offset;
// DU sends to RU and xran
uint16_t du_port_bitmask;
uint16_t band_sector_bitmask;
uint16_t ccid_bitmask;
uint16_t ru_port_bitmask;
// DU retrieves from RU, and sends to xran
uint8_t du_port;
uint8_t band_sector;
uint8_t ccid;
uint8_t ru_port;
int16_t frame_str; // might be needed in the future xran releases
bool managed_delay;
double max_tx_gain;
} xran_mplane_t;
typedef struct {
size_t num;
char **name;
} uplane_info_t;
typedef struct {
size_t num_cu_planes;
char **du_mac_addr; // one or two VF(s) for CU-planes
int32_t *vlan_tag; // one or two VF(s) for CU-planes
char *interface_name;
uplane_info_t tx_endpoints;
uplane_info_t rx_endpoints;
uplane_info_t tx_carriers;
uplane_info_t rx_carriers;
} ru_mplane_config_t;
typedef struct {
// activation if required at start-up timing
bool start_up_timing;
size_t rx_num;
char **rx_window_meas;
size_t tx_num;
char **tx_meas;
} pm_stats_t;
typedef struct {
char *username;
char *ru_ip_add;
ru_mplane_config_t ru_mplane_config;
void *session;
void *ctx;
xran_mplane_t xran_mplane;
ru_notif_t ru_notif;
pm_stats_t pm_stats;
} ru_session_t;
typedef struct {
size_t num_rus;
ru_session_t *ru_session;
char **du_key_pair;
} ru_session_list_t;
void free_ru_session_list(ru_session_list_t *src);
bool get_config_for_xran(const char *buffer, const int max_num_ant, xran_mplane_t *xran_mplane);
bool get_uplane_info(const char *buffer, ru_mplane_config_t *ru_mplane_config);
bool get_pm_object_list(const char *buffer, pm_stats_t *pm_stats);
#endif /* RU_MPLANE_API_H */