Skip to content

Commit

Permalink
mac80211: remove master netdev
Browse files Browse the repository at this point in the history
With the internal 'pending' queue system in place, we can simply
put packets there instead of pushing them off to the master dev,
getting rid of the master interface completely.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
  • Loading branch information
jmberg authored and linvjw committed Jul 24, 2009
1 parent c402908 commit 3b8d81e
Show file tree
Hide file tree
Showing 13 changed files with 195 additions and 392 deletions.
3 changes: 3 additions & 0 deletions include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ struct ieee80211_bss_conf {
* it can be sent out.
* @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211,
* used to indicate that a frame was already retried due to PS
* @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
* used to indicate frame should not be encrypted
*/
enum mac80211_tx_control_flags {
IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
Expand All @@ -259,6 +261,7 @@ enum mac80211_tx_control_flags {
IEEE80211_TX_INTFL_RCALGO = BIT(13),
IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
IEEE80211_TX_INTFL_RETRIED = BIT(15),
IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
};

/**
Expand Down
3 changes: 0 additions & 3 deletions net/mac80211/agg-tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,6 @@ static void ieee80211_agg_splice_packets(struct ieee80211_local *local,

if (!skb_queue_empty(&sta->ampdu_mlme.tid_tx[tid]->pending)) {
spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
/* mark queue as pending, it is stopped already */
__set_bit(IEEE80211_QUEUE_STOP_REASON_PENDING,
&local->queue_stop_reasons[queue]);
/* copy over remaining packets */
skb_queue_splice_tail_init(
&sta->ampdu_mlme.tid_tx[tid]->pending,
Expand Down
2 changes: 1 addition & 1 deletion net/mac80211/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static ssize_t queues_read(struct file *file, char __user *user_buf,
for (q = 0; q < local->hw.queues; q++)
res += sprintf(buf + res, "%02d: %#.8lx/%d\n", q,
local->queue_stop_reasons[q],
__netif_subqueue_stopped(local->mdev, q));
skb_queue_len(&local->pending[q]));
spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);

return simple_read_from_buffer(user_buf, count, ppos, buf, res);
Expand Down
19 changes: 8 additions & 11 deletions net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,14 +567,9 @@ enum queue_stop_reason {
IEEE80211_QUEUE_STOP_REASON_CSA,
IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
IEEE80211_QUEUE_STOP_REASON_SUSPEND,
IEEE80211_QUEUE_STOP_REASON_PENDING,
IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
};

struct ieee80211_master_priv {
struct ieee80211_local *local;
};

struct ieee80211_local {
/* embed the driver visible part.
* don't cast (use the static inlines below), but we keep
Expand All @@ -587,13 +582,20 @@ struct ieee80211_local {
/* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
spinlock_t queue_stop_reason_lock;

struct net_device *mdev; /* wmaster# - "master" 802.11 device */
int open_count;
int monitors, cooked_mntrs;
/* number of interfaces with corresponding FIF_ flags */
int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss;
unsigned int filter_flags; /* FIF_* */
struct iw_statistics wstats;

/* protects the aggregated multicast list and filter calls */
spinlock_t filter_lock;

/* aggregated multicast list */
struct dev_addr_list *mc_list;
int mc_count;

bool tim_in_locked_section; /* see ieee80211_beacon_get() */

/*
Expand Down Expand Up @@ -813,10 +815,6 @@ struct ieee80211_local {
static inline struct ieee80211_sub_if_data *
IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
{
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);

BUG_ON(!local || local->mdev == dev);

return netdev_priv(dev);
}

Expand Down Expand Up @@ -996,7 +994,6 @@ void ieee80211_recalc_idle(struct ieee80211_local *local);
/* tx handling */
void ieee80211_clear_tx_pending(struct ieee80211_local *local);
void ieee80211_tx_pending(unsigned long data);
int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev);
int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);

Expand Down
43 changes: 21 additions & 22 deletions net/mac80211/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,6 @@ static int ieee80211_open(struct net_device *dev)
ETH_ALEN);
}

if (compare_ether_addr(null_addr, local->mdev->dev_addr) == 0)
memcpy(local->mdev->dev_addr, local->hw.wiphy->perm_addr,
ETH_ALEN);

