Commit 08200783 authored by Robert Schmidt's avatar Robert Schmidt

Merge branch 'integration_2024_w21' into 'develop'

Integration: `2024.w21`

See merge request oai/openairinterface5g!2746

* !2717 Additional check on pucch_Config and srs_Config
* !2730 Fix for SSB index in function get_nr_prach_info_from_ssb_index
* !2734 add a function to reset the transmission timestamps chain
* !2741 Fix several potential segfaults in UE PUCCH tx power determination.
parents 0ad85cb1 73243f66
......@@ -829,6 +829,7 @@ void *UE_thread(void *arg)
if (start_rx_stream == 0) {
start_rx_stream=1;
syncInFrame(UE, &sync_timestamp, intialSyncOffset);
openair0_write_reorder_clear_context(&UE->rfdevice);
shiftForNextFrame = 0; // will be used to track clock drift
// read in first symbol
AssertFatal(UE->frame_parms.ofdm_symbol_size + UE->frame_parms.nb_prefix_samples0
......
......@@ -2072,13 +2072,15 @@ void release_PUCCH_SRS(NR_UE_MAC_INST_t *mac)
for (int bwp = 0; bwp < mac->ul_BWPs.count; bwp++) {
// release SchedulingRequestResourceConfig instances configured in PUCCH-Config
NR_PUCCH_Config_t *pucch_Config = mac->ul_BWPs.array[bwp]->pucch_Config;
for (int j = pucch_Config->schedulingRequestResourceToAddModList->list.count; j > 0 ; j--)
asn_sequence_del(&pucch_Config->schedulingRequestResourceToAddModList->list, j - 1, 1);
if (pucch_Config)
for (int j = pucch_Config->schedulingRequestResourceToAddModList->list.count; j > 0 ; j--)
asn_sequence_del(&pucch_Config->schedulingRequestResourceToAddModList->list, j - 1, 1);
// release SRS-Resource instances configured in SRS-Config
// TODO not clear if only SRS-Resources or also the ResourceSet should be released
NR_SRS_Config_t *srs_Config = mac->ul_BWPs.array[bwp]->srs_Config;
for (int j = srs_Config->srs_ResourceToAddModList->list.count; j > 0 ; j--)
asn_sequence_del(&srs_Config->srs_ResourceToAddModList->list, j - 1, 1);
if (srs_Config)
for (int j = srs_Config->srs_ResourceToAddModList->list.count; j > 0 ; j--)
asn_sequence_del(&srs_Config->srs_ResourceToAddModList->list, j - 1, 1);
}
}
......
......@@ -58,6 +58,9 @@
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#define DEFAULT_P0_NOMINAL_PUCCH_0_DBM 0
#define DEFAULT_DELTA_F_PUCCH_0_DB 0
// #define DEBUG_MIB
// #define ENABLE_MAC_PAYLOAD_DEBUG 1
// #define DEBUG_RAR
......@@ -1602,6 +1605,7 @@ int nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
return 0;
}
// PUCCH Power control according to 38.213 section 7.2.1
int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
int scs,
NR_PUCCH_Config_t *pucch_Config,
......@@ -1615,10 +1619,16 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
int O_uci)
{
NR_UE_UL_BWP_t *current_UL_BWP = mac->current_UL_BWP;
AssertFatal(current_UL_BWP && current_UL_BWP->pucch_ConfigCommon,
"Missing configuration: need UL_BWP and pucch_ConfigCommon to calculate PUCCH tx power\n");
int PUCCH_POWER_DEFAULT = 0;
int16_t P_O_NOMINAL_PUCCH = *current_UL_BWP->pucch_ConfigCommon->p0_nominal;
// p0_nominal is optional
int16_t P_O_NOMINAL_PUCCH = DEFAULT_P0_NOMINAL_PUCCH_0_DBM;
if (current_UL_BWP->pucch_ConfigCommon->p0_nominal != NULL) {
P_O_NOMINAL_PUCCH = *current_UL_BWP->pucch_ConfigCommon->p0_nominal;
}
struct NR_PUCCH_PowerControl *power_config = pucch_Config->pucch_PowerControl;
struct NR_PUCCH_PowerControl *power_config = pucch_Config ? pucch_Config->pucch_PowerControl : NULL;
if (!power_config)
return (PUCCH_POWER_DEFAULT);
......@@ -1643,7 +1653,8 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
int P_O_PUCCH = P_O_NOMINAL_PUCCH + P_O_UE_PUCCH;
int16_t delta_F_PUCCH;
int16_t delta_F_PUCCH = DEFAULT_DELTA_F_PUCCH_0_DB;
long *delta_F_PUCCH_config = NULL;
int DELTA_TF;
uint16_t N_ref_PUCCH;
int N_sc_ctrl_RB = 0;
......@@ -1653,27 +1664,27 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
case 0:
N_ref_PUCCH = 2;
DELTA_TF = 10 * log10(N_ref_PUCCH/N_symb_PUCCH);
delta_F_PUCCH = *power_config->deltaF_PUCCH_f0;
delta_F_PUCCH_config = power_config->deltaF_PUCCH_f0;
break;
case 1:
N_ref_PUCCH = 14;
DELTA_TF = 10 * log10(N_ref_PUCCH/N_symb_PUCCH);
delta_F_PUCCH = *power_config->deltaF_PUCCH_f1;
delta_F_PUCCH_config = power_config->deltaF_PUCCH_f1;
break;
case 2:
N_sc_ctrl_RB = 10;
DELTA_TF = get_deltatf(nb_of_prbs, N_symb_PUCCH, freq_hop_flag, add_dmrs_flag, N_sc_ctrl_RB, O_uci);
delta_F_PUCCH = *power_config->deltaF_PUCCH_f2;
delta_F_PUCCH_config = power_config->deltaF_PUCCH_f2;
break;
case 3:
N_sc_ctrl_RB = 14;
DELTA_TF = get_deltatf(nb_of_prbs, N_symb_PUCCH, freq_hop_flag, add_dmrs_flag, N_sc_ctrl_RB, O_uci);
delta_F_PUCCH = *power_config->deltaF_PUCCH_f3;
delta_F_PUCCH_config = power_config->deltaF_PUCCH_f3;
break;
case 4:
N_sc_ctrl_RB = 14/(nb_pucch_format_4_in_subframes[subframe_number]);
DELTA_TF = get_deltatf(nb_of_prbs, N_symb_PUCCH, freq_hop_flag, add_dmrs_flag, N_sc_ctrl_RB, O_uci);
delta_F_PUCCH = *power_config->deltaF_PUCCH_f4;
delta_F_PUCCH_config = power_config->deltaF_PUCCH_f4;
break;
default:
{
......@@ -1681,6 +1692,9 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
return (0);
}
}
if (delta_F_PUCCH_config != NULL) {
delta_F_PUCCH = *delta_F_PUCCH_config;
}
if (power_config->twoPUCCH_PC_AdjustmentStates && *power_config->twoPUCCH_PC_AdjustmentStates > 1) {
LOG_E(MAC,"PUCCH power control adjustment states with 2 states not yet implemented\n");
......
......@@ -1884,13 +1884,12 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac)
// Returns a RACH occasion if any matches the SSB idx, the frame and the slot
static int get_nr_prach_info_from_ssb_index(prach_association_pattern_t *prach_assoc_pattern,
uint8_t ssb_idx,
int ssb_idx,
int frame,
int slot,
ssb_list_info_t *ssb_list,
prach_occasion_info_t **prach_occasion_info_pp)
{
ssb_info_t *ssb_info_p;
prach_occasion_slot_t *prach_occasion_slot_p = NULL;
*prach_occasion_info_pp = NULL;
......@@ -1900,14 +1899,20 @@ static int get_nr_prach_info_from_ssb_index(prach_association_pattern_t *prach_a
// - ssb_idx mapped to one of the ROs in that RO slot
// - exact slot number
// - frame offset
ssb_info_p = &ssb_list->tx_ssb[ssb_idx];
int idx_list = ssb_list->nb_ssb_per_index[ssb_idx];
ssb_info_t *ssb_info_p = &ssb_list->tx_ssb[idx_list];
LOG_D(NR_MAC, "checking for prach : ssb_info_p->nb_mapped_ro %d\n", ssb_info_p->nb_mapped_ro);
for (uint8_t n_mapped_ro=0; n_mapped_ro<ssb_info_p->nb_mapped_ro; n_mapped_ro++) {
LOG_D(NR_MAC,"%d.%d: mapped_ro[%d]->frame.slot %d.%d, prach_assoc_pattern->nb_of_frame %d\n",
frame,slot,n_mapped_ro,ssb_info_p->mapped_ro[n_mapped_ro]->frame,ssb_info_p->mapped_ro[n_mapped_ro]->slot,prach_assoc_pattern->nb_of_frame);
for (int n_mapped_ro = 0; n_mapped_ro < ssb_info_p->nb_mapped_ro; n_mapped_ro++) {
LOG_D(NR_MAC,
"%d.%d: mapped_ro[%d]->frame.slot %d.%d, prach_assoc_pattern->nb_of_frame %d\n",
frame,
slot,
n_mapped_ro,
ssb_info_p->mapped_ro[n_mapped_ro]->frame,
ssb_info_p->mapped_ro[n_mapped_ro]->slot,
prach_assoc_pattern->nb_of_frame);
if ((slot == ssb_info_p->mapped_ro[n_mapped_ro]->slot) &&
(ssb_info_p->mapped_ro[n_mapped_ro]->frame == (frame % prach_assoc_pattern->nb_of_frame))) {
uint8_t prach_config_period_nb = ssb_info_p->mapped_ro[n_mapped_ro]->frame / prach_assoc_pattern->prach_conf_period_list[0].nb_of_frame;
uint8_t frame_nb_in_prach_config_period = ssb_info_p->mapped_ro[n_mapped_ro]->frame % prach_assoc_pattern->prach_conf_period_list[0].nb_of_frame;
prach_occasion_slot_p = &prach_assoc_pattern->prach_conf_period_list[prach_config_period_nb].prach_occasion_slot_map[frame_nb_in_prach_config_period][slot];
......
......@@ -269,3 +269,20 @@ int openair0_write_reorder(openair0_device *device, openair0_timestamp timestamp
}
return nsamps;
}
void openair0_write_reorder_clear_context(openair0_device *device)
{
LOG_I(HW, "received write reorder clear context\n");
re_order_t *ctx = &device->reOrder;
if (!ctx->initDone)
return;
if (pthread_mutex_trylock(&ctx->mutex_write) == 0)
LOG_E(HW, "write_reorder_clear_context call while still writing on the device\n");
pthread_mutex_destroy(&ctx->mutex_write);
pthread_mutex_lock(&ctx->mutex_store);
for (int i = 0; i < WRITE_QUEUE_SZ; i++)
ctx->queue[i].active = false;
pthread_mutex_unlock(&ctx->mutex_store);
pthread_mutex_destroy(&ctx->mutex_store);
ctx->initDone = false;
}
......@@ -671,7 +671,7 @@ extern int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **r
extern void iqrecorder_end(openair0_device *device);
int openair0_write_reorder(openair0_device *device, openair0_timestamp timestamp, void **txp, int nsamps, int nbAnt, int flags);
void openair0_write_reorder_clear_context(openair0_device *device);
#include <unistd.h>
#ifndef gettid
#define gettid() syscall(__NR_gettid)
......
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