Merge branch 'test_rlc_am' into raa

master
Ismael Gomez 7 years ago
commit 55dce13cab

@ -185,7 +185,8 @@ void parse_args(int argc, char **argv) {
cell.id = atoi(argv[optind]); cell.id = atoi(argv[optind]);
break; break;
case 'x': case 'x':
strncpy(mimo_type_str, argv[optind], 32); strncpy(mimo_type_str, argv[optind], 31);
mimo_type_str[31] = 0;
break; break;
case 'b': case 'b':
multiplex_pmi = (uint32_t) atoi(argv[optind]); multiplex_pmi = (uint32_t) atoi(argv[optind]);

@ -110,7 +110,7 @@ typedef enum {SRSLTE_SF_NORM, SRSLTE_SF_MBSFN} srslte_sf_t;
#define SRSLTE_SF_LEN_MAX (SRSLTE_SF_LEN(SRSLTE_SYMBOL_SZ_MAX)) #define SRSLTE_SF_LEN_MAX (SRSLTE_SF_LEN(SRSLTE_SYMBOL_SZ_MAX))
#define SRSLTE_SLOT_LEN_PRB(nof_prb) (SRSLTE_SLOT_LEN(srslte_symbol_sz(nof_prb))) #define SRSLTE_SLOT_LEN_PRB(nof_prb) (SRSLTE_SLOT_LEN(srslte_symbol_sz(nof_prb)))
#define SRSLTE_SF_LEN_PRB(nof_prb) (nof_prb > 0 ? SRSLTE_SF_LEN(srslte_symbol_sz(nof_prb)) : 0) #define SRSLTE_SF_LEN_PRB(nof_prb) (SRSLTE_SF_LEN(srslte_symbol_sz(nof_prb)))
#define SRSLTE_SLOT_LEN_RE(nof_prb, cp) (nof_prb*SRSLTE_NRE*SRSLTE_CP_NSYMB(cp)) #define SRSLTE_SLOT_LEN_RE(nof_prb, cp) (nof_prb*SRSLTE_NRE*SRSLTE_CP_NSYMB(cp))
#define SRSLTE_SF_LEN_RE(nof_prb, cp) (2*SRSLTE_SLOT_LEN_RE(nof_prb, cp)) #define SRSLTE_SF_LEN_RE(nof_prb, cp) (2*SRSLTE_SLOT_LEN_RE(nof_prb, cp))

@ -2243,9 +2243,9 @@ LIBLTE_ERROR_ENUM liblte_s1ap_pack_imsi(
if(ie != NULL && if(ie != NULL &&
ptr != NULL) ptr != NULL)
{ {
// max length of IE buffer is 32, so limit // max length of IE buffer is 8, so limit
if (ie->n_octets > 31) { if (ie->n_octets > 7) {
printf("Length in struct exceeds buffer (%d > 31).\n", ie->n_octets); printf("Length in struct exceeds buffer (%d > 7).\n", ie->n_octets);
return LIBLTE_ERROR_ENCODE_FAIL; return LIBLTE_ERROR_ENCODE_FAIL;
} }

@ -248,7 +248,7 @@ void rlc::add_bearer(uint32_t lcid, srslte_rlc_config_t cnfg)
} }
if (!rlc_array[lcid].active()) { if (!rlc_array[lcid].active()) {
rlc_log->info("Adding radio bearer %s with mode %s\n", rlc_log->warning("Adding radio bearer %s with mode %s\n",
rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg.rlc_mode]); rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg.rlc_mode]);
switch(cnfg.rlc_mode) switch(cnfg.rlc_mode)
{ {

@ -83,7 +83,7 @@ void rlc_am::init(srslte::log *log_,
void rlc_am::configure(srslte_rlc_config_t cfg_) void rlc_am::configure(srslte_rlc_config_t cfg_)
{ {
cfg = cfg_.am; cfg = cfg_.am;
log->info("%s configured: t_poll_retx=%d, poll_pdu=%d, poll_byte=%d, max_retx_thresh=%d, " log->warning("%s configured: t_poll_retx=%d, poll_pdu=%d, poll_byte=%d, max_retx_thresh=%d, "
"t_reordering=%d, t_status_prohibit=%d\n", "t_reordering=%d, t_status_prohibit=%d\n",
rrc->get_rb_name(lcid).c_str(), cfg.t_poll_retx, cfg.poll_pdu, cfg.poll_byte, cfg.max_retx_thresh, rrc->get_rb_name(lcid).c_str(), cfg.t_poll_retx, cfg.poll_pdu, cfg.poll_byte, cfg.max_retx_thresh,
cfg.t_reordering, cfg.t_status_prohibit); cfg.t_reordering, cfg.t_status_prohibit);
@ -315,9 +315,11 @@ int rlc_am::read_pdu(uint8_t *payload, uint32_t nof_bytes)
// RETX if required // RETX if required
if(retx_queue.size() > 0) { if(retx_queue.size() > 0) {
int ret = build_retx_pdu(payload, nof_bytes); int ret = build_retx_pdu(payload, nof_bytes);
if (ret) {
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
return ret; return ret;
} }
}
// Build a PDU from SDUs // Build a PDU from SDUs
int ret = build_data_pdu(payload, nof_bytes); int ret = build_data_pdu(payload, nof_bytes);
@ -471,8 +473,8 @@ int rlc_am::build_retx_pdu(uint8_t *payload, uint32_t nof_bytes)
if (!retx_queue.empty()) { if (!retx_queue.empty()) {
retx = retx_queue.front(); retx = retx_queue.front();
} else { } else {
log->error("In build_retx_pdu(): retx_queue is empty during sanity check\n"); log->info("In build_retx_pdu(): retx_queue is empty during sanity check, sn=%d\n", retx.sn);
return -1; return 0;
} }
} }
@ -549,7 +551,7 @@ int rlc_am::build_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_retx_t r
rrc->get_rb_name(lcid).c_str(), nof_bytes, head_len); rrc->get_rb_name(lcid).c_str(), nof_bytes, head_len);
return 0; return 0;
} }
pdu_space = nof_bytes-head_len; pdu_space = nof_bytes-head_len-2;
if(pdu_space < (retx.so_end-retx.so_start)) if(pdu_space < (retx.so_end-retx.so_start))
retx.so_end = retx.so_start+pdu_space; retx.so_end = retx.so_start+pdu_space;
@ -568,7 +570,7 @@ int rlc_am::build_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_retx_t r
upper += old_header.li[i]; upper += old_header.li[i];
head_len = rlc_am_packed_length(&new_header); head_len = rlc_am_packed_length(&new_header);
pdu_space = nof_bytes-head_len; pdu_space = nof_bytes-head_len-2;
if(pdu_space < (retx.so_end-retx.so_start)) if(pdu_space < (retx.so_end-retx.so_start))
retx.so_end = retx.so_start+pdu_space; retx.so_end = retx.so_start+pdu_space;
@ -1014,10 +1016,11 @@ void rlc_am::handle_control_pdu(uint8_t *payload, uint32_t nof_bytes)
if(it->second.buf) { if(it->second.buf) {
pool->deallocate(it->second.buf); pool->deallocate(it->second.buf);
it->second.buf = 0; it->second.buf = 0;
log->info("SN=%d removed from tx_window\n", i);
} }
tx_window.erase(it);
if(update_vt_a) if(update_vt_a)
{ {
tx_window.erase(it);
vt_a = (vt_a + 1)%MOD; vt_a = (vt_a + 1)%MOD;
vt_ms = (vt_ms + 1)%MOD; vt_ms = (vt_ms + 1)%MOD;
} }

@ -81,18 +81,18 @@ void rlc_um::configure(srslte_rlc_config_t cnfg_)
switch(cnfg_.rlc_mode) switch(cnfg_.rlc_mode)
{ {
case LIBLTE_RRC_RLC_MODE_UM_BI: case LIBLTE_RRC_RLC_MODE_UM_BI:
log->info("%s configured in %s mode: " log->warning("%s configured in %s mode: "
"t_reordering=%d ms, rx_sn_field_length=%u bits, tx_sn_field_length=%u bits\n", "t_reordering=%d ms, rx_sn_field_length=%u bits, tx_sn_field_length=%u bits\n",
rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode], rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode],
cfg.t_reordering, rlc_umd_sn_size_num[cfg.rx_sn_field_length], rlc_umd_sn_size_num[cfg.rx_sn_field_length]); cfg.t_reordering, rlc_umd_sn_size_num[cfg.rx_sn_field_length], rlc_umd_sn_size_num[cfg.rx_sn_field_length]);
break; break;
case LIBLTE_RRC_RLC_MODE_UM_UNI_UL: case LIBLTE_RRC_RLC_MODE_UM_UNI_UL:
log->info("%s configured in %s mode: tx_sn_field_length=%u bits\n", log->warning("%s configured in %s mode: tx_sn_field_length=%u bits\n",
rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode], rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode],
rlc_umd_sn_size_num[cfg.rx_sn_field_length]); rlc_umd_sn_size_num[cfg.rx_sn_field_length]);
break; break;
case LIBLTE_RRC_RLC_MODE_UM_UNI_DL: case LIBLTE_RRC_RLC_MODE_UM_UNI_DL:
log->info("%s configured in %s mode: " log->warning("%s configured in %s mode: "
"t_reordering=%d ms, rx_sn_field_length=%u bits\n", "t_reordering=%d ms, rx_sn_field_length=%u bits\n",
rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode], rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode],
cfg.t_reordering, rlc_umd_sn_size_num[cfg.rx_sn_field_length]); cfg.t_reordering, rlc_umd_sn_size_num[cfg.rx_sn_field_length]);

