Commit bb35caeb authored by Ejaz Ahmed's avatar Ejaz Ahmed

Fixed interface's name conflicts; restricted tx and rx operations in specific...

Fixed interface's name conflicts; restricted tx and rx  operations in specific slots to fix an issue in USRP.
parent 9588e10d
......@@ -86,6 +86,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "nr_nas_msg_sim.h"
#include <openair1/PHY/MODULATION/nr_modulation.h>
#include "openair2/GNB_APP/gnb_paramdef.h"
#include "openair2/RRC/NR_UE/sl_preconfig_paramvalues.h"
extern const char *duplex_mode[];
THREAD_STRUCT thread_struct;
......@@ -323,7 +324,7 @@ void init_openair0(bool is_sidelink) {
uint64_t dl_carrier, ul_carrier;
openair0_cfg[card].configFilename = NULL;
openair0_cfg[card].threequarter_fs = frame_parms->threequarter_fs;
openair0_cfg[card].sample_rate = frame_parms->samples_per_subframe * 1e3;
openair0_cfg[card].sample_rate = IS_SOFTMODEM_RFSIM ? frame_parms->samples_per_subframe * 1e3 : 46080000;
openair0_cfg[card].samples_per_frame = frame_parms->samples_per_frame;
if (frame_parms->frame_type==TDD)
......@@ -479,11 +480,22 @@ int main( int argc, char **argv ) {
uint16_t node_number = get_softmodem_params()->node_number;
ue_id_g = (node_number == 0) ? 0 : node_number - 2;
AssertFatal(ue_id_g >= 0, "UE id is expected to be nonnegative.\n");
ueinfo_t ueinfo;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
paramdef_t SL_UEINFO[] = SL_UEINFO_DESC(ueinfo);
paramlist_def_t SL_UEINFOList = {SL_CONFIG_STRING_UEINFO, NULL, 0};
sprintf(aprefix, "%s.[%d]", SL_CONFIG_STRING_SL_PRECONFIGURATION, 0);
config_getlist(&SL_UEINFOList, NULL, 0, aprefix);
sprintf(aprefix, "%s.[%i].%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION, 0, SL_CONFIG_STRING_UEINFO, 0);
config_get(SL_UEINFO, sizeof(SL_UEINFO)/sizeof(paramdef_t), aprefix);
if(IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa || get_softmodem_params()->nsa) {
if(node_number == 0) {
if(node_number == 0 && get_softmodem_params()->sl_mode == 0) {
init_pdcp(0);
}
else {
} else if (get_softmodem_params()->sl_mode == 2) {
init_pdcp(1+ueinfo.srcid);
} else {
init_pdcp(mode_offset + ue_id_g);
}
}
......@@ -538,7 +550,7 @@ int main( int argc, char **argv ) {
if (UE[CC_id]->sl_mode) {
AssertFatal(UE[CC_id]->sl_mode == 2, "Only Sidelink mode 2 supported. Mode 1 not yet supported\n");
nr_UE_configure_Sidelink(0, get_nrUE_params()->sync_ref);
nr_UE_configure_Sidelink(0, get_nrUE_params()->sync_ref, &ueinfo);
DevAssert(mac->if_module != NULL && mac->if_module->sl_phy_config_request != NULL);
sl_nr_ue_phy_params_t *sl_phy = &UE[CC_id]->SL_UE_PHY_PARAMS;
mac->if_module->sl_phy_config_request(&mac->SL_MAC_PARAMS->sl_phy_config);
......
......@@ -5,7 +5,11 @@
#include "PHY/defs_nr_UE.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h"
typedef struct ueinfo {
int srcid;
int thirdOctet;
int fourthOctet;
} ueinfo_t;
#define CONFIG_HLP_IF_FREQ "IF frequency for RF, if needed\n"
#define CONFIG_HLP_IF_FREQ_OFF "UL IF frequency offset for RF, if needed\n"
......
......@@ -134,8 +134,8 @@ int nr_slsch_procedures(PHY_VARS_NR_UE *ue, int frame_rx, int slot_rx, int SLSCH
sl_nr_rx_config_pssch_pdu_t *slsch_pdu = &phy_data->nr_sl_pssch_pdu; //ue->slsch[SLSCH_id].harq_process->slsch_pdu;
sl_nr_rx_config_pssch_sci_pdu_t *pssch_pdu = &phy_data->nr_sl_pssch_sci_pdu; //ue->slsch[SLSCH_id].harq_process->pssch_pdu;
uint8_t freq_density;
uint8_t nr_of_rbs;
uint8_t freq_density = 0;
uint8_t nr_of_rbs = 0;
if (is_csi_rs_slot) {
freq_density = ue->csirs_vars[0]->csirs_config_pdu.freq_density;
nr_of_rbs = ue->csirs_vars[0]->csirs_config_pdu.nr_of_rbs;
......
......@@ -47,6 +47,7 @@
#include "common/openairinterface5g_limits.h"
#include "pdcp.h"
#include <executables/nr-uesoftmodem.h>
char nl_rx_buf[NL_MAX_PAYLOAD];
......@@ -138,21 +139,23 @@ int netlink_init_tun(char *ifprefix, int num_if, int id) {//for UE, id = 1, 2, .
int begx = (id == 0) ? 0 : id - 1;
int endx = (id == 0) ? num_if : id;
int index;
for (int i = begx; i < endx; i++) {
sprintf(ifname, "oaitun_%.3s%d",ifprefix,i+1);
nas_sock_fd[i] = tun_alloc(ifname);
sprintf(ifname, "oaitun_%.3s%d", ifprefix, i+1);
index = get_softmodem_params()->sl_mode ? 0 : i;
nas_sock_fd[index] = tun_alloc(ifname);
if (nas_sock_fd[i] == -1) {
LOG_E(PDCP, "TUN: Error opening socket %s (%d:%s)\n",ifname,errno, strerror(errno));
if (nas_sock_fd[index] == -1) {
LOG_E(PDCP, "TUN: Error opening socket %s (%d:%s)\n", ifname, errno, strerror(errno));
exit(1);
}
LOG_I(PDCP, "TUN: Opened socket %s with fd nas_sock_fd[%d]=%d\n",
ifname, i, nas_sock_fd[i]);
ret = fcntl(nas_sock_fd[i],F_SETFL,O_NONBLOCK);
ifname, i, nas_sock_fd[index]);
ret = fcntl(nas_sock_fd[index], F_SETFL, O_NONBLOCK);
if (ret == -1) {
LOG_E(PDCP, "TUN: Error fcntl (%d:%s)\n",errno, strerror(errno));
LOG_E(PDCP, "TUN: Error fcntl (%d:%s)\n", errno, strerror(errno));
if (LINK_ENB_PDCP_TO_IP_DRIVER) {
exit(1);
......
......@@ -55,7 +55,7 @@ bool nr_schedule_slsch(NR_UE_MAC_INST_t *mac, int frameP,int slotP, nr_sci_pdu_t
*slsch_pdu_length_max = 0;
bool csi_acq = !mac->SL_MAC_PARAMS->sl_CSI_Acquisition;
bool csi_req_slot = !((slots_per_frame * frameP + slotP - sl_mac->slot_offset) % sl_mac->slot_periodicity);
if (rlc_status.bytes_in_buffer > 0 || mac->sci_pdu_rx.harq_feedback || (csi_acq && csi_req_slot)) {
if (rlc_status.bytes_in_buffer > 0 || mac->sci_pdu_rx.harq_feedback || (csi_acq && csi_req_slot) || mac->sl_csi_report) {
// Fill SCI1A
sci_pdu->priority = 0;
sci_pdu->frequency_resource_assignment.val = 0;
......@@ -81,7 +81,7 @@ bool nr_schedule_slsch(NR_UE_MAC_INST_t *mac, int frameP,int slotP, nr_sci_pdu_t
sci2_pdu->cast_type = 1;
if (format2 == NR_SL_SCI_FORMAT_2C || format2 == NR_SL_SCI_FORMAT_2A) {
sci2_pdu->csi_req = (csi_acq && csi_req_slot) ? 1 : 0;
LOG_D(NR_MAC, "Setting sci2_pdu->csi_req %d (%d.%d)\n", sci2_pdu->csi_req, frameP, slotP);
LOG_D(NR_MAC, "%4d.%2d Setting sci2_pdu->csi_req %d\n", frameP, slotP, sci2_pdu->csi_req);
}
if (format2 == NR_SL_SCI_FORMAT_2B)
sci2_pdu->zone_id = 0;
......
......@@ -726,7 +726,7 @@ void configure_psfch_params(int module_idP,
psfch_pdu->group_hop_flag = 0;
psfch_pdu->second_hop_prb = 0;
psfch_pdu->bit_len_harq = 1;
LOG_D(NR_MAC,"Filled psfch pdu\n");
LOG_D(NR_MAC, "Filled psfch pdu\n");
}
void configure_csi_report_params(NR_UE_MAC_INST_t* mac) {
......@@ -750,21 +750,24 @@ void nr_ue_process_mac_sl_pdu(int module_idP,
if (!pduP){
return;
}
if (mac->sci_pdu_rx.harq_feedback) {
uint8_t psfch_period = 0;
if (mac->sl_tx_res_pool->sl_PSFCH_Config_r16 && mac->sl_tx_res_pool->sl_PSFCH_Config_r16->choice.setup->sl_PSFCH_Period_r16)
psfch_period = *mac->sl_tx_res_pool->sl_PSFCH_Config_r16->choice.setup->sl_PSFCH_Period_r16;
if (psfch_period && mac->sci_pdu_rx.harq_feedback) {
configure_psfch_params(module_idP, mac, rx_ind, pdu_id);
}
if ((rx_ind->rx_indication_body + pdu_id)->rx_slsch_pdu.ack_nack == 0)
return;
if (mac->sci_pdu_rx.csi_req) {
LOG_D(NR_MAC, "%4d.%2d Configuring sl_csi_report parameters\n", frame, slot);
configure_csi_report_params(mac);
}
if ((rx_ind->rx_indication_body + pdu_id)->rx_slsch_pdu.ack_nack == 0)
return;
LOG_D(NR_MAC, "In %s : processing PDU %d (with length %d) of %d total number of PDUs...\n", __FUNCTION__, pdu_id, pdu_len, rx_ind->number_pdus);
NR_SLSCH_MAC_SUBHEADER_FIXED *sl_sch_subheader = (NR_SLSCH_MAC_SUBHEADER_FIXED *) pduP;
LOG_D(NR_PHY, "Rx V %d R %d SRC %d DST %d\n", sl_sch_subheader->V, sl_sch_subheader->R, sl_sch_subheader->SRC, sl_sch_subheader->DST);
LOG_D(NR_PHY, "%4d.%2d Rx V %d R %d SRC %d DST %d\n", frame, slot, sl_sch_subheader->V, sl_sch_subheader->R, sl_sch_subheader->SRC, sl_sch_subheader->DST);
pduP += sizeof(*sl_sch_subheader);
pdu_len -= sizeof(*sl_sch_subheader);
while (!done && pdu_len > 0) {
......
......@@ -3313,7 +3313,7 @@ bool nr_ue_sl_pssch_scheduler(NR_UE_MAC_INST_t *mac,
sl_sch_subheader->SRC = get_softmodem_params()->node_number;
sl_sch_subheader->DST = 0xab;
pdu += sizeof(NR_SLSCH_MAC_SUBHEADER_FIXED);
LOG_D(NR_PHY, "Tx V %d, R %d, SRC %d, DST %d\n", sl_sch_subheader->V, sl_sch_subheader->R, sl_sch_subheader->SRC, sl_sch_subheader->DST);
LOG_D(NR_PHY, "%4d.%2d Tx V %d, R %d, SRC %d, DST %d\n", frame, slot, sl_sch_subheader->V, sl_sch_subheader->R, sl_sch_subheader->SRC, sl_sch_subheader->DST);
int buflen_remain = buflen - sizeof(NR_SLSCH_MAC_SUBHEADER_FIXED);
LOG_D(NR_PHY, "buflen_remain after adding SL_SCH_MAC_SUBHEADER_FIXED %d\n", buflen_remain);
......@@ -3609,13 +3609,13 @@ void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind) {
}
if (sl_ind->slot_type==SIDELINK_SLOT_TYPE_TX || sl_ind->phy_data==NULL) rx_allowed=false;
if (((get_nrUE_params()->sync_ref && sl_ind->slot_rx > 5) ||
(!get_nrUE_params()->sync_ref && sl_ind->slot_rx < 17)) && rx_allowed && !is_psbch_slot) {
LOG_D(NR_MAC,"Scheduling PSCCH RX processing slot %d, sync_ref %d\n",slot,get_nrUE_params()->sync_ref);
if (((get_nrUE_params()->sync_ref && (sl_ind->slot_rx == 2 || sl_ind->slot_rx == 13 || sl_ind->slot_rx == 12)) ||
(!get_nrUE_params()->sync_ref && (sl_ind->slot_rx == 3 || sl_ind->slot_rx == 5 || sl_ind->slot_rx == 15))) && rx_allowed && !is_psbch_slot) {
nr_ue_sl_pscch_rx_scheduler(sl_ind, mac->sl_bwp, mac->sl_rx_res_pool,&rx_config, &tti_action);
}
if (!is_psbch_slot && tx_allowed && sl_ind->slot_type == SIDELINK_SLOT_TYPE_TX) {
if ((!get_nrUE_params()->sync_ref && !is_psbch_slot && tx_allowed && sl_ind->slot_type == SIDELINK_SLOT_TYPE_TX && (slot == 2 || slot == 13 || slot == 12)) ||
(get_nrUE_params()->sync_ref && !is_psbch_slot && tx_allowed && sl_ind->slot_type == SIDELINK_SLOT_TYPE_TX && (slot == 3 || slot == 5 || slot == 15))) {
//Check if reserved slot or a sidelink resource configured in Rx/Tx resource pool timeresource bitmap
bool schedule_slsch = nr_ue_sl_pssch_scheduler(mac, sl_ind, mac->sl_bwp, mac->sl_tx_res_pool, &tx_config, &tti_action);
bool is_csi_rs_sent = false;
......
......@@ -802,7 +802,7 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea
{
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
{
nfapi_nr_dl_tti_request_t *dl_tti_request = MALLOC(sizeof(*dl_tti_request));
nfapi_nr_dl_tti_request_t *dl_tti_request = malloc(sizeof(*dl_tti_request));
if (nfapi_nr_p7_message_unpack(buffer, len, dl_tti_request,
sizeof(*dl_tti_request), NULL) < 0)
{
......@@ -826,7 +826,7 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea
case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
{
nfapi_nr_tx_data_request_t *tx_data_request = MALLOC(sizeof(*tx_data_request));
nfapi_nr_tx_data_request_t *tx_data_request = malloc(sizeof(*tx_data_request));
if (nfapi_nr_p7_message_unpack(buffer, len, tx_data_request,
sizeof(*tx_data_request), NULL) < 0)
{
......@@ -846,7 +846,7 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea
case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
{
nfapi_nr_ul_dci_request_t *ul_dci_request = MALLOC(sizeof(*ul_dci_request));
nfapi_nr_ul_dci_request_t *ul_dci_request = malloc(sizeof(*ul_dci_request));
if (nfapi_nr_p7_message_unpack(buffer, len, ul_dci_request,
sizeof(*ul_dci_request), NULL) < 0)
{
......@@ -866,7 +866,7 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
{
nfapi_nr_ul_tti_request_t *ul_tti_request = MALLOC(sizeof(*ul_tti_request));
nfapi_nr_ul_tti_request_t *ul_tti_request = malloc(sizeof(*ul_tti_request));
if (nfapi_nr_p7_message_unpack(buffer, len, ul_tti_request,
sizeof(*ul_tti_request), NULL) < 0)
{
......
......@@ -41,6 +41,7 @@
#include "NR_RadioBearerConfig.h"
#include "openair2/PHY_INTERFACE/queue_t.h"
#include "common/utils/ocp_itti/intertask_interface.h"
#include "executables/nr-uesoftmodem.h"
extern queue_t nr_rach_ind_queue;
extern queue_t nr_rx_ind_queue;
......@@ -174,7 +175,7 @@ void nr_rrc_handle_SetupRelease_RLF_TimersAndConstants(NR_UE_RRC_INST_t *rrc,
struct NR_SetupRelease_RLF_TimersAndConstants *rlf_TimersAndConstants);
int configure_NR_SL_Preconfig(uint8_t id,int sync_source);
void nr_UE_configure_Sidelink(uint8_t id, uint8_t is_sync_source);
void nr_UE_configure_Sidelink(uint8_t id, uint8_t is_sync_source, ueinfo_t *ueinfo);
/** @}*/
#endif
......
......@@ -31,6 +31,7 @@
#include "rrc_vars.h"
#include "LAYER2/NR_MAC_UE/mac_proto.h"
#include "RRC/NAS/nas_config.h"
#include "executables/nr-uesoftmodem.h"
#define GNSS_SUPPORT 0
......@@ -560,7 +561,7 @@ int configure_NR_SL_Preconfig(uint8_t id,int sync_source)
* RRC configures MAC with sidelink parameters
* In case UE is a sync source/Master UE - then sends transmit SLSS REQ
*/
void nr_UE_configure_Sidelink(uint8_t id, uint8_t is_sync_source) {
void nr_UE_configure_Sidelink(uint8_t id, uint8_t is_sync_source, ueinfo_t *ueinfo) {
NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[id];
......@@ -576,31 +577,18 @@ void nr_UE_configure_Sidelink(uint8_t id, uint8_t is_sync_source) {
: SL_SYNC_SOURCE_LOCAL_TIMING;
}
struct {
int srcid;
int thirdOctet;
int fourthOctet;
} ueinfo;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
paramdef_t SL_UEINFO[] = SL_UEINFO_DESC(ueinfo);
paramlist_def_t SL_UEINFOList = {SL_CONFIG_STRING_UEINFO, NULL, 0};
sprintf(aprefix, "%s.[%d]", SL_CONFIG_STRING_SL_PRECONFIGURATION,0);
config_getlist(&SL_UEINFOList,NULL,0,aprefix);
sprintf(aprefix, "%s.[%i].%s.[%i]", SL_CONFIG_STRING_SL_PRECONFIGURATION, 0, SL_CONFIG_STRING_UEINFO, 0);
config_get(SL_UEINFO,sizeof(SL_UEINFO)/sizeof(paramdef_t),aprefix);
LOG_I(NR_RRC,"SL L2 SRCid %x, SL ipv4 addr X.X.%d.%d\n",ueinfo.srcid,ueinfo.thirdOctet,ueinfo.fourthOctet);
nas_config(1 + ueinfo.srcid, ueinfo.thirdOctet, ueinfo.fourthOctet, "oai_sl_tun");
nr_rrc_mac_config_req_sl_preconfig(id, sl_preconfig, sync_source, ueinfo.srcid);
LOG_D(NR_RRC, "SL L2 SRCid %x, SL ipv4 addr X.X.%d.%d\n", ueinfo->srcid, ueinfo->thirdOctet, ueinfo->fourthOctet);
nas_config(1 + ueinfo->srcid, ueinfo->thirdOctet, ueinfo->fourthOctet, "oai_sl_tun");
nr_rrc_mac_config_req_sl_preconfig(id, sl_preconfig, sync_source, ueinfo->srcid);
// SL RadioBearers
for (int i=0;i<sl_preconfig->sidelinkPreconfigNR_r16.sl_RadioBearerPreConfigList_r16->list.count;i++) {
add_drb_sl(ueinfo.srcid,(NR_SL_RadioBearerConfig_r16_t *)sl_preconfig->sidelinkPreconfigNR_r16.sl_RadioBearerPreConfigList_r16->list.array[i],0,0,NULL,NULL);
for (int i=0; i<sl_preconfig->sidelinkPreconfigNR_r16.sl_RadioBearerPreConfigList_r16->list.count; i++) {
add_drb_sl(ueinfo->srcid, (NR_SL_RadioBearerConfig_r16_t *)sl_preconfig->sidelinkPreconfigNR_r16.sl_RadioBearerPreConfigList_r16->list.array[i], 0, 0, NULL, NULL);
}
// configure RLC
for (int i=0;i<sl_preconfig->sidelinkPreconfigNR_r16.sl_RLC_BearerPreConfigList_r16->list.count;i++) {
nr_rlc_add_drb_sl(ueinfo.srcid,1,(NR_SL_RLC_BearerConfig_r16_t *)sl_preconfig->sidelinkPreconfigNR_r16.sl_RLC_BearerPreConfigList_r16->list.array[i]);
for (int i=0; i<sl_preconfig->sidelinkPreconfigNR_r16.sl_RLC_BearerPreConfigList_r16->list.count; i++) {
nr_rlc_add_drb_sl(ueinfo->srcid, 1, (NR_SL_RLC_BearerConfig_r16_t *)sl_preconfig->sidelinkPreconfigNR_r16.sl_RLC_BearerPreConfigList_r16->list.array[i]);
}
//TBD.. These should be chosen by RRC according to 3GPP 38.331 RRC specification.
//Currently hardcoding the values to these
......@@ -631,7 +619,7 @@ void nr_UE_configure_Sidelink(uint8_t id, uint8_t is_sync_source) {
AssertFatal(ssb_ta, "SSB_timeallocation cannot be NULL\n");
if (sync_source == SL_SYNC_SOURCE_LOCAL_TIMING || sync_source == SL_SYNC_SOURCE_GNSS)
nr_rrc_mac_transmit_slss_req(id,sl_mib_payload, slss_id, ssb_ta);
nr_rrc_mac_transmit_slss_req(id, sl_mib_payload, slss_id, ssb_ta);
}
......
......@@ -14,7 +14,7 @@ SIDELINK_PRECONFIGURATION = (
sl_powerControlOffset = 1;
sl_powerControlOffsetSS = 1;
slot_Offset = 0;
slot_Periodicity = 4;
slot_Periodicity = 5;
# Indicates if CSI Reporting is enabled in UNICAST. is 0-ENABLED, 1-DISABLED
sl_CSI_Acquisition = 0;
}
......
......@@ -14,7 +14,7 @@ SIDELINK_PRECONFIGURATION = (
sl_powerControlOffset = 1;
sl_powerControlOffsetSS = 1;
slot_Offset = 0;
slot_Periodicity = 4;
slot_Periodicity = 5;
# Indicates if CSI Reporting is enabled in UNICAST. is 0-ENABLED, 1-DISABLED
sl_CSI_Acquisition = 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