Skip to contentSkip to conversation

mac80211 fixes/cleanups/updates

PATCH NAK Johannes Berg 5 participants 18 messages Oct 7, 2008 – Oct 10, 2008 mac80211

lore
Share & tools
lore
author maintainer
#13 lore raw

PATCH 6/8 mac80211: clean up ieee80211_hw_config errors

In reply to Johannes Berg

Warn when ieee80211_hw_config returns an error, it shouldn't happen; remove a number of printks that would happen in such a case and one printk that is user-triggerable.

---
 net/mac80211/cfg.c  |    3 +--
 net/mac80211/main.c |    8 +++++++-
 net/mac80211/scan.c |   16 +++-------------
 net/mac80211/util.c |    5 +----
 net/mac80211/wext.c |    6 +-----
 5 files changed, 13 insertions(+), 25 deletions(-)
net/mac80211/cfg.c +1 -2
@@ -396,8 +396,7 @@ static int ieee80211_config_beacon(struc
 	 */
 	if (params->interval) {
 		sdata->local->hw.conf.beacon_int = params->interval;
-		if (ieee80211_hw_config(sdata->local))
-			return -EINVAL;
+		ieee80211_hw_config(sdata->local);
 		/*
 		 * We updated some parameter so if below bails out
 		 * it's not an error.
net/mac80211/main.c +7 -1
@@ -222,8 +222,14 @@ int ieee80211_hw_config(struct ieee80211
 	       wiphy_name(local->hw.wiphy), chan->center_freq);
 #endif
 
-	if (local->open_count)
+	if (local->open_count) {
 		ret = local->ops->config(local_to_hw(local), &local->hw.conf);
+		/*
+		 * HW reconfiguration should never fail, the driver has told
+		 * us what it can support so it should live up to that promise.
+		 */
+		WARN_ON(ret);
+	}
 
 	return ret;
 }
net/mac80211/scan.c +3 -13
@@ -447,18 +447,12 @@ void ieee80211_scan_completed(struct iee
 
 	if (local->hw_scanning) {
 		local->hw_scanning = false;
-		if (ieee80211_hw_config(local))
-			printk(KERN_DEBUG "%s: failed to restore operational "
-			       "channel after scan\n", wiphy_name(local->hw.wiphy));
-
+		ieee80211_hw_config(local);
 		goto done;
 	}
 
 	local->sw_scanning = false;
-	if (ieee80211_hw_config(local))
-		printk(KERN_DEBUG "%s: failed to restore operational "
-		       "channel after scan\n", wiphy_name(local->hw.wiphy));
-
+	ieee80211_hw_config(local);
 
 	netif_tx_lock_bh(local->mdev);
 	netif_addr_lock(local->mdev);
@@ -545,12 +539,8 @@ void ieee80211_scan_work(struct work_str
 
 		if (!skip) {
 			local->scan_channel = chan;
-			if (ieee80211_hw_config(local)) {
-				printk(KERN_DEBUG "%s: failed to set freq to "
-				       "%d MHz for scan\n", wiphy_name(local->hw.wiphy),
-				       chan->center_freq);
+			if (ieee80211_hw_config(local))
 				skip = 1;
-			}
 		}
 
 		/* advance state machine to next channel/band */
net/mac80211/util.c +1 -4
@@ -638,11 +638,8 @@ int ieee80211_set_freq(struct ieee80211_
 
 	if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
 		if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
-		    chan->flags & IEEE80211_CHAN_NO_IBSS) {
-			printk(KERN_DEBUG "%s: IBSS not allowed on frequency "
-				"%d MHz\n", sdata->dev->name, chan->center_freq);
+		    chan->flags & IEEE80211_CHAN_NO_IBSS)
 			return ret;
-		}
 		local->oper_channel = chan;
 
 		if (local->sw_scanning || local->hw_scanning)
net/mac80211/wext.c +1 -5
@@ -689,12 +689,8 @@ static int ieee80211_ioctl_siwtxpower(st
 		ieee80211_led_radio(local, local->hw.conf.radio_enabled);
 	}
 
-	if (need_reconfig) {
+	if (need_reconfig)
 		ieee80211_hw_config(local);
-		/* The return value of hw_config is not of big interest here,
-		 * as it doesn't say that it failed because of _this_ config
-		 * change or something else. Ignore it. */
-	}
 
 	return 0;
 }
author maintainer
#2 lore raw

PATCH 2/8 mac80211: remove aggregation status write support from debugfs

In reply to Johannes Berg

This code uses static variables and thus cannot be kept.

---
 net/mac80211/debugfs_sta.c |   73 ---------------------------------------------
 1 file changed, 1 insertion(+), 72 deletions(-)
net/mac80211/debugfs_sta.c +1 -72
@@ -39,13 +39,6 @@ static const struct file_operations sta_
 	.open = mac80211_open_file_generic,				\
 }
 
-#define STA_OPS_WR(name)						\
-static const struct file_operations sta_ ##name## _ops = {		\
-	.read = sta_##name##_read,					\
-	.write = sta_##name##_write,					\
-	.open = mac80211_open_file_generic,				\
-}
-
 #define STA_FILE(name, field, format)					\
 		STA_READ_##format(name, field)				\
 		STA_OPS(name)
@@ -168,71 +161,7 @@ static ssize_t sta_agg_status_read(struc
 
 	return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
 }
