Commit 0ae01780 authored by Xu Bo's avatar Xu Bo Committed by tengjianliang

fix withS1 issue

parent 75e27a68
......@@ -52,20 +52,20 @@ load_module ../../targets/bin/ue_ip.ko
if [ "$1" = "UE" ]; then
echo "bring up $LTEIF interface for UE"
ifconfig $LTEIF up
sudo ifconfig $LTEIF up
fi
ip route flush cache
sudo ip route flush cache
sleep 1
sysctl -w net.ipv4.conf.all.log_martians=1
sudo sysctl -w net.ipv4.conf.all.log_martians=1
echo "Disabling reverse path filtering"
sysctl -w net.ipv4.conf.all.rp_filter=0
ip route flush cache
sudo sysctl -w net.ipv4.conf.all.rp_filter=0
sudo ip route flush cache
# Check table 200 lte in /etc/iproute2/rt_tables
fgrep lte /etc/iproute2/rt_tables > /dev/null
if [ $? -ne 0 ]; then
echo "200 lte " >> /etc/iproute2/rt_tables
fi
ip rule add fwmark 1 table lte
ip route add default dev $LTEIF table lte
sudo ip rule add fwmark 1 table lte
sudo ip route add default dev $LTEIF table lte
......@@ -481,6 +481,35 @@ static void *itti_dump_socket(void *arg_p)
#ifdef RTAI
struct timeval timeout;
#endif
char temp[1024];
char cpu_affinity[1024];
cpu_set_t cpuset;
int s;
CPU_ZERO(&cpuset);
CPU_SET(10, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "rrc pthread_setaffinity_np");
exit_fun("rrc Error setting processor affinity");
}
/* Check the actual affinity mask assigned to the thread */
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "rrc pthread_getaffinity_np");
exit_fun("rrc Error getting processor affinity ");
}
memset(cpu_affinity,0,sizeof(cpu_affinity));
if (CPU_ISSET(10, &cpuset))
{
sprintf (temp, " CPU_10");
strcat(cpu_affinity, temp);
}
printf("Setting the affinity of itti_dump_socket to CPU %s!\n", cpu_affinity);
ITTI_DUMP_DEBUG(0x2, " Creating TCP dump socket on port %u\n", ITTI_PORT);
......
......@@ -5412,8 +5412,11 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u
subframe_tx,
subframe_select(&ue->frame_parms,subframe_tx),
eNB_id,
0/*FIXME CC_id*/);
0/*FIXME CC_id*/
#ifdef UE_EXPANSION_SIM2
,0
#endif
);
if (ret == CONNECTION_LOST) {
LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",ue->Mod_id,
frame_rx,subframe_tx);
......
......@@ -27,6 +27,7 @@
EMAIL : Lionel.Gauthier@eurecom.fr and Navid Nikaein
*/
#define _GNU_SOURCE
#include <string.h>
#include <stdio.h>
......@@ -301,6 +302,36 @@ void *eNB_app_task(void *args_p)
int result;
/* for no gcc warnings */
(void)instance;
char temp[1024];
char cpu_affinity[1024];
cpu_set_t cpuset;
int s;
CPU_ZERO(&cpuset);
CPU_SET(5, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "rrc pthread_setaffinity_np");
exit_fun("rrc Error setting processor affinity");
}
/* Check the actual affinity mask assigned to the thread */
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "rrc pthread_getaffinity_np");
exit_fun("rrc Error getting processor affinity ");
}
memset(cpu_affinity,0,sizeof(cpu_affinity));
if (CPU_ISSET(5, &cpuset))
{
sprintf (temp, " CPU_5");
strcat(cpu_affinity, temp);
}
printf("Setting the affinity of eNB_app_task to CPU %s!\n", cpu_affinity);
itti_mark_task_ready (TASK_ENB_APP);
......
......@@ -661,8 +661,11 @@ UE_L2_STATE_t ue_scheduler(const module_id_t module_idP,
const frame_t txFrameP,
const sub_frame_t txSubframe,
const lte_subframe_t direction,
const uint8_t eNB_index, const int CC_id);
const uint8_t eNB_index, const int CC_id
#ifdef UE_EXPANSION_SIM2
,const uint8_t thread_id
#endif
);
/*! \fn int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8_t eNB_index,uint16_t buflen);
\brief determine whether to use cba resource to transmit or not
\param[in] Mod_id instance of the UE
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -590,7 +590,8 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
//ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index];
ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / maxDRB];
} else {
ctxt.module_id = 0;
// ctxt.module_id = 0;
ctxt.module_id = pdcp_read_header_g.inst - 1;
rab_id = pdcp_read_header_g.rb_id % maxDRB;
ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
}
......@@ -702,8 +703,8 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
len,
nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr),
pdcp_read_header_g.rb_id);
LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %u]\n",
#endif
LOG_E(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %u]\n",
ctxt.frame,
pdcp_read_header_g.inst,
pdcp_read_header_g.rb_id,
......@@ -711,7 +712,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
ctxt.module_id,
ctxt.rnti,
rab_id);
#endif
//#endif
MSC_LOG_RX_MESSAGE(
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
......
......@@ -278,7 +278,6 @@ ue_ip_common_ip2wireless(
pdcph.inst = instP;
bytes_wrote = ue_ip_netlink_send((char *)&pdcph,UE_IP_PDCPH_SIZE);
#ifdef OAI_DRV_DEBUG_SEND
printk("[UE_IP_DRV][%s] Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n",__FUNCTION__,
......
......@@ -30,7 +30,7 @@
#define RRC_UE
#define RRC_UE_C
#define _GNU_SOURCE
#include "assertions.h"
#include "hashtable.h"
#include "asn1_conversions.h"
......@@ -4262,6 +4262,37 @@ void *rrc_ue_task( void *args_p )
SRB_INFO *srb_info_p;
protocol_ctxt_t ctxt;
char temp[1024];
char cpu_affinity[1024];
cpu_set_t cpuset;
int s;
CPU_ZERO(&cpuset);
CPU_SET(17, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "rrc_ue pthread_setaffinity_np");
exit_fun("rrc_ue Error setting processor affinity");
}
/* Check the actual affinity mask assigned to the thread */
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "rrc_ue pthread_getaffinity_np");
exit_fun("rrc_ue Error getting processor affinity ");
}
memset(cpu_affinity,0,sizeof(cpu_affinity));
if (CPU_ISSET(17, &cpuset))
{
sprintf (temp, " CPU_17");
strcat(cpu_affinity, temp);
}
printf("Setting the affinity of rrc_ue_task to CPU %s!\n", cpu_affinity);
itti_mark_task_ready (TASK_RRC_UE);
while(1) {
......
......@@ -29,6 +29,7 @@
*/
#define RRC_ENB
#define RRC_ENB_C
#define _GNU_SOURCE
#include "defs.h"
#include "extern.h"
......@@ -4940,6 +4941,36 @@ rrc_enb_task(
int CC_id;
protocol_ctxt_t ctxt;
char temp[1024];
char cpu_affinity[1024];
cpu_set_t cpuset;
int s;
CPU_ZERO(&cpuset);
CPU_SET(9, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "rrc pthread_setaffinity_np");
exit_fun("rrc Error setting processor affinity");
}
/* Check the actual affinity mask assigned to the thread */
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "rrc pthread_getaffinity_np");
exit_fun("rrc Error getting processor affinity ");
}
memset(cpu_affinity,0,sizeof(cpu_affinity));
if (CPU_ISSET(9, &cpuset))
{
sprintf (temp, " CPU_9");
strcat(cpu_affinity, temp);
}
printf("Setting the affinity of rrc_enb_task to CPU %s!\n", cpu_affinity);
itti_mark_task_ready(TASK_RRC_ENB);
LOG_I(RRC,"Entering main loop of RRC message task\n");
while (1) {
......
......@@ -1092,7 +1092,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
}
if ( (g_log->flag & FLAG_THREAD) || (c->flag & FLAG_THREAD) ) {
// if ( (g_log->flag & FLAG_THREAD) || (c->flag & FLAG_THREAD) ) {
# define THREAD_NAME_LEN 128
char threadname[THREAD_NAME_LEN];
if (pthread_getname_np(pthread_self(), threadname, THREAD_NAME_LEN) != 0)
......@@ -1103,20 +1103,20 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
}
# undef THREAD_NAME_LEN
}
// }
if ( (g_log->flag & FLAG_FUNCT) || (c->flag & FLAG_FUNCT) ) {
len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s] ",
func);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
}
#if 0
if ( (g_log->flag & FLAG_FILE_LINE) || (c->flag & FLAG_FILE_LINE) ) {
len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s:%d]",
file, line);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
}
#endif
len += vsnprintf(&log_buffer[len], MAX_LOG_TOTAL - len, format, args);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
log_end = log_buffer + len;
......
......@@ -26,6 +26,7 @@
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
......@@ -1005,7 +1006,36 @@ void *gtpv1u_eNB_task(void *args)
int rc = 0;
instance_t instance;
//const char *msg_name_p;
char temp[1024];
char cpu_affinity[1024];
cpu_set_t cpuset;
int s;
CPU_ZERO(&cpuset);
CPU_SET(12, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "gtpv1u pthread_setaffinity_np");
exit_fun("gtpv1u Error setting processor affinity");
}
/* Check the actual affinity mask assigned to the thread */
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "gtpv1u pthread_getaffinity_np");
exit_fun("gtpv1u Error getting processor affinity ");
}
memset(cpu_affinity,0,sizeof(cpu_affinity));
if (CPU_ISSET(12, &cpuset))
{
sprintf (temp, " CPU_12");
strcat(cpu_affinity, temp);
}
printf("Setting the affinity of gtpv1u_task to CPU %s!\n", cpu_affinity);
rc = gtpv1u_eNB_init();
AssertFatal(rc == 0, "gtpv1u_eNB_init Failed");
itti_mark_task_ready(TASK_GTPV1_U);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -274,13 +274,29 @@ int esm_ebr_context_create(
res = sprintf(command_line,
"ifconfig oip%d %s netmask %s broadcast %s up && "
"ip rule add from %s/32 table %d && "
"ip rule add to %s/32 table %d && "
"ip route add default dev oip%d table %d",
// "ip rule add from %s/32 table %d && "
// "ip rule add to %s/32 table %d && "
// "ip route add default dev oip%d table %d",
"ip rule add from %s/24 table %d prio %d && "
"ip rule add to %s/24 table %d prio %d && "
#ifdef UE_EXPANSION_SIM2
"ip route add default dev oip%d table %d &&"
"sysctl net.ipv4.conf.oip%d.rp_filter=0",
#else
//"ip route add default dev oip%d table %d",
"ip route add table %d 192.168.200.0/24 dev oip%d proto kernel scope link && "
"ip route add default dev oip%d table %d && ",
"sysctl net.ipv4.conf.oip%d.rp_filter=0",
#endif
ueid + 1, ipv4_addr, netmask, broadcast,
ipv4_addr, ueid + 201,
ipv4_addr, ueid + 201,
ueid + 1, ueid + 201);
ipv4_addr, 201, 201,
ipv4_addr, 201, 201,
#ifdef UE_EXPANSION_SIM2
ueid + 1, 201, ueid + 1);
#else
ueid + 201, ueid + 1,
ueid + 1, ueid + 201, ueid + 1);
#endif
if ( res<0 ) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string");
}
......
......@@ -18,7 +18,7 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#define _GNU_SOURCE
#include "utils.h"
#if defined(ENABLE_ITTI)
# include "assertions.h"
......@@ -94,7 +94,36 @@ void *nas_ue_task(void *args_p)
unsigned int Mod_id;
int result;
nas_user_container_t *users=args_p;
char temp[1024];
char cpu_affinity[1024];
cpu_set_t cpuset;
int s;
CPU_ZERO(&cpuset);
CPU_SET(16, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "nas pthread_setaffinity_np");
exit_fun("nas Error setting processor affinity");
}
/* Check the actual affinity mask assigned to the thread */
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "nas pthread_getaffinity_np");
exit_fun("nas Error getting processor affinity ");
}
memset(cpu_affinity,0,sizeof(cpu_affinity));
if (CPU_ISSET(16, &cpuset))
{
sprintf (temp, " CPU_16");
strcat(cpu_affinity, temp);
}
printf("Setting the affinity of nas_enb_task to CPU %s!\n", cpu_affinity);
itti_mark_task_ready (TASK_NAS_UE);
MSC_START_USE();
/* Initialize UE NAS (EURECOM-NAS) */
......
......@@ -27,7 +27,7 @@
* \version 1.0
* @ingroup _s1ap
*/
#define _GNU_SOURCE
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -300,6 +300,36 @@ void *s1ap_eNB_task(void *arg)
S1AP_DEBUG("Starting S1AP layer\n");
char temp[1024];
char cpu_affinity[1024];
cpu_set_t cpuset;
int s;
CPU_ZERO(&cpuset);
CPU_SET(11, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "s1ap pthread_setaffinity_np");
exit_fun("s1ap Error setting processor affinity");
}
/* Check the actual affinity mask assigned to the thread */
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "s1ap pthread_getaffinity_np");
exit_fun("s1ap Error getting processor affinity ");
}
memset(cpu_affinity,0,sizeof(cpu_affinity));
if (CPU_ISSET(11, &cpuset))
{
sprintf (temp, " CPU_11");
strcat(cpu_affinity, temp);
}
printf("Setting the affinity of s1ap_task to CPU %s!\n", cpu_affinity);
s1ap_eNB_prepare_internal_data();
itti_mark_task_ready(TASK_S1AP);
......
......@@ -18,7 +18,7 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#define _GNU_SOURCE
#include <pthread.h>
#include <stdint.h>
#include <errno.h>
......@@ -809,6 +809,36 @@ void *sctp_eNB_task(void *arg)
SCTP_DEBUG("Starting SCTP layer\n");
char temp[1024];
char cpu_affinity[1024];
cpu_set_t cpuset;
int s;
CPU_ZERO(&cpuset);
CPU_SET(11, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "sctp pthread_setaffinity_np");
exit_fun("sctp Error setting processor affinity");
}
/* Check the actual affinity mask assigned to the thread */
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "sctp pthread_getaffinity_np");
exit_fun("sctp Error getting processor affinity ");
}
memset(cpu_affinity,0,sizeof(cpu_affinity));
if (CPU_ISSET(11, &cpuset))
{
sprintf (temp, " CPU_11");
strcat(cpu_affinity, temp);
}
printf("Setting the affinity of sctp_task to CPU %s!\n", cpu_affinity);
STAILQ_INIT(&sctp_cnx_list);
itti_mark_task_ready(TASK_SCTP);
......
......@@ -25,6 +25,7 @@
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -295,7 +296,37 @@ void *udp_eNB_task(void *args_p)
MessageDef *received_message_p = NULL;
//const char *msg_name = NULL;
//instance_t instance = 0;
udp_enb_init();
char temp[1024];
char cpu_affinity[1024];
cpu_set_t cpuset;
int s;
CPU_ZERO(&cpuset);
CPU_SET(12, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "udp pthread_setaffinity_np");
exit_fun("udp Error setting processor affinity");
}
/* Check the actual affinity mask assigned to the thread */
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "udp pthread_getaffinity_np");
exit_fun("udp Error getting processor affinity ");
}
memset(cpu_affinity,0,sizeof(cpu_affinity));
if (CPU_ISSET(12, &cpuset))
{
sprintf (temp, " CPU_12");
strcat(cpu_affinity, temp);
}
printf("Setting the affinity of udp_task to CPU %s!\n", cpu_affinity);
udp_enb_init();
itti_mark_task_ready(TASK_UDP);
MSC_START_USE();
......
......@@ -604,7 +604,7 @@ void* eNB_time_sync( void* param ){
// set default return value
eNB_time_sync_status = 0;
thread_top_init("eNB_time_sync",1,500000L,1000000L,20000000L);
thread_top_init("eNB_time_sync",6,500000L,1000000L,20000000L);
wait_sync("eNB_time_sync");
wait_system_ready("eNB_time_sync",&socket_ready_flag);
......@@ -798,7 +798,7 @@ static void* eNB_phy_stub( void* param ) {
// set default return value
eNB_phy_stub_status = 0;
thread_top_init("eNB_phy_stub",1,500000L,1000000L,20000000L);
thread_top_init("eNB_phy_stub",7,500000L,1000000L,20000000L);
addr = RC.rrc[eNB->Mod_id]->udp_socket_ip_enb;
port = RC.rrc[eNB->Mod_id]->udp_socket_port_enb;
......
......@@ -842,9 +842,7 @@ static void* ru_thread_asynch_rxtx( void* param ) {
int subframe=0, frame=0;
thread_top_init("ru_thread_asynch_rxtx",1,870000L,1000000L,1000000L);
// wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe
wait_sync("ru_thread_asynch_rxtx");
......@@ -1352,7 +1350,7 @@ static void* ru_thread( void* param ) {
// set default return value
thread_top_init("ru_thread",0,870000,1000000,1000000);
thread_top_init("ru_thread",8,870000,1000000,1000000);
LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,eNB_functions[ru->function],eNB_timing[ru->if_timing]);
......
......@@ -507,7 +507,37 @@ static void *scope_thread(void *arg) {
void *l2l1_task(void *arg) {
MessageDef *message_p = NULL;
int result;
char temp[1024];
char cpu_affinity[1024];
cpu_set_t cpuset;
int s;
CPU_ZERO(&cpuset);
CPU_SET(5, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "rrc pthread_setaffinity_np");
exit_fun("rrc Error setting processor affinity");
}
/* Check the actual affinity mask assigned to the thread */
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "rrc pthread_getaffinity_np");
exit_fun("rrc Error getting processor affinity ");
}
memset(cpu_affinity,0,sizeof(cpu_affinity));
if (CPU_ISSET(5, &cpuset))
{
sprintf (temp, " CPU_5");
strcat(cpu_affinity, temp);
}
printf("Setting the affinity of l2l1_task to CPU %s!\n", cpu_affinity);
itti_set_task_real_time(TASK_L2L1);
itti_mark_task_ready(TASK_L2L1);
......@@ -1031,14 +1061,14 @@ int main( int argc, char **argv )
if (init_opt(in_path, in_ip, NULL, radio_type) == -1)
LOG_E(OPT,"failed to run OPT \n");
}
if (UE_flag==1) {
#ifdef PDCP_USE_NETLINK
netlink_init();
#if defined(PDCP_USE_NETLINK_QUEUES)
pdcp_netlink_init();
#endif
#endif
}
#if !defined(ENABLE_ITTI)
// to make a graceful exit when ctrl-c is pressed
signal(SIGSEGV, signal_handler);
......@@ -1152,15 +1182,27 @@ int main( int argc, char **argv )
int s;
char cpu_affinity[1024];
CPU_ZERO(&cpuset);
#ifdef CPU_AFFINITY
//#ifdef CPU_AFFINITY
#if 1
if (get_nprocs() > 2) {
CPU_SET(0, &cpuset);
// CPU_SET(0, &cpuset);
//CPU_SET(0, &cpuset);
CPU_SET(4, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0) {
perror( "pthread_setaffinity_np");
exit_fun("Error setting processor affinity");
}
LOG_I(HW, "Setting the affinity of main function to CPU 0, for device library to use CPU 0 only!\n");
// LOG_I(HW, "Setting the affinity of main function to CPU 0, for device library to use CPU 0 only!\n");
char cpu_affinity[1024];
memset(cpu_affinity,0,sizeof(cpu_affinity));
for (int j = 0; j < get_nprocs(); j++)
if (CPU_ISSET(j, &cpuset)) {
char temp[1024];
sprintf (temp, " CPU_%d", j);
strcat(cpu_affinity, temp);
}
printf( "Setting the affinity of main function to CPU %s, for device library to use CPU only!\n",cpu_affinity);
}
#endif
......@@ -1189,7 +1231,7 @@ int main( int argc, char **argv )
(RC.nb_inst > 0)) {
// don't create if node doesn't connect to RRC/S1/GTP
if (create_tasks(UE_flag ? 0 : 1, UE_flag ? 1 : 0) < 0) {
if (create_tasks(UE_flag ? 0 : 1, UE_flag ? NB_UE_INST : 0) < 0) {
printf("cannot create ITTI tasks\n");
exit(-1); // need a softer mode
}
......
......@@ -91,7 +91,7 @@ int32_t **txdata;
#ifdef UE_EXPANSION_SIM2
UE_RX_RECEIVE_INFO ue_rx_receive_info[10];
//uint8_t pdcp_end_flag[RX_NB_TH][256];
int ue_sd_c;
int ue_sd_s;
extern int udp_socket_ip_enb;
......@@ -642,7 +642,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
sprintf(threadname,"UE_%d_proc_%d", UE->Mod_id, proc->sub_frame_start);
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
#if 0
if ( (proc->sub_frame_start+1)%RX_NB_TH == 0 && threads.one != -1 )
CPU_SET(threads.one, &cpuset);
if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.two != -1 )
......@@ -650,6 +650,8 @@ static void *UE_thread_rxn_txnp4(void *arg) {
if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.three != -1 )
CPU_SET(threads.three, &cpuset);
//CPU_SET(threads.three, &cpuset);
#endif
CPU_SET(18+(UE->Mod_id%8), &cpuset);
init_thread(900000,1000000 , FIFO_PRIORITY-1, &cpuset,
threadname);
......@@ -828,7 +830,11 @@ static void *UE_thread_rxn_txnp4(void *arg) {
proc->subframe_tx,
subframe_select(&UE->frame_parms,proc->subframe_tx),
0,
0/*FIXME CC_id*/);
0/*FIXME CC_id*/
#ifdef UE_EXPANSION_SIM2
,proc->sub_frame_start
#endif
);
if ( ret != CONNECTION_OK) {
char *txt;
switch (ret) {
......@@ -871,6 +877,8 @@ static void *UE_thread_rxn_txnp4(void *arg) {
if (UE->mode != loop_through_memory)
phy_procedures_UE_S_TX(UE,0,0,no_relay);
#else
}else{
//pdcp_end_flag[proc->sub_frame_start][UE->Mod_id] = 1;
}
ue_tx_info[proc->sub_frame_start][UE->Mod_id].flag = 1;
#endif
......@@ -929,7 +937,8 @@ void* UE_time_sync(void *arg){
int inst;
uint8_t CC_id;
int ue_inst = 0;
protocol_ctxt_t ctxt;
volatile uint8_t thread_idx = 0;
sprintf(threadname,"UE_time_sync");
cpu_set_t cpuset;
......@@ -1013,6 +1022,11 @@ void* UE_time_sync(void *arg){
PHY_vars_UE_g[0][CC_id]->proc.proc_rxtx[thread_idx].frame_tx = (frame + (subframe > 5 ? 1: 0))&1023;
PHY_vars_UE_g[0][CC_id]->proc.proc_rxtx[thread_idx].subframe_tx = (subframe +4)%10;
}
//memset(&pdcp_end_flag[thread_idx][0],0,256);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0,
PHY_vars_UE_g[0][0]->proc.proc_rxtx[thread_idx].frame_tx,
PHY_vars_UE_g[0][0]->proc.proc_rxtx[thread_idx].subframe_tx, 0);
pdcp_run(&ctxt);
if(pthread_mutex_lock(&mutex_rxtx[thread_idx]) != 0){
LOG_E( MAC, "[UE] ERROR locking mutex for cond rxtx[%d] \n", thread_idx );
......@@ -1342,8 +1356,8 @@ static void* UE_phy_rev( void* arg ) {
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
if ( threads.iq != -1 )
CPU_SET(threads.iq, &cpuset);
// if ( threads.iq != -1 )
CPU_SET(15, &cpuset);
init_thread(100000, 500000, FIFO_PRIORITY-1, &cpuset,
"UE_phy_rev");
......@@ -1424,8 +1438,8 @@ static void* UE_phy_send( void* param ) {
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
if ( threads.iq != -1 )
CPU_SET(threads.iq, &cpuset);
// if ( threads.iq != -1 )
CPU_SET(13+thread_idx, &cpuset);
init_thread(100000, 500000, FIFO_PRIORITY-1, &cpuset,
"UE_phy_send");
......
......@@ -298,14 +298,19 @@ void thread_top_init(char *thread_name,
/* Enable CPU Affinity only if number of CPUs >2 */
CPU_ZERO(&cpuset);
#ifdef CPU_AFFINITY
//#ifdef CPU_AFFINITY
#if 1
if (get_nprocs() > 2)
{
#if 0
if (affinity == 0)
CPU_SET(0,&cpuset);
else
for (j = 1; j < get_nprocs(); j++)
CPU_SET(j, &cpuset);
#else
CPU_SET(affinity, &cpuset);
#endif
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
......@@ -345,7 +350,7 @@ void thread_top_init(char *thread_name,
exit_fun("Error getting thread priority");
}
LOG_I(HW, "[SCHED][eNB] %s started on CPU %d, sched_policy = %s , priority = %d, CPU Affinity=%s \n",thread_name,sched_getcpu(),
printf("[SCHED][eNB] %s started on CPU %d, sched_policy = %s , priority = %d, CPU Affinity=%s \n",thread_name,sched_getcpu(),
(policy == SCHED_FIFO) ? "SCHED_FIFO" :
(policy == SCHED_RR) ? "SCHED_RR" :
(policy == SCHED_OTHER) ? "SCHED_OTHER" :
......
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