Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b8d81e0 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

mac80211: remove master netdev



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: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c4029083
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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),
@@ -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),
};

/**
+0 −3
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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);
+8 −11
Original line number Diff line number Diff line
@@ -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
@@ -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() */

	/*
@@ -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);
}

@@ -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);

+21 −22
Original line number Diff line number Diff line
@@ -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.
	 */
@@ -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;
@@ -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);
		}
@@ -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);
	}
@@ -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);

@@ -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);
@@ -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);
		}
@@ -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);
@@ -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);
}

/*
Loading