From 20b420bb84ee47f5c26fa4e106c15a83c91d621c Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Thu, 16 Mar 2017 14:44:38 +0100 Subject: [PATCH] fix compilation for ubuntu 16 This work was done by Laurent Thomas. --- cmake_targets/CMakeLists.txt | 9 +++- .../NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c | 9 +++- .../NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c | 8 ++++ openair2/NETWORK_DRIVER/LITE/device.c | 8 ++++ openair2/NETWORK_DRIVER/MESH/classifier.c | 4 +- openair2/NETWORK_DRIVER/MESH/common.c | 5 +-- openair2/NETWORK_DRIVER/MESH/device.c | 19 +++++--- openair2/NETWORK_DRIVER/MESH/ioctl.c | 2 +- openair2/NETWORK_DRIVER/MESH/local.h | 44 +++++++++---------- openair2/NETWORK_DRIVER/MESH/mesh.c | 6 ++- openair2/NETWORK_DRIVER/MESH/proto_extern.h | 11 +++-- openair2/NETWORK_DRIVER/UE_IP/common.c | 4 +- openair2/NETWORK_DRIVER/UE_IP/device.c | 8 ++++ 13 files changed, 87 insertions(+), 50 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 3687b08a1a8..c2b9b82f52b 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2099,11 +2099,16 @@ endforeach() # force castxml and clang compilation with gnu89 standard # we can't use cXX standard as pthread_rwlock_t is gnu standard list(APPEND itti_compiler_options "-std=gnu89") - set (ITTI_H ${ITTI_DIR}/intertask_interface_types.h) +if(EXISTS /usr/bin/gccxml) + set(xml_command gccxml ${itti_compiler_options} -fxml=${OPENAIR_BIN_DIR}/messages.xml ${ITTI_H}) +else() + set(xml_command castxml --castxml-gccxml ${itti_compiler_options} ${ITTI_H} -o ${OPENAIR_BIN_DIR}/messages.xml) +endif() + add_custom_command ( OUTPUT ${OPENAIR_BIN_DIR}/messages.xml - COMMAND gccxml ${itti_compiler_options} -fxml=${OPENAIR_BIN_DIR}/messages.xml ${ITTI_H} + COMMAND ${xml_command} DEPENDS ${S1AP_OAI_generated} ${RRC_FULL_DIR}/asn1_constants.h ) diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c index 7a8bd0f8678..77b3c28165f 100644 --- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c +++ b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c @@ -233,9 +233,12 @@ int nasmt_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) } // End debug information - netif_stop_queue(dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + netif_trans_update(dev); +#else dev->trans_start = jiffies; +#endif #ifdef NAS_DEBUG_SEND_DETAIL printk("nasmt_hard_start_xmit: step 1\n"); #endif @@ -307,7 +310,11 @@ void nasmt_tx_timeout(struct net_device *dev) printk("nasmt_tx_timeout: begin\n"); //((struct nas_priv *)(dev->priv))->stats.tx_errors++; (gpriv->stats).tx_errors++; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + netif_trans_update(dev); +#else dev->trans_start = jiffies; +#endif netif_wake_queue(dev); printk("nasmt_tx_timeout: transmit timed out %s\n",dev->name); } diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c index aaaa95754dc..970600de214 100644 --- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c +++ b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c @@ -226,7 +226,11 @@ int nasrg_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) // End debug information netif_stop_queue(dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + netif_trans_update(dev); +#else dev->trans_start = jiffies; +#endif #ifdef NAS_DEBUG_SEND_DETAIL printk("nasrg_hard_start_xmit: step 1\n"); #endif @@ -296,7 +300,11 @@ void nasrg_tx_timeout(struct net_device *dev) printk("nasrg_tx_timeout: begin\n"); // ((struct nas_priv *)(dev->priv))->stats.tx_errors++; (gpriv->stats).tx_errors++; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + netif_trans_update(dev); +#else dev->trans_start = jiffies; +#endif netif_wake_queue(dev); printk("nasrg_tx_timeout: transmit timed out %s\n",dev->name); } diff --git a/openair2/NETWORK_DRIVER/LITE/device.c b/openair2/NETWORK_DRIVER/LITE/device.c index 9579ebf249c..616af5e1455 100644 --- a/openair2/NETWORK_DRIVER/LITE/device.c +++ b/openair2/NETWORK_DRIVER/LITE/device.c @@ -255,7 +255,11 @@ int oai_nw_drv_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) // End debug information netif_stop_queue(dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + netif_trans_update(dev); +#else dev->trans_start = jiffies; +#endif #ifdef OAI_DRV_DEBUG_DEVICE printk("[OAI_IP_DRV][%s] step 1\n", __FUNCTION__); #endif @@ -328,7 +332,11 @@ void oai_nw_drv_tx_timeout(struct net_device *dev) printk("[OAI_IP_DRV][%s] begin\n", __FUNCTION__); // (struct oai_nw_drv_priv *)(dev->priv)->stats.tx_errors++; (priv->stats).tx_errors++; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + netif_trans_update(dev); +#else dev->trans_start = jiffies; +#endif netif_wake_queue(dev); printk("[OAI_IP_DRV][%s] transmit timed out %s\n", __FUNCTION__,dev->name); } diff --git a/openair2/NETWORK_DRIVER/MESH/classifier.c b/openair2/NETWORK_DRIVER/MESH/classifier.c index a982faac46b..d477ba3ea90 100644 --- a/openair2/NETWORK_DRIVER/MESH/classifier.c +++ b/openair2/NETWORK_DRIVER/MESH/classifier.c @@ -790,7 +790,7 @@ void nas_CLASS_send(struct sk_buff *skb,int inst) dscp, sprotocol, sp->classref, sfct, sp->rab_id); #endif - sp->fct(skb, cx, sp,inst); + sp->fct(skb, cx, sp,inst, NULL); } // if classifier entry match found @@ -808,7 +808,7 @@ void nas_CLASS_send(struct sk_buff *skb,int inst) if (no_connection == 1) printk("NAS_CLASS_SEND: no corresponding connection, so the message is dropped\n"); -#endif NAS_DEBUG_CLASS +#endif /* NAS_DEBUG_CLASS */ // } // while loop over connections diff --git a/openair2/NETWORK_DRIVER/MESH/common.c b/openair2/NETWORK_DRIVER/MESH/common.c index 0a4e3ddfed9..6d10abd3801 100644 --- a/openair2/NETWORK_DRIVER/MESH/common.c +++ b/openair2/NETWORK_DRIVER/MESH/common.c @@ -321,10 +321,9 @@ void nas_COMMON_receive(uint16_t dlen, //--------------------------------------------------------------------------- // Delete the data -void nas_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp,int inst) +void nas_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp,int inst,struct nas_priv *gpriv) { struct nas_priv *priv=netdev_priv(nasdev[inst]); - //--------------------------------------------------------------------------- ++priv->stats.tx_dropped; } @@ -332,7 +331,7 @@ void nas_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct class //--------------------------------------------------------------------------- // Request the transfer of data (QoS SAP) -void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst) +void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst, struct nas_priv *gpriv) { //--------------------------------------------------------------------------- struct pdcp_data_req_header_s pdcph; diff --git a/openair2/NETWORK_DRIVER/MESH/device.c b/openair2/NETWORK_DRIVER/MESH/device.c index f28b41fc688..393fe9f9e01 100644 --- a/openair2/NETWORK_DRIVER/MESH/device.c +++ b/openair2/NETWORK_DRIVER/MESH/device.c @@ -124,11 +124,8 @@ void *nas_interrupt(void) int nas_open(struct net_device *dev) { //--------------------------------------------------------------------------- - struct nas_priv *priv=netdev_priv(dev); - printk("OPEN: begin\n"); // MOD_INC_USE_COUNT; - // Address has already been set at init #ifndef PDCP_USE_NETLINK @@ -250,7 +247,11 @@ int nas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) // End debug information netif_stop_queue(dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + netif_trans_update(dev); +#else dev->trans_start = jiffies; +#endif #ifdef DEBUG_DEVICE printk("HARD_START_XMIT: step 1\n"); #endif @@ -311,7 +312,11 @@ void nas_tx_timeout(struct net_device *dev) printk("TX_TIMEOUT: begin\n"); // (struct nas_priv *)(dev->priv)->stats.tx_errors++; (priv->stats).tx_errors++; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + netif_trans_update(dev); +#else dev->trans_start = jiffies; +#endif netif_wake_queue(dev); printk("TX_TIMEOUT: transmit timed out %s\n",dev->name); } @@ -406,8 +411,8 @@ void nas_init(struct net_device *dev) nas_TOOL_imei2iid(IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address) nas_TOOL_imei2iid(IMEI, (uint8_t *)priv->cx[0].iid6); #else - nas_TOOL_imei2iid(nas_IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address) - nas_TOOL_imei2iid(nas_IMEI, (uint8_t *)priv->cx[0].iid6); + nas_TOOL_imei2iid((uint8_t *)nas_IMEI, dev->dev_addr); // IMEI to device address (for stateless autoconfiguration address) + nas_TOOL_imei2iid((uint8_t *)nas_IMEI, (uint8_t *)priv->cx[0].iid6); #endif // this is more appropriate for user space soft realtime emulation #else @@ -478,8 +483,8 @@ int init_module (void) if (nasdev[inst]) { nas_mesh_init(inst); //memcpy(nasdev[inst]->dev_addr,&nas_IMEI[0],8); - nas_TOOL_imei2iid(nas_IMEI, nasdev[inst]->dev_addr);// IMEI to device address (for stateless autoconfiguration address) - nas_TOOL_imei2iid(nas_IMEI, (uint8_t *)priv->cx[0].iid6); + nas_TOOL_imei2iid((uint8_t *)nas_IMEI, nasdev[inst]->dev_addr);// IMEI to device address (for stateless autoconfiguration address) + nas_TOOL_imei2iid((uint8_t *)nas_IMEI, (uint8_t *)priv->cx[0].iid6); // TO HAVE DIFFERENT HW @ ((unsigned char*)nasdev[inst]->dev_addr)[7] = ((unsigned char*)nasdev[inst]->dev_addr)[7] + (unsigned char)inst + 1; printk("Setting HW addr for INST %d to : %X%X\n",inst,*((unsigned int *)&nasdev[inst]->dev_addr[0]),*((unsigned int *)&nasdev[inst]->dev_addr[4])); diff --git a/openair2/NETWORK_DRIVER/MESH/ioctl.c b/openair2/NETWORK_DRIVER/MESH/ioctl.c index 7d4bb10b1f8..4045908d93c 100644 --- a/openair2/NETWORK_DRIVER/MESH/ioctl.c +++ b/openair2/NETWORK_DRIVER/MESH/ioctl.c @@ -853,7 +853,7 @@ int nas_CTL_ioctl(struct net_device *dev, //--------------------------------------------------------------------------- void nas_CTL_send(struct sk_buff *skb, struct cx_entity *cx, - struct classifier_entity *gc) + struct classifier_entity *gc, int inst, struct nas_priv *gpriv) { //--------------------------------------------------------------------------- printk("NAS_CTL_SEND - void \n"); diff --git a/openair2/NETWORK_DRIVER/MESH/local.h b/openair2/NETWORK_DRIVER/MESH/local.h index 8db2b550b0d..0e0a581cbc9 100644 --- a/openair2/NETWORK_DRIVER/MESH/local.h +++ b/openair2/NETWORK_DRIVER/MESH/local.h @@ -98,6 +98,26 @@ struct cx_entity { int provider_id[MAX_MEASURE_NB]; }; +//#define NAS_RETRY_LIMIT_DEFAULT 5 + +struct nas_priv { + int irq; + struct timer_list timer; + spinlock_t lock; + struct net_device_stats stats; + uint8_t retry_limit; + uint32_t timer_establishment; + uint32_t timer_release; + struct cx_entity cx[NAS_CX_MAX]; + struct classifier_entity *rclassifier[NAS_DSCP_MAX]; // receive classifier + uint16_t nrclassifier; + int sap[NAS_SAPI_MAX]; + struct sock *nl_sk; + uint8_t nlmsg[NAS_MAX_LENGTH+sizeof(struct nlmsghdr)]; + uint8_t xbuffer[NAS_MAX_LENGTH]; // transmition buffer + uint8_t rbuffer[NAS_MAX_LENGTH]; // reception buffer +}; + struct classifier_entity { uint32_t classref; @@ -122,29 +142,7 @@ struct classifier_entity { struct rb_entity *rb_rx; //pointer to rb_entity for receiving (in case of forwarding rule) nasRadioBearerId_t rab_id; // RAB identification for sending nasRadioBearerId_t rab_id_rx; // RAB identification for receiving (in case of forwarding rule) - void (*fct)(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst); -}; - - - -//#define NAS_RETRY_LIMIT_DEFAULT 5 - -struct nas_priv { - int irq; - struct timer_list timer; - spinlock_t lock; - struct net_device_stats stats; - uint8_t retry_limit; - uint32_t timer_establishment; - uint32_t timer_release; - struct cx_entity cx[NAS_CX_MAX]; - struct classifier_entity *rclassifier[NAS_DSCP_MAX]; // receive classifier - uint16_t nrclassifier; - int sap[NAS_SAPI_MAX]; - struct sock *nl_sk; - uint8_t nlmsg[NAS_MAX_LENGTH+sizeof(struct nlmsghdr)]; - uint8_t xbuffer[NAS_MAX_LENGTH]; // transmition buffer - uint8_t rbuffer[NAS_MAX_LENGTH]; // reception buffer + void (*fct)(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst, struct nas_priv *gpriv); }; struct ipversion { diff --git a/openair2/NETWORK_DRIVER/MESH/mesh.c b/openair2/NETWORK_DRIVER/MESH/mesh.c index e934a6eb950..9817428c5e9 100644 --- a/openair2/NETWORK_DRIVER/MESH/mesh.c +++ b/openair2/NETWORK_DRIVER/MESH/mesh.c @@ -155,9 +155,10 @@ void nas_mesh_start_default_sclassifier(struct cx_entity *cx,struct rb_entity *r } //--------------------------------------------------------------------------- -void nas_mesh_timer(unsigned long data,struct nas_priv *gpriv) +void nas_mesh_timer(unsigned long data) { //--------------------------------------------------------------------------- + struct nas_priv *gpriv=(struct nas_priv *) data; uint8_t cxi; struct cx_entity *cx; struct rb_entity *rb; @@ -168,7 +169,7 @@ void nas_mesh_timer(unsigned long data,struct nas_priv *gpriv) (gpriv->timer).function=nas_mesh_timer; (gpriv->timer).expires=jiffies+NAS_TIMER_TICK; - (gpriv->timer).data=0L; + (gpriv->timer).data=data; return; @@ -381,6 +382,7 @@ int nas_mesh_DC_send_cx_release_request(struct cx_entity *cx, void nas_mesh_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc, + int inst, struct nas_priv *gpriv) { //--------------------------------------------------------------------------- diff --git a/openair2/NETWORK_DRIVER/MESH/proto_extern.h b/openair2/NETWORK_DRIVER/MESH/proto_extern.h index 4c0b89f60fd..a362876f834 100644 --- a/openair2/NETWORK_DRIVER/MESH/proto_extern.h +++ b/openair2/NETWORK_DRIVER/MESH/proto_extern.h @@ -96,7 +96,7 @@ void nas_COMMON_receive(unsigned short dlen, */ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, - struct classifier_entity *gc,int inst); + struct classifier_entity *gc,int inst, struct nas_priv *gpriv); /** \fn void nas_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst) @@ -108,7 +108,7 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, */ void nas_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, - struct classifier_entity *gc,int inst); + struct classifier_entity *gc,int inst, struct nas_priv *gpriv); #ifndef PDCP_USE_NETLINK /** @@ -195,19 +195,18 @@ void nas_mesh_init(int inst //!< Instance ID ); -void nas_mesh_timer(unsigned long data, - struct nas_priv *gpriv); +void nas_mesh_timer(unsigned long data); int nas_mesh_DC_receive(struct cx_entity *cx,struct nas_priv *gpriv); int nas_mesh_GC_receive(struct nas_priv *gpriv); int nas_mesh_DC_send_cx_establish_request(struct cx_entity *cx,struct nas_priv *gpriv); int nas_mesh_DC_send_cx_release_request(struct cx_entity *cx,struct nas_priv *gpriv); -void nas_mesh_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,struct nas_priv *gpriv); +void nas_mesh_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst, struct nas_priv *gpriv); // iocontrol.c void nas_CTL_send(struct sk_buff *skb, struct cx_entity *cx, - struct classifier_entity *gc); + struct classifier_entity *gc,int inst, struct nas_priv *gpriv); //int nas_CTL_receive_authentication(struct ipv6hdr *iph, struct cx-entity *cx, unsigned char sapi); int nas_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); diff --git a/openair2/NETWORK_DRIVER/UE_IP/common.c b/openair2/NETWORK_DRIVER/UE_IP/common.c index 1ea5df0d30c..8c3e4557d36 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/common.c +++ b/openair2/NETWORK_DRIVER/UE_IP/common.c @@ -123,9 +123,7 @@ skb_p->mark = rb_idP; // LG TEST skb_p->ip_summed = CHECKSUM_NONE; skb_p->ip_summed = CHECKSUM_UNNECESSARY; - - - ipv_p = (struct ipversion*)((void*)&(skb_p->data[hard_header_len])); + ipv_p = (ipversion_t *)((void *)&(skb_p->data[hard_header_len])); switch (ipv_p->version) { diff --git a/openair2/NETWORK_DRIVER/UE_IP/device.c b/openair2/NETWORK_DRIVER/UE_IP/device.c index cfd73428622..a4f714d4c55 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/device.c +++ b/openair2/NETWORK_DRIVER/UE_IP/device.c @@ -243,7 +243,11 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP) // End debug information netif_stop_queue(dev_pP); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + netif_trans_update(dev_pP); +#else dev_pP->trans_start = jiffies; +#endif #ifdef OAI_DRV_DEBUG_DEVICE printk("[UE_IP_DRV][%s] step 1\n", __FUNCTION__); #endif @@ -315,7 +319,11 @@ void ue_ip_tx_timeout(struct net_device *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++; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + netif_trans_update(dev_pP); +#else dev_pP->trans_start = jiffies; +#endif netif_wake_queue(dev_pP); printk("[UE_IP_DRV][%s] transmit timed out %s\n", __FUNCTION__,dev_pP->name); } -- GitLab