-
-static ssize_t sta_agg_status_write(struct file *file,
-		const char __user *user_buf, size_t count, loff_t *ppos)
-{
-	struct sta_info *sta = file->private_data;
-	struct ieee80211_local *local = sta->sdata->local;
-	struct ieee80211_hw *hw = &local->hw;
-	u8 *da = sta->sta.addr;
-	static int tid_static_tx[16] = {0, 0, 0, 0, 0, 0, 0, 0,
-					0, 0, 0, 0, 0, 0, 0, 0};
-	static int tid_static_rx[16] = {1, 1, 1, 1, 1, 1, 1, 1,
-					1, 1, 1, 1, 1, 1, 1, 1};
-	char *endp;
-	char buf[32];
-	int buf_size, rs;
-	unsigned int tid_num;
-	char state[4];
-
-	memset(buf, 0x00, sizeof(buf));
-	buf_size = min(count, (sizeof(buf)-1));
-	if (copy_from_user(buf, user_buf, buf_size))
-		return -EFAULT;
-
-	tid_num = simple_strtoul(buf, &endp, 0);
-	if (endp == buf)
-		return -EINVAL;
-
-	if ((tid_num >= 100) && (tid_num <= 115)) {
-		/* toggle Rx aggregation command */
-		tid_num = tid_num - 100;
-		if (tid_static_rx[tid_num] == 1) {
-			strcpy(state, "off ");
-			ieee80211_sta_stop_rx_ba_session(sta->sdata, da, tid_num, 0,
-					WLAN_REASON_QSTA_REQUIRE_SETUP);
-			sta->ampdu_mlme.tid_state_rx[tid_num] |=
-					HT_AGG_STATE_DEBUGFS_CTL;
-			tid_static_rx[tid_num] = 0;
-		} else {
-			strcpy(state, "on ");
-			sta->ampdu_mlme.tid_state_rx[tid_num] &=
-					~HT_AGG_STATE_DEBUGFS_CTL;
-			tid_static_rx[tid_num] = 1;
-		}
-		printk(KERN_DEBUG "debugfs - try switching tid %u %s\n",
-				tid_num, state);
-	} else if ((tid_num >= 0) && (tid_num <= 15)) {
-		/* toggle Tx aggregation command */
-		if (tid_static_tx[tid_num] == 0) {
-			strcpy(state, "on ");
-			rs =  ieee80211_start_tx_ba_session(hw, da, tid_num);
-			if (rs == 0)
-				tid_static_tx[tid_num] = 1;
-		} else {
-			strcpy(state, "off");
-			rs =  ieee80211_stop_tx_ba_session(hw, da, tid_num, 1);
-			if (rs == 0)
-				tid_static_tx[tid_num] = 0;
-		}
-		printk(KERN_DEBUG "debugfs - switching tid %u %s, return=%d\n",
-				tid_num, state, rs);
-	}
-
-	return count;
-}
-STA_OPS_WR(agg_status);
+STA_OPS(agg_status);
 
 #define DEBUGFS_ADD(name) \
 	sta->debugfs.name = debugfs_create_file(#name, 0400, \
author maintainer
#9 lore raw

PATCH 3/8 mac80211: remove writable debugs mesh parameters

In reply to Johannes Berg

These parameters shouldn't be configurable via debugfs, if they need to be configurable nl80211 support has to be added, if not then they don't need to be writable here either.

Cc Javier Cardona <[email protected]>
Cc Luis Carlos Cobo <[email protected]>
---
 net/mac80211/debugfs_netdev.c |  112 +++++++++---------------------------------
 1 file changed, 24 insertions(+), 88 deletions(-)
net/mac80211/debugfs_netdev.c +24 -88
@@ -41,29 +41,6 @@ static ssize_t ieee80211_if_read(
 	return ret;
 }
 
-#ifdef CONFIG_MAC80211_MESH
-static ssize_t ieee80211_if_write(
-	struct ieee80211_sub_if_data *sdata,
-	char const __user *userbuf,
-	size_t count, loff_t *ppos,
-	int (*format)(struct ieee80211_sub_if_data *, char *))
-{
-	char buf[10];
-	int buf_size;
-
-	memset(buf, 0x00, sizeof(buf));
-	buf_size = min(count, (sizeof(buf)-1));
-	if (copy_from_user(buf, userbuf, buf_size))
-		return count;
-	read_lock(&dev_base_lock);
-	if (sdata->dev->reg_state == NETREG_REGISTERED)
-		(*format)(sdata, buf);
-	read_unlock(&dev_base_lock);
-
-	return count;
-}
-#endif
-
 #define IEEE80211_IF_FMT(name, field, format_string)			\
 static ssize_t ieee80211_if_fmt_##name(					\
 	const struct ieee80211_sub_if_data *sdata, char *buf,		\
@@ -71,19 +48,6 @@ static ssize_t ieee80211_if_fmt_##name(	
 {									\
 	return scnprintf(buf, buflen, format_string, sdata->field);	\
 }
-#define IEEE80211_IF_WFMT(name, field, type)				\
-static int ieee80211_if_wfmt_##name(					\
-	struct ieee80211_sub_if_data *sdata, char *buf)			\
-{									\
-	unsigned long tmp;						\
-	char *endp;							\
-									\
-	tmp = simple_strtoul(buf, &endp, 0);				\
-	if ((endp == buf) || ((type)tmp != tmp))			\
-		return -EINVAL;						\
-	sdata->field = tmp;						\
-	return 0;							\
-}
 #define IEEE80211_IF_FMT_DEC(name, field)				\
 		IEEE80211_IF_FMT(name, field, "%d\n")
 #define IEEE80211_IF_FMT_HEX(name, field)				\
@@ -126,34 +90,6 @@ static const struct file_operations name
 		IEEE80211_IF_FMT_##format(name, field)			\
 		__IEEE80211_IF_FILE(name)
 
-#define __IEEE80211_IF_WFILE(name)					\
-static ssize_t ieee80211_if_read_##name(struct file *file,		\
-					char __user *userbuf,		\
-					size_t count, loff_t *ppos)	\
-{									\
-	return ieee80211_if_read(file->private_data,			\
-				 userbuf, count, ppos,			\
-				 ieee80211_if_fmt_##name);		\
-}									\
-static ssize_t ieee80211_if_write_##name(struct file *file,		\
-					const char __user *userbuf,	\
-					size_t count, loff_t *ppos)	\
-{									\
-	return ieee80211_if_write(file->private_data,			\
-				 userbuf, count, ppos,			\
-				 ieee80211_if_wfmt_##name);		\
-}									\
-static const struct file_operations name##_ops = {			\
-	.read = ieee80211_if_read_##name,				\
-	.write = ieee80211_if_write_##name,				\
-	.open = mac80211_open_file_generic,				\
-}
-
-#define IEEE80211_IF_WFILE(name, field, format, type)			\
-		IEEE80211_IF_FMT_##format(name, field)			\
-		IEEE80211_IF_WFMT(name, field, type)			\
-		__IEEE80211_IF_WFILE(name)
-
 /* common attributes */
 IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
 IEEE80211_IF_FILE(force_unicast_rateidx, force_unicast_rateidx, DEC);
@@ -212,30 +148,30 @@ IEEE80211_IF_FILE(dropped_frames_no_rout
 IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC);
 
 /* Mesh parameters */
-IEEE80211_IF_WFILE(dot11MeshMaxRetries,
-		u.mesh.mshcfg.dot11MeshMaxRetries, DEC, u8);
-IEEE80211_IF_WFILE(dot11MeshRetryTimeout,
-		u.mesh.mshcfg.dot11MeshRetryTimeout, DEC, u16);
-IEEE80211_IF_WFILE(dot11MeshConfirmTimeout,
-		u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC, u16);
-IEEE80211_IF_WFILE(dot11MeshHoldingTimeout,
-		u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC, u16);
-IEEE80211_IF_WFILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC, u8);
-IEEE80211_IF_WFILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC, u8);
-IEEE80211_IF_WFILE(dot11MeshMaxPeerLinks,
-		u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC, u16);
-IEEE80211_IF_WFILE(dot11MeshHWMPactivePathTimeout,
-		u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC, u32);
-IEEE80211_IF_WFILE(dot11MeshHWMPpreqMinInterval,
-		u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC, u16);
-IEEE80211_IF_WFILE(dot11MeshHWMPnetDiameterTraversalTime,
-		u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC, u16);
-IEEE80211_IF_WFILE(dot11MeshHWMPmaxPREQretries,
-		u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC, u8);
-IEEE80211_IF_WFILE(path_refresh_time,
-		u.mesh.mshcfg.path_refresh_time, DEC, u32);
-IEEE80211_IF_WFILE(min_discovery_timeout,
-		u.mesh.mshcfg.min_discovery_timeout, DEC, u16);
+IEEE80211_IF_FILE(dot11MeshMaxRetries,
+		u.mesh.mshcfg.dot11MeshMaxRetries, DEC);
+IEEE80211_IF_FILE(dot11MeshRetryTimeout,
+		u.mesh.mshcfg.dot11MeshRetryTimeout, DEC);
+IEEE80211_IF_FILE(dot11MeshConfirmTimeout,
+		u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC);
+IEEE80211_IF_FILE(dot11MeshHoldingTimeout,
+		u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC);
+IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC);
+IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC);
+IEEE80211_IF_FILE(dot11MeshMaxPeerLinks,
+		u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC);
+IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout,
+		u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC);
+IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval,
+		u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC);
+IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime,
+		u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC);
+IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries,
+		u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC);
+IEEE80211_IF_FILE(path_refresh_time,
+		u.mesh.mshcfg.path_refresh_time, DEC);
+IEEE80211_IF_FILE(min_discovery_timeout,
+		u.mesh.mshcfg.min_discovery_timeout, DEC);
 #endif
 
 

