[WCNCR00152226] misc: Add build support for Linux backports-3.14-1

[Description]
Fix compile errors for Linux 2.6.32 + backports-3.14-1 due to:
- non-static inline functions
- function skb_reset_mac_len is not available before linux-3.0

Add a KAL function kal_skb_reset_mac_len to wrap implementations. Modify
Makefile.x86 and export $CFG_CFG80211_VERSION only when
$BACKPORTED_KERNEL_VERSION is non-empty.

Tested ok by
1. linux-2.6.32 (i386) + backports-3.14-1
2. build 12 variants ok:
    make -f Makefile.x86 \
       LINUX_SRC={3.10.23/arm, 3.18.42/i386, 4.4.23/amd64, 3.13.11/amd64} \
       hif={sdio, pcie, usb}

Change-Id: Ic1455a484164f93b57f05693921c03a98c23d758
Feature: misc
Signed-off-by: George Kuo <george.kuo@mediatek.com>
CR-Id: WCNCR00152226
diff --git a/Makefile.x86 b/Makefile.x86
index 3b9f7c8..2bb3106 100644
--- a/Makefile.x86
+++ b/Makefile.x86
@@ -20,7 +20,10 @@
 export CONFIG_MTK_COMBO_COMM_UART=m
 export CONFIG_MTK_COMBO_COMM_SDIO=m
 export CONFIG_MT_WIFI_CHRDEV=m
-#export CFG_CFG80211_VERSION ?= $(BACKPORTED_KERNEL_VERSION)
+
+ifneq ($(BACKPORTED_KERNEL_VERSION),)
+export CFG_CFG80211_VERSION ?= $(BACKPORTED_KERNEL_VERSION)
+endif
 
 # pcie | sdio | usb
 ifeq ($(hif),)
diff --git a/mgmt/assoc.c b/mgmt/assoc.c
index 62783e4..b73009e 100644
--- a/mgmt/assoc.c
+++ b/mgmt/assoc.c
@@ -253,7 +253,7 @@
 * @return (none)
 */
 /*----------------------------------------------------------------------------*/
-__KAL_INLINE__ VOID assocBuildReAssocReqFrameCommonIEs(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo)
+static __KAL_INLINE__ VOID assocBuildReAssocReqFrameCommonIEs(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo)
 {
 	P_CONNECTION_SETTINGS_T prConnSettings;
 	P_STA_RECORD_T prStaRec;
@@ -904,7 +904,7 @@
 * \return (none)
 */
 /*----------------------------------------------------------------------------*/
-__KAL_INLINE__ VOID
+static __KAL_INLINE__ VOID
 assocComposeDisassocFrame(IN P_STA_RECORD_T prStaRec,
 			  IN PUINT_8 pucBuffer, IN UINT_8 aucMACAddress[], IN UINT_16 u2ReasonCode)
 {
@@ -1353,7 +1353,7 @@
 * @return (none)
 */
 /*----------------------------------------------------------------------------*/
-__KAL_INLINE__ VOID
+static __KAL_INLINE__ VOID
 assocBuildReAssocRespFrameCommonIEs(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo, IN P_BSS_INFO_T prBssInfo)
 {
 	PUINT_8 pucBuffer;
@@ -1415,7 +1415,7 @@
 * @return (none)
 */
 /*----------------------------------------------------------------------------*/
-__KAL_INLINE__ VOID
+static __KAL_INLINE__ VOID
 assocComposeReAssocRespFrameHeaderAndFF(IN P_STA_RECORD_T prStaRec,
 					IN PUINT_8 pucBuffer,
 					IN UINT_8 aucBSSID[], IN UINT_16 u2CapInfo, IN OUT PUINT_16 pu2PayloadLen)
diff --git a/mgmt/auth.c b/mgmt/auth.c
index 152125d..f6db0de 100644
--- a/mgmt/auth.c
+++ b/mgmt/auth.c
@@ -125,7 +125,7 @@
 * \return (none)
 */
 /*----------------------------------------------------------------------------*/
-__KAL_INLINE__ VOID
+static __KAL_INLINE__ VOID
 authComposeAuthFrameHeaderAndFF(IN PUINT_8 pucBuffer,
 				IN UINT_8 aucPeerMACAddress[],
 				IN UINT_8 aucMACAddress[],
@@ -725,7 +725,7 @@
 * @return (none)
 */
 /*----------------------------------------------------------------------------*/
-__KAL_INLINE__ VOID
+static __KAL_INLINE__ VOID
 authComposeDeauthFrameHeaderAndFF(IN PUINT_8 pucBuffer,
 				  IN UINT_8 aucPeerMACAddress[],
 				  IN UINT_8 aucMACAddress[], IN UINT_8 aucBssid[], IN UINT_16 u2ReasonCode)
diff --git a/os/linux/gl_kal.c b/os/linux/gl_kal.c
index 0af3b11..ab4c051 100644
--- a/os/linux/gl_kal.c
+++ b/os/linux/gl_kal.c
@@ -956,7 +956,7 @@
 
 		skb_reset_network_header(prSkb);
 		skb_reset_transport_header(prSkb);
-		skb_reset_mac_len(prSkb);
+		kal_skb_reset_mac_len(prSkb);
 	}
 
 	if (!in_interrupt())
diff --git a/os/linux/include/gl_kal.h b/os/linux/include/gl_kal.h
index d12e155..d316665 100644
--- a/os/linux/include/gl_kal.h
+++ b/os/linux/include/gl_kal.h
@@ -1128,8 +1128,21 @@
 
 int kalMetInitProcfs(IN P_GLUE_INFO_T prGlueInfo);
 int kalMetRemoveProcfs(void);
-#endif /* _GL_KAL_H */
 
 VOID kalFreeTxMsduWorker(struct work_struct *work);
 VOID kalFreeTxMsdu(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
 
+#if KERNEL_VERSION(3, 0, 0) <= LINUX_VERSION_CODE
+/* since: 0b5c9db1b11d3175bb42b80663a9f072f801edf5 */
+static inline void kal_skb_reset_mac_len(struct sk_buff *skb)
+{
+	skb_reset_mac_len(skb);
+}
+#else
+static inline void kal_skb_reset_mac_len(struct sk_buff *skb)
+{
+	skb->mac_len = skb->network_header - skb->mac_header;
+}
+#endif
+
+#endif /* _GL_KAL_H */