Commit ce29d805 authored by Raymond Knopp's avatar Raymond Knopp

Minor modifications to support latest kernels

parent b8b674f4
...@@ -99,21 +99,44 @@ void *ue_ip_interrupt(void) ...@@ -99,21 +99,44 @@ void *ue_ip_interrupt(void)
} }
#endif //NETLINK #endif //NETLINK
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
void ue_ip_timer(struct timer_list *t)
#else
void ue_ip_timer(unsigned long dataP) void ue_ip_timer(unsigned long dataP)
#endif
{ {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
ue_ip_priv_t *priv_p=(ue_ip_priv_t *)dataP; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
ue_ip_priv_t *priv_p = from_timer(priv_p, t, timer);
#else
ue_ip_priv_t *priv_p = (ue_ip_priv_t *)dataP;
#endif
spin_lock(&priv_p->lock); spin_lock(&priv_p->lock);
(priv_p->timer).function=ue_ip_timer; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
(priv_p->timer).expires=jiffies+UE_IP_TIMER_TICK; mod_timer(&priv_p->timer, jiffies + UE_IP_TIMER_TICK);
(priv_p->timer).data=dataP; #else
(priv_p->timer).function = ue_ip_timer;
(priv_p->timer).expires = jiffies + UE_IP_TIMER_TICK;
(priv_p->timer).data = dataP;
add_timer(&priv_p->timer); add_timer(&priv_p->timer);
#endif
spin_unlock(&priv_p->lock); spin_unlock(&priv_p->lock);
return; return;
// add_timer(&gpriv->timer); // add_timer(&gpriv->timer);
// spin_unlock(&gpriv->lock); // spin_unlock(&gpriv->lock);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Called by ifconfig when the device is activated by ifconfig // Called by ifconfig when the device is activated by ifconfig
int ue_ip_open(struct net_device *dev_pP) int ue_ip_open(struct net_device *dev_pP)
...@@ -137,16 +160,22 @@ int ue_ip_open(struct net_device *dev_pP) ...@@ -137,16 +160,22 @@ int ue_ip_open(struct net_device *dev_pP)
netif_wake_queue(dev_pP); netif_wake_queue(dev_pP);
} }
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
timer_setup(&(priv_p->timer), ue_ip_timer, 0);
(priv_p->timer).expires = jiffies+UE_IP_TIMER_TICK;
#else
init_timer(&priv_p->timer); init_timer(&priv_p->timer);
(priv_p->timer).expires = jiffies+UE_IP_TIMER_TICK; (priv_p->timer).expires = jiffies+UE_IP_TIMER_TICK;
(priv_p->timer).data = (unsigned long)priv_p; (priv_p->timer).data = (unsigned long)priv_p;
(priv_p->timer).function = ue_ip_timer; (priv_p->timer).function = ue_ip_timer;
#endif
//add_timer(&priv_p->timer); //add_timer(&priv_p->timer);
printk("[UE_IP_DRV][%s] name = %s\n", __FUNCTION__, dev_pP->name); printk("[UE_IP_DRV][%s] name = %s\n", __FUNCTION__, dev_pP->name);
return 0; return 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Called by ifconfig when the device is desactivated // Called by ifconfig when the device is desactivated
int ue_ip_stop(struct net_device *dev_pP) int ue_ip_stop(struct net_device *dev_pP)
...@@ -236,7 +265,7 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP) ...@@ -236,7 +265,7 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP)
// End debug information // End debug information
netif_stop_queue(dev_pP); netif_stop_queue(dev_pP);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE >= 1796 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796)
netif_trans_update(dev_pP); netif_trans_update(dev_pP);
#else #else
dev_pP->trans_start = jiffies; dev_pP->trans_start = jiffies;
...@@ -312,7 +341,7 @@ void ue_ip_tx_timeout(struct net_device *dev_pP) ...@@ -312,7 +341,7 @@ void ue_ip_tx_timeout(struct net_device *dev_pP)
printk("[UE_IP_DRV][%s] begin\n", __FUNCTION__); printk("[UE_IP_DRV][%s] begin\n", __FUNCTION__);
// (ue_ip_priv_t *)(dev_pP->priv_p)->stats.tx_errors++; // (ue_ip_priv_t *)(dev_pP->priv_p)->stats.tx_errors++;
(priv_p->stats).tx_errors++; (priv_p->stats).tx_errors++;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE >= 1796 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796)
netif_trans_update(dev_pP); netif_trans_update(dev_pP);
#else #else
dev_pP->trans_start = jiffies; dev_pP->trans_start = jiffies;
...@@ -365,7 +394,6 @@ int init_module (void) ...@@ -365,7 +394,6 @@ int init_module (void)
int err,inst; int err,inst;
char devicename[100]; char devicename[100];
// Initialize parameters shared with RRC // Initialize parameters shared with RRC
printk("[UE_IP_DRV][%s] Starting OAI IP driver", __FUNCTION__); printk("[UE_IP_DRV][%s] Starting OAI IP driver", __FUNCTION__);
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include "constant.h" #include "constant.h"
#include "platform_types.h" #include "platform_types.h"
#include "sap.h" #include "sap.h"
#define MAKE_VERSION(a,b,c) ((a)*256+(b)*16+(c))
typedef struct ue_ip_priv_s { typedef struct ue_ip_priv_s {
......
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