Johannes Berg

author maintainer
#0 lore raw

cover mac80211 fixes/cleanups/updates

Here are a few mac80211 patches.

johannes

author maintainer
#1 lore raw

PATCH 1/8 mac80211: fix debugfs lockup

When debugfs_create_dir fails, sta_info_debugfs_add_work will not terminate because it will find the same station again and again. This is possible whenever debugfs fails for whatever reason; one reason is a race condition in mac80211, unfortunately we cannot do much about it, so just document it, it just means some station may be missing from debugfs.

---
 net/mac80211/debugfs_sta.c |   11 +++++++++++
 net/mac80211/sta_info.c    |    7 ++++++-
 net/mac80211/sta_info.h    |    1 +
 3 files changed, 18 insertions(+), 1 deletion(-)
net/mac80211/debugfs_sta.c +11 -0
@@ -249,11 +249,22 @@ void ieee80211_sta_debugfs_add(struct st
 	DECLARE_MAC_BUF(mbuf);
 	u8 *mac;
 
+	sta->debugfs.add_has_run = true;
+
 	if (!stations_dir)
 		return;
 
 	mac = print_mac(mbuf, sta->sta.addr);
 
+	/*
+	 * This might fail due to a race condition:
+	 * When mac80211 unlinks a station, the debugfs entries
+	 * remain, but it is already possible to link a new
+	 * station with the same address which triggers adding
+	 * it to debugfs; therefore, if the old station isn't
+	 * destroyed quickly enough the old station's debugfs
+	 * dir might still be around.
+	 */
 	sta->debugfs.dir = debugfs_create_dir(mac, stations_dir);
 	if (!sta->debugfs.dir)
 		return;
net/mac80211/sta_info.c +6 -1
@@ -635,7 +635,12 @@ static void sta_info_debugfs_add_work(st
 
 		spin_lock_irqsave(&local->sta_lock, flags);
 		list_for_each_entry(tmp, &local->sta_list, list) {
-			if (!tmp->debugfs.dir) {
+			/*
+			 * debugfs.add_has_run will be set by
+			 * ieee80211_sta_debugfs_add regardless
+			 * of what else it does.
+			 */
+			if (!tmp->debugfs.add_has_run) {
 				sta = tmp;
 				__sta_info_pin(sta);
 				break;
net/mac80211/sta_info.h +1 -0
@@ -300,6 +300,7 @@ struct sta_info {
 		struct dentry *inactive_ms;
 		struct dentry *last_seq_ctrl;
 		struct dentry *agg_status;
+		bool add_has_run;
 	} debugfs;
 #endif
 
author maintainer
#12 lore raw

PATCH 5/8 mac80211: remove wiphy_to_hw

In reply to Johannes Berg

This isn't used by anyone, if we ever need it we can add it back, until then it's useless.

---
 include/net/mac80211.h |    2 --
 net/mac80211/cfg.c     |    7 -------
 2 files changed, 9 deletions(-)
include/net/mac80211.h +0 -2
@@ -846,8 +846,6 @@ struct ieee80211_hw {
 	s8 max_signal;
 };
 
-struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy);
-
 /**
  * SET_IEEE80211_DEV - set device for 802.11 hardware
  *
net/mac80211/cfg.c +0 -7
@@ -17,13 +17,6 @@
 #include "rate.h"
 #include "mesh.h"
 
-struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy)
-{
-	struct ieee80211_local *local = wiphy_priv(wiphy);
-	return &local->hw;
-}
-EXPORT_SYMBOL(wiphy_to_hw);
-
 static bool nl80211_type_check(enum nl80211_iftype type)
 {
 	switch (type) {
author maintainer
#14 lore raw

PATCH 7/8 mac80211: remove max_antenna_gain config

In reply to Johannes Berg

The antenna gain isn't exactly configurable, despite the belief of some unnamed individual who thinks that the EEPROM might influence it.

---
 include/net/mac80211.h |    2 --
 net/mac80211/main.c    |    2 --
 2 files changed, 4 deletions(-)
include/net/mac80211.h +0 -2
@@ -456,7 +456,6 @@ enum ieee80211_conf_flags {
  * @listen_interval: listen interval in units of beacon interval
  * @flags: configuration flags defined above
  * @power_level: requested transmit power (in dBm)
- * @max_antenna_gain: maximum antenna gain (in dBi)
  * @antenna_sel_tx: transmit antenna selection, 0: default/diversity,
  *	1/2: antenna 0/1
  * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx
@@ -471,7 +470,6 @@ struct ieee80211_conf {
 	u16 listen_interval;
 	u32 flags;
 	int power_level;
-	int max_antenna_gain;
 	u8 antenna_sel_tx;
 	u8 antenna_sel_rx;
 
net/mac80211/main.c +0 -2
@@ -215,8 +215,6 @@ int ieee80211_hw_config(struct ieee80211
 		local->hw.conf.power_level = min(chan->max_power,
 					       local->hw.conf.power_level);
 
-	local->hw.conf.max_antenna_gain = chan->max_antenna_gain;
-
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
 	printk(KERN_DEBUG "%s: HW CONFIG: freq=%d\n",
 	       wiphy_name(local->hw.wiphy), chan->center_freq);
author maintainer
#15 lore raw

PATCH 8/8 mac80211: fix short slot handling

In reply to Johannes Berg

This patch makes mac80211 handle short slot requests from the AP properly.

---
 include/net/mac80211.h |    8 +++--
 net/mac80211/main.c    |    9 +++--
 net/mac80211/mlme.c    |   74 ++++++++++++++++++++++++++-----------------------
 3 files changed, 52 insertions(+), 39 deletions(-)
net/mac80211/main.c +6 -3
@@ -346,9 +346,12 @@ void ieee80211_bss_info_change_notify(st
 
 u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata)
 {
-	sdata->bss_conf.use_cts_prot = 0;
-	sdata->bss_conf.use_short_preamble = 0;
-	return BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_ERP_PREAMBLE;
+	sdata->bss_conf.use_cts_prot = false;
+	sdata->bss_conf.use_short_preamble = false;
+	sdata->bss_conf.use_short_slot = false;
+	return BSS_CHANGED_ERP_CTS_PROT |
+	       BSS_CHANGED_ERP_PREAMBLE |
+	       BSS_CHANGED_ERP_SLOT;
 }
 
 void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
net/mac80211/mlme.c +40 -34

111 lines not on this page · raw message

include/net/mac80211.h +6 -2
@@ -180,8 +180,12 @@ enum ieee80211_bss_change {
  * @assoc: association status
  * @aid: association ID number, valid only when @assoc is true
  * @use_cts_prot: use CTS protection
- * @use_short_preamble: use 802.11b short preamble
- * @use_short_slot: use short slot time (only relevant for ERP)
+ * @use_short_preamble: use 802.11b short preamble;
+ *	if the hardware cannot handle this it must set the
+ *	IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE hardware flag
+ * @use_short_slot: use short slot time (only relevant for ERP);
+ *	if the hardware cannot handle this it must set the
+ *	IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
  * @dtim_period: num of beacons before the next DTIM, for PSM
  * @timestamp: beacon timestamp
  * @beacon_int: beacon interval
author maintainer
#11 lore raw

PATCH 4/8 mac80211: minor code cleanups

In reply to Johannes Berg

Nothing very interesting, some checkpatch inspired stuff, some other things.

---
 net/mac80211/debugfs_sta.c |    6 +++---
 net/mac80211/main.c        |    2 +-
 net/mac80211/mesh.c        |    2 +-
 net/mac80211/rc80211_pid.h |    2 +-
 net/mac80211/rx.c          |   24 +++++++++++++-----------
 net/mac80211/sta_info.c    |    4 ++--
 net/mac80211/wep.c         |   26 +++++++++++++-------------
 net/mac80211/wep.h         |    2 +-
 net/mac80211/wpa.c         |   29 ++++++++++-------------------
 9 files changed, 45 insertions(+), 52 deletions(-)
net/mac80211/wep.c +13 -13
@@ -49,17 +49,19 @@ void ieee80211_wep_free(struct ieee80211
 	crypto_free_blkcipher(local->wep_rx_tfm);
 }
 
-static inline int ieee80211_wep_weak_iv(u32 iv, int keylen)
+static inline bool ieee80211_wep_weak_iv(u32 iv, int keylen)
 {
-	/* Fluhrer, Mantin, and Shamir have reported weaknesses in the
+	/*
+	 * Fluhrer, Mantin, and Shamir have reported weaknesses in the
 	 * key scheduling algorithm of RC4. At least IVs (KeyByte + 3,
-	 * 0xff, N) can be used to speedup attacks, so avoid using them. */
+	 * 0xff, N) can be used to speedup attacks, so avoid using them.
+	 */
 	if ((iv & 0xff00) == 0xff00) {
 		u8 B = (iv >> 16) & 0xff;
 		if (B >= 3 && B < 3 + keylen)
-			return 1;
+			return true;
 	}
-	return 0;
+	return false;
 }
 
 
@@ -268,7 +270,7 @@ int ieee80211_wep_decrypt(struct ieee802
 }
 
 
-u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key)
+bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key)
 {
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	unsigned int hdrlen;
@@ -276,16 +278,13 @@ u8 * ieee80211_wep_is_weak_iv(struct sk_
 	u32 iv;
 
 	if (!ieee80211_has_protected(hdr->frame_control))
-		return NULL;
+		return false;
 
 	hdrlen = ieee80211_hdrlen(hdr->frame_control);
 	ivpos = skb->data + hdrlen;
 	iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2];
 
-	if (ieee80211_wep_weak_iv(iv, key->conf.keylen))
-		return ivpos;
-
-	return NULL;
+	return ieee80211_wep_weak_iv(iv, key->conf.keylen);
 }
 
 ieee80211_rx_result
