Skip to content

Commit

Permalink
[MAC80211]: add "invalid" interface type
Browse files Browse the repository at this point in the history
Since I cannot convince the lazy driver authors (hello Michael)
to stop (ab)using the MGMT interface type internally in their
drivers, this patch introduces a new _INVALID type especially
for their use and changes all affected drivers to use it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Johannes Berg authored and David S. Miller committed Oct 10, 2007
1 parent f7c4dae commit a289755
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 9 deletions.
8 changes: 4 additions & 4 deletions drivers/net/wireless/adm8211.c
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ static void adm8211_stop(struct ieee80211_hw *dev)
{
struct adm8211_priv *priv = dev->priv;

priv->mode = IEEE80211_IF_TYPE_MGMT;
priv->mode = IEEE80211_IF_TYPE_INVALID;
priv->nar = 0;
ADM8211_CSR_WRITE(NAR, 0);
ADM8211_CSR_WRITE(IER, 0);
Expand Down Expand Up @@ -1898,7 +1898,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev,
priv->tx_power = 0x40;
priv->lpf_cutoff = 0xFF;
priv->lnags_threshold = 0xFF;
priv->mode = IEEE80211_IF_TYPE_MGMT;
priv->mode = IEEE80211_IF_TYPE_INVALID;

/* Power-on issue. EEPROM won't read correctly without */
if (pdev->revision >= ADM8211_REV_BA) {
Expand Down Expand Up @@ -1993,7 +1993,7 @@ static int adm8211_suspend(struct pci_dev *pdev, pm_message_t state)
struct ieee80211_hw *dev = pci_get_drvdata(pdev);
struct adm8211_priv *priv = dev->priv;

if (priv->mode != IEEE80211_IF_TYPE_MGMT) {
if (priv->mode != IEEE80211_IF_TYPE_INVALID) {
ieee80211_stop_queues(dev);
adm8211_stop(dev);
}
Expand All @@ -2011,7 +2011,7 @@ static int adm8211_resume(struct pci_dev *pdev)
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);

if (priv->mode != IEEE80211_IF_TYPE_MGMT) {
if (priv->mode != IEEE80211_IF_TYPE_INVALID) {
adm8211_start(dev);
ieee80211_start_queues(dev);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/p54common.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ static void p54_stop(struct ieee80211_hw *dev)
kfree_skb(skb);
}
priv->stop(dev);
priv->mode = IEEE80211_IF_TYPE_MGMT;
priv->mode = IEEE80211_IF_TYPE_INVALID;
}

static int p54_add_interface(struct ieee80211_hw *dev,
Expand Down Expand Up @@ -949,7 +949,7 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len)
return NULL;

priv = dev->priv;
priv->mode = IEEE80211_IF_TYPE_MGMT;
priv->mode = IEEE80211_IF_TYPE_INVALID;
skb_queue_head_init(&priv->tx_queue);
memcpy(priv->channels, p54_channels, sizeof(p54_channels));
memcpy(priv->rates, p54_rates, sizeof(p54_rates));
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/p54pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ static int p54p_suspend(struct pci_dev *pdev, pm_message_t state)
struct ieee80211_hw *dev = pci_get_drvdata(pdev);
struct p54p_priv *priv = dev->priv;

if (priv->common.mode != IEEE80211_IF_TYPE_MGMT) {
if (priv->common.mode != IEEE80211_IF_TYPE_INVALID) {
ieee80211_stop_queues(dev);
p54p_stop(dev);
}
Expand All @@ -658,7 +658,7 @@ static int p54p_resume(struct pci_dev *pdev)
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);

if (priv->common.mode != IEEE80211_IF_TYPE_MGMT) {
if (priv->common.mode != IEEE80211_IF_TYPE_INVALID) {
p54p_open(dev);
ieee80211_start_queues(dev);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/rt2x00/rt2x00.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ struct interface {
* When set to INVALID_INTERFACE, no interface is configured.
*/
int type;
#define INVALID_INTERFACE IEEE80211_IF_TYPE_MGMT
#define INVALID_INTERFACE IEEE80211_IF_TYPE_INVALID

/*
* MAC of the device.
Expand Down
3 changes: 3 additions & 0 deletions include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ struct ieee80211_conf {
/**
* enum ieee80211_if_types - types of 802.11 network interfaces
*
* @IEEE80211_IF_TYPE_INVALID: invalid interface type, not used
* by mac80211 itself
* @IEEE80211_IF_TYPE_AP: interface in AP mode.
* @IEEE80211_IF_TYPE_MGMT: special interface for communication with hostap
* daemon. Drivers should never see this type.
Expand All @@ -468,6 +470,7 @@ struct ieee80211_conf {
* will never see this type.
*/
enum ieee80211_if_types {
IEEE80211_IF_TYPE_INVALID,
IEEE80211_IF_TYPE_AP,
IEEE80211_IF_TYPE_MGMT,
IEEE80211_IF_TYPE_STA,
Expand Down
4 changes: 4 additions & 0 deletions net/mac80211/ieee80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ static int ieee80211_open(struct net_device *dev)
case IEEE80211_IF_TYPE_IBSS:
/* no special treatment */
break;
case IEEE80211_IF_TYPE_INVALID:
/* cannot happen */
WARN_ON(1);
break;
}

if (local->open_count == 0) {
Expand Down
4 changes: 4 additions & 0 deletions net/mac80211/ieee80211_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ void ieee80211_if_reinit(struct net_device *dev)
ieee80211_if_sdata_deinit(sdata);

switch (sdata->type) {
case IEEE80211_IF_TYPE_INVALID:
/* cannot happen */
WARN_ON(1);
break;
case IEEE80211_IF_TYPE_MGMT:
/* nothing to do */
break;
Expand Down
1 change: 1 addition & 0 deletions net/mac80211/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
case IEEE80211_IF_TYPE_MNTR:
/* take everything */
break;
case IEEE80211_IF_TYPE_INVALID:
case IEEE80211_IF_TYPE_MGMT:
/* should never get here */
WARN_ON(1);
Expand Down

0 comments on commit a289755

Please sign in to comment.