Commit ddca335b authored by Andrew Burger's avatar Andrew Burger

New address port setup

parent 3936ceaa
......@@ -230,9 +230,9 @@ log_config =
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="debug";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="debug";
mac_log_level ="info";
mac_log_verbosity ="high";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
......
......@@ -3,9 +3,9 @@ log_config = {
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="debug";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="debug";
mac_log_level ="info";
mac_log_verbosity ="medium";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
......
......@@ -166,6 +166,9 @@ typedef struct {
} vnf_info;
bool is_rx = false;
bool is_crc = false;
int vnf_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "vnf_pack_vendor_extension_tlv\n");
nfapi_tl_t *tlv = (nfapi_tl_t *)ve;
......@@ -406,10 +409,21 @@ int phy_subframe_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id,
first_time = 0;
}
if(UL_RCC_INFO.rx_ind->sfn_sf != 0 && !is_rx)
{
LOG_E(MAC, "Test1 phy_subframe_ind sfn_sf: %u rx_ind sfn_sf: %u\n", sfn_sf, UL_RCC_INFO.rx_ind->sfn_sf);
is_rx = true;
}
if(UL_RCC_INFO.crc_ind->sfn_sf != 0 && !is_crc)
{
LOG_E(MAC, "Test1 phy_subframe_ind sfn_sf: %u crc_ind sfn_sf: %u\n", sfn_sf, UL_RCC_INFO.crc_ind->sfn_sf);
is_crc = true;
}
if (RC.eNB && RC.eNB[0][0]->configured) {
uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf);
uint16_t sf = NFAPI_SFNSF2SF(sfn_sf);
//LOG_D(PHY,"[VNF] subframe indication sfn_sf:%d sfn:%d sf:%d\n", sfn_sf, sfn, sf);
LOG_D(PHY,"[VNF] subframe indication sfn_sf:%d sfn:%d sf:%d\n", sfn_sf, sfn, sf);
wake_eNB_rxtx(RC.eNB[0][0], sfn, sf);
} else {
printf("[VNF] %s() RC.eNB:%p\n", __FUNCTION__, RC.eNB);
......@@ -491,6 +505,7 @@ int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indicatio
int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indication_t *ind) {
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_harqs:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->harq_indication_body.number_of_harqs);
LOG_E(MAC, "%s entered\n", __func__);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = -1;
......@@ -529,7 +544,8 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
pthread_mutex_lock(&eNB->UL_INFO_mutex);
LOG_E(MAC, "%s entered\n", __func__);
LOG_E(MAC, "%s entered sfn: %u sf: %u\n", __func__, NFAPI_SFNSF2SFN(ind->sfn_sf),
NFAPI_SFNSF2SF(ind->sfn_sf));
if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = -1;
......@@ -595,7 +611,8 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_pdus:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus);
}
LOG_E(MAC, "%s entered\n", __func__);
LOG_E(MAC, "%s entered sfn: %u sf: %u\n", __func__, NFAPI_SFNSF2SFN(ind->sfn_sf),
NFAPI_SFNSF2SF(ind->sfn_sf));
pthread_mutex_lock(&eNB->UL_INFO_mutex);
if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = -1;
......@@ -733,6 +750,7 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_
//mac_cqi_ind(p7_vnf->mac, ind);
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_cqis:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
LOG_E(MAC, "%s entered\n", __func__);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = -1;
......
......@@ -50,8 +50,8 @@ queue_t hi_dci0_req_queue;
int current_sfn_sf;
static int ue_sock_descriptor = -1;
struct sockaddr_in server_address;
static int ue_tx_sock_descriptor = -1;
static int ue_rx_sock_descriptor = -1;
extern nfapi_tx_request_pdu_t* tx_request_pdu[1023][10][10];
//extern int timer_subframe;
......@@ -1115,42 +1115,81 @@ void UE_config_stub_pnf(void) {
}
}
void ue_init_standalone_socket(const char *addr, int port)
void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
{
int addr_len = sizeof(server_address);
memset(&server_address, 0, addr_len);
server_address.sin_family = AF_INET;
server_address.sin_port = htons(port);
{
struct sockaddr_in server_address;
int addr_len = sizeof(server_address);
memset(&server_address, 0, addr_len);
server_address.sin_family = AF_INET;
server_address.sin_port = htons(tx_port);
int sd = socket(server_address.sin_family, SOCK_DGRAM, 0);
if (sd < 0)
{
LOG_E(MAC, "Socket creation error standalone PNF\n");
return;
}
int sd = socket(server_address.sin_family, SOCK_DGRAM, 0);
if (sd < 0) {
LOG_E(MAC, "Socket creation error standalone PNF\n");
return;
}
if (inet_pton(server_address.sin_family, addr, &server_address.sin_addr) <= 0)
{
LOG_E(MAC, "Invalid standalone PNF Address\n");
close(sd);
return;
}
if (inet_pton(server_address.sin_family, addr, &server_address.sin_addr) <= 0) {
LOG_E(MAC, "Invalid standalone PNF Address\n");
close(sd);
return;
// Using connect to use send() instead of sendto()
if (connect(sd, (struct sockaddr *)&server_address, addr_len) < 0)
{
LOG_E(MAC, "Connection to standalone PNF failed: %s\n", strerror(errno));
close(sd);
return;
}
LOG_I(MAC, "Succeeded Now\n");
assert(ue_tx_sock_descriptor == -1);
ue_tx_sock_descriptor = sd;
}
// Using connect to use send() instead of sendto()
while (connect(sd, (struct sockaddr *)&server_address, addr_len) < 0) {
LOG_E(MAC, "Connection to standalone PNF failed: %s\n", strerror(errno));
sleep(1);
{
struct sockaddr_in server_address;
int addr_len = sizeof(server_address);
memset(&server_address, 0, addr_len);
server_address.sin_family = AF_INET;
server_address.sin_port = htons(rx_port);
int sd = socket(server_address.sin_family, SOCK_DGRAM, 0);
if (sd < 0)
{
LOG_E(MAC, "Socket creation error standalone PNF\n");
return;
}
if (inet_pton(server_address.sin_family, addr, &server_address.sin_addr) <= 0)
{
LOG_E(MAC, "Invalid standalone PNF Address\n");
close(sd);
return;
}
if (connect(sd, (struct sockaddr *)&server_address, addr_len) < 0)
{
LOG_E(MAC, "Connection to standalone PNF failed: %s\n", strerror(errno));
close(sd);
return;
}
LOG_I(MAC, "Succeeded Now\n");
assert(ue_rx_sock_descriptor == -1);
ue_rx_sock_descriptor = sd;
}
LOG_I(MAC, "Succeeded Now\n");
assert(ue_sock_descriptor == -1);
ue_sock_descriptor = sd;
}
void *ue_standalone_pnf_task(void *context)
{
struct sockaddr_in server_address;
int addr_len = sizeof(server_address);
char buffer[1024];
int sd = ue_sock_descriptor;
int sd = ue_rx_sock_descriptor;
assert(sd > 0);
while (true)
{
......@@ -1282,27 +1321,27 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len
{
case NFAPI_RACH_INDICATION:
encoded_size = nfapi_p7_message_pack(&UL->rach_ind, buffer, sizeof(buffer), NULL);
LOG_D(MAC, "RACH_IND sent to Proxy, Size: %d\n", encoded_size);
LOG_E(MAC, "RACH_IND sent to Proxy, Size: %d\n", encoded_size);
break;
case NFAPI_CRC_INDICATION:
encoded_size = nfapi_p7_message_pack(&UL->crc_ind, buffer, sizeof(buffer), NULL);
LOG_D(MAC, "CRC_IND sent to Proxy, Size: %d\n", encoded_size);
LOG_E(MAC, "CRC_IND sent to Proxy, Size: %d\n", encoded_size);
break;
case NFAPI_RX_ULSCH_INDICATION: // is this the right nfapi message_id? Ask Raymond
encoded_size = nfapi_p7_message_pack(&UL->rx_ind, buffer, sizeof(buffer), NULL);
LOG_D(MAC, "RX_IND sent to Proxy, Size: %d\n", encoded_size);
LOG_E(MAC, "RX_IND sent to Proxy, Size: %d\n", encoded_size);
break;
case NFAPI_RX_CQI_INDICATION: // is this the right nfapi message_id? Ask Raymond
encoded_size = nfapi_p7_message_pack(&UL->cqi_ind, buffer, sizeof(buffer), NULL);
LOG_D(MAC, "CQI_IND sent to Proxy, Size: %d\n", encoded_size);
LOG_E(MAC, "CQI_IND sent to Proxy, Size: %d\n", encoded_size);
break;
case NFAPI_HARQ_INDICATION:
LOG_D(MAC, "HARQ_IND sent to Proxy, Size: %d\n", encoded_size);
LOG_E(MAC, "HARQ_IND sent to Proxy, Size: %d\n", encoded_size);
encoded_size = nfapi_p7_message_pack(&UL->harq_ind, buffer, sizeof(buffer), NULL);
break;
case NFAPI_RX_SR_INDICATION: // is this the right nfapi message_id? Ask Raymond
encoded_size = nfapi_p7_message_pack(&UL->sr_ind, buffer, sizeof(buffer), NULL);
LOG_D(MAC, "SR_IND sent to Proxy, Size: %d\n", encoded_size);
LOG_E(MAC, "SR_IND sent to Proxy, Size: %d\n", encoded_size);
break;
default:
LOG_E(MAC, "%s Unknown Message msg_type :: %u\n", __func__, msg_type);
......@@ -1313,7 +1352,7 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len
LOG_E(MAC, "standalone pack failed\n");
return;
}
if (send(ue_sock_descriptor, buffer, encoded_size, 0) < 0)
if (send(ue_tx_sock_descriptor, buffer, encoded_size, 0) < 0)
{
LOG_E(MAC, "Send Proxy UE failed\n");
return;
......@@ -1323,8 +1362,8 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len
void send_standalone_dummy()
{
static const uint16_t dummy[] = {0, 0};
LOG_D(MAC, "Dummy sent to Proxy, Size: %zu\n", sizeof(dummy));
if (send(ue_sock_descriptor, dummy, sizeof(dummy), 0) < 0)
LOG_E(MAC, "Dummy sent to Proxy, Size: %zu\n", sizeof(dummy));
if (send(ue_tx_sock_descriptor, dummy, sizeof(dummy), 0) < 0)
{
LOG_E(MAC, "send dummy to OAI UE failed: %s\n", strerror(errno));
return;
......
......@@ -139,7 +139,7 @@ int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfa
void UE_config_stub_pnf(void);
// open an SCTP socket with a standalone PNF module
void ue_init_standalone_socket(const char *addr, int port);
void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port);
// read from standalone pnf socket call corresponding memcpy functions
void *ue_standalone_pnf_task(void *context);
......
......@@ -428,8 +428,9 @@ void init_UE_stub_single_thread(int nb_inst,
void init_UE_standalone_thread()
{
const char *standalone_addr = "127.0.0.1"; // these two lines go into init
int standalone_port = 3289;
ue_init_standalone_socket(standalone_addr, standalone_port);
int standalone_tx_port = 3211;
int standalone_rx_port = 3212;
ue_init_standalone_socket(standalone_addr, standalone_tx_port, standalone_rx_port);
pthread_t thread;
if (pthread_create(&thread, NULL, ue_standalone_pnf_task, NULL) != 0) {
......@@ -442,7 +443,7 @@ void init_UE_stub(int nb_inst,
int uecap_xer_in,
char *emul_iface)
{
int inst;
int inst;
LOG_I(PHY,"UE : Calling Layer 2 for initialization\n");
l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
0,// cba_group_active
......
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