remove #if for kernel 2.x
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6067 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
@@ -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);
|
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 = {
|
static const struct net_device_ops nasmesh_netdev_ops = {
|
||||||
.ndo_open = oai_nw_drv_open,
|
.ndo_open = oai_nw_drv_open,
|
||||||
.ndo_stop = oai_nw_drv_stop,
|
.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_tx_timeout = oai_nw_drv_tx_timeout,
|
||||||
.ndo_change_rx_flags = oai_nw_drv_change_rx_flags,
|
.ndo_change_rx_flags = oai_nw_drv_change_rx_flags,
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
/*.ndo_set_multicast_list = NULL,*/
|
/*.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);
|
set_bit(__LINK_STATE_PRESENT, &dev->state);
|
||||||
|
|
||||||
//
|
//
|
||||||
#ifdef KERNEL_VERSION_GREATER_THAN_2629
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
|
||||||
printk("[OAI_IP_DRV][%s] KERNEL_VERSION_GREATER_THAN_2629\n", __FUNCTION__);
|
|
||||||
#ifdef KERNEL_VERSION_GREATER_THAN_32
|
|
||||||
printk("[OAI_IP_DRV][%s] KERNEL_VERSION_GREATER_THAN_32\n", __FUNCTION__);
|
printk("[OAI_IP_DRV][%s] KERNEL_VERSION_GREATER_THAN_32\n", __FUNCTION__);
|
||||||
#endif
|
#endif
|
||||||
dev->netdev_ops = &nasmesh_netdev_ops;
|
dev->netdev_ops = &nasmesh_netdev_ops;
|
||||||
@@ -391,22 +387,6 @@ void oai_nw_drv_init(struct net_device *dev){
|
|||||||
//346 }
|
//346 }
|
||||||
ether_setup(dev);
|
ether_setup(dev);
|
||||||
#endif
|
#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
|
// Initialize private structure
|
||||||
priv->rx_flags = OAI_NW_DRV_RESET_RX_FLAGS;
|
priv->rx_flags = OAI_NW_DRV_RESET_RX_FLAGS;
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ static inline void nasmesh_unlock(void)
|
|||||||
mutex_unlock(&nasmesh_mutex);
|
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.
|
// 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)
|
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,
|
//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)
|
int oai_nw_drv_netlink_init(void)
|
||||||
@@ -168,15 +116,11 @@ int oai_nw_drv_netlink_init(void)
|
|||||||
&oai_netlink_cfg);
|
&oai_netlink_cfg);
|
||||||
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
||||||
nas_nl_sk = netlink_kernel_create(
|
nas_nl_sk = netlink_kernel_create(
|
||||||
# ifdef KERNEL_VERSION_GREATER_THAN_2622
|
|
||||||
&init_net,
|
&init_net,
|
||||||
# endif
|
|
||||||
NAS_NETLINK_ID,
|
NAS_NETLINK_ID,
|
||||||
0,
|
0,
|
||||||
nas_nl_data_ready,
|
nas_nl_data_ready,
|
||||||
# ifdef KERNEL_VERSION_GREATER_THAN_2622
|
|
||||||
&nasmesh_mutex, // NULL
|
&nasmesh_mutex, // NULL
|
||||||
# endif
|
|
||||||
THIS_MODULE);
|
THIS_MODULE);
|
||||||
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
||||||
|
|
||||||
@@ -186,12 +130,7 @@ int oai_nw_drv_netlink_init(void)
|
|||||||
return(-1);
|
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);
|
return(0);
|
||||||
|
|
||||||
@@ -204,11 +143,7 @@ void oai_nw_drv_netlink_release(void) {
|
|||||||
printk("[OAI_IP_DRV][NETLINK] Releasing netlink socket\n");
|
printk("[OAI_IP_DRV][NETLINK] Releasing netlink socket\n");
|
||||||
|
|
||||||
if(nas_nl_sk){
|
if(nas_nl_sk){
|
||||||
#ifdef KERNEL_VERSION_GREATER_THAN_2629
|
|
||||||
netlink_kernel_release(nas_nl_sk); //or skb->sk
|
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/udp.h>
|
||||||
//#include <linux/tcp.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
|
//#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){
|
void print_TOOL_pk_all(struct sk_buff *skb){
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
printk("Skb:\t %u, len = %u\n", (unsigned int)skb, skb->len);
|
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?
|
//navid: need to calculate the current used space: fixme?
|
||||||
printk("Skb:\t available buf space = %u \n", skb->truesize);
|
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))
|
switch (ntohs(skb->protocol))
|
||||||
{
|
{
|
||||||
case ETH_P_IPV6:
|
case ETH_P_IPV6:
|
||||||
#ifdef KERNEL_VERSION_GREATER_THAN_2622
|
|
||||||
print_TOOL_pk_ipv6((struct ipv6hdr *)skb->network_header);
|
print_TOOL_pk_ipv6((struct ipv6hdr *)skb->network_header);
|
||||||
#else
|
|
||||||
print_TOOL_pk_ipv6(skb->nh.ipv6h);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case ETH_P_IP:
|
case ETH_P_IP:
|
||||||
#ifdef KERNEL_VERSION_GREATER_THAN_2622
|
|
||||||
print_TOOL_pk_ipv4((struct iphdr *)skb->network_header);
|
print_TOOL_pk_ipv4((struct iphdr *)skb->network_header);
|
||||||
#else
|
|
||||||
print_TOOL_pk_ipv4(skb->nh.iph);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user