Commit 1d3b5e7a authored by Lionel Gauthier's avatar Lionel Gauthier

Coding rules

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5126 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 78459ad4
...@@ -53,7 +53,7 @@ V3= $(if $(IS_KERNEL_MAIN_VERSION_IS_3),-DKERNEL_MAIN_VERSION_IS_3=1) ...@@ -53,7 +53,7 @@ V3= $(if $(IS_KERNEL_MAIN_VERSION_IS_3),-DKERNEL_MAIN_VERSION_IS_3=1)
#################################################### ####################################################
# EXTRA COMPILER FLAGS # EXTRA COMPILER FLAGS
#################################################### ####################################################
EXTRA_CFLAGS = -fno-common $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_20),-mregparm=3 -fno-stack-protector -mpreferred-stack-boundary=4) $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) $(GT2622) $(GT2629) $(V3) $(GT32) EXTRA_CFLAGS = -I$(OPENAIR2_DIR)/COMMON -fno-common $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_20),-mregparm=3 -fno-stack-protector -mpreferred-stack-boundary=4) $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) $(GT2622) $(GT2629) $(V3) $(GT32)
......
...@@ -67,105 +67,108 @@ ...@@ -67,105 +67,108 @@
//#define OAI_DRV_DEBUG_SEND //#define OAI_DRV_DEBUG_SEND
//#define OAI_DRV_DEBUG_RECEIVE //#define OAI_DRV_DEBUG_RECEIVE
void ue_ip_common_class_wireless2ip(u16 dlen,
void *pdcp_sdu, void
int inst, ue_ip_common_class_wireless2ip(
OaiNwDrvRadioBearerId_t rb_id) { sdu_size_t data_lenP,
void *pdcp_sdu_pP,
int instP,
rb_id_t rb_idP) {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct sk_buff *skb; struct sk_buff *skb_p = NULL;
struct ipversion *ipv; ipversion_t *ipv_p = NULL;
struct ue_ip_priv *gpriv=netdev_priv(ue_ip_dev[inst]); ue_ip_priv_t *gpriv_p = netdev_priv(ue_ip_dev[instP]);
unsigned int hard_header_len; unsigned int hard_header_len = 0;
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
int i; int i;
unsigned char *addr; unsigned char *addr_p = 0;
#endif #endif
unsigned char protocol; unsigned char protocol;
struct iphdr *network_header; struct iphdr *network_header_p = NULL;
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
printk("[UE_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__, rb_id,inst,dlen); printk("[UE_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__, rb_idP,instP,data_lenP);
#endif #endif
skb = dev_alloc_skb( dlen + 2 ); skb_p = dev_alloc_skb( data_lenP + 2 );
if(!skb) { if(!skb_p) {
printk("[UE_IP_DRV][%s] low on memory\n",__FUNCTION__); printk("[UE_IP_DRV][%s] low on memory\n",__FUNCTION__);
++gpriv->stats.rx_dropped; ++gpriv_p->stats.rx_dropped;
return; return;
} }
skb_reserve(skb,2); skb_reserve(skb_p,2);
memcpy(skb_put(skb, dlen), pdcp_sdu,dlen); memcpy(skb_put(skb_p, data_lenP), pdcp_sdu_pP,data_lenP);
skb->dev = ue_ip_dev[inst]; skb_p->dev = ue_ip_dev[instP];
hard_header_len = ue_ip_dev[inst]->hard_header_len; hard_header_len = ue_ip_dev[instP]->hard_header_len;
skb_set_mac_header(skb, 0); skb_set_mac_header(skb_p, 0);
//skb->mac_header = skb->data; //skb_p->mac_header = skb_p->data;
//printk("[NAC_COMMIN_RECEIVE]: Packet Type %d (%d,%d)",skb->pkt_type,PACKET_HOST,PACKET_BROADCAST); //printk("[NAC_COMMIN_RECEIVE]: Packet Type %d (%d,%d)",skb_p->pkt_type,PACKET_HOST,PACKET_BROADCAST);
skb->pkt_type = PACKET_HOST; skb_p->pkt_type = PACKET_HOST;
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
printk("[UE_IP_DRV][%s] Receiving packet of size %d from PDCP \n",__FUNCTION__, skb->len); printk("[UE_IP_DRV][%s] Receiving packet of size %d from PDCP \n",__FUNCTION__, skb_p->len);
for (i=0;i<skb->len;i++) for (i=0;i<skb_p->len;i++)
printk("%2x ",((unsigned char *)(skb->data))[i]); printk("%2x ",((unsigned char *)(skb_p->data))[i]);
printk("\n"); printk("\n");
#endif #endif
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
printk("[UE_IP_DRV][%s] skb->data @ %p\n",__FUNCTION__, skb->data); printk("[UE_IP_DRV][%s] skb_p->data @ %p\n",__FUNCTION__, skb_p->data);
printk("[UE_IP_DRV][%s] skb->mac_header @ %p\n",__FUNCTION__, skb->mac_header); printk("[UE_IP_DRV][%s] skb_p->mac_header @ %p\n",__FUNCTION__, skb_p->mac_header);
#endif #endif
// LG TEST skb->ip_summed = CHECKSUM_NONE; // LG TEST skb_p->ip_summed = CHECKSUM_NONE;
skb->ip_summed = CHECKSUM_UNNECESSARY; skb_p->ip_summed = CHECKSUM_UNNECESSARY;
ipv = (struct ipversion *)&(skb->data[hard_header_len]); ipv_p = (struct ipversion *)&(skb_p->data[hard_header_len]);
switch (ipv->version) { switch (ipv_p->version) {
case 6: case 6:
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
printk("[UE_IP_DRV][%s] receive IPv6 message\n",__FUNCTION__); printk("[UE_IP_DRV][%s] receive IPv6 message\n",__FUNCTION__);
#endif #endif
skb_set_network_header(skb, hard_header_len); skb_set_network_header(skb_p, hard_header_len);
//skb->network_header = &skb->data[hard_header_len]; //skb_p->network_header_p = &skb_p->data[hard_header_len];
if (hard_header_len == 0) { if (hard_header_len == 0) {
skb->protocol = htons(ETH_P_IPV6); skb_p->protocol = htons(ETH_P_IPV6);
} else { } else {
#ifdef OAI_NW_DRIVER_TYPE_ETHERNET #ifdef OAI_NW_DRIVER_TYPE_ETHERNET
skb->protocol = eth_type_trans(skb, ue_ip_dev[inst]); skb_p->protocol = eth_type_trans(skb_p, ue_ip_dev[instP]);
#else #else
#endif #endif
} }
//printk("Writing packet with protocol %x\n",ntohs(skb->protocol)); //printk("Writing packet with protocol %x\n",ntohs(skb_p->protocol));
break; break;
case 4: case 4:
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
//printk("NAS_TOOL_RECEIVE: receive IPv4 message\n"); //printk("NAS_TOOL_RECEIVE: receive IPv4 message\n");
addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr; addr_p = (unsigned char *)&((struct iphdr *)&skb_p->data[hard_header_len])->saddr;
if (addr) { if (addr_p) {
printk("[UE_IP_DRV][%s] Source %d.%d.%d.%d\n",__FUNCTION__, addr[0],addr[1],addr[2],addr[3]); printk("[UE_IP_DRV][%s] Source %d.%d.%d.%d\n",__FUNCTION__, addr_p[0],addr_p[1],addr_p[2],addr_p[3]);
} }
addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr; addr_p = (unsigned char *)&((struct iphdr *)&skb_p->data[hard_header_len])->daddr;
if (addr){ if (addr_p){
printk("[UE_IP_DRV][%s] Dest %d.%d.%d.%d\n",__FUNCTION__, addr[0],addr[1],addr[2],addr[3]); printk("[UE_IP_DRV][%s] Dest %d.%d.%d.%d\n",__FUNCTION__, addr_p[0],addr_p[1],addr_p[2],addr_p[3]);
} }
printk("[UE_IP_DRV][%s] protocol %d\n",__FUNCTION__, ((struct iphdr *)&skb->data[hard_header_len])->protocol); printk("[UE_IP_DRV][%s] protocol %d\n",__FUNCTION__, ((struct iphdr *)&skb_p->data[hard_header_len])->protocol);
#endif #endif
skb->network_header = &skb->data[hard_header_len]; skb_p->network_header = &skb_p->data[hard_header_len];
//network_header = (struct iphdr *)skb_network_header(skb); //network_header_p = (struct iphdr *)skb_network_header(skb_p);
network_header = (struct iphdr *)skb_network_header(skb); network_header_p = (struct iphdr *)skb_network_header(skb_p);
protocol = network_header->protocol; protocol = network_header_p->protocol;
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
switch (protocol) { switch (protocol) {
...@@ -190,25 +193,25 @@ void ue_ip_common_class_wireless2ip(u16 dlen, ...@@ -190,25 +193,25 @@ void ue_ip_common_class_wireless2ip(u16 dlen,
#endif #endif
if (hard_header_len == 0) { if (hard_header_len == 0) {
skb->protocol = htons(ETH_P_IP); skb_p->protocol = htons(ETH_P_IP);
} }
//printk("[UE_IP_DRV][COMMON] Writing packet with protocol %x\n",ntohs(skb->protocol)); //printk("[UE_IP_DRV][COMMON] Writing packet with protocol %x\n",ntohs(skb_p->protocol));
break; break;
default: default:
printk("[UE_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__,rb_id,inst,dlen); printk("[UE_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__,rb_idP,instP,data_lenP);
printk("[UE_IP_DRV][%s] Inst %d: receive unknown message (version=%d)\n",__FUNCTION__,inst,ipv->version); printk("[UE_IP_DRV][%s] Inst %d: receive unknown message (version=%d)\n",__FUNCTION__,instP,ipv_p->version);
} }
++gpriv->stats.rx_packets; ++gpriv_p->stats.rx_packets;
gpriv->stats.rx_bytes += dlen; gpriv_p->stats.rx_bytes += data_lenP;
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
printk("[UE_IP_DRV][%s] sending packet of size %d to kernel\n",__FUNCTION__,skb->len); printk("[UE_IP_DRV][%s] sending packet of size %d to kernel\n",__FUNCTION__,skb_p->len);
for (i=0;i<skb->len;i++) for (i=0;i<skb_p->len;i++)
printk("%2x ",((unsigned char *)(skb->data))[i]); printk("%2x ",((unsigned char *)(skb_p->data))[i]);
printk("\n"); printk("\n");
#endif //OAI_DRV_DEBUG_RECEIVE #endif //OAI_DRV_DEBUG_RECEIVE
netif_rx(skb); netif_rx(skb_p);
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
printk("[UE_IP_DRV][%s] end\n",__FUNCTION__); printk("[UE_IP_DRV][%s] end\n",__FUNCTION__);
#endif #endif
...@@ -216,18 +219,22 @@ void ue_ip_common_class_wireless2ip(u16 dlen, ...@@ -216,18 +219,22 @@ void ue_ip_common_class_wireless2ip(u16 dlen,
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Delete the data // Delete the data
void ue_ip_common_ip2wireless_drop(struct sk_buff *skb, int inst){ void ue_ip_common_ip2wireless_drop(struct sk_buff *skb_pP, int instP){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct ue_ip_priv *priv=netdev_priv(ue_ip_dev[inst]); ue_ip_priv_t *priv_p=netdev_priv(ue_ip_dev[instP]);
++priv->stats.tx_dropped; ++priv_p->stats.tx_dropped;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Request the transfer of data (QoS SAP) // Request the transfer of data (QoS SAP)
void ue_ip_common_ip2wireless(struct sk_buff *skb, int inst){ void
ue_ip_common_ip2wireless(
struct sk_buff *skb_pP,
int instP
) {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct pdcp_data_req_header_s pdcph; struct pdcp_data_req_header_s pdcph;
struct ue_ip_priv *priv=netdev_priv(ue_ip_dev[inst]); ue_ip_priv_t *priv_p=netdev_priv(ue_ip_dev[instP]);
#ifdef LOOPBACK_TEST #ifdef LOOPBACK_TEST
int i; int i;
#endif #endif
...@@ -237,10 +244,10 @@ void ue_ip_common_ip2wireless(struct sk_buff *skb, int inst){ ...@@ -237,10 +244,10 @@ void ue_ip_common_ip2wireless(struct sk_buff *skb, int inst){
unsigned int bytes_wrote; unsigned int bytes_wrote;
// Start debug information // Start debug information
#ifdef OAI_DRV_DEBUG_SEND #ifdef OAI_DRV_DEBUG_SEND
printk("[UE_IP_DRV][%s] inst %d begin \n",__FUNCTION__,inst); printk("[UE_IP_DRV][%s] inst %d begin \n",__FUNCTION__,instP);
#endif #endif
if (skb==NULL){ if (skb_pP==NULL){
#ifdef OAI_DRV_DEBUG_SEND #ifdef OAI_DRV_DEBUG_SEND
printk("[UE_IP_DRV][%s] input parameter skb is NULL \n",__FUNCTION__); printk("[UE_IP_DRV][%s] input parameter skb is NULL \n",__FUNCTION__);
#endif #endif
...@@ -248,79 +255,79 @@ void ue_ip_common_ip2wireless(struct sk_buff *skb, int inst){ ...@@ -248,79 +255,79 @@ void ue_ip_common_ip2wireless(struct sk_buff *skb, int inst){
} }
pdcph.data_size = skb->len; pdcph.data_size = skb_pP->len;
if (skb->mark) { if (skb_pP->mark) {
pdcph.rb_id = skb->mark; pdcph.rb_id = skb_pP->mark;
} else { } else {
pdcph.rb_id = UE_IP_DEFAULT_RAB_ID; pdcph.rb_id = UE_IP_DEFAULT_RAB_ID;
} }
pdcph.inst = inst; pdcph.inst = instP;
bytes_wrote = ue_ip_netlink_send((char *)&pdcph,UE_IP_PDCPH_SIZE); bytes_wrote = ue_ip_netlink_send((char *)&pdcph,UE_IP_PDCPH_SIZE);
#ifdef OAI_DRV_DEBUG_SEND #ifdef OAI_DRV_DEBUG_SEND
printk("[UE_IP_DRV][%s] Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n",__FUNCTION__, printk("[UE_IP_DRV][%s] Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n",__FUNCTION__,
bytes_wrote,skb->len); bytes_wrote,skb_pP->len);
#endif #endif
if (bytes_wrote != UE_IP_PDCPH_SIZE) if (bytes_wrote != UE_IP_PDCPH_SIZE)
{ {
printk("[UE_IP_DRV][%s] problem while writing PDCP's header (bytes wrote = %d)\n",__FUNCTION__,bytes_wrote); printk("[UE_IP_DRV][%s] problem while writing PDCP's header (bytes wrote = %d)\n",__FUNCTION__,bytes_wrote);
printk("rb_id %d, Wrote %d, Header Size %d \n", pdcph.rb_id , bytes_wrote, UE_IP_PDCPH_SIZE); printk("rb_id %d, Wrote %d, Header Size %d \n", pdcph.rb_id , bytes_wrote, UE_IP_PDCPH_SIZE);
priv->stats.tx_dropped ++; priv_p->stats.tx_dropped ++;
return; return;
} }
bytes_wrote += ue_ip_netlink_send((char *)skb->data,skb->len); bytes_wrote += ue_ip_netlink_send((char *)skb_pP->data,skb_pP->len);
if (bytes_wrote != skb->len+UE_IP_PDCPH_SIZE) if (bytes_wrote != skb_pP->len+UE_IP_PDCPH_SIZE)
{ {
printk("[UE_IP_DRV][%s] Inst %d, RB_ID %d: problem while writing PDCP's data, bytes_wrote = %d, Data_len %d, PDCPH_SIZE %d\n", printk("[UE_IP_DRV][%s] Inst %d, RB_ID %d: problem while writing PDCP's data, bytes_wrote = %d, Data_len %d, PDCPH_SIZE %d\n",
__FUNCTION__, __FUNCTION__,
inst, instP,
pdcph.rb_id, pdcph.rb_id,
bytes_wrote, bytes_wrote,
skb->len, skb_pP->len,
UE_IP_PDCPH_SIZE); // congestion UE_IP_PDCPH_SIZE); // congestion
priv->stats.tx_dropped ++; priv_p->stats.tx_dropped ++;
return; return;
} }
#ifdef OAI_DRV_DEBUG_SEND #ifdef OAI_DRV_DEBUG_SEND
printk("[UE_IP_DRV][%s] Sending packet of size %d to PDCP \n",__FUNCTION__,skb->len); printk("[UE_IP_DRV][%s] Sending packet of size %d to PDCP \n",__FUNCTION__,skb_pP->len);
for (j=0;j<skb->len;j++) for (j=0;j<skb_pP->len;j++)
printk("%2x ",((unsigned char *)(skb->data))[j]); printk("%2x ",((unsigned char *)(skb_pP->data))[j]);
printk("\n"); printk("\n");
#endif #endif
priv->stats.tx_bytes += skb->len; priv_p->stats.tx_bytes += skb_pP->len;
priv->stats.tx_packets ++; priv_p->stats.tx_packets ++;
#ifdef OAI_DRV_DEBUG_SEND #ifdef OAI_DRV_DEBUG_SEND
printk("[UE_IP_DRV][%s] end \n",__FUNCTION__); printk("[UE_IP_DRV][%s] end \n",__FUNCTION__);
#endif #endif
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void ue_ip_common_wireless2ip(struct nlmsghdr *nlh) { void ue_ip_common_wireless2ip(struct nlmsghdr *nlh_pP) {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct pdcp_data_ind_header_s *pdcph = (struct pdcp_data_ind_header_s *)NLMSG_DATA(nlh); struct pdcp_data_ind_header_s *pdcph_p = (struct pdcp_data_ind_header_s *)NLMSG_DATA(nlh_pP);
struct ue_ip_priv *priv; ue_ip_priv_t *priv_p;
priv = netdev_priv(ue_ip_dev[pdcph->inst]); priv_p = netdev_priv(ue_ip_dev[pdcph_p->inst]);
#ifdef OAI_DRV_DEBUG_RECEIVE #ifdef OAI_DRV_DEBUG_RECEIVE
printk("[UE_IP_DRV][%s] QOS receive from PDCP, size %d, rab %d, inst %d\n",__FUNCTION__, printk("[UE_IP_DRV][%s] QOS receive from PDCP, size %d, rab %d, inst %d\n",__FUNCTION__,
pdcph->data_size,pdcph->rb_id,pdcph->inst); pdcph_p->data_size,pdcph_p->rb_id,pdcph_p->inst);
#endif #endif
ue_ip_common_class_wireless2ip(pdcph->data_size, ue_ip_common_class_wireless2ip(pdcph_p->data_size,
(unsigned char *)NLMSG_DATA(nlh) + UE_IP_PDCPH_SIZE, (unsigned char *)NLMSG_DATA(nlh_pP) + UE_IP_PDCPH_SIZE,
pdcph->inst, pdcph_p->inst,
pdcph->rb_id); pdcph_p->rb_id);
} }
...@@ -70,12 +70,12 @@ extern int ue_ip_netlink_init(void); ...@@ -70,12 +70,12 @@ extern int ue_ip_netlink_init(void);
#endif #endif
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int ue_ip_find_inst(struct net_device *dev) { int ue_ip_find_inst(struct net_device *dev_pP) {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int i; int i;
for (i=0;i<UE_IP_NB_INSTANCES_MAX;i++) for (i=0;i<UE_IP_NB_INSTANCES_MAX;i++)
if (ue_ip_dev[i] == dev) if (ue_ip_dev[i] == dev_pP)
return(i); return(i);
return(-1); return(-1);
} }
...@@ -85,23 +85,23 @@ int ue_ip_find_inst(struct net_device *dev) { ...@@ -85,23 +85,23 @@ int ue_ip_find_inst(struct net_device *dev) {
#ifndef OAI_NW_DRIVER_USE_NETLINK #ifndef OAI_NW_DRIVER_USE_NETLINK
void *ue_ip_interrupt(void){ void *ue_ip_interrupt(void){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
u8 cxi; uint8_t cxi;
// struct ue_ip_priv *priv=netdev_priv(dev_id); // ue_ip_priv_t *priv_p=netdev_priv(dev_id);
// unsigned int flags; // unsigned int flags;
// priv->lock = SPIN_LOCK_UNLOCKED; // priv_p->lock = SPIN_LOCK_UNLOCKED;
#ifdef OAI_DRV_DEBUG_INTERRUPT #ifdef OAI_DRV_DEBUG_INTERRUPT
printk("INTERRUPT - begin\n"); printk("INTERRUPT - begin\n");
#endif #endif
// spin_lock_irqsave(&priv->lock,flags); // spin_lock_irqsave(&priv_p->lock,flags);
cxi=0; cxi=0;
// mesh_GC_receive(); // mesh_GC_receive();
// mesh_DC_receive(naspriv->cx+cxi); // mesh_DC_receive(naspriv->cx+cxi);
#ifndef OAI_NW_DRIVER_USE_NETLINK #ifndef OAI_NW_DRIVER_USE_NETLINK
ue_ip_common_wireless2ip(); ue_ip_common_wireless2ip();
#endif #endif
// spin_unlock_irqrestore(&priv->lock,flags); // spin_unlock_irqrestore(&priv_p->lock,flags);
#ifdef OAI_DRV_DEBUG_INTERRUPT #ifdef OAI_DRV_DEBUG_INTERRUPT
printk("INTERRUPT: end\n"); printk("INTERRUPT: end\n");
#endif #endif
...@@ -109,15 +109,15 @@ void *ue_ip_interrupt(void){ ...@@ -109,15 +109,15 @@ void *ue_ip_interrupt(void){
} }
#endif //NETLINK #endif //NETLINK
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void ue_ip_timer(unsigned long data){ void ue_ip_timer(unsigned long dataP){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct ue_ip_priv *priv=(struct ue_ip_priv *)data; ue_ip_priv_t *priv_p=(ue_ip_priv_t *)dataP;
spin_lock(&priv->lock); spin_lock(&priv_p->lock);
(priv->timer).function=ue_ip_timer; (priv_p->timer).function=ue_ip_timer;
(priv->timer).expires=jiffies+UE_IP_TIMER_TICK; (priv_p->timer).expires=jiffies+UE_IP_TIMER_TICK;
(priv->timer).data=data; (priv_p->timer).data=dataP;
add_timer(&priv->timer); add_timer(&priv_p->timer);
spin_unlock(&priv->lock); spin_unlock(&priv_p->lock);
return; return;
// add_timer(&gpriv->timer); // add_timer(&gpriv->timer);
// spin_unlock(&gpriv->lock); // spin_unlock(&gpriv->lock);
...@@ -125,9 +125,9 @@ void ue_ip_timer(unsigned long data){ ...@@ -125,9 +125,9 @@ void ue_ip_timer(unsigned long data){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// 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){ int ue_ip_open(struct net_device *dev_pP){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct ue_ip_priv *priv=netdev_priv(dev); ue_ip_priv_t *priv_p=netdev_priv(dev_pP);
// Address has already been set at init // Address has already been set at init
#ifndef OAI_NW_DRIVER_USE_NETLINK #ifndef OAI_NW_DRIVER_USE_NETLINK
...@@ -137,45 +137,45 @@ int ue_ip_open(struct net_device *dev){ ...@@ -137,45 +137,45 @@ int ue_ip_open(struct net_device *dev){
} }
#endif //OAI_NW_DRIVER_USE_NETLINK #endif //OAI_NW_DRIVER_USE_NETLINK
if(!netif_queue_stopped(dev)) if(!netif_queue_stopped(dev_pP))
netif_start_queue(dev); netif_start_queue(dev_pP);
else else
netif_wake_queue(dev); netif_wake_queue(dev_pP);
init_timer(&priv->timer); init_timer(&priv_p->timer);
(priv->timer).expires = jiffies+UE_IP_TIMER_TICK; (priv_p->timer).expires = jiffies+UE_IP_TIMER_TICK;
(priv->timer).data = (unsigned long)priv; (priv_p->timer).data = (unsigned long)priv_p;
(priv->timer).function = ue_ip_timer; (priv_p->timer).function = ue_ip_timer;
//add_timer(&priv->timer); //add_timer(&priv_p->timer);
printk("[UE_IP_DRV][%s] name = %s\n", __FUNCTION__, dev->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){ int ue_ip_stop(struct net_device *dev_pP){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct ue_ip_priv *priv = netdev_priv(dev); ue_ip_priv_t *priv_p = netdev_priv(dev_pP);
printk("[UE_IP_DRV][%s] Begin\n", __FUNCTION__); printk("[UE_IP_DRV][%s] Begin\n", __FUNCTION__);
del_timer(&(priv->timer)); del_timer(&(priv_p->timer));
netif_stop_queue(dev); netif_stop_queue(dev_pP);
// MOD_DEC_USE_COUNT; // MOD_DEC_USE_COUNT;
printk("[UE_IP_DRV][%s] End\n", __FUNCTION__); printk("[UE_IP_DRV][%s] End\n", __FUNCTION__);
return 0; return 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void ue_ip_teardown(struct net_device *dev){ void ue_ip_teardown(struct net_device *dev_pP){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct ue_ip_priv *priv; ue_ip_priv_t *priv_p;
int inst; int inst;
printk("[UE_IP_DRV][%s] Begin\n", __FUNCTION__); printk("[UE_IP_DRV][%s] Begin\n", __FUNCTION__);
if (dev) { if (dev_pP) {
priv = netdev_priv(dev); priv_p = netdev_priv(dev_pP);
inst = ue_ip_find_inst(dev); inst = ue_ip_find_inst(dev_pP);
if ((inst<0) || (inst>=UE_IP_NB_INSTANCES_MAX)) { if ((inst<0) || (inst>=UE_IP_NB_INSTANCES_MAX)) {
printk("[UE_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__); printk("[UE_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__);
return; return;
...@@ -183,35 +183,35 @@ void ue_ip_teardown(struct net_device *dev){ ...@@ -183,35 +183,35 @@ void ue_ip_teardown(struct net_device *dev){
printk("[UE_IP_DRV][%s] End\n", __FUNCTION__); printk("[UE_IP_DRV][%s] End\n", __FUNCTION__);
} // check dev } // check dev_pP
else { else {
printk("[UE_IP_DRV][%s] Device is null\n", __FUNCTION__); printk("[UE_IP_DRV][%s] Device is null\n", __FUNCTION__);
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int ue_ip_set_config(struct net_device *dev, struct ifmap *map){ int ue_ip_set_config(struct net_device *dev_pP, struct ifmap *map_pP){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
printk("[UE_IP_DRV][%s] Begin\n", __FUNCTION__); printk("[UE_IP_DRV][%s] Begin\n", __FUNCTION__);
if (dev->flags & IFF_UP) if (dev_pP->flags & IFF_UP)
return -EBUSY; return -EBUSY;
if (map->base_addr != dev->base_addr) { if (map_pP->base_addr != dev_pP->base_addr) {
printk(KERN_WARNING "[UE_IP_DRV][%s] Can't change I/O address\n", __FUNCTION__); printk(KERN_WARNING "[UE_IP_DRV][%s] Can't change I/O address\n", __FUNCTION__);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (map->irq != dev->irq) if (map_pP->irq != dev_pP->irq)
dev->irq = map->irq; dev_pP->irq = map_pP->irq;
printk("[UE_IP_DRV][%s] End\n", __FUNCTION__); printk("[UE_IP_DRV][%s] End\n", __FUNCTION__);
return 0; return 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
int ue_ip_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int inst; int inst;
if (dev) { if (dev_pP) {
inst = ue_ip_find_inst(dev); inst = ue_ip_find_inst(dev_pP);
} else { } else {
printk("[UE_IP_DRV][%s] ERROR, device is null\n", __FUNCTION__); printk("[UE_IP_DRV][%s] ERROR, device is null\n", __FUNCTION__);
return -1; return -1;
...@@ -222,25 +222,25 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){ ...@@ -222,25 +222,25 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
printk("[UE_IP_DRV][%s] inst %d, begin\n", __FUNCTION__,inst); printk("[UE_IP_DRV][%s] inst %d, begin\n", __FUNCTION__,inst);
#endif #endif
if (!skb){ if (!skb_pP){
printk("[UE_IP_DRV][%s] input parameter skb is NULL\n", __FUNCTION__); printk("[UE_IP_DRV][%s] input parameter skb is NULL\n", __FUNCTION__);
return -1; return -1;
} }
// End debug information // End debug information
netif_stop_queue(dev); netif_stop_queue(dev_pP);
dev->trans_start = jiffies; dev_pP->trans_start = jiffies;
#ifdef OAI_DRV_DEBUG_DEVICE #ifdef OAI_DRV_DEBUG_DEVICE
printk("[UE_IP_DRV][%s] step 1\n", __FUNCTION__); printk("[UE_IP_DRV][%s] step 1\n", __FUNCTION__);
#endif #endif
ue_ip_common_ip2wireless(skb,inst); ue_ip_common_ip2wireless(skb_pP,inst);
#ifdef OAI_DRV_DEBUG_DEVICE #ifdef OAI_DRV_DEBUG_DEVICE
printk("[UE_IP_DRV][%s] step 2\n", __FUNCTION__); printk("[UE_IP_DRV][%s] step 2\n", __FUNCTION__);
#endif #endif
dev_kfree_skb(skb); dev_kfree_skb(skb_pP);
#ifdef OAI_DRV_DEBUG_DEVICE #ifdef OAI_DRV_DEBUG_DEVICE
printk("[UE_IP_DRV][%s] step 3\n", __FUNCTION__); printk("[UE_IP_DRV][%s] step 3\n", __FUNCTION__);
#endif #endif
netif_wake_queue(dev); netif_wake_queue(dev_pP);
#ifdef OAI_DRV_DEBUG_DEVICE #ifdef OAI_DRV_DEBUG_DEVICE
printk("[UE_IP_DRV][%s] end\n", __FUNCTION__); printk("[UE_IP_DRV][%s] end\n", __FUNCTION__);
#endif #endif
...@@ -252,50 +252,48 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){ ...@@ -252,50 +252,48 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct net_device_stats *ue_ip_get_stats(struct net_device *dev){ struct net_device_stats *ue_ip_get_stats(struct net_device *dev_pP){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// return &((struct ue_ip_priv *)dev->priv)->stats; ue_ip_priv_t *priv_p = netdev_priv(dev_pP);
struct ue_ip_priv *priv = netdev_priv(dev); return &priv_p->stats;
//printk("[UE_IP_DRV][%s]\n", __FUNCTION__);
return &priv->stats;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int ue_ip_set_mac_address(struct net_device *dev, void *mac) { int ue_ip_set_mac_address(struct net_device *dev_pP, void *mac_pP) {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
//struct sockaddr *addr = mac; //struct sockaddr *addr = mac_pP;
printk("[UE_IP_DRV][%s] CHANGE MAC ADDRESS UNSUPPORTED\n", __FUNCTION__); printk("[UE_IP_DRV][%s] CHANGE MAC ADDRESS UNSUPPORTED\n", __FUNCTION__);
//memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); //memcpy(dev_pP->dev_addr, addr->sa_data, dev_pP->addr_len);
return 0; return 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int ue_ip_change_mtu(struct net_device *dev, int mtu){ int ue_ip_change_mtu(struct net_device *dev_pP, int mtuP){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
printk("[UE_IP_DRV][%s] CHANGE MTU %d bytes\n", __FUNCTION__, mtu); printk("[UE_IP_DRV][%s] CHANGE MTU %d bytes\n", __FUNCTION__, mtuP);
if ((mtu<50) || (mtu>1500)) if ((mtuP<50) || (mtuP>1500))
return -EINVAL; return -EINVAL;
dev->mtu = mtu; dev_pP->mtu = mtuP;
return 0; return 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void ue_ip_change_rx_flags(struct net_device *dev, int flags){ void ue_ip_change_rx_flags(struct net_device *dev_pP, int flagsP){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct ue_ip_priv *priv = netdev_priv(dev); ue_ip_priv_t *priv_p = netdev_priv(dev_pP);
printk("[UE_IP_DRV][%s] CHANGE RX FLAGS %08X\n", __FUNCTION__, flags); printk("[UE_IP_DRV][%s] CHANGE RX FLAGS %08X\n", __FUNCTION__, flagsP);
priv->rx_flags ^= flags; priv_p->rx_flags ^= flagsP;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void ue_ip_tx_timeout(struct net_device *dev){ void ue_ip_tx_timeout(struct net_device *dev_pP){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Transmitter timeout, serious problems. // Transmitter timeout, serious problems.
struct ue_ip_priv *priv = netdev_priv(dev); ue_ip_priv_t *priv_p = netdev_priv(dev_pP);
printk("[UE_IP_DRV][%s] begin\n", __FUNCTION__); printk("[UE_IP_DRV][%s] begin\n", __FUNCTION__);
// (struct ue_ip_priv *)(dev->priv)->stats.tx_errors++; // (ue_ip_priv_t *)(dev_pP->priv_p)->stats.tx_errors++;
(priv->stats).tx_errors++; (priv_p->stats).tx_errors++;
dev->trans_start = jiffies; dev_pP->trans_start = jiffies;
netif_wake_queue(dev); netif_wake_queue(dev_pP);
printk("[UE_IP_DRV][%s] transmit timed out %s\n", __FUNCTION__,dev->name); printk("[UE_IP_DRV][%s] transmit timed out %s\n", __FUNCTION__,dev_pP->name);
} }
static const struct net_device_ops ue_ip_netdev_ops = { static const struct net_device_ops ue_ip_netdev_ops = {
...@@ -315,23 +313,23 @@ static const struct net_device_ops ue_ip_netdev_ops = { ...@@ -315,23 +313,23 @@ static const struct net_device_ops ue_ip_netdev_ops = {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Initialisation of the network device // Initialisation of the network device
void ue_ip_init(struct net_device *dev){ void ue_ip_init(struct net_device *dev_pP){
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct ue_ip_priv *priv; ue_ip_priv_t *priv_p = NULL;
if (dev) { if (dev_pP) {
priv = netdev_priv(dev); priv_p = netdev_priv(dev_pP);
memset(priv, 0, sizeof(struct ue_ip_priv)); memset(priv_p, 0, sizeof(ue_ip_priv_t));
spin_lock_init(&priv->lock); spin_lock_init(&priv_p->lock);
#ifdef KERNEL_VERSION_GREATER_THAN_2629 #ifdef KERNEL_VERSION_GREATER_THAN_2629
dev->netdev_ops = &ue_ip_netdev_ops; dev_pP->netdev_ops = &ue_ip_netdev_ops;
#else #else
#error "KERNEL VERSION MUST BE NEWER THAN 2.6.29" #error "KERNEL VERSION MUST BE NEWER THAN 2.6.29"
#endif #endif
dev->hard_header_len = 0; dev_pP->hard_header_len = 0;
dev->addr_len = UE_IP_ADDR_LEN; dev_pP->addr_len = UE_IP_ADDR_LEN;
dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP; dev_pP->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
dev->tx_queue_len = UE_IP_TX_QUEUE_LEN; dev_pP->tx_queue_len = UE_IP_TX_QUEUE_LEN;
dev->mtu = UE_IP_MTU; dev_pP->mtu = UE_IP_MTU;
} else { } else {
printk("[UE_IP_DRV][%s] ERROR, Device is NULL!!\n", __FUNCTION__); printk("[UE_IP_DRV][%s] ERROR, Device is NULL!!\n", __FUNCTION__);
return; return;
...@@ -350,7 +348,7 @@ int init_module (void) { ...@@ -350,7 +348,7 @@ int init_module (void) {
for (inst=0;inst<UE_IP_NB_INSTANCES_MAX;inst++) { for (inst=0;inst<UE_IP_NB_INSTANCES_MAX;inst++) {
printk("[UE_IP_DRV][%s] begin init instance %d\n", __FUNCTION__,inst); printk("[UE_IP_DRV][%s] begin init instance %d\n", __FUNCTION__,inst);
sprintf(devicename,"oip%d",inst); sprintf(devicename,"oip%d",inst);
ue_ip_dev[inst] = alloc_netdev(sizeof(struct ue_ip_priv),devicename, ue_ip_init); ue_ip_dev[inst] = alloc_netdev(sizeof(ue_ip_priv_t),devicename, ue_ip_init);
//netif_stop_queue(ue_ip_dev[inst]); //netif_stop_queue(ue_ip_dev[inst]);
if (ue_ip_dev[inst] == NULL) { if (ue_ip_dev[inst] == NULL) {
printk("[UE_IP_DRV][%s][INST %02d] alloc_netdev FAILED\n", __FUNCTION__,inst); printk("[UE_IP_DRV][%s][INST %02d] alloc_netdev FAILED\n", __FUNCTION__,inst);
......
...@@ -63,33 +63,34 @@ ...@@ -63,33 +63,34 @@
#include "constant.h" #include "constant.h"
#include "platform_types.h"
#include "sap.h" #include "sap.h"
struct ue_ip_priv { typedef struct ue_ip_priv_s {
int irq; int irq;
int rx_flags; int rx_flags;
struct timer_list timer; struct timer_list timer;
spinlock_t lock; spinlock_t lock;
struct net_device_stats stats; struct net_device_stats stats;
u8 retry_limit; uint8_t retry_limit;
u32 timer_establishment; uint32_t timer_establishment;
u32 timer_release; uint32_t timer_release;
struct sock *nl_sk; struct sock *nl_sk;
u8 nlmsg[UE_IP_PRIMITIVE_MAX_LENGTH+sizeof(struct nlmsghdr)]; uint8_t nlmsg[UE_IP_PRIMITIVE_MAX_LENGTH+sizeof(struct nlmsghdr)];
u8 xbuffer[UE_IP_PRIMITIVE_MAX_LENGTH]; // transmition buffer uint8_t xbuffer[UE_IP_PRIMITIVE_MAX_LENGTH]; // transmition buffer
u8 rbuffer[UE_IP_PRIMITIVE_MAX_LENGTH]; // reception buffer uint8_t rbuffer[UE_IP_PRIMITIVE_MAX_LENGTH]; // reception buffer
}; } ue_ip_priv_t;
struct ipversion { typedef struct ipversion_s {
#if defined(__LITTLE_ENDIAN_BITFIELD) #if defined(__LITTLE_ENDIAN_BITFIELD)
u8 reserved:4, uint8_t reserved:4,
version:4; version:4;
#else #else
u8 version:4, uint8_t version:4,
reserved:4; reserved:4;
#endif #endif
}; }ipversion_t;
typedef struct pdcp_data_req_header_s { typedef struct pdcp_data_req_header_s {
......
...@@ -82,10 +82,10 @@ int ue_ip_find_inst(struct net_device *dev); ...@@ -82,10 +82,10 @@ int ue_ip_find_inst(struct net_device *dev);
@param inst Instance number @param inst Instance number
@param rb_id Radio Bearer Id @param rb_id Radio Bearer Id
*/ */
void ue_ip_common_class_wireless2ip(unsigned short dlen, void ue_ip_common_class_wireless2ip(sdu_size_t dlen,
void *pdcp_sdu, void *pdcp_sdu,
int inst, int inst,
OaiNwDrvRadioBearerId_t rb_id); rb_id_t rb_id);
/** /**
\fn void ue_ip_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst) \fn void ue_ip_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst)
......
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