@@ -332,6 +331,8 @@ static int wep_encrypt_skb(struct ieee80
 ieee80211_tx_result
 ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx)
 {
+	int i;
+
 	ieee80211_tx_set_protected(tx);
 
 	if (wep_encrypt_skb(tx, tx->skb) < 0) {
@@ -340,9 +341,8 @@ ieee80211_crypto_wep_encrypt(struct ieee
 	}
 
 	if (tx->extra_frag) {
-		int i;
 		for (i = 0; i < tx->num_extra_frag; i++) {
-			if (wep_encrypt_skb(tx, tx->extra_frag[i]) < 0) {
+			if (wep_encrypt_skb(tx, tx->extra_frag[i])) {
 				I802_DEBUG_INC(tx->local->
 					       tx_handlers_drop_wep);
 				return TX_DROP;
net/mac80211/wep.h +1 -1
@@ -26,7 +26,7 @@ int ieee80211_wep_encrypt(struct ieee802
 			  struct ieee80211_key *key);
 int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb,
 			  struct ieee80211_key *key);
-u8 *ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key);
+bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key);
 
 ieee80211_rx_result
 ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx);
net/mac80211/wpa.c +10 -19
@@ -49,8 +49,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
 	    !(tx->flags & IEEE80211_TX_FRAGMENTED) &&
 	    !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) &&
 	    !wpa_test) {
-		/* hwaccel - with no need for preallocated room for Michael MIC
-		 */
+		/* hwaccel - with no need for preallocated room for MMIC */
 		return TX_CONTINUE;
 	}
 
