* debug patches
@ 2007-07-19 17:43 Johannes Berg
0 siblings, 0 replies; only message in thread
From: Johannes Berg @ 2007-07-19 17:43 UTC (permalink / raw)
To: linux-wireless
[-- Attachment #1.1: Type: text/plain, Size: 113 bytes --]
27 and 31 could be applied, but look at the other patches for how crap
the master device really is
johannes
[-- Attachment #1.2: 026-mdev-show-subif.patch --]
[-- Type: text/x-vhdl, Size: 1847 bytes --]
---
net/mac80211/ieee80211.c | 1 +
net/mac80211/ieee80211_i.h | 23 +++++++++++++++++++----
2 files changed, 20 insertions(+), 4 deletions(-)
--- wireless-dev.orig/net/mac80211/ieee80211_i.h 2007-07-19 14:59:13.892204414 +0200
+++ wireless-dev/net/mac80211/ieee80211_i.h 2007-07-19 15:36:09.473857384 +0200
@@ -444,7 +444,25 @@ struct ieee80211_sub_if_data {
#endif
};
-#define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev)
+/* for wiphy privid */
+extern void *mac80211_wiphy_privid;
+
+#define IEEE80211_DEV_TO_SUB_IF_NW(dev) netdev_priv(dev)
+
+#define IEEE80211_DEV_TO_SUB_IF(dev) ({ \
+ struct ieee80211_sub_if_data *__sdata; \
+ \
+ __sdata = netdev_priv(dev); \
+ \
+ if (dev->ieee80211_ptr && dev->ieee80211_ptr->wiphy && \
+ dev->ieee80211_ptr->wiphy->privid == mac80211_wiphy_privid&&\
+ __sdata->local->mdev == dev) { \
+ printk(KERN_DEBUG "IEEE80211_DEV_TO_SUB_IF(mdev) usage\n");\
+ dump_stack(); \
+ } \
+ \
+ __sdata; \
+ })
enum {
IEEE80211_RX_MSG = 1,
@@ -916,7 +934,4 @@ void ieee80211_if_del_mgmt(struct ieee80
void ieee80211_regdomain_init(void);
void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode);
-/* for wiphy privid */
-extern void *mac80211_wiphy_privid;
-
#endif /* IEEE80211_I_H */
--- wireless-dev.orig/net/mac80211/ieee80211.c 2007-07-19 15:21:14.642204414 +0200
+++ wireless-dev/net/mac80211/ieee80211.c 2007-07-19 15:35:50.593857384 +0200
@@ -42,6 +42,7 @@
/* privid for wiphys to determine whether they belong to us or not */
void *mac80211_wiphy_privid = &mac80211_wiphy_privid;
+EXPORT_SYMBOL_GPL(mac80211_wiphy_privid);
/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
[-- Attachment #1.3: 027-if_add_reduce.patch --]
[-- Type: text/x-vhdl, Size: 4991 bytes --]
---
net/mac80211/ieee80211.c | 2 +-
net/mac80211/ieee80211_cfg.c | 2 +-
net/mac80211/ieee80211_i.h | 2 +-
net/mac80211/ieee80211_iface.c | 7 +------
net/mac80211/ieee80211_ioctl.c | 11 +++++------
5 files changed, 9 insertions(+), 15 deletions(-)
--- wireless-dev.orig/net/mac80211/ieee80211.c 2007-07-19 15:35:50.593857384 +0200
+++ wireless-dev/net/mac80211/ieee80211.c 2007-07-19 15:36:12.863857384 +0200
@@ -5183,7 +5183,7 @@ int ieee80211_register_hw(struct ieee802
ieee80211_install_qdisc(local->mdev);
/* add one default STA interface */
- result = ieee80211_if_add(local->mdev, "wlan%d", NULL,
+ result = ieee80211_if_add(local, "wlan%d", NULL,
IEEE80211_IF_TYPE_STA);
if (result)
printk(KERN_WARNING "%s: Failed to add default virtual iface\n",
--- wireless-dev.orig/net/mac80211/ieee80211_cfg.c 2007-07-19 15:35:50.653857384 +0200
+++ wireless-dev/net/mac80211/ieee80211_cfg.c 2007-07-19 15:36:12.863857384 +0200
@@ -44,7 +44,7 @@ static int ieee80211_add_iface(struct wi
return -EINVAL;
}
- return ieee80211_if_add(local->mdev, name, NULL, itype);
+ return ieee80211_if_add(local, name, NULL, itype);
}
static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex)
--- wireless-dev.orig/net/mac80211/ieee80211_i.h 2007-07-19 15:36:09.473857384 +0200
+++ wireless-dev/net/mac80211/ieee80211_i.h 2007-07-19 15:36:12.863857384 +0200
@@ -918,7 +918,7 @@ void dls_info_stop(struct ieee80211_if_s
int dls_link_status(struct ieee80211_local *local, u8 *addr);
/* ieee80211_iface.c */
-int ieee80211_if_add(struct net_device *dev, const char *name,
+int ieee80211_if_add(struct ieee80211_local *local, const char *name,
struct net_device **new_dev, int type);
void ieee80211_if_set_type(struct net_device *dev, int type);
void ieee80211_if_reinit(struct net_device *dev);
--- wireless-dev.orig/net/mac80211/ieee80211_iface.c 2007-07-19 15:35:50.513857384 +0200
+++ wireless-dev/net/mac80211/ieee80211_iface.c 2007-07-19 15:36:12.863857384 +0200
@@ -37,11 +37,10 @@ static void ieee80211_if_sdata_deinit(st
}
/* Must be called with rtnl lock held. */
-int ieee80211_if_add(struct net_device *dev, const char *name,
+int ieee80211_if_add(struct ieee80211_local *local, const char *name,
struct net_device **new_dev, int type)
{
struct net_device *ndev;
- struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_sub_if_data *sdata = NULL;
int ret;
@@ -56,10 +55,6 @@ int ieee80211_if_add(struct net_device *
goto fail;
memcpy(ndev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN);
- ndev->base_addr = dev->base_addr;
- ndev->irq = dev->irq;
- ndev->mem_start = dev->mem_start;
- ndev->mem_end = dev->mem_end;
SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy));
sdata = IEEE80211_DEV_TO_SUB_IF(ndev);
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c 2007-07-19 15:35:50.713857384 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c 2007-07-19 15:36:12.873857384 +0200
@@ -912,6 +912,7 @@ static int ieee80211_ioctl_add_if(struct
int res;
struct hostapd_if_wds *wds;
struct hostapd_if_bss *bss;
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
printk(KERN_WARNING "PRISM2_HOSTAPD_ADD_IF ioctl is deprecated!");
switch (param->u.if_info.type) {
@@ -921,14 +922,12 @@ static int ieee80211_ioctl_add_if(struct
if (left < sizeof(struct hostapd_if_wds))
return -EPROTO;
- res = ieee80211_if_add(dev, param->u.if_info.name, &new_dev,
+ res = ieee80211_if_add(local, param->u.if_info.name, &new_dev,
IEEE80211_IF_TYPE_WDS);
if (res)
return res;
res = ieee80211_if_update_wds(new_dev, wds->remote_addr);
if (unlikely(res)) {
- struct ieee80211_local *local =
- wdev_priv(dev->ieee80211_ptr);
struct ieee80211_sub_if_data *sdata =
IEEE80211_DEV_TO_SUB_IF(new_dev);
write_lock_bh(&local->sub_if_lock);
@@ -941,7 +940,7 @@ static int ieee80211_ioctl_add_if(struct
if (left < sizeof(struct hostapd_if_vlan))
return -EPROTO;
- res = ieee80211_if_add(dev, param->u.if_info.name, NULL,
+ res = ieee80211_if_add(local, param->u.if_info.name, NULL,
IEEE80211_IF_TYPE_VLAN);
return res;
case HOSTAP_IF_BSS:
@@ -950,7 +949,7 @@ static int ieee80211_ioctl_add_if(struct
if (left < sizeof(struct hostapd_if_bss))
return -EPROTO;
- res = ieee80211_if_add(dev, param->u.if_info.name, &new_dev,
+ res = ieee80211_if_add(local, param->u.if_info.name, &new_dev,
IEEE80211_IF_TYPE_AP);
if (res)
return res;
@@ -960,7 +959,7 @@ static int ieee80211_ioctl_add_if(struct
if (left < sizeof(struct hostapd_if_sta))
return -EPROTO;
- res = ieee80211_if_add(dev, param->u.if_info.name, NULL,
+ res = ieee80211_if_add(local, param->u.if_info.name, NULL,
IEEE80211_IF_TYPE_STA);
return res;
default:
[-- Attachment #1.4: 028-mdev-qos.patch --]
[-- Type: text/x-vhdl, Size: 1403 bytes --]
---
net/mac80211/wme.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--- wireless-dev.orig/net/mac80211/wme.c 2007-07-19 15:36:15.513857384 +0200
+++ wireless-dev/net/mac80211/wme.c 2007-07-19 15:58:18.113857384 +0200
@@ -166,7 +166,7 @@ static inline int wme_downgrade_ac(struc
static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd)
{
struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
- struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(qd->dev);
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF_NW(qd->dev);
struct ieee80211_if_sta *ifsta = &sdata->u.sta;
struct ieee80211_tx_packet_data *pkt_data =
(struct ieee80211_tx_packet_data *) skb->cb;
@@ -175,6 +175,13 @@ static inline int classify80211(struct s
int qos, tsid, dir;
const int ieee802_1d_to_ac[8] = { 2, 3, 3, 2, 1, 1, 0, 0 };
+ printk(KERN_DEBUG "classify80211(%s)\n", qd->dev->name);
+ if (qd->dev != sdata->local->mdev)
+ printk(KERN_DEBUG "Congrats. you managed to invoke classify80211 with"
+ " a non master device.\n"
+ "Good thing it contains special code even if that doesn't"
+ " really make sense.\n");
+
/* see if frame is data or non data frame */
if (unlikely((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)) {
/* management frames go on AC_VO queue, but are sent
[-- Attachment #1.5: 029-mdev-scan.patch --]
[-- Type: text/x-vhdl, Size: 1420 bytes --]
---
net/mac80211/ieee80211_sta.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- wireless-dev.orig/net/mac80211/ieee80211_sta.c 2007-07-19 15:55:13.103857384 +0200
+++ wireless-dev/net/mac80211/ieee80211_sta.c 2007-07-19 16:02:04.003857384 +0200
@@ -2135,7 +2135,7 @@ static void ieee80211_rx_bss_info(struct
int channel, invalid = 0, clen;
struct ieee80211_sta_bss *bss;
struct sta_info *sta;
- struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF_NW(dev);
u64 timestamp;
if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN))
@@ -2371,6 +2371,9 @@ static void ieee80211_rx_bss_info(struct
* channels, so map the channel into frequency. */
bss->freq = freq_list[channel - 1];
}
+ printk(KERN_DEBUG "bss " MAC_FMT " updated from %s\n", MAC_ARG(mgmt->bssid), dev->name);
+ if (local->mdev == dev)
+ printk(KERN_DEBUG "remind me, why can this code be invoked for the master device?\n");
bss->timestamp = timestamp;
bss->last_update = jiffies;
bss->rssi = rx_status->ssi;
@@ -2403,7 +2406,7 @@ static void ieee80211_rx_mgmt_beacon(str
ieee80211_rx_bss_info(dev, mgmt, len, rx_status, 1);
- sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+ sdata = IEEE80211_DEV_TO_SUB_IF_NW(dev);
if (sdata->type != IEEE80211_IF_TYPE_STA)
return;
ifsta = &sdata->u.sta;
[-- Attachment #1.6: 030-ignore-netdev-notif.patch --]
[-- Type: text/x-vhdl, Size: 602 bytes --]
---
net/mac80211/debugfs_netdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- wireless-dev.orig/net/mac80211/debugfs_netdev.c 2007-07-19 15:46:13.713857384 +0200
+++ wireless-dev/net/mac80211/debugfs_netdev.c 2007-07-19 15:46:25.573857384 +0200
@@ -735,7 +735,7 @@ static int netdev_notify(struct notifier
{
struct net_device *dev = ndev;
struct dentry *dir;
- struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF_NW(dev);
char buf[10+IFNAMSIZ];
if (state != NETDEV_CHANGENAME)
[-- Attachment #1.7: 031-no-master-debugfs.patch --]
[-- Type: text/x-vhdl, Size: 827 bytes --]
---
net/mac80211/ieee80211.c | 3 ---
1 file changed, 3 deletions(-)
--- wireless-dev.orig/net/mac80211/ieee80211.c 2007-07-19 15:47:28.553857384 +0200
+++ wireless-dev/net/mac80211/ieee80211.c 2007-07-19 15:47:52.323857384 +0200
@@ -5163,8 +5163,6 @@ int ieee80211_register_hw(struct ieee802
if (result < 0)
goto fail_dev;
- ieee80211_debugfs_add_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev));
-
result = ieee80211_init_rate_ctrl_alg(local, NULL);
if (result < 0) {
printk(KERN_DEBUG "%s: Failed to initialize rate control "
@@ -5199,7 +5197,6 @@ int ieee80211_register_hw(struct ieee802
fail_wep:
rate_control_deinitialize(local);
fail_rate:
- ieee80211_debugfs_remove_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev));
unregister_netdevice(local->mdev);
fail_dev:
rtnl_unlock();
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-07-19 17:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-19 17:43 debug patches Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox