Commit b841938a authored by yangjian's avatar yangjian

merge amf-arm

parents 7146804d bf6d3952
etc/amf.conf merge=ours
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
# #
####################################### #######################################
#SUPPORTED_DISTRO="Ubuntu 18.04, CentOS 7, RHEL 7" #SUPPORTED_DISTRO="Ubuntu 18.04, CentOS 7, RHEL 7"
SUPPORTED_DISTRO="Ubuntu 18.04" SUPPORTED_DISTRO="Ubuntu 18.04, Ubuntu 20.04"
if [ ! -f /etc/os-release ]; then if [ ! -f /etc/os-release ]; then
echo_fatal "No /etc/os-release file found. You're likely on an unsupported distro." echo_fatal "No /etc/os-release file found. You're likely on an unsupported distro."
fi fi
...@@ -128,6 +128,7 @@ check_supported_distribution() { ...@@ -128,6 +128,7 @@ check_supported_distribution() {
local distribution=$(get_distribution_release) local distribution=$(get_distribution_release)
case "$distribution" in case "$distribution" in
"ubuntu18.04") return 0 ;; "ubuntu18.04") return 0 ;;
"ubuntu20.04") return 0 ;;
#"rhel7") return 0 ;; #"rhel7") return 0 ;;
#"centos7") return 0 ;; #"centos7") return 0 ;;
esac esac
......
...@@ -271,6 +271,13 @@ check_install_amf_deps(){ ...@@ -271,6 +271,13 @@ check_install_amf_deps(){
specific_packages="libconfig++-dev libasio-dev libboost-all-dev" specific_packages="libconfig++-dev libasio-dev libboost-all-dev"
fi fi
;; ;;
"ubuntu20.04")
if [ $IS_CONTAINER -eq 0 ]; then
specific_packages="libconfig++-dev libasio-dev libboost-all-dev mysql-server"
else
specific_packages="libconfig++-dev libasio-dev libboost-all-dev"
fi
;;
esac esac
# removed libspdlog-dev # removed libspdlog-dev
PACKAGE_LIST="\ PACKAGE_LIST="\
...@@ -282,7 +289,7 @@ check_install_amf_deps(){ ...@@ -282,7 +289,7 @@ check_install_amf_deps(){
guile-2.0-dev \ guile-2.0-dev \
libcurl4-gnutls-dev \ libcurl4-gnutls-dev \
libevent-dev \ libevent-dev \
libgcrypt11-dev \ libgcrypt20-dev \
libgmp-dev \ libgmp-dev \
libhogweed? \ libhogweed? \
libidn2-0-dev \ libidn2-0-dev \
......
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
AMF =
{
INSTANCE_ID = 10; # 0 is the default
PID_DIRECTORY = "/var/run"; # /var/run is the default
AMF_NAME = "OAI-AMF";
RELATIVE_CAPACITY = 50;
# Display statistics about whole system (in seconds)
STATISTICS_TIMER_INTERVAL = 20; # YOUR CONFIG HERE
CORE_CONFIGURATION:
{
EMERGENCY_SUPPORT = "false";
};
GUAMI:
{
MCC = "460"; MNC = "11"; RegionID = "128"; AMFSetID = "4"; AMFPointer = "1" # YOUR GUAMI CONFIG HERE
}
SERVED_GUAMI_LIST = (
{MCC = "460"; MNC = "11"; RegionID = "128"; AMFSetID = "4"; AMFPointer = "1"} #48bits <MCC><MNC><RegionID><AMFSetID><AMFPointer>
);
PLMN_SUPPORT_LIST = (
{
MCC = "460"; MNC = "11"; TAC = 100; # YOUR PLMN CONFIG HERE
SLICE_SUPPORT_LIST = (
{SST = "1"; SD = "none"} # YOUR NSSAI CONFIG HERE
)
}
);
INTERFACES:
{
# AMF binded interface for N1/N2 interface (NGAP)
NGAP_AMF:
{
INTERFACE_NAME = "eth0"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read";
PORT = 38412; # YOUR NETWORK CONFIG HERE
PPID = 60; # YOUR NETWORK CONFIG HERE
};
# AMF binded interface for Nausf interface
NAUSF:
{
INTERFACE_NAME = "eth0"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "192.168.199.181/24";
PORT = 8383; # YOUR NETWORK CONFIG HERE
};
# AMF binded interface for N11
N11:
{
INTERFACE_NAME = "lo"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "127.0.0.1/24";
PORT = 8282; # YOUR NETWORK CONFIG HERE
SMF_INSTANCES_POOL = (
{SMF_INSTANCE_ID = 1; IPV4_ADDRESS = "127.0.0.2"; PORT = "8889"; VERSION = "v1"; SELECTED = "true"}, # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = 2; IPV4_ADDRESS = "10.103.238.21"; PORT = "8181"; VERSION = "v1"; SELECTED = "false"} # YOUR SMF CONFIG HERE
);
};
};
AUTHENTICATION:
{
## MySQL mandatory options
MYSQL_server = "127.0.0.1"; # MySQL Server address
MYSQL_user = "openxg"; # Database server login
MYSQL_pass = "123456"; # Database server password
MYSQL_db = "OPENXG_DB"; # Your database name
## OP
OPERATOR_key = "1006020f0a478bf6b699f15c062e42b3"; # OP key matching your database
RANDOM = "true";
};
NAS:
{
ORDERED_SUPPORTED_INTEGRITY_ALGORITHM_LIST = [ "NIA1" , "NIA0" , "NIA2" ];
ORDERED_SUPPORTED_CIPHERING_ALGORITHM_LIST = [ "NEA0" , "NEA1" , "NEA2" ];
};
};
MODULES =
{
NGAP_MESSAGE = (
{MSG_NAME = "NGSetupRequest"; ProcedureCode = 21; TypeOfMessage = "initialMessage"}
);
};
...@@ -69,6 +69,7 @@ amf_app::amf_app(const amf_config& amf_cfg) { ...@@ -69,6 +69,7 @@ amf_app::amf_app(const amf_config& amf_cfg) {
try { try {
amf_n1_inst = new amf_n1(); amf_n1_inst = new amf_n1();
printf("----------Got N2 Address is %s\n",std::string(inet_ntoa(amf_cfg.n2.addr4)).c_str());
amf_n2_inst = amf_n2_inst =
new amf_n2(std::string(inet_ntoa(amf_cfg.n2.addr4)), amf_cfg.n2.port); new amf_n2(std::string(inet_ntoa(amf_cfg.n2.addr4)), amf_cfg.n2.port);
amf_n11_inst = new amf_n11(); amf_n11_inst = new amf_n11();
...@@ -92,6 +93,7 @@ void amf_app::allRegistredModulesInit(const amf_modules& modules) { ...@@ -92,6 +93,7 @@ void amf_app::allRegistredModulesInit(const amf_modules& modules) {
void amf_app_task(void*) { void amf_app_task(void*) {
const task_id_t task_id = TASK_AMF_APP; const task_id_t task_id = TASK_AMF_APP;
itti_inst->notify_task_ready(task_id); itti_inst->notify_task_ready(task_id);
// set_cpu(1);
do { do {
std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id); std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id);
auto* msg = shared_msg.get(); auto* msg = shared_msg.get();
......
This diff is collapsed.
...@@ -101,6 +101,7 @@ void amf_n11_task(void*); ...@@ -101,6 +101,7 @@ void amf_n11_task(void*);
void amf_n11_task(void*) { void amf_n11_task(void*) {
const task_id_t task_id = TASK_AMF_N11; const task_id_t task_id = TASK_AMF_N11;
itti_inst->notify_task_ready(task_id); itti_inst->notify_task_ready(task_id);
// set_cpu(4);
do { do {
std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id); std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id);
auto* msg = shared_msg.get(); auto* msg = shared_msg.get();
...@@ -554,7 +555,16 @@ void amf_n11::curl_http_client( ...@@ -554,7 +555,16 @@ void amf_n11::curl_http_client(
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, body.length()); curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, body.length());
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body_data); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body_data);
// struct timeval tv1;
// struct timezone tz1;
// gettimeofday(&tv1,&tz1);
// long time_start = tv1.tv_sec*1000000 +tv1.tv_usec;
// std::cout << "*************** time["<< time_start <<"] amf_n11 http curl_easy_perform start ***********"<<std::endl;
res = curl_easy_perform(curl); res = curl_easy_perform(curl);
// gettimeofday(&tv1,&tz1);
// long time_end = tv1.tv_sec*1000000 +tv1.tv_usec;
// std::cout << "*************** time["<< time_end <<"] amf_n11 http curl_easy_perform end ***********"<<std::endl;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
// get cause from the response // get cause from the response
......
...@@ -83,6 +83,7 @@ void amf_n2_task(void*); ...@@ -83,6 +83,7 @@ void amf_n2_task(void*);
void amf_n2_task(void* args_p) { void amf_n2_task(void* args_p) {
const task_id_t task_id = TASK_AMF_N2; const task_id_t task_id = TASK_AMF_N2;
itti_inst->notify_task_ready(task_id); itti_inst->notify_task_ready(task_id);
// set_cpu(3);
do { do {
std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id); std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id);
auto* msg = shared_msg.get(); auto* msg = shared_msg.get();
...@@ -492,7 +493,8 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) { ...@@ -492,7 +493,8 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
itti_msg->is_5g_s_tmsi_present = false; itti_msg->is_5g_s_tmsi_present = false;
Logger::amf_n2().debug("5g_s_tmsi not present"); Logger::amf_n2().debug("5g_s_tmsi not present");
} else { } else {
itti_msg->is_5g_s_tmsi_present = true; // itti_msg->is_5g_s_tmsi_present = true;
itti_msg->is_5g_s_tmsi_present = false;
itti_msg->_5g_s_tmsi = _5g_s_tmsi; itti_msg->_5g_s_tmsi = _5g_s_tmsi;
Logger::amf_n2().debug("5g_s_tmsi present"); Logger::amf_n2().debug("5g_s_tmsi present");
...@@ -682,29 +684,29 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) { ...@@ -682,29 +684,29 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
Logger::amf_n2().debug("Encoding parameters for Service Request"); Logger::amf_n2().debug("Encoding parameters for Service Request");
if (itti_msg.is_pdu_exist) { if (itti_msg.is_pdu_exist) {
std::vector<PDUSessionResourceSetupRequestItem_t> list; // std::vector<PDUSessionResourceSetupRequestItem_t> list;
PDUSessionResourceSetupRequestItem_t item; // PDUSessionResourceSetupRequestItem_t item;
item.pduSessionId = itti_msg.pdu_session_id; // item.pduSessionId = itti_msg.pdu_session_id;
// item.s_nssai.sst = "01"; // // item.s_nssai.sst = "01";
// item.s_nssai.sd = "None"; // // item.s_nssai.sd = "None";
item.s_nssai.sst = amf_cfg.plmn_list[0].slice_list[0].sST; // item.s_nssai.sst = amf_cfg.plmn_list[0].slice_list[0].sST;
item.s_nssai.sd = amf_cfg.plmn_list[0].slice_list[0].sD; // item.s_nssai.sd = amf_cfg.plmn_list[0].slice_list[0].sD;
item.pduSessionNAS_PDU = NULL; // item.pduSessionNAS_PDU = NULL;
if (itti_msg.isn2sm_avaliable) { // if (itti_msg.isn2sm_avaliable) {
//bstring n2sm = itti_msg.n2sm; // //bstring n2sm = itti_msg.n2sm;
if (blength(itti_msg.n2sm) != 0) { // if (blength(itti_msg.n2sm) != 0) {
Logger::amf_n2().debug("*** test into itti_msg.n2sm ***"); // Logger::amf_n2().debug("*** test into itti_msg.n2sm ***");
item.pduSessionResourceSetupRequestTransfer.buf = // item.pduSessionResourceSetupRequestTransfer.buf =
(uint8_t*) bdata(itti_msg.n2sm); // (uint8_t*) bdata(itti_msg.n2sm);
Logger::amf_n2().debug("*** test into item.pduSessionResourceSetupRequestTransfer.buf ***"); // Logger::amf_n2().debug("*** test into item.pduSessionResourceSetupRequestTransfer.buf ***");
item.pduSessionResourceSetupRequestTransfer.size = // item.pduSessionResourceSetupRequestTransfer.size =
blength(itti_msg.n2sm); // blength(itti_msg.n2sm);
} else { // } else {
Logger::amf_n2().error("n2sm empty!"); // Logger::amf_n2().error("n2sm empty!");
} // }
} // }
list.push_back(item); // list.push_back(item);
msg->setPduSessionResourceSetupRequestList(list); // msg->setPduSessionResourceSetupRequestList(list);
msg->setUEAggregateMaxBitRate( msg->setUEAggregateMaxBitRate(
0x08a7d8c0, 0x20989680); // TODO: remove hardcoded value 0x08a7d8c0, 0x20989680); // TODO: remove hardcoded value
} }
...@@ -900,12 +902,12 @@ void amf_n2::handle_itti_message(itti_ue_context_release_command& itti_msg) { ...@@ -900,12 +902,12 @@ void amf_n2::handle_itti_message(itti_ue_context_release_command& itti_msg) {
if (itti_msg.cause.getChoiceOfCause() == Ngap_Cause_PR_nas) { if (itti_msg.cause.getChoiceOfCause() == Ngap_Cause_PR_nas) {
ueCtxRelCmd->setCauseNas((e_Ngap_CauseNas) itti_msg.cause.getValue()); ueCtxRelCmd->setCauseNas((e_Ngap_CauseNas) itti_msg.cause.getValue());
} }
if (itti_msg.cause.getChoiceOfCause() == Ngap_Cause_PR_radioNetwork) { else if (itti_msg.cause.getChoiceOfCause() == Ngap_Cause_PR_radioNetwork) {
ueCtxRelCmd->setCauseRadioNetwork( ueCtxRelCmd->setCauseRadioNetwork(
(e_Ngap_CauseRadioNetwork) itti_msg.cause.getValue()); (e_Ngap_CauseRadioNetwork) itti_msg.cause.getValue());
} }
uint8_t buffer[200]; uint8_t buffer[BUFFER_SIZE_512];
int encoded_size = ueCtxRelCmd->encode2buffer(buffer, 200); int encoded_size = ueCtxRelCmd->encode2buffer(buffer, BUFFER_SIZE_512);
delete ueCtxRelCmd; delete ueCtxRelCmd;
bstring b = blk2bstr(buffer, encoded_size); bstring b = blk2bstr(buffer, encoded_size);
sctp_s_38412.sctp_send_msg( sctp_s_38412.sctp_send_msg(
......
...@@ -45,6 +45,7 @@ nas_context::nas_context() { ...@@ -45,6 +45,7 @@ nas_context::nas_context() {
ueSecurityCaplen = 2; ueSecurityCaplen = 2;
ueSecurityCapEEnc = 0; ueSecurityCapEEnc = 0;
ueSecurityCapEInt = 0; ueSecurityCapEInt = 0;
ngKsi = 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -276,6 +276,8 @@ std::shared_ptr<itti_msg> itti_mw::receive_msg(task_id_t task_id) { ...@@ -276,6 +276,8 @@ std::shared_ptr<itti_msg> itti_mw::receive_msg(task_id_t task_id) {
std::shared_ptr<itti_msg> msg = std::shared_ptr<itti_msg> msg =
itti_task_ctxts[task_id]->msg_queue.front(); itti_task_ctxts[task_id]->msg_queue.front();
itti_task_ctxts[task_id]->msg_queue.pop(); itti_task_ctxts[task_id]->msg_queue.pop();
// std::cout << "*************** task_id ("<< task_id << ") queue_num = " << itti_task_ctxts[task_id]->msg_queue.size()<<"***********"<<std::endl;
return msg; return msg;
} }
} }
......
...@@ -135,6 +135,7 @@ ...@@ -135,6 +135,7 @@
#define _5GMM_CAUSE_SYNCH_FAILURE 0b00010101 #define _5GMM_CAUSE_SYNCH_FAILURE 0b00010101
#define _5GMM_CAUSE_IMPLICITLY_DE_REGISTERED 10 #define _5GMM_CAUSE_IMPLICITLY_DE_REGISTERED 10
#define _5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED 9 #define _5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED 9
#define _5GMM_CAUSE_NGKSI_ALREADY_IN_USE 71
// A.5 Causes related to invalid messages // A.5 Causes related to invalid messages
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#define _5GMM_CAUSE_SEMANTICALLY_INCORRECT 95 #define _5GMM_CAUSE_SEMANTICALLY_INCORRECT 95
......
...@@ -659,24 +659,27 @@ int _5GSMobilityIdentity::_5g_guti_decodefrombuffer(uint8_t* buf, int len) { ...@@ -659,24 +659,27 @@ int _5GSMobilityIdentity::_5g_guti_decodefrombuffer(uint8_t* buf, int len) {
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
decoded_size++; decoded_size++;
Logger::nas_mm().debug("Octet 0x%x", octet); Logger::nas_mm().debug("Octet 0x%x", octet);
digit[0] = octet; digit[3] = octet;
tmsi |= octet; // tmsi |= octet;
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
decoded_size++; decoded_size++;
Logger::nas_mm().debug("Octet 0x%x", octet); Logger::nas_mm().debug("Octet 0x%x", octet);
digit[1] = octet; digit[2] = octet;
tmsi |= octet << 8; // tmsi |= octet << 8;
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
decoded_size++; decoded_size++;
Logger::nas_mm().debug("Octet 0x%x", octet); Logger::nas_mm().debug("Octet 0x%x", octet);
digit[2] = octet; digit[1] = octet;
tmsi |= octet << 16; // tmsi |= octet << 16;
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
decoded_size++; decoded_size++;
Logger::nas_mm().debug("Octet 0x%x", octet); Logger::nas_mm().debug("Octet 0x%x", octet);
digit[3] = octet; digit[0] = octet;
tmsi |= octet << 24; // tmsi |= octet << 24;
_5g_guti->_5g_tmsi = tmsi; for(int i=0;i<4;i++)
tmsi |= (digit[i] << (i * 8));
_5g_guti->_5g_tmsi = tmsi;
Logger::nas_mm().debug("decoding 5GSMobilityIdentity 5G-GUTI"); Logger::nas_mm().debug("decoding 5GSMobilityIdentity 5G-GUTI");
return decoded_size; return decoded_size;
} }
......
...@@ -243,7 +243,9 @@ asn_dec_rval_t NativeEnumerated_decode_aper( ...@@ -243,7 +243,9 @@ asn_dec_rval_t NativeEnumerated_decode_aper(
} }
ASN_DEBUG("Decoding %s as NativeEnumerated", td->name); ASN_DEBUG("Decoding %s as NativeEnumerated", td->name);
#if TEST0515_IS_ON
printf("test0515 Decoding %s as NativeEnumerated\n", td->name); printf("test0515 Decoding %s as NativeEnumerated\n", td->name);
#endif
if (ct->flags & APC_EXTENSIBLE) { if (ct->flags & APC_EXTENSIBLE) {
int inext = per_get_few_bits(pd, 1); int inext = per_get_few_bits(pd, 1);
......
...@@ -321,7 +321,9 @@ asn_dec_rval_t NativeInteger_decode_aper( ...@@ -321,7 +321,9 @@ asn_dec_rval_t NativeInteger_decode_aper(
(void) opt_codec_ctx; (void) opt_codec_ctx;
ASN_DEBUG("Decoding NativeInteger %s (APER)", td->name); ASN_DEBUG("Decoding NativeInteger %s (APER)", td->name);
#if TEST0515_IS_ON
printf("test0515 Decoding NativeInteger %s (APER)\n", td->name); printf("test0515 Decoding NativeInteger %s (APER)\n", td->name);
#endif
if (!native) { if (!native) {
native = (long*) (*sptr = CALLOC(1, sizeof(*native))); native = (long*) (*sptr = CALLOC(1, sizeof(*native)));
......
...@@ -1033,9 +1033,11 @@ asn_dec_rval_t CHOICE_decode_aper( ...@@ -1033,9 +1033,11 @@ asn_dec_rval_t CHOICE_decode_aper(
if (value < 0) ASN__DECODE_STARVED; if (value < 0) ASN__DECODE_STARVED;
ASN_DEBUG( ASN_DEBUG(
"CHOICE %s got index %d in range %d", td->name, value, ct->range_bits); "CHOICE %s got index %d in range %d", td->name, value, ct->range_bits);
#if TEST0515_IS_ON
printf( printf(
"test0515 CHOICE %s got index %d in range %d\n", td->name, value, "test0515 CHOICE %s got index %d in range %d\n", td->name, value,
ct->range_bits); ct->range_bits);
#endif
if (value > ct->upper_bound) ASN__DECODE_FAILED; if (value > ct->upper_bound) ASN__DECODE_FAILED;
} else { } else {
if (specs->ext_start == -1) ASN__DECODE_FAILED; if (specs->ext_start == -1) ASN__DECODE_FAILED;
...@@ -1050,7 +1052,9 @@ asn_dec_rval_t CHOICE_decode_aper( ...@@ -1050,7 +1052,9 @@ asn_dec_rval_t CHOICE_decode_aper(
/* Set presence to be able to free it later */ /* Set presence to be able to free it later */
_set_present_idx(st, specs->pres_offset, specs->pres_size, value + 1); _set_present_idx(st, specs->pres_offset, specs->pres_size, value + 1);
#if TEST1130_IS_ON
printf("test1130 decoding td->name %s set present %d\n", td->name, value + 1); printf("test1130 decoding td->name %s set present %d\n", td->name, value + 1);
#endif
elm = &td->elements[value]; elm = &td->elements[value];
if (elm->flags & ATF_POINTER) { if (elm->flags & ATF_POINTER) {
/* Member is a pointer to another structure */ /* Member is a pointer to another structure */
...@@ -1060,9 +1064,11 @@ asn_dec_rval_t CHOICE_decode_aper( ...@@ -1060,9 +1064,11 @@ asn_dec_rval_t CHOICE_decode_aper(
memb_ptr2 = &memb_ptr; memb_ptr2 = &memb_ptr;
} }
ASN_DEBUG("Discovered CHOICE %s encodes %s", td->name, elm->name); ASN_DEBUG("Discovered CHOICE %s encodes %s", td->name, elm->name);
#if TEST1130_IS_ON
printf( printf(
"test1130 decoding element(%s) in td->name(%s), pointer(%p)\n", elm->name, "test1130 decoding element(%s) in td->name(%s), pointer(%p)\n", elm->name,
td->name, memb_ptr2); td->name, memb_ptr2);
#endif
if (ct && ct->range_bits >= 0) { if (ct && ct->range_bits >= 0) {
rv = elm->type->op->aper_decoder( rv = elm->type->op->aper_decoder(
...@@ -1077,9 +1083,11 @@ asn_dec_rval_t CHOICE_decode_aper( ...@@ -1077,9 +1083,11 @@ asn_dec_rval_t CHOICE_decode_aper(
if (rv.code != RC_OK) { if (rv.code != RC_OK) {
ASN_DEBUG( ASN_DEBUG(
"Failed to decode %s in %s (CHOICE) %d", elm->name, td->name, rv.code); "Failed to decode %s in %s (CHOICE) %d", elm->name, td->name, rv.code);
#if TEST0515_IS_ON
printf( printf(
"test0515 Failed to decode %s in %s (CHOICE) %d\n", elm->name, td->name, "test0515 Failed to decode %s in %s (CHOICE) %d\n", elm->name, td->name,
rv.code); rv.code);
#endif
} }
return rv; return rv;
} }
...@@ -1169,32 +1177,42 @@ int CHOICE_print( ...@@ -1169,32 +1177,42 @@ int CHOICE_print(
const asn_CHOICE_specifics_t* specs = const asn_CHOICE_specifics_t* specs =
(const asn_CHOICE_specifics_t*) td->specifics; (const asn_CHOICE_specifics_t*) td->specifics;
unsigned present; unsigned present;
#if TEST1130_IS_ON
if (!sptr) if (!sptr)
printf("test1130 sptr null\n"); printf("test1130 sptr null\n");
else else
printf("test1130 OK\n"); printf("test1130 OK\n");
#endif
if (!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0; if (!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
/* /*
* Figure out which CHOICE element is encoded. * Figure out which CHOICE element is encoded.
*/ */
present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size);
#if TEST1130_IS_ON
printf("test1130 present %d, td->elements %d\n", present, td->elements_count); printf("test1130 present %d, td->elements %d\n", present, td->elements_count);
#endif
/* /*
* Print that element. * Print that element.
*/ */
if (present > 0 && present <= td->elements_count) { if (present > 0 && present <= td->elements_count) {
asn_TYPE_member_t* elm = &td->elements[present - 1]; asn_TYPE_member_t* elm = &td->elements[present - 1];
#if TEST1130_IS_ON
printf("test1130 td_name %s, element_name %s\n", td->name, elm->name); printf("test1130 td_name %s, element_name %s\n", td->name, elm->name);
#endif
const void* memb_ptr; const void* memb_ptr;
if (elm->flags & ATF_POINTER) { if (elm->flags & ATF_POINTER) {
memb_ptr = *(const void* const*) ((const char*) sptr + elm->memb_offset); memb_ptr = *(const void* const*) ((const char*) sptr + elm->memb_offset);
#if TEST1130_IS_ON
printf("test1130 memb_ptr1 (%p)\n", memb_ptr); printf("test1130 memb_ptr1 (%p)\n", memb_ptr);
#endif
if (!memb_ptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0; if (!memb_ptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
} else { } else {
memb_ptr = (const void*) ((const char*) sptr + elm->memb_offset); memb_ptr = (const void*) ((const char*) sptr + elm->memb_offset);
#if TEST1130_IS_ON
printf("test1130 memb_ptr2 (%p)\n", memb_ptr); printf("test1130 memb_ptr2 (%p)\n", memb_ptr);
#endif
} }
/* Print member's name and stuff */ /* Print member's name and stuff */
...@@ -1207,7 +1225,9 @@ int CHOICE_print( ...@@ -1207,7 +1225,9 @@ int CHOICE_print(
return elm->type->op->print_struct( return elm->type->op->print_struct(
elm->type, memb_ptr, ilevel, cb, app_key); elm->type, memb_ptr, ilevel, cb, app_key);
} else { } else {
#if TEST1130_IS_ON
printf("test1130 casued by present = %d\n", present); printf("test1130 casued by present = %d\n", present);
#endif
return (cb("<absent>", 8, app_key) < 0) ? -1 : 0; return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
} }
} }
......
...@@ -932,10 +932,12 @@ int SEQUENCE_print( ...@@ -932,10 +932,12 @@ int SEQUENCE_print(
asn_app_consume_bytes_f* cb, void* app_key) { asn_app_consume_bytes_f* cb, void* app_key) {
size_t edx; size_t edx;
int ret; int ret;
#if TEST1130_IS_ON
if (!sptr) if (!sptr)
printf("test1130 memory not present %s \n", td->name); printf("test1130 memory not present %s \n", td->name);
else else
printf("test1130 memory present %s \n", td->name); printf("test1130 memory present %s \n", td->name);
#endif
if (!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0; if (!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
/* Dump preamble */ /* Dump preamble */
...@@ -957,7 +959,9 @@ int SEQUENCE_print( ...@@ -957,7 +959,9 @@ int SEQUENCE_print(
} }
} else { } else {
memb_ptr = (const void*) ((const char*) sptr + elm->memb_offset); memb_ptr = (const void*) ((const char*) sptr + elm->memb_offset);
#if TEST1130_IS_ON
printf("test1130 element name(%s): mem_ptr(%p)\n", elm->name, memb_ptr); printf("test1130 element name(%s): mem_ptr(%p)\n", elm->name, memb_ptr);
#endif
} }
/* Indentation */ /* Indentation */
...@@ -1498,7 +1502,9 @@ asn_dec_rval_t SEQUENCE_decode_aper( ...@@ -1498,7 +1502,9 @@ asn_dec_rval_t SEQUENCE_decode_aper(
} }
ASN_DEBUG("Decoding %s as SEQUENCE (APER)", td->name); ASN_DEBUG("Decoding %s as SEQUENCE (APER)", td->name);
#if TEST0515_IS_ON
printf("test0515 Decoding %s as SEQUENCE (APER)\n", td->name); printf("test0515 Decoding %s as SEQUENCE (APER)\n", td->name);
#endif
/* Handle extensions */ /* Handle extensions */
if (specs->first_extension < 0) { if (specs->first_extension < 0) {
...@@ -1532,7 +1538,9 @@ asn_dec_rval_t SEQUENCE_decode_aper( ...@@ -1532,7 +1538,9 @@ asn_dec_rval_t SEQUENCE_decode_aper(
*/ */
for (edx = 0; edx < td->elements_count; edx++) { for (edx = 0; edx < td->elements_count; edx++) {
asn_TYPE_member_t* elm = &td->elements[edx]; asn_TYPE_member_t* elm = &td->elements[edx];
#if TEST1130_IS_ON
printf("test1130 decoding element (%s)\n", elm->name); printf("test1130 decoding element (%s)\n", elm->name);
#endif
void* memb_ptr; /* Pointer to the member */ void* memb_ptr; /* Pointer to the member */
void** memb_ptr2; /* Pointer to that pointer */ void** memb_ptr2; /* Pointer to that pointer */
#if 0 #if 0
...@@ -1572,9 +1580,11 @@ asn_dec_rval_t SEQUENCE_decode_aper( ...@@ -1572,9 +1580,11 @@ asn_dec_rval_t SEQUENCE_decode_aper(
ASN_DEBUG( ASN_DEBUG(
"Member %s->%s is optional, p=%d (%d->%d)", td->name, elm->name, "Member %s->%s is optional, p=%d (%d->%d)", td->name, elm->name,
present, (int) opmd.nboff, (int) opmd.nbits); present, (int) opmd.nboff, (int) opmd.nbits);
#if TEST0515_IS_ON
printf( printf(
"test0515 Member %s->%s is optional, p=%d (%d->%d)\n", td->name, "test0515 Member %s->%s is optional, p=%d (%d->%d)\n", td->name,
elm->name, present, (int) opmd.nboff, (int) opmd.nbits); elm->name, present, (int) opmd.nboff, (int) opmd.nbits);
#endif
if (present == 0) { if (present == 0) {
/* This element is not present */ /* This element is not present */
if (elm->default_value_set) { if (elm->default_value_set) {
...@@ -1593,7 +1603,9 @@ asn_dec_rval_t SEQUENCE_decode_aper( ...@@ -1593,7 +1603,9 @@ asn_dec_rval_t SEQUENCE_decode_aper(
/* Fetch the member from the stream */ /* Fetch the member from the stream */
ASN_DEBUG("Decoding member \"%s\" in %s", elm->name, td->name); ASN_DEBUG("Decoding member \"%s\" in %s", elm->name, td->name);
#if TEST0515_IS_ON
printf("test0515 Decoding member \"%s\" in %s\n", elm->name, td->name); printf("test0515 Decoding member \"%s\" in %s\n", elm->name, td->name);
#endif
if (elm->flags & ATF_OPEN_TYPE) { if (elm->flags & ATF_OPEN_TYPE) {
rv = OPEN_TYPE_aper_get(opt_codec_ctx, td, st, elm, pd); rv = OPEN_TYPE_aper_get(opt_codec_ctx, td, st, elm, pd);
......
...@@ -789,10 +789,12 @@ int SET_OF_print( ...@@ -789,10 +789,12 @@ int SET_OF_print(
const asn_anonymous_set_* list = _A_CSET_FROM_VOID(sptr); const asn_anonymous_set_* list = _A_CSET_FROM_VOID(sptr);
int ret; int ret;
int i; int i;
#if TEST1130_IS_ON
if (!sptr) if (!sptr)
printf("test1130 set_of_printf sptr null\n"); printf("test1130 set_of_printf sptr null\n");
else else
printf("test1130 set_of_printf OK\n"); printf("test1130 set_of_printf OK\n");
#endif
if (!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0; if (!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
/* Dump preamble */ /* Dump preamble */
......
...@@ -33,6 +33,7 @@ ber_tlv_tag_t asn_TYPE_outmost_tag( ...@@ -33,6 +33,7 @@ ber_tlv_tag_t asn_TYPE_outmost_tag(
*/ */
int asn_fprint( int asn_fprint(
FILE* stream, const asn_TYPE_descriptor_t* td, const void* struct_ptr) { FILE* stream, const asn_TYPE_descriptor_t* td, const void* struct_ptr) {
#if ASN_FPRINT_IS_ON
if (!stream) stream = stdout; if (!stream) stream = stdout;
if (!td || !struct_ptr) { if (!td || !struct_ptr) {
errno = EINVAL; errno = EINVAL;
...@@ -48,7 +49,7 @@ int asn_fprint( ...@@ -48,7 +49,7 @@ int asn_fprint(
if (_print2fp("\n", 1, stream)) { if (_print2fp("\n", 1, stream)) {
return -1; return -1;
} }
#endif
return fflush(stream); return fflush(stream);
} }
......
...@@ -79,7 +79,9 @@ static asn_dec_rval_t uper_open_type_get_simple( ...@@ -79,7 +79,9 @@ static asn_dec_rval_t uper_open_type_get_simple(
ASN__STACK_OVERFLOW_CHECK(ctx); ASN__STACK_OVERFLOW_CHECK(ctx);
ASN_DEBUG("Getting open type %s...", td->name); ASN_DEBUG("Getting open type %s...", td->name);
#if TEST1130_IS_ON
printf("test1130 decoding open type %s\n", td->name); printf("test1130 decoding open type %s\n", td->name);
#endif
do { do {
chunk_bytes = uper_get_length(pd, -1, 0, &repeat); chunk_bytes = uper_get_length(pd, -1, 0, &repeat);
...@@ -407,10 +409,14 @@ static asn_dec_rval_t aper_open_type_get_simple( ...@@ -407,10 +409,14 @@ static asn_dec_rval_t aper_open_type_get_simple(
ASN__STACK_OVERFLOW_CHECK(ctx); ASN__STACK_OVERFLOW_CHECK(ctx);
ASN_DEBUG("Getting open type %s...", td->name); ASN_DEBUG("Getting open type %s...", td->name);
#if TEST0515_IS_ON
printf("test0515 Getting open type %s...\n", td->name); printf("test0515 Getting open type %s...\n", td->name);
#endif
do { do {
#if TEST1130_IS_ON
printf("test1130 while repeat1(%d)\n", repeat); printf("test1130 while repeat1(%d)\n", repeat);
#endif
chunk_bytes = aper_get_length(pd, -1, -1, &repeat); chunk_bytes = aper_get_length(pd, -1, -1, &repeat);
if (chunk_bytes < 0) { if (chunk_bytes < 0) {
FREEMEM(buf); FREEMEM(buf);
...@@ -431,14 +437,18 @@ static asn_dec_rval_t aper_open_type_get_simple( ...@@ -431,14 +437,18 @@ static asn_dec_rval_t aper_open_type_get_simple(
ASN__DECODE_STARVED; ASN__DECODE_STARVED;
} }
bufLen += chunk_bytes; bufLen += chunk_bytes;
#if TEST1130_IS_ON
printf("test1130 while repeat2(%d)\n", repeat); printf("test1130 while repeat2(%d)\n", repeat);
#endif
} while (repeat); } while (repeat);
// ASN_DEBUG("Getting open type %s encoded in %ld bytes", td->name, // ASN_DEBUG("Getting open type %s encoded in %ld bytes", td->name,
// (long)bufLen); // (long)bufLen);
#if TEST1130_IS_ON
printf( printf(
"test1130 Getting open type %s encoded in %ld bytes\n", td->name, "test1130 Getting open type %s encoded in %ld bytes\n", td->name,
(long) bufLen); (long) bufLen);
#endif
memset(&spd, 0, sizeof(spd)); memset(&spd, 0, sizeof(spd));
spd.buffer = buf; spd.buffer = buf;
......
...@@ -81,8 +81,6 @@ void PlmnId::getMnc(std::string& mnc) { ...@@ -81,8 +81,6 @@ void PlmnId::getMnc(std::string& mnc) {
mnc = to_string(mnc_digit2); mnc = to_string(mnc_digit2);
mnc += to_string(mnc_digit3); mnc += to_string(mnc_digit3);
} }
//mnc = to_string(m_mnc);
cout<<"################ MNC "<<mnc<<endl;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -136,6 +136,9 @@ endif() ...@@ -136,6 +136,9 @@ endif()
Message("Architecture is ${CMAKE_SYSTEM_PROCESSOR}") Message("Architecture is ${CMAKE_SYSTEM_PROCESSOR}")
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l") if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
set(C_FLAGS_PROCESSOR "-gdwarf-2 -mfloat-abi=hard -mfpu=neon -lgcc -lrt") set(C_FLAGS_PROCESSOR "-gdwarf-2 -mfloat-abi=hard -mfpu=neon -lgcc -lrt")
elseif ( CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
#set(C_FLAGS_PROCESSOR "-gdwarf-2 -mfloat-abi=hard -mfpu=neon -lgcc -lrt")
set(C_FLAGS_PROCESSOR "-gdwarf-2 -lgcc -lrt")
else (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l") else (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
set(C_FLAGS_PROCESSOR "-msse4.2") set(C_FLAGS_PROCESSOR "-msse4.2")
endif() endif()
...@@ -155,7 +158,8 @@ add_definitions(-DBSTRLIB_CAN_USE_STL=1 -DBSTRLIB_CAN_USE_IOSTREAM=1 -DBSTRLIB_T ...@@ -155,7 +158,8 @@ add_definitions(-DBSTRLIB_CAN_USE_STL=1 -DBSTRLIB_CAN_USE_IOSTREAM=1 -DBSTRLIB_T
if(STATIC_LINKING) if(STATIC_LINKING)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer")
else (STATIC_LINKING) else (STATIC_LINKING)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer") #set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer")
endif(STATIC_LINKING) endif(STATIC_LINKING)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O2 -fno-omit-frame-pointer -s -DINFO_IS_ON=1 ") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O2 -fno-omit-frame-pointer -s -DINFO_IS_ON=1 ")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -O2 -DINFO_IS_ON=1 ") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -O2 -DINFO_IS_ON=1 ")
...@@ -164,7 +168,8 @@ set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS} -Os -s -DTRACE_IS_ON=1 -DDEBUG_IS ...@@ -164,7 +168,8 @@ set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS} -Os -s -DTRACE_IS_ON=1 -DDEBUG_IS
if(STATIC_LINKING) if(STATIC_LINKING)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer")
else(STATIC_LINKING) else(STATIC_LINKING)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer") #set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer")
endif(STATIC_LINKING) endif(STATIC_LINKING)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -fno-omit-frame-pointer -s -DINFO_IS_ON=1") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -fno-omit-frame-pointer -s -DINFO_IS_ON=1")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -std=c++17 -g -O2 -DINFO_IS_ON=1") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -std=c++17 -g -O2 -DINFO_IS_ON=1")
......
...@@ -48,6 +48,8 @@ extern "C" { ...@@ -48,6 +48,8 @@ extern "C" {
#include <iostream> #include <iostream>
#include "thread_sched.hpp"
namespace sctp { namespace sctp {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -91,10 +93,13 @@ void sctp_server::start_receive(sctp_application* app) { ...@@ -91,10 +93,13 @@ void sctp_server::start_receive(sctp_application* app) {
pthread_create(&thread_, NULL, sctp_receiver_thread, (void*) this); pthread_create(&thread_, NULL, sctp_receiver_thread, (void*) this);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void* sctp_server::sctp_receiver_thread(void* arg) { void* sctp_server::sctp_receiver_thread(void* arg) {
sctp_server* ptr = (sctp_server*) arg; sctp_server* ptr = (sctp_server*) arg;
Logger::sctp().info("Create pthread to receive sctp message"); Logger::sctp().info("Create pthread to receive sctp message");
set_cpu(5);
int fdmax; int fdmax;
int clientsock; int clientsock;
fd_set master; fd_set master;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
\company Eurecom \company Eurecom
\email: lionel.gauthier@eurecom.fr \email: lionel.gauthier@eurecom.fr
*/ */
#include <iostream>
#include "thread_sched.hpp" #include "thread_sched.hpp"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -48,3 +48,24 @@ void util::thread_sched_params::apply( ...@@ -48,3 +48,24 @@ void util::thread_sched_params::apply(
"Could not set schedparam to ITTI task %d, err=%d", task_id, rc); "Could not set schedparam to ITTI task %d, err=%d", task_id, rc);
} }
} }
//------------------------------------------------------------------------------
int set_cpu(int cpu_num)
{
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(cpu_num,&cpuset);
// int rc =pthread_setaffinity_np(threads[i].native_handle(),sizeof(cpu_set_t), &cpuset);
int rc =pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (rc != 0) {
std::cerr << "Error calling pthread_setaffinity_np: " << rc << "\n";
}
return rc;
}
\ No newline at end of file
...@@ -44,4 +44,7 @@ class thread_sched_params { ...@@ -44,4 +44,7 @@ class thread_sched_params {
}; };
} // namespace util } // namespace util
int set_cpu(int cpu_num);
#endif /* FILE_THREAD_SCHED_HPP_SEEN */ #endif /* FILE_THREAD_SCHED_HPP_SEEN */
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