@@ -67,8 +66,6 @@ ieee80211_tx_h_michael_mic_add(struct ie
 #else
 	authenticator = 1;
 #endif
-	/* At this point we know we're using ALG_TKIP. To get the MIC key
-	 * we now will rely on the offset from the ieee80211_key_conf::key */
 	key_offset = authenticator ?
 		NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY :
 		NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY;
@@ -92,9 +89,7 @@ ieee80211_rx_h_michael_mic_verify(struct
 	int authenticator = 1, wpa_test = 0;
 	DECLARE_MAC_BUF(mac);
 
-	/*
-	 * No way to verify the MIC if the hardware stripped it
-	 */
+	/* No way to verify the MIC if the hardware stripped it */
 	if (rx->status->flag & RX_FLAG_MMIC_STRIPPED)
 		return RX_CONTINUE;
 
@@ -116,8 +111,6 @@ ieee80211_rx_h_michael_mic_verify(struct
 #else
 	authenticator = 1;
 #endif
-	/* At this point we know we're using ALG_TKIP. To get the MIC key
-	 * we now will rely on the offset from the ieee80211_key_conf::key */
 	key_offset = authenticator ?
 		NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY :
 		NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY;
@@ -205,6 +198,7 @@ ieee80211_tx_result
 ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
 {
 	struct sk_buff *skb = tx->skb;
+	int i;
 
 	ieee80211_tx_set_protected(tx);
 
@@ -212,9 +206,8 @@ ieee80211_crypto_tkip_encrypt(struct iee
 		return TX_DROP;
 
 	if (tx->extra_frag) {
-		int i;
 		for (i = 0; i < tx->num_extra_frag; i++) {
-			if (tkip_encrypt_skb(tx, tx->extra_frag[i]) < 0)
+			if (tkip_encrypt_skb(tx, tx->extra_frag[i]))
 				return TX_DROP;
 		}
 	}
@@ -353,7 +346,7 @@ static inline void ccmp_pn2hdr(u8 *hdr, 
 }
 
 
-static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr)
+static inline void ccmp_hdr2pn(u8 *pn, u8 *hdr)
 {
 	pn[0] = hdr[7];
 	pn[1] = hdr[6];
@@ -361,7 +354,6 @@ static inline int ccmp_hdr2pn(u8 *pn, u8
 	pn[3] = hdr[4];
 	pn[4] = hdr[1];
 	pn[5] = hdr[0];
-	return (hdr[3] >> 6) & 0x03;
 }
 
 
@@ -379,7 +371,7 @@ static int ccmp_encrypt_skb(struct ieee8
 
 	if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
 	    !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
-		/* hwaccel - with no need for preallocated room for CCMP "
+		/* hwaccel - with no need for preallocated room for CCMP
 		 * header or MIC fields */
 		info->control.hw_key = &tx->key->conf;
 		return 0;
@@ -432,6 +424,7 @@ ieee80211_tx_result
 ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
 {
 	struct sk_buff *skb = tx->skb;
+	int i;
 
 	ieee80211_tx_set_protected(tx);
 
@@ -439,9 +432,8 @@ ieee80211_crypto_ccmp_encrypt(struct iee
 		return TX_DROP;
 
 	if (tx->extra_frag) {
-		int i;
 		for (i = 0; i < tx->num_extra_frag; i++) {
-			if (ccmp_encrypt_skb(tx, tx->extra_frag[i]) < 0)
+			if (ccmp_encrypt_skb(tx, tx->extra_frag[i]))
 				return TX_DROP;
 		}
 	}
@@ -474,7 +466,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
 	    (rx->status->flag & RX_FLAG_IV_STRIPPED))
 		return RX_CONTINUE;
 
-	(void) ccmp_hdr2pn(pn, skb->data + hdrlen);
+	ccmp_hdr2pn(pn, skb->data + hdrlen);
 
 	if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) {
 		key->u.ccmp.replays++;
@@ -489,9 +481,8 @@ ieee80211_crypto_ccmp_decrypt(struct iee
 			    key->u.ccmp.tfm, key->u.ccmp.rx_crypto_buf,
 			    skb->data + hdrlen + CCMP_HDR_LEN, data_len,
 			    skb->data + skb->len - CCMP_MIC_LEN,
-			    skb->data + hdrlen + CCMP_HDR_LEN)) {
+			    skb->data + hdrlen + CCMP_HDR_LEN))
 			return RX_DROP_UNUSABLE;
-		}
 	}
 
 	memcpy(key->u.ccmp.rx_pn[rx->queue], pn, CCMP_PN_LEN);
net/mac80211/debugfs_sta.c +3 -3
@@ -137,7 +137,7 @@ static ssize_t sta_agg_status_read(struc
 	p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:");
 	for (i = 0; i < STA_TID_NUM; i++)
 		p += scnprintf(p, sizeof(buf)+buf-p, "%5d",
-			sta->ampdu_mlme.tid_state_rx[i]?
+			sta->ampdu_mlme.tid_state_rx[i] ?
 			sta->ampdu_mlme.tid_rx[i]->dialog_token : 0);
 
 	p += scnprintf(p, sizeof(buf)+buf-p, "\n TX  :");
@@ -148,13 +148,13 @@ static ssize_t sta_agg_status_read(struc
 	p += scnprintf(p, sizeof(buf)+buf-p, "\n DTKN:");
 	for (i = 0; i < STA_TID_NUM; i++)
 		p += scnprintf(p, sizeof(buf)+buf-p, "%5d",
-			sta->ampdu_mlme.tid_state_tx[i]?
+			sta->ampdu_mlme.tid_state_tx[i] ?
 			sta->ampdu_mlme.tid_tx[i]->dialog_token : 0);
 
 	p += scnprintf(p, sizeof(buf)+buf-p, "\n SSN :");
 	for (i = 0; i < STA_TID_NUM; i++)
 		p += scnprintf(p, sizeof(buf)+buf-p, "%5d",
-			sta->ampdu_mlme.tid_state_tx[i]?
+			sta->ampdu_mlme.tid_state_tx[i] ?
 			sta->ampdu_mlme.tid_tx[i]->ssn : 0);
 
 	p += scnprintf(p, sizeof(buf)+buf-p, "\n");
net/mac80211/main.c +1 -1
@@ -1013,7 +1013,7 @@ static int __init ieee80211_init(void)
 
 	BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb));
 	BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) +
-	             IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb));
+		     IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb));
 
 	ret = rc80211_pid_init();
 	if (ret)
net/mac80211/mesh.c +1 -1
@@ -473,7 +473,7 @@ static void ieee80211_mesh_rx_bcn_presp(
 					size_t len,
 					struct ieee80211_rx_status *rx_status)
 {
-	struct ieee80211_local *local= sdata->local;
+	struct ieee80211_local *local = sdata->local;
 	struct ieee802_11_elems elems;
 	struct ieee80211_channel *channel;
 	u64 supp_rates = 0;
net/mac80211/rc80211_pid.h +1 -1
@@ -49,7 +49,7 @@
 
 /* Arithmetic right shift for positive and negative values for ISO C. */
 #define RC_PID_DO_ARITH_RIGHT_SHIFT(x, y) \
-	(x) < 0 ? -((-(x)) >> (y)) : (x) >> (y)
+	((x) < 0 ? -((-(x)) >> (y)) : (x) >> (y))
 
 enum rc_pid_event_type {
 	RC_PID_EVENT_TYPE_TX_STATUS,
net/mac80211/rx.c +13 -11
@@ -26,10 +26,11 @@
 #include "tkip.h"
 #include "wme.h"
 
-u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
-				struct tid_ampdu_rx *tid_agg_rx,
-				struct sk_buff *skb, u16 mpdu_seq_num,
-				int bar_req);
+static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
+					   struct tid_ampdu_rx *tid_agg_rx,
+					   struct sk_buff *skb,
+					   u16 mpdu_seq_num,
+					   int bar_req);
 /*
  * monitor mode reception
  *
@@ -2000,17 +2001,17 @@ static void __ieee80211_rx_handle_packet
 
 static inline int seq_less(u16 sq1, u16 sq2)
 {
-	return (((sq1 - sq2) & SEQ_MASK) > (SEQ_MODULO >> 1));
+	return ((sq1 - sq2) & SEQ_MASK) > (SEQ_MODULO >> 1);
 }
 
 static inline u16 seq_inc(u16 sq)
 {
-	return ((sq + 1) & SEQ_MASK);
+	return (sq + 1) & SEQ_MASK;
 }
 
 static inline u16 seq_sub(u16 sq1, u16 sq2)
 {
-	return ((sq1 - sq2) & SEQ_MASK);
+	return (sq1 - sq2) & SEQ_MASK;
 }
 
 
@@ -2018,10 +2019,11 @@ static inline u16 seq_sub(u16 sq1, u16 s
  * As it function blongs to Rx path it must be called with
  * the proper rcu_read_lock protection for its flow.
  */
-u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
-				struct tid_ampdu_rx *tid_agg_rx,
-				struct sk_buff *skb, u16 mpdu_seq_num,
-				int bar_req)
+static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
+					   struct tid_ampdu_rx *tid_agg_rx,
+					   struct sk_buff *skb,
+					   u16 mpdu_seq_num,
+					   int bar_req)
 {
 	struct ieee80211_local *local = hw_to_local(hw);
 	struct ieee80211_rx_status status;
net/mac80211/sta_info.c +2 -2
@@ -294,7 +294,7 @@ int sta_info_insert(struct sta_info *sta
 	}
 
 	if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->dev->dev_addr) == 0 ||
-	            is_multicast_ether_addr(sta->sta.addr))) {
+		    is_multicast_ether_addr(sta->sta.addr))) {
 		err = -EINVAL;
 		goto out_free;
 	}
@@ -830,7 +830,7 @@ void ieee80211_sta_expire(struct ieee802
 }
 
 struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
-                                         const u8 *addr)
+					 const u8 *addr)
 {
 	struct sta_info *sta = sta_info_get(hw_to_local(hw), addr);
 
#10 lore raw

Re: [PATCH 3/8] mac80211: remove writable debugs mesh parameters

In reply to Johannes Berg

Johannes,

Quoted 3 lines · Johannes Berg

These parameters shouldn't be configurable via debugfs, if they need to be configurable nl80211 support has to be added, if not then they don't need to be writable here either.

Ack (on behalf of Luisca as well, who is on sabbatical somewhere in Asia...)

Javier

Quoted 153 lines
Cc Javier Cardona <[email protected]>
Cc Luis Carlos Cobo <[email protected]>
---
 net/mac80211/debugfs_netdev.c |  112 +++++++++---------------------------------
 1 file changed, 24 insertions(+), 88 deletions(-)
net/mac80211/debugfs_netdev.c 2008-10-07 11:27:00.000000000 +0200 renamed from net/mac80211/debugfs_netdev.c 2008-10-07 11:26:52.000000000 +0200 +24 -89
@@ -41,29 +41,6 @@ static ssize_t ieee80211_if_read(
       return ret;
 }
 
-#ifdef CONFIG_MAC80211_MESH
-static ssize_t ieee80211_if_write(
-       struct ieee80211_sub_if_data *sdata,
-       char const __user *userbuf,
-       size_t count, loff_t *ppos,
-       int (*format)(struct ieee80211_sub_if_data *, char *))
-{
-       char buf[10];
-       int buf_size;
-
-       memset(buf, 0x00, sizeof(buf));
-       buf_size = min(count, (sizeof(buf)-1));
-       if (copy_from_user(buf, userbuf, buf_size))
-               return count;
-       read_lock(&dev_base_lock);
-       if (sdata->dev->reg_state == NETREG_REGISTERED)
-               (*format)(sdata, buf);
-       read_unlock(&dev_base_lock);
-
-       return count;
-}
-#endif
-
 #define IEEE80211_IF_FMT(name, field, format_string)                   \
 static ssize_t ieee80211_if_fmt_##name(                                        \
       const struct ieee80211_sub_if_data *sdata, char *buf,           \
@@ -71,19 +48,6 @@ static ssize_t ieee80211_if_fmt_##name(
 {                                                                      \
       return scnprintf(buf, buflen, format_string, sdata->field);     \
 }
-#define IEEE80211_IF_WFMT(name, field, type)                           \
-static int ieee80211_if_wfmt_##name(                                   \
-       struct ieee80211_sub_if_data *sdata, char *buf)                 \
-{                                                                      \
-       unsigned long tmp;                                              \
-       char *endp;                                                     \
-                                                                       \
-       tmp = simple_strtoul(buf, &endp, 0);                            \
-       if ((endp == buf) || ((type)tmp != tmp))                        \
-               return -EINVAL;                                         \
-       sdata->field = tmp;                                             \
-       return 0;                                                       \
-}
 #define IEEE80211_IF_FMT_DEC(name, field)                              \
               IEEE80211_IF_FMT(name, field, "%d\n")
 #define IEEE80211_IF_FMT_HEX(name, field)                              \
@@ -126,34 +90,6 @@ static const struct file_operations name
               IEEE80211_IF_FMT_##format(name, field)                  \
               __IEEE80211_IF_FILE(name)
 
-#define __IEEE80211_IF_WFILE(name)                                     \
-static ssize_t ieee80211_if_read_##name(struct file *file,             \
-                                       char __user *userbuf,           \
-                                       size_t count, loff_t *ppos)     \
-{                                                                      \
-       return ieee80211_if_read(file->private_data,                    \
-                                userbuf, count, ppos,                  \
-                                ieee80211_if_fmt_##name);              \
-}                                                                      \
-static ssize_t ieee80211_if_write_##name(struct file *file,            \
-                                       const char __user *userbuf,     \
-                                       size_t count, loff_t *ppos)     \
-{                                                                      \
-       return ieee80211_if_write(file->private_data,                   \
-                                userbuf, count, ppos,                  \
-                                ieee80211_if_wfmt_##name);             \
-}                                                                      \
-static const struct file_operations name##_ops = {                     \
-       .read = ieee80211_if_read_##name,                               \
-       .write = ieee80211_if_write_##name,                             \
-       .open = mac80211_open_file_generic,                             \
-}
-
-#define IEEE80211_IF_WFILE(name, field, format, type)                  \
-               IEEE80211_IF_FMT_##format(name, field)                  \
-               IEEE80211_IF_WFMT(name, field, type)                    \
-               __IEEE80211_IF_WFILE(name)
-
 /* common attributes */
 IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
 IEEE80211_IF_FILE(force_unicast_rateidx, force_unicast_rateidx, DEC);
@@ -212,30 +148,30 @@ IEEE80211_IF_FILE(dropped_frames_no_rout
 IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC);
 
 /* Mesh parameters */
-IEEE80211_IF_WFILE(dot11MeshMaxRetries,
-               u.mesh.mshcfg.dot11MeshMaxRetries, DEC, u8);
-IEEE80211_IF_WFILE(dot11MeshRetryTimeout,
-               u.mesh.mshcfg.dot11MeshRetryTimeout, DEC, u16);
-IEEE80211_IF_WFILE(dot11MeshConfirmTimeout,
-               u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC, u16);
-IEEE80211_IF_WFILE(dot11MeshHoldingTimeout,
-               u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC, u16);
-IEEE80211_IF_WFILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC, u8);
-IEEE80211_IF_WFILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC, u8);
-IEEE80211_IF_WFILE(dot11MeshMaxPeerLinks,
-               u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC, u16);
-IEEE80211_IF_WFILE(dot11MeshHWMPactivePathTimeout,
-               u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC, u32);
-IEEE80211_IF_WFILE(dot11MeshHWMPpreqMinInterval,
-               u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC, u16);
-IEEE80211_IF_WFILE(dot11MeshHWMPnetDiameterTraversalTime,
-               u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC, u16);
-IEEE80211_IF_WFILE(dot11MeshHWMPmaxPREQretries,
-               u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC, u8);
-IEEE80211_IF_WFILE(path_refresh_time,
-               u.mesh.mshcfg.path_refresh_time, DEC, u32);
-IEEE80211_IF_WFILE(min_discovery_timeout,
-               u.mesh.mshcfg.min_discovery_timeout, DEC, u16);
+IEEE80211_IF_FILE(dot11MeshMaxRetries,
+               u.mesh.mshcfg.dot11MeshMaxRetries, DEC);
+IEEE80211_IF_FILE(dot11MeshRetryTimeout,
+               u.mesh.mshcfg.dot11MeshRetryTimeout, DEC);
+IEEE80211_IF_FILE(dot11MeshConfirmTimeout,
+               u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC);
+IEEE80211_IF_FILE(dot11MeshHoldingTimeout,
+               u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC);
+IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC);
+IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC);
+IEEE80211_IF_FILE(dot11MeshMaxPeerLinks,
+               u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC);
+IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout,
+               u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC);
+IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval,
+               u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC);
+IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime,
+               u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC);
+IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries,
+               u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC);
+IEEE80211_IF_FILE(path_refresh_time,
+               u.mesh.mshcfg.path_refresh_time, DEC);
+IEEE80211_IF_FILE(min_discovery_timeout,
+               u.mesh.mshcfg.min_discovery_timeout, DEC);
 #endif
 
 
 
