Remove netlink/PDCP_USE_NETLINK: it's not used

Remove netlink code, and the PDCP_USE_NETLINK macro, as there is no
known use, it makes the code more complicated, and is simply "technical
debt".

In 4G PDCP, a subtle change has been introduced, in pdcp_module_init()
of pdcp.c. Looking at the diff of this commit, it can be seen that there
is now a new "else-if (ENB_NAS_USE_TUN_W_MBMS_BIT)" branch that is under
what was the "if (PDCP_USE_NETLINK)" branch, while the code fragment was
actually inside the "else" branch of PDCP_USE_NETLINK. This seems to be
necessary: previously, if we did not use noS1 mode and we don't use any
TUN (i.e., the eNB), the else block would set up this interface. It is
important that this interface is brought up, because if we omit it,
RFsim will not work. It seems to me that this interface will regularly
create some traffic; without it, RFsim will be blocked, and the UE
cannot connect.

In short, it seems to be important to have the MBMS interface, which
injects traffic in the RFsim side, which will unblock RFsim. The change
in pdcp_module_init() preserves the total changes of the if-else
(PDCP_USE_NETLINK).
This commit is contained in:
Robert Schmidt
2024-08-01 18:22:45 +02:00
parent bfaa906a1e
commit cf950dfa86
11 changed files with 56 additions and 182 deletions
+24 -35
View File
@@ -2291,46 +2291,35 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask, int id) {
this is while switching from noS1 as build option
to noS1 as config option */
if ( pdcp_optmask & UE_NAS_USE_TUN_BIT) {
pdcp_params.optmask = pdcp_params.optmask | PDCP_USE_NETLINK_BIT ;
pdcp_params.optmask = pdcp_params.optmask;
}
pdcp_params.optmask = pdcp_params.optmask | pdcp_optmask ;
LOG_I(PDCP, "pdcp init,%s %s\n",
((LINK_ENB_PDCP_TO_GTPV1U)?"usegtp":""),
((PDCP_USE_NETLINK)?"usenetlink":""));
if (PDCP_USE_NETLINK) {
nas_getparams();
nas_getparams();
if(UE_NAS_USE_TUN) {
int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)? MAX_MOBILES_PER_ENB : 1;
netlink_init_tun("ue",num_if, id);
if (IS_SOFTMODEM_NOS1)
nas_config(1, 1, 2, "ue");
netlink_init_mbms_tun("uem", id);
nas_config_mbms(1, 2, 2, "uem");
LOG_I(PDCP, "UE pdcp will use tun interface\n");
} else if(ENB_NAS_USE_TUN) {
netlink_init_tun("enb", 1, 0);
nas_config(1, 1, 1, "enb");
if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){
netlink_init_mbms_tun("enm", 0);
nas_config_mbms(1, 2, 1, "enm");
LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n");
}
LOG_I(PDCP, "ENB pdcp will use tun interface\n");
} else {
LOG_I(PDCP, "pdcp will use kernel modules\n");
netlink_init();
if (UE_NAS_USE_TUN) {
int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? MAX_MOBILES_PER_ENB : 1;
netlink_init_tun("ue", num_if, id);
if (IS_SOFTMODEM_NOS1)
nas_config(1, 1, 2, "ue");
netlink_init_mbms_tun("uem", id);
nas_config_mbms(1, 2, 2, "uem");
LOG_I(PDCP, "UE pdcp will use tun interface\n");
} else if (ENB_NAS_USE_TUN) {
netlink_init_tun("enb", 1, 0);
nas_config(1, 1, 1, "enb");
if (pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT) {
netlink_init_mbms_tun("enm", 0);
nas_config_mbms(1, 2, 1, "enm");
LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n");
}
}else{
if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){
LOG_W(PDCP, "ENB pdcp will use tun interface for MBMS\n");
netlink_init_mbms_tun("enm", 0);
nas_config_mbms_s1(1, 2, 1, "enm");
}else
LOG_E(PDCP, "ENB pdcp will not use tun interface\n");
}
LOG_I(PDCP, "ENB pdcp will use tun interface\n");
} else if (pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT) {
netlink_init_mbms_tun("enm", 0);
nas_config_mbms_s1(1, 2, 1, "enm");
LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n");
}
pthread_create(&pdcp_stats_thread_desc,NULL,pdcp_stats_thread,NULL);
@@ -2357,7 +2346,7 @@ pdcp_free (
void pdcp_module_cleanup (void)
//-----------------------------------------------------------------------------
{
netlink_cleanup();
// empty - we could free all contexts, not implemented
}
//-----------------------------------------------------------------------------
-2
View File
@@ -49,7 +49,6 @@
#define MAX_NUMBER_NETIF 1 //16
#define ENB_NAS_USE_TUN_W_MBMS_BIT (1<< 10)
#define PDCP_USE_NETLINK_BIT (1<< 11)
#define LINK_ENB_PDCP_TO_IP_DRIVER_BIT (1<< 13)
#define LINK_ENB_PDCP_TO_GTPV1U_BIT (1<< 14)
#define UE_NAS_USE_TUN_BIT (1<< 15)
@@ -59,7 +58,6 @@ typedef struct {
} pdcp_params_t;
#define PDCP_USE_NETLINK ( get_pdcp_optmask() & PDCP_USE_NETLINK_BIT)
#define LINK_ENB_PDCP_TO_IP_DRIVER ( get_pdcp_optmask() & LINK_ENB_PDCP_TO_IP_DRIVER_BIT)
#define LINK_ENB_PDCP_TO_GTPV1U ( get_pdcp_optmask() & LINK_ENB_PDCP_TO_GTPV1U_BIT)
#define UE_NAS_USE_TUN ( get_pdcp_optmask() & UE_NAS_USE_TUN_BIT)
+8 -18
View File
@@ -136,12 +136,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n");
ret = write(nas_sock_fd[0], pdcpData, pdcpHead->data_size);
LOG_T(PDCP,"[NB PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[0],pdcpHead->data_size);
} else if (PDCP_USE_NETLINK) {
int sizeToWrite= sizeof (pdcp_data_ind_header_t) + pdcpHead->data_size;
memcpy(NLMSG_DATA(nas_nlh_tx), (uint8_t *) pdcpHead, sizeToWrite);
nas_nlh_tx->nlmsg_len = sizeToWrite;
ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0);
} // PDCP_USE_NETLINK
}
AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s), nas_sock_fd[0]: %d\n", errno, strerror(errno), nas_sock_fd[0]);
@@ -422,9 +417,9 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
if (len > 0) {
for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf;
NLMSG_OK (nas_nlh_rx, len);
nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, len)) {
for (struct nlmsghdr *nas_nlh_rx = (struct nlmsghdr *)nl_rx_buf;
NLMSG_OK(nas_nlh_rx, len);
nas_nlh_rx = NLMSG_NEXT(nas_nlh_rx, len)) {
if (nas_nlh_rx->nlmsg_type == NLMSG_DONE) {
LOG_D(PDCP, "[PDCP][NETLINK] RX NLMSG_DONE\n");
//return;
@@ -807,15 +802,10 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
} /* pdcp_fifo_read_input_sdus_frompc5s */
//-----------------------------------------------------------------------------
int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const ctxt_pP) {
if (UE_NAS_USE_TUN || ENB_NAS_USE_TUN) {
return pdcp_fifo_read_input_sdus_fromtun (ctxt_pP);
} else if (PDCP_USE_NETLINK) {
pdcp_fifo_read_input_sdus_frompc5s (ctxt_pP);
return pdcp_fifo_read_input_sdus_fromnetlinksock(ctxt_pP);
} /* PDCP_USE_NETLINK */
return 0;
int pdcp_fifo_read_input_sdus(const protocol_ctxt_t *const ctxt_pP)
{
DevAssert(UE_NAS_USE_TUN || ENB_NAS_USE_TUN);
return pdcp_fifo_read_input_sdus_fromtun(ctxt_pP);
}
//TTN for D2D (PC5S)