summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Hsu <ryanhsu@qca.qualcomm.com>2016-01-21 15:25:39 -0800
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2016-04-17 21:53:01 +0530
commit0d1d573047f8a29d64e30fa40b7555d246bb91d9 (patch)
tree9102d62aa50e472294a719a6e5170c16f0969cc2
parent0e2f47e789868f203000a8e1a548cd9828754a84 (diff)
qcacld-2.0: Update wlan_hdd_add_virtual_intf for Kernel upgrade
qcacld-3.0 to qcacld-2.0 propagation Commit: 6bab2e19 ("cfg80211: pass name_assign_type to rdev_add_virtual_intf) Above commit add new parameter - name_assign_type to indicate the ifname is set by userspace or generated by the kernel. Also add this new param to all underlying interfaces, so that we can get rid of the conditional flag interleave in APIs but only to the toppest and lowest one. Change-Id: I2233391f4e7313cf4134c975e14b6060ad852c5d CRs-fixed: 966067
-rw-r--r--CORE/HDD/inc/wlan_hdd_hostapd.h7
-rw-r--r--CORE/HDD/inc/wlan_hdd_main.h10
-rw-r--r--CORE/HDD/inc/wlan_hdd_p2p.h9
-rw-r--r--CORE/HDD/src/wlan_hdd_ftm.c6
-rw-r--r--CORE/HDD/src/wlan_hdd_hostapd.c7
-rw-r--r--CORE/HDD/src/wlan_hdd_main.c44
-rw-r--r--CORE/HDD/src/wlan_hdd_nan_datapath.c4
-rw-r--r--CORE/HDD/src/wlan_hdd_p2p.c57
8 files changed, 107 insertions, 37 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_hostapd.h b/CORE/HDD/inc/wlan_hdd_hostapd.h
index 31338bb602d3..8fe456aadf52 100644
--- a/CORE/HDD/inc/wlan_hdd_hostapd.h
+++ b/CORE/HDD/inc/wlan_hdd_hostapd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -55,7 +55,10 @@
/* max length of command string in hostapd ioctl */
#define HOSTAPD_IOCTL_COMMAND_STRLEN_MAX 8192
-hdd_adapter_t* hdd_wlan_create_ap_dev( hdd_context_t *pHddCtx, tSirMacAddr macAddr, tANI_U8 *name);
+hdd_adapter_t* hdd_wlan_create_ap_dev(hdd_context_t *pHddCtx,
+ tSirMacAddr macAddr,
+ unsigned char name_assign_type,
+ tANI_U8 *name);
VOS_STATUS hdd_register_hostapd(hdd_adapter_t *pAdapter, tANI_U8 rtnl_held);
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index 0ac95b876a6e..19b666531c86 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -248,6 +248,15 @@
#endif
#endif
+/*
+ * NET_NAME_UNKNOWN is only introduced after Kernel 3.17, to have a macro
+ * here if the Kernel version is less than 3.17 to avoid the interleave
+ * conditional compilation.
+ */
+#if !(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))
+#define NET_NAME_UNKNOWN 0
+#endif
+
typedef v_U8_t tWlanHddMacAddr[HDD_MAC_ADDR_LEN];
/*
@@ -1790,6 +1799,7 @@ VOS_STATUS hdd_add_adapter_front( hdd_context_t *pHddCtx,
hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type,
const char* name, tSirMacAddr macAddr,
+ unsigned char name_assign_type,
tANI_U8 rtnl_held );
VOS_STATUS hdd_close_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter, tANI_U8 rtnl_held );
VOS_STATUS hdd_close_all_adapters( hdd_context_t *pHddCtx );
diff --git a/CORE/HDD/inc/wlan_hdd_p2p.h b/CORE/HDD/inc/wlan_hdd_p2p.h
index 7fad19cf0ab2..cfafdca3695a 100644
--- a/CORE/HDD/inc/wlan_hdd_p2p.h
+++ b/CORE/HDD/inc/wlan_hdd_p2p.h
@@ -166,7 +166,14 @@ int wlan_hdd_mgmt_tx( struct wiphy *wiphy, struct net_device *dev,
#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) || defined(WITH_BACKPORTS)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
+struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
+ const char *name,
+ unsigned char name_assign_type,
+ enum nl80211_iftype type,
+ u32 *flags,
+ struct vif_params *params);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) || defined(WITH_BACKPORTS)
struct wireless_dev* wlan_hdd_add_virtual_intf(
struct wiphy *wiphy, const char *name,
enum nl80211_iftype type,
diff --git a/CORE/HDD/src/wlan_hdd_ftm.c b/CORE/HDD/src/wlan_hdd_ftm.c
index 87cdffd68cdf..9e13072e727d 100644
--- a/CORE/HDD/src/wlan_hdd_ftm.c
+++ b/CORE/HDD/src/wlan_hdd_ftm.c
@@ -741,8 +741,10 @@ err_vos_status_failure:
static int hdd_ftm_service_registration(hdd_context_t *pHddCtx)
{
hdd_adapter_t *pAdapter;
- pAdapter = hdd_open_adapter( pHddCtx, WLAN_HDD_FTM, "wlan%d",
- wlan_hdd_get_intf_addr(pHddCtx), FALSE);
+ pAdapter = hdd_open_adapter(pHddCtx, WLAN_HDD_FTM, "wlan%d",
+ wlan_hdd_get_intf_addr(pHddCtx),
+ NET_NAME_UNKNOWN,
+ FALSE);
if( NULL == pAdapter )
{
hddLog(VOS_TRACE_LEVEL_ERROR,"%s: hdd_open_adapter failed", __func__);
diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c
index 862bbdd9645c..6643cf7f4df9 100644
--- a/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -7066,7 +7066,10 @@ error_wmm_init:
return status;
}
-hdd_adapter_t* hdd_wlan_create_ap_dev( hdd_context_t *pHddCtx, tSirMacAddr macAddr, tANI_U8 *iface_name )
+hdd_adapter_t* hdd_wlan_create_ap_dev(hdd_context_t *pHddCtx,
+ tSirMacAddr macAddr,
+ unsigned char name_assign_type,
+ tANI_U8 *iface_name )
{
struct net_device *pWlanHostapdDev = NULL;
hdd_adapter_t *pHostapdAdapter = NULL;
@@ -7076,7 +7079,7 @@ hdd_adapter_t* hdd_wlan_create_ap_dev( hdd_context_t *pHddCtx, tSirMacAddr macAd
pWlanHostapdDev = alloc_netdev_mq(sizeof(hdd_adapter_t),
iface_name,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) || defined(WITH_BACKPORTS)
- NET_NAME_UNKNOWN,
+ name_assign_type,
#endif
ether_setup,
NUM_TX_QUEUES);
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 8b7a441534e5..a9bc8d2938fe 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -9962,7 +9962,10 @@ static inline void
hdd_adapter_runtime_suspend_denit(hdd_adapter_t *adapter) { }
#endif
-static hdd_adapter_t* hdd_alloc_station_adapter( hdd_context_t *pHddCtx, tSirMacAddr macAddr, const char* name )
+static hdd_adapter_t* hdd_alloc_station_adapter(hdd_context_t *pHddCtx,
+ tSirMacAddr macAddr,
+ unsigned char name_assign_type,
+ const char* name)
{
struct net_device *pWlanDev = NULL;
hdd_adapter_t *pAdapter = NULL;
@@ -9972,7 +9975,7 @@ static hdd_adapter_t* hdd_alloc_station_adapter( hdd_context_t *pHddCtx, tSirMac
pWlanDev = alloc_netdev_mq(sizeof( hdd_adapter_t ),
name,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) || defined(WITH_BACKPORTS)
- NET_NAME_UNKNOWN,
+ name_assign_type,
#endif
(VOS_MONITOR_MODE == vos_get_conparam()?
mon_mode_ether_setup : ether_setup),
@@ -10692,6 +10695,7 @@ VOS_STATUS hdd_check_for_existing_macaddr( hdd_context_t *pHddCtx,
hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type,
const char *iface_name, tSirMacAddr macAddr,
+ unsigned char name_assign_type,
tANI_U8 rtnl_held )
{
hdd_adapter_t *pAdapter = NULL;
@@ -10760,7 +10764,9 @@ hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type,
case WLAN_HDD_OCB:
case WLAN_HDD_NDI:
{
- pAdapter = hdd_alloc_station_adapter( pHddCtx, macAddr, iface_name );
+ pAdapter = hdd_alloc_station_adapter(pHddCtx, macAddr,
+ name_assign_type,
+ iface_name);
if( NULL == pAdapter )
{
@@ -10831,7 +10837,9 @@ hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type,
case WLAN_HDD_P2P_GO:
case WLAN_HDD_SOFTAP:
{
- pAdapter = hdd_wlan_create_ap_dev( pHddCtx, macAddr, (tANI_U8 *)iface_name );
+ pAdapter = hdd_wlan_create_ap_dev(pHddCtx, macAddr,
+ name_assign_type,
+ (tANI_U8 *)iface_name );
if( NULL == pAdapter )
{
hddLog(VOS_TRACE_LEVEL_FATAL,
@@ -10865,7 +10873,9 @@ hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type,
}
case WLAN_HDD_FTM:
{
- pAdapter = hdd_alloc_station_adapter( pHddCtx, macAddr, iface_name );
+ pAdapter = hdd_alloc_station_adapter(pHddCtx, macAddr,
+ name_assign_type,
+ iface_name );
if( NULL == pAdapter )
{
@@ -14646,11 +14656,15 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc)
if (pHddCtx->cfg_ini->dot11p_mode == WLAN_HDD_11P_STANDALONE) {
/* Create only 802.11p interface */
- pAdapter = hdd_open_adapter(pHddCtx, WLAN_HDD_OCB,
- "wlanocb%d", wlan_hdd_get_intf_addr(pHddCtx), rtnl_lock_enable);
+ pAdapter = hdd_open_adapter(pHddCtx, WLAN_HDD_OCB,"wlanocb%d",
+ wlan_hdd_get_intf_addr(pHddCtx),
+ NET_NAME_UNKNOWN,
+ rtnl_lock_enable);
} else {
- pAdapter = hdd_open_adapter( pHddCtx, WLAN_HDD_INFRA_STATION, "wlan%d",
- wlan_hdd_get_intf_addr(pHddCtx), rtnl_lock_enable );
+ pAdapter = hdd_open_adapter(pHddCtx, WLAN_HDD_INFRA_STATION, "wlan%d",
+ wlan_hdd_get_intf_addr(pHddCtx),
+ NET_NAME_UNKNOWN,
+ rtnl_lock_enable);
#ifdef WLAN_OPEN_P2P_INTERFACE
/* Open P2P device interface */
@@ -14678,8 +14692,9 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc)
}
pP2pAdapter = hdd_open_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE, "p2p%d",
- &pHddCtx->p2pDeviceAddress.bytes[0],
- rtnl_lock_enable);
+ &pHddCtx->p2pDeviceAddress.bytes[0],
+ NET_NAME_UNKNOWN,
+ rtnl_lock_enable);
if (NULL == pP2pAdapter) {
hddLog(VOS_TRACE_LEVEL_FATAL,
@@ -14692,9 +14707,10 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc)
/* Open 802.11p Interface */
if (pAdapter != NULL) {
if (pHddCtx->cfg_ini->dot11p_mode == WLAN_HDD_11P_CONCURRENT) {
- dot11_adapter = hdd_open_adapter(pHddCtx, WLAN_HDD_OCB,
- "wlanocb%d", wlan_hdd_get_intf_addr(pHddCtx),
- rtnl_lock_enable);
+ dot11_adapter = hdd_open_adapter(pHddCtx, WLAN_HDD_OCB, "wlanocb%d",
+ wlan_hdd_get_intf_addr(pHddCtx),
+ NET_NAME_UNKNOWN,
+ rtnl_lock_enable);
if (dot11_adapter == NULL) {
hddLog(VOS_TRACE_LEVEL_FATAL,
diff --git a/CORE/HDD/src/wlan_hdd_nan_datapath.c b/CORE/HDD/src/wlan_hdd_nan_datapath.c
index 297d03d97217..48d9070a0080 100644
--- a/CORE/HDD/src/wlan_hdd_nan_datapath.c
+++ b/CORE/HDD/src/wlan_hdd_nan_datapath.c
@@ -329,7 +329,9 @@ static int hdd_ndi_create_req_handler(hdd_context_t *hdd_ctx,
}
adapter = hdd_open_adapter(hdd_ctx, WLAN_HDD_NDI, iface_name,
- wlan_hdd_get_intf_addr(hdd_ctx), VOS_TRUE);
+ wlan_hdd_get_intf_addr(hdd_ctx),
+ NET_NAME_UNKNOWN,
+ VOS_TRUE);
if (!adapter) {
hddLog(LOGE, FL("hdd_open_adapter failed"));
return -ENOMEM;
diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c
index 53169e69de9a..9d03f00dea52 100644
--- a/CORE/HDD/src/wlan_hdd_p2p.c
+++ b/CORE/HDD/src/wlan_hdd_p2p.c
@@ -2153,20 +2153,11 @@ static tANI_U8 wlan_hdd_get_session_type( enum nl80211_iftype type )
return sessionType;
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) || defined(WITH_BACKPORTS)
struct wireless_dev* __wlan_hdd_add_virtual_intf(
struct wiphy *wiphy, const char *name,
+ unsigned char name_assign_type,
enum nl80211_iftype type,
u32 *flags, struct vif_params *params )
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
-struct wireless_dev* __wlan_hdd_add_virtual_intf(
- struct wiphy *wiphy, char *name, enum nl80211_iftype type,
- u32 *flags, struct vif_params *params )
-#else
-struct net_device* __wlan_hdd_add_virtual_intf(
- struct wiphy *wiphy, char *name, enum nl80211_iftype type,
- u32 *flags, struct vif_params *params )
-#endif
{
hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
hdd_adapter_t* pAdapter = NULL;
@@ -2228,12 +2219,15 @@ struct net_device* __wlan_hdd_add_virtual_intf(
pAdapter = hdd_open_adapter( pHddCtx,
wlan_hdd_get_session_type(type),
name, p2pDeviceAddress.bytes,
+ name_assign_type,
VOS_TRUE );
}
else
{
pAdapter = hdd_open_adapter( pHddCtx, wlan_hdd_get_session_type(type),
- name, wlan_hdd_get_intf_addr(pHddCtx), VOS_TRUE );
+ name, wlan_hdd_get_intf_addr(pHddCtx),
+ name_assign_type,
+ VOS_TRUE);
}
if( NULL == pAdapter)
@@ -2249,16 +2243,45 @@ struct net_device* __wlan_hdd_add_virtual_intf(
#endif
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) || defined(WITH_BACKPORTS)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
+/**
+ * wlan_hdd_add_virtual_intf() - Add virtual interface wrapper
+ * @wiphy: wiphy pointer
+ * @name: User-visible name of the interface
+ * @name_assign_type: the name of assign type of the netdev
+ * @nl80211_iftype: (virtual) interface types
+ * @flags: monitor mode configuration flags (not used)
+ * @vif_params: virtual interface parameters (not used)
+ *
+ * Return: the pointer of wireless dev, otherwise NULL.
+ */
+struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
+ const char *name,
+ unsigned char name_assign_type,
+ enum nl80211_iftype type,
+ u32 *flags,
+ struct vif_params *params)
+{
+ struct wireless_dev *wdev;
+
+ vos_ssr_protect(__func__);
+ wdev = __wlan_hdd_add_virtual_intf(wiphy, name, name_assign_type,
+ type, flags, params);
+ vos_ssr_unprotect(__func__);
+ return wdev;
+}
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) || defined(WITH_BACKPORTS)
struct wireless_dev* wlan_hdd_add_virtual_intf(
struct wiphy *wiphy, const char *name,
enum nl80211_iftype type,
u32 *flags, struct vif_params *params )
{
struct wireless_dev* wdev;
+ unsigned char name_assign_type = 0;
vos_ssr_protect(__func__);
- wdev = __wlan_hdd_add_virtual_intf(wiphy, name, type, flags, params);
+ wdev = __wlan_hdd_add_virtual_intf(wiphy, name, name_assign_type,
+ type, flags, params);
vos_ssr_unprotect(__func__);
return wdev;
}
@@ -2268,9 +2291,11 @@ struct wireless_dev* wlan_hdd_add_virtual_intf(
u32 *flags, struct vif_params *params )
{
struct wireless_dev* wdev;
+ unsigned char name_assign_type = 0;
vos_ssr_protect(__func__);
- wdev = __wlan_hdd_add_virtual_intf(wiphy, name, type, flags, params);
+ wdev = __wlan_hdd_add_virtual_intf(wiphy, name, name_assign_type,
+ type, flags, params);
vos_ssr_unprotect(__func__);
return wdev;
}
@@ -2280,9 +2305,11 @@ struct net_device* wlan_hdd_add_virtual_intf(
u32 *flags, struct vif_params *params )
{
struct net_device* ndev;
+ unsigned char name_assign_type = 0;
vos_ssr_protect(__func__);
- ndev = __wlan_hdd_add_virtual_intf(wiphy, name, type, flags, params);
+ ndev = __wlan_hdd_add_virtual_intf(wiphy, name, name_assign_type,
+ type, flags, params);
vos_ssr_unprotect(__func__);
return ndev;
}