--
Signature · 2 lines
Javier Cardona
cozybit Inc.
#3 lore raw

Re: [PATCH 2/8] mac80211: remove aggregation status write support from debugfs

In reply to Johannes Berg
Quoted 1 line · Johannes Berg

This code uses static variables and thus cannot be kept.

NACK
Need something to debug this stuff
Tomas

Quoted 102 lines
---
 net/mac80211/debugfs_sta.c |   73 ---------------------------------------------
 1 file changed, 1 insertion(+), 72 deletions(-)
net/mac80211/debugfs_sta.c 2008-10-07 11:26:59.000000000 +0200 renamed from net/mac80211/debugfs_sta.c 2008-10-07 11:26:58.000000000 +0200 +1 -74
@@ -39,13 +39,6 @@ static const struct file_operations sta_
       .open = mac80211_open_file_generic,                             \
 }
 
-#define STA_OPS_WR(name)                                               \
-static const struct file_operations sta_ ##name## _ops = {             \
-       .read = sta_##name##_read,                                      \
-       .write = sta_##name##_write,                                    \
-       .open = mac80211_open_file_generic,                             \
-}
-
 #define STA_FILE(name, field, format)                                  \
               STA_READ_##format(name, field)                          \
               STA_OPS(name)
@@ -168,71 +161,7 @@ static ssize_t sta_agg_status_read(struc
 
       return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
 }
