diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-09-16 08:18:59 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-09-24 16:18:00 -0400 |
commit | 133b822638ff01eb1e32e1917b197c40ed095ddd (patch) | |
tree | 8b96f00426728f3c05ba05f387240f0279512a75 /net/mac80211/tx.c | |
parent | 9e5e6c327defcef19dabad64335ee68bb55b2355 (diff) |
mac80211: make master iface not wireless
There's no need to register the master netdev with cfg80211,
in fact, this is quite dangerous and lead to having to add
checks for the master interface all over the config handlers.
This patch removes the "ieee80211_ptr" from the master iface
in favour of having a small netdev_priv() associated with
the master interface that stores the ieee80211_local pointer.
Because of this, a lot of code in the configuration handlers
can go away. To make this patch easier to verify I have also
removed a number of wiphy_priv() calls in favour of getting
the sdata first and then the local pointer from that.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r-- | net/mac80211/tx.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 20d683641b42..00d798cc9e04 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -165,11 +165,10 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
165 | return cpu_to_le16(dur); | 165 | return cpu_to_le16(dur); |
166 | } | 166 | } |
167 | 167 | ||
168 | static int inline is_ieee80211_device(struct net_device *dev, | 168 | static int inline is_ieee80211_device(struct ieee80211_local *local, |
169 | struct net_device *master) | 169 | struct net_device *dev) |
170 | { | 170 | { |
171 | return (wdev_priv(dev->ieee80211_ptr) == | 171 | return local == wdev_priv(dev->ieee80211_ptr); |
172 | wdev_priv(master->ieee80211_ptr)); | ||
173 | } | 172 | } |
174 | 173 | ||
175 | /* tx handlers */ | 174 | /* tx handlers */ |
@@ -1001,14 +1000,14 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
1001 | /* | 1000 | /* |
1002 | * NB: @tx is uninitialised when passed in here | 1001 | * NB: @tx is uninitialised when passed in here |
1003 | */ | 1002 | */ |
1004 | static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | 1003 | static int ieee80211_tx_prepare(struct ieee80211_local *local, |
1005 | struct sk_buff *skb, | 1004 | struct ieee80211_tx_data *tx, |
1006 | struct net_device *mdev) | 1005 | struct sk_buff *skb) |
1007 | { | 1006 | { |
1008 | struct net_device *dev; | 1007 | struct net_device *dev; |
1009 | 1008 | ||
1010 | dev = dev_get_by_index(&init_net, skb->iif); | 1009 | dev = dev_get_by_index(&init_net, skb->iif); |
1011 | if (unlikely(dev && !is_ieee80211_device(dev, mdev))) { | 1010 | if (unlikely(dev && !is_ieee80211_device(local, dev))) { |
1012 | dev_put(dev); | 1011 | dev_put(dev); |
1013 | dev = NULL; | 1012 | dev = NULL; |
1014 | } | 1013 | } |
@@ -1258,6 +1257,8 @@ static int ieee80211_skb_resize(struct ieee80211_local *local, | |||
1258 | int ieee80211_master_start_xmit(struct sk_buff *skb, | 1257 | int ieee80211_master_start_xmit(struct sk_buff *skb, |
1259 | struct net_device *dev) | 1258 | struct net_device *dev) |
1260 | { | 1259 | { |
1260 | struct ieee80211_master_priv *mpriv = netdev_priv(dev); | ||
1261 | struct ieee80211_local *local = mpriv->local; | ||
1261 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1262 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1262 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 1263 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
1263 | struct net_device *odev = NULL; | 1264 | struct net_device *odev = NULL; |
@@ -1273,7 +1274,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1273 | 1274 | ||
1274 | if (skb->iif) | 1275 | if (skb->iif) |
1275 | odev = dev_get_by_index(&init_net, skb->iif); | 1276 | odev = dev_get_by_index(&init_net, skb->iif); |
1276 | if (unlikely(odev && !is_ieee80211_device(odev, dev))) { | 1277 | if (unlikely(odev && !is_ieee80211_device(local, odev))) { |
1277 | dev_put(odev); | 1278 | dev_put(odev); |
1278 | odev = NULL; | 1279 | odev = NULL; |
1279 | } | 1280 | } |
@@ -1449,8 +1450,8 @@ fail: | |||
1449 | int ieee80211_subif_start_xmit(struct sk_buff *skb, | 1450 | int ieee80211_subif_start_xmit(struct sk_buff *skb, |
1450 | struct net_device *dev) | 1451 | struct net_device *dev) |
1451 | { | 1452 | { |
1452 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1453 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
1453 | struct ieee80211_sub_if_data *sdata; | 1454 | struct ieee80211_local *local = sdata->local; |
1454 | int ret = 1, head_need; | 1455 | int ret = 1, head_need; |
1455 | u16 ethertype, hdrlen, meshhdrlen = 0; | 1456 | u16 ethertype, hdrlen, meshhdrlen = 0; |
1456 | __le16 fc; | 1457 | __le16 fc; |
@@ -1462,7 +1463,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1462 | struct sta_info *sta; | 1463 | struct sta_info *sta; |
1463 | u32 sta_flags = 0; | 1464 | u32 sta_flags = 0; |
1464 | 1465 | ||
1465 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1466 | if (unlikely(skb->len < ETH_HLEN)) { | 1466 | if (unlikely(skb->len < ETH_HLEN)) { |
1467 | ret = 0; | 1467 | ret = 0; |
1468 | goto fail; | 1468 | goto fail; |
@@ -2032,7 +2032,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
2032 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); | 2032 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); |
2033 | } | 2033 | } |
2034 | 2034 | ||
2035 | if (!ieee80211_tx_prepare(&tx, skb, local->mdev)) | 2035 | if (!ieee80211_tx_prepare(local, &tx, skb)) |
2036 | break; | 2036 | break; |
2037 | dev_kfree_skb_any(skb); | 2037 | dev_kfree_skb_any(skb); |
2038 | } | 2038 | } |