Commit e62f569b authored by Cedric Roux's avatar Cedric Roux
Browse files

Merge remote-tracking branch 'origin/various-l2-fixes-187' into develop_integration_w07

parents f9b5dafe 1b417979
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -59,3 +59,5 @@ typedef struct IF5_mobipass_header IF5_mobipass_header_t;
void send_IF5(PHY_VARS_eNB*, openair0_timestamp, int, uint8_t*, uint16_t);
void recv_IF5(PHY_VARS_eNB*, openair0_timestamp*, int, uint16_t);
void malloc_IF5_buffer(PHY_VARS_eNB*);
This diff is collapsed.
......@@ -78,7 +78,8 @@
void exit_fun(const char* s);
extern int exit_openair;
struct timespec start_fh, start_fh_prev;
int start_fh_sf, start_fh_prev_sf;
// Fix per CC openair rf/if device update
// extern openair0_device openair0;
......@@ -2751,6 +2752,10 @@ void eNB_fep_full(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc_rxtx) {
/// **** send_IF4 of rxdataF to RCC (no prach now) **** ///
LOG_D(PHY,"send_IF4p5 (PULFFT): frame %d, subframe %d\n",proc_rxtx->frame_rx,proc_rxtx->subframe_rx);
send_IF4p5(eNB, proc_rxtx->frame_rx, proc_rxtx->subframe_rx, IF4p5_PULFFT, 0);
start_fh_prev = start_fh;
start_fh_prev_sf = start_fh_sf;
clock_gettime( CLOCK_MONOTONIC, &start_fh);
start_fh_sf = proc_rxtx->subframe_rx;
}
}
......@@ -2762,6 +2767,10 @@ void eNB_fep_rru_if5(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc_rxtx) {
/// **** send_IF5 of rxdata to BBU **** ///
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF5, 1 );
send_IF5(eNB, proc->timestamp_rx, proc->subframe_rx, &seqno, IF5_RRH_GW_UL);
start_fh_prev = start_fh;
start_fh_prev_sf = start_fh_sf;
clock_gettime( CLOCK_MONOTONIC, &start_fh);
start_fh_sf = proc->subframe_rx;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF5, 0 );
}
......
......@@ -208,6 +208,7 @@
#define ENB_CONFIG_STRING_RRH_GW_IQ_TXSHIFT "iq_txshift"
#define ENB_CONFIG_STRING_RRH_GW_TX_SAMPLE_ADVANCE "tx_sample_advance"
#define ENB_CONFIG_STRING_RRH_GW_TX_SCHEDULING_ADVANCE "tx_scheduling_advance"
#define ENB_CONFIG_STRING_RRH_GW_IF_COMPRESSION "if_compression"
#define ENB_CONFIG_STRING_ASN1_VERBOSITY "Asn1_verbosity"
#define ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE "none"
......@@ -338,6 +339,7 @@ void enb_config_display(void)
} else {
printf( "\tRF target : \tNONE:\n");
}
printf( "\tif_compression : \t%s Compression:\n",(enb_properties.properties[i]->rrh_gw_config[j].if_compress == 1)? "ALAW" : "None");
}
}
......@@ -657,6 +659,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
char* ipv6 = NULL;
char* active = NULL;
char* preference = NULL;
char* if_compression = NULL;
char* tr_preference = NULL;
char* rf_preference = NULL;
......@@ -2327,82 +2330,91 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
// RRH Config
setting_rrh_gws = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_RRH_GW_CONFIG);
if ( setting_rrh_gws != NULL) {
num_rrh_gw = config_setting_length(setting_rrh_gws);
enb_properties.properties[enb_properties_index]->nb_rrh_gw = 0;
num_rrh_gw = config_setting_length(setting_rrh_gws);
enb_properties.properties[enb_properties_index]->nb_rrh_gw = 0;
for (j = 0; j < num_rrh_gw; j++) {
setting_rrh_gw = config_setting_get_elem(setting_rrh_gws, j);
if ( !(
config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME, (const char **)&if_name)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_LOCAL_ADDRESS, (const char **)&ipv4)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_REMOTE_ADDRESS , (const char **)&ipv4_remote)
&& config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_LOCAL_PORT, &local_port)
&& config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_REMOTE_PORT, &remote_port)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_ACTIVE, (const char **)&active)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_TRANSPORT_PREFERENCE, (const char **)&tr_preference)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_RF_TARGET_PREFERENCE, (const char **)&rf_preference)
&& config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_IQ_TXSHIFT, &iq_txshift)
&& config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_TX_SAMPLE_ADVANCE, &tx_sample_advance)
&& config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_TX_SCHEDULING_ADVANCE, &tx_scheduling_advance)
)
) {
AssertFatal (0,
"Failed to parse eNB configuration file %s, %u th enb %u the RRH GW address !\n",
lib_config_file_name_pP, i, j);
continue; // FIXME will prevent segfaults below, not sure what happens at function exit...
}
enb_properties.properties[enb_properties_index]->nb_rrh_gw += 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].rrh_gw_if_name = strdup(if_name);
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].local_address = strdup(ipv4);
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].remote_address = strdup(ipv4_remote);
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].local_port = local_port;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].remote_port = remote_port;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].iq_txshift = iq_txshift;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].tx_sample_advance = tx_sample_advance;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].tx_scheduling_advance= tx_scheduling_advance;
if (strcmp(active, "yes") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].active = 1;
}
if (strcmp(tr_preference, "udp") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 1;
} else if (strcmp(tr_preference, "raw") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 1;
} else if (strcmp(tr_preference, "udp_if4p5") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udpif4p5 = 1;
} else if (strcmp(tr_preference, "raw_if4p5") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].rawif4p5 = 1;
} else if (strcmp(tr_preference, "raw_if5_mobipass") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].rawif5_mobipass = 1;
} else {//if (strcmp(preference, "no") == 0)
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 1;
}
if (strcmp(rf_preference, "exmimo") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].exmimo = 1;
} else if (strcmp(rf_preference, "usrp_b200") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_b200 = 1;
} else if (strcmp(rf_preference, "usrp_x300") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_x300 = 1;
} else if (strcmp(rf_preference, "bladerf") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].bladerf = 1;
} else if (strcmp(rf_preference, "lmsdr") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].lmssdr = 1;
} else {//if (strcmp(preference, "no") == 0)
for (j = 0; j < num_rrh_gw; j++) {
setting_rrh_gw = config_setting_get_elem(setting_rrh_gws, j);
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].exmimo = 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_b200 = 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_x300 = 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].bladerf = 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].lmssdr = 1;
}
}
if ( !(
config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME, (const char **)&if_name)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_LOCAL_ADDRESS, (const char **)&ipv4)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_REMOTE_ADDRESS , (const char **)&ipv4_remote)
&& config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_LOCAL_PORT, &local_port)
&& config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_REMOTE_PORT, &remote_port)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_ACTIVE, (const char **)&active)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_TRANSPORT_PREFERENCE, (const char **)&tr_preference)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_RF_TARGET_PREFERENCE, (const char **)&rf_preference)
&& config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_IQ_TXSHIFT, &iq_txshift)
&& config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_TX_SAMPLE_ADVANCE, &tx_sample_advance)
&& config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_TX_SCHEDULING_ADVANCE, &tx_scheduling_advance)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_IF_COMPRESSION, (const char **)&if_compression)
)
) {
AssertFatal (0,
"Failed to parse eNB configuration file %s, %u th enb %u the RRH GW address !\n",
lib_config_file_name_pP, i, j);
continue; // FIXME will prevent segfaults below, not sure what happens at function exit...
}
enb_properties.properties[enb_properties_index]->nb_rrh_gw += 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].rrh_gw_if_name = strdup(if_name);
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].local_address = strdup(ipv4);
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].remote_address = strdup(ipv4_remote);
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].local_port = local_port;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].remote_port = remote_port;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].iq_txshift = iq_txshift;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].tx_sample_advance = tx_sample_advance;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].tx_scheduling_advance= tx_scheduling_advance;
if (strcmp(active, "yes") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].active = 1;
}
if (strcmp(tr_preference, "udp") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 1;
} else if (strcmp(tr_preference, "raw") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 1;
} else if (strcmp(tr_preference, "udp_if4p5") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udpif4p5 = 1;
} else if (strcmp(tr_preference, "raw_if4p5") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].rawif4p5 = 1;
} else if (strcmp(tr_preference, "raw_if5_mobipass") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].rawif5_mobipass = 1;
} else {//if (strcmp(preference, "no") == 0)
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 1;
}
if (strcmp(rf_preference, "exmimo") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].exmimo = 1;
} else if (strcmp(rf_preference, "usrp_b200") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_b200 = 1;
} else if (strcmp(rf_preference, "usrp_x300") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_x300 = 1;
} else if (strcmp(rf_preference, "bladerf") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].bladerf = 1;
} else if (strcmp(rf_preference, "lmsdr") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].lmssdr = 1;
} else {//if (strcmp(preference, "no") == 0)
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].exmimo = 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_b200 = 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_x300 = 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].bladerf = 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].lmssdr = 1;
}
if (strcmp(if_compression, "alaw") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].if_compress = 1;
} else if (strcmp(if_compression, "none") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].if_compress = 0;
} else {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].if_compress = 0;
}
}
} else {
enb_properties.properties[enb_properties_index]->nb_rrh_gw = 0;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].rrh_gw_if_name = "none";
......@@ -2421,8 +2433,9 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_x300 = 0;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].bladerf = 0;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].lmssdr = 0;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].if_compress = 0;
}
// SCTP SETTING
enb_properties.properties[enb_properties_index]->sctp_out_streams = SCTP_OUT_STREAMS;
enb_properties.properties[enb_properties_index]->sctp_in_streams = SCTP_IN_STREAMS;
......
......@@ -85,6 +85,7 @@ typedef struct rrh_gw_config_s {
uint8_t udpif4p5;
uint8_t rawif4p5;
uint8_t rawif5_mobipass;
uint8_t if_compress;
int tx_scheduling_advance;
int tx_sample_advance;
int iq_txshift;
......
......@@ -3432,7 +3432,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
)
//-----------------------------------------------------------------------------
{
int i;
int i, drb_id;
#ifdef PDCP_USE_NETLINK
int oip_ifup = 0;
int dest_ip_offset = 0;
......@@ -3564,6 +3564,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
if (DRB_configList != NULL) {
for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8)
if (DRB_configList->list.array[i]) {
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
LOG_I(RRC,
"[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n",
ctxt_pP->module_id,
......@@ -3580,7 +3581,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
(int)DRB_configList->list.array[i]->drb_Identity,
(int)*DRB_configList->list.array[i]->logicalChannelIdentity);
if (ue_context_pP->ue_context.DRB_active[i] == 0) {
if (ue_context_pP->ue_context.DRB_active[drb_id] == 0) {
/*
rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_ADD,
(ue_mod_idP * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity,UNDEF_SECURITY_MODE);
......@@ -3588,7 +3589,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
(ue_mod_idP * NB_RB_MAX) + (int)*eNB_rrc_inst[ctxt_pP->module_id].DRB_config[ue_mod_idP][i]->logicalChannelIdentity,
RADIO_ACCESS_BEARER,Rlc_info_um);
*/
ue_context_pP->ue_context.DRB_active[i] = 1;
ue_context_pP->ue_context.DRB_active[drb_id] = 1;
LOG_D(RRC,
"[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n",
......@@ -3673,7 +3674,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
} else { // remove LCHAN from MAC/PHY
if (ue_context_pP->ue_context.DRB_active[i] == 1) {
if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
// DRB has just been removed so remove RLC + PDCP for DRB
/* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE,
(ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE);
......@@ -3687,7 +3688,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
Rlc_info_um);
}
ue_context_pP->ue_context.DRB_active[i] = 0;
ue_context_pP->ue_context.DRB_active[drb_id] = 0;
LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
......
......@@ -181,6 +181,10 @@ const char* eurecomVariablesNames[] = {
"ue0_trx_write_ns",
"ue0_trx_read_ns_missing",
"ue0_trx_write_ns_missing"
"send_if4_symbol",
"recv_if4_symbol",
"send_if5_pkt_id",
"recv_if5_pkt_id"
};
const char* eurecomFunctionsNames[] = {
......@@ -375,7 +379,10 @@ const char* eurecomFunctionsNames[] = {
"send_if4",
"recv_if4",
"send_if5",
"recv_if5"
"recv_if5",
"compress_if",
"decompress_if"
};
struct vcd_module_s vcd_modules[VCD_SIGNAL_DUMPER_MODULE_END] = {
......
......@@ -147,6 +147,10 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN5,
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN6,
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN7,
VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF4_SYMBOL,
VCD_SIGNAL_DUMPER_VARIABLES_RECV_IF4_SYMBOL,
VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF5_PKT_ID,
VCD_SIGNAL_DUMPER_VARIABLES_RECV_IF5_PKT_ID,
VCD_SIGNAL_DUMPER_VARIABLES_UE_PDCP_FLUSH_SIZE,
VCD_SIGNAL_DUMPER_VARIABLES_UE_PDCP_FLUSH_ERR,
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS,
......@@ -354,6 +358,9 @@ typedef enum {
VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF5,
VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF5,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF,
VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
VCD_SIGNAL_DUMPER_FUNCTIONS_END = VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
} vcd_signal_dump_functions;
......
......@@ -242,6 +242,8 @@ typedef struct {
uint8_t iq_txshift;
//! transport type preference (RAW/UDP)
uint8_t transp_preference;
//! compression enable (0: No comp/ 1: A-LAW)
uint8_t if_compress;
//! radio front end preference (EXMIMO,USRP, BALDERF,LMSSDR)
uint8_t rf_preference;
} eth_params_t;
......
......@@ -145,21 +145,28 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
memcpy(buff2,(void*)&eth->eh,MAC_HEADER_SIZE_BYTES);
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t))=1+(i<<1);
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = timestamp;
int sent_byte;
if (eth->compression = ALAW_COMPRESS) {
sent_byte = RAW_PACKET_SIZE_BYTES_ALAW(nsamps);
} else {
sent_byte = RAW_PACKET_SIZE_BYTES(nsamps);
}
/*printf("[RRH]write mod_%d %d , len %d, buff %p \n",
Mod_id,eth->sockfd[Mod_id],RAW_PACKET_SIZE_BYTES(nsamps), buff2);*/
while(bytes_sent < RAW_PACKET_SIZE_BYTES(nsamps)) {
while(bytes_sent < sent_byte) {
#if DEBUG
printf("------- TX ------: buff2 current position=%d remaining_bytes=%d bytes_sent=%d \n",
(void *)(buff2+bytes_sent),
RAW_PACKET_SIZE_BYTES(nsamps) - bytes_sent,
sent_byte - bytes_sent,
bytes_sent);
#endif
/* Send packet */
bytes_sent += send(eth->sockfd,
buff2,
RAW_PACKET_SIZE_BYTES(nsamps),
sent_byte,
sendto_flag);
if ( bytes_sent == -1) {
eth->num_tx_errors++;
......@@ -172,7 +179,7 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t)),
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)),
bytes_sent);
dump_packet((device->host_type == BBU_HOST)? "BBU":"RRH", buff2, RAW_PACKET_SIZE_BYTES(nsamps), TX_FLAG);
dump_packet((device->host_type == BBU_HOST)? "BBU":"RRH", buff2, sent_byte, TX_FLAG);
#endif
eth->tx_actual_nsamps=bytes_sent>>2;
eth->tx_count++;
......@@ -240,6 +247,8 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi
int i=0;
eth_state_t *eth = (eth_state_t*)device->priv;
int rcvfrom_flag =0;
int block_cnt=0;
int again_cnt=0;
eth->rx_nsamps=nsamps;
......@@ -247,25 +256,54 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi
/* buff[i] points to the position in rx buffer where the payload to be received will be placed
buff2 points to the position in rx buffer where the packet header will be placed */
void *buff2 = (void*)(buff[i]-APP_HEADER_SIZE_BYTES-MAC_HEADER_SIZE_BYTES);
/* we don't want to ovewrite with the header info the previous rx buffer data so we store it*/
struct ether_header temp = *(struct ether_header *)buff2;
int32_t temp0 = *(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES);
openair0_timestamp temp1 = *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
bytes_received=0;
int receive_bytes;
if (eth->compression == ALAW_COMPRESS) {
receive_bytes = RAW_PACKET_SIZE_BYTES_ALAW(nsamps);
} else {
receive_bytes = RAW_PACKET_SIZE_BYTES(nsamps);
}
while(bytes_received < RAW_PACKET_SIZE_BYTES(nsamps)) {
while(bytes_received < receive_bytes) {
again:
bytes_received +=recv(eth->sockfd,
buff2,
RAW_PACKET_SIZE_BYTES(nsamps),
receive_bytes,
rcvfrom_flag);
if (bytes_received ==-1) {
eth->num_rx_errors++;
perror("ETHERNET IF5 READ: ");
if (errno == EAGAIN) continue;
exit(-1);
if (errno == EAGAIN) {
again_cnt++;
usleep(10);
if (again_cnt == 1000) {
perror("ETHERNET IF5 READ (EAGAIN): ");
exit(-1);
} else {
printf("AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN \n");
goto again;
}
} else if (errno == EWOULDBLOCK) {
block_cnt++;
usleep(10);
if (block_cnt == 1000) {
perror("ETHERNET IF5 READ (EWOULDBLOCK): ");
exit(-1);
} else {
printf("BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK \n");
goto again;
}
} else {
perror("ETHERNET IF5 READ");
printf("(%s):\n", strerror(errno));
exit(-1);
}
} else {
/* store the timestamp value from packet's header */
*timestamp = *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
......@@ -280,7 +318,7 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t)),
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)),
bytes_received);
dump_packet((device->host_type == BBU_HOST)? "BBU":"RRH", buff2, RAW_PACKET_SIZE_BYTES(nsamps),RX_FLAG);
dump_packet((device->host_type == BBU_HOST)? "BBU":"RRH", buff2, receive_bytes, RX_FLAG);
#endif
......@@ -303,19 +341,43 @@ int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestam
ssize_t packet_size = MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t;
IF4p5_header_t *test_header = (IF4p5_header_t*)(buff[0] + MAC_HEADER_SIZE_BYTES);
int block_cnt=0;
int again_cnt=0;
#ifdef DEBUG
printf("Reading from device %p, eth %p, sockfd %d\n",device,eth,eth->sockfd);
#endif
bytes_received = recv(eth->sockfd,
buff[0],
packet_size,
MSG_PEEK);
if (bytes_received ==-1) {
eth->num_rx_errors++;
perror("ETHERNET IF4p5 READ (header): ");
exit(-1);
while (bytes_received < packet_size) {
again:
bytes_received = recv(eth->sockfd,
buff[0],
packet_size,
MSG_PEEK);
if (bytes_received ==-1) {
eth->num_rx_errors++;
if (errno == EAGAIN) {
again_cnt++;
usleep(10);
if (again_cnt == 1000) {
perror("ETHERNET IF4p5 READ (EAGAIN): ");
exit(-1);
} else {
printf("AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN \n");
goto again;
}
} else if (errno == EWOULDBLOCK) {
block_cnt++;
usleep(10);
if (block_cnt == 1000) {
perror("ETHERNET IF4p5 READ (EWOULDBLOCK): ");
exit(-1);
} else {
printf("BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK \n");
goto again;
}
} else {
perror("ETHERNET IF4p5 READ");
printf("(%s):\n", strerror(errno));
exit(-1);
}
}
}
#ifdef DEBUG
for (int i=0;i<packet_size;i++)
......@@ -331,8 +393,7 @@ int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestam
packet_size = RAW_IF4p5_PULFFT_SIZE_BYTES(nblocks);
} else {
packet_size = RAW_IF4p5_PRACH_SIZE_BYTES;
}
}
while(bytes_received < packet_size) {
bytes_received = recv(eth->sockfd,
......
......@@ -262,23 +262,30 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi
// eth->pck_header.seq_num = pck_seq_num;
//eth->pck_header.antenna_id = 1+(i<<1);
//eth->pck_header.timestamp = timestamp;
*(uint16_t *)buff2 = pck_seq_num;
*(uint16_t *)buff2 = eth->pck_seq_num;
*(uint16_t *)(buff2 + sizeof(uint16_t)) = 1+(i<<1);
*(openair0_timestamp *)(buff2 + sizeof(int32_t)) = timestamp;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TX_SEQ_NUM, pck_seq_num);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TX_SEQ_NUM, eth->pck_seq_num);
while(bytes_sent < UDP_PACKET_SIZE_BYTES(nsamps)) {
int sent_byte;
if (eth->compression == ALAW_COMPRESS) {
sent_byte = UDP_PACKET_SIZE_BYTES_ALAW(nsamps);
} else {
sent_byte = UDP_PACKET_SIZE_BYTES(nsamps);
}
//while(bytes_sent < sent_byte) {
//printf("eth->pck_seq_num: %d\n", eth->pck_seq_num);
#if DEBUG
printf("------- TX ------: buff2 current position=%d remaining_bytes=%d bytes_sent=%d \n",
(void *)(buff2+bytes_sent),
UDP_PACKET_SIZE_BYTES(nsamps) - bytes_sent,
sent_byte - bytes_sent,
bytes_sent);
#endif
/* Send packet */
bytes_sent += sendto(eth->sockfd,
buff2,
UDP_PACKET_SIZE_BYTES(nsamps),
sent_byte,
sendto_flag,
(struct sockaddr*)&eth->dest_addr,
eth->addr_len);
......@@ -294,14 +301,15 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi
*(int16_t *)(buff2 + sizeof(int16_t)),
*(openair0_timestamp *)(buff2 + sizeof(int32_t)),
bytes_sent);