Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] compat-wireless: adapt moving brcm80211 to main area
From: Hauke Mehrtens @ 2011-10-13 14:16 UTC (permalink / raw)
  To: mcgrof, mcgrof; +Cc: linux-wireless, Hauke Mehrtens

brcm80211 is no staging driver any more and can be found in the main
area where all the other wireless drivers are now. There where some
changes needed for the move.
And BRCMFMAC does not depend on WEXT any more so remove that from
config.
BRCMFMAC does not build with kernel < 2.6.29, because
ndev->netdev_ops = NULL and ndev->netdev_ops == &brcmf_netdev_ops_pri
are not supported by the backport code for netdev_ops.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 Makefile                               |    1 -
 config.mk                              |   12 +--------
 patches/25-multicast-list_head.patch   |   32 +++++++++++++-------------
 patches/29-sdio_no_suspend.patch       |   18 +++++++-------
 patches/35-fix-makefile-includes.patch |   26 ++++++++++----------
 scripts/admin-update.sh                |    8 +++++-
 scripts/driver-select                  |   39 +++++++++++++++++++++----------
 7 files changed, 73 insertions(+), 63 deletions(-)

diff --git a/Makefile b/Makefile
index 6fe77b8..d3a9d93 100644
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,6 @@ obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/bcma/
 obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/misc/eeprom/
 
 ifeq ($(CONFIG_STAGING_EXCLUDE_BUILD),)
-obj-$(CONFIG_COMPAT_STAGING) += drivers/staging/brcm80211/
 endif
 
 endif
diff --git a/config.mk b/config.mk
index 3463f83..a71de4e 100644
--- a/config.mk
+++ b/config.mk
@@ -396,9 +396,7 @@ CONFIG_RTL8192CE=m
 CONFIG_RTL8192SE=m
 CONFIG_RTL8192DE=m
 
-ifdef CONFIG_COMPAT_STAGING
 CONFIG_BRCMSMAC=m
-endif #CONFIG_COMPAT_STAGING
 
 endif #CONFIG_PCI
 ## end of PCI
@@ -572,13 +570,9 @@ CONFIG_ATH6KL=m
 # CONFIG_ATH6KL_DEBUG=y
 endif #CONFIG_COMPAT_KERNEL_2_6_27
 
-ifdef CONFIG_COMPAT_STAGING
-ifdef CONFIG_WIRELESS_EXT
-
+ifndef CONFIG_COMPAT_KERNEL_2_6_29
 CONFIG_BRCMFMAC=m
-
-endif #CONFIG_WIRELESS_EXT
-endif #CONFIG_COMPAT_STAGING
+endif #CONFIG_COMPAT_KERNEL_2_6_29
 
 endif #CONFIG_MMC
 
@@ -614,10 +608,8 @@ endif #CONFIG_MAC80211_LEDS
 CONFIG_ATH_COMMON=m
 # CONFIG_ATH_DEBUG=y
 
-ifdef CONFIG_COMPAT_STAGING
 CONFIG_BRCMUTIL=m
 # CONFIG_BRCMDBG=y
-endif #CONFIG_COMPAT_STAGING
 
 ifdef CONFIG_CRC7
 CONFIG_WL1251=m
diff --git a/patches/25-multicast-list_head.patch b/patches/25-multicast-list_head.patch
index e3e99e6..25fa450 100644
--- a/patches/25-multicast-list_head.patch
+++ b/patches/25-multicast-list_head.patch
@@ -83,7 +83,7 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  }
 --- a/drivers/net/wireless/adm8211.c
 +++ b/drivers/net/wireless/adm8211.c