-
-static ssize_t sta_agg_status_write(struct file *file,
-               const char __user *user_buf, size_t count, loff_t *ppos)
-{
-       struct sta_info *sta = file->private_data;
-       struct ieee80211_local *local = sta->sdata->local;
-       struct ieee80211_hw *hw = &local->hw;
-       u8 *da = sta->sta.addr;
-       static int tid_static_tx[16] = {0, 0, 0, 0, 0, 0, 0, 0,
-                                       0, 0, 0, 0, 0, 0, 0, 0};
-       static int tid_static_rx[16] = {1, 1, 1, 1, 1, 1, 1, 1,
-                                       1, 1, 1, 1, 1, 1, 1, 1};
-       char *endp;
-       char buf[32];
-       int buf_size, rs;
-       unsigned int tid_num;
-       char state[4];
-
-       memset(buf, 0x00, sizeof(buf));
-       buf_size = min(count, (sizeof(buf)-1));
-       if (copy_from_user(buf, user_buf, buf_size))
-               return -EFAULT;
-
-       tid_num = simple_strtoul(buf, &endp, 0);
-       if (endp == buf)
-               return -EINVAL;
-
-       if ((tid_num >= 100) && (tid_num <= 115)) {
-               /* toggle Rx aggregation command */
-               tid_num = tid_num - 100;
-               if (tid_static_rx[tid_num] == 1) {
-                       strcpy(state, "off ");
-                       ieee80211_sta_stop_rx_ba_session(sta->sdata, da, tid_num, 0,
-                                       WLAN_REASON_QSTA_REQUIRE_SETUP);
-                       sta->ampdu_mlme.tid_state_rx[tid_num] |=
-                                       HT_AGG_STATE_DEBUGFS_CTL;
-                       tid_static_rx[tid_num] = 0;
-               } else {
-                       strcpy(state, "on ");
-                       sta->ampdu_mlme.tid_state_rx[tid_num] &=
-                                       ~HT_AGG_STATE_DEBUGFS_CTL;
-                       tid_static_rx[tid_num] = 1;
-               }
-               printk(KERN_DEBUG "debugfs - try switching tid %u %s\n",
-                               tid_num, state);
-       } else if ((tid_num >= 0) && (tid_num <= 15)) {
-               /* toggle Tx aggregation command */
-               if (tid_static_tx[tid_num] == 0) {
-                       strcpy(state, "on ");
-                       rs =  ieee80211_start_tx_ba_session(hw, da, tid_num);
-                       if (rs == 0)
-                               tid_static_tx[tid_num] = 1;
-               } else {
-                       strcpy(state, "off");
-                       rs =  ieee80211_stop_tx_ba_session(hw, da, tid_num, 1);
-                       if (rs == 0)
-                               tid_static_tx[tid_num] = 0;
-               }
-               printk(KERN_DEBUG "debugfs - switching tid %u %s, return=%d\n",
-                               tid_num, state, rs);
-       }
-
-       return count;
-}
-STA_OPS_WR(agg_status);
+STA_OPS(agg_status);
 
 #define DEBUGFS_ADD(name) \
       sta->debugfs.name = debugfs_create_file(#name, 0400, \
 
--
 
--

To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#4 lore raw

Re: [PATCH 2/8] mac80211: remove aggregation status write support from debugfs

Quoted 5 lines · Tomas Winkler
Quoted 1 line · Johannes Berg

This code uses static variables and thus cannot be kept.

NACK
Need something to debug this stuff

Tough luck. Go write proper support in nl80211 then.

johannes

author maintainer
#16 lore raw

PATCH v2 8/8 mac80211: fix short slot handling

In reply to Johannes Berg

This patch makes mac80211 handle short slot requests from the AP properly. Also warn about uses of IEEE80211_CONF_SHORT_SLOT_TIME and optimise out the code since it cannot ever be hit anyway.

---
 include/net/mac80211.h |   15 +++++++--
 net/mac80211/main.c    |    9 +++--
 net/mac80211/mlme.c    |   74 ++++++++++++++++++++++++++-----------------------
 3 files changed, 58 insertions(+), 40 deletions(-)
net/mac80211/main.c +6 -3
@@ -346,9 +346,12 @@ void ieee80211_bss_info_change_notify(st
 
 u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata)
 {
-	sdata->bss_conf.use_cts_prot = 0;
-	sdata->bss_conf.use_short_preamble = 0;
-	return BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_ERP_PREAMBLE;
+	sdata->bss_conf.use_cts_prot = false;
+	sdata->bss_conf.use_short_preamble = false;
+	sdata->bss_conf.use_short_slot = false;
+	return BSS_CHANGED_ERP_CTS_PROT |
+	       BSS_CHANGED_ERP_PREAMBLE |
+	       BSS_CHANGED_ERP_SLOT;
 }
 
 void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
net/mac80211/mlme.c +40 -34

111 lines not on this page · raw message

include/net/mac80211.h +12 -3
@@ -180,8 +180,12 @@ enum ieee80211_bss_change {
  * @assoc: association status
  * @aid: association ID number, valid only when @assoc is true
  * @use_cts_prot: use CTS protection
- * @use_short_preamble: use 802.11b short preamble
- * @use_short_slot: use short slot time (only relevant for ERP)
+ * @use_short_preamble: use 802.11b short preamble;
+ *	if the hardware cannot handle this it must set the
+ *	IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE hardware flag
+ * @use_short_slot: use short slot time (only relevant for ERP);
+ *	if the hardware cannot handle this it must set the
+ *	IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
  * @dtim_period: num of beacons before the next DTIM, for PSM
  * @timestamp: beacon timestamp
  * @beacon_int: beacon interval
@@ -453,12 +457,17 @@ enum ieee80211_conf_flags {
 	 * have been converted to use bss_info_changed() for slot time
 	 * configuration
 	 */
-	IEEE80211_CONF_SHORT_SLOT_TIME	= (1<<0),
 	IEEE80211_CONF_RADIOTAP		= (1<<1),
 	IEEE80211_CONF_SUPPORT_HT_MODE	= (1<<2),
 	IEEE80211_CONF_PS		= (1<<3),
 };
 
+static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
+{
+	return 0;
+}
+#define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
+
 /**
  * struct ieee80211_conf - configuration of the device
  *
author maintainer
#17 lore raw

PATCH v3 8/8 mac80211: fix short slot handling

This patch makes mac80211 handle short slot requests from the AP properly. Also warn about uses of IEEE80211_CONF_SHORT_SLOT_TIME and optimise out the code since it cannot ever be hit anyway.

---
v3: fix comments

 include/net/mac80211.h |   28 ++++++++++--------
 net/mac80211/main.c    |    9 +++--
 net/mac80211/mlme.c    |   74 ++++++++++++++++++++++++++-----------------------
 3 files changed, 62 insertions(+), 49 deletions(-)
net/mac80211/main.c +6 -3
@@ -346,9 +346,12 @@ void ieee80211_bss_info_change_notify(st
 
 u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata)
 {
-	sdata->bss_conf.use_cts_prot = 0;
-	sdata->bss_conf.use_short_preamble = 0;
-	return BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_ERP_PREAMBLE;
+	sdata->bss_conf.use_cts_prot = false;
+	sdata->bss_conf.use_short_preamble = false;
+	sdata->bss_conf.use_short_slot = false;
+	return BSS_CHANGED_ERP_CTS_PROT |
+	       BSS_CHANGED_ERP_PREAMBLE |
+	       BSS_CHANGED_ERP_SLOT;
 }
 
 void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
net/mac80211/mlme.c +40 -34

111 lines not on this page · raw message

include/net/mac80211.h +16 -12
@@ -180,8 +180,12 @@ enum ieee80211_bss_change {
  * @assoc: association status
  * @aid: association ID number, valid only when @assoc is true
  * @use_cts_prot: use CTS protection
- * @use_short_preamble: use 802.11b short preamble
- * @use_short_slot: use short slot time (only relevant for ERP)
+ * @use_short_preamble: use 802.11b short preamble;
+ *	if the hardware cannot handle this it must set the
+ *	IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE hardware flag
+ * @use_short_slot: use short slot time (only relevant for ERP);
+ *	if the hardware cannot handle this it must set the
+ *	IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
  * @dtim_period: num of beacons before the next DTIM, for PSM
  * @timestamp: beacon timestamp
  * @beacon_int: beacon interval
@@ -442,23 +446,23 @@ struct ieee80211_rx_status {
  *
  * Flags to define PHY configuration options
  *
- * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time
  * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
  * @IEEE80211_CONF_SUPPORT_HT_MODE: use 802.11n HT capabilities (if supported)
  * @IEEE80211_CONF_PS: Enable 802.11 power save mode
  */
 enum ieee80211_conf_flags {
-	/*
-	 * TODO: IEEE80211_CONF_SHORT_SLOT_TIME will be removed once drivers
-	 * have been converted to use bss_info_changed() for slot time
-	 * configuration
-	 */
-	IEEE80211_CONF_SHORT_SLOT_TIME	= (1<<0),
-	IEEE80211_CONF_RADIOTAP		= (1<<1),
-	IEEE80211_CONF_SUPPORT_HT_MODE	= (1<<2),
-	IEEE80211_CONF_PS		= (1<<3),
+	IEEE80211_CONF_RADIOTAP		= (1<<0),
+	IEEE80211_CONF_SUPPORT_HT_MODE	= (1<<1),
+	IEEE80211_CONF_PS		= (1<<2),
 };
 
+/* XXX: remove all this once drivers stop trying to use it */
+static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
+{
+	return 0;
+}
+#define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
+
 /**
  * struct ieee80211_conf - configuration of the device
  *
#5 lore raw

Re: [PATCH 2/8] mac80211: remove aggregation status write support from debugfs

In reply to Johannes Berg
Quoted 8 lines · Johannes Berg
Quoted 5 lines · Tomas Winkler
Quoted 1 line · Johannes Berg

This code uses static variables and thus cannot be kept.

NACK
Need something to debug this stuff

Tough luck. Go write proper support in nl80211 then.

Someone has some patch to use nl80211 for this BTW. *cough*

Luis

author maintainer
#6 lore raw

Re: [PATCH 2/8] mac80211: remove aggregation status write support from debugfs

Quoted 5 lines · Luis R. Rodriguez
Quoted 3 lines · Johannes Berg
Quoted 2 lines · Tomas Winkler

On Tue, Oct 7, 2008 at 12:04 PM, Johannes Berg
<[email protected]> wrote:

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

This code uses static variables and thus cannot be kept.

NACK
Need something to debug this stuff

Tough luck. Go write proper support in nl80211 then.

Someone has some patch to use nl80211 for this BTW. *cough*

Who what where? Andrey said he was going to work on it?

johannes

#7 lore raw

Re: [PATCH 2/8] mac80211: remove aggregation status write support from debugfs

In reply to Luis R. Rodriguez

Yes, this adds two nl80211 commands (NEW_BA and DEL_BA)
https://cozybit1.dnsalias.org/~andrey/patches/001-add-ba-session-command-nl80211.patch
and this adds corresponding "station addba" and "station delba" options for them to iw:
https://cozybit1.dnsalias.org/~andrey/patches/002-iw-add-nl80211-ba-commands.patch

With the current code, I am not sure if it's ever intended that user space has the ability to initiate and tear down BA sessions, so this may or may not be useful to others. Right now I am using them to test BA initiation and teardown and I suspect that they may be useful to, for example, hostapd in the future.

Please let me know what you think. Thanks,

-Andrey

Quoted 15 lines · Luis R. Rodriguez
Quoted 8 lines · Johannes Berg
Quoted 5 lines · Tomas Winkler
Quoted 1 line · Johannes Berg

This code uses static variables and thus cannot be kept.

NACK
Need something to debug this stuff

Tough luck. Go write proper support in nl80211 then.

Someone has some patch to use nl80211 for this BTW. *cough*

Luis

author maintainer
#8 lore raw

Re: [PATCH 2/8] mac80211: remove aggregation status write support from debugfs

Quoted 7 lines · Andrey Yurovsky

With the current code, I am not sure if it's ever intended that user space has the ability to initiate and tear down BA sessions, so this may or may not be useful to others. Right now I am using them to test BA initiation and teardown and I suspect that they may be useful to, for example, hostapd in the future.

Please let me know what you think. Thanks,

Without looking at the code, is this really useful for much except debugging? Shouldn't the rate control algorithm be in a much better position to make that decision?

johannes