/*
* Validate the MAC address for this device.
*/
Expand Down Expand Up @@ -229,9 +225,9 @@ static int ieee80211_open(struct net_device *dev)
if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS)
local->fif_other_bss++;

netif_addr_lock_bh(local->mdev);
spin_lock_bh(&local->filter_lock);
ieee80211_configure_filter(local);
netif_addr_unlock_bh(local->mdev);
spin_unlock_bh(&local->filter_lock);
break;
default:
conf.vif = &sdata->vif;
Expand All @@ -243,9 +239,9 @@ static int ieee80211_open(struct net_device *dev)

if (ieee80211_vif_is_mesh(&sdata->vif)) {
local->fif_other_bss++;
netif_addr_lock_bh(local->mdev);
spin_lock_bh(&local->filter_lock);
ieee80211_configure_filter(local);
netif_addr_unlock_bh(local->mdev);
spin_unlock_bh(&local->filter_lock);

ieee80211_start_mesh(sdata);
}
Expand Down Expand Up @@ -279,10 +275,6 @@ static int ieee80211_open(struct net_device *dev)
}

if (local->open_count == 0) {
res = dev_open(local->mdev);
WARN_ON(res);
if (res)
goto err_del_interface;
tasklet_enable(&local->tx_pending_tasklet);
tasklet_enable(&local->tasklet);
}
Expand Down Expand Up @@ -393,7 +385,14 @@ static int ieee80211_stop(struct net_device *dev)
if (sdata->flags & IEEE80211_SDATA_PROMISC)
atomic_dec(&local->iff_promiscs);

dev_mc_unsync(local->mdev, dev);
netif_addr_lock_bh(dev);
spin_lock_bh(&local->filter_lock);
__dev_addr_unsync(&local->mc_list, &local->mc_count,
&dev->mc_list, &dev->mc_count);
ieee80211_configure_filter(local);
spin_unlock_bh(&local->filter_lock);
netif_addr_unlock_bh(dev);

del_timer_sync(&local->dynamic_ps_timer);
cancel_work_sync(&local->dynamic_ps_enable_work);

Expand Down Expand Up @@ -442,9 +441,9 @@ static int ieee80211_stop(struct net_device *dev)
if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS)
local->fif_other_bss--;

netif_addr_lock_bh(local->mdev);
spin_lock_bh(&local->filter_lock);
ieee80211_configure_filter(local);
netif_addr_unlock_bh(local->mdev);
spin_unlock_bh(&local->filter_lock);
break;
case NL80211_IFTYPE_STATION:
del_timer_sync(&sdata->u.mgd.chswitch_timer);
Expand Down Expand Up @@ -487,9 +486,9 @@ static int ieee80211_stop(struct net_device *dev)
local->fif_other_bss--;
atomic_dec(&local->iff_allmultis);

netif_addr_lock_bh(local->mdev);
spin_lock_bh(&local->filter_lock);
ieee80211_configure_filter(local);
netif_addr_unlock_bh(local->mdev);
spin_unlock_bh(&local->filter_lock);

ieee80211_stop_mesh(sdata);
}
Expand Down Expand Up @@ -535,9 +534,6 @@ static int ieee80211_stop(struct net_device *dev)
ieee80211_recalc_ps(local, -1);

if (local->open_count == 0) {
if (netif_running(local->mdev))
dev_close(local->mdev);

drv_stop(local);

ieee80211_led_radio(local, false);
Expand Down Expand Up @@ -584,8 +580,11 @@ static void ieee80211_set_multicast_list(struct net_device *dev)
atomic_dec(&local->iff_promiscs);
sdata->flags ^= IEEE80211_SDATA_PROMISC;
}

dev_mc_sync(local->mdev, dev);
spin_lock_bh(&local->filter_lock);
__dev_addr_sync(&local->mc_list, &local->mc_count,
&dev->mc_list, &dev->mc_count);
ieee80211_configure_filter(local);
spin_unlock_bh(&local->filter_lock);
}

/*
Expand Down
Loading

0 comments on commit 3b8d81e

Please sign in to comment.