Commit ba3f18de authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'ci-improve-l2-sim' of...

Merge branch 'ci-improve-l2-sim' of https://gitlab.eurecom.fr/oai/openairinterface5g into ci-improve-l2-sim
parents aaa07960 3535263c
......@@ -51,13 +51,12 @@
struct net_device *ue_ip_dev[UE_IP_NB_INSTANCES_MAX];
#ifdef OAI_NW_DRIVER_USE_NETLINK
extern void ue_ip_netlink_release(void);
extern int ue_ip_netlink_init(void);
extern void ue_ip_netlink_release(void);
extern int ue_ip_netlink_init(void);
#endif
//---------------------------------------------------------------------------
int ue_ip_find_inst(struct net_device *dev_pP)
{
int ue_ip_find_inst(struct net_device *dev_pP) {
//---------------------------------------------------------------------------
int i;
......@@ -72,15 +71,12 @@ int ue_ip_find_inst(struct net_device *dev_pP)
//---------------------------------------------------------------------------
#ifndef OAI_NW_DRIVER_USE_NETLINK
void *ue_ip_interrupt(void)
{
void *ue_ip_interrupt(void) {
//---------------------------------------------------------------------------
uint8_t cxi;
// ue_ip_priv_t *priv_p=netdev_priv(dev_id);
// unsigned int flags;
// priv_p->lock = SPIN_LOCK_UNLOCKED;
#ifdef OAI_DRV_DEBUG_INTERRUPT
printk("INTERRUPT - begin\n");
#endif
......@@ -100,9 +96,9 @@ void *ue_ip_interrupt(void)
#endif //NETLINK
//---------------------------------------------------------------------------
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
void ue_ip_timer(struct timer_list *t)
void ue_ip_timer(struct timer_list *t)
#else
void ue_ip_timer(unsigned long dataP)
void ue_ip_timer(unsigned long dataP)
#endif
{
//---------------------------------------------------------------------------
......@@ -111,7 +107,6 @@ void ue_ip_timer(unsigned long dataP)
#else
ue_ip_priv_t *priv_p = (ue_ip_priv_t *)dataP;
#endif
spin_lock(&priv_p->lock);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
mod_timer(&priv_p->timer, jiffies + UE_IP_TIMER_TICK);
......@@ -121,7 +116,6 @@ void ue_ip_timer(unsigned long dataP)
(priv_p->timer).data = dataP;
add_timer(&priv_p->timer);
#endif
spin_unlock(&priv_p->lock);
return;
// add_timer(&gpriv->timer);
......@@ -130,11 +124,9 @@ void ue_ip_timer(unsigned long dataP)
//---------------------------------------------------------------------------
// 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) {
//---------------------------------------------------------------------------
ue_ip_priv_t *priv_p=netdev_priv(dev_pP);
// Address has already been set at init
#ifndef OAI_NW_DRIVER_USE_NETLINK
......@@ -161,18 +153,15 @@ int ue_ip_open(struct net_device *dev_pP)
(priv_p->timer).function = ue_ip_timer;
#endif
//add_timer(&priv_p->timer);
printk("[UE_IP_DRV][%s] name = %s\n", __FUNCTION__, dev_pP->name);
return 0;
}
//---------------------------------------------------------------------------
// 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) {
//---------------------------------------------------------------------------
ue_ip_priv_t *priv_p = netdev_priv(dev_pP);
printk("[UE_IP_DRV][%s] Begin\n", __FUNCTION__);
del_timer(&(priv_p->timer));
netif_stop_queue(dev_pP);
......@@ -182,12 +171,10 @@ int ue_ip_stop(struct net_device *dev_pP)
}
//---------------------------------------------------------------------------
void ue_ip_teardown(struct net_device *dev_pP)
{
void ue_ip_teardown(struct net_device *dev_pP) {
//---------------------------------------------------------------------------
ue_ip_priv_t *priv_p;
int inst;
printk("[UE_IP_DRV][%s] Begin\n", __FUNCTION__);
if (dev_pP) {
......@@ -199,7 +186,6 @@ void ue_ip_teardown(struct net_device *dev_pP)
return;
}
printk("[UE_IP_DRV][%s] End\n", __FUNCTION__);
} // check dev_pP
else {
......@@ -207,8 +193,7 @@ void ue_ip_teardown(struct net_device *dev_pP)
}
}
//---------------------------------------------------------------------------
int ue_ip_set_config(struct net_device *dev_pP, struct ifmap *map_pP)
{
int ue_ip_set_config(struct net_device *dev_pP, struct ifmap *map_pP) {
//---------------------------------------------------------------------------
printk("[UE_IP_DRV][%s] Begin\n", __FUNCTION__);
......@@ -231,8 +216,7 @@ int ue_ip_set_config(struct net_device *dev_pP, struct ifmap *map_pP)
//---------------------------------------------------------------------------
//
int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP)
{
int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP) {
//---------------------------------------------------------------------------
int inst;
......@@ -284,15 +268,13 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP)
}
//---------------------------------------------------------------------------
struct net_device_stats *ue_ip_get_stats(struct net_device *dev_pP)
{
struct net_device_stats *ue_ip_get_stats(struct net_device *dev_pP) {
//---------------------------------------------------------------------------
ue_ip_priv_t *priv_p = netdev_priv(dev_pP);
return &priv_p->stats;
}
//---------------------------------------------------------------------------
int ue_ip_set_mac_address(struct net_device *dev_pP, void *mac_pP)
{
int ue_ip_set_mac_address(struct net_device *dev_pP, void *mac_pP) {
//---------------------------------------------------------------------------
//struct sockaddr *addr = mac_pP;
printk("[UE_IP_DRV][%s] CHANGE MAC ADDRESS UNSUPPORTED\n", __FUNCTION__);
......@@ -300,8 +282,7 @@ int ue_ip_set_mac_address(struct net_device *dev_pP, void *mac_pP)
return 0;
}
//---------------------------------------------------------------------------
int ue_ip_change_mtu(struct net_device *dev_pP, int mtuP)
{
int ue_ip_change_mtu(struct net_device *dev_pP, int mtuP) {
//---------------------------------------------------------------------------
printk("[UE_IP_DRV][%s] CHANGE MTU %d bytes\n", __FUNCTION__, mtuP);
......@@ -313,8 +294,7 @@ int ue_ip_change_mtu(struct net_device *dev_pP, int mtuP)
return 0;
}
//---------------------------------------------------------------------------
void ue_ip_change_rx_flags(struct net_device *dev_pP, int flagsP)
{
void ue_ip_change_rx_flags(struct net_device *dev_pP, int flagsP) {
//---------------------------------------------------------------------------
ue_ip_priv_t *priv_p = netdev_priv(dev_pP);
printk("[UE_IP_DRV][%s] CHANGE RX FLAGS %08X\n", __FUNCTION__, flagsP);
......@@ -322,12 +302,10 @@ void ue_ip_change_rx_flags(struct net_device *dev_pP, int flagsP)
}
//---------------------------------------------------------------------------
void ue_ip_tx_timeout(struct net_device *dev_pP)
{
void ue_ip_tx_timeout(struct net_device *dev_pP) {
//---------------------------------------------------------------------------
// Transmitter timeout, serious problems.
ue_ip_priv_t *priv_p = netdev_priv(dev_pP);
printk("[UE_IP_DRV][%s] begin\n", __FUNCTION__);
// (ue_ip_priv_t *)(dev_pP->priv_p)->stats.tx_errors++;
(priv_p->stats).tx_errors++;
......@@ -361,8 +339,7 @@ static const struct net_device_ops ue_ip_netdev_ops = {
//---------------------------------------------------------------------------
// Initialisation of the network device
void ue_ip_init(struct net_device *dev_pP)
{
void ue_ip_init(struct net_device *dev_pP) {
//---------------------------------------------------------------------------
ue_ip_priv_t *priv_p = NULL;
......@@ -382,13 +359,10 @@ void ue_ip_init(struct net_device *dev_pP)
}
}
//---------------------------------------------------------------------------
int init_module (void)
{
int init_module (void) {
//---------------------------------------------------------------------------
int err,inst;
char devicename[100];
// Initialize parameters shared with RRC
printk("[UE_IP_DRV][%s] Starting OAI IP driver", __FUNCTION__);
......@@ -423,15 +397,12 @@ int init_module (void)
}
return err;
}
//---------------------------------------------------------------------------
void cleanup_module(void)
{
void cleanup_module(void) {
//---------------------------------------------------------------------------
int inst;
printk("[UE_IP_DRV][CLEANUP] begin\n");
for (inst=0; inst<UE_IP_NB_INSTANCES_MAX; inst++) {
......
......@@ -168,7 +168,6 @@ int setInterfaceParameter(char *interfaceName, char *settingAddress, int operati
}
close(sock_fd);
// printf("Set OK!\n");
return 0;
}
......@@ -225,7 +224,9 @@ int NAS_config(char *interfaceName, char *ipAddress, char *networkMask, char *br
// if(!returnValue)
// returnValue=set_gateway(interfaceName, broadcastAddress);
bringInterfaceUp(interfaceName, 1);
if(!returnValue)
returnValue = bringInterfaceUp(interfaceName, 1);
return returnValue;
}
......@@ -252,7 +253,16 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifname)
if(!returnValue)
returnValue= setInterfaceParameter(interfaceName, broadcastAddress,SIOCSIFBRDADDR);
if(!returnValue)
bringInterfaceUp(interfaceName, 1);
if(!returnValue)
LOG_I(OIP,"Interface %s successfuly configured, ip address %s, mask %s broadcast address %s\n",
interfaceName, ipAddress, netMask, broadcastAddress);
else
LOG_E(OIP,"Interface %s couldn't be configured (ip address %s, mask %s broadcast address %s)\n",
interfaceName, ipAddress, netMask, broadcastAddress);
return returnValue;
}
......
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