Commit af6a266d authored by thomasl's avatar thomasl

remove #if for kernel 2.x


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6067 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 1616e66a
......@@ -315,7 +315,6 @@ void oai_nw_drv_tx_timeout(struct net_device *dev){
printk("[OAI_IP_DRV][%s] transmit timed out %s\n", __FUNCTION__,dev->name);
}
#ifdef KERNEL_VERSION_GREATER_THAN_2629
static const struct net_device_ops nasmesh_netdev_ops = {
.ndo_open = oai_nw_drv_open,
.ndo_stop = oai_nw_drv_stop,
......@@ -329,7 +328,6 @@ static const struct net_device_ops nasmesh_netdev_ops = {
.ndo_tx_timeout = oai_nw_drv_tx_timeout,
.ndo_change_rx_flags = oai_nw_drv_change_rx_flags,
};
#endif
/*.ndo_set_multicast_list = NULL,*/
//---------------------------------------------------------------------------
......@@ -367,9 +365,7 @@ void oai_nw_drv_init(struct net_device *dev){
set_bit(__LINK_STATE_PRESENT, &dev->state);
//
#ifdef KERNEL_VERSION_GREATER_THAN_2629
printk("[OAI_IP_DRV][%s] KERNEL_VERSION_GREATER_THAN_2629\n", __FUNCTION__);
#ifdef KERNEL_VERSION_GREATER_THAN_32
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
printk("[OAI_IP_DRV][%s] KERNEL_VERSION_GREATER_THAN_32\n", __FUNCTION__);
#endif
dev->netdev_ops = &nasmesh_netdev_ops;
......@@ -391,22 +387,6 @@ void oai_nw_drv_init(struct net_device *dev){
//346 }
ether_setup(dev);
#endif
#else
printk("[OAI_IP_DRV][%s] KERNEL_VERSION_LOWER_THAN_2629\n", __FUNCTION__);
dev->open = oai_nw_drv_open;
dev->stop = oai_nw_drv_stop;
dev->set_config = oai_nw_drv_set_config;
dev->hard_start_xmit = oai_nw_drv_hard_start_xmit;
dev->do_ioctl = oai_nw_drv_CTL_ioctl;
dev->get_stats = oai_nw_drv_get_stats;
// dev->rebuild_header = NULL;
// dev->hard_header = NULL;
dev->change_mtu = oai_nw_drv_change_mtu;
// dev->hard_header_cache = NULL;
// dev->header_cache_update = NULL;
dev->tx_timeout = oai_nw_drv_tx_timeout;
dev->change_rx_flags = oai_nw_drv_change_rx_flags;
#endif
//
// Initialize private structure
priv->rx_flags = OAI_NW_DRV_RESET_RX_FLAGS;
......
......@@ -76,7 +76,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)
{
......@@ -95,57 +94,6 @@ static void nas_nl_data_ready (struct sk_buff *skb)
//kfree_skb(skb); // not required,
}
}
#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("[OAI_IP_DRV][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("[OAI_IP_DRV][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("[OAI_IP_DRV][NETLINK] exit_netlink_thread\n");
break;
}
}
} // while
printk("[OAI_IP_DRV][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 oai_nw_drv_netlink_init(void)
......@@ -168,15 +116,11 @@ int oai_nw_drv_netlink_init(void)
&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) */
......@@ -186,12 +130,7 @@ int oai_nw_drv_netlink_init(void)
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);
......@@ -204,11 +143,7 @@ void oai_nw_drv_netlink_release(void) {
printk("[OAI_IP_DRV][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
}
......
......@@ -37,9 +37,6 @@
//#include <linux/udp.h>
//#include <linux/tcp.h>
//#define KERNEL_VERSION_GREATER_THAN_2622 1
//#define KERNEL_VERSION_GREATER_THAN_2630 1
//#define OAI_NW_DRV_DEBUG_TOOL 1
......@@ -537,27 +534,15 @@ void print_TOOL_pk_ipv4(struct iphdr *iph){
void print_TOOL_pk_all(struct sk_buff *skb){
//---------------------------------------------------------------------------
printk("Skb:\t %u, len = %u\n", (unsigned int)skb, skb->len);
#ifdef KERNEL_VERSION_GREATER_THAN_2629
//navid: need to calculate the current used space: fixme?
printk("Skb:\t available buf space = %u \n", skb->truesize);
#else
printk("Skb:\t available buf space = %u, cur used space = %u \n", skb->end-skb->head, skb->tail-skb->data);
#endif
switch (ntohs(skb->protocol))
{
case ETH_P_IPV6:
#ifdef KERNEL_VERSION_GREATER_THAN_2622
print_TOOL_pk_ipv6((struct ipv6hdr *)skb->network_header);
#else
print_TOOL_pk_ipv6(skb->nh.ipv6h);
#endif
break;
case ETH_P_IP:
#ifdef KERNEL_VERSION_GREATER_THAN_2622
print_TOOL_pk_ipv4((struct iphdr *)skb->network_header);
#else
print_TOOL_pk_ipv4(skb->nh.iph);
#endif
break;
}
}
......
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