@ -590,15 +590,15 @@ int main(int argc, char *argv[])
/******************* This is copied from srsue gw **********************/ /******************* This is copied from srsue gw **********************/
int setup_if_addr(char *ip_addr) int setup_if_addr(char *ip_addr)
{ {
char *dev = (char*) "tun_srsenb"; char *dev = (char*) "tun_srsenb";
int sock = 0;
// Construct the TUN device // Construct the TUN device
int tun_fd = open("/dev/net/tun", O_RDWR); int tun_fd = open("/dev/net/tun", O_RDWR);
if(0 > tun_fd) if(0 > tun_fd)
{ {
perror("open"); perror("open");
return(-1); return SRSLTE_ERROR;
} }
struct ifreq ifr; struct ifreq ifr;
@ -609,30 +609,23 @@ int setup_if_addr(char *ip_addr)
if(0 > ioctl(tun_fd, TUNSETIFF, &ifr)) if(0 > ioctl(tun_fd, TUNSETIFF, &ifr))
{ {
perror("ioctl1"); perror("ioctl1");
close(tun_fd); goto clean_exit;
return -1;
} }
// Bring up the interface // Bring up the interface
int sock = socket(AF_INET, SOCK_DGRAM, 0); sock = socket(AF_INET, SOCK_DGRAM, 0);
if(0 > ioctl(sock, SIOCGIFFLAGS, &ifr)) if(0 > ioctl(sock, SIOCGIFFLAGS, &ifr))
{ {
perror("socket"); perror("socket");
close(sock); goto clean_exit;
close(tun_fd);
return -1;
} }
ifr.ifr_flags |= IFF_UP | IFF_RUNNING; ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
if(0 > ioctl(sock, SIOCSIFFLAGS, &ifr)) if(0 > ioctl(sock, SIOCSIFFLAGS, &ifr))
{ {
perror("ioctl2"); perror("ioctl2");
close(sock); goto clean_exit;
close(tun_fd);
return -1;
} }
close(sock);
// Setup the IP address // Setup the IP address
sock = socket(AF_INET, SOCK_DGRAM, 0); sock = socket(AF_INET, SOCK_DGRAM, 0);
ifr.ifr_addr.sa_family = AF_INET; ifr.ifr_addr.sa_family = AF_INET;
@ -640,21 +633,19 @@ int setup_if_addr(char *ip_addr)
if(0 > ioctl(sock, SIOCSIFADDR, &ifr)) if(0 > ioctl(sock, SIOCSIFADDR, &ifr))
{ {
perror("ioctl"); perror("ioctl");
close(sock); goto clean_exit;
close(tun_fd);
return -1;
} }
ifr.ifr_netmask.sa_family = AF_INET; ifr.ifr_netmask.sa_family = AF_INET;
((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr = inet_addr("255.255.255.0"); ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr = inet_addr("255.255.255.0");
if(0 > ioctl(sock, SIOCSIFNETMASK, &ifr)) if(0 > ioctl(sock, SIOCSIFNETMASK, &ifr))
{ {
perror("ioctl"); perror("ioctl");
close(sock); goto clean_exit;
close(tun_fd);
return -1;
} }
close(sock);
return(tun_fd); return(tun_fd);
clean_exit:
close(tun_fd);
return SRSLTE_ERROR;
} }

@ -57,7 +57,6 @@ private:
std::string float_to_eng_string(float f, int digits); std::string float_to_eng_string(float f, int digits);
std::string int_to_eng_string(int f, int digits); std::string int_to_eng_string(int f, int digits);
float metrics_report_period;
bool do_print; bool do_print;
uint8_t n_reports; uint8_t n_reports;
ue_metrics_interface* ue; ue_metrics_interface* ue;

@ -232,8 +232,8 @@ void phch_worker::work_imp()
/** Calculate RSSI on the input signal before generating the output */ /** Calculate RSSI on the input signal before generating the output */
// Average RSSI over all symbols // Average RSSI over all symbols (make sure SF length is non-zero)
float rssi_dbm = 10*log10(srslte_vec_avg_power_cf(signal_buffer[0], SRSLTE_SF_LEN_PRB(cell.nof_prb))) + 30; float rssi_dbm = SRSLTE_SF_LEN_PRB(cell.nof_prb) > 0 ? (10*log10(srslte_vec_avg_power_cf(signal_buffer[0], SRSLTE_SF_LEN_PRB(cell.nof_prb))) + 30) : 0;
if (isnormal(rssi_dbm)) { if (isnormal(rssi_dbm)) {
phy->avg_rssi_dbm = SRSLTE_VEC_EMA(rssi_dbm, phy->avg_rssi_dbm, phy->args->snr_ema_coeff); phy->avg_rssi_dbm = SRSLTE_VEC_EMA(rssi_dbm, phy->avg_rssi_dbm, phy->args->snr_ema_coeff);
} }

Loading…
Cancel
Save