Commit 1b2c507d authored by thomasl's avatar thomasl
Browse files

fix legacy kernel conditional compil

and the line to include modules.h has become commented (weird!)



git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6083 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent d27b0a62
......@@ -75,7 +75,6 @@ static inline void nasmesh_unlock(void)
mutex_unlock(&nasmesh_mutex);
}
#ifdef KERNEL_VERSION_GREATER_THAN_2629
// This can also be implemented using thread to get the data from PDCP without blocking.
static void nas_nl_data_ready (struct sk_buff *skb)
{
......@@ -99,58 +98,6 @@ static void nas_nl_data_ready (struct sk_buff *skb)
}
}
#else
static struct task_struct *netlink_rx_thread;
// this thread is used to avoid blocking other system calls from entering the kernel
static int nas_netlink_rx_thread(void *data) {
int err;
struct sk_buff *skb = NULL;
struct nlmsghdr *nlh = NULL;
printk("[NAS][NETLINK] Starting RX Thread \n");
while (!kthread_should_stop()) {
if (nas_nl_sk) {
skb = skb_recv_datagram(nas_nl_sk, 0, 0, &err);
if (skb) {
#ifdef NETLINK_DEBUG
printk("[NAS][NETLINK] Received socket from PDCP\n");
#endif //NETLINK_DEBUG
nlh = (struct nlmsghdr *)skb->data;
nas_COMMON_QOS_receive(nlh);
skb_free_datagram(nas_nl_sk,skb);
}
}
else {
if (exit_netlink_thread == 1) {
printk("[NAS][NETLINK] exit_netlink_thread\n");
break;
}
}
} // while
printk("[NAS][NETLINK] Exiting RX thread\n");
return(0);
}
static void nas_nl_data_ready (struct sock *sk, int len)
{
wake_up_interruptible(sk->sk_sleep);
}
#endif
int nas_netlink_init()
{
......@@ -172,15 +119,11 @@ int nas_netlink_init()
&oai_netlink_cfg);
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
nas_nl_sk = netlink_kernel_create(
# ifdef KERNEL_VERSION_GREATER_THAN_2622
&init_net,
# endif
NAS_NETLINK_ID,
0,
nas_nl_data_ready,
# ifdef KERNEL_VERSION_GREATER_THAN_2622
&nasmesh_mutex, // NULL
# endif
THIS_MODULE);
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
......@@ -190,12 +133,7 @@ int nas_netlink_init()
return(-1);
}
#ifdef KERNEL_VERSION_GREATER_THAN_2629
#else
// Create receive thread
netlink_rx_thread = kthread_run(nas_netlink_rx_thread, NULL, "NAS_NETLINK_RX_THREAD");
#endif
return(0);
......@@ -208,11 +146,7 @@ void nas_netlink_release(void) {
printk("[NAS][NETLINK] Releasing netlink socket\n");
if(nas_nl_sk){
#ifdef KERNEL_VERSION_GREATER_THAN_2629
netlink_kernel_release(nas_nl_sk); //or skb->sk
#else
sock_release(nas_nl_sk->sk_socket);
#endif
}
......
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