Search Linux Wireless

[PATCH 4/6] mac80211: remove global tsinfo debugfs variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



remove global tsinfo debugfs variables

Signed-off-by: Zhu Yi <yi.zhu@xxxxxxxxx>
---
 net/mac80211/debugfs_netdev.c  |   33 +++++++++++++++------------------
 net/mac80211/ieee80211_i.h     |    4 ++++
 net/mac80211/ieee80211_iface.c |    8 ++++++++
 3 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 7be0d90..a1c5fcc 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -87,16 +87,6 @@ static const struct file_operations name##_ops = {			\
 		IEEE80211_IF_FMT_##format(name, field)			\
 		__IEEE80211_IF_FILE(name)
 
-static struct ieee80211_elem_tspec _tspec = {
-	.nominal_msdu_size = 200,
-	.inactivity_interval = 40,
-	.mean_data_rate = 40000,
-	.min_phy_rate = 6000000,
-	.surplus_band_allow = 8192,
-	.medium_time = 30,
-};
-static u8 _dls_mac[ETH_ALEN];
-
 #define DEBUGFS_QOS_FILE(name, f)					\
 static ssize_t qos_ ##name## _write(struct file *file,			\
 				    const char __user *userbuf,		\
@@ -104,7 +94,7 @@ static ssize_t qos_ ##name## _write(struct file *file,			\
 {									\
 	struct ieee80211_sub_if_data *sdata = file->private_data;	\
 									\
-	f(sdata->dev, &sdata->u.sta, &_tspec);				\
+	f(sdata->dev, &sdata->u.sta, &sdata->u.sta.tspec);				\
 									\
 	return count;							\
 }									\
@@ -132,7 +122,8 @@ DEBUGFS_QOS_FILE(delts_wmm, wmm_send_delts);
 static ssize_t qos_if_dls_mac(const struct ieee80211_sub_if_data *sdata,
 			      char *buf, int buflen)
 {
-	return scnprintf(buf, buflen, MAC_FMT "\n", MAC_ARG(_dls_mac));
+	return scnprintf(buf, buflen, MAC_FMT "\n",
+			 MAC_ARG(sdata->u.sta.dls_mac));
 }
 
 static ssize_t qos_dls_mac_read(struct file *file,
@@ -163,7 +154,7 @@ static ssize_t qos_dls_mac_write(struct file *file, const char __user *userbuf,
 		printk(KERN_ERR "%s: sscanf input error\n", sdata->dev->name);
 		return -EINVAL;
 	}
-	memcpy(_dls_mac, m, ETH_ALEN);
+	memcpy(sdata->u.sta.dls_mac, m, ETH_ALEN);
 	return count;
 }
 
@@ -207,10 +198,12 @@ static ssize_t qos_dls_op_write(struct file *file, const char __user *userbuf,
 	}
 	switch (opt) {
 	case 1:
-		ieee80211_send_dls_req(sdata->dev, &sdata->u.sta, _dls_mac, 0);
+		ieee80211_send_dls_req(sdata->dev, &sdata->u.sta,
+				       sdata->u.sta.dls_mac, 0);
 		break;
 	case 2:
-		ieee80211_send_dls_teardown(sdata->dev, &sdata->u.sta, _dls_mac,
+		ieee80211_send_dls_teardown(sdata->dev, &sdata->u.sta,
+					    sdata->u.sta.dls_mac,
 					    WLAN_REASON_QSTA_NOT_USE);
 		break;
 	default:
@@ -232,8 +225,9 @@ static ssize_t tsinfo_ ##_name## _read(struct file *file,		\
 				       size_t count, loff_t *ppos)	\
 {									\
 	char buf[20];							\
+	struct ieee80211_sub_if_data *sdata = file->private_data;	\
 	int res = scnprintf(buf, count, "%u\n",				\
-			IEEE80211_TSINFO_## _name (_tspec.ts_info));	\
+		IEEE80211_TSINFO_## _name (sdata->u.sta.tspec.ts_info));\
 	return simple_read_from_buffer(userbuf, count, ppos, buf, res);	\
 }									\
 									\
@@ -244,6 +238,7 @@ static ssize_t tsinfo_ ##_name## _write(struct file *file,		\
 	char buf[20];							\
 	size_t size;							\
 	int val;							\
+	struct ieee80211_sub_if_data *sdata = file->private_data;	\
 									\
 	size = min(sizeof(buf) - 1, count);				\
 	buf[size] = '\0';						\
@@ -298,7 +293,8 @@ static ssize_t tspec_ ##name## _read(struct file *file,			\
 				      size_t count, loff_t *ppos)	\
 {									\
 	char buf[20];							\
-	int res = scnprintf(buf, count, "%u\n", _tspec.name);		\
+	struct ieee80211_sub_if_data *sdata = file->private_data;	\
+	int res = scnprintf(buf, count, "%u\n", sdata->u.sta.tspec.name);\
 	return simple_read_from_buffer(userbuf, count, ppos, buf, res);	\
 }									\
 									\
@@ -308,13 +304,14 @@ static ssize_t tspec_ ##name## _write(struct file *file,		\
 {									\
 	char buf[20];							\
 	size_t size;							\
+	struct ieee80211_sub_if_data *sdata = file->private_data;	\
 									\
 	size = min(sizeof(buf) - 1, count);				\
 	buf[size] = '\0';						\
 	if (copy_from_user(buf, userbuf, size))				\
 		return -EFAULT;						\
 									\
-	_tspec.name = simple_strtoul(buf, NULL, 0);			\
+	sdata->u.sta.tspec.name = simple_strtoul(buf, NULL, 0);		\
 	return count;							\
 }									\
 									\
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 2bb34ff..cba1114 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -296,6 +296,10 @@ struct ieee80211_if_sta {
 #define STA_TSDIR_NUM  2
 	/* EDCA: 0~7, HCCA: 8~15 */
 	struct sta_ts_data ts_data[STA_TSID_NUM][STA_TSDIR_NUM];
+#ifdef CONFIG_MAC80211_DEBUGFS
+	struct ieee80211_elem_tspec tspec;
+	u8 dls_mac[ETH_ALEN];
+#endif
 };
 
 
diff --git a/net/mac80211/ieee80211_iface.c b/net/mac80211/ieee80211_iface.c
index c5c8bab..f4a6500 100644
--- a/net/mac80211/ieee80211_iface.c
+++ b/net/mac80211/ieee80211_iface.c
@@ -198,6 +198,14 @@ void ieee80211_if_set_type(struct net_device *dev, int type)
 		/* Initialize non-AP QSTA QoS Params */
 		ifsta->dot11EDCAAveragingPeriod = 5;
 		ifsta->MPDUExchangeTime = 0;
+#ifdef CONFIG_MAC80211_DEBUGFS
+		ifsta->tspec.nominal_msdu_size = 200,
+		ifsta->tspec.inactivity_interval = 40,
+		ifsta->tspec.mean_data_rate = 40000,
+		ifsta->tspec.min_phy_rate = 6000000,
+		ifsta->tspec.surplus_band_allow = 8192,
+		ifsta->tspec.medium_time = 30,
+#endif
 
 		msdata = IEEE80211_DEV_TO_SUB_IF(sdata->local->mdev);
 		sdata->bss = &msdata->u.ap;
-- 
1.5.0.rc2.g73a2
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux