mirror of https://github.com/PentHertz/srsLTE.git
add configuration for GW
This commit is contained in:
parent
76969932dc
commit
892ff2c36a
|
@ -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
|
class srslte_pdcp_config_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "srslte/common/log.h"
|
#include "srslte/common/log.h"
|
||||||
#include "srslte/common/common.h"
|
#include "srslte/common/common.h"
|
||||||
#include "srslte/common/msg_queue.h"
|
#include "srslte/common/msg_queue.h"
|
||||||
|
#include "srslte/common/interfaces_common.h"
|
||||||
#include "srslte/interfaces/ue_interfaces.h"
|
#include "srslte/interfaces/ue_interfaces.h"
|
||||||
#include "srslte/common/threads.h"
|
#include "srslte/common/threads.h"
|
||||||
#include "gw_metrics.h"
|
#include "gw_metrics.h"
|
||||||
|
@ -46,7 +47,7 @@ class gw
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
gw();
|
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 stop();
|
||||||
|
|
||||||
void get_metrics(gw_metrics_t &m);
|
void get_metrics(gw_metrics_t &m);
|
||||||
|
@ -72,13 +73,13 @@ private:
|
||||||
srslte::byte_buffer_pool *pool;
|
srslte::byte_buffer_pool *pool;
|
||||||
|
|
||||||
srslte::log *gw_log;
|
srslte::log *gw_log;
|
||||||
|
srslte::srslte_gw_config_t cfg;
|
||||||
bool running;
|
bool running;
|
||||||
bool run_enable;
|
bool run_enable;
|
||||||
int32 tun_fd;
|
int32 tun_fd;
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
int32 sock;
|
int32 sock;
|
||||||
bool if_up;
|
bool if_up;
|
||||||
uint32_t lcid;
|
|
||||||
|
|
||||||
uint32_t current_ip_addr;
|
uint32_t current_ip_addr;
|
||||||
|
|
||||||
|
|
|
@ -47,13 +47,13 @@ gw::gw()
|
||||||
default_netmask = true;
|
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();
|
pool = srslte::byte_buffer_pool::get_instance();
|
||||||
pdcp = pdcp_;
|
pdcp = pdcp_;
|
||||||
nas = nas_;
|
nas = nas_;
|
||||||
gw_log = gw_log_;
|
gw_log = gw_log_;
|
||||||
lcid = lcid_;
|
cfg = cfg_;
|
||||||
run_enable = true;
|
run_enable = true;
|
||||||
|
|
||||||
gettimeofday(&metrics_time[1], NULL);
|
gettimeofday(&metrics_time[1], NULL);
|
||||||
|
@ -273,9 +273,9 @@ void gw::run_thread()
|
||||||
{
|
{
|
||||||
gw_log->info_hex(pdu->msg, pdu->N_bytes, "TX PDU");
|
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) {
|
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();
|
nas->attach_request();
|
||||||
attach_attempts++;
|
attach_attempts++;
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ void gw::run_thread()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attach_attempts == ATTACH_MAX_ATTEMPTS) {
|
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;
|
attach_attempts = 0;
|
||||||
|
@ -298,10 +298,10 @@ void gw::run_thread()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send PDU directly to PDCP
|
// Send PDU directly to PDCP
|
||||||
if (pdcp->is_drb_enabled(lcid)) {
|
if (pdcp->is_drb_enabled(cfg.lcid)) {
|
||||||
pdu->set_timestamp();
|
pdu->set_timestamp();
|
||||||
ul_tput_bytes += pdu->N_bytes;
|
ul_tput_bytes += pdu->N_bytes;
|
||||||
pdcp->write_sdu(lcid, pdu);
|
pdcp->write_sdu(cfg.lcid, pdu);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
pdu = pool_allocate;
|
pdu = pool_allocate;
|
||||||
|
|
Loading…
Reference in New Issue