[OpenWrt-Devel] [PATCH v3 1/2] [mac80211] Add "channel set helper" callback to ath9k

Stefan Rompf stefan at loplof.de
Fri Jun 12 15:36:13 EDT 2015


This patch adds a "channel set helper" callback to the ath9k driver and 
exports the ath9k kernel API for other packages. The registered function
is called whenever ath9k changes the channel. 

Signed-off-by: Stefan Rompf <stefan at loplof.de>
---
Index: package/kernel/mac80211/Makefile
===================================================================
--- package/kernel/mac80211/Makefile	(Revision 45695)
+++ package/kernel/mac80211/Makefile	(Arbeitskopie)
@@ -1737,11 +1737,13 @@
 		$(1)/usr/include/mac80211 \
 		$(1)/usr/include/mac80211-backport \
 		$(1)/usr/include/mac80211/ath \
+		$(1)/usr/include/mac80211/ath/ath9k \
 		$(1)/usr/include/net/mac80211
 	$(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
 	$(CP) $(PKG_BUILD_DIR)/backport-include/* $(1)/usr/include/mac80211-backport/
 	$(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
 	$(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/
+	$(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/*.h $(1)/usr/include/mac80211/ath/ath9k/
 	rm -f $(1)/usr/include/mac80211-backport/linux/module.h
 endef
 
Index: package/kernel/mac80211/patches/930-ath9k_add_channel_set_helper.patch
===================================================================
--- package/kernel/mac80211/patches/930-ath9k_add_channel_set_helper.patch	(Revision 0)
+++ package/kernel/mac80211/patches/930-ath9k_add_channel_set_helper.patch	(Arbeitskopie)
@@ -0,0 +1,46 @@
+diff -X diffign -Npur kernel/drivers/net/wireless/ath/ath9k.orig/ath9k.h kernel/drivers/net/wireless/ath/ath9k/ath9k.h
+--- kernel/drivers/net/wireless/ath/ath9k.orig/ath9k.h	2015-06-04 21:19:11.000000000 +0200
++++ kernel/drivers/net/wireless/ath/ath9k/ath9k.h	2015-06-06 10:23:05.000000000 +0200
+@@ -1110,4 +1110,10 @@ static inline int ath_ahb_init(void) { r
+ static inline void ath_ahb_exit(void) {};
+ #endif
+ 
++/*
++ * OpenWrt channel set helper, needed f.e. for Ubiquiti UniFi Outdoor Plus
++ */
++typedef void (set_channel_helper_fn)(struct ath_hw* ah, int bw, int fq);
++void ath9k_register_set_channel_helper(set_channel_helper_fn *); /* call inside RTNL lock to guard against parallel channel change */
++
+ #endif /* ATH9K_H */
+diff -X diffign -Npur kernel/drivers/net/wireless/ath/ath9k.orig/channel.c kernel/drivers/net/wireless/ath/ath9k/channel.c
+--- kernel/drivers/net/wireless/ath/ath9k.orig/channel.c	2015-03-10 04:37:15.000000000 +0100
++++ kernel/drivers/net/wireless/ath/ath9k/channel.c	2015-06-06 10:23:05.000000000 +0200
+@@ -16,6 +16,18 @@
+ 
+ #include "ath9k.h"
+ 
++/*
++ * OpenWrt channel set helper
++ */
++static set_channel_helper_fn *ath9k_set_channel_helper;
++
++void ath9k_register_set_channel_helper(set_channel_helper_fn *chanfn)
++{
++	ath9k_set_channel_helper = chanfn;
++}
++EXPORT_SYMBOL(ath9k_register_set_channel_helper);
++
++
+ /* Set/change channels.  If the channel is really being changed, it's done
+  * by reseting the chip.  To accomplish this we must first cleanup any pending
+  * DMA, then restart stuff.
+@@ -41,6 +53,9 @@ static int ath_set_channel(struct ath_so
+ 	ath_dbg(common, CONFIG, "Set channel: %d MHz width: %d\n",
+ 		chan->center_freq, chandef->width);
+ 
++	if (ath9k_set_channel_helper)
++		ath9k_set_channel_helper(ah, chandef->width, chan->center_freq);
++
+ 	/* update survey stats for the old channel before switching */
+ 	spin_lock_bh(&common->cc_lock);
+ 	ath_update_survey_stats(sc);
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list