Commit f6e664af authored by Lionel Gauthier's avatar Lionel Gauthier

Modified ETHERNET DRIVER: deleted the classifier, classification is done by...

Modified ETHERNET DRIVER: deleted the classifier, classification is done by marking. Changed netlink reading code in pdcp_fifo.c

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4007 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent d44ccd24
...@@ -16,12 +16,19 @@ ...@@ -16,12 +16,19 @@
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>
#define MAX_PAYLOAD 4096 /* this sould cover the max mtu size*/ #include <errno.h>
#include "platform_constants.h"
char nl_rx_buf[NL_MAX_PAYLOAD];
struct sockaddr_nl nas_src_addr, nas_dest_addr; struct sockaddr_nl nas_src_addr, nas_dest_addr;
struct nlmsghdr *nas_nlh = NULL; struct nlmsghdr *nas_nlh_tx = NULL;
struct iovec nas_iov; struct nlmsghdr *nas_nlh_rx = NULL;
struct iovec nas_iov_tx;
struct iovec nas_iov_rx = {nl_rx_buf, sizeof(nl_rx_buf)};
int nas_sock_fd; int nas_sock_fd;
struct msghdr nas_msg; struct msghdr nas_msg_tx;
struct msghdr nas_msg_rx;
#define GRAAL_NETLINK_ID 31 #define GRAAL_NETLINK_ID 31
...@@ -39,36 +46,57 @@ int netlink_init(void) ...@@ -39,36 +46,57 @@ int netlink_init(void)
ret = fcntl(nas_sock_fd,F_SETFL,O_NONBLOCK); ret = fcntl(nas_sock_fd,F_SETFL,O_NONBLOCK);
printf("[NETLINK] fcntl returns %d\n",ret); printf("[NETLINK] fcntl returns %d\n",ret);
nas_sock_fd = socket(PF_NETLINK, SOCK_RAW,GRAAL_NETLINK_ID);
if (nas_sock_fd==-1) {
printf("[NETLINK] Error opening socket %d (%d:%s)\n",nas_sock_fd,errno, strerror(errno));
exit(1);
}
printf("[NETLINK]Opened socket with fd %d\n",nas_sock_fd);
printf("[NETLINK] bind returns %d\n",ret);
if (ret == -1) {
printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
exit(1);
}
memset(&nas_src_addr, 0, sizeof(nas_src_addr)); memset(&nas_src_addr, 0, sizeof(nas_src_addr));
nas_src_addr.nl_family = AF_NETLINK; nas_src_addr.nl_family = AF_NETLINK;
nas_src_addr.nl_pid = 1;//getpid(); /* self pid */ nas_src_addr.nl_pid = 1;//getpid(); /* self pid */
nas_src_addr.nl_groups = 0; /* not in mcast groups */ nas_src_addr.nl_groups = 0; /* not in mcast groups */
ret = bind(nas_sock_fd, (struct sockaddr *)&nas_src_addr, ret = bind(nas_sock_fd, (struct sockaddr*)&nas_src_addr, sizeof(nas_src_addr));
sizeof(nas_src_addr));
printf("[NETLINK] bind returns %d\n",ret);
memset(&nas_dest_addr, 0, sizeof(nas_dest_addr)); memset(&nas_dest_addr, 0, sizeof(nas_dest_addr));
nas_dest_addr.nl_family = AF_NETLINK; nas_dest_addr.nl_family = AF_NETLINK;
nas_dest_addr.nl_pid = 0; /* For Linux Kernel */ nas_dest_addr.nl_pid = 0; /* For Linux Kernel */
nas_dest_addr.nl_groups = 0; /* unicast */ nas_dest_addr.nl_groups = 0; /* unicast */
nas_nlh=(struct nlmsghdr *)malloc(NLMSG_SPACE(MAX_PAYLOAD)); // TX PART
nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD));
memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD));
/* Fill the netlink message header */ /* Fill the netlink message header */
nas_nlh->nlmsg_len = NLMSG_SPACE(MAX_PAYLOAD); nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD);
nas_nlh->nlmsg_pid = 1;//getpid(); /* self pid */ nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */
nas_nlh->nlmsg_flags = 0; nas_nlh_tx->nlmsg_flags = 0;
nas_iov.iov_base = (void *)nas_nlh; nas_iov_tx.iov_base = (void *)nas_nlh_tx;
nas_iov.iov_len = nas_nlh->nlmsg_len; nas_iov_tx.iov_len = nas_nlh_tx->nlmsg_len;
memset(&nas_msg,0,sizeof(nas_msg)); memset(&nas_msg_tx,0,sizeof(nas_msg_tx));
nas_msg.msg_name = (void *)&nas_dest_addr; nas_msg_tx.msg_name = (void *)&nas_dest_addr;
nas_msg.msg_namelen = sizeof(nas_dest_addr); nas_msg_tx.msg_namelen = sizeof(nas_dest_addr);
nas_msg.msg_iov = &nas_iov; nas_msg_tx.msg_iov = &nas_iov_tx;
nas_msg.msg_iovlen = 1; nas_msg_tx.msg_iovlen = 1;
/* Read message from kernel */
memset(nas_nlh, 0, NLMSG_SPACE(MAX_PAYLOAD)); // RX PART
memset(&nas_msg_rx,0,sizeof(nas_msg_rx));
nas_msg_rx.msg_name = (void *)&nas_src_addr;
nas_msg_rx.msg_namelen = sizeof(nas_src_addr);
nas_msg_rx.msg_iov = &nas_iov_rx;
nas_msg_rx.msg_iovlen = 1;
return(nas_sock_fd); return(nas_sock_fd);
} }
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#ifndef __PLATFORM_CONSTANTS_H__ #ifndef __PLATFORM_CONSTANTS_H__
# define __PLATFORM_CONSTANTS_H__ # define __PLATFORM_CONSTANTS_H__
#define NL_MAX_PAYLOAD 4096 /* this should cover the max mtu size*/
#ifdef USER_MODE #ifdef USER_MODE
#ifdef LARGE_SCALE #ifdef LARGE_SCALE
# define NB_MODULES_MAX 128 # define NB_MODULES_MAX 128
...@@ -45,6 +47,7 @@ ...@@ -45,6 +47,7 @@
# define MAX_MANAGED_RG_PER_MOBILE 2 # define MAX_MANAGED_RG_PER_MOBILE 2
# define DEFAULT_RAB_ID 3
# define NB_RB_MAX 11 # define NB_RB_MAX 11
# define NB_RAB_MAX 8 // 4 # define NB_RAB_MAX 8 // 4
# define RAB_SHIFT1 9 # define RAB_SHIFT1 9
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
#endif //NON_ACCESS_STRATUM #endif //NON_ACCESS_STRATUM
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "COMMON/platform_constants.h" #include "COMMON/platform_constants.h"
#include "COMMON/platform_types.h"
#include "DRB-ToAddMod.h" #include "DRB-ToAddMod.h"
#include "DRB-ToAddModList.h" #include "DRB-ToAddModList.h"
#include "SRB-ToAddMod.h" #include "SRB-ToAddMod.h"
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
*******************************************************************************/ *******************************************************************************/
/*! \file pdcp_fifo.c /*! \file pdcp_fifo.c
* \brief pdcp interface with linux IP interface * \brief pdcp interface with linux IP interface, have a look at http://man7.org/linux/man-pages/man7/netlink.7.html for netlink
* \author Lionel GAUTHIER and Navid Nikaein * \author Lionel GAUTHIER and Navid Nikaein
* \date 2009 * \date 2009
* \version 0.5 * \version 0.5
...@@ -65,21 +65,27 @@ extern int otg_enabled; ...@@ -65,21 +65,27 @@ extern int otg_enabled;
#include "UTIL/OCG/OCG_extern.h" #include "UTIL/OCG/OCG_extern.h"
#include "UTIL/LOG/log.h" #include "UTIL/LOG/log.h"
#include "UTIL/FIFO/pad_list.h" #include "UTIL/FIFO/pad_list.h"
#include "platform_constants.h"
#ifdef NAS_NETLINK #ifdef NAS_NETLINK
#include <sys/socket.h> #include <sys/socket.h>
#include <linux/netlink.h> #include <linux/netlink.h>
extern char nl_rx_buf[NL_MAX_PAYLOAD];
extern struct sockaddr_nl nas_src_addr, nas_dest_addr; extern struct sockaddr_nl nas_src_addr, nas_dest_addr;
extern struct nlmsghdr *nas_nlh; extern struct nlmsghdr *nas_nlh_tx;
extern struct iovec nas_iov; extern struct nlmsghdr *nas_nlh_rx;
extern struct iovec nas_iov_tx;
extern struct iovec nas_iov_rx;
extern int nas_sock_fd; extern int nas_sock_fd;
extern struct msghdr nas_msg; extern struct msghdr nas_msg_tx;
extern struct msghdr nas_msg_rx;
#define MAX_PAYLOAD 1600 #define MAX_PAYLOAD 1600
unsigned char pdcp_read_state = 0; unsigned char pdcp_read_state = 0;
unsigned char pdcp_read_payload[MAX_PAYLOAD]; //unsigned char pdcp_read_payload[MAX_PAYLOAD];
#endif #endif
extern Packet_OTG_List *otg_pdcp_buffer; extern Packet_OTG_List *otg_pdcp_buffer;
...@@ -132,9 +138,9 @@ int ...@@ -132,9 +138,9 @@ int
#else #else
#ifdef NAS_NETLINK #ifdef NAS_NETLINK
#ifdef LINUX #ifdef LINUX
memcpy(NLMSG_DATA(nas_nlh), &(((u8 *) sdu->data)[sizeof (pdcp_data_ind_header_t) - pdcp_output_header_bytes_to_write]), memcpy(NLMSG_DATA(nas_nlh_tx), &(((u8 *) sdu->data)[sizeof (pdcp_data_ind_header_t) - pdcp_output_header_bytes_to_write]),
pdcp_output_header_bytes_to_write); pdcp_output_header_bytes_to_write);
nas_nlh->nlmsg_len = pdcp_output_header_bytes_to_write; nas_nlh_tx->nlmsg_len = pdcp_output_header_bytes_to_write;
#endif //LINUX #endif //LINUX
#endif //NAS_NETLINK #endif //NAS_NETLINK
...@@ -159,9 +165,9 @@ int ...@@ -159,9 +165,9 @@ int
#ifdef NAS_NETLINK #ifdef NAS_NETLINK
#ifdef LINUX #ifdef LINUX
memcpy(NLMSG_DATA(nas_nlh)+sizeof(pdcp_data_ind_header_t), &(sdu->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write); memcpy(NLMSG_DATA(nas_nlh_tx)+sizeof(pdcp_data_ind_header_t), &(sdu->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write);
nas_nlh->nlmsg_len += pdcp_output_sdu_bytes_to_write; nas_nlh_tx->nlmsg_len += pdcp_output_sdu_bytes_to_write;
ret = sendmsg(nas_sock_fd,&nas_msg,0); ret = sendmsg(nas_sock_fd,&nas_msg_tx,0);
if (ret<0) { if (ret<0) {
LOG_D(PDCP, "[PDCP_FIFOS] sendmsg returns %d (errno: %d)\n", ret, errno); LOG_D(PDCP, "[PDCP_FIFOS] sendmsg returns %d (errno: %d)\n", ret, errno);
mac_xface->macphy_exit(""); mac_xface->macphy_exit("");
...@@ -260,7 +266,8 @@ int ...@@ -260,7 +266,8 @@ int
pdcp_fifo_read_input_sdus_remaining_bytes (u32_t frame,u8_t eNB_flag) pdcp_fifo_read_input_sdus_remaining_bytes (u32_t frame,u8_t eNB_flag)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
sdu_size_t bytes_read=0; sdu_size_t bytes_read = 0;
rb_id_t rab_id = 0;
// if remaining bytes to read // if remaining bytes to read
if (pdcp_input_sdu_remaining_size_to_read > 0) { if (pdcp_input_sdu_remaining_size_to_read > 0) {
...@@ -289,10 +296,11 @@ int ...@@ -289,10 +296,11 @@ int
pdcp_read_header.inst = 0; pdcp_read_header.inst = 0;
#endif #endif
if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id].instanciated_instance) { if (pdcp_input_header.rb_id != 0) {
LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n", LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id); frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id);
if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id].instanciated_instance) {
pdcp_data_req (pdcp_input_header.inst, pdcp_data_req (pdcp_input_header.inst,
frame, eNB_flag, frame, eNB_flag,
pdcp_input_header.rb_id, pdcp_input_header.rb_id,
...@@ -302,6 +310,34 @@ int ...@@ -302,6 +310,34 @@ int
pdcp_input_sdu_buffer, pdcp_input_sdu_buffer,
PDCP_DATA_PDU); PDCP_DATA_PDU);
} }
} else if (eNB_flag) {
// is a broadcast packet, we have to send this packet on all default RABS of all connected UEs
LOG_D(PDCP, "Checking if could sent on default rabs\n");
#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES
for (rab_id = DEFAULT_RAB_ID; rab_id < MAX_RB; rab_id = rab_id + NB_RB_MAX) {
LOG_D(PDCP, "Checking if could sent on default rab id %d\n", rab_id);
if (pdcp_array[pdcp_input_header.inst][rab_id].instanciated_instance == (pdcp_input_header.inst + 1)) {
pdcp_data_req (pdcp_input_header.inst,
frame, eNB_flag,
rab_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_DATA_PDU);
}
}
} else {
LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
pdcp_data_req (pdcp_input_header.inst,
frame, eNB_flag,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_DATA_PDU);
}
// not necessary // not necessary
//memset(pdcp_input_sdu_buffer, 0, MAX_IP_PACKET_SIZE); //memset(pdcp_input_sdu_buffer, 0, MAX_IP_PACKET_SIZE);
return 1; return 1;
...@@ -318,127 +354,232 @@ int ...@@ -318,127 +354,232 @@ int
pdcp_fifo_read_input_sdus (u32_t frame, u8_t eNB_flag) pdcp_fifo_read_input_sdus (u32_t frame, u8_t eNB_flag)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifdef NAS_FIFO //#ifdef NAS_FIFO
int cont; // int cont;
int bytes_read; // int bytes_read;
//
// if remaining bytes to read // // if remaining bytes to read
if (pdcp_fifo_read_input_sdus_remaining_bytes (frame,eNB_flag) > 0) { // if (pdcp_fifo_read_input_sdus_remaining_bytes (frame,eNB_flag) > 0) {
//
// all bytes that had to be read for a SDU were read // // all bytes that had to be read for a SDU were read
// if not overflow of list, try to get new sdus from rt fifo // // if not overflow of list, try to get new sdus from rt fifo
cont = 1; // cont = 1;
//
while (cont > 0) { // while (cont > 0) {
bytes_read = rtf_get (NAS2PDCP_FIFO, // bytes_read = rtf_get (NAS2PDCP_FIFO,
&(((u8 *) & pdcp_input_header)[pdcp_input_index_header]), // &(((u8 *) & pdcp_input_header)[pdcp_input_index_header]),
sizeof (pdcp_data_req_header_t) - pdcp_input_index_header); // sizeof (pdcp_data_req_header_t) - pdcp_input_index_header);
//
if (bytes_read > 0) { // if (bytes_read > 0) {
#ifdef PDCP_DEBUG //#ifdef PDCP_DEBUG
LOG_D(PDCP, "[PDCP_FIFOS] TTI %d Read %d Bytes of data (header %d) from Nas_mesh\n", // LOG_D(PDCP, "[PDCP_FIFOS] TTI %d Read %d Bytes of data (header %d) from Nas_mesh\n",
frame, // frame,
bytes_read, // bytes_read,
sizeof(pdcp_data_req_header_t)); // sizeof(pdcp_data_req_header_t));
#endif // PDCP_DEBUG //#endif // PDCP_DEBUG
pdcp_input_index_header += bytes_read; // pdcp_input_index_header += bytes_read;
//
if (pdcp_input_index_header == sizeof (pdcp_data_req_header_t)) { // if (pdcp_input_index_header == sizeof (pdcp_data_req_header_t)) {
#ifdef PDCP_DEBUG //#ifdef PDCP_DEBUG
LOG_D(PDCP, "TTI %d IP->RADIO READ HEADER sdu size %d\n", // LOG_D(PDCP, "TTI %d IP->RADIO READ HEADER sdu size %d\n",
frame, // frame,
pdcp_input_header.data_size); // pdcp_input_header.data_size);
#endif //PDCP_DEBUG //#endif //PDCP_DEBUG
pdcp_input_index_header = 0; // pdcp_input_index_header = 0;
if (pdcp_input_header.data_size < 0) { // if (pdcp_input_header.data_size < 0) {
LOG_E(PDCP, "READ_FIFO: DATA_SIZE %d < 0\n",pdcp_input_header.data_size); // LOG_E(PDCP, "READ_FIFO: DATA_SIZE %d < 0\n",pdcp_input_header.data_size);
//
mac_xface->macphy_exit(""); // mac_xface->macphy_exit("");
return 0; // return 0;
} // }
pdcp_input_sdu_remaining_size_to_read = pdcp_input_header.data_size; // pdcp_input_sdu_remaining_size_to_read = pdcp_input_header.data_size;
pdcp_input_sdu_size_read = 0; // pdcp_input_sdu_size_read = 0;
// we know the size of the sdu, so read the sdu; // // we know the size of the sdu, so read the sdu;
cont = pdcp_fifo_read_input_sdus_remaining_bytes (frame,eNB_flag); // cont = pdcp_fifo_read_input_sdus_remaining_bytes (frame,eNB_flag);
} else { // } else {
cont = 0; // cont = 0;
} // }
// error while reading rt fifo // // error while reading rt fifo
} else { // } else {
cont = 0; // cont = 0;
} // }
} // }
} // }
return bytes_read; // return bytes_read;
//
#else //NAS_FIFO //#else //NAS_FIFO
//#ifdef NAS_NETLINK
// int len = 1;
// rb_id_t rab_id = 0;
//
// while (len > 0) {
// if (pdcp_read_state == 0) {
//#ifdef LINUX
// len = recvmsg(nas_sock_fd, &nas_msg, 0);
//#else
// len = -1;
//#endif
//
// if (len < 0) {
// // nothing in pdcp NAS socket
// //LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len);
// } else {
//#ifdef PDCP_DEBUG
//#ifdef LINUX
// LOG_I(PDCP, "[PDCP][NETLINK] Received socket with length %d (nlmsg_len = %d)\n", \
// len, nas_nlh->nlmsg_len-sizeof(struct nlmsghdr));
//#else
// LOG_I(PDCP, "[PDCP][NETLINK] nlmsg_len = %d (%d,%d)\n", \
// nas_nlh->nlmsg_len, sizeof(pdcp_data_req_header_t), \
// sizeof(struct nlmsghdr));
//#endif
//#endif
// }
//
//#ifdef LINUX
// if (nas_nlh->nlmsg_len == sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)) {
// pdcp_read_state = 1; //get
// memcpy((void *)&pdcp_read_header, (void *)NLMSG_DATA(nas_nlh), sizeof(pdcp_data_req_header_t));
// }
//#else
// pdcp_read_state = 1;
//#endif
// }
//
// if (pdcp_read_state == 1) {
//#ifdef LINUX
// len = recvmsg(nas_sock_fd, &nas_msg, 0);
//#else
// len = -1;
//#endif
//
// if (len < 0) {
// // nothing in pdcp NAS socket
// //LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len);
// } else {
// pdcp_read_state = 0;
// // print_active_requests()
//
//#ifdef LINUX
// memcpy(pdcp_read_payload, (unsigned char *)NLMSG_DATA(nas_nlh), nas_nlh->nlmsg_len - sizeof(struct nlmsghdr));
//#endif
//
//#ifdef OAI_EMU
// pdcp_read_header.inst = (pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) ? \
// pdcp_read_header.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local :
// pdcp_read_header.inst + oai_emulation.info.first_enb_local;
//#else
// pdcp_read_header.inst = 0;
//#endif
//
// if (pdcp_read_header.rb_id != 0) {
// if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id].instanciated_instance) {
//#ifdef PDCP_DEBUG
// LOG_I(PDCP, "[PDCP][NETLINK][IP->PDCP] TTI %d, INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n", \
// frame, pdcp_read_header.inst, len, nas_nlh->nlmsg_len-sizeof(struct nlmsghdr), pdcp_read_header.rb_id);
// LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
// frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id);
//#endif
//
// pdcp_data_req(pdcp_read_header.inst,
// frame,
// eNB_flag,
// pdcp_read_header.rb_id,
// RLC_MUI_UNDEFINED,
// RLC_SDU_CONFIRM_NO,
// pdcp_read_header.data_size,
// pdcp_read_payload,
// PDCP_DATA_PDU);
// } else {
// LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u\n",
// pdcp_read_header.inst, pdcp_read_header.rb_id);
// }
// } else if (eNB_flag) {
// // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs
// LOG_D(PDCP, "Checking if could sent on default rabs\n");
//#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES
// for (rab_id = DEFAULT_RAB_ID; rab_id < MAX_RB; rab_id = rab_id + NB_RB_MAX) {
// LOG_D(PDCP, "Checking if could sent on default rab id %d\n", rab_id);
// if (pdcp_array[pdcp_input_header.inst][rab_id].instanciated_instance == (pdcp_input_header.inst + 1)) {
// pdcp_data_req (pdcp_input_header.inst, frame, eNB_flag, rab_id, RLC_MUI_UNDEFINED,RLC_SDU_CONFIRM_NO,
// pdcp_input_header.data_size,
// pdcp_input_sdu_buffer,
// PDCP_DATA_PDU);
// }
// }
// } else {
// LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
// pdcp_data_req (pdcp_input_header.inst,
// frame, eNB_flag,
// DEFAULT_RAB_ID,
// RLC_MUI_UNDEFINED,
// RLC_SDU_CONFIRM_NO,
// pdcp_input_header.data_size,
// pdcp_input_sdu_buffer,
// PDCP_DATA_PDU);
// }
// }
// }
// } // end of while
//
// return len;
//
//#else // neither NAS_NETLINK nor NAS_FIFO
// return 0;
//#endif // NAS_NETLINK
//#endif // NAS_FIFO
#ifdef NAS_NETLINK #ifdef NAS_NETLINK
int len = 1; int len = 1;
rb_id_t rab_id = 0;
while (len > 0) { while (len > 0) {
if (pdcp_read_state == 0) { len = recvmsg(nas_sock_fd, &nas_msg_rx, 0);
#ifdef LINUX
len = recvmsg(nas_sock_fd, &nas_msg, 0);
#else
len = -1;
#endif
if (len < 0) { if (len<=0) {
// nothing in pdcp NAS socket // nothing in pdcp NAS socket
//LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len); //LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len);
} else { } else {
#ifdef PDCP_DEBUG for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf;
#ifdef LINUX NLMSG_OK (nas_nlh_rx, len);
LOG_I(PDCP, "[PDCP][NETLINK] Received socket with length %d (nlmsg_len = %d)\n", \ nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, len)) {
len, nas_nlh->nlmsg_len-sizeof(struct nlmsghdr));
#else
LOG_I(PDCP, "[PDCP][NETLINK] nlmsg_len = %d (%d,%d)\n", \
nas_nlh->nlmsg_len, sizeof(pdcp_data_req_header_t), \
sizeof(struct nlmsghdr));
#endif // LINUX
#endif // PDCP_DEBUG
}
#ifdef LINUX if (nas_nlh_rx->nlmsg_type == NLMSG_DONE) {
if (nas_nlh->nlmsg_len == sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)) { LOG_I(PDCP, "[PDCP][NETLINK] RX NLMSG_DONE\n");
pdcp_read_state = 1; //get //return;
memcpy((void *)&pdcp_read_header, (void *)NLMSG_DATA(nas_nlh), sizeof(pdcp_data_req_header_t)); };
if (nas_nlh_rx->nlmsg_type == NLMSG_ERROR) {
LOG_I(PDCP, "[PDCP][NETLINK] RX NLMSG_ERROR\n");
} }
#else if (pdcp_read_state == 0) {
pdcp_read_state = 1; if (nas_nlh_rx->nlmsg_len == sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)) {
#endif pdcp_read_state = 1; //get
memcpy((void *)&pdcp_read_header, (void *)NLMSG_DATA(nas_nlh_rx), sizeof(pdcp_data_req_header_t));
LOG_I(PDCP, "[PDCP][NETLINK] RX pdcp_data_req_header_t inst %u, rb_id %u data_size %d\n", pdcp_read_header.inst, pdcp_read_header.rb_id, pdcp_read_header.data_size);
} else {
LOG_E(PDCP, "[PDCP][NETLINK] WRONG size %d should be sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)\n", nas_nlh_rx->nlmsg_len);
} }
if (pdcp_read_state == 1) {
#ifdef LINUX
len = recvmsg(nas_sock_fd, &nas_msg, 0);
#else
len = -1;
#endif
if (len < 0) {
// nothing in pdcp NAS socket
//LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len);
} else { } else {
pdcp_read_state = 0; pdcp_read_state = 0;
// print_active_requests() // print_active_requests()
#ifdef PDCP_DEBUG
#ifdef LINUX LOG_I(PDCP, "[PDCP][NETLINK] Something in socket, length %d \n", nas_nlh_rx->nlmsg_len - sizeof(struct nlmsghdr));
memcpy(pdcp_read_payload, (unsigned char *)NLMSG_DATA(nas_nlh), nas_nlh->nlmsg_len - sizeof(struct nlmsghdr));
#endif #endif
//memcpy(pdcp_read_payload, (unsigned char *)NLMSG_DATA(nas_nlh_rx), nas_nlh_rx->nlmsg_len - sizeof(struct nlmsghdr));
#ifdef OAI_EMU #ifdef OAI_EMU
pdcp_read_header.inst = (pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) ? \ pdcp_read_header.inst = (pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) ? \
pdcp_read_header.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local : pdcp_read_header.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local :
pdcp_read_header.inst + oai_emulation.info.first_enb_local; pdcp_read_header.inst + oai_emulation.info.first_enb_local;
#else #else
pdcp_read_header.inst = 0; pdcp_read_header.inst = 0;
#endif #endif
if (pdcp_read_header.rb_id != 0) {
if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id].instanciated_instance) { if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id].instanciated_instance) {
#ifdef PDCP_DEBUG #ifdef PDCP_DEBUG
LOG_I(PDCP, "[PDCP][NETLINK][IP->PDCP] TTI %d, INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n", \ LOG_I(PDCP, "[PDCP][NETLINK][IP->PDCP] TTI %d, INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n",
frame, pdcp_read_header.inst, len, nas_nlh->nlmsg_len-sizeof(struct nlmsghdr), pdcp_read_header.rb_id); frame, pdcp_read_header.inst, len, nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr), pdcp_read_header.rb_id);
LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n", LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id); frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id);
#endif #endif
...@@ -450,22 +591,43 @@ int ...@@ -450,22 +591,43 @@ int
RLC_MUI_UNDEFINED, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, RLC_SDU_CONFIRM_NO,
pdcp_read_header.data_size, pdcp_read_header.data_size,
pdcp_read_payload, (unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_DATA_PDU); PDCP_DATA_PDU);
} else { } else {
LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u\n", LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u\n",
pdcp_read_header.inst, pdcp_read_header.rb_id); pdcp_read_header.inst, pdcp_read_header.rb_id);
} }
} else if (eNB_flag) {
// is a broadcast packet, we have to send this packet on all default RABS of all connected UEs
#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES
for (rab_id = DEFAULT_RAB_ID; rab_id < MAX_RB; rab_id = rab_id + NB_RB_MAX) {
if (pdcp_array[pdcp_input_header.inst][rab_id].instanciated_instance == (pdcp_input_header.inst + 1)) {
pdcp_data_req (pdcp_read_header.inst, frame, eNB_flag, rab_id, RLC_MUI_UNDEFINED,RLC_SDU_CONFIRM_NO,
pdcp_read_header.data_size,
(unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_DATA_PDU);
}
}
} else {
LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
pdcp_data_req (pdcp_read_header.inst,
frame, eNB_flag,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_read_header.data_size,
(unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_DATA_PDU);
}
}
}
} }
} }
} // end of while
return len; return len;
#else // neither NAS_NETLINK nor NAS_FIFO #else // neither NAS_NETLINK nor NAS_FIFO
return 0; return 0;
#endif // NAS_NETLINK #endif // NAS_NETLINK
#endif // NAS_FIFO
} }
......
...@@ -40,6 +40,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis ...@@ -40,6 +40,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame) void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
if (rlcP->t_status_prohibit.time_out > 0) {
if (rlcP->t_status_prohibit.running) { if (rlcP->t_status_prohibit.running) {
if ( if (
// CASE 1: start time out // CASE 1: start time out
...@@ -73,7 +74,9 @@ void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame) ...@@ -73,7 +74,9 @@ void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame)
rlcP->module_id, rlcP->module_id,
rlcP->rb_id); rlcP->rb_id);
#warning TO DO rlc_am_check_timer_status_prohibit #warning TO DO rlc_am_check_timer_status_prohibit
rlcP->t_status_prohibit.frame_time_out = frame + rlcP->t_status_prohibit.time_out; rlc_am_stop_and_reset_timer_status_prohibit(rlcP, frame);
//rlcP->t_status_prohibit.frame_time_out = frame + rlcP->t_status_prohibit.time_out;
}
} }
} }
} }
...@@ -81,23 +84,27 @@ void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame) ...@@ -81,23 +84,27 @@ void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame)
void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame) void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
if (rlcP->t_status_prohibit.time_out > 0) {
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] STOPPED AND RESET\n", frame, LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] STOPPED AND RESET\n", frame,
rlcP->module_id, rlcP->rb_id); rlcP->module_id, rlcP->rb_id);
rlcP->t_status_prohibit.running = 0; rlcP->t_status_prohibit.running = 0;
rlcP->t_status_prohibit.frame_time_out = 0; rlcP->t_status_prohibit.frame_time_out = 0;
rlcP->t_status_prohibit.frame_start = 0; rlcP->t_status_prohibit.frame_start = 0;
rlcP->t_status_prohibit.timed_out = 0; rlcP->t_status_prohibit.timed_out = 0;
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame) void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
if (rlcP->t_status_prohibit.time_out > 0) {
rlcP->t_status_prohibit.running = 1; rlcP->t_status_prohibit.running = 1;
rlcP->t_status_prohibit.frame_time_out = rlcP->t_status_prohibit.time_out + frame; rlcP->t_status_prohibit.frame_time_out = rlcP->t_status_prohibit.time_out + frame;
rlcP->t_status_prohibit.frame_start = frame; rlcP->t_status_prohibit.frame_start = frame;
rlcP->t_status_prohibit.timed_out = 0; rlcP->t_status_prohibit.timed_out = 0;
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] STARTED (TIME-OUT = FRAME %05d)\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->t_status_prohibit.frame_time_out); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] STARTED (TIME-OUT = FRAME %05d)\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->t_status_prohibit.frame_time_out);
LOG_D(RLC, "TIME-OUT = FRAME %05d\n", rlcP->t_status_prohibit.frame_time_out); LOG_D(RLC, "TIME-OUT = FRAME %05d\n", rlcP->t_status_prohibit.frame_time_out);
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void rlc_am_init_timer_status_prohibit(rlc_am_entity_t *rlcP, u32_t time_outP) void rlc_am_init_timer_status_prohibit(rlc_am_entity_t *rlcP, u32_t time_outP)
......
...@@ -171,7 +171,6 @@ typedef struct { ...@@ -171,7 +171,6 @@ typedef struct {
#define RLC_MAX_LC ((max_val_DRB_Identity+1)* MAX_MOBILES_PER_RG) #define RLC_MAX_LC ((max_val_DRB_Identity+1)* MAX_MOBILES_PER_RG)
#endif #endif
protected_rlc(void (*rlc_rrc_data_ind) (module_id_t , u32_t, u8_t, rb_id_t , sdu_size_t , char* );) protected_rlc(void (*rlc_rrc_data_ind) (module_id_t , u32_t, u8_t, rb_id_t , sdu_size_t , char* );)
protected_rlc(void (*rlc_rrc_data_conf) (module_id_t , rb_id_t , mui_t, rlc_tx_status_t );) protected_rlc(void (*rlc_rrc_data_conf) (module_id_t , rb_id_t , mui_t, rlc_tx_status_t );)
......
...@@ -268,7 +268,13 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t module_idP, u32_t frameP, u ...@@ -268,7 +268,13 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t module_idP, u32_t frameP, u
mbms_session = pmch_info_r9->mbms_SessionInfoList_r9.list.array[cnt2]; mbms_session = pmch_info_r9->mbms_SessionInfoList_r9.list.array[cnt2];
if (mbms_session->logicalChannelIdentity_r9 > 0) { if (mbms_session->logicalChannelIdentity_r9 > 0) {
lc_id = (NUMBER_OF_UE_MAX*NB_RB_MAX) + mbms_session->logicalChannelIdentity_r9; //lc_id = (NUMBER_OF_UE_MAX*NB_RB_MAX) + mbms_session->logicalChannelIdentity_r9;
if (eNB_flagP) {
lc_id = mbms_session->logicalChannelIdentity_r9 + (maxDRB + 3) * MAX_MOBILES_PER_RG;
} else {
lc_id = mbms_session->logicalChannelIdentity_r9 + (maxDRB + 3);
}
if (mbms_session->sessionId_r9 != NULL) { if (mbms_session->sessionId_r9 != NULL) {
mbms_session_id = mbms_session->sessionId_r9->buf[0]; mbms_session_id = mbms_session->sessionId_r9->buf[0];
......
...@@ -10,55 +10,57 @@ export KERNEL_MAIN_TYPE ...@@ -10,55 +10,57 @@ export KERNEL_MAIN_TYPE
KERNEL_MAIN_VERSION=$(shell echo `uname -r | cut -d. -f-1`) KERNEL_MAIN_VERSION=$(shell echo `uname -r | cut -d. -f-1`)
ifeq ($(IS_LINUX), 1) ifeq ($(IS_LINUX), 1)
SUBVERSION=$(shell echo `grep '^SUBLEVEL =' /usr/src/linux/Makefile | sed -e 's, ,,g' | sed -e 's/SUBLEVEL=//'`) PATCHLEVEL=$(shell echo `grep '^PATCHLEVEL =' /usr/src/linux/Makefile | sed -e 's, ,,g' | sed -e 's/PATCHLEVEL=//'`)
SUBLEVEL=$(shell echo `grep '^SUBLEVEL =' /usr/src/linux/Makefile | sed -e 's, ,,g' | sed -e 's/SUBLEVEL=//'`)
else else
ifeq ($(IS_KERNEL_OPENAIRINTERFACE), 1) ifeq ($(IS_KERNEL_OPENAIRINTERFACE), 1)
SUBVERSION=$(shell echo `grep '^SUBLEVEL =' /usr/src/linux-$(KERNEL_NAME)/Makefile | sed -e 's, ,,g' | sed -e 's/SUBLEVEL=//'`) PATCHLEVEL=$(shell echo `grep '^PATCHLEVEL =' /usr/src/linux-$(KERNEL_NAME)/Makefile | sed -e 's, ,,g' | sed -e 's/PATCHLEVEL=//'`)
SUBLEVEL=$(shell echo `grep '^SUBLEVEL =' /usr/src/linux-$(KERNEL_NAME)/Makefile | sed -e 's, ,,g' | sed -e 's/SUBLEVEL=//'`)
else else
SUBVERSION=$(shell echo `grep '^SUBLEVEL =' /usr/src/linux-headers-$(KERNEL_NAME)/Makefile | sed -e 's, ,,g' | sed -e 's/SUBLEVEL=//'`) PATCHLEVEL=$(shell echo `grep '^PATCHLEVEL =' /usr/src/linux-headers-$(KERNEL_NAME)/Makefile | sed -e 's, ,,g' | sed -e 's/PATCHLEVEL=//'`)
SUBLEVEL=$(shell echo `grep '^SUBLEVEL =' /usr/src/linux-headers-$(KERNEL_NAME)/Makefile | sed -e 's, ,,g' | sed -e 's/SUBLEVEL=//'`)
endif endif
endif endif
ifeq ($(KERNEL_MAIN_VERSION),2)
ifeq ($(PATCHLEVEL),6)
IS_KERNEL_SUBVERSION_GREATER_THAN_20=$(shell if [ $(SUBVERSION) -ge 20 ] ; then echo true ; fi) IS_KERNEL_GREATER_THAN_2620=$(shell if [ $(SUBLEVEL) -ge 20 ] ; then echo true ; fi)
KERNEL_ARCH=$(shell echo `uname -m`) IS_KERNEL_GREATER_THAN_2622=$(shell if [ $(SUBLEVEL) -ge 22 ] ; then echo true ; fi)
#SET_REGPARM=$(shell if [ $(KERNEL_ARCH) = 'i686' -a $(SUBVERSION) -ge 20 ]; then echo true ; fi) IS_KERNEL_GREATER_THAN_2629=$(shell if [ $(SUBLEVEL) -ge 29 ] ; then echo true ; fi)
SET_X64=$(shell if [ $(KERNEL_ARCH) = 'x86_64' -a $(SUBVERSION) -ge 20 ]; then echo true ; fi) IS_KERNEL_GREATER_THAN_2630=$(shell if [ $(SUBLEVEL) -ge 30 ] ; then echo true ; fi)
IS_KERNEL_GREATER_THAN_2632=$(shell if [ $(SUBLEVEL) -ge 32 ] ; then echo true ; fi)
IS_KERNEL_SUBVERSION_GREATER_THAN_22=$(shell if [ $(SUBVERSION) -ge 22 ] ; then echo true ; fi) IS_KERNEL_MAIN_VERSION_IS_3 = "false"
IS_KERNEL_SUBVERSION_GREATER_THAN_29=$(shell if [ $(SUBVERSION) -ge 29 ] ; then echo true ; fi) IS_KERNEL_GREATER_THAN_32 = "false"
IS_KERNEL_SUBVERSION_GREATER_THAN_30=$(shell if [ $(SUBVERSION) -ge 30 ] ; then echo true ; fi) IS_KERNEL_GREATER_THAN_35 = "false"
IS_KERNEL_SUBVERSION_GREATER_THAN_32=$(shell if [ $(SUBVERSION) -ge 32 ] ; then echo true ; fi) endif
else
# Add global rule for V3 kernels ifeq ($(KERNEL_MAIN_VERSION),3)
ifeq ($(KERNEL_MAIN_VERSION),3) IS_KERNEL_GREATER_THAN_2622 = "true"
IS_KERNEL_SUBVERSION_GREATER_THAN_22 = "true" IS_KERNEL_GREATER_THAN_2629 = "true"
IS_KERNEL_SUBVERSION_GREATER_THAN_29 = "true" IS_KERNEL_GREATER_THAN_2630 = "true"
IS_KERNEL_SUBVERSION_GREATER_THAN_30 = "true" IS_KERNEL_GREATER_THAN_2632 = "true"
IS_KERNEL_SUBVERSION_GREATER_THAN_32 = "true"
IS_KERNEL_MAIN_VERSION_IS_3 = "true" IS_KERNEL_MAIN_VERSION_IS_3 = "true"
IS_KERNEL_GREATER_THAN_32=$(shell if [ $(PATCHLEVEL) -ge 2 ] ; then echo true ; fi)
IS_KERNEL_GREATER_THAN_35=$(shell if [ $(PATCHLEVEL) -ge 5 ] ; then echo true ; fi)
endif
endif endif
GT2622= $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_22),-DKERNEL_VERSION_GREATER_THAN_2622=1)
GT2629= $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_29),-DKERNEL_VERSION_GREATER_THAN_2629=1)
GT32= $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_32),-DKERNEL_VERSION_GREATER_THAN_32=1)
V3= $(if $(IS_KERNEL_MAIN_VERSION_IS_3),-DKERNEL_MAIN_VERSION_IS_3=1)
####################################################
# NASMESH compilation flags
####################################################
#RTAI=1
#################################################### KERNEL_ARCH=$(shell echo `uname -m`)
# D E B U G F L A G S SET_X64=$(shell if [ $(KERNEL_ARCH) = 'x86_64' ]; then echo true ; fi)
####################################################
GT2622= $(if $(IS_KERNEL_GREATER_THAN_2622),-DKERNEL_VERSION_GREATER_THAN_2622=1)
GT2629= $(if $(IS_KERNEL_GREATER_THAN_2629),-DKERNEL_VERSION_GREATER_THAN_2629=1)
GT2632= $(if $(IS_KERNEL_GREATER_THAN_2632),-DKERNEL_VERSION_GREATER_THAN_2632=1)
GT32= $(if $(IS_KERNEL_GREATER_THAN_32),-DKERNEL_VERSION_GREATER_THAN_32=1)
GT35= $(if $(IS_KERNEL_GREATER_THAN_35),-DKERNEL_VERSION_GREATER_THAN_35=1)
V3= $(if $(IS_KERNEL_MAIN_VERSION_IS_3),-DKERNEL_MAIN_VERSION_IS_3=1)
#################################################### ####################################################
# EXTRA COMPILER FLAGS # EXTRA COMPILER FLAGS
#################################################### ####################################################
EXTRA_CFLAGS = -fno-common $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_20),-mregparm=3 -fno-stack-protector -mpreferred-stack-boundary=4) $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) $(GT2622) $(GT2629) $(V3) $(GT32) EXTRA_CFLAGS = -fno-common $(if $(IS_KERNEL_GREATER_THAN_2620),-mregparm=3 -fno-stack-protector -mpreferred-stack-boundary=4) $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) $(GT2622) $(GT2629) $(V3) $(GT32) $(GT35)
ifdef ADDRCONF ifdef ADDRCONF
EXTRA_CFLAGS += -DADDRCONF EXTRA_CFLAGS += -DADDRCONF
...@@ -90,7 +92,7 @@ obj-m += oai_nw_drv.o ...@@ -90,7 +92,7 @@ obj-m += oai_nw_drv.o
oai_nw_drv-objs += device.o oai_nw_drv-objs += device.o
oai_nw_drv-objs += common.o oai_nw_drv-objs += common.o
oai_nw_drv-objs += ioctl.o oai_nw_drv-objs += ioctl.o
oai_nw_drv-objs += classifier.o #oai_nw_drv-objs += classifier.o
oai_nw_drv-objs += tool.o oai_nw_drv-objs += tool.o
ifdef OAI_NW_DRIVER_USE_NETLINK ifdef OAI_NW_DRIVER_USE_NETLINK
oai_nw_drv-objs += netlink.o oai_nw_drv-objs += netlink.o
...@@ -113,6 +115,8 @@ print: ...@@ -113,6 +115,8 @@ print:
@echo linux kernel ge 29: $(IS_KERNEL_SUBVERSION_GREATER_THAN_29) @echo linux kernel ge 29: $(IS_KERNEL_SUBVERSION_GREATER_THAN_29)
@echo flag gt2629: $(GT2629) @echo flag gt2629: $(GT2629)
@echo linux kernel ge 30: $(IS_KERNEL_SUBVERSION_GREATER_THAN_30) @echo linux kernel ge 30: $(IS_KERNEL_SUBVERSION_GREATER_THAN_30)
@echo linux kernel ge 32: $(IS_KERNEL_SUBVERSION_GREATER_THAN_32)
@echo linux kernel ge 35: $(IS_KERNEL_SUBVERSION_GREATER_THAN_35)
@echo flag KERNEL_MAIN_VERSION $(KERNEL_MAIN_VERSION) @echo flag KERNEL_MAIN_VERSION $(KERNEL_MAIN_VERSION)
clean: clean:
rm -f *.ko rm -f *.ko
......
...@@ -220,300 +220,7 @@ void oai_nw_drv_create_mask_ipv4_addr(struct in_addr *masked_addrP, int prefix_l ...@@ -220,300 +220,7 @@ void oai_nw_drv_create_mask_ipv4_addr(struct in_addr *masked_addrP, int prefix_l
masked_addrP->s_addr = htonl(0xFFFFFFFF << (32 - prefix_len)); masked_addrP->s_addr = htonl(0xFFFFFFFF << (32 - prefix_len));
return; return;
} }
//---------------------------------------------------------------------------
// Add a new classifier rule (send direction)
struct classifier_entity *oai_nw_drv_class_add_send_classifier(struct cx_entity *cx, u8 dscp, u16 classref){
//---------------------------------------------------------------------------
struct classifier_entity *classifier;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_ADD_SCLASSIFIER: begin for dscp %d, classref %d\n", dscp,classref);
#endif
if (cx==NULL){
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_ADD_SCLASSIFIER - input parameter cx is NULL \n");
#endif
return NULL;
}
for (classifier=cx->sclassifier[dscp]; classifier!=NULL; classifier=classifier->next){
if (classifier->classref==classref){
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_ADD_SCLASSIFIER: classifier already exist for dscp %d, classref %d\n",dscp,classref);
#endif
return classifier;
}
}
classifier=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL);
if (classifier==NULL)
return NULL;
classifier->next=cx->sclassifier[dscp];
classifier->classref=classref;
cx->sclassifier[dscp]=classifier;
++cx->nsclassifier;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_ADD_SCLASSIFIER: classifier created for dscp %d, classref %d\n",dscp,classref);
#endif
return classifier;
}
//---------------------------------------------------------------------------
// Add a new classifier rule (receive direction)
struct classifier_entity *oai_nw_drv_class_add_recv_classifier(u8 dscp,
u16 classref,
struct oai_nw_drv_priv *gpriv){
//---------------------------------------------------------------------------
struct classifier_entity *classifier;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_ADD_RCLASSIFIER: begin\n");
#endif
for (classifier=gpriv->rclassifier[dscp]; classifier!=NULL; classifier=classifier->next)
{
if (classifier->classref==classref){
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_ADD_RCLASSIFIER: classifier already exist for dscp %d, classref %d\n",dscp,classref);
#endif
return classifier;
}
}
classifier=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL);
if (classifier==NULL)
return NULL;
classifier->next=gpriv->rclassifier[dscp];
classifier->classref=classref;
gpriv->rclassifier[dscp]=classifier;
++gpriv->nrclassifier;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_ADD_RCLASSIFIER: classifier created for dscp %d, classref %d\n",dscp,classref);
#endif
return classifier;
}
//---------------------------------------------------------------------------
// Add a new classifier rule (forwarding)
struct classifier_entity *oai_nw_drv_class_add_fwd_classifier(struct cx_entity *cx, u8 dscp, u16 classref){
//---------------------------------------------------------------------------
struct classifier_entity *classifier;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_ADD_FCLASSIFIER: begin for dscp %d, classref %d\n", dscp,classref);
#endif
if (cx==NULL){
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_ADD_FCLASSIFIER - input parameter cx is NULL \n");
#endif
return NULL;
}
for (classifier=cx->fclassifier[dscp]; classifier!=NULL; classifier=classifier->next){
if (classifier->classref==classref){
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_ADD_SCLASSIFIER: classifier already exist for dscp %d, classref %d\n",dscp,classref);
#endif
return classifier;
}
}
classifier=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL);
if (classifier==NULL)
return NULL;
classifier->next=cx->fclassifier[dscp];
classifier->classref=classref;
cx->fclassifier[dscp]=classifier;
++cx->nfclassifier;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_ADD_FCLASSIFIER: classifier created for dscp %d, classref %d\n",dscp,classref);
#endif
return classifier;
}
//---------------------------------------------------------------------------
void oai_nw_drv_class_flush_send_classifier(struct cx_entity *cx){
//---------------------------------------------------------------------------
u8 dscpi;
struct classifier_entity *classifier;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_FLUSH_SCLASSIFIER: begin\n");
#endif
if (cx==NULL){
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_FLUSH_SCLASSIFIER - input parameter cx is NULL \n");
#endif
return;
}
//
for (dscpi=0; dscpi<OAI_NW_DRV_DSCP_MAX; ++dscpi)
{
for (classifier=cx->sclassifier[dscpi]; classifier!=NULL; classifier=cx->sclassifier[dscpi])
{
cx->sclassifier[dscpi]=classifier->next;
kfree(classifier);
}
}
cx->nsclassifier=0;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_FLUSH_SCLASSIFIER: end\n");
#endif
}
//---------------------------------------------------------------------------
void oai_nw_drv_class_flush_fwd_classifier(struct cx_entity *cx){
//---------------------------------------------------------------------------
u8 dscpi;
struct classifier_entity *classifier;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_FLUSH_FCLASSIFIER: begin\n");
#endif
if (cx==NULL){
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_FLUSH_FCLASSIFIER - input parameter cx is NULL \n");
#endif
return;
}
//
for (dscpi=0; dscpi<OAI_NW_DRV_DSCP_MAX; ++dscpi)
{
for (classifier=cx->fclassifier[dscpi]; classifier!=NULL; classifier=cx->fclassifier[dscpi])
{
cx->fclassifier[dscpi]=classifier->next;
kfree(classifier);
}
}
cx->nfclassifier=0;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_FLUSH_FCLASSIFIER: end\n");
#endif
}
//---------------------------------------------------------------------------
void oai_nw_drv_class_flush_recv_classifier(struct oai_nw_drv_priv *gpriv){
//---------------------------------------------------------------------------
u8 dscpi;
struct classifier_entity *classifier;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_FLUSH_RCLASSIFIER: begin\n");
#endif
for (dscpi=0; dscpi<OAI_NW_DRV_DSCP_MAX; ++dscpi)
{
for (classifier=gpriv->rclassifier[dscpi]; classifier!=NULL; classifier=gpriv->rclassifier[dscpi])
{
gpriv->rclassifier[dscpi]=classifier->next;
kfree(classifier);
}
}
gpriv->nrclassifier=0;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_FLUSH_RCLASSIFIER: end\n");
#endif
}
//---------------------------------------------------------------------------
// Delete a classifier rule (send direction)
void oai_nw_drv_class_del_send_classifier(struct cx_entity *cx, u8 dscp, u16 classref){
//---------------------------------------------------------------------------
struct classifier_entity *pclassifier,*np;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_DEL_SCLASSIFIER: begin\n");
#endif
if (cx==NULL){
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_DEL_SCLASSIFIER - input parameter cx is NULL \n");
#endif
return;
}
//
pclassifier=cx->sclassifier[dscp];
if (pclassifier==NULL)
return;
if (pclassifier->classref==classref)
{
cx->sclassifier[dscp]=pclassifier->next;
kfree(pclassifier);
--cx->nsclassifier;
return;
}
for (np=pclassifier->next; np!=NULL; pclassifier=np)
{
if (np->classref==classref)
{
pclassifier->next=np->next;
kfree(np);
--cx->nsclassifier;
return;
}
}
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_DEL_SCLASSIFIER: end\n");
#endif
}
//---------------------------------------------------------------------------
// Delete a classifier rule (send direction)
void oai_nw_drv_class_del_fwd_classifier(struct cx_entity *cx, u8 dscp, u16 classref){
//---------------------------------------------------------------------------
struct classifier_entity *pclassifier,*np;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_DEL_FCLASSIFIER: begin\n");
#endif
if (cx==NULL){
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_DEL_FCLASSIFIER - input parameter cx is NULL \n");
#endif
return;
}
//
pclassifier=cx->fclassifier[dscp];
if (pclassifier==NULL)
return;
if (pclassifier->classref==classref)
{
cx->fclassifier[dscp]=pclassifier->next;
kfree(pclassifier);
--cx->nfclassifier;
return;
}
for (np=pclassifier->next; np!=NULL; pclassifier=np)
{
if (np->classref==classref)
{
pclassifier->next=np->next;
kfree(np);
--cx->nfclassifier;
return;
}
}
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_DEL_FCLASSIFIER: end\n");
#endif
}
//---------------------------------------------------------------------------
// Delete a classifier rule (receive direction)
void oai_nw_drv_class_del_recv_classifier(u8 dscp, u16 classref,struct oai_nw_drv_priv *gpriv){
//---------------------------------------------------------------------------
struct classifier_entity *pclassifier,*np;
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_DEL_RCLASSIFIER: begin\n");
#endif
pclassifier=gpriv->rclassifier[dscp];
if (pclassifier==NULL)
return;
if (pclassifier->classref==classref)
{
gpriv->rclassifier[dscp]=pclassifier->next;
kfree(pclassifier);
--gpriv->nrclassifier;
return;
}
for (np=pclassifier->next; np!=NULL; pclassifier=np)
{
if (np->classref==classref)
{
pclassifier->next=np->next;
kfree(np);
--gpriv->nrclassifier;
return;
}
}
#ifdef OAI_DRV_DEBUG_CLASS
printk("OAI_NW_DRV_CLASS_DEL_RCLASSIFIER: end\n");
#endif
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Search the entity with the IPv6 address 'addr' // Search the entity with the IPv6 address 'addr'
...@@ -606,576 +313,3 @@ struct cx_entity *oai_nw_drv_find_cx6(struct sk_buff *skb, ...@@ -606,576 +313,3 @@ struct cx_entity *oai_nw_drv_find_cx6(struct sk_buff *skb,
return cx; return cx;
} }
//---------------------------------------------------------------------------
// Search the entity with the IPv4 address 'addr'
struct cx_entity *oai_nw_drv_find_cx4(struct sk_buff *skb,
unsigned char dscp,
struct oai_nw_drv_priv *gpriv,
int inst,
int *paddr_type,
unsigned char *cx_searcher) {
//---------------------------------------------------------------------------
unsigned char cxi;
u32 daddr;
struct cx_entity *default_ip=NULL;
struct classifier_entity *pclassifier=NULL;
struct in_addr masked_addr;
// if (inst >0)
// return(gpriv->cx); //dump to clusterhead
if (skb!=NULL) {
daddr = ((struct iphdr*)(skb_network_header(skb)))->daddr;
if (daddr != INADDR_ANY) {
if (ipv4_is_multicast(ip_hdr(skb)->daddr)) {
// TO BE CHECKED
*paddr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_MC_SIGNALLING;
#ifdef OAI_DRV_DEBUG_CLASS
printk("SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr));
printk(" DEST ADDR %d.%d.%d.%d MULTICAST\n",NIPADDR(ip_hdr(skb)->daddr));
#endif
return NULL;
} else if (ipv4_is_lbcast(ip_hdr(skb)->daddr)) {
// TO BE CHECKED
*paddr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_BROADCAST;
#ifdef OAI_DRV_DEBUG_CLASS
printk("SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr));
printk(" DEST ADDR %d.%d.%d.%d LOCAL BROADCAST\n",NIPADDR(ip_hdr(skb)->daddr));
#endif
return NULL;
} else if (IN_CLASSA(htonl(ip_hdr(skb)->daddr)) ||
IN_CLASSB(htonl(ip_hdr(skb)->daddr)) ||
IN_CLASSC(htonl(ip_hdr(skb)->daddr))) {
if ( ((ip_hdr(skb)->daddr & 0xFF000000) >> 24) == 0x000000FF) {
*paddr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_BROADCAST;
#ifdef OAI_DRV_DEBUG_CLASS
printk("SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr));
printk(" DEST ADDR %d.%d.%d.%d BROADCAST\n",NIPADDR(ip_hdr(skb)->daddr));
#endif
return NULL;
}
*paddr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_UNICAST;
#ifdef OAI_DRV_DEBUG_CLASS
printk("SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr));
printk(" DEST ADDR %d.%d.%d.%d UNICAST\n",NIPADDR(ip_hdr(skb)->daddr));
#endif
for (cxi=*cx_searcher; cxi<OAI_NW_DRV_CX_MAX; ++cxi) {
(*cx_searcher)++;
pclassifier = gpriv->cx[cxi].sclassifier[dscp];
while (pclassifier!=NULL) {
if ((pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_4) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)) { // verify that this is an IPv4 rule
oai_nw_drv_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
if (IN_ARE_ADDR_MASKED_EQUAL(&ip_hdr(skb)->daddr, &(pclassifier->daddr.ipv4), &masked_addr)) {
#ifdef OAI_DRV_DEBUG_CLASS
printk("oai_nw_drv_find_cx4: IP MASK MATCHED: found cx %d: %d.%d.%d.%d/%d\n",cxi, NIPADDR(pclassifier->daddr.ipv4), pclassifier->dplen);
#endif //OAI_DRV_DEBUG_CLASS
return &gpriv->cx[cxi];
//return gpriv->cx+cxi;
}
}
// goto to next classification rule for the connection
pclassifier = pclassifier->next;
}
}
} else {
*paddr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_UNKNOWN;
#ifdef OAI_DRV_DEBUG_CLASS
printk("SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr));
printk(" DEST ADDR %d.%d.%d.%d TYPE UNKNOWN\n",NIPADDR(ip_hdr(skb)->daddr));
#endif
}
}
}
#ifdef OAI_DRV_DEBUG_CLASS
printk("oai_nw_drv_find_cx4 NOT FOUND: %d.%d.%d.%d\n",NIPADDR(ip_hdr(skb)->daddr));
#endif //OAI_DRV_DEBUG_CLASS
return default_ip;
}
#ifdef MPLS
//---------------------------------------------------------------------------
// Search the entity with the mpls label and given exp
struct cx_entity *oai_nw_drv_find_cx_mpls(struct sk_buff *skb,
unsigned char exp,
struct oai_nw_drv_priv *gpriv,
int inst,
unsigned char *cx_searcher){
//---------------------------------------------------------------------------
unsigned char cxi;
struct cx_entity *default_label = NULL;
struct classifier_entity *pclassifier = NULL;
// if (inst >0)
//return(gpriv->cx); //dump to clusterhead
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][CLASS][MPLS] Searching for label %d\n",MPLSCB(skb)->label);
#endif
for (cxi=*cx_searcher; cxi<OAI_NW_DRV_CX_MAX; ++cxi) {
(*cx_searcher)++;
pclassifier = gpriv->cx[cxi].sclassifier[exp];
while (pclassifier!=NULL) {
if (pclassifier->ip_version == OAI_NW_DRV_MPLS_VERSION_CODE) { // verify that this is an MPLS rule
#ifdef OAI_DRV_DEBUG_CLASS
printk("cx %d : label %d\n",cxi,pclassifier->daddr.mpls_label);
#endif //OAI_DRV_DEBUG_CLASS
if (pclassifier->daddr.mpls_label==MPLSCB(skb)->label){
#ifdef OAI_DRV_DEBUG_CLASS
printk("found cx %d: label %d, RB %d\n",cxi,
MPLSCB(skb)->label,
pclassifier->rab_id);
#endif //OAI_DRV_DEBUG_CLASS
return gpriv->cx+cxi;
}
/*
else if (gpriv->cx[cxi].sclassifier[dscp]->daddr.ipv4==OAI_NW_DRV_DEFAULT_IPV4_ADDR) {
#ifdef OAI_DRV_DEBUG_CLASS
printk("found default_ip rule\n");
#endif //OAI_DRV_DEBUG_CLASS
default_ip = gpriv->cx+cxi;
}
*/
}
// goto to next classification rule for the connection
pclassifier = pclassifier->next;
}
}
return default_label;
}
#endif
//---------------------------------------------------------------------------
// Search the sending function
void oai_nw_drv_class_send(struct sk_buff *skb,int inst){
//---------------------------------------------------------------------------
struct classifier_entity *pclassifier = NULL, *sp = NULL;
struct sk_buff *skb_cloned = NULL;
u8 *protocolh = NULL;
u8 version;
u8 protocol, dscp;
u16 classref;
struct cx_entity *cx = NULL;
unsigned int i;
struct net_device *dev = oai_nw_drv_dev[inst];
struct oai_nw_drv_priv *gpriv = netdev_priv(dev);
unsigned char cx_searcher,no_connection;
int addr_type;
struct in6_addr masked6_addr;
struct in_addr masked_addr;
// RARP vars
struct arphdr *rarp = NULL;
unsigned char *rarp_ptr = NULL;
__be32 sip, tip;
unsigned char *sha = NULL, *tha = NULL; /* s for "source", t for "target" */
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] begin - inst %d\n",__FUNCTION__, inst);
#endif
if (skb==NULL){
#ifdef OAI_DRV_DEBUG_SEND
printk("[NAS][%s] - input parameter skb is NULL \n",__FUNCTION__);
#endif
return;
}
#ifdef OAI_DRV_DEBUG_SEND
printk("[NAS][%s] Got packet from kernel:\n",__FUNCTION__);
for (i=0;i < skb->len;i++)
printk("%2x ",((unsigned char *)skb->data)[i]);
printk("\n");
#endif
// find all connections related to socket
cx_searcher = 0;
no_connection = 1;
// Address classification
switch (ntohs(skb->protocol)) {
case ETH_P_IPV6:
version = 6;
addr_type = OAI_NW_DRV_IPV6_ADDR_TYPE_UNKNOWN;
protocolh = oai_nw_drv_TOOL_get_protocol6(ipv6_hdr(skb), &protocol);
dscp = oai_nw_drv_TOOL_get_dscp6 (ipv6_hdr(skb));
cx = oai_nw_drv_find_cx6 (skb, dscp, gpriv, inst, &addr_type, &cx_searcher);
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] ETH_P_IPV6 skb %p dscp %d gpriv %p inst %d cx_searcher %p \n",__FUNCTION__,skb, dscp, gpriv, inst, &cx_searcher);
#endif
// find in default DSCP a valid classification
if (cx == NULL) {
switch (addr_type) {
case OAI_NW_DRV_IPV6_ADDR_TYPE_MC_SIGNALLING:
for (i=0; i<OAI_NW_DRV_CX_MAX; i++){
pclassifier=(&gpriv->cx[i])->sclassifier[OAI_NW_DRV_DSCP_DEFAULT];
while (pclassifier!=NULL) {
if ((pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_6) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)) {
// ok found default classifier for this packet
oai_nw_drv_create_mask_ipv6_addr(&masked6_addr, pclassifier->dplen);
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] IPv6 MULTICAST CX %u TRYING default DSCP classifier IP Version %d, Dest ADDR %X:%X:%X:%X:%X:%X:%X:%X/%u Mask %X:%X:%X:%X:%X:%X:%X:%X/%u \n",
__FUNCTION__, i, pclassifier->ip_version,
NIP6ADDR(&(pclassifier->daddr.ipv6)), pclassifier->dplen,
NIP6ADDR(&masked6_addr), pclassifier->dplen);
#endif
if (IN6_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv6, &ipv6_hdr(skb)->daddr, &masked6_addr)) {
cx = &gpriv->cx[i];
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] IPv6 MULTICAST CX %u ETH_P_IPV6 FOUND OAI_NW_DRV_DSCP_DEFAULT with IN6_ARE_ADDR_MASKED_EQUAL(%d bits)\n",__FUNCTION__, i, pclassifier->dplen);
#endif
skb_cloned = skb_clone (skb, 0);
if (skb_cloned) {
pclassifier->fct(skb_cloned, cx, pclassifier,inst);
dev_kfree_skb(skb_cloned);
} else {
printk("[NAS][%s] IPv6 MULTICAST CX %u could not send packet, skb_clone() failed)\n",__FUNCTION__, i);
}
break;
} else if(IN6_IS_ADDR_UNSPECIFIED(&pclassifier->daddr.ipv6)) {
cx = &gpriv->cx[i];
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] IPv6 MULTICAST CX %u ETH_P_IPV6 FOUND OAI_NW_DRV_DSCP_DEFAULT with IN6_IS_ADDR_UNSPECIFIED\n",__FUNCTION__, i);
#endif
skb_cloned = skb_clone (skb, 0);
if (skb_cloned) {
pclassifier->fct(skb_cloned, cx, pclassifier,inst);
dev_kfree_skb(skb_cloned);
} else {
printk("[NAS][%s] IPv6 MULTICAST CX %u could not send packet, skb_clone() failed)\n",__FUNCTION__, i);
}
break;
}
}
pclassifier = pclassifier->next;
}
}
cx = NULL;
break;
case OAI_NW_DRV_IPV6_ADDR_TYPE_UNICAST:
for (i=0; i<OAI_NW_DRV_CX_MAX; i++){
pclassifier=(&gpriv->cx[i])->sclassifier[OAI_NW_DRV_DSCP_DEFAULT];
while (pclassifier!=NULL) {
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] TRYING default DSCP classifier IP Version %d, Dest ADDR %X:%X:%X:%X:%X:%X:%X:%X/%u\n",__FUNCTION__, pclassifier->ip_version, NIP6ADDR(&(pclassifier->daddr.ipv6)), pclassifier->dplen);
#endif
if ((pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_6) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)) {
// ok found default classifier for this packet
oai_nw_drv_create_mask_ipv6_addr(&masked6_addr, pclassifier->dplen);
if (IN6_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv6, &ipv6_hdr(skb)->daddr, &masked6_addr)) {
// then force dscp
cx = &gpriv->cx[i];
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] ETH_P_IPV6 FOUND OAI_NW_DRV_DSCP_DEFAULT with IN6_ARE_ADDR_MASKED_EQUAL(%d bits)\n",__FUNCTION__, pclassifier->dplen);
#endif
dscp = OAI_NW_DRV_DSCP_DEFAULT;
i = OAI_NW_DRV_CX_MAX;
break;
} else if(IN6_IS_ADDR_UNSPECIFIED(&pclassifier->daddr.ipv6)) {
cx = &gpriv->cx[i];
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] ETH_P_IPV6 FOUND OAI_NW_DRV_DSCP_DEFAULT with IN6_IS_ADDR_UNSPECIFIED\n",__FUNCTION__);
#endif
dscp = OAI_NW_DRV_DSCP_DEFAULT;
i = OAI_NW_DRV_CX_MAX;
break;
} else {
printk("[NAS][%s] TRYING default DSCP classifier: NO MATCH\n",__FUNCTION__);
}
}
pclassifier = pclassifier->next;
}
}
break;
case OAI_NW_DRV_IPV6_ADDR_TYPE_MC_MBMS:
break;
// should have found a valid classification rule
case OAI_NW_DRV_IPV6_ADDR_TYPE_UNKNOWN:
default:
;
}
}
break;
case ETH_P_ARP:
version = 4;
addr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_BROADCAST;
dscp = 0;
cx = NULL;
/* Basic sanity checks can be done without the lock. */
//rarp = (struct arphdr *)skb_transport_header(skb);
rarp = (struct arphdr *)skb_network_header(skb);
if (rarp) {
if (rarp->ar_hln != dev->addr_len || dev->type != ntohs(rarp->ar_hrd)) {
printk("[NAS][%s] ARP PACKET WRONG ADDR LEN or WRONG ARP HEADER TYPE\n",__FUNCTION__);
break;
}
} else {
printk("[NAS][%s] ARP HEADER POINTER IS NULL\n",__FUNCTION__);
break;
}
/* If it's not Ethernet, delete it. */
if (rarp->ar_pro != htons(ETH_P_IP)) {
printk("[NAS][%s] ARP PACKET PROTOCOL IS NOT ETHERNET\n",__FUNCTION__);
break;
}
rarp_ptr = (unsigned char *) (rarp + 1);
sha = rarp_ptr;
rarp_ptr += dev->addr_len;
memcpy(&sip, rarp_ptr, 4);
rarp_ptr += 4;
tha = rarp_ptr;
rarp_ptr += dev->addr_len;
memcpy(&tip, rarp_ptr, 4);
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] ARP DEST IP transport IP = %d.%d.%d.%d\n",__FUNCTION__, NIPADDR(tip));
#endif
for (i=0; i<OAI_NW_DRV_CX_MAX; i++){
pclassifier=(&gpriv->cx[i])->sclassifier[OAI_NW_DRV_DSCP_DEFAULT];
while (pclassifier!=NULL) {
if ((pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_4) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)) {
// ok found default classifier for this packet
oai_nw_drv_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] MASK = %d.%d.%d.%d\n",__FUNCTION__, NIPADDR(masked_addr.s_addr));
#endif
if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &tip, &masked_addr.s_addr)) {
// then force dscp
cx = &gpriv->cx[i];
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] ETH_P_ARP FOUND OAI_NW_DRV_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(%d bits)\n",__FUNCTION__, pclassifier->dplen);
#endif
dscp = OAI_NW_DRV_DSCP_DEFAULT;
i = OAI_NW_DRV_CX_MAX;
break;
} else if(INADDR_ANY == pclassifier->daddr.ipv4) {
cx = &gpriv->cx[i];
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] ETH_P_ARP FOUND OAI_NW_DRV_DSCP_DEFAULT with INADDR_ANY\n",__FUNCTION__);
#endif
dscp = OAI_NW_DRV_DSCP_DEFAULT;
i = OAI_NW_DRV_CX_MAX;
break;
}
}
pclassifier = pclassifier->next;
}
}
break;
case ETH_P_IP:
version = 4;
addr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_UNKNOWN;
dscp = oai_nw_drv_TOOL_get_dscp4((struct iphdr *)(skb_network_header(skb)));
cx = oai_nw_drv_find_cx4(skb, dscp, gpriv, inst, &addr_type, &cx_searcher);
protocolh = oai_nw_drv_TOOL_get_protocol4((struct iphdr *)(skb_network_header(skb)), &protocol);
// find in default DSCP a valid classification
if (cx == NULL) {
switch (addr_type) {
case OAI_NW_DRV_IPV4_ADDR_TYPE_MC_SIGNALLING:
case OAI_NW_DRV_IPV4_ADDR_TYPE_BROADCAST:
for (i=0; i<OAI_NW_DRV_CX_MAX; i++){
pclassifier=(&gpriv->cx[i])->sclassifier[OAI_NW_DRV_DSCP_DEFAULT];
while (pclassifier!=NULL) {
if ((pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_4) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)) {
// ok found default classifier for this packet
oai_nw_drv_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] IPv4 MULTICAST CX %u TRYING default DSCP classifier IP Version %d, Dest ADDR %u.%u.%u.%u/%u Mask %u.%u.%u.%u/%u \n",
__FUNCTION__, i, pclassifier->ip_version,
NIPADDR(pclassifier->daddr.ipv4), pclassifier->dplen,
NIPADDR(masked_addr.s_addr), pclassifier->dplen);
#endif
if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &ip_hdr(skb)->daddr, &masked_addr.s_addr)) {
cx = &gpriv->cx[i];
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s][CX %u] ETH_P_IP FOUND OAI_NW_DRV_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(IP CLASS %d.%d.%d.%d, IP DEST %d.%d.%d.%d, MASK = %d.%d.%d.%d %d bits)\n",
__FUNCTION__, i, NIPADDR(pclassifier->daddr.ipv4), NIPADDR(ip_hdr(skb)->daddr), NIPADDR(masked_addr.s_addr), pclassifier->dplen);
#endif
skb_cloned = skb_clone (skb, 0);
if (skb_cloned) {
pclassifier->fct(skb_cloned, cx, pclassifier,inst);
dev_kfree_skb(skb_cloned);
} else {
printk("[NAS][%s] IPv4 MULTICAST CX %u could not send packet, skb_clone() failed)\n",__FUNCTION__, i);
}
break;
} else if(INADDR_ANY == pclassifier->daddr.ipv4) {
cx = &gpriv->cx[i];
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s][CX %u] ETH_P_IP FOUND OAI_NW_DRV_DSCP_DEFAULT with INADDR_ANY\n",__FUNCTION__, i);
#endif
skb_cloned = skb_clone (skb, 0);
if (skb_cloned) {
pclassifier->fct(skb_cloned, cx, pclassifier,inst);
dev_kfree_skb(skb_cloned);
} else {
printk("[NAS][%s] IPv6 MULTICAST CX %u could not send packet, skb_clone() failed)\n",__FUNCTION__, i);
}
break;
}
}
pclassifier = pclassifier->next;
}
}
cx = NULL;
break;
case OAI_NW_DRV_IPV4_ADDR_TYPE_UNICAST:
for (i=0; i<OAI_NW_DRV_CX_MAX; i++){
//if ((pclassifier=cx->sclassifier[OAI_NW_DRV_DSCP_DEFAULT])!=NULL) {
pclassifier=(&gpriv->cx[i])->sclassifier[OAI_NW_DRV_DSCP_DEFAULT];
while (pclassifier != NULL) {
if ((pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_4) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)) {
// ok found default classifier for this packet
oai_nw_drv_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] MASK = %d.%d.%d.%d\n",__FUNCTION__, NIPADDR(masked_addr.s_addr));
#endif
if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &ip_hdr(skb)->daddr, &masked_addr.s_addr)) {
// then force dscp
cx = &gpriv->cx[i];
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s][CX %d] ETH_P_IP FOUND OAI_NW_DRV_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(IP CLASS %d.%d.%d.%d, IP DEST %d.%d.%d.%d, MASK = %d.%d.%d.%d %d bits)\n",
__FUNCTION__, i, NIPADDR(pclassifier->daddr.ipv4), NIPADDR(ip_hdr(skb)->daddr), NIPADDR(masked_addr.s_addr), pclassifier->dplen);
#endif
dscp = OAI_NW_DRV_DSCP_DEFAULT;
i = OAI_NW_DRV_CX_MAX;
break;
} else if(INADDR_ANY == pclassifier->daddr.ipv4) {
cx = &gpriv->cx[i];
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] ETH_P_IP FOUND OAI_NW_DRV_DSCP_DEFAULT with INADDR_ANY\n",__FUNCTION__);
#endif
dscp = OAI_NW_DRV_DSCP_DEFAULT;
i = OAI_NW_DRV_CX_MAX;
break;
}
}
pclassifier = pclassifier->next;
}
}
break;
// should have found a valid classification rule
case OAI_NW_DRV_IPV4_ADDR_TYPE_UNKNOWN:
default:
;
}
}
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] ETH_P_IP Got IPv4 packet (%02X), dscp = %d, cx = %p\n",__FUNCTION__,ntohs(skb->protocol),dscp,cx);
#endif
break;
#ifdef MPLS
case ETH_P_MPLS_UC:
cx=oai_nw_drv_find_cx_mpls(skb,MPLSCB(skb)->exp,gpriv,inst,&cx_searcher);
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] ETH_P_MPLS_UC Got MPLS unicast packet, exp = %d, label = %d, cx = %p\n",__FUNCTION__,MPLSCB(skb)->exp,MPLSCB(skb)->label,cx);
#endif
dscp = MPLSCB(skb)->exp;
version = OAI_NW_DRV_MPLS_VERSION_CODE;
protocol = version;
break;
#endif
default:
printk("[NAS][%s] Unknown protocol\n",__FUNCTION__);
version = 0;
return;
}
// If a valid connection for the DSCP/EXP with destination address
// is found scan all protocol-based classification rules
if (cx != NULL) {
classref = 0;
sp = NULL;
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] DSCP/EXP %d : looking for classifier entry\n",__FUNCTION__,dscp);
#endif
for (pclassifier=cx->sclassifier[dscp]; pclassifier!=NULL; pclassifier=pclassifier->next) {
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] DSCP %d p->classref=%d,p->protocol=%d,p->version=%d\n",__FUNCTION__,dscp,pclassifier->classref,pclassifier->protocol,pclassifier->ip_version);
#endif
// Check if transport protocol/message match
/*
if ((pclassifier->protocol == protocol))
if ((protocol == OAI_NW_DRV_PROTOCOL_ICMP6) && (version == 6))
if (pclassifier->protocol_message_type == (pclassifier->protocol_message_type )) {
printk("[GRAAL][CLASSIFIER] Router advertisement\n");
}
*/
// normal rule checks that network protocol version matches
if ((pclassifier->ip_version == version) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)){
sp=pclassifier;
classref=sp->classref;
break;
}
}
if (sp!=NULL) {
#ifdef OAI_DRV_DEBUG_CLASS
char sfct[10], sprotocol[10];
if (sp->fct==oai_nw_drv_common_ip2wireless)
strcpy(sfct, "qos");
if (sp->fct==oai_nw_drv_CTL_send)
strcpy(sfct, "ctl");
if (sp->fct==oai_nw_drv_class_del_send_classifier)
strcpy(sfct, "del");
switch(protocol) {
case OAI_NW_DRV_PROTOCOL_UDP:strcpy(sprotocol, "udp");printk("udp packet\n");break;
case OAI_NW_DRV_PROTOCOL_TCP:strcpy(sprotocol, "tcp");printk("tcp packet\n");break;
case OAI_NW_DRV_PROTOCOL_ICMP4:strcpy(sprotocol, "icmp4");printk("icmp4 packet\n");break;
case OAI_NW_DRV_PROTOCOL_ICMP6:strcpy(sprotocol, "icmp6");print_TOOL_pk_icmp6((struct icmp6hdr*)protocolh);break;
case OAI_NW_DRV_PROTOCOL_ARP:strcpy(sprotocol, "arp");printk("arp packet\n");break;
#ifdef MPLS
case OAI_NW_DRV_MPLS_VERSION_CODE:strcpy(sprotocol,"mpls");break;
#endif
default:strcpy(sprotocol, "unknown");
}
printk("[NAS][%s] (dscp %u, %s) received, (classref %u, fct %s, rab_id %u) classifier rule\n",__FUNCTION__,
dscp, sprotocol, sp->classref, sfct, sp->rab_id);
#endif
sp->fct(skb, cx, sp,inst);
} // if classifier entry match found
else {
printk("[NAS][%s] no corresponding item in the classifier, so the message is dropped\n",__FUNCTION__);
// oai_nw_drv_COMMON_del_send(skb, cx, NULL,inst);
}
no_connection = 0;
} // if connection found
//#ifdef OAI_DRV_DEBUG_CLASS
if (no_connection == 1)
printk("[NAS][%s] no corresponding connection, so the message is dropped\n",__FUNCTION__);
//#endif
// } // while loop over connections
#ifdef OAI_DRV_DEBUG_CLASS
printk("[NAS][%s] end\n",__FUNCTION__);
#endif
}
...@@ -73,7 +73,6 @@ ...@@ -73,7 +73,6 @@
void oai_nw_drv_common_class_wireless2ip(u16 dlen, void oai_nw_drv_common_class_wireless2ip(u16 dlen,
void *pdcp_sdu, void *pdcp_sdu,
int inst, int inst,
struct classifier_entity *rclass,
OaiNwDrvRadioBearerId_t rb_id) { OaiNwDrvRadioBearerId_t rb_id) {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -93,11 +92,7 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, ...@@ -93,11 +92,7 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen,
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__, rb_id,inst,dlen); printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__, rb_id,inst,dlen);
#endif #endif
if (rclass == NULL) {
printk("[OAI_IP_DRV][%s] rclass Not found Drop RX packet\n",__FUNCTION__);
++gpriv->stats.rx_dropped;
return;
}
skb = dev_alloc_skb( dlen + 2 ); skb = dev_alloc_skb( dlen + 2 );
if(!skb) { if(!skb) {
...@@ -111,46 +106,36 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, ...@@ -111,46 +106,36 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen,
skb->dev = oai_nw_drv_dev[inst]; skb->dev = oai_nw_drv_dev[inst];
hard_header_len = oai_nw_drv_dev[inst]->hard_header_len; hard_header_len = oai_nw_drv_dev[inst]->hard_header_len;
#ifdef KERNEL_VERSION_GREATER_THAN_2622 skb_set_mac_header(skb, 0);
skb->mac_header = skb->data; skb_set_network_header(skb, hard_header_len);
#else skb->mark = rb_id;
skb->mac.raw = skb->data;
#endif
//printk("[NAC_COMMIN_RECEIVE]: Packet Type %d (%d,%d)",skb->pkt_type,PACKET_HOST,PACKET_BROADCAST);
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] Receiving packet of size %d from PDCP \n",__FUNCTION__, skb->len); printk("[OAI_IP_DRV][%s] Receiving packet @%p of size %d from PDCP \n",__FUNCTION__, skb->data, skb->len);
for (i=0;i<skb->len;i++) for (i=0;i<skb->len;i++)
printk("%2x ",((unsigned char *)(skb->data))[i]); printk("%2x ",((unsigned char *)(skb->data))[i]);
printk("\n"); printk("\n");
#endif #endif
#ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] skb->data @ %p\n",__FUNCTION__, skb->data);
printk("[OAI_IP_DRV][%s] skb->mac_header @ %p\n",__FUNCTION__, skb->mac_header);
#endif
if (rclass->ip_version != OAI_NW_DRV_MPLS_VERSION_CODE) { // This is an IP packet
// LG TEST skb->ip_summed = CHECKSUM_NONE; // LG TEST skb->ip_summed = CHECKSUM_NONE;
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
ipv = (struct ipversion *)&(skb->data[hard_header_len]); ipv = (struct ipversion *)skb_network_header(skb);
switch (ipv->version) { switch (ipv->version) {
case 6: case 6:
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] receive IPv6 message\n",__FUNCTION__); printk("[OAI_IP_DRV][%s] receive IPv6 message\n",__FUNCTION__);
#endif #endif
#ifdef KERNEL_VERSION_GREATER_THAN_2622 skb_set_network_header(skb, hard_header_len);
skb->network_header = &skb->data[hard_header_len]; //skb->network_header = &skb->data[hard_header_len];
#else
skb->nh.ipv6h = (struct ipv6hdr *)&skb->data[hard_header_len];
#endif
if (hard_header_len == 0) { if (hard_header_len == 0) {
skb->protocol = htons(ETH_P_IPV6); skb->protocol = htons(ETH_P_IPV6);
} else { } else {
...@@ -201,16 +186,11 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, ...@@ -201,16 +186,11 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen,
printk("[OAI_IP_DRV][%s] protocol %d\n",__FUNCTION__, ((struct iphdr *)&skb->data[hard_header_len])->protocol); printk("[OAI_IP_DRV][%s] protocol %d\n",__FUNCTION__, ((struct iphdr *)&skb->data[hard_header_len])->protocol);
#endif #endif
#ifdef KERNEL_VERSION_GREATER_THAN_2622 skb_set_network_header(skb, hard_header_len);
skb->network_header = &skb->data[hard_header_len]; //skb->network_header = &skb->data[hard_header_len];
network_header = (struct iphdr *)skb_network_header(skb); network_header = (struct iphdr *)skb_network_header(skb);
protocol = network_header->protocol; protocol = network_header->protocol;
#else
skb->nh.iph = (struct iphdr *)&skb->data[hard_header_len];
protocol=skb->nh.iph->protocol;
#endif
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
switch (protocol) { switch (protocol) {
case IPPROTO_IP: case IPPROTO_IP:
...@@ -234,30 +214,17 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, ...@@ -234,30 +214,17 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen,
#endif #endif
#ifdef NAS_ADDRESS_FIX #ifdef NAS_ADDRESS_FIX
#ifdef KERNEL_VERSION_GREATER_THAN_2622
network_header->check = 0; network_header->check = 0;
network_header->check = ip_fast_csum((unsigned char *) network_header, network_header->ihl); network_header->check = ip_fast_csum((unsigned char *) network_header, network_header->ihl);
//printk("[OAI_IP_DRV][COMMON][RECEIVE] IP Fast Checksum %x \n", network_header->check); //printk("[OAI_IP_DRV][COMMON][RECEIVE] IP Fast Checksum %x \n", network_header->check);
#else
skb->nh.iph->check = 0;
skb->nh.iph->check = ip_fast_csum((unsigned char *)&skb->data[hard_header_len], skb->nh.iph->ihl);
// if (!(skb->nh.iph->frag_off & htons(IP_OFFSET))) {
#endif
switch(protocol) { switch(protocol) {
case IPPROTO_TCP: case IPPROTO_TCP:
#ifdef KERNEL_VERSION_GREATER_THAN_2622
cksum = (u16*)&(((struct tcphdr*)((network_header + (network_header->ihl<<2))))->check); cksum = (u16*)&(((struct tcphdr*)((network_header + (network_header->ihl<<2))))->check);
check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum)); check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum));
//check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum)); //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum));
//check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_TCP, ~(*cksum)); //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_TCP, ~(*cksum));
#else
cksum = (u16*)&(((struct tcphdr*)((skb->data + (skb->nh.iph->ihl<<2))))->check);
check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr,0,0, ~(*cksum));
//check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr,tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum));
// check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr, dlen, IPPROTO_TCP, ~(*cksum));
#endif
*cksum = csum_tcpudp_magic(~osaddr, ~odaddr, 0, 0, ~check); *cksum = csum_tcpudp_magic(~osaddr, ~odaddr, 0, 0, ~check);
//*cksum = csum_tcpudp_magic(~osaddr, ~odaddr, dlen, IPPROTO_TCP, ~check); //*cksum = csum_tcpudp_magic(~osaddr, ~odaddr, dlen, IPPROTO_TCP, ~check);
...@@ -278,17 +245,11 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, ...@@ -278,17 +245,11 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen,
break; break;
case IPPROTO_UDP: case IPPROTO_UDP:
#ifdef KERNEL_VERSION_GREATER_THAN_2622
cksum = (u16*)&(((struct udphdr*)((network_header + (network_header->ihl<<2))))->check); cksum = (u16*)&(((struct udphdr*)((network_header + (network_header->ihl<<2))))->check);
check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum)); check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum));
// check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, udp_hdr(skb)->len, IPPROTO_UDP, ~(*cksum)); // check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, udp_hdr(skb)->len, IPPROTO_UDP, ~(*cksum));
//check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_UDP, ~(*cksum)); //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_UDP, ~(*cksum));
#else
cksum = (u16*)&(((struct udphdr*)((&skb->data[hard_header_len] + (skb->nh.iph->ihl<<2))))->check);
check = csum_tcpudp_magic(((struct iphdr *)&skb->data[hard_header_len])->saddr, ((struct iphdr *)&skb->data[hard_header_len])->daddr, 0,0, ~(*cksum));
//check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr, udp_hdr(skb)->len, IPPROTO_UDP, ~(*cksum));
//check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr, dlen, IPPROTO_UDP, ~(*cksum));
#endif
*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,0,0, ~check); *cksum= csum_tcpudp_magic(~osaddr, ~odaddr,0,0, ~check);
//*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,udp_hdr(skb)->len, IPPROTO_UDP, ~check); //*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,udp_hdr(skb)->len, IPPROTO_UDP, ~check);
//*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,dlen, IPPROTO_UDP, ~check); //*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,dlen, IPPROTO_UDP, ~check);
...@@ -307,7 +268,6 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, ...@@ -307,7 +268,6 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen,
default: default:
break; break;
} }
//#endif // KERNEL VERSION > 22
#endif //NAS_ADDRESS_FIX #endif //NAS_ADDRESS_FIX
if (hard_header_len == 0) { if (hard_header_len == 0) {
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
...@@ -321,23 +281,13 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, ...@@ -321,23 +281,13 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen,
break; break;
default: default:
#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
// fill skb->pkt_type, skb->dev // fill skb->pkt_type, skb->dev
#ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] skb->data @ %p\n",__FUNCTION__, skb->data);
printk("[OAI_IP_DRV][%s] skb->network_header @ %p\n",__FUNCTION__, skb->network_header);
printk("[OAI_IP_DRV][%s] skb->mac_header @ %p\n",__FUNCTION__, skb->mac_header);
#endif
skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]); skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]);
// minus 1(short) instead of 2(bytes) because u16* // minus 1(short) instead of 2(bytes) because u16*
p_ether_type = (u16 *)&(skb->mac_header[hard_header_len-2]); p_ether_type = (u16 *)(skb_network_header(skb)-2);
ether_type = ntohs(*p_ether_type); ether_type = ntohs(*p_ether_type);
#ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] Packet is not IPv4 or IPv6 ether_type=%04X\n",__FUNCTION__, ether_type);
printk("[OAI_IP_DRV][%s] skb->data @ %p\n",__FUNCTION__, skb->data);
printk("[OAI_IP_DRV][%s] skb->network_header @ %p\n",__FUNCTION__, skb->network_header);
printk("[OAI_IP_DRV][%s] skb->mac_header @ %p\n",__FUNCTION__, skb->mac_header);
#endif
switch (ether_type) { switch (ether_type) {
case ETH_P_ARP: case ETH_P_ARP:
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
...@@ -345,32 +295,14 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, ...@@ -345,32 +295,14 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen,
#endif #endif
//skb->pkt_type = PACKET_HOST; //skb->pkt_type = PACKET_HOST;
skb->protocol = htons(ETH_P_ARP); skb->protocol = htons(ETH_P_ARP);
#ifdef KERNEL_VERSION_GREATER_THAN_2622
skb->network_header = &skb->mac_header[hard_header_len];
#else
skb->nh.iph = (struct iphdr *)&skb->data[hard_header_len];
#endif
break; break;
default: default:
; ;
} }
#else
printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__,rb_id,inst,dlen); printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__,rb_id,inst,dlen);
printk("[OAI_IP_DRV][%s] Inst %d: receive unknown message (version=%d)\n",__FUNCTION__,inst,ipv->version); printk("[OAI_IP_DRV][%s] Inst %d: receive unknown message (version=%d)\n",__FUNCTION__,inst,ipv->version);
#endif
}
} else { // This is an MPLS packet
#ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] Received an MPLS packet on RB %d\n",__FUNCTION__,rb_id);
#endif
if (hard_header_len == 0) {
skb->protocol = htons(ETH_P_MPLS_UC);
} else {
#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]);
#endif
}
} }
++gpriv->stats.rx_packets; ++gpriv->stats.rx_packets;
gpriv->stats.rx_bytes += dlen; gpriv->stats.rx_bytes += dlen;
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
...@@ -387,7 +319,7 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, ...@@ -387,7 +319,7 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen,
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Delete the data // Delete the data
void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp,int inst){ void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct oai_nw_drv_priv *priv=netdev_priv(oai_nw_drv_dev[inst]); struct oai_nw_drv_priv *priv=netdev_priv(oai_nw_drv_dev[inst]);
++priv->stats.tx_dropped; ++priv->stats.tx_dropped;
...@@ -395,7 +327,7 @@ void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, struct cx_entity *c ...@@ -395,7 +327,7 @@ void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, struct cx_entity *c
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Request the transfer of data (QoS SAP) // Request the transfer of data (QoS SAP)
void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst){ void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct pdcp_data_req_header_t pdcph; struct pdcp_data_req_header_t pdcph;
struct oai_nw_drv_priv *priv=netdev_priv(oai_nw_drv_dev[inst]); struct oai_nw_drv_priv *priv=netdev_priv(oai_nw_drv_dev[inst]);
...@@ -410,96 +342,46 @@ void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, st ...@@ -410,96 +342,46 @@ void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, st
#ifdef OAI_DRV_DEBUG_SEND #ifdef OAI_DRV_DEBUG_SEND
printk("[OAI_IP_DRV][%s] inst %d begin \n",__FUNCTION__,inst); printk("[OAI_IP_DRV][%s] inst %d begin \n",__FUNCTION__,inst);
#endif #endif
// if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
// {
// priv->stats.tx_dropped ++;
// printk("NAS_QOS_SEND: No connected, so message are dropped \n");
// return;
// }
if (skb==NULL){ if (skb==NULL){
#ifdef OAI_DRV_DEBUG_SEND #ifdef OAI_DRV_DEBUG_SEND
printk("[OAI_IP_DRV][%s] input parameter skb is NULL \n",__FUNCTION__); printk("[OAI_IP_DRV][%s] input parameter skb is NULL \n",__FUNCTION__);
#endif #endif
return; return;
} }
if (gc==NULL){
#ifdef OAI_DRV_DEBUG_SEND
printk("[OAI_IP_DRV][%s] input parameter gc is NULL \n",__FUNCTION__);
#endif
priv->stats.tx_dropped ++;
return;
}
if (cx==NULL){
#ifdef OAI_DRV_DEBUG_SEND
printk("[OAI_IP_DRV][%s] input parameter cx is NULL \n",__FUNCTION__);
#endif
priv->stats.tx_dropped ++;
return;
}
// End debug information
if (gc->rb==NULL)
{
gc->rb=oai_nw_drv_common_search_rb(cx, gc->rab_id);
if (gc->rb==NULL)
{
++priv->stats.tx_dropped;
printk("[OAI_IP_DRV][%s] No corresponding Radio Bearer, so message are dropped, rab_id=%u \n", __FUNCTION__, gc->rab_id);
return;
}
}
#ifdef OAI_DRV_DEBUG_SEND
printk("[OAI_IP_DRV][%s] #1 :",__FUNCTION__);
printk("lcr %u, rab_id %u, rab_id %u, skb_len %d\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id,skb->len);
oai_nw_drv_print_classifier(gc);
#endif
pdcph.data_size = skb->len; pdcph.data_size = skb->len;
pdcph.rb_id = (gc->rb)->rab_id; pdcph.rb_id = skb->mark;
pdcph.inst = inst; pdcph.inst = inst;
#ifdef OAI_NW_DRIVER_USE_NETLINK
bytes_wrote = oai_nw_drv_netlink_send((char *)&pdcph,OAI_NW_DRV_PDCPH_SIZE); bytes_wrote = oai_nw_drv_netlink_send((char *)&pdcph,OAI_NW_DRV_PDCPH_SIZE);
#ifdef OAI_DRV_DEBUG_SEND #ifdef OAI_DRV_DEBUG_SEND
printk("[OAI_IP_DRV][%s] Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n",__FUNCTION__, printk("[OAI_IP_DRV][%s] Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n",__FUNCTION__,
bytes_wrote,skb->len); bytes_wrote,skb->len);
#endif #endif
#else
bytes_wrote = rtf_put(IP2PDCP_FIFO, &pdcph, OAI_NW_DRV_PDCPH_SIZE);
#ifdef OAI_DRV_DEBUG_SEND
printk("[OAI_IP_DRV][%s]Wrote %d bytes (header for %d byte skb) to PDCP fifo\n",__FUNCTION__,
bytes_wrote,skb->len);
#endif
#endif //OAI_NW_DRIVER_USE_NETLINK
if (bytes_wrote != OAI_NW_DRV_PDCPH_SIZE) if (bytes_wrote != OAI_NW_DRV_PDCPH_SIZE)
{ {
printk("[OAI_IP_DRV][%s] problem while writing PDCP's header (bytes wrote = %d to fifo %d)\n",__FUNCTION__,bytes_wrote,IP2PDCP_FIFO); printk("[OAI_IP_DRV][%s] problem while writing PDCP's header (bytes wrote = %d to fifo %d)\n",__FUNCTION__,bytes_wrote,IP2PDCP_FIFO);
printk("rb_id %d, Wrote %d, Header Size %d \n", pdcph.rb_id , bytes_wrote, OAI_NW_DRV_PDCPH_SIZE); printk("rb_id %u, Wrote %u, Header Size %lu \n", pdcph.rb_id , bytes_wrote, OAI_NW_DRV_PDCPH_SIZE);
#ifndef OAI_NW_DRIVER_USE_NETLINK
rtf_reset(IP2PDCP_FIFO);
#endif //OAI_NW_DRIVER_USE_NETLINK
priv->stats.tx_dropped ++; priv->stats.tx_dropped ++;
return; return;
} }
#ifdef OAI_NW_DRIVER_USE_NETLINK
bytes_wrote += oai_nw_drv_netlink_send((char *)skb->data,skb->len); bytes_wrote += oai_nw_drv_netlink_send((char *)skb->data,skb->len);
#else
bytes_wrote += rtf_put(IP2PDCP_FIFO, skb->data, skb->len);
#endif //OAI_NW_DRIVER_USE_NETLINK
if (bytes_wrote != skb->len+OAI_NW_DRV_PDCPH_SIZE) if (bytes_wrote != skb->len+OAI_NW_DRV_PDCPH_SIZE)
{ {
printk("[OAI_IP_DRV][%s] Inst %d, RB_ID %d: problem while writing PDCP's data, bytes_wrote = %d, Data_len %d, PDCPH_SIZE %d\n", printk("[OAI_IP_DRV][%s] Inst %d, RB_ID %u: problem while writing PDCP's data, bytes_wrote = %u, Data_len %u, PDCPH_SIZE %lu\n",
__FUNCTION__, __FUNCTION__,
inst, inst,
pdcph.rb_id, pdcph.rb_id,
bytes_wrote, bytes_wrote,
skb->len, skb->len,
OAI_NW_DRV_PDCPH_SIZE); // congestion OAI_NW_DRV_PDCPH_SIZE); // congestion
#ifndef OAI_NW_DRIVER_USE_NETLINK
rtf_reset(IP2PDCP_FIFO);
#endif //OAI_NW_DRIVER_USE_NETLINK
priv->stats.tx_dropped ++; priv->stats.tx_dropped ++;
return; return;
} }
...@@ -518,303 +400,25 @@ void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, st ...@@ -518,303 +400,25 @@ void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, st
#endif #endif
} }
#ifndef OAI_NW_DRIVER_USE_NETLINK
//---------------------------------------------------------------------------
void oai_nw_drv_common_wireless2ip(void){
//---------------------------------------------------------------------------
u8 sapi;
struct pdcp_data_ind_header_t pdcph;
unsigned char data_buffer[2048];
struct classifier_entity *rclass;
struct oai_nw_drv_priv *priv;
int bytes_read;
// Start debug information
#ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] - begin \n", __FUNCTION__);
#endif
// End debug information
bytes_read = rtf_get(PDCP2IP_FIFO,&pdcph, OAI_NW_DRV_PDCPH_SIZE);
while (bytes_read>0) {
if (bytes_read != OAI_NW_DRV_PDCPH_SIZE)
{
printk("[OAI_IP_DRV][%s] problem while reading PDCP header\n", __FUNCTION__);
return;
}
priv=netdev_priv(oai_nw_drv_dev[pdcph.inst]);
rclass = oai_nw_drv_common_search_class_for_rb(pdcph.rb_id,priv);
bytes_read+= rtf_get(PDCP2IP_FIFO,
data_buffer,
pdcph.data_size);
#ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] - Got header for RB %d, Inst %d \n",__FUNCTION__,
pdcph.rb_id,
pdcph.inst);
#endif
if (rclass) {
#ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] Found corresponding connection in classifier for RAB\n",__FUNCTION__);
#endif //OAI_DRV_DEBUG_RECEIVE
oai_nw_drv_common_class_wireless2ip(pdcph.data_size,
(void *)data_buffer,
pdcph.inst,
rclass,
pdcph.rb_id);
} else {
priv->stats.tx_dropped += 1;
}
bytes_read = rtf_get(PDCP2IP_FIFO, &pdcph, OAI_NW_DRV_PDCPH_SIZE);
}
#ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] - end \n",__FUNCTION__);
#endif
}
#else
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh) { void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh) {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct pdcp_data_ind_header_t *pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh); struct pdcp_data_ind_header_t *pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
struct classifier_entity *rclass;
struct oai_nw_drv_priv *priv; struct oai_nw_drv_priv *priv;
priv = netdev_priv(oai_nw_drv_dev[pdcph->inst]); priv = netdev_priv(oai_nw_drv_dev[pdcph->inst]);
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] QOS receive from PDCP, size %d, rab %d, inst %d\n",__FUNCTION__, printk("[OAI_IP_DRV][%s] QOS receive from PDCP, size %d, rab %d, inst %d\n",__FUNCTION__,
pdcph->data_size,pdcph->rb_id,pdcph->inst); pdcph->data_size,pdcph->rb_id,pdcph->inst);
#endif //OAI_DRV_DEBUG_RECEIVE #endif //OAI_DRV_DEBUG_RECEIVE
rclass = oai_nw_drv_common_search_class_for_rb(pdcph->rb_id,priv);
if (rclass) {
#ifdef OAI_DRV_DEBUG_RECEIVE
printk("[OAI_IP_DRV][%s] Found corresponding connection in classifier for RAB\n",__FUNCTION__);
#endif //OAI_DRV_DEBUG_RECEIVE
oai_nw_drv_common_class_wireless2ip(pdcph->data_size, oai_nw_drv_common_class_wireless2ip(pdcph->data_size,
(unsigned char *)NLMSG_DATA(nlh) + OAI_NW_DRV_PDCPH_SIZE, (unsigned char *)NLMSG_DATA(nlh) + OAI_NW_DRV_PDCPH_SIZE,
pdcph->inst, pdcph->inst,
rclass,
pdcph->rb_id); pdcph->rb_id);
} else {
priv->stats.tx_dropped += 1;
}
}
#endif //OAI_NW_DRIVER_USE_NETLINK
//---------------------------------------------------------------------------
struct cx_entity *oai_nw_drv_common_search_cx(OaiNwDrvLocalConnectionRef_t lcr,struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
#ifdef OAI_DRV_DEBUG_CLASS
printk("[OAI_IP_DRV][%s] - lcr %d\n",__FUNCTION__,lcr);
#endif
if (lcr<OAI_NW_DRV_CX_MAX)
return priv->cx+lcr;
else
return NULL;
}
//---------------------------------------------------------------------------
// Search a Radio Bearer
struct rb_entity *oai_nw_drv_common_search_rb(struct cx_entity *cx, OaiNwDrvRadioBearerId_t rab_id){
//---------------------------------------------------------------------------
struct rb_entity *rb;
#ifdef OAI_DRV_DEBUG_CLASS
printk("[OAI_IP_DRV][%s] - rab_id %d\n",__FUNCTION__, rab_id);
#endif
for (rb=cx->rb; rb!=NULL; rb=rb->next)
{
if (rb->rab_id==rab_id)
return rb;
}
return NULL;
}
//
// Search for a classifier with corresponding radio bearer
//---------------------------------------------------------------------------
struct classifier_entity *oai_nw_drv_common_search_class_for_rb(OaiNwDrvRadioBearerId_t rab_id,struct oai_nw_drv_priv *priv) {
//---------------------------------------------------------------------------
//struct rb_entity *rb;
int dscp;
struct classifier_entity *rclass;
#ifdef OAI_DRV_DEBUG_CLASS
printk("[OAI_IP_DRV][%s] - rab_id %d\n",__FUNCTION__, rab_id);
#endif
for (dscp=0;dscp<OAI_NW_DRV_DSCP_MAX;dscp++) {
// printk("[OAI_IP_DRV][COMMON] priv->rclassifier[%d] = %p\n",dscp,priv->rclassifier[dscp]);
for (rclass=priv->rclassifier[dscp]; rclass!=NULL; rclass=rclass->next) {
#ifdef OAI_DRV_DEBUG_CLASS
printk("[OAI_IP_DRV][%s] - dscp %d, rb %d\n",__FUNCTION__, dscp,rclass->rab_id);
#endif
if (rclass->rab_id==rab_id)
return rclass;
}
}
return NULL;
} }
//---------------------------------------------------------------------------
struct rb_entity *oai_nw_drv_common_add_rb(struct oai_nw_drv_priv *gpriv, struct cx_entity *cx, OaiNwDrvRadioBearerId_t rab_id, OaiNwDrvQoSTrafficClass_t qos){
//--------------------------------------------------------------------------
struct rb_entity *rb;
//struct classifier_entity *pclassifier;
//struct classifier_entity *rclassifier;
#ifdef OAI_DRV_DEBUG_CLASS
printk("[OAI_IP_DRV][%s] begin for rab_id %d , qos %d\n",__FUNCTION__, rab_id, qos );
#endif
if (cx==NULL){
#ifdef OAI_DRV_DEBUG_CLASS
printk("[OAI_IP_DRV][%s] input parameter cx is NULL \n",__FUNCTION__);
#endif
return NULL;
}
rb=oai_nw_drv_common_search_rb(cx, rab_id);
if (rb==NULL) {
rb=(struct rb_entity *)kmalloc(sizeof(struct rb_entity), GFP_KERNEL);
if (rb!=NULL) {
rb->retry=0;
rb->countimer=OAI_NW_DRV_TIMER_IDLE;
rb->rab_id=rab_id;
//rb->rab_id=rab_id+(32*cx->lcr);
#ifdef OAI_DRV_DEBUG_DC
printk("[OAI_IP_DRV][%s] rab_id=%u, mt_id=%u\n",__FUNCTION__,rb->rab_id, cx->lcr);
#endif
rb->qos=qos;
rb->sapi=OAI_NW_DRV_RAB_INPUT_SAPI;
rb->state=OAI_NW_DRV_IDLE;
rb->next=cx->rb;
cx->rb=rb;
++cx->num_rb;
} else {
printk("[OAI_IP_DRV][%s] NAS_ADD_CTL_RB: no memory\n",__FUNCTION__);
}
/*if (cx->num_rb == 1) {
// first RAB added, add default classification rule for multicast signalling
pclassifier=oai_nw_drv_class_add_send_classifier(cx, OAI_NW_DRV_DSCP_DEFAULT, 0);
if (pclassifier != NULL) {
pclassifier->rab_id = rab_id;
pclassifier->rb = rb;
oai_nw_drv_TOOL_fct(pclassifier, OAI_NW_DRV_FCT_QOS_SEND);
pclassifier->ip_version = OAI_NW_DRV_IP_VERSION_6;
memset((u8*)&pclassifier->saddr.ipv6,0,16);
memset((u8*)&pclassifier->daddr.ipv6,0,16);
printk("[OAI_IP_DRV][%s] ADD DEFAULT TX CLASSIFIER ON RAB %d OAI_NW_DRV_DSCP_DEFAULT Adding IPv6 %X:%X:%X:%X:%X:%X:%X:%X -> %X:%X:%X:%X:%X:%X:%X:%X \n",
__FUNCTION__, rab_id, NIP6ADDR(&pclassifier->saddr.ipv6), NIP6ADDR(&pclassifier->daddr.ipv6));
pclassifier->splen = 0;
pclassifier->dplen = 0;
pclassifier->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
pclassifier->protocol_message_type = 0; //LG ??
pclassifier->sport = htons(OAI_NW_DRV_PORT_DEFAULT);
pclassifier->dport = htons(OAI_NW_DRV_PORT_DEFAULT);
}
// first RAB added, add default classification rule for multicast signalling
rclassifier=oai_nw_drv_class_add_recv_classifier(OAI_NW_DRV_DSCP_DEFAULT, 1, gpriv);
if (rclassifier != NULL) {
rclassifier->rab_id = rab_id;
rclassifier->rb = rb;
//oai_nw_drv_TOOL_fct(rclassifier, OAI_NW_DRV_FCT_QOS_SEND);
rclassifier->ip_version = OAI_NW_DRV_IP_VERSION_6;
memset((u8*)&rclassifier->saddr.ipv6,0,16);
memset((u8*)&rclassifier->daddr.ipv6,0,16);
printk("[OAI_IP_DRV][%s] ADD DEFAULT RX CLASSIFIER ON RAB %d OAI_NW_DRV_DSCP_DEFAULT Adding IPv6 %X:%X:%X:%X:%X:%X:%X:%X -> %X:%X:%X:%X:%X:%X:%X:%X \n",
__FUNCTION__, rab_id, NIP6ADDR(&rclassifier->saddr.ipv6), NIP6ADDR(&rclassifier->daddr.ipv6));
rclassifier->splen = 0;
rclassifier->dplen = 0;
rclassifier->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
rclassifier->protocol_message_type = 0; //LG ??
rclassifier->sport = htons(OAI_NW_DRV_PORT_DEFAULT);
rclassifier->dport = htons(OAI_NW_DRV_PORT_DEFAULT);
}
pclassifier=oai_nw_drv_class_add_send_classifier(cx, OAI_NW_DRV_DSCP_DEFAULT, 2);
if (pclassifier != NULL) {
pclassifier->rab_id = rab_id;
pclassifier->rb = rb;
oai_nw_drv_TOOL_fct(pclassifier, OAI_NW_DRV_FCT_QOS_SEND);
pclassifier->ip_version = OAI_NW_DRV_IP_VERSION_4;
memset((u8*)&pclassifier->saddr.ipv4,0,4);
memset((u8*)&pclassifier->daddr.ipv4,0,4);
printk("[OAI_IP_DRV][%s] ADD DEFAULT TX CLASSIFIER ON RAB %d OAI_NW_DRV_DSCP_DEFAULT Adding IPv4 %d:%d:%d:%d -> %d.%d.%d.%d\n",
__FUNCTION__, rab_id, NIPADDR(pclassifier->saddr.ipv4), NIPADDR(pclassifier->daddr.ipv4));
pclassifier->splen = 0;
pclassifier->dplen = 0;
pclassifier->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
pclassifier->protocol_message_type = 0; //LG ??
pclassifier->sport = htons(OAI_NW_DRV_PORT_DEFAULT);
pclassifier->dport = htons(OAI_NW_DRV_PORT_DEFAULT);
}
// first RAB added, add default classification rule for multicast signalling
rclassifier=oai_nw_drv_class_add_recv_classifier(OAI_NW_DRV_DSCP_DEFAULT, 3, gpriv);
if (rclassifier != NULL) {
rclassifier->rab_id = rab_id;
rclassifier->rb = rb;
//oai_nw_drv_TOOL_fct(rclassifier, OAI_NW_DRV_FCT_QOS_SEND);
rclassifier->ip_version = OAI_NW_DRV_IP_VERSION_4;
memset((u8*)&rclassifier->saddr.ipv4,0,4);
memset((u8*)&rclassifier->daddr.ipv4,0,4);
printk("[OAI_IP_DRV][%s] ADD DEFAULT RX CLASSIFIER ON RAB %d OAI_NW_DRV_DSCP_DEFAULT Adding IPv4 %d:%d:%d:%d -> %d.%d.%d.%d\n",
__FUNCTION__, rab_id, NIPADDR(rclassifier->saddr.ipv4), NIPADDR(rclassifier->daddr.ipv4));
rclassifier->splen = 0;
rclassifier->dplen = 0;
rclassifier->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
rclassifier->protocol_message_type = 0; //LG ??
rclassifier->sport = htons(OAI_NW_DRV_PORT_DEFAULT);
rclassifier->dport = htons(OAI_NW_DRV_PORT_DEFAULT);
}
}*/
}
#ifdef OAI_DRV_DEBUG_CLASS
printk("[OAI_IP_DRV][%s] end \n",__FUNCTION__ );
#endif
return rb;
}
//---------------------------------------------------------------------------
void oai_nw_drv_common_flush_rb(struct cx_entity *cx){
//---------------------------------------------------------------------------
struct rb_entity *rb;
struct classifier_entity *gc;
u8 dscp;
#ifdef OAI_DRV_DEBUG_CLASS
printk("[OAI_IP_DRV][%s] begin\n",__FUNCTION__);
#endif
if (cx==NULL){
#ifdef OAI_DRV_DEBUG_CLASS
printk("[OAI_IP_DRV][%s] input parameter cx is NULL \n",__FUNCTION__);
#endif
return;
}
// End debug information
for (rb=cx->rb; rb!=NULL; rb=cx->rb){
printk("[OAI_IP_DRV][%s] del rab_id %u\n",__FUNCTION__, rb->rab_id);
cx->rb=rb->next;
kfree(rb);
}
cx->num_rb=0;
cx->rb=NULL;
for(dscp=0; dscp<OAI_NW_DRV_DSCP_MAX; ++dscp)
{
for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next)
gc->rb=NULL;
}
#ifdef OAI_DRV_DEBUG_CLASS
printk("[OAI_IP_DRV][%s] end\n",__FUNCTION__);
#endif
}
...@@ -180,7 +180,6 @@ int oai_nw_drv_stop(struct net_device *dev){ ...@@ -180,7 +180,6 @@ int oai_nw_drv_stop(struct net_device *dev){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void oai_nw_drv_teardown(struct net_device *dev){ void oai_nw_drv_teardown(struct net_device *dev){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int cxi;
struct oai_nw_drv_priv *priv; struct oai_nw_drv_priv *priv;
int inst; int inst;
...@@ -192,12 +191,12 @@ void oai_nw_drv_teardown(struct net_device *dev){ ...@@ -192,12 +191,12 @@ void oai_nw_drv_teardown(struct net_device *dev){
printk("[OAI_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__); printk("[OAI_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__);
return; return;
} }
oai_nw_drv_class_flush_recv_classifier(priv); /*oai_nw_drv_class_flush_recv_classifier(priv);
for (cxi=0;cxi<OAI_NW_DRV_CX_MAX;cxi++) { for (cxi=0;cxi<OAI_NW_DRV_CX_MAX;cxi++) {
oai_nw_drv_common_flush_rb(priv->cx+cxi); oai_nw_drv_common_flush_rb(priv->cx+cxi);
oai_nw_drv_class_flush_send_classifier(priv->cx+cxi); oai_nw_drv_class_flush_send_classifier(priv->cx+cxi);
} }*/
printk("[OAI_IP_DRV][%s] End\n", __FUNCTION__); printk("[OAI_IP_DRV][%s] End\n", __FUNCTION__);
} // check dev } // check dev
else { else {
...@@ -248,7 +247,7 @@ int oai_nw_drv_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){ ...@@ -248,7 +247,7 @@ int oai_nw_drv_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
#ifdef OAI_DRV_DEBUG_DEVICE #ifdef OAI_DRV_DEBUG_DEVICE
printk("[OAI_IP_DRV][%s] step 1\n", __FUNCTION__); printk("[OAI_IP_DRV][%s] step 1\n", __FUNCTION__);
#endif #endif
oai_nw_drv_class_send(skb,inst); oai_nw_drv_common_ip2wireless(skb,inst);
#ifdef OAI_DRV_DEBUG_DEVICE #ifdef OAI_DRV_DEBUG_DEVICE
printk("[OAI_IP_DRV][%s] step 2\n", __FUNCTION__); printk("[OAI_IP_DRV][%s] step 2\n", __FUNCTION__);
#endif #endif
...@@ -335,7 +334,7 @@ static const struct net_device_ops nasmesh_netdev_ops = { ...@@ -335,7 +334,7 @@ static const struct net_device_ops nasmesh_netdev_ops = {
// Initialisation of the network device // Initialisation of the network device
void oai_nw_drv_init(struct net_device *dev){ void oai_nw_drv_init(struct net_device *dev){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
u8 cxi, dscpi; u8 cxi;
struct oai_nw_drv_priv *priv; struct oai_nw_drv_priv *priv;
int index; int index;
...@@ -416,10 +415,10 @@ void oai_nw_drv_init(struct net_device *dev){ ...@@ -416,10 +415,10 @@ void oai_nw_drv_init(struct net_device *dev){
// priv->timer_establishment=TIMER_ESTABLISHMENT_DEFAULT; // priv->timer_establishment=TIMER_ESTABLISHMENT_DEFAULT;
// priv->timer_release=TIMER_RELEASE_DEFAULT; // priv->timer_release=TIMER_RELEASE_DEFAULT;
for (dscpi=0; dscpi<OAI_NW_DRV_DSCP_MAX; ++dscpi) { /*for (dscpi=0; dscpi<OAI_NW_DRV_DSCP_MAX; ++dscpi) {
priv->rclassifier[dscpi]=NULL; priv->rclassifier[dscpi]=NULL;
} }
priv->nrclassifier=0; priv->nrclassifier=0;*/
// //
for (cxi=0;cxi<OAI_NW_DRV_CX_MAX;cxi++) { for (cxi=0;cxi<OAI_NW_DRV_CX_MAX;cxi++) {
#ifdef OAI_DRV_DEBUG_DEVICE #ifdef OAI_DRV_DEBUG_DEVICE
...@@ -432,7 +431,7 @@ void oai_nw_drv_init(struct net_device *dev){ ...@@ -432,7 +431,7 @@ void oai_nw_drv_init(struct net_device *dev){
priv->cx[cxi].countimer = OAI_NW_DRV_TIMER_IDLE; priv->cx[cxi].countimer = OAI_NW_DRV_TIMER_IDLE;
priv->cx[cxi].retry = 0; priv->cx[cxi].retry = 0;
priv->cx[cxi].lcr = cxi; priv->cx[cxi].lcr = cxi;
priv->cx[cxi].rb = NULL; /*priv->cx[cxi].rb = NULL;
priv->cx[cxi].num_rb = 0; priv->cx[cxi].num_rb = 0;
// initialisation of the classifier // initialisation of the classifier
for (dscpi=0; dscpi<65; ++dscpi) { for (dscpi=0; dscpi<65; ++dscpi) {
...@@ -442,6 +441,7 @@ void oai_nw_drv_init(struct net_device *dev){ ...@@ -442,6 +441,7 @@ void oai_nw_drv_init(struct net_device *dev){
priv->cx[cxi].nsclassifier=0; priv->cx[cxi].nsclassifier=0;
priv->cx[cxi].nfclassifier=0; priv->cx[cxi].nfclassifier=0;
*/
// initialisation of the IP address // initialisation of the IP address
oai_nw_drv_TOOL_eNB_imei2iid(oai_nw_drv_IMEI, (u8 *)priv->cx[cxi].iid6, dev->addr_len); oai_nw_drv_TOOL_eNB_imei2iid(oai_nw_drv_IMEI, (u8 *)priv->cx[cxi].iid6, dev->addr_len);
priv->cx[cxi].iid4=0; priv->cx[cxi].iid4=0;
...@@ -628,10 +628,3 @@ MODULE_PARM_DESC(oai_nw_drv_is_clusterhead,"The Clusterhead Indicator"); ...@@ -628,10 +628,3 @@ MODULE_PARM_DESC(oai_nw_drv_is_clusterhead,"The Clusterhead Indicator");
//MODULE_VERSION(DRV_VERSION); //MODULE_VERSION(DRV_VERSION);
/*#endif*/ /*#endif*/
/*
//---------------------------------------------------------------------------
//module_init(init_nasmesh);
//module_exit(exit_nasmesh);
//---------------------------------------------------------------------------
*/
...@@ -77,517 +77,12 @@ int oai_nw_drv_ioCTL_statistic_request(struct oai_nw_drv_ioctl *gifr, ...@@ -77,517 +77,12 @@ int oai_nw_drv_ioCTL_statistic_request(struct oai_nw_drv_ioctl *gifr,
return 0; return 0;
} }
///////////////////////////////////////////////////////////////////////////////
// Connections List
//---------------------------------------------------------------------------
void oai_nw_drv_set_msg_cx_list_reply(u8 *msgrep,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
struct cx_entity *cx;
OaiNwDrvLocalConnectionRef_t lcr;
struct oai_nw_drv_msg_cx_list_reply *list;
msgrep[0]=OAI_NW_DRV_CX_MAX;
list=(struct oai_nw_drv_msg_cx_list_reply *)(msgrep+1);
for(lcr=0;lcr<OAI_NW_DRV_CX_MAX;++lcr)
{
cx=oai_nw_drv_common_search_cx(lcr,priv);
list[lcr].lcr=lcr;
list[lcr].state=cx->state;
list[lcr].cellid=cx->cellid;
list[lcr].iid4=cx->iid4;
list[lcr].iid6[0]=cx->iid6[0];
list[lcr].iid6[1]=cx->iid6[1];
list[lcr].num_rb=cx->num_rb;
list[lcr].nsclassifier=cx->nsclassifier;
printk("NAS_SET_MSG_CX_LIST_REPLY: nsc=%u\n",cx->nsclassifier);
}
}
//---------------------------------------------------------------------------
int oai_nw_drv_ioCTL_cx_list_request(struct oai_nw_drv_ioctl *gifr,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
u8 msgrep[OAI_NW_DRV_CX_MAX*sizeof(struct oai_nw_drv_msg_cx_list_reply)+1];
printk("NAS_IOCTL_CX_LIST: connection list requested\n");
oai_nw_drv_set_msg_cx_list_reply(msgrep,priv);
if (copy_to_user(gifr->msg, msgrep, OAI_NW_DRV_CX_MAX*sizeof(struct oai_nw_drv_msg_cx_list_reply)+1))
{
printk("NAS_IOCTL_CX_LIST: copy_to_user failure\n");
return -EFAULT;
}
printk("NAS_IOCTL_CX_LIST: end\n");
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// Radio Bearer List
//---------------------------------------------------------------------------
void oai_nw_drv_set_msg_rb_list_reply(u8 *msgrep,
struct oai_nw_drv_msg_rb_list_request *msgreq,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
struct cx_entity *cx;
cx=oai_nw_drv_common_search_cx(msgreq->lcr,priv);
if (cx!=NULL)
{
u8 rbi;
struct rb_entity *rb;
struct oai_nw_drv_msg_rb_list_reply *list;
if (cx->num_rb > OAI_NW_DRV_LIST_RB_MAX)
msgrep[0] = OAI_NW_DRV_LIST_RB_MAX;
else
msgrep[0] = cx->num_rb;
list=(struct oai_nw_drv_msg_rb_list_reply *)(msgrep+1);
for (rb=cx->rb, rbi=0; (rb!=NULL)&&(rbi<msgrep[0]); rb=rb->next, ++rbi)
{
list[rbi].state=rb->state;
list[rbi].rab_id=rb->rab_id;
list[rbi].sapi=rb->sapi;
list[rbi].qos=rb->qos;
}
}
else
msgrep[0]=0;
}
//---------------------------------------------------------------------------
int oai_nw_drv_ioCTL_rb_list_request(struct oai_nw_drv_ioctl *gifr,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
u8 msgrep[OAI_NW_DRV_LIST_RB_MAX*sizeof(struct oai_nw_drv_msg_rb_list_reply)+1];
struct oai_nw_drv_msg_rb_list_request msgreq;
printk("NAS_IOCTL_RB_LIST: Radio Bearer list requested\n");
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq)))
{
printk("NAS_IOCTL_RB_LIST: copy_from_user failure\n");
return -EFAULT;
}
oai_nw_drv_set_msg_rb_list_reply(msgrep, &msgreq,priv);
if (copy_to_user(gifr->msg, msgrep, OAI_NW_DRV_LIST_RB_MAX*sizeof(struct oai_nw_drv_msg_rb_list_reply)+1))
{
printk("NAS_IOCTL_RB_LIST: copy_to_user failure\n");
return -EFAULT;
}
printk("NAS_IOCTL_CX_LIST: end\n");
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// Radio Bearer Establishment
//---------------------------------------------------------------------------
void oai_nw_drv_set_msg_rb_establishment_reply(struct oai_nw_drv_msg_rb_establishment_reply *msgrep,
struct oai_nw_drv_msg_rb_establishment_request *msgreq,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
if ((msgreq->rab_id<3)||(msgreq->rab_id>OAI_NW_DRV_MAX_RABS)) { // navid : increase the number
msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTRABI;
} else {
struct cx_entity *cx;
cx=oai_nw_drv_common_search_cx(msgreq->lcr,priv);
if (cx==NULL) {
msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTLCR;
} else {
struct rb_entity *rb;
rb=oai_nw_drv_common_add_rb(priv, cx, msgreq->rab_id, msgreq->qos);
if (rb!=NULL){
//rb->cnxid = msgreq->cnxid;
//msgrep->status=oai_nw_drv_rg_DC_send_rb_establish_request(cx, rb);
} else {
msgrep->status=-OAI_NW_DRV_ERROR_NOMEMORY;
//msgrep->cnxid = msgreq->cnxid;
}
}
}
}
//---------------------------------------------------------------------------
int oai_nw_drv_ioCTL_rb_establishment_request(struct oai_nw_drv_ioctl *gifr,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
struct oai_nw_drv_msg_rb_establishment_request msgreq;
struct oai_nw_drv_msg_rb_establishment_reply msgrep;
printk("NAS_IOCTL_RB_ESTABLISHMENT: Radio bearer establishment requested\n");
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
printk("NAS_IOCTL_RB_ESTABLISHMENT: copy_from_user failure\n");
return -EFAULT;
}
oai_nw_drv_set_msg_rb_establishment_reply(&msgrep, &msgreq,priv);
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
printk("NAS_IOCTL_RB_ESTABLISHMENT: copy_to_user failure\n");
return -EFAULT;
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// Radio Bearer Release
//---------------------------------------------------------------------------
void oai_nw_drv_set_msg_rb_release_reply(struct oai_nw_drv_msg_rb_release_reply *msgrep,
struct oai_nw_drv_msg_rb_release_request *msgreq,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
if (msgreq->lcr<OAI_NW_DRV_CX_MAX)
{
struct rb_entity *rb;
struct cx_entity *cx;
cx=oai_nw_drv_common_search_cx(msgreq->lcr,priv);
rb=oai_nw_drv_common_search_rb(cx, msgreq->rab_id);
if (rb!=NULL) {
//msgrep->status=oai_nw_drv_rg_DC_send_rb_release_request(cx, rb);
}
else
msgrep->status=-OAI_NW_DRV_ERROR_NOTCONNECTED;
// msgrep->cnxid = msgreq->cnxid;
}
else
msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTLCR;
}
//---------------------------------------------------------------------------
int oai_nw_drv_ioCTL_rb_release_request(struct oai_nw_drv_ioctl *gifr,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
struct oai_nw_drv_msg_rb_release_request msgreq;
struct oai_nw_drv_msg_rb_release_reply msgrep;
printk("NAS_IOCTL_RB_RELEASE: Radio bearer release requested\n");
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq)))
{
printk("NAS_IOCTL_RB_RELEASE: copy_from_user failure\n");
return -EFAULT;
}
oai_nw_drv_set_msg_rb_release_reply(&msgrep, &msgreq, priv);
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep)))
{
printk("NAS_IOCTL_RB_RELEASE: copy_to_user failure\n");
return -EFAULT;
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// Classifier List
//---------------------------------------------------------------------------
void oai_nw_drv_set_msg_class_list_reply(u8 *msgrep,
struct oai_nw_drv_msg_class_list_request *msgreq,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
struct cx_entity *cx;
struct classifier_entity *gc;
struct oai_nw_drv_msg_class_list_reply *list;
u8 cli;
list=(struct oai_nw_drv_msg_class_list_reply *)(msgrep+1);
switch(msgreq->dir)
{
case OAI_NW_DRV_DIRECTION_SEND:
cx=oai_nw_drv_common_search_cx(msgreq->lcr,priv);
if (cx==NULL) {
msgrep[0]=0;
return;
}
gc=cx->sclassifier[msgreq->dscp];
break;
case OAI_NW_DRV_DIRECTION_RECEIVE:
cx=NULL;
gc=priv->rclassifier[msgreq->dscp];
break;
default:
cx=NULL;
msgrep[0]=0;
return;
}
for (cli=0; (gc!=NULL)&&(cli<OAI_NW_DRV_LIST_CLASS_MAX); gc=gc->next, ++cli)
{
list[cli].classref=gc->classref;
list[cli].lcr=msgreq->lcr;
list[cli].dir=msgreq->dir;
list[cli].dscp=msgreq->dscp;
list[cli].rab_id=gc->rab_id;
list[cli].version=gc->ip_version;
switch(gc->ip_version)
{
case 4:
list[cli].saddr.ipv4 = gc->saddr.ipv4;
list[cli].daddr.ipv4 = gc->daddr.ipv4;
break;
case 6:
list[cli].saddr.ipv6 = gc->saddr.ipv6;
list[cli].daddr.ipv6 = gc->daddr.ipv6;
break;
}
list[cli].protocol=gc->protocol;
list[cli].sport=ntohs(gc->sport);
list[cli].dport=ntohs(gc->dport);
list[cli].splen=gc->splen;
list[cli].dplen=gc->dplen;
list[cli].fct=oai_nw_drv_TOOL_invfct(gc);
}
msgrep[0]=cli;
}
//---------------------------------------------------------------------------
int oai_nw_drv_ioCTL_class_list_request(struct oai_nw_drv_ioctl *gifr,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
struct oai_nw_drv_msg_class_list_request msgreq;
printk("NAS_IOCTL_CLASS_LIST: classifier list requested\n");
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq)))
{
printk("NAS_IOCTL_CLASS_LIST: copy_from_user failure\n");
return -EFAULT;
}
oai_nw_drv_set_msg_class_list_reply(g_msgrep, &msgreq,priv);
if (copy_to_user(gifr->msg, g_msgrep, OAI_NW_DRV_LIST_CLASS_MAX*sizeof(struct oai_nw_drv_msg_class_list_reply)+1))
{
printk("NAS_IOCTL_CLASS_LIST: copy_to_user failure\n");
return -EFAULT;
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// Request the addition of a classifier rule
//---------------------------------------------------------------------------
void oai_nw_drv_set_msg_class_add_reply(struct oai_nw_drv_msg_class_add_reply *msgrep,
struct oai_nw_drv_msg_class_add_request *msgreq,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
struct classifier_entity *gc,*gc2;
unsigned char *saddr,*daddr;
unsigned int *saddr32,*daddr32;
printk("[OAI_IP_DRV][CLASS] oai_nw_drv_set_msg_class_add_reply\n");
if (msgreq->dscp>OAI_NW_DRV_DSCP_MAX){
printk("NAS_SET_MSG_CLASS_ADD_REPLY: Incoherent parameter value\n");
msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTDSCP;
return;
}
if (msgreq->dir==OAI_NW_DRV_DIRECTION_SEND){
struct cx_entity *cx;
cx=oai_nw_drv_common_search_cx(msgreq->lcr,priv);
if (cx!=NULL){
printk("NAS_SET_MSG_CLASS_ADD_REPLY: DSCP/EXP %d, Classref %d, RB %u\n", msgreq->dscp, msgreq->classref,msgreq->rab_id );
gc=oai_nw_drv_class_add_send_classifier(cx, msgreq->dscp, msgreq->classref);
printk("NAS_SET_MSG_CLASS_ADD_REPLY: %p %p\n" , msgreq, gc);
if (gc==NULL){
msgrep->status=-OAI_NW_DRV_ERROR_NOMEMORY;
return;
}
}else{
msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTLCR;
return;
}
gc->rab_id=msgreq->rab_id;
gc->rb=oai_nw_drv_common_search_rb(cx, gc->rab_id);
printk("NAS_SET_MSG_CLASS_ADD_REPLY: gc_rb %p %u \n", gc->rb, gc->rab_id);
}else{
if (msgreq->dir==OAI_NW_DRV_DIRECTION_RECEIVE) {
gc=oai_nw_drv_class_add_recv_classifier(msgreq->dscp,
msgreq->classref,
priv);
if (gc==NULL){
msgrep->status=-OAI_NW_DRV_ERROR_NOMEMORY;
return;
}
gc->rab_id=msgreq->rab_id;
} else {
msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTDIR;
return;
}
for (gc2 = priv->rclassifier[msgreq->dscp]; gc2!=NULL ; gc2 = gc2->next)
printk("[OAI_IP_DRV][CLASS] Add Receive Classifier dscp %d: rab_id %d (%p,next %p)\n",msgreq->dscp,gc2->rab_id,gc2,gc2->next);
}
printk("[OAI_IP_DRV][CLASS] Getting addresses ...\n");
oai_nw_drv_TOOL_fct(gc, msgreq->fct);
gc->ip_version=msgreq->version;
switch(gc->ip_version){
case 4:
gc->saddr.ipv4=msgreq->saddr.ipv4;
gc->daddr.ipv4=msgreq->daddr.ipv4;
// #ifdef NAS_CLASS_DEBUG
saddr = (unsigned char *)&gc->saddr.ipv4;
daddr = (unsigned char *)&gc->daddr.ipv4;
printk("[OAI_IP_DRV][CLASS] Adding IPv4 %d.%d.%d.%d/%d -> %d.%d.%d.%d/%d\n",
saddr[0],saddr[1],saddr[2],saddr[3],msgreq->splen,
daddr[0],daddr[1],daddr[2],daddr[3],msgreq->dplen);
//#endif
gc->splen=msgreq->splen;
gc->dplen=msgreq->dplen;
break;
case 6:
memcpy(&gc->saddr.ipv6,&msgreq->saddr.ipv6,16);
memcpy(&gc->daddr.ipv6,&msgreq->daddr.ipv6,16);
saddr32 = (unsigned int *)&gc->saddr.ipv6;
daddr32 = (unsigned int *)&gc->daddr.ipv6;
printk("[OAI_IP_DRV][CLASS] Adding IPv6 %X:%X:%X:%X:%X:%X:%X:%X/%d -> %X:%X:%X:%X:%X:%X:%X:%X/%d\n",
NIP6ADDR(&gc->saddr.ipv6), msgreq->splen, NIP6ADDR(&gc->daddr.ipv6), msgreq->dplen);
gc->splen=msgreq->splen;
gc->dplen=msgreq->dplen;
break;
case OAI_NW_DRV_MPLS_VERSION_CODE:
printk("[OAI_IP_DRV][CLASS] Adding MPLS label %d with exp %d\n",
msgreq->daddr.mpls_label,msgreq->dscp);
gc->daddr.mpls_label = msgreq->daddr.mpls_label;
break;
case 0:
gc->saddr.ipv6.s6_addr32[0]=0;
gc->daddr.ipv6.s6_addr32[1]=0;
gc->saddr.ipv6.s6_addr32[2]=0;
gc->daddr.ipv6.s6_addr32[3]=0;
gc->splen=0;
gc->dplen=0;
break;
default:
msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTVERSION;
kfree(gc);
return;
}
gc->protocol=msgreq->protocol;
gc->protocol_message_type=msgreq->protocol_message_type;
gc->sport=htons(msgreq->sport);
gc->dport=htons(msgreq->dport);
msgrep->status=0;
}
//---------------------------------------------------------------------------
int oai_nw_drv_ioCTL_class_add_request(struct oai_nw_drv_ioctl *gifr,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
struct oai_nw_drv_msg_class_add_request msgreq;
struct oai_nw_drv_msg_class_add_reply msgrep;
printk("NAS_IOCTL_CLASS_ADD: Add classifier components requested\n");
printk("NAS_IOCTL_CLASS_ADD: size of gifr msg %d\n", sizeof(gifr->msg));
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))){
printk("NAS_IOCTL_CLASS_ADD: copy_from_user failure\n");
return -EFAULT;
}
oai_nw_drv_set_msg_class_add_reply(&msgrep, &msgreq,priv);
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))){
printk("NAS_IOCTL_CLASS_ADD: copy_to_user failure\n");
return -EFAULT;
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// Request the deletion of a classifier rule
//---------------------------------------------------------------------------
void oai_nw_drv_set_msg_class_del_reply(struct oai_nw_drv_msg_class_del_reply *msgrep,
struct oai_nw_drv_msg_class_del_request *msgreq,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
if (msgreq->dscp>OAI_NW_DRV_DSCP_DEFAULT) {
printk("NAS_SET_MSG_CLASS_DEL_REPLY: Incoherent parameter value\n");
msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTDSCP;
return;
}
if (msgreq->dir==OAI_NW_DRV_DIRECTION_SEND) {
struct cx_entity *cx;
cx=oai_nw_drv_common_search_cx(msgreq->lcr,priv);
if (cx!=NULL) {
oai_nw_drv_class_del_send_classifier(cx, msgreq->dscp, msgreq->classref);
} else {
msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTLCR;
return;
}
} else {
if (msgreq->dir==OAI_NW_DRV_DIRECTION_RECEIVE) {
oai_nw_drv_class_del_recv_classifier(msgreq->dscp, msgreq->classref,priv);
} else {
msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTDIR;
return;
}
}
msgrep->status=0;
}
//---------------------------------------------------------------------------
int oai_nw_drv_ioCTL_class_del_request(struct oai_nw_drv_ioctl *gifr,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
struct oai_nw_drv_msg_class_del_request msgreq;
struct oai_nw_drv_msg_class_del_reply msgrep;
printk("NAS_IOCTL_CLASS_DEL: Del classifier components requested\n");
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
printk("NAS_IOCTL_CLASS_DEL: copy_from_user failure\n");
return -EFAULT;
}
oai_nw_drv_set_msg_class_del_reply(&msgrep, &msgreq,priv);
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
printk("NAS_IOCTL_CLASS_DEL: copy_to_user failure\n");
return -EFAULT;
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// IMEI // IMEI
// Messages for IMEI transfer // Messages for IMEI transfer
//---------------------------------------------------------------------------
void oai_nw_drv_set_msg_imei_reply(struct oai_nw_drv_msg_l2id_reply *msgrep,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
struct cx_entity *cx;
int lcr=0; // Temp lcr->mt =0
cx=oai_nw_drv_common_search_cx(lcr,priv);
if (cx!=NULL)
{
msgrep->l2id[0] = cx->iid6[0];
msgrep->l2id[1] = cx->iid6[1];
}
}
//---------------------------------------------------------------------------
int oai_nw_drv_ioCTL_imei_request(struct oai_nw_drv_ioctl *gifr,
struct oai_nw_drv_priv *priv){
//---------------------------------------------------------------------------
struct oai_nw_drv_msg_l2id_reply msgrep;
printk("NAS_IOCTL_IMEI: IMEI requested\n");
oai_nw_drv_set_msg_imei_reply(&msgrep,priv);
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep)))
{
printk("NAS_IOCTL_IMEI: copy_to_user failure\n");
return -EFAULT;
}
return 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...@@ -613,30 +108,8 @@ int oai_nw_drv_CTL_ioctl(struct net_device *dev, ...@@ -613,30 +108,8 @@ int oai_nw_drv_CTL_ioctl(struct net_device *dev,
case OAI_NW_DRV_MSG_STATISTIC_REQUEST: case OAI_NW_DRV_MSG_STATISTIC_REQUEST:
r=oai_nw_drv_ioCTL_statistic_request(gifr,priv); r=oai_nw_drv_ioCTL_statistic_request(gifr,priv);
break; break;
case OAI_NW_DRV_MSG_CX_LIST_REQUEST:
r=oai_nw_drv_ioCTL_cx_list_request(gifr,priv);
break;
case OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REQUEST:
r=oai_nw_drv_ioCTL_rb_establishment_request(gifr,priv);
break;
case OAI_NW_DRV_MSG_RB_RELEASE_REQUEST:
r= oai_nw_drv_ioCTL_rb_release_request(gifr,priv);
break;
case OAI_NW_DRV_MSG_RB_LIST_REQUEST:
r=oai_nw_drv_ioCTL_rb_list_request(gifr,priv);
break;
case OAI_NW_DRV_MSG_CLASS_ADD_REQUEST:
r=oai_nw_drv_ioCTL_class_add_request(gifr,priv);
break;
case OAI_NW_DRV_MSG_CLASS_LIST_REQUEST:
r=oai_nw_drv_ioCTL_class_list_request(gifr,priv);
break;
case OAI_NW_DRV_MSG_CLASS_DEL_REQUEST:
r=oai_nw_drv_ioCTL_class_del_request(gifr,priv);
break;
case OAI_NW_DRV_MSG_IMEI_REQUEST:
r=oai_nw_drv_ioCTL_imei_request(gifr,priv);
break;
default: default:
// printk("NAS_IOCTL_RRM: unkwon request type, type=%x\n", gifr->type); // printk("NAS_IOCTL_RRM: unkwon request type, type=%x\n", gifr->type);
r=-EFAULT; r=-EFAULT;
...@@ -651,9 +124,7 @@ int oai_nw_drv_CTL_ioctl(struct net_device *dev, ...@@ -651,9 +124,7 @@ int oai_nw_drv_CTL_ioctl(struct net_device *dev,
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void oai_nw_drv_CTL_send(struct sk_buff *skb, void oai_nw_drv_CTL_send(struct sk_buff *skb, int inst) {
struct cx_entity *cx,
struct classifier_entity *gc,int inst){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
printk("NAS_CTL_SEND - void \n"); printk("NAS_CTL_SEND - void \n");
} }
...@@ -64,18 +64,6 @@ ...@@ -64,18 +64,6 @@
#include "constant.h" #include "constant.h"
#include "sap.h" #include "sap.h"
//#include "rrc_nas_primitives.h"
struct rb_entity {
OaiNwDrvRadioBearerId_t rab_id;
OaiNwDrvSapId_t sapi;
OaiNwDrvQoSTrafficClass_t qos;
u8 state;
u8 retry;
u32 countimer;
struct rb_entity *next;
};
struct cx_entity { struct cx_entity {
int sap[OAI_NW_DRV_SAPI_CX_MAX]; int sap[OAI_NW_DRV_SAPI_CX_MAX];
...@@ -84,14 +72,9 @@ struct cx_entity { ...@@ -84,14 +72,9 @@ struct cx_entity {
OaiNwDrvCellID_t cellid; // cell identification OaiNwDrvCellID_t cellid; // cell identification
u32 countimer; // timeout's counter u32 countimer; // timeout's counter
u8 retry; // number of retransmission u8 retry; // number of retransmission
struct classifier_entity *sclassifier[OAI_NW_DRV_DSCP_MAX]; // send classifier;
struct classifier_entity *fclassifier[OAI_NW_DRV_DSCP_MAX]; // forward classifier;
u16 nsclassifier;
u16 nfclassifier;
u32 iid6[2]; // IPv6 interface identification u32 iid6[2]; // IPv6 interface identification
u8 iid4; // IPv4 interface identification u8 iid4; // IPv4 interface identification
struct rb_entity *rb;
u16 num_rb; // number of radio bearer in linked list
int lastRRCprimitive; int lastRRCprimitive;
//measures //measures
int req_prov_id [OAI_NW_DRV_MAX_MEASURE_NB]; int req_prov_id [OAI_NW_DRV_MAX_MEASURE_NB];
...@@ -101,34 +84,6 @@ struct cx_entity { ...@@ -101,34 +84,6 @@ struct cx_entity {
int provider_id [OAI_NW_DRV_MAX_MEASURE_NB]; int provider_id [OAI_NW_DRV_MAX_MEASURE_NB];
}; };
struct classifier_entity {
u32 classref; // classifier identity
struct classifier_entity *next; // linked list
u8 ip_version; // IP version 4 or 6
union{
struct in6_addr ipv6;
u32 ipv4;
} saddr; // IP source address
u8 splen; // IP source prefix length
union{
struct in6_addr ipv6;
u32 ipv4;
unsigned int mpls_label;
} daddr; // IP destination address
u8 dplen; // IP destination prefix length
u8 protocol; // high layer protocol type (TCP, UDP,..)
unsigned char protocol_message_type;
u16 sport; // source port
u16 dport; // destination port
struct rb_entity *rb; // pointer to rb_entity for sending function or receiving in case of forwarding rule
struct rb_entity *rb_rx; // pointer to rb_entity for receiving (in case of forwarding rule)
OaiNwDrvRadioBearerId_t rab_id; // RAB identification for sending
OaiNwDrvRadioBearerId_t rab_id_rx; // RAB identification for receiving (in case of forwarding rule)
void (*fct)(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst);
};
//#define NAS_RETRY_LIMIT_DEFAULT 5
struct oai_nw_drv_priv { struct oai_nw_drv_priv {
int irq; int irq;
int rx_flags; int rx_flags;
...@@ -139,7 +94,7 @@ struct oai_nw_drv_priv { ...@@ -139,7 +94,7 @@ struct oai_nw_drv_priv {
u32 timer_establishment; u32 timer_establishment;
u32 timer_release; u32 timer_release;
struct cx_entity cx[OAI_NW_DRV_CX_MAX]; struct cx_entity cx[OAI_NW_DRV_CX_MAX];
struct classifier_entity *rclassifier[OAI_NW_DRV_DSCP_MAX]; // receive classifier //struct classifier_entity *rclassifier[OAI_NW_DRV_DSCP_MAX]; // receive classifier
u16 nrclassifier; u16 nrclassifier;
int sap[OAI_NW_DRV_SAPI_MAX]; int sap[OAI_NW_DRV_SAPI_MAX];
struct sock *nl_sk; struct sock *nl_sk;
...@@ -173,15 +128,9 @@ typedef struct pdcp_data_ind_header_t { ...@@ -173,15 +128,9 @@ typedef struct pdcp_data_ind_header_t {
extern struct net_device *oai_nw_drv_dev[OAI_NW_DRV_NB_INSTANCES_MAX]; extern struct net_device *oai_nw_drv_dev[OAI_NW_DRV_NB_INSTANCES_MAX];
//extern int bytes_wrote;
//extern int bytes_read;
extern u8 OAI_NW_DRV_NULL_IMEI[14]; extern u8 OAI_NW_DRV_NULL_IMEI[14];
//global variables shared with RRC
#ifndef OAI_NW_DRIVER_USE_NETLINK
extern int pdcp_2_oai_nw_drv_irq;
#endif
//extern u8 nas_IMEI[14];
#endif #endif
\ No newline at end of file
...@@ -74,39 +74,33 @@ int oai_nw_drv_find_inst(struct net_device *dev); ...@@ -74,39 +74,33 @@ int oai_nw_drv_find_inst(struct net_device *dev);
// common.c // common.c
/** /**
\fn void oai_nw_drv_common_class_wireless2ip(unsigned short dlen, void* pdcp_sdu,int inst,struct classifier_entity *rclass,OaiNwDrvRadioBearerId_t rb_id) \fn void oai_nw_drv_common_class_wireless2ip(unsigned short dlen, void* pdcp_sdu,int inst,OaiNwDrvRadioBearerId_t rb_id)
\brief Receive classified LTE packet, build skbuff struct with it and deliver it to the OS network layer. \brief Receive classified LTE packet, build skbuff struct with it and deliver it to the OS network layer.
@param dlen Length of SDU in bytes @param dlen Length of SDU in bytes
@param pdcp_sdu Pointer to received SDU @param pdcp_sdu Pointer to received SDU
@param inst Instance number @param inst Instance number
@param rclass RX Classifier entity
@param rb_id Radio Bearer Id @param rb_id Radio Bearer Id
*/ */
void oai_nw_drv_common_class_wireless2ip(unsigned short dlen, void oai_nw_drv_common_class_wireless2ip(unsigned short dlen,
void *pdcp_sdu, void *pdcp_sdu,
int inst, int inst,
struct classifier_entity *rclass,
OaiNwDrvRadioBearerId_t rb_id); OaiNwDrvRadioBearerId_t rb_id);
/** /**
\fn void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst) \fn void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst)
\brief Request the transfer of data (QoS SAP) \brief Request the transfer of data (QoS SAP)
@param skb pointer to socket buffer @param skb pointer to socket buffer
@param cx pointer to connection entity for SDU
@param gc pointer to classifier entity for SDU
@param inst device instance @param inst device instance
*/ */
void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst); void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst);
/** /**
\fn void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst) \fn void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst)
\brief Drop the IP packet comming from the OS network layer. \brief Drop the IP packet comming from the OS network layer.
@param skb pointer to socket buffer @param skb pointer to socket buffer
@param cx pointer to connection entity for SDU
@param gc pointer to classifier entity for SDU
@param inst device instance @param inst device instance
*/ */
void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst); void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst);
#ifndef OAI_NW_DRIVER_USE_NETLINK #ifndef OAI_NW_DRIVER_USE_NETLINK
/** /**
...@@ -122,49 +116,6 @@ void oai_nw_drv_common_wireless2ip(void); ...@@ -122,49 +116,6 @@ void oai_nw_drv_common_wireless2ip(void);
void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh); void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh);
#endif //OAI_NW_DRIVER_USE_NETLINK #endif //OAI_NW_DRIVER_USE_NETLINK
/**
\fn struct rb_entity *oai_nw_drv_common_add_rb(struct cx_entity *cx, OaiNwDrvRadioBearerId_t rabi, OaiNwDrvQoSTrafficClass_t qos)
\brief Add a radio-bearer descriptor
@param gpriv pointer to driver instance private datas
@param cx pointer to connection entity
@param rabi radio-bearer index
@param qos NAS QOS traffic class
*/
struct rb_entity *oai_nw_drv_common_add_rb(struct oai_nw_drv_priv *gpriv, struct cx_entity *cx, OaiNwDrvRadioBearerId_t rab_id, OaiNwDrvQoSTrafficClass_t qos);
/**
\fn struct rb_entity *oai_nw_drv_common_search_rb(struct cx_entity *cx, OaiNwDrvRadioBearerId_t rabi)
\brief Search for a radio-bearer entity for a particular connection and radio-bearer index
@param cx pointer to connection entity
@param rabi radio-bearer index
@returns A pointer to the radio-bearer entity
*/
struct rb_entity *oai_nw_drv_common_search_rb(struct cx_entity *cx, OaiNwDrvRadioBearerId_t rabi);
/**
\fn struct cx_entity *oai_nw_drv_common_search_cx(OaiNwDrvLocalConnectionRef_t lcr,struct oai_nw_drv_priv *gpriv)
\brief Search for a connection entity based on its index and pointer to oai_nw_drv_priv
@param lcr index of local connection
@param gpriv pointer to oai_nw_drv_priv for device
@returns A pointer to the connection entity
*/
struct cx_entity *oai_nw_drv_common_search_cx(OaiNwDrvLocalConnectionRef_t lcr,struct oai_nw_drv_priv *gpriv);
/**
\fn struct classifier_entity *oai_nw_drv_common_search_class_for_rb(OaiNwDrvRadioBearerId_t rab_id,struct oai_nw_drv_priv *priv)
\brief Search for an RX classifier entity based on a RB id and pointer to oai_nw_drv_priv
@param rab_id Index of RAB for search
@param priv pointer to oai_nw_drv_priv for device
@returns A pointer to the corresponding RX classifier entity
*/
struct classifier_entity *oai_nw_drv_common_search_class_for_rb(OaiNwDrvRadioBearerId_t rab_id,struct oai_nw_drv_priv *priv);
/**
\fn void oai_nw_drv_common_flush_rb(struct cx_entity *cx)
\brief Clear all RB's for a particular connection
@param cx pointer to connection entity
*/
void oai_nw_drv_common_flush_rb(struct cx_entity *cx);
#ifdef OAI_NW_DRIVER_USE_NETLINK #ifdef OAI_NW_DRIVER_USE_NETLINK
/** /**
...@@ -186,15 +137,9 @@ void oai_nw_drv_COMMON_QOS_receive(struct nlmsghdr *nlh); ...@@ -186,15 +137,9 @@ void oai_nw_drv_COMMON_QOS_receive(struct nlmsghdr *nlh);
#endif //OAI_NW_DRIVER_USE_NETLINK #endif //OAI_NW_DRIVER_USE_NETLINK
// int oai_nw_drv_mesh_DC_receive(struct cx_entity *cx,struct oai_nw_drv_priv *gpriv);
// int oai_nw_drv_mesh_GC_receive(struct oai_nw_drv_priv *gpriv);
// int oai_nw_drv_mesh_DC_send_cx_establish_request(struct cx_entity *cx,struct oai_nw_drv_priv *gpriv);
// int oai_nw_drv_mesh_DC_send_cx_release_request(struct cx_entity *cx,struct oai_nw_drv_priv *gpriv);
// void oai_nw_drv_mesh_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,struct oai_nw_drv_priv *gpriv);
// iocontrol.c // iocontrol.c
void oai_nw_drv_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc, int inst); void oai_nw_drv_CTL_send(struct sk_buff *skb, int inst);
//int oai_nw_drv_CTL_receive_authentication(struct ipv6hdr *iph, struct cx-entity *cx, unsigned char sapi);
int oai_nw_drv_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); int oai_nw_drv_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
// classifier.c // classifier.c
...@@ -205,70 +150,9 @@ int oai_nw_drv_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); ...@@ -205,70 +150,9 @@ int oai_nw_drv_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
void oai_nw_drv_class_send(struct sk_buff *skb, //!< Pointer to socket buffer void oai_nw_drv_class_send(struct sk_buff *skb, //!< Pointer to socket buffer
int inst //!< Instance ID int inst //!< Instance ID
); );
/**
\brief
*/
struct classifier_entity *oai_nw_drv_class_add_send_classifier(struct cx_entity *cx, unsigned char dscp, unsigned short classref);
/**
\brief Send a socket received from IP to classifier for a particular instance ID.
*/
struct classifier_entity *oai_nw_drv_class_add_fwd_classifier(struct cx_entity *cx,
unsigned char dscp,
unsigned short classref
);
/**
\brief Send a socket received from IP to classifier for a particular instance ID.
*/
struct classifier_entity *oai_nw_drv_class_add_recv_classifier(unsigned char dscp,
unsigned short classref,
struct oai_nw_drv_priv*
);
/**
\brief
*/
void oai_nw_drv_class_del_send_classifier(struct cx_entity *cx,
unsigned char dscp,
unsigned short classref
);
/**
\brief
*/
void oai_nw_drv_class_del_fwd_classifier(struct cx_entity *cx,
unsigned char dscp,
unsigned short classref
);
/**
\brief
*/
void oai_nw_drv_class_del_recv_classifier(unsigned char dscp,
unsigned short classref,
struct oai_nw_drv_priv*
);
/**
\brief
*/
void oai_nw_drv_class_flush_send_classifier(struct cx_entity *cx);
/**
\brief
*/
void oai_nw_drv_class_flush_fwd_classifier(struct cx_entity *cx);
/**
\brief
*/
void oai_nw_drv_class_flush_recv_classifier(struct oai_nw_drv_priv *gpriv);
// tool.c // tool.c
unsigned char oai_nw_drv_TOOL_invfct(struct classifier_entity *gc);
void oai_nw_drv_TOOL_fct(struct classifier_entity *gc, unsigned char fct);
void oai_nw_drv_TOOL_imei2iid(unsigned char *imei, unsigned char *iid); void oai_nw_drv_TOOL_imei2iid(unsigned char *imei, unsigned char *iid);
void oai_nw_drv_TOOL_eNB_imei2iid(unsigned char *imei, unsigned char *iid, unsigned char len); void oai_nw_drv_TOOL_eNB_imei2iid(unsigned char *imei, unsigned char *iid, unsigned char len);
unsigned char oai_nw_drv_TOOL_get_dscp6(struct ipv6hdr *iph); unsigned char oai_nw_drv_TOOL_get_dscp6(struct ipv6hdr *iph);
...@@ -285,9 +169,6 @@ void print_TOOL_pk_all(struct sk_buff *skb); ...@@ -285,9 +169,6 @@ void print_TOOL_pk_all(struct sk_buff *skb);
void print_TOOL_pk_ipv6(struct ipv6hdr *iph); void print_TOOL_pk_ipv6(struct ipv6hdr *iph);
void print_TOOL_state(unsigned char state); void print_TOOL_state(unsigned char state);
void oai_nw_drv_tool_print_buffer(char * buffer,int length); void oai_nw_drv_tool_print_buffer(char * buffer,int length);
void oai_nw_drv_print_rb_entity(struct rb_entity *rb);
void oai_nw_drv_print_classifier(struct classifier_entity *gc);
#ifdef OAI_NW_DRIVER_USE_NETLINK #ifdef OAI_NW_DRIVER_USE_NETLINK
// netlink.c // netlink.c
......
...@@ -42,58 +42,7 @@ ...@@ -42,58 +42,7 @@
//#define OAI_NW_DRV_DEBUG_TOOL 1 //#define OAI_NW_DRV_DEBUG_TOOL 1
//---------------------------------------------------------------------------
//
void oai_nw_drv_TOOL_fct(struct classifier_entity *classifier, u8 fct){
//---------------------------------------------------------------------------
// Start debug information
#ifdef OAI_NW_DRV_DEBUG_TOOL
printk("OAI_NW_DRV_TOOL_FCT - begin \n");
#endif
if (classifier==NULL){
#ifdef OAI_NW_DRV_DEBUG_TOOL
printk("OAI_NW_DRV_TOOL_FCT - input parameter classifier is NULL \n");
#endif
return;
}
// End debug information
switch(fct){
case OAI_NW_DRV_FCT_QOS_SEND:
classifier->fct=oai_nw_drv_common_ip2wireless;
break;
case OAI_NW_DRV_FCT_CTL_SEND:
classifier->fct=oai_nw_drv_CTL_send;
break;
case OAI_NW_DRV_FCT_DEL_SEND:
classifier->fct=oai_nw_drv_common_ip2wireless_drop;
break;
default:
classifier->fct=oai_nw_drv_common_ip2wireless_drop;
}
}
//---------------------------------------------------------------------------
u8 oai_nw_drv_TOOL_invfct(struct classifier_entity *classifier){
//---------------------------------------------------------------------------
// Start debug information
#ifdef OAI_NW_DRV_DEBUG_TOOL
printk("OAI_NW_DRV_TOOL_INVFCT - begin \n");
#endif
if (classifier==NULL){
#ifdef OAI_NW_DRV_DEBUG_TOOL
printk("OAI_NW_DRV_TOOL_INVFCT - input parameter classifier is NULL \n");
#endif
return 0;
}
// End debug information
if (classifier->fct==oai_nw_drv_common_ip2wireless)
return OAI_NW_DRV_FCT_QOS_SEND;
if (classifier->fct==oai_nw_drv_CTL_send)
return OAI_NW_DRV_FCT_CTL_SEND;
if (classifier->fct==oai_nw_drv_common_ip2wireless_drop)
return OAI_NW_DRV_FCT_DEL_SEND;
return 0;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
u8 oai_nw_drv_TOOL_get_dscp6(struct ipv6hdr *iph){ u8 oai_nw_drv_TOOL_get_dscp6(struct ipv6hdr *iph){
...@@ -677,31 +626,7 @@ void print_TOOL_pk_all(struct sk_buff *skb){ ...@@ -677,31 +626,7 @@ void print_TOOL_pk_all(struct sk_buff *skb){
return (1); return (1);
}*/ }*/
//---------------------------------------------------------------------------
void print_TOOL_state(u8 state){
//---------------------------------------------------------------------------
// case OAI_NW_DRV_STATE_IDLE:printk(" State OAI_NW_DRV_STATE_IDLE\n");return;
// case OAI_NW_DRV_STATE_CONNECTED:printk(" State OAI_NW_DRV_STATE_CONNECTED\n");return;
// case OAI_NW_DRV_STATE_ESTABLISHMENT_REQUEST:printk(" State OAI_NW_DRV_STATE_ESTABLISHMENT_REQUEST\n");return;
// case OAI_NW_DRV_STATE_ESTABLISHMENT_FAILURE:printk(" State OAI_NW_DRV_STATE_ESTABLISHMENT_FAILURE\n");return;
// case OAI_NW_DRV_STATE_RELEASE_FAILURE:printk(" State OAI_NW_DRV_STATE_RELEASE_FAILURE\n");return;
switch(state){
case OAI_NW_DRV_IDLE:printk("OAI_NW_DRV_IDLE\n");return;
case OAI_NW_DRV_CX_FACH:printk("OAI_NW_DRV_CX_FACH\n");return;
case OAI_NW_DRV_CX_DCH:printk("OAI_NW_DRV_CX_DCH\n");return;
case OAI_NW_DRV_CX_RECEIVED:printk("OAI_NW_DRV_CX_RECEIVED\n");return;
case OAI_NW_DRV_CX_CONNECTING:printk("OAI_NW_DRV_CX_CONNECTING\n");return;
case OAI_NW_DRV_CX_RELEASING:printk("OAI_NW_DRV_CX_RELEASING\n");return;
case OAI_NW_DRV_CX_CONNECTING_FAILURE:printk("OAI_NW_DRV_CX_CONNECTING_FAILURE\n");return;
case OAI_NW_DRV_CX_RELEASING_FAILURE:printk("OAI_NW_DRV_CX_RELEASING_FAILURE\n");return;
case OAI_NW_DRV_RB_ESTABLISHING:printk("OAI_NW_DRV_RB_ESTABLISHING\n");return;
case OAI_NW_DRV_RB_RELEASING:printk("OAI_NW_DRV_RB_RELEASING\n");return;
case OAI_NW_DRV_RB_DCH:printk("OAI_NW_DRV_RB_DCH\n");return;
default: printk(" Unknown state\n");
}
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Print the content of a buffer in hexadecimal // Print the content of a buffer in hexadecimal
...@@ -725,42 +650,4 @@ void oai_nw_drv_tool_print_buffer(char * buffer,int length) { ...@@ -725,42 +650,4 @@ void oai_nw_drv_tool_print_buffer(char * buffer,int length) {
printk("-%hx-",buffer[i]); printk("-%hx-",buffer[i]);
printk(",\t length %d\n", length); printk(",\t length %d\n", length);
} }
//-----------------------------------------------------------------------------
void oai_nw_drv_print_rb_entity(struct rb_entity *rb){
//-----------------------------------------------------------------------------
// Start debug information
#ifdef OAI_NW_DRV_DEBUG_TOOL
printk("OAI_NW_DRV_PRINT_RB_ENTITY - begin \n");
#endif
if (rb==NULL){
#ifdef OAI_NW_DRV_DEBUG_TOOL
printk("OAI_NW_DRV_PRINT_RB_ENTITY - input parameter rb is NULL \n");
#endif
return;
}
// End debug information
printk("\nrb_entity content: rab_id %d, sapi %d, qos %d, \n", rb->rab_id, rb->sapi, rb->qos);
printk("state %d, retry %d, countimer %d\n",rb->state, rb->retry, rb->countimer);
};
//-----------------------------------------------------------------------------
void oai_nw_drv_print_classifier(struct classifier_entity *classifier){
//-----------------------------------------------------------------------------
// Start debug information
#ifdef OAI_NW_DRV_DEBUG_TOOL
printk("OAI_NW_DRV_PRINT_GC_ENTITY - begin \n");
#endif
if (classifier==NULL){
#ifdef OAI_NW_DRV_DEBUG_TOOL
printk("OAI_NW_DRV_PRINT_GC_ENTITY - input parameter classifier is NULL \n");
#endif
return;
}
// End debug information
printk("\nClassifier content: classref %d, version %d, splen %d, dplen %d,\n", classifier->classref, classifier->ip_version, classifier->splen, classifier->dplen);
printk("protocol %d, sport %d, dport %d, rab_id %d\n", classifier->protocol, classifier->sport, classifier->dport, classifier->rab_id);
if (classifier->rb != NULL){
oai_nw_drv_print_rb_entity(classifier->rb);
}
};
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "local.h" #include "local.h"
#include "proto_extern.h" #include "proto_extern.h"
#include "platform_constants.h"
//#define NETLINK_DEBUG 1 //#define NETLINK_DEBUG 1
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -96,7 +96,7 @@ int logInit (void) { ...@@ -96,7 +96,7 @@ int logInit (void) {
} }
g_log->log_component[PHY].name = "PHY"; g_log->log_component[PHY].name = "PHY";
g_log->log_component[PHY].level = LOG_INFO; g_log->log_component[PHY].level = LOG_EMERG;
g_log->log_component[PHY].flag = LOG_MED; g_log->log_component[PHY].flag = LOG_MED;
g_log->log_component[PHY].interval = 1; g_log->log_component[PHY].interval = 1;
g_log->log_component[PHY].fd = 0; g_log->log_component[PHY].fd = 0;
...@@ -104,7 +104,7 @@ int logInit (void) { ...@@ -104,7 +104,7 @@ int logInit (void) {
g_log->log_component[PHY].filelog_name = "/tmp/phy.log"; g_log->log_component[PHY].filelog_name = "/tmp/phy.log";
g_log->log_component[MAC].name = "MAC"; g_log->log_component[MAC].name = "MAC";
g_log->log_component[MAC].level = LOG_DEBUG; g_log->log_component[MAC].level = LOG_EMERG;
g_log->log_component[MAC].flag = LOG_MED; g_log->log_component[MAC].flag = LOG_MED;
g_log->log_component[MAC].interval = 1; g_log->log_component[MAC].interval = 1;
g_log->log_component[MAC].fd = 0; g_log->log_component[MAC].fd = 0;
...@@ -112,7 +112,7 @@ int logInit (void) { ...@@ -112,7 +112,7 @@ int logInit (void) {
g_log->log_component[MAC].filelog_name = "/tmp/mac.log"; g_log->log_component[MAC].filelog_name = "/tmp/mac.log";
g_log->log_component[OPT].name = "OPT"; g_log->log_component[OPT].name = "OPT";
g_log->log_component[OPT].level = LOG_INFO; g_log->log_component[OPT].level = LOG_EMERG;
g_log->log_component[OPT].flag = LOG_MED; g_log->log_component[OPT].flag = LOG_MED;
g_log->log_component[OPT].interval = 1; g_log->log_component[OPT].interval = 1;
g_log->log_component[OPT].fd = 0; g_log->log_component[OPT].fd = 0;
...@@ -144,7 +144,7 @@ int logInit (void) { ...@@ -144,7 +144,7 @@ int logInit (void) {
g_log->log_component[RRC].filelog_name = "/tmp/rrc.log"; g_log->log_component[RRC].filelog_name = "/tmp/rrc.log";
g_log->log_component[EMU].name = "EMU"; g_log->log_component[EMU].name = "EMU";
g_log->log_component[EMU].level = LOG_INFO; g_log->log_component[EMU].level = LOG_EMERG;
g_log->log_component[EMU].flag = LOG_MED; g_log->log_component[EMU].flag = LOG_MED;
g_log->log_component[EMU].interval = 1; g_log->log_component[EMU].interval = 1;
g_log->log_component[EMU].fd = 0; g_log->log_component[EMU].fd = 0;
...@@ -152,7 +152,7 @@ int logInit (void) { ...@@ -152,7 +152,7 @@ int logInit (void) {
g_log->log_component[EMU].filelog_name = ""; g_log->log_component[EMU].filelog_name = "";
g_log->log_component[OMG].name = "OMG"; g_log->log_component[OMG].name = "OMG";
g_log->log_component[OMG].level = LOG_INFO; g_log->log_component[OMG].level = LOG_EMERG;
g_log->log_component[OMG].flag = LOG_MED; g_log->log_component[OMG].flag = LOG_MED;
g_log->log_component[OMG].interval = 1; g_log->log_component[OMG].interval = 1;
g_log->log_component[OMG].fd = 0; g_log->log_component[OMG].fd = 0;
...@@ -160,7 +160,7 @@ int logInit (void) { ...@@ -160,7 +160,7 @@ int logInit (void) {
g_log->log_component[OMG].filelog_name = ""; g_log->log_component[OMG].filelog_name = "";
g_log->log_component[OTG].name = "OTG"; g_log->log_component[OTG].name = "OTG";
g_log->log_component[OTG].level = LOG_FILE; g_log->log_component[OTG].level = LOG_EMERG;
g_log->log_component[OTG].flag = LOG_MED; g_log->log_component[OTG].flag = LOG_MED;
g_log->log_component[OTG].interval = 1; g_log->log_component[OTG].interval = 1;
g_log->log_component[OTG].fd = 0; g_log->log_component[OTG].fd = 0;
...@@ -168,7 +168,7 @@ int logInit (void) { ...@@ -168,7 +168,7 @@ int logInit (void) {
g_log->log_component[OTG].filelog_name = "/tmp/otg.log"; g_log->log_component[OTG].filelog_name = "/tmp/otg.log";
g_log->log_component[OTG_LATENCY].name = "OTG_LATENCY"; g_log->log_component[OTG_LATENCY].name = "OTG_LATENCY";
g_log->log_component[OTG_LATENCY].level = LOG_FILE; g_log->log_component[OTG_LATENCY].level = LOG_EMERG;
g_log->log_component[OTG_LATENCY].flag = LOG_MED; g_log->log_component[OTG_LATENCY].flag = LOG_MED;
g_log->log_component[OTG_LATENCY].interval = 1; g_log->log_component[OTG_LATENCY].interval = 1;
g_log->log_component[OTG_LATENCY].fd = 0; g_log->log_component[OTG_LATENCY].fd = 0;
...@@ -176,7 +176,7 @@ int logInit (void) { ...@@ -176,7 +176,7 @@ int logInit (void) {
g_log->log_component[OTG_LATENCY].filelog_name = "/tmp/otg_latency.dat"; g_log->log_component[OTG_LATENCY].filelog_name = "/tmp/otg_latency.dat";
g_log->log_component[OTG_LATENCY_BG].name = "OTG_LATENCY_BG"; g_log->log_component[OTG_LATENCY_BG].name = "OTG_LATENCY_BG";
g_log->log_component[OTG_LATENCY_BG].level = LOG_FILE; g_log->log_component[OTG_LATENCY_BG].level = LOG_EMERG;
g_log->log_component[OTG_LATENCY_BG].flag = LOG_MED; g_log->log_component[OTG_LATENCY_BG].flag = LOG_MED;
g_log->log_component[OTG_LATENCY_BG].interval = 1; g_log->log_component[OTG_LATENCY_BG].interval = 1;
g_log->log_component[OTG_LATENCY_BG].fd = 0; g_log->log_component[OTG_LATENCY_BG].fd = 0;
...@@ -185,7 +185,7 @@ int logInit (void) { ...@@ -185,7 +185,7 @@ int logInit (void) {
g_log->log_component[OTG_GP].name = "OTG_GP"; g_log->log_component[OTG_GP].name = "OTG_GP";
g_log->log_component[OTG_GP].level = LOG_FILE; g_log->log_component[OTG_GP].level = LOG_EMERG;
g_log->log_component[OTG_GP].flag = LOG_MED; g_log->log_component[OTG_GP].flag = LOG_MED;
g_log->log_component[OTG_GP].interval = 1; g_log->log_component[OTG_GP].interval = 1;
g_log->log_component[OTG_GP].fd = 0; g_log->log_component[OTG_GP].fd = 0;
...@@ -193,7 +193,7 @@ int logInit (void) { ...@@ -193,7 +193,7 @@ int logInit (void) {
g_log->log_component[OTG_GP].filelog_name = "/tmp/otg_GP.dat"; g_log->log_component[OTG_GP].filelog_name = "/tmp/otg_GP.dat";
g_log->log_component[OTG_GP_BG].name = "OTG_GP_BG"; g_log->log_component[OTG_GP_BG].name = "OTG_GP_BG";
g_log->log_component[OTG_GP_BG].level = LOG_FILE; g_log->log_component[OTG_GP_BG].level = LOG_EMERG;
g_log->log_component[OTG_GP_BG].flag = LOG_MED; g_log->log_component[OTG_GP_BG].flag = LOG_MED;
g_log->log_component[OTG_GP_BG].interval = 1; g_log->log_component[OTG_GP_BG].interval = 1;
g_log->log_component[OTG_GP_BG].fd = 0; g_log->log_component[OTG_GP_BG].fd = 0;
...@@ -201,7 +201,7 @@ int logInit (void) { ...@@ -201,7 +201,7 @@ int logInit (void) {
g_log->log_component[OTG_GP_BG].filelog_name = "/tmp/otg_GP_bg.dat"; g_log->log_component[OTG_GP_BG].filelog_name = "/tmp/otg_GP_bg.dat";
g_log->log_component[OTG_JITTER].name = "OTG_JITTER"; g_log->log_component[OTG_JITTER].name = "OTG_JITTER";
g_log->log_component[OTG_JITTER].level = LOG_FILE; g_log->log_component[OTG_JITTER].level = LOG_EMERG;
g_log->log_component[OTG_JITTER].flag = LOG_MED; g_log->log_component[OTG_JITTER].flag = LOG_MED;
g_log->log_component[OTG_JITTER].interval = 1; g_log->log_component[OTG_JITTER].interval = 1;
g_log->log_component[OTG_JITTER].fd = 0; g_log->log_component[OTG_JITTER].fd = 0;
...@@ -209,7 +209,7 @@ int logInit (void) { ...@@ -209,7 +209,7 @@ int logInit (void) {
g_log->log_component[OTG_JITTER].filelog_name = "/tmp/otg_jitter.dat"; g_log->log_component[OTG_JITTER].filelog_name = "/tmp/otg_jitter.dat";
g_log->log_component[OCG].name = "OCG"; g_log->log_component[OCG].name = "OCG";
g_log->log_component[OCG].level = LOG_INFO; g_log->log_component[OCG].level = LOG_EMERG;
g_log->log_component[OCG].flag = LOG_MED; g_log->log_component[OCG].flag = LOG_MED;
g_log->log_component[OCG].interval = 1; g_log->log_component[OCG].interval = 1;
g_log->log_component[OCG].fd = 0; g_log->log_component[OCG].fd = 0;
...@@ -217,7 +217,7 @@ int logInit (void) { ...@@ -217,7 +217,7 @@ int logInit (void) {
g_log->log_component[OCG].filelog_name = ""; g_log->log_component[OCG].filelog_name = "";
g_log->log_component[PERF].name = "PERF"; g_log->log_component[PERF].name = "PERF";
g_log->log_component[PERF].level = LOG_INFO; g_log->log_component[PERF].level = LOG_EMERG;
g_log->log_component[PERF].flag = LOG_MED; g_log->log_component[PERF].flag = LOG_MED;
g_log->log_component[PERF].interval = 1; g_log->log_component[PERF].interval = 1;
g_log->log_component[PERF].fd = 0; g_log->log_component[PERF].fd = 0;
...@@ -225,7 +225,7 @@ int logInit (void) { ...@@ -225,7 +225,7 @@ int logInit (void) {
g_log->log_component[PERF].filelog_name = ""; g_log->log_component[PERF].filelog_name = "";
g_log->log_component[OIP].name = "OIP"; g_log->log_component[OIP].name = "OIP";
g_log->log_component[OIP].level = LOG_INFO; g_log->log_component[OIP].level = LOG_EMERG;
g_log->log_component[OIP].flag = LOG_MED; g_log->log_component[OIP].flag = LOG_MED;
g_log->log_component[OIP].interval = 1; g_log->log_component[OIP].interval = 1;
g_log->log_component[OIP].fd = 0; g_log->log_component[OIP].fd = 0;
...@@ -233,7 +233,7 @@ int logInit (void) { ...@@ -233,7 +233,7 @@ int logInit (void) {
g_log->log_component[OIP].filelog_name = ""; g_log->log_component[OIP].filelog_name = "";
g_log->log_component[CLI].name = "CLI"; g_log->log_component[CLI].name = "CLI";
g_log->log_component[CLI].level = LOG_INFO; g_log->log_component[CLI].level = LOG_EMERG;
g_log->log_component[CLI].flag = LOG_MED; g_log->log_component[CLI].flag = LOG_MED;
g_log->log_component[CLI].interval = 1; g_log->log_component[CLI].interval = 1;
g_log->log_component[CLI].fd = 0; g_log->log_component[CLI].fd = 0;
...@@ -241,7 +241,7 @@ int logInit (void) { ...@@ -241,7 +241,7 @@ int logInit (void) {
g_log->log_component[CLI].filelog_name = ""; g_log->log_component[CLI].filelog_name = "";
g_log->log_component[MSC].name = "MSC"; g_log->log_component[MSC].name = "MSC";
g_log->log_component[MSC].level = LOG_TRACE; g_log->log_component[MSC].level = LOG_EMERG;
g_log->log_component[MSC].flag = LOG_MED; g_log->log_component[MSC].flag = LOG_MED;
g_log->log_component[MSC].interval = 1; g_log->log_component[MSC].interval = 1;
g_log->log_component[MSC].fd = 0; g_log->log_component[MSC].fd = 0;
...@@ -249,7 +249,7 @@ int logInit (void) { ...@@ -249,7 +249,7 @@ int logInit (void) {
g_log->log_component[MSC].filelog_name = "/tmp/msc.log"; g_log->log_component[MSC].filelog_name = "/tmp/msc.log";
g_log->log_component[OCM].name = "OCM"; g_log->log_component[OCM].name = "OCM";
g_log->log_component[OCM].level = LOG_TRACE; g_log->log_component[OCM].level = LOG_EMERG;
g_log->log_component[OCM].flag = LOG_MED; g_log->log_component[OCM].flag = LOG_MED;
g_log->log_component[OCM].interval = 1; g_log->log_component[OCM].interval = 1;
g_log->log_component[OCM].fd = 0; g_log->log_component[OCM].fd = 0;
...@@ -257,7 +257,7 @@ int logInit (void) { ...@@ -257,7 +257,7 @@ int logInit (void) {
g_log->log_component[OCM].filelog_name = "/tmp/ocm.log"; g_log->log_component[OCM].filelog_name = "/tmp/ocm.log";
g_log->log_component[S1AP].name = "S1AP"; g_log->log_component[S1AP].name = "S1AP";
g_log->log_component[S1AP].level = LOG_TRACE; g_log->log_component[S1AP].level = LOG_EMERG;
g_log->log_component[S1AP].flag = LOG_MED; g_log->log_component[S1AP].flag = LOG_MED;
g_log->log_component[S1AP].interval = 1; g_log->log_component[S1AP].interval = 1;
g_log->log_component[S1AP].fd = 0; g_log->log_component[S1AP].fd = 0;
...@@ -265,7 +265,7 @@ int logInit (void) { ...@@ -265,7 +265,7 @@ int logInit (void) {
g_log->log_component[S1AP].filelog_name = "/tmp/s1ap.log"; g_log->log_component[S1AP].filelog_name = "/tmp/s1ap.log";
g_log->log_component[SCTP].name = "SCTP"; g_log->log_component[SCTP].name = "SCTP";
g_log->log_component[SCTP].level = LOG_TRACE; g_log->log_component[SCTP].level = LOG_EMERG;
g_log->log_component[SCTP].flag = LOG_MED; g_log->log_component[SCTP].flag = LOG_MED;
g_log->log_component[SCTP].interval = 1; g_log->log_component[SCTP].interval = 1;
g_log->log_component[SCTP].fd = 0; g_log->log_component[SCTP].fd = 0;
...@@ -273,7 +273,7 @@ int logInit (void) { ...@@ -273,7 +273,7 @@ int logInit (void) {
g_log->log_component[SCTP].filelog_name = ""; g_log->log_component[SCTP].filelog_name = "";
g_log->log_component[HW].name = "HW"; g_log->log_component[HW].name = "HW";
g_log->log_component[HW].level = LOG_DEBUG; g_log->log_component[HW].level = LOG_EMERG;
g_log->log_component[HW].flag = LOG_MED; g_log->log_component[HW].flag = LOG_MED;
g_log->log_component[HW].interval = 1; g_log->log_component[HW].interval = 1;
g_log->log_component[HW].fd = 0; g_log->log_component[HW].fd = 0;
......
...@@ -3,13 +3,14 @@ all: oaisim naslite_netlink_ether ...@@ -3,13 +3,14 @@ all: oaisim naslite_netlink_ether
userclean: clean oaisim naslite_netlink_ether userclean: clean oaisim naslite_netlink_ether
oaisim: oaisim:
(cd $(OPENAIR_TARGETS)/SIMU/USER && make NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 -j2) (cd $(OPENAIR_TARGETS)/SIMU/USER && make NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 Rel10=1 -j8)
naslite_netlink_ether: naslite_netlink_ether:
(cd $(OPENAIR2_DIR) && make naslite_netlink_ether.ko) (cd $(OPENAIR2_DIR) && make naslite_netlink_ether.ko)
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE/RB_TOOL/ && make) (cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE/RB_TOOL/ && make)
clean: clean:
(cd $(OPENAIR_TARGETS)/SIMU/USER && make clean)
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE && make clean) (cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE && make clean)
(cd $(OPENAIR_TARGETS)/SIMU/USER && make clean)
(cd $(OPENAIR_TARGETS)/SIMU/USER && make cleanasn1)
...@@ -416,7 +416,15 @@ int olg_config() { ...@@ -416,7 +416,15 @@ int olg_config() {
oai_emulation.info.g_log_verbosity, oai_emulation.info.g_log_verbosity,
oai_emulation.emulation_config.log_emu.interval); oai_emulation.emulation_config.log_emu.interval);
// if perf eval then reset the otg log level // if perf eval then reset the otg log level
/* set_comp_log(PHY, LOG_NONE, 0x15,1);
set_comp_log(EMU, LOG_NONE, 0x15,1);
set_comp_log(OCG, LOG_NONE, 0x15,1);
set_comp_log(OCM, LOG_NONE, 0x15,1);
set_comp_log(OTG, LOG_NONE, 0x15,1);
set_comp_log(MAC, LOG_NONE, 0x15,1);
set_comp_log(OMG, LOG_NONE, 0x15,1);
set_comp_log(OPT, LOG_ERR, 0x15,1);
/*
set_log(OCG, LOG_DEBUG, 1); set_log(OCG, LOG_DEBUG, 1);
set_log(EMU, LOG_INFO, 20); set_log(EMU, LOG_INFO, 20);
set_log(MAC, LOG_DEBUG, 1); set_log(MAC, LOG_DEBUG, 1);
......
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