add configuration for GW

This commit is contained in:
Andre Puschmann 2018-01-17 16:45:07 +01:00
parent 76969932dc
commit 892ff2c36a
3 changed files with 21 additions and 9 deletions

View File

@ -45,6 +45,17 @@ public:
};
class srslte_gw_config_t
{
public:
srslte_gw_config_t(uint32_t lcid_ = 0)
:lcid(lcid_)
{}
uint32_t lcid;
};
class srslte_pdcp_config_t
{
public:

View File

@ -31,6 +31,7 @@
#include "srslte/common/log.h"
#include "srslte/common/common.h"
#include "srslte/common/msg_queue.h"
#include "srslte/common/interfaces_common.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/threads.h"
#include "gw_metrics.h"
@ -46,7 +47,7 @@ class gw
{
public:
gw();
void init(pdcp_interface_gw *pdcp_, nas_interface_gw *nas_, srslte::log *gw_log_, uint32_t lcid_);
void init(pdcp_interface_gw *pdcp_, nas_interface_gw *nas_, srslte::log *gw_log_, srslte::srslte_gw_config_t);
void stop();
void get_metrics(gw_metrics_t &m);
@ -72,13 +73,13 @@ private:
srslte::byte_buffer_pool *pool;
srslte::log *gw_log;
srslte::srslte_gw_config_t cfg;
bool running;
bool run_enable;
int32 tun_fd;
struct ifreq ifr;
int32 sock;
bool if_up;
uint32_t lcid;
uint32_t current_ip_addr;

View File

@ -47,13 +47,13 @@ gw::gw()
default_netmask = true;
}
void gw::init(pdcp_interface_gw *pdcp_, nas_interface_gw *nas_, srslte::log *gw_log_, uint32_t lcid_)
void gw::init(pdcp_interface_gw *pdcp_, nas_interface_gw *nas_, srslte::log *gw_log_, srslte::srslte_gw_config_t cfg_)
{
pool = srslte::byte_buffer_pool::get_instance();
pdcp = pdcp_;
nas = nas_;
gw_log = gw_log_;
lcid = lcid_;
cfg = cfg_;
run_enable = true;
gettimeofday(&metrics_time[1], NULL);
@ -273,9 +273,9 @@ void gw::run_thread()
{
gw_log->info_hex(pdu->msg, pdu->N_bytes, "TX PDU");
while(run_enable && !pdcp->is_drb_enabled(lcid) && attach_attempts < ATTACH_MAX_ATTEMPTS) {
while(run_enable && !pdcp->is_drb_enabled(cfg.lcid) && attach_attempts < ATTACH_MAX_ATTEMPTS) {
if (attach_cnt == 0) {
gw_log->info("LCID=%d not active, requesting NAS attach (%d/%d)\n", lcid, attach_attempts, ATTACH_MAX_ATTEMPTS);
gw_log->info("LCID=%d not active, requesting NAS attach (%d/%d)\n", cfg.lcid, attach_attempts, ATTACH_MAX_ATTEMPTS);
nas->attach_request();
attach_attempts++;
}
@ -287,7 +287,7 @@ void gw::run_thread()
}
if (attach_attempts == ATTACH_MAX_ATTEMPTS) {
gw_log->warning("LCID=%d was not active after %d attempts\n", lcid, ATTACH_MAX_ATTEMPTS);
gw_log->warning("LCID=%d was not active after %d attempts\n", cfg.lcid, ATTACH_MAX_ATTEMPTS);
}
attach_attempts = 0;
@ -298,10 +298,10 @@ void gw::run_thread()
}
// Send PDU directly to PDCP
if (pdcp->is_drb_enabled(lcid)) {
if (pdcp->is_drb_enabled(cfg.lcid)) {
pdu->set_timestamp();
ul_tput_bytes += pdu->N_bytes;
pdcp->write_sdu(lcid, pdu);
pdcp->write_sdu(cfg.lcid, pdu);
do {
pdu = pool_allocate;