-@@ -1319,19 +1319,37 @@ static void adm8211_bss_info_changed(str
+@@ -1320,19 +1320,37 @@ static void adm8211_bss_info_changed(str
  }
  
  static u64 adm8211_prepare_multicast(struct ieee80211_hw *hw,
@@ -217,7 +217,7 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  }
 --- a/drivers/net/wireless/libertas/main.c
 +++ b/drivers/net/wireless/libertas/main.c
-@@ -311,18 +311,34 @@ static int lbs_add_mcast_addrs(struct cm
+@@ -313,18 +313,34 @@ static int lbs_add_mcast_addrs(struct cm
  	netif_addr_lock_bh(dev);
  	cnt = netdev_mc_count(dev);
  	netdev_for_each_mc_addr(ha, dev) {
@@ -254,7 +254,7 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  	}
 --- a/drivers/net/wireless/libertas_tf/main.c
 +++ b/drivers/net/wireless/libertas_tf/main.c
-@@ -418,20 +418,36 @@ static int lbtf_op_config(struct ieee802
+@@ -419,20 +419,36 @@ static int lbtf_op_config(struct ieee802
  }
  
  static u64 lbtf_op_prepare_multicast(struct ieee80211_hw *hw,
@@ -435,7 +435,7 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  			      size_t fw_name_len, u32 *hw_ver);
 --- a/drivers/net/wireless/p54/main.c
 +++ b/drivers/net/wireless/p54/main.c
-@@ -359,11 +359,18 @@ out:
+@@ -360,11 +360,18 @@ out:
  	return ret;
  }
  
@@ -454,7 +454,7 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  	int i;
  
  	BUILD_BUG_ON(ARRAY_SIZE(priv->mc_maclist) !=
-@@ -373,12 +380,23 @@ static u64 p54_prepare_multicast(struct
+@@ -374,12 +381,23 @@ static u64 p54_prepare_multicast(struct
  	 * Otherwise the firmware will drop it and ARP will no longer work.
  	 */
  	i = 1;
@@ -494,7 +494,7 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  
 --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c
 +++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
-@@ -813,10 +813,19 @@ static void rtl8180_bss_info_changed(str
+@@ -814,10 +814,19 @@ static void rtl8180_bss_info_changed(str
  	}
  }
  
@@ -516,7 +516,7 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  static void rtl8180_configure_filter(struct ieee80211_hw *dev,
 --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
 +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
-@@ -1204,9 +1204,17 @@ static void rtl8187_bss_info_changed(str
+@@ -1205,9 +1205,17 @@ static void rtl8187_bss_info_changed(str
  }
  
  static u64 rtl8187_prepare_multicast(struct ieee80211_hw *dev,
@@ -536,7 +536,7 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  static void rtl8187_configure_filter(struct ieee80211_hw *dev,
 --- a/drivers/net/wireless/wl12xx/main.c
 +++ b/drivers/net/wireless/wl12xx/main.c
-@@ -2467,11 +2467,20 @@ struct wl1271_filter_params {
+@@ -2464,11 +2464,20 @@ struct wl1271_filter_params {
  	u8 mc_list[ACX_MC_ADDRESS_GROUP_MAX][ETH_ALEN];
  };
  
@@ -557,7 +557,7 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  	struct wl1271 *wl = hw->priv;
  
  	if (unlikely(wl->state == WL1271_STATE_OFF))
-@@ -2484,16 +2493,40 @@ static u64 wl1271_op_prepare_multicast(s
+@@ -2481,16 +2490,40 @@ static u64 wl1271_op_prepare_multicast(s
  	}
  
  	/* update multicast filtering parameters */
@@ -635,10 +635,10 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  	}
  
  	return hash.low | ((u64)hash.high << 32);
---- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
-+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
-@@ -213,7 +213,11 @@ static void _brcmf_set_multicast_list(st
- 	netdev_for_each_mc_addr(ha, dev) {
+--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+@@ -172,7 +172,11 @@ static void _brcmf_set_multicast_list(st
+ 	netdev_for_each_mc_addr(ha, ndev) {
  		if (!cnt)
  			break;
 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
@@ -651,7 +651,7 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  	}
 --- a/include/net/mac80211.h
 +++ b/include/net/mac80211.h
-@@ -1960,7 +1960,11 @@ struct ieee80211_ops {
+@@ -2112,7 +2112,11 @@ struct ieee80211_ops {
  			       enum ieee80211_tx_sync_type type);
  
  	u64 (*prepare_multicast)(struct ieee80211_hw *hw,
@@ -712,7 +712,7 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  
 --- a/net/mac80211/ieee80211_i.h
 +++ b/net/mac80211/ieee80211_i.h
-@@ -776,7 +776,12 @@ struct ieee80211_local {
+@@ -780,7 +780,12 @@ struct ieee80211_local {
  	struct work_struct recalc_smps;
  
  	/* aggregated multicast list */
@@ -768,7 +768,7 @@ This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
  	spin_unlock_bh(&local->filter_lock);
  
  	/* be a bit nasty */
-@@ -616,9 +620,11 @@ struct ieee80211_hw *ieee80211_alloc_hw(
+@@ -630,9 +634,11 @@ struct ieee80211_hw *ieee80211_alloc_hw(
  	local->uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
  
  	INIT_LIST_HEAD(&local->interfaces);
diff --git a/patches/29-sdio_no_suspend.patch b/patches/29-sdio_no_suspend.patch
index 1d09d34..934eb94 100644
--- a/patches/29-sdio_no_suspend.patch
+++ b/patches/29-sdio_no_suspend.patch
@@ -96,7 +96,7 @@ suspend and resume that are not backported.
  /*******************************************************************/
 --- a/drivers/net/wireless/mwifiex/sdio.c
 +++ b/drivers/net/wireless/mwifiex/sdio.c
-@@ -126,8 +126,10 @@ mwifiex_sdio_remove(struct sdio_func *fu
+@@ -127,8 +127,10 @@ mwifiex_sdio_remove(struct sdio_func *fu
  		return;
  
  	if (user_rmmod) {
@@ -107,7 +107,7 @@ suspend and resume that are not backported.
  
  		for (i = 0; i < adapter->priv_num; i++)
  			if ((GET_BSS_ROLE(adapter->priv[i]) ==
-@@ -147,6 +149,7 @@ mwifiex_sdio_remove(struct sdio_func *fu
+@@ -148,6 +150,7 @@ mwifiex_sdio_remove(struct sdio_func *fu
  	kfree(card);
  }
  
@@ -115,7 +115,7 @@ suspend and resume that are not backported.
  /*
   * SDIO suspend.
   *
-@@ -254,6 +257,7 @@ static int mwifiex_sdio_resume(struct de
+@@ -255,6 +258,7 @@ static int mwifiex_sdio_resume(struct de
  
  	return 0;
  }
@@ -123,7 +123,7 @@ suspend and resume that are not backported.
  
  /* Device ID for SD8787 */
  #define SDIO_DEVICE_ID_MARVELL_8787   (0x9119)
-@@ -266,10 +270,12 @@ static const struct sdio_device_id mwifi
+@@ -267,10 +271,12 @@ static const struct sdio_device_id mwifi
  
  MODULE_DEVICE_TABLE(sdio, mwifiex_ids);
  
@@ -136,7 +136,7 @@ suspend and resume that are not backported.
  
  static struct sdio_driver mwifiex_sdio = {
  	.name = "mwifiex_sdio",
-@@ -278,7 +284,9 @@ static struct sdio_driver mwifiex_sdio =
+@@ -279,7 +285,9 @@ static struct sdio_driver mwifiex_sdio =
  	.remove = mwifiex_sdio_remove,
  	.drv = {
  		.owner = THIS_MODULE,
@@ -146,8 +146,8 @@ suspend and resume that are not backported.
  	}
  };
  
---- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
-+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
 @@ -55,7 +55,7 @@ static bool
  brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev)
  {
@@ -166,7 +166,7 @@ suspend and resume that are not backported.
  	int retry = 0;
  	while (atomic_read(&sdiodev->suspend) && retry++ != 30)
  		wait_event_timeout(*wq, false, HZ/100);
-@@ -564,7 +564,7 @@ static void brcmf_ops_sdio_remove(struct
+@@ -550,7 +550,7 @@ static void brcmf_ops_sdio_remove(struct
  	}
  }
  
@@ -175,7 +175,7 @@ suspend and resume that are not backported.
  static int brcmf_sdio_suspend(struct device *dev)
  {
  	mmc_pm_flag_t sdio_flags;
-@@ -617,7 +617,7 @@ static struct sdio_driver brcmf_sdmmc_dr
+@@ -603,7 +603,7 @@ static struct sdio_driver brcmf_sdmmc_dr
  	.remove = brcmf_ops_sdio_remove,
  	.name = "brcmfmac",
  	.id_table = brcmf_sdmmc_ids,
diff --git a/patches/35-fix-makefile-includes.patch b/patches/35-fix-makefile-includes.patch
index c9f8eb1..3207ab0 100644
--- a/patches/35-fix-makefile-includes.patch
+++ b/patches/35-fix-makefile-includes.patch
@@ -18,42 +18,42 @@ path the make process will search in the kernel tree for the headers.
  
 -ccflags-y += -Idrivers/net/wireless/rtl818x
 +ccflags-y += -I$(obj)/..
---- a/drivers/staging/brcm80211/brcmfmac/Makefile
-+++ b/drivers/staging/brcm80211/brcmfmac/Makefile
+--- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile
++++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
 @@ -16,8 +16,8 @@
  # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  
  ccflags-y += \
--	-Idrivers/staging/brcm80211/brcmfmac	\
--	-Idrivers/staging/brcm80211/include
+-	-Idrivers/net/wireless/brcm80211/brcmfmac	\
+-	-Idrivers/net/wireless/brcm80211/include
 +	-I$(obj)		\
 +	-I$(obj)/../include
  
  DHDOFILES = \
  	wl_cfg80211.o \
---- a/drivers/staging/brcm80211/brcmsmac/Makefile
-+++ b/drivers/staging/brcm80211/brcmsmac/Makefile
+--- a/drivers/net/wireless/brcm80211/brcmsmac/Makefile
++++ b/drivers/net/wireless/brcm80211/brcmsmac/Makefile
 @@ -17,9 +17,9 @@
  
  ccflags-y := \
  	-D__CHECK_ENDIAN__ \
--	-Idrivers/staging/brcm80211/brcmsmac \
--	-Idrivers/staging/brcm80211/brcmsmac/phy \
--	-Idrivers/staging/brcm80211/include
+-	-Idrivers/net/wireless/brcm80211/brcmsmac \
+-	-Idrivers/net/wireless/brcm80211/brcmsmac/phy \
+-	-Idrivers/net/wireless/brcm80211/include
 +	-I$(obj)				\
 +	-I$(obj)/phy				\
 +	-I$(obj)/../include
  
  BRCMSMAC_OFILES := \
  	mac80211_if.o \
---- a/drivers/staging/brcm80211/brcmutil/Makefile
-+++ b/drivers/staging/brcm80211/brcmutil/Makefile
+--- a/drivers/net/wireless/brcm80211/brcmutil/Makefile
++++ b/drivers/net/wireless/brcm80211/brcmutil/Makefile
 @@ -16,8 +16,8 @@
  # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  
  ccflags-y :=				\
--	-Idrivers/staging/brcm80211/brcmutil \
--	-Idrivers/staging/brcm80211/include
+-	-Idrivers/net/wireless/brcm80211/brcmutil \
+-	-Idrivers/net/wireless/brcm80211/include
 +	-I$(obj)			\
 +	-I$(obj)/../include
  
diff --git a/scripts/admin-update.sh b/scripts/admin-update.sh
index 061748c..3e63e51 100755
--- a/scripts/admin-update.sh
+++ b/scripts/admin-update.sh
@@ -224,6 +224,12 @@ DRIVERS="$DRIVERS drivers/ssb"
 DRIVERS="$DRIVERS drivers/bcma"
 DRIVERS="$DRIVERS drivers/net/wireless/b43"
 DRIVERS="$DRIVERS drivers/net/wireless/b43legacy"
+DRIVERS="$DRIVERS drivers/net/wireless/brcm80211"
+DRIVERS="$DRIVERS drivers/net/wireless/brcm80211/brcmfmac"
+DRIVERS="$DRIVERS drivers/net/wireless/brcm80211/brcmsmac"
+DRIVERS="$DRIVERS drivers/net/wireless/brcm80211/brcmsmac/phy"
+DRIVERS="$DRIVERS drivers/net/wireless/brcm80211/brcmutil"
+DRIVERS="$DRIVERS drivers/net/wireless/brcm80211/include"
 DRIVERS="$DRIVERS drivers/net/wireless/iwlegacy"
 DRIVERS="$DRIVERS drivers/net/wireless/iwlwifi"
 DRIVERS="$DRIVERS drivers/net/wireless/rt2x00"
@@ -248,7 +254,7 @@ DRIVERS="$DRIVERS drivers/net/wireless/orinoco"
 DRIVERS="$DRIVERS drivers/net/wireless/mwifiex"
 
 # Staging drivers
-STAGING_DRIVERS="drivers/staging/brcm80211"
+STAGING_DRIVERS=""
 
 # Ethernet drivers
 DRIVERS="$DRIVERS drivers/net/ethernet/atheros"
diff --git a/scripts/driver-select b/scripts/driver-select
index f571519..3619541 100755
--- a/scripts/driver-select
+++ b/scripts/driver-select
@@ -7,6 +7,7 @@
 DRIVERS_MAKEFILE="drivers/net/wireless/Makefile"
 ATH_MAKEFILE="drivers/net/wireless/ath/Makefile"
 ATH9K_MAKEFILE="drivers/net/wireless/ath/ath9k/Makefile"
+BRCM80211_MAKEFILE="drivers/net/wireless/brcm80211/Makefile"
 RT2X00_MAKEFILE="drivers/net/wireless/rt2x00/Makefile"
 NET_WIRELESS_MAKEFILE="net/wireless/Makefile"
 EEPROM_MAKEFILE="drivers/misc/eeprom/Makefile"
@@ -32,11 +33,7 @@ PURPLE="\033[35m"
 CYAN="\033[36m"
 UNDERLINE="\033[02m"
 
-SUPPORTED_80211_DRIVERS="ath5k ath9k ath9k_htc carl9170 ath6kl b43 zd1211rw rt2x00 wl1251 wl12xx"
-
-if [ -d drivers/staging/brcm80211 ]; then
-	SUPPORTED_80211_DRIVERS="$SUPPORTED_80211_DRIVERS brcm80211"
-fi
+SUPPORTED_80211_DRIVERS="ath5k ath9k ath9k_htc carl9170 ath6kl b43 zd1211rw rt2x00 wl1251 wl12xx brcmsmac brcmfmac"
 
 # b43 needs some more work for driver-select, the SSB stuff, plus
 # what if you update b44 but not b43? It will bust.
@@ -55,6 +52,7 @@ function usage {
 	echo -e "\nSupported group drivers:"
 	echo -e "\t${CYAN}atheros${NORMAL} < ${PURPLE} ath5k ath9k carl9170 zd1211rw ath6kl ${NORMAL}>"
 	echo -e "\t${CYAN}ath${NORMAL} < ${PURPLE} ath5k ath9k carl9170 ath6kl ${NORMAL}>"
+	echo -e "\t${CYAN}brcm80211${NORMAL} < ${PURPLE} brcmsmac brcmfmac ${NORMAL}>"
 	echo -e "\t${CYAN}iwlagn${NORMAL} < ${PURPLE} iwlagn ${NORMAL}>"
 	echo -e "\t${CYAN}rtl818x${NORMAL} < ${PURPLE} rtl8180 rtl8187 ${NORMAL}>"
 	echo -e "\t${CYAN}rtlwifi${NORMAL} < ${PURPLE} rtl8192ce ${NORMAL}>"
@@ -220,11 +218,6 @@ function disable_staging {
 	perl -i -ne 'print if ! /CONFIG_COMPAT_STAGING/ ' Makefile
 }
 
-function disable_brcm80211 {
-	backup_file Makefile
-	perl -i -ne 'print if ! /brcm80211/ ' Makefile
-}
-
 function disable_update-initramfs
 {
 	backup_file Makefile
@@ -244,6 +237,12 @@ function select_ath9k_driver
 	# In the future here we'll add stuff to disable ath9k_htc
 }
 
+function select_brcm80211_driver 
+{
+	backup_file $BRCM80211_MAKEFILE
+	perl -i -ne 'print if /'$1'/ || /CONFIG_BRCMUTIL/ ' $BRCM80211_MAKEFILE
+}
+
 function restore_file {
 	#ORIG=$(shell ${1%%.${BACKUP_EXT}})
 	ORIG=${1%%.bk}
@@ -306,7 +305,6 @@ case $1 in
 		;;
 	ath)
 		disable_bt_usb_ethernet_var
-		disable_brcm80211
 		select_drivers		CONFIG_ATH_COMMON
 		disable_var_01
 		;;
@@ -347,6 +345,13 @@ case $1 in
 		disable_staging
 		disable_var_01
 		;;
+	brcm80211)
+		disable_staging
+		disable_bt_usb_ethernet_var
+		select_drivers		CONFIG_BRCMUTIL \
+					CONFIG_BRCMFMAC \
+					CONFIG_BRCMSMAC
+		;;
 # Singular modules
 	ath5k)
 		disable_staging
@@ -379,9 +384,17 @@ case $1 in
 		select_driver		CONFIG_ATH_COMMON
 		select_ath_driver	CONFIG_ATH6KL
 		;;
-	brcm80211)
+	brcmsmac)
+		disable_staging
+		disable_bt_usb_ethernet_var
+		select_drivers		CONFIG_BRCMUTIL CONFIG_BRCMFMAC
+		select_brcm80211_driver	CONFIG_BRCMSMAC
+		;;
+	brcmfmac)
+		disable_staging
 		disable_bt_usb_ethernet_var
-		select_driver		CONFIG_NOTHING
+		select_drivers		CONFIG_BRCMUTIL CONFIG_BRCMFMAC
+		select_brcm80211_driver	CONFIG_BRCMFMAC
 		;;
 	zd1211rw)
 		select_driver		CONFIG_COMPAT_ZD1211RW
-- 
1.7.4.1


^ permalink raw reply related

* [PATCH] brcm80211: rename CONFIG_BRCMUMAC to CONFIG_BRCMUTIL
From: Hauke Mehrtens @ 2011-10-13 14:25 UTC (permalink / raw)
  To: arend, linville; +Cc: linux-wireless, Hauke Mehrtens

There is no config option named CONFIG_BRCMUMAC this should be
CONFIG_BRCMUTIL as this is missing here.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
index 0a304b0..812a050 100644
--- a/drivers/net/wireless/Makefile
+++ b/drivers/net/wireless/Makefile
@@ -59,5 +59,5 @@ obj-$(CONFIG_IWM)	+= iwmc3200wifi/
 
 obj-$(CONFIG_MWIFIEX)	+= mwifiex/
 obj-$(CONFIG_BRCMFMAC) += brcm80211/
-obj-$(CONFIG_BRCMUMAC) += brcm80211/
+obj-$(CONFIG_BRCMUTIL) += brcm80211/
 obj-$(CONFIG_BRCMSMAC) += brcm80211/
-- 
1.7.4.1


^ permalink raw reply related

* Re: [PATCH] brcm80211: rename CONFIG_BRCMUMAC to CONFIG_BRCMUTIL
From: Johannes Berg @ 2011-10-13 14:28 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: arend, linville, linux-wireless
In-Reply-To: <1318515949-9558-1-git-send-email-hauke@hauke-m.de>

On Thu, 2011-10-13 at 16:25 +0200, Hauke Mehrtens wrote:
> There is no config option named CONFIG_BRCMUMAC this should be
> CONFIG_BRCMUTIL as this is missing here.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/wireless/Makefile |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
> index 0a304b0..812a050 100644
> --- a/drivers/net/wireless/Makefile
> +++ b/drivers/net/wireless/Makefile
> @@ -59,5 +59,5 @@ obj-$(CONFIG_IWM)	+= iwmc3200wifi/
>  
>  obj-$(CONFIG_MWIFIEX)	+= mwifiex/
>  obj-$(CONFIG_BRCMFMAC) += brcm80211/
> -obj-$(CONFIG_BRCMUMAC) += brcm80211/
> +obj-$(CONFIG_BRCMUTIL) += brcm80211/
>  obj-$(CONFIG_BRCMSMAC) += brcm80211/

Shouldn't it just go away since BRCMUTIL depends on SMAC||FMAC and is
otherwise unreachable?

johannes


^ permalink raw reply

* [PATCH 1/2] nl80211: Add sta_flags to the station info
From: Helmut Schaa @ 2011-10-13 14:30 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, johannes, Helmut Schaa

Reuse the already existing struct nl80211_sta_flag_update to specify
both, a flag mask and the flag set itself. This means
nl80211_sta_flag_update is now used for setting station flags and also
for getting station flags.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---

I think this is reasonable since even if we add read-only flags in
the future we can just ignore them when userspace tries to set them.

Helmut

 include/linux/nl80211.h |    2 ++
 include/net/cfg80211.h  |    5 ++++-
 net/wireless/nl80211.c  |    4 ++++
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 9d797f2..013ec4b 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -1548,6 +1548,7 @@ enum nl80211_sta_bss_param {
  * @NL80211_STA_INFO_BSS_PARAM: current station's view of BSS, nested attribute
  *     containing info as possible, see &enum nl80211_sta_bss_param
  * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected
+ * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. 
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -1569,6 +1570,7 @@ enum nl80211_sta_info {
 	NL80211_STA_INFO_RX_BITRATE,
 	NL80211_STA_INFO_BSS_PARAM,
 	NL80211_STA_INFO_CONNECTED_TIME,
+	NL80211_STA_INFO_STA_FLAGS,
 
 	/* keep last */
 	__NL80211_STA_INFO_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 74f4f85..92cf1c2 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -497,6 +497,7 @@ struct station_parameters {
  * @STATION_INFO_BSS_PARAM: @bss_param filled
  * @STATION_INFO_CONNECTED_TIME: @connected_time filled
  * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
+ * @STATION_INFO_STA_FLAGS: @sta_flags filled
  */
 enum station_info_flags {
 	STATION_INFO_INACTIVE_TIME	= 1<<0,
@@ -516,7 +517,8 @@ enum station_info_flags {
 	STATION_INFO_RX_BITRATE		= 1<<14,
 	STATION_INFO_BSS_PARAM          = 1<<15,
 	STATION_INFO_CONNECTED_TIME	= 1<<16,
-	STATION_INFO_ASSOC_REQ_IES	= 1<<17
+	STATION_INFO_ASSOC_REQ_IES	= 1<<17,
+	STATION_INFO_STA_FLAGS		= 1<<18
 };
 
 /**
@@ -633,6 +635,7 @@ struct station_info {
 	u32 tx_failed;
 	u32 rx_dropped_misc;
 	struct sta_bss_parameters bss_param;
+	struct nl80211_sta_flag_update sta_flags;
 
 	int generation;
 
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index edf655a..48260c2 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2344,6 +2344,10 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
 
 		nla_nest_end(msg, bss_param);
 	}
+	if (sinfo->filled & STATION_INFO_STA_FLAGS)
+		NLA_PUT(msg, NL80211_STA_INFO_STA_FLAGS,
+			sizeof(struct nl80211_sta_flag_update),
+			&sinfo->sta_flags);
 	nla_nest_end(msg, sinfoattr);
 
 	if (sinfo->filled & STATION_INFO_ASSOC_REQ_IES)
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 2/2] mac80211: Provide station flags to cfg80211
From: Helmut Schaa @ 2011-10-13 14:30 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, johannes, Helmut Schaa
In-Reply-To: <1318516240-10033-1-git-send-email-helmut.schaa@googlemail.com>

Only station flags that are already defined in nl80211 are added for
now.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---
 net/mac80211/cfg.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index d0705f2..e253afa 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -344,7 +344,8 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 			STATION_INFO_RX_BITRATE |
 			STATION_INFO_RX_DROP_MISC |
 			STATION_INFO_BSS_PARAM |
-			STATION_INFO_CONNECTED_TIME;
+			STATION_INFO_CONNECTED_TIME |
+			STATION_INFO_STA_FLAGS;
 
 	do_posix_clock_monotonic_gettime(&uptime);
 	sinfo->connected_time = uptime.tv_sec - sta->last_connected;
@@ -404,6 +405,23 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 		sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
 	sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
 	sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
+
+	sinfo->sta_flags.set = 0;
+	sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
+				BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
+				BIT(NL80211_STA_FLAG_WME) |
+				BIT(NL80211_STA_FLAG_MFP) |
+				BIT(NL80211_STA_FLAG_AUTHENTICATED);
+	if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
+		sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
+	if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
+		sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
+	if (test_sta_flag(sta, WLAN_STA_WME))
+		sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
+	if (test_sta_flag(sta, WLAN_STA_MFP))
+		sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
+	if (test_sta_flag(sta, WLAN_STA_AUTH))
+		sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
 }
 
 
-- 
1.7.3.4


^ permalink raw reply related

* Re: [PATCH 1/2] nl80211: Add sta_flags to the station info
From: Johannes Berg @ 2011-10-13 14:43 UTC (permalink / raw)
  To: Helmut Schaa; +Cc: linux-wireless, linville
In-Reply-To: <1318516240-10033-1-git-send-email-helmut.schaa@googlemail.com>

On Thu, 2011-10-13 at 16:30 +0200, Helmut Schaa wrote:
> Reuse the already existing struct nl80211_sta_flag_update to specify
> both, a flag mask and the flag set itself. This means
> nl80211_sta_flag_update is now used for setting station flags and also
> for getting station flags.

Why would we care about the mask here? Wouldn't a u32 attribute with the
set flags only make more sense?

johannes


^ permalink raw reply

* Re: [PATCH 1/2] nl80211: Add sta_flags to the station info
From: Helmut Schaa @ 2011-10-13 14:54 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, linville
In-Reply-To: <1318516981.5612.20.camel@jlt3.sipsolutions.net>

On Thu, Oct 13, 2011 at 4:43 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> Why would we care about the mask here? Wouldn't a u32 attribute with the
> set flags only make more sense?

I though about using the mask to tell user space which flags are actually
used/supported by the driver. There might be nl80211 drivers that can't provide
all flags and hence want to mask out the flags. Otherwise user space cannot
decide if a flag is not set or not supported by the driver. Does that sound
reasonable?

Helmut

^ permalink raw reply

* Re: [PATCH 1/2] nl80211: Add sta_flags to the station info
From: Johannes Berg @ 2011-10-13 15:00 UTC (permalink / raw)
  To: Helmut Schaa; +Cc: linux-wireless, linville
In-Reply-To: <CAGXE3d-9VfBm8DdzuQQ71U=1B81g_Ga1BvmJgv-0RZ6UMOSo_A@mail.gmail.com>

On Thu, 2011-10-13 at 16:54 +0200, Helmut Schaa wrote:
> On Thu, Oct 13, 2011 at 4:43 PM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > Why would we care about the mask here? Wouldn't a u32 attribute with the
> > set flags only make more sense?
> 
> I though about using the mask to tell user space which flags are actually
> used/supported by the driver. There might be nl80211 drivers that can't provide
> all flags and hence want to mask out the flags. Otherwise user space cannot
> decide if a flag is not set or not supported by the driver. Does that sound
> reasonable?

Yeah I was thinking that too, maybe that makes some sense. Not sure
we'll really run into that? Anyway we can keep it, I don't mind.

johannes


^ permalink raw reply

* Re: [PATCH] brcm80211: rename CONFIG_BRCMUMAC to CONFIG_BRCMUTIL
From: Arend van Spriel @ 2011-10-13 15:12 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Hauke Mehrtens, linville@tuxdriver.com,
	linux-wireless@vger.kernel.org
In-Reply-To: <1318516084.5612.18.camel@jlt3.sipsolutions.net>

[-- Attachment #1: Type: text/plain, Size: 1298 bytes --]

On 10/13/2011 04:28 PM, Johannes Berg wrote:
> On Thu, 2011-10-13 at 16:25 +0200, Hauke Mehrtens wrote:
>> There is no config option named CONFIG_BRCMUMAC this should be
>> CONFIG_BRCMUTIL as this is missing here.
>>
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>  drivers/net/wireless/Makefile |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
>> index 0a304b0..812a050 100644
>> --- a/drivers/net/wireless/Makefile
>> +++ b/drivers/net/wireless/Makefile
>> @@ -59,5 +59,5 @@ obj-$(CONFIG_IWM)	+= iwmc3200wifi/
>>  
>>  obj-$(CONFIG_MWIFIEX)	+= mwifiex/
>>  obj-$(CONFIG_BRCMFMAC) += brcm80211/
>> -obj-$(CONFIG_BRCMUMAC) += brcm80211/
>> +obj-$(CONFIG_BRCMUTIL) += brcm80211/
>>  obj-$(CONFIG_BRCMSMAC) += brcm80211/
> 
> Shouldn't it just go away since BRCMUTIL depends on SMAC||FMAC and is
> otherwise unreachable?
> 
> johannes
> 
> 

Henry provided the script for preparing the mainline patch. Indeed there
is no BRCMUMAC item so that was clearly a mistake. Also Johannes
statement is a valid one. BRCMUTIL always comes with either BRCMSMAC or
BRCMFMAC so include brcm80211/ on BRCMSMAC or BRCMFMAC is sufficient.
The Makefile in brcm80211 assures brcmutil module is built.

Gr. AvS

[-- Attachment #2: 0xB5E1A116.asc --]
[-- Type: application/pgp-keys, Size: 3113 bytes --]

^ permalink raw reply

* Re: [PATCH 22/22] brcm80211: removed file wifi.c
From: Luis R. Rodriguez @ 2011-10-13 18:08 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
	Alwin Beukers
In-Reply-To: <4E96A696.9040607@broadcom.com>

On Thu, Oct 13, 2011 at 1:51 AM, Arend van Spriel <arend@broadcom.com> wrote:
> On 10/12/2011 11:54 PM, Luis R. Rodriguez wrote:
>> On Wed, Oct 12, 2011 at 11:51 AM, Arend van Spriel <arend@broadcom.com> wrote:
>>> From: Alwin Beukers <alwin@broadcom.com>
>>>
>>> Wifi.c was empty after previous cleanups, so it was removed.
>>>
>>> Reviewed-by: Arend van Spriel <arend@broadcom.com>
>>> Signed-off-by: Arend van Spriel <arend@broadcom.com>
>>
>> Heh, remove Reviewed-by dude.
>>
>>   Luis
>>
>
> I had a remark on this in earlier commits. So I am clearly missing the
> point here. The author submitted this change and others for review to me
> and I reviewed it as requested. Hence the Reviewed-by: entry.
>
> I have been given the task to publish these patches and I sign them off
> for the "Developer's Certificate of Origin". Hence the Signed-off-by: entry.
>
> Is there something wrong with this reasoning?

Yeah this all makes no sense. If someone submits you a patch for you
to review *and* push upstream you simply add *their* SOB first, and
then after that your own.

  Luis

^ permalink raw reply

* Re: [PATCH 22/22] brcm80211: removed file wifi.c
From: Arend van Spriel @ 2011-10-13 18:27 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
	Alwin Beukers
In-Reply-To: <CAB=NE6XiXc=TsjQ0bCphqaprDAjrXMfoKaQTwyNu-hX2d0issA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1573 bytes --]

On 10/13/2011 08:08 PM, Luis R. Rodriguez wrote:
> On Thu, Oct 13, 2011 at 1:51 AM, Arend van Spriel <arend@broadcom.com> wrote:
>> On 10/12/2011 11:54 PM, Luis R. Rodriguez wrote:
>>> On Wed, Oct 12, 2011 at 11:51 AM, Arend van Spriel <arend@broadcom.com> wrote:
>>>> From: Alwin Beukers <alwin@broadcom.com>
>>>>
>>>> Wifi.c was empty after previous cleanups, so it was removed.
>>>>
>>>> Reviewed-by: Arend van Spriel <arend@broadcom.com>
>>>> Signed-off-by: Arend van Spriel <arend@broadcom.com>
>>>
>>> Heh, remove Reviewed-by dude.
>>>
>>>   Luis
>>>
>>
>> I had a remark on this in earlier commits. So I am clearly missing the
>> point here. The author submitted this change and others for review to me
>> and I reviewed it as requested. Hence the Reviewed-by: entry.
>>
>> I have been given the task to publish these patches and I sign them off
>> for the "Developer's Certificate of Origin". Hence the Signed-off-by: entry.
>>
>> Is there something wrong with this reasoning?
> 
> Yeah this all makes no sense. If someone submits you a patch for you
> to review *and* push upstream you simply add *their* SOB first, and
> then after that your own.
> 
>   Luis
> 

Ok, dude

Not trying to be rude, but in my opinion these are two separate things.
Your statement is that Signed-off-by: entry also covers the "Reviewer's
statement of oversight", but I could not find any confirmation to your
statement in the SubmittingPatches documentation.

The only miss I see is that the author did not sign off on this patch.

Gr. AvS


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 900 bytes --]

^ permalink raw reply

* Re: [PATCH 22/22] brcm80211: removed file wifi.c
From: John W. Linville @ 2011-10-13 18:23 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Arend van Spriel, linux-wireless@vger.kernel.org, Alwin Beukers
In-Reply-To: <CAB=NE6XiXc=TsjQ0bCphqaprDAjrXMfoKaQTwyNu-hX2d0issA@mail.gmail.com>

On Thu, Oct 13, 2011 at 11:08:15AM -0700, Luis R. Rodriguez wrote:
> On Thu, Oct 13, 2011 at 1:51 AM, Arend van Spriel <arend@broadcom.com> wrote:
> > On 10/12/2011 11:54 PM, Luis R. Rodriguez wrote:
> >> On Wed, Oct 12, 2011 at 11:51 AM, Arend van Spriel <arend@broadcom.com> wrote:
> >>> From: Alwin Beukers <alwin@broadcom.com>
> >>>
> >>> Wifi.c was empty after previous cleanups, so it was removed.
> >>>
> >>> Reviewed-by: Arend van Spriel <arend@broadcom.com>
> >>> Signed-off-by: Arend van Spriel <arend@broadcom.com>
> >>
> >> Heh, remove Reviewed-by dude.
> >>
> >>   Luis
> >>
> >
> > I had a remark on this in earlier commits. So I am clearly missing the
> > point here. The author submitted this change and others for review to me
> > and I reviewed it as requested. Hence the Reviewed-by: entry.
> >
> > I have been given the task to publish these patches and I sign them off
> > for the "Developer's Certificate of Origin". Hence the Signed-off-by: entry.
> >
> > Is there something wrong with this reasoning?
> 
> Yeah this all makes no sense. If someone submits you a patch for you
> to review *and* push upstream you simply add *their* SOB first, and
> then after that your own.

For my $0.02, having both a Reviewed-by and a Signed-off-by looks
a little funny, but it isn't necessarily wrong.  The Signed-off-by
really only says that you believe that patch is legally contributed.

Oh, and IANAL...

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply

* Re: [PATCH 22/22] brcm80211: removed file wifi.c
From: Arend van Spriel @ 2011-10-13 18:32 UTC (permalink / raw)
  To: John W. Linville
  Cc: Luis R. Rodriguez, linux-wireless@vger.kernel.org, Alwin Beukers
In-Reply-To: <20111013182306.GD2504@tuxdriver.com>


[-- Attachment #1.1: Type: text/plain, Size: 1552 bytes --]

On 10/13/2011 08:23 PM, John W. Linville wrote:
> On Thu, Oct 13, 2011 at 11:08:15AM -0700, Luis R. Rodriguez wrote:
>> On Thu, Oct 13, 2011 at 1:51 AM, Arend van Spriel <arend@broadcom.com> wrote:
>>> On 10/12/2011 11:54 PM, Luis R. Rodriguez wrote:
>>>> On Wed, Oct 12, 2011 at 11:51 AM, Arend van Spriel <arend@broadcom.com> wrote:
>>>>> From: Alwin Beukers <alwin@broadcom.com>
>>>>>
>>>>> Wifi.c was empty after previous cleanups, so it was removed.
>>>>>
>>>>> Reviewed-by: Arend van Spriel <arend@broadcom.com>
>>>>> Signed-off-by: Arend van Spriel <arend@broadcom.com>
>>>>
>>>> Heh, remove Reviewed-by dude.
>>>>
>>>>   Luis
>>>>
>>>
>>> I had a remark on this in earlier commits. So I am clearly missing the
>>> point here. The author submitted this change and others for review to me
>>> and I reviewed it as requested. Hence the Reviewed-by: entry.
>>>
>>> I have been given the task to publish these patches and I sign them off
>>> for the "Developer's Certificate of Origin". Hence the Signed-off-by: entry.
>>>
>>> Is there something wrong with this reasoning?
>>
>> Yeah this all makes no sense. If someone submits you a patch for you
>> to review *and* push upstream you simply add *their* SOB first, and
>> then after that your own.
> 
> For my $0.02, having both a Reviewed-by and a Signed-off-by looks
> a little funny, but it isn't necessarily wrong.  The Signed-off-by
> really only says that you believe that patch is legally contributed.
> 
> Oh, and IANAL...
> 
> John

IANALE

Gr. AvS

[-- Attachment #1.2: 0xB5E1A116.asc --]
[-- Type: application/pgp-keys, Size: 3165 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 900 bytes --]

^ permalink raw reply

* Compat-wireless release for 2011-10-13 is baked
From: Compat-wireless cronjob account @ 2011-10-13 19:04 UTC (permalink / raw)
  To: linux-wireless

>From git://github.com/sfrothwell/linux-next
 + 706f460...53c998a akpm-end   -> origin/akpm-end  (forced update)
 + 5c56568...7b64d23 master     -> origin/master  (forced update)
 * [new tag]         next-20111013 -> next-20111013

compat-wireless code metrics

    717234 - Total upstream lines of code being pulled

^ permalink raw reply

* [PATCH] mac80211: handle HT PHY BSS membership selector value correctly
From: Christian Lamparter @ 2011-10-13 19:08 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, linville

802.11n-2009 extends the supported rates element with a
magic value which can be used to prevent legacy stations
from joining the BSS.

However, this magic value is not a rate like the others
and the magic can simply be ignored/skipped at this late
stage.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
---
pending... still testing.
---
 include/linux/ieee80211.h |    4 ++
 net/mac80211/mlme.c       |   71 ++++++++++++++++++++++++--------------------
 2 files changed, 42 insertions(+), 33 deletions(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 48363c3..7d2c72d 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -770,6 +770,10 @@ struct ieee80211_mgmt {
 	} u;
 } __attribute__ ((packed));
 
+/* Supported Rates flags and value encodings in 802.11n-2009 7.3.2.2 */
+#define BSS_MEMBERSHIP_SELECTOR		BIT(7)
+#define BSS_MEMBERSHIP_SELECTOR_HT_PHY	127
+
 /* mgmt header + 1 byte category code */
 #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
 
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 0e5d8da..5619fd5 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1463,6 +1463,38 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
 	return RX_MGMT_CFG80211_DISASSOC;
 }
 
+static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
+				u8 *supp_rates, unsigned int supp_rates_len,
+				u32 *rates, u32 *basic_rates,
+				bool *have_higher_than_11mbit)
+{
+	int i, j;
+
+	for (i = 0; i < supp_rates_len; i++) {
+		int rate = (supp_rates[i] & 0x7f) * 5;
+		bool is_basic = !!(supp_rates[i] & BSS_MEMBERSHIP_SELECTOR);
+
+		if (rate > 110)
+			*have_higher_than_11mbit = true;
+
+		/*
+		 * BSS_MEMBERSHIP_SELECTOR_HT_PHY is defined in 802.11n-2009
+		 * 7.3.2.2 as a magic value instead of a rate. Hence, skip it.
+		 */
+		if (is_basic &&
+		    (supp_rates[i] & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HT_PHY)
+			continue;
+
+		for (j = 0; j < sband->n_bitrates; j++) {
+			if (sband->bitrates[j].bitrate == rate) {
+				*rates |= BIT(j);
+				if (is_basic)
+					*basic_rates |= BIT(j);
+				break;
+			}
+		}
+	}
+}
 
 static bool ieee80211_assoc_success(struct ieee80211_work *wk,
 				    struct ieee80211_mgmt *mgmt, size_t len)
@@ -1479,7 +1511,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
 	struct ieee802_11_elems elems;
 	struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;
 	u32 changed = 0;
-	int i, j, err;
+	int err;
 	bool have_higher_than_11mbit = false;
 	u16 ap_ht_cap_flags;
 
@@ -1525,39 +1557,12 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
 	basic_rates = 0;
 	sband = local->hw.wiphy->bands[wk->chan->band];
 
-	for (i = 0; i < elems.supp_rates_len; i++) {
-		int rate = (elems.supp_rates[i] & 0x7f) * 5;
-		bool is_basic = !!(elems.supp_rates[i] & 0x80);
-
-		if (rate > 110)
-			have_higher_than_11mbit = true;
-
-		for (j = 0; j < sband->n_bitrates; j++) {
-			if (sband->bitrates[j].bitrate == rate) {
-				rates |= BIT(j);
-				if (is_basic)
-					basic_rates |= BIT(j);
-				break;
-			}
-		}
-	}
-
-	for (i = 0; i < elems.ext_supp_rates_len; i++) {
-		int rate = (elems.ext_supp_rates[i] & 0x7f) * 5;
-		bool is_basic = !!(elems.ext_supp_rates[i] & 0x80);
+	ieee80211_get_rates(sband, elems.supp_rates, elems.supp_rates_len,
+			    &rates, &basic_rates, &have_higher_than_11mbit);
 
-		if (rate > 110)
-			have_higher_than_11mbit = true;
-
-		for (j = 0; j < sband->n_bitrates; j++) {
-			if (sband->bitrates[j].bitrate == rate) {
-				rates |= BIT(j);
-				if (is_basic)
-					basic_rates |= BIT(j);
-				break;
-			}
-		}
-	}
+	ieee80211_get_rates(sband, elems.ext_supp_rates,
+			    elems.ext_supp_rates_len, &rates, &basic_rates,
+			    &have_higher_than_11mbit);
 
 	sta->sta.supp_rates[wk->chan->band] = rates;
 	sdata->vif.bss_conf.basic_rates = basic_rates;
-- 
1.7.7


^ permalink raw reply related

* Re: [PATCH] mac80211: handle HT PHY BSS membership selector value correctly
From: Jouni Malinen @ 2011-10-13 22:45 UTC (permalink / raw)
  To: Christian Lamparter; +Cc: linux-wireless, johannes, linville
In-Reply-To: <201110132108.50019.chunkeey@googlemail.com>

On Thu, Oct 13, 2011 at 09:08:49PM +0200, Christian Lamparter wrote:
> 802.11n-2009 extends the supported rates element with a
> magic value which can be used to prevent legacy stations
> from joining the BSS.

Well, it can be used to try to make legacy stations not attempt
connection, but no guarantees on them actually checking whether they
support all the "basic rates".. For example, where is mac80211 (or
wpa_supplicant) doing that check? ;-)

> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> @@ -1463,6 +1463,38 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
> +static void ieee80211_get_rates(struct ieee80211_supported_band *sband,

> +	for (i = 0; i < supp_rates_len; i++) {
> +		int rate = (supp_rates[i] & 0x7f) * 5;
> +		bool is_basic = !!(supp_rates[i] & BSS_MEMBERSHIP_SELECTOR);

This looks a bit odd since the BSS_MEMBERSHIP_SELECTOR is not exactly
same as basic rate indicator even through they share the same bit. We
used to have the magic 0x80 value here which could actually look less
confusing than the mixing of basic and BSS membership terms.

> +		if (rate > 110)
> +			*have_higher_than_11mbit = true;

While this is not really introduced by this patch, this looks quite
bogus since the higher-than-11Mbps is then used to figure out whether
this was a 802.11g network. That is not correct since a network with a
single supported rate 6 Mbps should also get that behavior.. More robust
mechanism would be to check for any OFDM rate being listed.

> +	ieee80211_get_rates(sband, elems.supp_rates, elems.supp_rates_len,
> +			    &rates, &basic_rates, &have_higher_than_11mbit);

> +	ieee80211_get_rates(sband, elems.ext_supp_rates,
> +			    elems.ext_supp_rates_len, &rates, &basic_rates,
> +			    &have_higher_than_11mbit);

Yay for getting rid of the duplicated loop :-).
 
-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply

* Re: [PATCH] mac80211: handle HT PHY BSS membership selector value correctly
From: Christian Lamparter @ 2011-10-14  7:42 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: linux-wireless, johannes, linville
In-Reply-To: <20111013224532.GA1959@jm.kir.nu>

On Friday, October 14, 2011 12:45:32 AM Jouni Malinen wrote:
> On Thu, Oct 13, 2011 at 09:08:49PM +0200, Christian Lamparter wrote:
> > 802.11n-2009 extends the supported rates element with a
> > magic value which can be used to prevent legacy stations
> > from joining the BSS.
> 
> Well, it can be used to try to make legacy stations not attempt
> connection, but no guarantees on them actually checking whether they
> support all the "basic rates".. For example, where is mac80211 (or
> wpa_supplicant) doing that check? ;-)

Actually, you have already implemented the check elsewhere :)


> 
> > diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> > @@ -1463,6 +1463,38 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
> > +static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
> 
> > +	for (i = 0; i < supp_rates_len; i++) {
> > +		int rate = (supp_rates[i] & 0x7f) * 5;
> > +		bool is_basic = !!(supp_rates[i] & BSS_MEMBERSHIP_SELECTOR);
> 
> This looks a bit odd since the BSS_MEMBERSHIP_SELECTOR is not exactly
> same as basic rate indicator even through they share the same bit. We
> used to have the magic 0x80 value here which could actually look less
> confusing than the mixing of basic and BSS membership terms.
> 
> > +		if (rate > 110)
> > +			*have_higher_than_11mbit = true;
> 
> While this is not really introduced by this patch, this looks quite
> bogus since the higher-than-11Mbps is then used to figure out whether
> this was a 802.11g network. That is not correct since a network with a
> single supported rate 6 Mbps should also get that behavior.. More robust
> mechanism would be to check for any OFDM rate being listed.
> 
> > +	ieee80211_get_rates(sband, elems.supp_rates, elems.supp_rates_len,
> > +			    &rates, &basic_rates, &have_higher_than_11mbit);
> 
> > +	ieee80211_get_rates(sband, elems.ext_supp_rates,
> > +			    elems.ext_supp_rates_len, &rates, &basic_rates,
> > +			    &have_higher_than_11mbit);
> 
> Yay for getting rid of the duplicated loop :-).
>  
> 

^ permalink raw reply

* Re: [PATCH] mac80211: handle HT PHY BSS membership selector value correctly
From: Christian Lamparter @ 2011-10-14  8:12 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: linux-wireless, johannes, linville
In-Reply-To: <201110140942.37085.chunkeey@googlemail.com>

[Hit 'sent' by accident]

On Friday, October 14, 2011 09:42:36 AM Christian Lamparter wrote:
> On Friday, October 14, 2011 12:45:32 AM Jouni Malinen wrote:
> > On Thu, Oct 13, 2011 at 09:08:49PM +0200, Christian Lamparter wrote:
> > > 802.11n-2009 extends the supported rates element with a
> > > magic value which can be used to prevent legacy stations
> > > from joining the BSS.
> > 
> > Well, it can be used to try to make legacy stations not attempt
> > connection, but no guarantees on them actually checking whether they
> > support all the "basic rates".. For example, where is mac80211 (or
> > wpa_supplicant) doing that check? ;-)
> 
Actually, you have already implemented the check in hostapd :)

commit 2944824315b7c74838c551ef08c9843e02de1d46
Author: Jouni Malinen <jouni.malinen@atheros.com>
Date:   Wed Feb 9 15:08:47 2011 +0200

line 682:
        if (hapd->iconf->ieee80211n && hapd->iconf->require_ht &&
            !(sta->flags & WLAN_STA_HT)) {
                hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
                               HOSTAPD_LEVEL_INFO, "Station does not support "
                               "mandatory HT PHY - reject association");
                return WLAN_STATUS_ASSOC_DENIED_NO_HT;
        }

so if a legacy station decides to join a require_ht = 1 BSS
then the AP will refuse it with WLAN_STATUS_ASSOC_DENIED_NO_HT
and the wpa_supp client will blacklist the AP because of that
and it will choose a different AP for the next try.

> > > diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> > > @@ -1463,6 +1463,38 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
> > > +static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
> > 
> > > +	for (i = 0; i < supp_rates_len; i++) {
> > > +		int rate = (supp_rates[i] & 0x7f) * 5;
> > > +		bool is_basic = !!(supp_rates[i] & BSS_MEMBERSHIP_SELECTOR);
> > 
> > This looks a bit odd since the BSS_MEMBERSHIP_SELECTOR is not exactly
> > same as basic rate indicator even through they share the same bit. We
> > used to have the magic 0x80 value here which could actually look less
> > confusing than the mixing of basic and BSS membership terms.
So, what's the exact difference between then BasicRate and a MembershipRate
in this context then? Is a rate called "basic rate" when it's one of the
legacy e.g.: 6, 12, 24 Mbit rates [And likewise: is a rate called a MembershipRate
when only in the magic 127 HT PHY case?] 

> > 
> > > +		if (rate > 110)
> > > +			*have_higher_than_11mbit = true;
> > While this is not really introduced by this patch, this looks quite
> > bogus since the higher-than-11Mbps is then used to figure out whether
> > this was a 802.11g network. That is not correct since a network with a
> > single supported rate 6 Mbps should also get that behavior.. More robust
> > mechanism would be to check for any OFDM rate being listed.
Also, there's 22mbit 8-PSK PBCC [I think mwl8k supports it and some TI
stuff could support it as well]. The check is questionable, but fixing
it may no be trivial either. [Anyway, it's a bit outside the scope and
requires another patch]

Regards,
	Chr

^ permalink raw reply

* Re: [PATCH v2] mac80211: pass vif param to conf_tx() callback
From: Eliad Peller @ 2011-10-14  9:54 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1318433496.3933.44.camel@jlt3.sipsolutions.net>

On Wed, Oct 12, 2011 at 5:31 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Sun, 2011-10-02 at 10:15 +0200, Eliad Peller wrote:
>> tx params should be configured per interface.
>> add ieee80211_vif param to the conf_tx callback,
>> and change all the drivers that use this callback.
>
> For the record, I said this to you on IRC but you weren't around I
> guess. This patch (with the other ones) is now passing a bogus sdata/vif
> pointer to drivers -- e.g. for monitor mode interfaces from
> ieee80211_do_open -> ieee80211_set_wmm_default -> drv_conf_tx.
>
> I suspect the way to fix this would be to move the call to
> ieee80211_set_wmm_default into the last switch statement in do_open,
> could you please look into it?
>
thanks for the info.
i'll look into it.

Eliad.

^ permalink raw reply

* [PATCH] libertas: fix changing interface type when interface is down
From: Daniel Drake @ 2011-10-14 11:05 UTC (permalink / raw)
  To: linville, dcbw; +Cc: linux-wireless, libertas-dev

The recent changes to only power the device when the interface up
introduced a bug: changing interface type, legal when the interface
is down, performs device I/O.

Fix this functionality by validating and recording the interface
type when the change is requested, but only applying the change
if/when the interface is brought up.

Signed-off-by: Daniel Drake <dsd@laptop.org>
---
 drivers/net/wireless/libertas/cfg.c  |   20 ++++++--------------
 drivers/net/wireless/libertas/decl.h |    2 ++
 drivers/net/wireless/libertas/main.c |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 610bfce..ff63782 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -1666,28 +1666,20 @@ static int lbs_change_intf(struct wiphy *wiphy, struct net_device *dev,
 	if (dev == priv->mesh_dev)
 		return -EOPNOTSUPP;
 
-	lbs_deb_enter(LBS_DEB_CFG80211);
-
 	switch (type) {
 	case NL80211_IFTYPE_MONITOR:
-		ret = lbs_set_monitor_mode(priv, 1);
-		break;
 	case NL80211_IFTYPE_STATION:
-		if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR)
-			ret = lbs_set_monitor_mode(priv, 0);
-		if (!ret)
-			ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 1);
-		break;
 	case NL80211_IFTYPE_ADHOC:
-		if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR)
-			ret = lbs_set_monitor_mode(priv, 0);
-		if (!ret)
-			ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 2);
 		break;
 	default:
-		ret = -ENOTSUPP;
+		return -EOPNOTSUPP;
 	}
 
+	lbs_deb_enter(LBS_DEB_CFG80211);
+
+	if (priv->iface_running)
+		ret = lbs_set_iface_type(priv, type);
+
 	if (!ret)
 		priv->wdev->iftype = type;
 
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index 9304e6f..bc951ab 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -9,6 +9,7 @@
 
 #include <linux/netdevice.h>
 #include <linux/firmware.h>
+#include <linux/nl80211.h>
 
 /* Should be terminated by a NULL entry */
 struct lbs_fw_table {
@@ -45,6 +46,7 @@ void lbs_host_to_card_done(struct lbs_private *priv);
 
 int lbs_start_iface(struct lbs_private *priv);
 int lbs_stop_iface(struct lbs_private *priv);
+int lbs_set_iface_type(struct lbs_private *priv, enum nl80211_iftype type);
 
 int lbs_rtap_supported(struct lbs_private *priv);
 
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 6a32623..f78afd7 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -99,6 +99,32 @@ u8 lbs_data_rate_to_fw_index(u32 rate)
 	return 0;
 }
 
+int lbs_set_iface_type(struct lbs_private *priv, enum nl80211_iftype type)
+{
+	int ret = 0;
+
+	switch (type) {
+	case NL80211_IFTYPE_MONITOR:
+		ret = lbs_set_monitor_mode(priv, 1);
+		break;
+	case NL80211_IFTYPE_STATION:
+		if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR)
+			ret = lbs_set_monitor_mode(priv, 0);
+		if (!ret)
+			ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 1);
+		break;
+	case NL80211_IFTYPE_ADHOC:
+		if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR)
+			ret = lbs_set_monitor_mode(priv, 0);
+		if (!ret)
+			ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 2);
+		break;
+	default:
+		ret = -ENOTSUPP;
+	}
+	return ret;
+}
+
 int lbs_start_iface(struct lbs_private *priv)
 {
 	struct cmd_ds_802_11_mac_address cmd;
@@ -120,6 +146,12 @@ int lbs_start_iface(struct lbs_private *priv)
 		goto err;
 	}
 
+	ret = lbs_set_iface_type(priv, priv->wdev->iftype);
+	if (ret) {
+		lbs_deb_net("set iface type failed\n");
+		goto err;
+	}
+
 	lbs_update_channel(priv);
 
 	priv->iface_running = true;
-- 
1.7.6.4


^ permalink raw reply related

* [PATCH 0/5] ath6kl: Add SDIO polling method for debugging
From: Sangwook Lee @ 2011-10-14 12:50 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, patches, Sangwook Lee

Add SDIO polling method based user defined intevals
At initial development stage, when SDIO irqs problem happen,
We can use this funtionality for debugging.
This is only tested with AR6003 HW2.0

Sangwook Lee (5):
  ath6kl: Add SDIO polling function definitions
  ath6kl: Add SDIO polling function hook into SDIO init time
  ath6kl: Add SDIO polling method into menu
  ath6kl: Add SDIO polling file into Makefile
  ath6kl: Add SDIO polling function

 drivers/net/wireless/ath/ath6kl/Kconfig     |    8 +
 drivers/net/wireless/ath/ath6kl/Makefile    |    1 +
 drivers/net/wireless/ath/ath6kl/debug.h     |   25 +++
 drivers/net/wireless/ath/ath6kl/sdio.c      |    7 +
 drivers/net/wireless/ath/ath6kl/sdio_poll.c |  216 +++++++++++++++++++++++++++
 5 files changed, 257 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath6kl/sdio_poll.c

-- 
1.7.4.1


^ permalink raw reply

* [PATCH 2/5] ath6kl: Add SDIO polling function hook into SDIO init time
From: Sangwook Lee @ 2011-10-14 12:50 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, patches, Sangwook Lee
In-Reply-To: <1318596646-19495-1-git-send-email-sangwook.lee@linaro.org>

Add SDIO polling function into SDIO related file

Signed-off-by: Sangwook Lee <sangwook.lee@linaro.org>
---
 drivers/net/wireless/ath/ath6kl/sdio.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index f48af45..f3520d9 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -447,6 +447,9 @@ static void ath6kl_sdio_irq_handler(struct sdio_func *func)
 	int status;
 	struct ath6kl_sdio *ar_sdio;
 
+	if (ath6kl_wd_poll_is_ture())
+		return;
+
 	ath6kl_dbg(ATH6KL_DBG_SDIO, "irq\n");
 
 	ar_sdio = sdio_get_drvdata(func);
@@ -858,6 +861,8 @@ static int ath6kl_sdio_probe(struct sdio_func *func,
 
 	sdio_release_host(func);
 
+	ath6kl_wd_init(ar);
+
 	ret = ath6kl_core_init(ar);
 	if (ret) {
 		ath6kl_err("Failed to init ath6kl core\n");
@@ -891,6 +896,8 @@ static void ath6kl_sdio_remove(struct sdio_func *func)
 	ath6kl_stop_txrx(ar_sdio->ar);
 	cancel_work_sync(&ar_sdio->wr_async_work);
 
+	ath6kl_wd_cleanup(ar_sdio->ar);
+
 	ath6kl_unavail_ev(ar_sdio->ar);
 
 	ath6kl_sdio_power_off(ar_sdio);
-- 
1.7.4.1


^ permalink raw reply related

* [PATCH 5/5] ath6kl: Add SDIO polling function
From: Sangwook Lee @ 2011-10-14 12:50 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, patches, Sangwook Lee
In-Reply-To: <1318596646-19495-1-git-send-email-sangwook.lee@linaro.org>

SDIO polling fuctions exsits on the separate file. This can be
deseleted in Makefile according to menu configuration

Signed-off-by: Sangwook Lee <sangwook.lee@linaro.org>
---
 drivers/net/wireless/ath/ath6kl/sdio_poll.c |  216 +++++++++++++++++++++++++++
 1 files changed, 216 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath6kl/sdio_poll.c

diff --git a/drivers/net/wireless/ath/ath6kl/sdio_poll.c b/drivers/net/wireless/ath/ath6kl/sdio_poll.c
new file mode 100644
index 0000000..ce2f127
--- /dev/null
+++ b/drivers/net/wireless/ath/ath6kl/sdio_poll.c
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2011 Linaro
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <linux/moduleparam.h>
+#include <linux/errno.h>
+#include <linux/of.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/card.h>
+#include <linux/mmc/sdio_func.h>
+#include <linux/kthread.h>
+#include "core.h"
+#include "cfg80211.h"
+#include "target.h"
+#include "debug.h"
+#include "hif-ops.h"
+
+/* This structure is duplicated used in sdio.c */
+struct ath6kl_sdio {
+
+	struct sdio_func *func;
+
+	spinlock_t lock;
+
+	/* free list */
+	struct list_head bus_req_freeq;
+
+	/* available bus requests */
+	struct bus_request bus_req[BUS_REQUEST_MAX_NUM];
+
+	struct ath6kl *ar;
+	u8 *dma_buffer;
+
+	/* scatter request list head */
+	struct list_head scat_req;
+
+	spinlock_t scat_lock;
+	bool is_disabled;
+	atomic_t irq_handling;
+	const struct sdio_device_id *id;
+	struct work_struct wr_async_work;
+	struct list_head wr_asyncq;
+	spinlock_t wr_async_lock;
+};
+
+/* Use polling method of SDIO interrupt */
+struct ath6kl_poll {
+	/* Watchdog task struct */
+	struct task_struct *wd_ts;
+	/* watchdog sempahore */
+	struct semaphore wd_sem;
+	struct completion wd_exited;
+	/* Wathdog wake up timer */
+	struct timer_list wd_timer;
+	bool wd_timer_valid;
+	/* polling time ms */
+	int wd_ms;
+};
+
+/*Later, this can become a member of struct ath6kl */
+static struct ath6kl_poll *ap_g;
+
+static void ath6kl_wd_poll_handler(struct ath6kl *ar)
+{
+	int status;
+	struct ath6kl_sdio *ar_sdio;
+
+	/* Wait for htc_target to be created
+	 * because wd_init is called
+	 * beforeath6kl_core_init
+	 */
+	if (!ar->htc_target)
+		return;
+
+	ar_sdio = (struct ath6kl_sdio *)ar->hif_priv;
+	ath6kl_dbg(ATH6KL_DBG_SDIO, "irq\n");
+	atomic_set(&ar_sdio->irq_handling, 1);
+	status = ath6kldev_intr_bh_handler(ar);
+	atomic_set(&ar_sdio->irq_handling, 0);
+	WARN_ON(status && status != -ECANCELED);
+}
+
+/* Update watchdog time */
+static inline void ath6kl_wd_update_time(struct ath6kl_poll *ap)
+{
+	if (ap->wd_timer_valid)
+		mod_timer(&ap->wd_timer, jiffies + msecs_to_jiffies(ap->wd_ms));
+}
+
+static void ath6kl_wd_func(ulong data)
+{
+	struct ath6kl_poll *ap = (struct ath6kl_poll *)data;
+
+	if (!ap->wd_timer_valid) {
+		del_timer_sync(&ap->wd_timer);
+		return;
+	}
+	/* Wake up sleeping watchdog thread */
+	if (ap->wd_timer_valid)
+		up(&ap->wd_sem);
+
+	/* Reschedule the watchdog */
+	ath6kl_wd_update_time(ap);
+}
+
+static int ath6kl_wd_thread(void *data)
+{
+	struct ath6kl *ar = (struct ath6kl *)data;
+	struct ath6kl_poll *ap = ap_g;
+	struct sched_param param = {.sched_priority = 1 };
+
+	sched_setscheduler(current, SCHED_FIFO, &param);
+	allow_signal(SIGKILL);
+	allow_signal(SIGTERM);
+
+	/* Run until signal received */
+	do {
+		if (down_interruptible(&ap->wd_sem) == 0) {
+			/* Call the bus module watchdog */
+			ath6kl_wd_poll_handler(ar);
+			/* Reschedule the watchdog */
+			ath6kl_wd_update_time(ap);
+		} else {
+			break;
+		}
+	} while (!kthread_should_stop());
+
+	complete_and_exit(&ap->wd_exited, 0);
+
+	return 0;
+}
+
+/**
+ * ath6kl_wd_init -init watchdog poll for ath6kl
+ *
+ * must be called after ath6kl_htc_create because SDIO host
+ * irq must be disabled
+ */
+void ath6kl_wd_init(struct ath6kl *ar)
+{
+	struct ath6kl_poll *ap;
+	struct timer_list *timer;
+
+	ap = kzalloc(sizeof(struct ath6kl_poll), GFP_KERNEL);
+
+	/* For ath6kl_wd_cleanup */
+	ap_g = ap;
+
+	if (!ap) {
+		ath6kl_err("failed to alloc memory\n");
+		return;
+	}
+
+	/* Congfigure polling time */
+	ap->wd_timer_valid = true;
+	/* Please change this polling time : 10 ms by default */
+	ap->wd_ms = 10;
+
+	sema_init(&ap->wd_sem, 1);
+	init_completion(&ap->wd_exited);
+
+	ap->wd_ts = kthread_run(ath6kl_wd_thread, (void *)ar, "ath6kl_wd");
+	if (IS_ERR(ap->wd_ts)) {
+		ap->wd_timer_valid = false;
+		del_timer_sync(&ap->wd_timer);
+		ath6kl_err("failed to make ath6k_wd\n");
+		kfree(ap);
+		ap_g = NULL;
+		return;
+	}
+
+	/* Set up the watchdog timer */
+	timer = &ap->wd_timer;
+	init_timer(timer);
+	timer->function = ath6kl_wd_func;
+	timer->data = (ulong) ap;
+	/* Run timer now at first */
+	timer->expires = jiffies + msecs_to_jiffies(1);
+	add_timer(timer);
+
+}
+
+void ath6kl_wd_cleanup(struct ath6kl *ar)
+{
+	struct ath6kl_poll *ap = ap_g;
+
+	/* Check validity */
+	if (!ap || !ap->wd_timer_valid)
+		return;
+
+	ap->wd_ms = 0;
+	del_timer_sync(&ap->wd_timer);
+	ap->wd_timer_valid = false;
+
+	/* Wake up thread sleeping on wd_sem */
+	send_sig(SIGTERM, ap->wd_ts, 1);
+
+	wait_for_completion(&ap->wd_exited);
+
+	/* Kill watchdog thread */
+	kthread_stop(ap->wd_ts);
+
+	kfree(ap);
+}
-- 
1.7.4.1


^ permalink raw reply related

* [PATCH 1/5] ath6kl: Add SDIO polling function definitions
From: Sangwook Lee @ 2011-10-14 12:50 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, patches, Sangwook Lee
In-Reply-To: <1318596646-19495-1-git-send-email-sangwook.lee@linaro.org>

Add SDIO polling function definition into debug.h

Signed-off-by: Sangwook Lee <sangwook.lee@linaro.org>
---
 drivers/net/wireless/ath/ath6kl/debug.h |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/debug.h b/drivers/net/wireless/ath/ath6kl/debug.h
index 9288a3c..bbe4a39 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.h
+++ b/drivers/net/wireless/ath/ath6kl/debug.h
@@ -133,6 +133,31 @@ static inline int ath6kl_debug_init(struct ath6kl *ar)
 static inline void ath6kl_debug_cleanup(struct ath6kl *ar)
 {
 }
+#endif
+
+#ifdef CONFIG_ATH6KL_SDIO_POLL
+void ath6kl_wd_init(struct ath6kl *ar);
+
+void ath6kl_wd_cleanup(struct ath6kl *ar);
+
+static inline int ath6kl_wd_poll_is_ture(void)
+{
+	return true;
+}
+
+#else
+static inline void ath6kl_wd_init(struct ath6kl *ar)
+{
+}
+
+static inline void ath6kl_wd_cleanup(struct ath6kl *ar)
+{
+}
+
+static inline int ath6kl_wd_poll_is_ture(void)
+{
+	return false;
+}
 
 #endif
 #endif
-- 
1.7.4.1


^ permalink raw reply related

* [PATCH 4/5] ath6kl: Add SDIO polling file into Makefile
From: Sangwook Lee @ 2011-10-14 12:50 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, patches, Sangwook Lee
In-Reply-To: <1318596646-19495-1-git-send-email-sangwook.lee@linaro.org>

Add new file into Makefile

Signed-off-by: Sangwook Lee <sangwook.lee@linaro.org>
---
 drivers/net/wireless/ath/ath6kl/Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/Makefile b/drivers/net/wireless/ath/ath6kl/Makefile
index 8f7a0d1..a8f4a55 100644
--- a/drivers/net/wireless/ath/ath6kl/Makefile
+++ b/drivers/net/wireless/ath/ath6kl/Makefile
@@ -32,6 +32,7 @@ ath6kl-y += main.o
 ath6kl-y += txrx.o
 ath6kl-y += wmi.o
 ath6kl-y += sdio.o
+ath6kl-$(CONFIG_ATH6KL_SDIO_POLL) += sdio_poll.o
 ath6kl-$(CONFIG_NL80211_TESTMODE) += testmode.o
 
 ccflags-y += -D__CHECK_ENDIAN__
-- 
1.7.4.1


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox