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

Commit 51fb61e7 authored by Johannes Berg's avatar Johannes Berg Committed by David S. Miller
Browse files

mac80211: move interface type to vif structure



Drivers that support mixed AP/STA operation may well need to
know the type of a virtual interface when iterating over them.
The easiest way to support that is to move the interface type
variable into the vif structure.

Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 32bfd35d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -535,10 +535,12 @@ enum ieee80211_if_types {
 * Data in this structure is continually present for driver
 * use during the life of a virtual interface.
 *
 * @type: type of this virtual interface
 * @drv_priv: data area for driver use, will always be aligned to
 *	sizeof(void *).
 */
struct ieee80211_vif {
	enum ieee80211_if_types type;
	/* must be last */
	u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
};
+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,

	sdata = IEEE80211_DEV_TO_SUB_IF(dev);

        if (sdata->type == IEEE80211_IF_TYPE_VLAN)
	if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN)
		return -EOPNOTSUPP;

	ieee80211_if_reinit(dev);
+2 −2
Original line number Diff line number Diff line
@@ -226,7 +226,7 @@ static void add_files(struct ieee80211_sub_if_data *sdata)
	if (!sdata->debugfsdir)
		return;

	switch (sdata->type) {
	switch (sdata->vif.type) {
	case IEEE80211_IF_TYPE_STA:
	case IEEE80211_IF_TYPE_IBSS:
		add_sta_files(sdata);
@@ -353,7 +353,7 @@ void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata)

void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata)
{
	del_files(sdata, sdata->type);
	del_files(sdata, sdata->vif.type);
	debugfs_remove(sdata->debugfsdir);
	sdata->debugfsdir = NULL;
}
+18 −18
Original line number Diff line number Diff line
@@ -177,21 +177,21 @@ static int ieee80211_open(struct net_device *dev)
			/*
			 * check whether it may have the same address
			 */
			if (!identical_mac_addr_allowed(sdata->type,
							nsdata->type))
			if (!identical_mac_addr_allowed(sdata->vif.type,
							nsdata->vif.type))
				return -ENOTUNIQ;

			/*
			 * can only add VLANs to enabled APs
			 */
			if (sdata->type == IEEE80211_IF_TYPE_VLAN &&
			    nsdata->type == IEEE80211_IF_TYPE_AP &&
			if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN &&
			    nsdata->vif.type == IEEE80211_IF_TYPE_AP &&
			    netif_running(nsdata->dev))
				sdata->u.vlan.ap = nsdata;
		}
	}

	switch (sdata->type) {
	switch (sdata->vif.type) {
	case IEEE80211_IF_TYPE_WDS:
		if (is_zero_ether_addr(sdata->u.wds.remote_addr))
			return -ENOLINK;
@@ -222,7 +222,7 @@ static int ieee80211_open(struct net_device *dev)
		ieee80211_led_radio(local, local->hw.conf.radio_enabled);
	}

	switch (sdata->type) {
	switch (sdata->vif.type) {
	case IEEE80211_IF_TYPE_VLAN:
		list_add(&sdata->u.vlan.list, &sdata->u.vlan.ap->u.ap.vlans);
		/* no need to tell driver */
@@ -244,7 +244,7 @@ static int ieee80211_open(struct net_device *dev)
		/* fall through */
	default:
		conf.vif = &sdata->vif;
		conf.type = sdata->type;
		conf.type = sdata->vif.type;
		conf.mac_addr = dev->dev_addr;
		res = local->ops->add_interface(local_to_hw(local), &conf);
		if (res && !local->open_count && local->ops->stop)
@@ -256,7 +256,7 @@ static int ieee80211_open(struct net_device *dev)
		ieee80211_reset_erp_info(dev);
		ieee80211_enable_keys(sdata);

		if (sdata->type == IEEE80211_IF_TYPE_STA &&
		if (sdata->vif.type == IEEE80211_IF_TYPE_STA &&
		    !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME))
			netif_carrier_off(dev);
		else
@@ -322,7 +322,7 @@ static int ieee80211_stop(struct net_device *dev)
	dev_mc_unsync(local->mdev, dev);

	/* down all dependent devices, that is VLANs */
	if (sdata->type == IEEE80211_IF_TYPE_AP) {
	if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
		struct ieee80211_sub_if_data *vlan, *tmp;

		list_for_each_entry_safe(vlan, tmp, &sdata->u.ap.vlans,
@@ -333,7 +333,7 @@ static int ieee80211_stop(struct net_device *dev)

	local->open_count--;

	switch (sdata->type) {
	switch (sdata->vif.type) {
	case IEEE80211_IF_TYPE_VLAN:
		list_del(&sdata->u.vlan.list);
		sdata->u.vlan.ap = NULL;
@@ -379,7 +379,7 @@ static int ieee80211_stop(struct net_device *dev)
		/* fall through */
	default:
		conf.vif = &sdata->vif;
		conf.type = sdata->type;
		conf.type = sdata->vif.type;
		conf.mac_addr = dev->dev_addr;
		/* disable all keys for as long as this netdev is down */
		ieee80211_disable_keys(sdata);
@@ -502,13 +502,13 @@ static int __ieee80211_if_config(struct net_device *dev,
		return 0;

	memset(&conf, 0, sizeof(conf));
	conf.type = sdata->type;
	if (sdata->type == IEEE80211_IF_TYPE_STA ||
	    sdata->type == IEEE80211_IF_TYPE_IBSS) {
	conf.type = sdata->vif.type;
	if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
	    sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
		conf.bssid = sdata->u.sta.bssid;
		conf.ssid = sdata->u.sta.ssid;
		conf.ssid_len = sdata->u.sta.ssid_len;
	} else if (sdata->type == IEEE80211_IF_TYPE_AP) {
	} else if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
		conf.ssid = sdata->u.ap.ssid;
		conf.ssid_len = sdata->u.ap.ssid_len;
		conf.beacon = beacon;
@@ -703,7 +703,7 @@ static void ieee80211_tasklet_handler(unsigned long data)
		case IEEE80211_RX_MSG:
			/* status is in skb->cb */
			memcpy(&rx_status, skb->cb, sizeof(rx_status));
			/* Clear skb->type in order to not confuse kernel
			/* Clear skb->pkt_type in order to not confuse kernel
			 * netstack. */
			skb->pkt_type = 0;
			__ieee80211_rx(local_to_hw(local), skb, &rx_status);
@@ -962,7 +962,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
		if (!monitors || !skb)
			goto out;

		if (sdata->type == IEEE80211_IF_TYPE_MNTR) {
		if (sdata->vif.type == IEEE80211_IF_TYPE_MNTR) {
			if (!netif_running(sdata->dev))
				continue;
			monitors--;
@@ -1084,7 +1084,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
	mdev->header_ops = &ieee80211_header_ops;
	mdev->set_multicast_list = ieee80211_master_set_multicast_list;

	sdata->type = IEEE80211_IF_TYPE_AP;
	sdata->vif.type = IEEE80211_IF_TYPE_AP;
	sdata->dev = mdev;
	sdata->local = local;
	sdata->u.ap.force_unicast_rateidx = -1;
+0 −1
Original line number Diff line number Diff line
@@ -294,7 +294,6 @@ struct ieee80211_if_sta {
#define IEEE80211_SDATA_USERSPACE_MLME	BIT(4)
struct ieee80211_sub_if_data {
	struct list_head list;
	enum ieee80211_if_types type;

	struct wireless_dev wdev;

Loading