aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-12-18 19:31:26 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:09:36 -0500
commit32bfd35d4b63bd63de4bb0d791ef049c3c868726 (patch)
treec1c213a35a00bcbe71a2ecc6521e19dec66cf6eb /net/mac80211/ieee80211.c
parentf653211197f3841f383fa9757ef8ce182c6cf627 (diff)
mac80211: dont use interface indices in drivers
This patch gets rid of the if_id stuff where possible in favour of a new per-virtual-interface structure "struct ieee80211_vif". This structure is located at the end of the per-interface structure and contains a variable length driver-use data area. This has two advantages: * removes the need to look up interfaces by if_id, this is better for working with network namespaces and performance * allows drivers to store and retrieve per-interface data without having to allocate own lists/hash tables Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ieee80211.c')
-rw-r--r--net/mac80211/ieee80211.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 4807e5215a79..42c27089f006 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -243,7 +243,7 @@ static int ieee80211_open(struct net_device *dev)
243 sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET; 243 sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET;
244 /* fall through */ 244 /* fall through */
245 default: 245 default:
246 conf.if_id = dev->ifindex; 246 conf.vif = &sdata->vif;
247 conf.type = sdata->type; 247 conf.type = sdata->type;
248 conf.mac_addr = dev->dev_addr; 248 conf.mac_addr = dev->dev_addr;
249 res = local->ops->add_interface(local_to_hw(local), &conf); 249 res = local->ops->add_interface(local_to_hw(local), &conf);
@@ -378,7 +378,7 @@ static int ieee80211_stop(struct net_device *dev)
378 sdata->u.sta.extra_ie_len = 0; 378 sdata->u.sta.extra_ie_len = 0;
379 /* fall through */ 379 /* fall through */
380 default: 380 default:
381 conf.if_id = dev->ifindex; 381 conf.vif = &sdata->vif;
382 conf.type = sdata->type; 382 conf.type = sdata->type;
383 conf.mac_addr = dev->dev_addr; 383 conf.mac_addr = dev->dev_addr;
384 /* disable all keys for as long as this netdev is down */ 384 /* disable all keys for as long as this netdev is down */
@@ -515,7 +515,7 @@ static int __ieee80211_if_config(struct net_device *dev,
515 conf.beacon_control = control; 515 conf.beacon_control = control;
516 } 516 }
517 return local->ops->config_interface(local_to_hw(local), 517 return local->ops->config_interface(local_to_hw(local),
518 dev->ifindex, &conf); 518 &sdata->vif, &conf);
519} 519}
520 520
521int ieee80211_if_config(struct net_device *dev) 521int ieee80211_if_config(struct net_device *dev)
@@ -527,11 +527,13 @@ int ieee80211_if_config_beacon(struct net_device *dev)
527{ 527{
528 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 528 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
529 struct ieee80211_tx_control control; 529 struct ieee80211_tx_control control;
530 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
530 struct sk_buff *skb; 531 struct sk_buff *skb;
531 532
532 if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) 533 if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE))
533 return 0; 534 return 0;
534 skb = ieee80211_beacon_get(local_to_hw(local), dev->ifindex, &control); 535 skb = ieee80211_beacon_get(local_to_hw(local), &sdata->vif,
536 &control);
535 if (!skb) 537 if (!skb)
536 return -ENOMEM; 538 return -ENOMEM;
537 return __ieee80211_if_config(dev, skb, &control); 539 return __ieee80211_if_config(dev, skb, &control);
@@ -736,7 +738,7 @@ static void ieee80211_remove_tx_extra(struct ieee80211_local *local,
736 struct ieee80211_tx_packet_data *pkt_data; 738 struct ieee80211_tx_packet_data *pkt_data;
737 739
738 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; 740 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
739 pkt_data->ifindex = control->ifindex; 741 pkt_data->ifindex = vif_to_sdata(control->vif)->dev->ifindex;
740 pkt_data->flags = 0; 742 pkt_data->flags = 0;
741 if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS) 743 if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS)
742 pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; 744 pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS;