* Re: [PATCH] cfg80211: Allow TDLS peer AID to be configured for VHT
From: Jouni Malinen @ 2013-05-27 15:14 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1369427943.13623.8.camel@johannes>
On Fri, May 24, 2013 at 10:39:03PM +0200, Johannes Berg wrote:
> On Thu, 2013-05-16 at 20:11 +0300, Jouni Malinen wrote:
>
> > - if (!info->attrs[NL80211_ATTR_STA_AID])
> > + if (!info->attrs[NL80211_ATTR_STA_AID] &&
> > + !info->attrs[NL80211_ATTR_PEER_AID])
> > return -EINVAL;
>
> Technically here I think you could check that this attribute isn't used
> with non-TDLS stations, since in new_station you know what it's going to
> be, right?
Well, in this function yes, but not this early.. I'll add validation for
this within the iftype switch.
> > @@ -3985,7 +3989,10 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
> > - params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]);
> > + if (info->attrs[NL80211_ATTR_STA_AID])
> > + params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]);
> > + else
> > + params.aid = nla_get_u16(info->attrs[NL80211_ATTR_PEER_AID]);
>
> This is a bit strange? Wouldn't you want to prefer the new attribute, so
> you can put some possibly invalid value into the old attribute for old
> kernels? Otherwise what's the reason for even reading the new attribute
> in this code at all, if new userspace code must set the old attribute
> for old kernels anyway?
This was something to allow the new attribute to be taken into use if we
ever get rid of the extra dummy STA for TDLS. I'd assume this ends up
having to get a new capability flag, so wpa_supplicant could figure out
which attribute to use. Anyway, I agree it makes more sense to reverse
the order here to prefer _PEER_AID.
--
Jouni Malinen PGP id EFC895FA
^ permalink raw reply
* Re: P2P Device support: how to deal with p2p_no_group_iface option
From: Arend van Spriel @ 2013-05-27 14:03 UTC (permalink / raw)
To: Johannes Berg
Cc: Jouni Malinen, hostap@lists.shmoo.com, linux-wireless,
Jithu Jance
In-Reply-To: <1369663161.14740.13.camel@jlt4.sipsolutions.net>
On 05/27/2013 03:59 PM, Johannes Berg wrote:
> On Mon, 2013-05-27 at 15:56 +0200, Arend van Spriel wrote:
>
>>> I don't think I'd do either of those. Not creating P2P_DEVICE will
>>> simply not work with drivers expecting it, and changing iftype to/from
>>> P2P-Device isn't supported since it would delete/create the netdev.
>>
>> So should we check that in cfg80211 upon wiphy_register().
>
> Check what?
Check that the interface combinations contain a iface limit with only
P2P_DEVICE:
{
.max = 1,
.types = BIT(NL80211_IFTYPE_P2P_DEVICE)
}
>>> I don't really see much choice but reject (or ignore) this option for
>>> drivers using P2P_DEVICE. Why would anyone *really* want P2P operation
>>> on wlan0 when another interface can be used?
>>
>> In this mac80211_hwsim is a special case. We could make P2P_DEVICE
>> support in mac80211_hwsim optional using module parameter to allow
>> testing both cases.
>
> Yes, that we could do.
>
> johannes
>
>
^ permalink raw reply
* Re: P2P Device support: how to deal with p2p_no_group_iface option
From: Johannes Berg @ 2013-05-27 13:59 UTC (permalink / raw)
To: Arend van Spriel
Cc: Jouni Malinen, hostap@lists.shmoo.com, linux-wireless,
Jithu Jance
In-Reply-To: <51A36603.7020403@broadcom.com>
On Mon, 2013-05-27 at 15:56 +0200, Arend van Spriel wrote:
> > I don't think I'd do either of those. Not creating P2P_DEVICE will
> > simply not work with drivers expecting it, and changing iftype to/from
> > P2P-Device isn't supported since it would delete/create the netdev.
>
> So should we check that in cfg80211 upon wiphy_register().
Check what?
> > I don't really see much choice but reject (or ignore) this option for
> > drivers using P2P_DEVICE. Why would anyone *really* want P2P operation
> > on wlan0 when another interface can be used?
>
> In this mac80211_hwsim is a special case. We could make P2P_DEVICE
> support in mac80211_hwsim optional using module parameter to allow
> testing both cases.
Yes, that we could do.
johannes
^ permalink raw reply
* Re: P2P Device support: how to deal with p2p_no_group_iface option
From: Arend van Spriel @ 2013-05-27 13:56 UTC (permalink / raw)
To: Johannes Berg
Cc: Jouni Malinen, hostap@lists.shmoo.com, linux-wireless,
Jithu Jance
In-Reply-To: <1369645418.8229.17.camel@jlt4.sipsolutions.net>
On 05/27/2013 11:03 AM, Johannes Berg wrote:
> Hi,
>
>> I looked into issues around hwsim p2p tests and got all but one p2p test
>> passing now (test_autogo_tdls). I had to remove the p2p_no_group_iface
>> option from the p2px.conf files, because otherwise it tries to change
>> the P2P management interface into a P2P group interface. When using
>> P2P_DEVICE and P2P management interface this is not allowed by
>> mac80211_hwsim. Also for brcmfmac the P2P_DEVICE interface is dedicated
>> and can only be added/deleted, but not changed. Not sure if that is true
>> for iwlmvm as well.
>>
>> So I would like to discuss how to deal with the p2p_no_group_iface
>> option. As P2P_DEVICE is a new concept the name of the option may no
>> longer match what it intends. Is the option to force all P2P operations
>> to be done on a single interface, ie. wlan0 (or whatever is specified on
>> the command line) and no P2P_DEVICE is to be created. Or should it
>> change the interface from the command line as P2P group interface.
>
> I don't think I'd do either of those. Not creating P2P_DEVICE will
> simply not work with drivers expecting it, and changing iftype to/from
> P2P-Device isn't supported since it would delete/create the netdev.
So should we check that in cfg80211 upon wiphy_register().
> I don't really see much choice but reject (or ignore) this option for
> drivers using P2P_DEVICE. Why would anyone *really* want P2P operation
> on wlan0 when another interface can be used?
In this mac80211_hwsim is a special case. We could make P2P_DEVICE
support in mac80211_hwsim optional using module parameter to allow
testing both cases.
Regards,
Arend
^ permalink raw reply
* Re: pull-request: mac80211-next 2013-05-27
From: Johannes Berg @ 2013-05-27 13:11 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
In-Reply-To: <1369658569.14740.11.camel@jlt4.sipsolutions.net>
[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]
On Mon, 2013-05-27 at 14:42 +0200, Johannes Berg wrote:
> John,
>
> I also have a bunch of new things for cfg80211/mac80211. Just like with
> iwlwifi, I had to merge my mac80211 tree, so this pulled in some more
> changes that looks spurious. Again, a better looking shortlog all the
> way at the end.
>
> The biggest change this time is my cfg80211 locking and MLME/SME work,
> cleaning up locking there by greatly reducing the number of different
> useless locks. Other than that, some relatively minor things.
>
> Please let me know of any problems.
>
> johannes
>
>
> The following changes since commit f722406faae2d073cc1d01063d1123c35425939e:
>
> Linux 3.10-rc1 (2013-05-11 17:14:08 -0700)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git for-john
>
> for you to fetch changes up to 0dd83174762ff46356824217e69daf374f794ba4:
Oh, there was a build error here, I've corrected it and the new HEAD is
now 6abb9cb99f33b20c2f32f18a3ae9cc7543e46edb.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* [PATCH 5/5] staging: vt6656: rf.c: Remove camel case from local variables
From: Malcolm Priestley @ 2013-05-27 13:09 UTC (permalink / raw)
To: gregkh; +Cc: linux-wireless
Camel case changes;
Static declaration
abyAL2230InitTable -> al2230_init_table
abyAL2230ChannelTable0 -> al2230_channel_table0
abyAL2230ChannelTable1 -> al2230_channel_table1
abyAL7230InitTable -> al7230_init_table_amode
abyAL7230ChannelTable0 -> al7230_channel_table0
abyAL7230ChannelTable1 -> al7230_channel_table1
abyAL7230ChannelTable2 -> al7230_channel_table2
abyVT3226_InitTable -> at3226_init_table
abyVT3226D0_InitTable -> at3226d0_init_table
abyVT3226_ChannelTable0 -> vt3226_channel_table0
abyVT3226_ChannelTable1 -> vt3226_channel_table1
abyVT3342A0_InitTable -> vt3342a0_init_table
abyVT3342_ChannelTable0 -> vt3342_channel_table0
abyVT3342_ChannelTable1 -> vt3342_channel_table1
Constant declaration
dwVT3226D0LoCurrentTable -> vt3226d0_lo_current_table
dwAL2230PowerTable -> al2230_power_table
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
drivers/staging/vt6656/rf.c | 76 ++++++++++++++++++++++-----------------------
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 6deeffe..d27fa43 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -64,7 +64,7 @@ static int msglevel =MSG_LEVEL_INFO;
#define VT3342_PWR_IDX_LEN 64
//}}
-u8 abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = {
+static u8 al2230_init_table[CB_AL2230_INIT_SEQ][3] = {
{0x03, 0xF7, 0x90},
{0x03, 0x33, 0x31},
{0x01, 0xB8, 0x02},
@@ -82,7 +82,7 @@ u8 abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = {
{0x00, 0x58, 0x0F}
};
-u8 abyAL2230ChannelTable0[CB_MAX_CHANNEL_24G][3] = {
+static u8 al2230_channel_table0[CB_MAX_CHANNEL_24G][3] = {
{0x03, 0xF7, 0x90}, // channel = 1, Tf = 2412MHz
{0x03, 0xF7, 0x90}, // channel = 2, Tf = 2417MHz
{0x03, 0xE7, 0x90}, // channel = 3, Tf = 2422MHz
@@ -99,7 +99,7 @@ u8 abyAL2230ChannelTable0[CB_MAX_CHANNEL_24G][3] = {
{0x03, 0xE7, 0xC0} // channel = 14, Tf = 2412M
};
-u8 abyAL2230ChannelTable1[CB_MAX_CHANNEL_24G][3] = {
+static u8 al2230_channel_table1[CB_MAX_CHANNEL_24G][3] = {
{0x03, 0x33, 0x31}, // channel = 1, Tf = 2412MHz
{0x0B, 0x33, 0x31}, // channel = 2, Tf = 2417MHz
{0x03, 0x33, 0x31}, // channel = 3, Tf = 2422MHz
@@ -118,7 +118,7 @@ u8 abyAL2230ChannelTable1[CB_MAX_CHANNEL_24G][3] = {
// 40MHz reference frequency
// Need to Pull PLLON(PE3) low when writing channel registers through 3-wire.
-u8 abyAL7230InitTable[CB_AL7230_INIT_SEQ][3] = {
+static u8 al7230_init_table[CB_AL7230_INIT_SEQ][3] = {
{0x20, 0x37, 0x90}, // Channel1 // Need modify for 11a
{0x13, 0x33, 0x31}, // Channel1 // Need modify for 11a
{0x84, 0x1F, 0xF2}, // Need modify for 11a: 451FE2
@@ -141,7 +141,7 @@ u8 abyAL7230InitTable[CB_AL7230_INIT_SEQ][3] = {
{0x1A, 0xBA, 0x8F} // Need modify for 11a: 12BACF
};
-u8 abyAL7230InitTableAMode[CB_AL7230_INIT_SEQ][3] = {
+static u8 al7230_init_table_amode[CB_AL7230_INIT_SEQ][3] = {
{0x2F, 0xF5, 0x20}, // Channel184 // Need modify for 11b/g
{0x00, 0x00, 0x01}, // Channel184 // Need modify for 11b/g
{0x45, 0x1F, 0xE2}, // Need modify for 11b/g
@@ -160,7 +160,7 @@ u8 abyAL7230InitTableAMode[CB_AL7230_INIT_SEQ][3] = {
{0x12, 0xBA, 0xCF} // Need modify for 11b/g
};
-u8 abyAL7230ChannelTable0[CB_MAX_CHANNEL][3] = {
+static u8 al7230_channel_table0[CB_MAX_CHANNEL][3] = {
{0x20, 0x37, 0x90}, // channel = 1, Tf = 2412MHz
{0x20, 0x37, 0x90}, // channel = 2, Tf = 2417MHz
{0x20, 0x37, 0x90}, // channel = 3, Tf = 2422MHz
@@ -226,7 +226,7 @@ u8 abyAL7230ChannelTable0[CB_MAX_CHANNEL][3] = {
{0x2F, 0xF6, 0x10} // channel = 165, Tf = 5825MHz (56)
};
-u8 abyAL7230ChannelTable1[CB_MAX_CHANNEL][3] = {
+static u8 al7230_channel_table1[CB_MAX_CHANNEL][3] = {
{0x13, 0x33, 0x31}, // channel = 1, Tf = 2412MHz
{0x1B, 0x33, 0x31}, // channel = 2, Tf = 2417MHz
{0x03, 0x33, 0x31}, // channel = 3, Tf = 2422MHz
@@ -290,7 +290,7 @@ u8 abyAL7230ChannelTable1[CB_MAX_CHANNEL][3] = {
{0x02, 0xAA, 0xB1} // channel = 165, Tf = 5825MHz (56)
};
-u8 abyAL7230ChannelTable2[CB_MAX_CHANNEL][3] = {
+static u8 al7230_channel_table2[CB_MAX_CHANNEL][3] = {
{0x7F, 0xD7, 0x84}, // channel = 1, Tf = 2412MHz
{0x7F, 0xD7, 0x84}, // channel = 2, Tf = 2417MHz
{0x7F, 0xD7, 0x84}, // channel = 3, Tf = 2422MHz
@@ -355,7 +355,7 @@ u8 abyAL7230ChannelTable2[CB_MAX_CHANNEL][3] = {
};
///{{RobertYu:20051111
-u8 abyVT3226_InitTable[CB_VT3226_INIT_SEQ][3] = {
+static u8 at3226_init_table[CB_VT3226_INIT_SEQ][3] = {
{0x03, 0xFF, 0x80},
{0x02, 0x82, 0xA1},
{0x03, 0xC6, 0xA2},
@@ -369,7 +369,7 @@ u8 abyVT3226_InitTable[CB_VT3226_INIT_SEQ][3] = {
{0x02, 0x00, 0x2A}
};
-u8 abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = {
+static u8 at3226d0_init_table[CB_VT3226_INIT_SEQ][3] = {
{0x03, 0xFF, 0x80},
{0x03, 0x02, 0x21}, //RobertYu:20060327
{0x03, 0xC6, 0xA2},
@@ -383,7 +383,7 @@ u8 abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = {
{0x02, 0x01, 0xAA} //RobertYu:20060523
};
-u8 abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = {
+static u8 vt3226_channel_table0[CB_MAX_CHANNEL_24G][3] = {
{0x01, 0x97, 0x83}, // channel = 1, Tf = 2412MHz
{0x01, 0x97, 0x83}, // channel = 2, Tf = 2417MHz
{0x01, 0x97, 0x93}, // channel = 3, Tf = 2422MHz
@@ -400,7 +400,7 @@ u8 abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = {
{0x03, 0x37, 0xC3} // channel = 14, Tf = 2484MHz
};
-u8 abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = {
+static u8 vt3226_channel_table1[CB_MAX_CHANNEL_24G][3] = {
{0x02, 0x66, 0x64}, // channel = 1, Tf = 2412MHz
{0x03, 0x66, 0x64}, // channel = 2, Tf = 2417MHz
{0x00, 0x66, 0x64}, // channel = 3, Tf = 2422MHz
@@ -419,7 +419,7 @@ u8 abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = {
///}}RobertYu
//{{RobertYu:20060502, TWIF 1.14, LO Current for 11b mode
-u32 dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = {
+const u32 vt3226d0_lo_current_table[CB_MAX_CHANNEL_24G] = {
0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz
0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz
@@ -438,7 +438,7 @@ u32 dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = {
//}}
//{{RobertYu:20060609
-u8 abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */
+static u8 vt3342a0_init_table[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */
{0x03, 0xFF, 0x80}, //update for mode//
{0x02, 0x08, 0x81},
{0x00, 0xC6, 0x02},
@@ -461,7 +461,7 @@ u8 abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */
// channel56, 5280MHz 0x00C402 for disable Frac
// other channels 0x00C602
-u8 abyVT3342_ChannelTable0[CB_MAX_CHANNEL][3] = {
+static u8 vt3342_channel_table0[CB_MAX_CHANNEL][3] = {
{0x02, 0x05, 0x03}, // channel = 1, Tf = 2412MHz
{0x01, 0x15, 0x03}, // channel = 2, Tf = 2417MHz
{0x03, 0xC5, 0x03}, // channel = 3, Tf = 2422MHz
@@ -527,7 +527,7 @@ u8 abyVT3342_ChannelTable0[CB_MAX_CHANNEL][3] = {
{0x00, 0x06, 0x03} // channel = 165, Tf = 5825MHz (56), TBD
};
-u8 abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = {
+static u8 vt3342_channel_table1[CB_MAX_CHANNEL][3] = {
{0x01, 0x99, 0x94}, // channel = 1, Tf = 2412MHz
{0x02, 0x44, 0x44}, // channel = 2, Tf = 2417MHz
{0x02, 0xEE, 0xE4}, // channel = 3, Tf = 2422MHz
@@ -597,7 +597,7 @@ u8 abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = {
*
-*/
-const u32 dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = {
+const u32 al2230_power_table[AL2230_PWR_IDX_LEN] = {
0x04040900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
0x04041900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
0x04042900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
@@ -802,7 +802,7 @@ int RFbRawSetPower(struct vnt_private *priv, u8 power, u32 rate)
return false;
ret &= IFRFbWriteEmbedded(priv,
- dwAL2230PowerTable[priv->byCurPwr]);
+ al2230_power_table[priv->byCurPwr]);
if (rate <= RATE_11M)
ret &= IFRFbWriteEmbedded(priv, 0x0001b400 +
@@ -816,7 +816,7 @@ int RFbRawSetPower(struct vnt_private *priv, u8 power, u32 rate)
return false;
ret &= IFRFbWriteEmbedded(priv,
- dwAL2230PowerTable[priv->byCurPwr]);
+ al2230_power_table[priv->byCurPwr]);
if (rate <= RATE_11M) {
ret &= IFRFbWriteEmbedded(priv, 0x040c1400 +
@@ -880,14 +880,14 @@ int RFbRawSetPower(struct vnt_private *priv, u8 power, u32 rate)
"RFbRawSetPower> 11B mode uCurrChannel[%d]\n",
priv->vnt_mgmt.uScanChannel);
ret &= IFRFbWriteEmbedded(priv,
- dwVT3226D0LoCurrentTable[priv->
+ vt3226d0_lo_current_table[priv->
vnt_mgmt.uScanChannel - 1]);
} else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"RFbRawSetPower> 11B mode uCurrChannel[%d]\n",
priv->vnt_mgmt.uCurrChannel);
ret &= IFRFbWriteEmbedded(priv,
- dwVT3226D0LoCurrentTable[priv->
+ vt3226d0_lo_current_table[priv->
vnt_mgmt.uCurrChannel - 1]);
}
@@ -979,41 +979,41 @@ void RFbRFTableDownload(struct vnt_private *priv)
length1 = CB_AL2230_INIT_SEQ * 3;
length2 = CB_MAX_CHANNEL_24G * 3;
length3 = CB_MAX_CHANNEL_24G * 3;
- addr1 = &abyAL2230InitTable[0][0];
- addr2 = &abyAL2230ChannelTable0[0][0];
- addr3 = &abyAL2230ChannelTable1[0][0];
+ addr1 = &al2230_init_table[0][0];
+ addr2 = &al2230_channel_table0[0][0];
+ addr3 = &al2230_channel_table1[0][0];
break;
case RF_AIROHA7230:
length1 = CB_AL7230_INIT_SEQ * 3;
length2 = CB_MAX_CHANNEL * 3;
length3 = CB_MAX_CHANNEL * 3;
- addr1 = &abyAL7230InitTable[0][0];
- addr2 = &abyAL7230ChannelTable0[0][0];
- addr3 = &abyAL7230ChannelTable1[0][0];
+ addr1 = &al7230_init_table[0][0];
+ addr2 = &al7230_channel_table0[0][0];
+ addr3 = &al7230_channel_table1[0][0];
break;
case RF_VT3226:
length1 = CB_VT3226_INIT_SEQ * 3;
length2 = CB_MAX_CHANNEL_24G * 3;
length3 = CB_MAX_CHANNEL_24G * 3;
- addr1 = &abyVT3226_InitTable[0][0];
- addr2 = &abyVT3226_ChannelTable0[0][0];
- addr3 = &abyVT3226_ChannelTable1[0][0];
+ addr1 = &at3226_init_table[0][0];
+ addr2 = &vt3226_channel_table0[0][0];
+ addr3 = &vt3226_channel_table1[0][0];
break;
case RF_VT3226D0:
length1 = CB_VT3226_INIT_SEQ * 3;
length2 = CB_MAX_CHANNEL_24G * 3;
length3 = CB_MAX_CHANNEL_24G * 3;
- addr1 = &abyVT3226D0_InitTable[0][0];
- addr2 = &abyVT3226_ChannelTable0[0][0];
- addr3 = &abyVT3226_ChannelTable1[0][0];
+ addr1 = &at3226d0_init_table[0][0];
+ addr2 = &vt3226_channel_table0[0][0];
+ addr3 = &vt3226_channel_table1[0][0];
break;
case RF_VT3342A0:
length1 = CB_VT3342_INIT_SEQ * 3;
length2 = CB_MAX_CHANNEL * 3;
length3 = CB_MAX_CHANNEL * 3;
- addr1 = &abyVT3342A0_InitTable[0][0];
- addr2 = &abyVT3342_ChannelTable0[0][0];
- addr3 = &abyVT3342_ChannelTable1[0][0];
+ addr1 = &vt3342a0_init_table[0][0];
+ addr2 = &vt3342_channel_table0[0][0];
+ addr3 = &vt3342_channel_table1[0][0];
break;
}
@@ -1062,8 +1062,8 @@ void RFbRFTableDownload(struct vnt_private *priv)
if (priv->byRFType == RF_AIROHA7230) {
length1 = CB_AL7230_INIT_SEQ * 3;
length2 = CB_MAX_CHANNEL * 3;
- addr1 = &(abyAL7230InitTableAMode[0][0]);
- addr2 = &(abyAL7230ChannelTable2[0][0]);
+ addr1 = &(al7230_init_table_amode[0][0]);
+ addr2 = &(al7230_channel_table2[0][0]);
memcpy(array, addr1, length1);
--
1.8.1.2
^ permalink raw reply related
* [PATCH 4/5] staging: vt6656: rf.c: RFbRFTableDownload: Remove camel case and clean up.
From: Malcolm Priestley @ 2013-05-27 13:07 UTC (permalink / raw)
To: gregkh; +Cc: linux-wireless
White space clean up.
Camel case changes;
pDevice -> priv
wLength1 -> length1
wLength2 -> length2
wLength3 -> length3
pbyAddr1 -> addr1
pbyAddr2 -> addr2
pbyAddr3 -> addr3
wLength -> length
wValue -> value
abyArray -> array
No functional changes.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
drivers/staging/vt6656/rf.c | 261 ++++++++++++++++++++------------------------
1 file changed, 121 insertions(+), 140 deletions(-)
diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 2f3963e..6deeffe 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -966,146 +966,127 @@ void RFvRSSITodBm(struct vnt_private *priv, u8 rssi, long *dbm)
*dbm = -1 * (a + b * 2);
}
-void RFbRFTableDownload(struct vnt_private *pDevice)
+void RFbRFTableDownload(struct vnt_private *priv)
{
- u16 wLength1 = 0, wLength2 = 0, wLength3 = 0;
- u8 *pbyAddr1 = NULL, *pbyAddr2 = NULL, *pbyAddr3 = NULL;
- u16 wLength, wValue;
- u8 abyArray[256];
-
- switch ( pDevice->byRFType ) {
- case RF_AL2230:
- case RF_AL2230S:
- wLength1 = CB_AL2230_INIT_SEQ * 3;
- wLength2 = CB_MAX_CHANNEL_24G * 3;
- wLength3 = CB_MAX_CHANNEL_24G * 3;
- pbyAddr1 = &(abyAL2230InitTable[0][0]);
- pbyAddr2 = &(abyAL2230ChannelTable0[0][0]);
- pbyAddr3 = &(abyAL2230ChannelTable1[0][0]);
- break;
- case RF_AIROHA7230:
- wLength1 = CB_AL7230_INIT_SEQ * 3;
- wLength2 = CB_MAX_CHANNEL * 3;
- wLength3 = CB_MAX_CHANNEL * 3;
- pbyAddr1 = &(abyAL7230InitTable[0][0]);
- pbyAddr2 = &(abyAL7230ChannelTable0[0][0]);
- pbyAddr3 = &(abyAL7230ChannelTable1[0][0]);
- break;
- case RF_VT3226: //RobertYu:20051111
- wLength1 = CB_VT3226_INIT_SEQ * 3;
- wLength2 = CB_MAX_CHANNEL_24G * 3;
- wLength3 = CB_MAX_CHANNEL_24G * 3;
- pbyAddr1 = &(abyVT3226_InitTable[0][0]);
- pbyAddr2 = &(abyVT3226_ChannelTable0[0][0]);
- pbyAddr3 = &(abyVT3226_ChannelTable1[0][0]);
- break;
- case RF_VT3226D0: //RobertYu:20051114
- wLength1 = CB_VT3226_INIT_SEQ * 3;
- wLength2 = CB_MAX_CHANNEL_24G * 3;
- wLength3 = CB_MAX_CHANNEL_24G * 3;
- pbyAddr1 = &(abyVT3226D0_InitTable[0][0]);
- pbyAddr2 = &(abyVT3226_ChannelTable0[0][0]);
- pbyAddr3 = &(abyVT3226_ChannelTable1[0][0]);
- break;
- case RF_VT3342A0: //RobertYu:20060609
- wLength1 = CB_VT3342_INIT_SEQ * 3;
- wLength2 = CB_MAX_CHANNEL * 3;
- wLength3 = CB_MAX_CHANNEL * 3;
- pbyAddr1 = &(abyVT3342A0_InitTable[0][0]);
- pbyAddr2 = &(abyVT3342_ChannelTable0[0][0]);
- pbyAddr3 = &(abyVT3342_ChannelTable1[0][0]);
- break;
-
- }
- //Init Table
-
- memcpy(abyArray, pbyAddr1, wLength1);
- CONTROLnsRequestOut(pDevice,
- MESSAGE_TYPE_WRITE,
- 0,
- MESSAGE_REQUEST_RF_INIT,
- wLength1,
- abyArray
- );
- //Channel Table 0
- wValue = 0;
- while ( wLength2 > 0 ) {
-
- if ( wLength2 >= 64 ) {
- wLength = 64;
- } else {
- wLength = wLength2;
- }
- memcpy(abyArray, pbyAddr2, wLength);
- CONTROLnsRequestOut(pDevice,
- MESSAGE_TYPE_WRITE,
- wValue,
- MESSAGE_REQUEST_RF_CH0,
- wLength,
- abyArray);
-
- wLength2 -= wLength;
- wValue += wLength;
- pbyAddr2 += wLength;
- }
- //Channel table 1
- wValue = 0;
- while ( wLength3 > 0 ) {
-
- if ( wLength3 >= 64 ) {
- wLength = 64;
- } else {
- wLength = wLength3;
- }
- memcpy(abyArray, pbyAddr3, wLength);
- CONTROLnsRequestOut(pDevice,
- MESSAGE_TYPE_WRITE,
- wValue,
- MESSAGE_REQUEST_RF_CH1,
- wLength,
- abyArray);
-
- wLength3 -= wLength;
- wValue += wLength;
- pbyAddr3 += wLength;
- }
-
- //7230 needs 2 InitTable and 3 Channel Table
- if ( pDevice->byRFType == RF_AIROHA7230 ) {
- wLength1 = CB_AL7230_INIT_SEQ * 3;
- wLength2 = CB_MAX_CHANNEL * 3;
- pbyAddr1 = &(abyAL7230InitTableAMode[0][0]);
- pbyAddr2 = &(abyAL7230ChannelTable2[0][0]);
- memcpy(abyArray, pbyAddr1, wLength1);
- //Init Table 2
- CONTROLnsRequestOut(pDevice,
- MESSAGE_TYPE_WRITE,
- 0,
- MESSAGE_REQUEST_RF_INIT2,
- wLength1,
- abyArray);
-
- //Channel Table 0
- wValue = 0;
- while ( wLength2 > 0 ) {
-
- if ( wLength2 >= 64 ) {
- wLength = 64;
- } else {
- wLength = wLength2;
- }
- memcpy(abyArray, pbyAddr2, wLength);
- CONTROLnsRequestOut(pDevice,
- MESSAGE_TYPE_WRITE,
- wValue,
- MESSAGE_REQUEST_RF_CH2,
- wLength,
- abyArray);
-
- wLength2 -= wLength;
- wValue += wLength;
- pbyAddr2 += wLength;
- }
- }
+ u16 length1 = 0, length2 = 0, length3 = 0;
+ u8 *addr1 = NULL, *addr2 = NULL, *addr3 = NULL;
+ u16 length, value;
+ u8 array[256];
+ switch (priv->byRFType) {
+ case RF_AL2230:
+ case RF_AL2230S:
+ length1 = CB_AL2230_INIT_SEQ * 3;
+ length2 = CB_MAX_CHANNEL_24G * 3;
+ length3 = CB_MAX_CHANNEL_24G * 3;
+ addr1 = &abyAL2230InitTable[0][0];
+ addr2 = &abyAL2230ChannelTable0[0][0];
+ addr3 = &abyAL2230ChannelTable1[0][0];
+ break;
+ case RF_AIROHA7230:
+ length1 = CB_AL7230_INIT_SEQ * 3;
+ length2 = CB_MAX_CHANNEL * 3;
+ length3 = CB_MAX_CHANNEL * 3;
+ addr1 = &abyAL7230InitTable[0][0];
+ addr2 = &abyAL7230ChannelTable0[0][0];
+ addr3 = &abyAL7230ChannelTable1[0][0];
+ break;
+ case RF_VT3226:
+ length1 = CB_VT3226_INIT_SEQ * 3;
+ length2 = CB_MAX_CHANNEL_24G * 3;
+ length3 = CB_MAX_CHANNEL_24G * 3;
+ addr1 = &abyVT3226_InitTable[0][0];
+ addr2 = &abyVT3226_ChannelTable0[0][0];
+ addr3 = &abyVT3226_ChannelTable1[0][0];
+ break;
+ case RF_VT3226D0:
+ length1 = CB_VT3226_INIT_SEQ * 3;
+ length2 = CB_MAX_CHANNEL_24G * 3;
+ length3 = CB_MAX_CHANNEL_24G * 3;
+ addr1 = &abyVT3226D0_InitTable[0][0];
+ addr2 = &abyVT3226_ChannelTable0[0][0];
+ addr3 = &abyVT3226_ChannelTable1[0][0];
+ break;
+ case RF_VT3342A0:
+ length1 = CB_VT3342_INIT_SEQ * 3;
+ length2 = CB_MAX_CHANNEL * 3;
+ length3 = CB_MAX_CHANNEL * 3;
+ addr1 = &abyVT3342A0_InitTable[0][0];
+ addr2 = &abyVT3342_ChannelTable0[0][0];
+ addr3 = &abyVT3342_ChannelTable1[0][0];
+ break;
+ }
+
+ /* Init Table */
+ memcpy(array, addr1, length1);
+
+ CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, 0,
+ MESSAGE_REQUEST_RF_INIT, length1, array);
+
+ /* Channel Table 0 */
+ value = 0;
+ while (length2 > 0) {
+ if (length2 >= 64)
+ length = 64;
+ else
+ length = length2;
+
+ memcpy(array, addr2, length);
+
+ CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE,
+ value, MESSAGE_REQUEST_RF_CH0, length, array);
+
+ length2 -= length;
+ value += length;
+ addr2 += length;
+ }
+
+ /* Channel table 1 */
+ value = 0;
+ while (length3 > 0) {
+ if (length3 >= 64)
+ length = 64;
+ else
+ length = length3;
+
+ memcpy(array, addr3, length);
+
+ CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE,
+ value, MESSAGE_REQUEST_RF_CH1, length, array);
+
+ length3 -= length;
+ value += length;
+ addr3 += length;
+ }
+
+ if (priv->byRFType == RF_AIROHA7230) {
+ length1 = CB_AL7230_INIT_SEQ * 3;
+ length2 = CB_MAX_CHANNEL * 3;
+ addr1 = &(abyAL7230InitTableAMode[0][0]);
+ addr2 = &(abyAL7230ChannelTable2[0][0]);
+
+ memcpy(array, addr1, length1);
+
+ /* Init Table 2 */
+ CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE,
+ 0, MESSAGE_REQUEST_RF_INIT2, length1, array);
+
+ /* Channel Table 0 */
+ value = 0;
+ while (length2 > 0) {
+ if (length2 >= 64)
+ length = 64;
+ else
+ length = length2;
+
+ memcpy(array, addr2, length);
+
+ CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE,
+ value, MESSAGE_REQUEST_RF_CH2, length, array);
+
+ length2 -= length;
+ value += length;
+ addr2 += length;
+ }
+ }
}
--
1.8.1.2
^ permalink raw reply related
* [PATCH 3/5] staging: vt6656: rf.c: RFvRSSITodBm Remove camel case and clean up.
From: Malcolm Priestley @ 2013-05-27 13:05 UTC (permalink / raw)
To: gregkh; +Cc: linux-wireless
White space clean up.
Camel case changes;
pDevice -> priv
byCurrRSSI -> rssi
pldBm -> dbm
byIdx -> idx
abyAIROHARF -> airoharf
No functional changes.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
drivers/staging/vt6656/rf.c | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index b7aad36..2f3963e 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -31,6 +31,7 @@
* Revision History:
* RF_VT3226: RobertYu:20051111, VT3226C0 and before
* RF_VT3226D0: RobertYu:20051228
+ * RF_VT3342A0: RobertYu:20060609
*
*/
@@ -942,27 +943,27 @@ int RFbRawSetPower(struct vnt_private *priv, u8 power, u32 rate)
* Return Value: none
*
-*/
-void RFvRSSITodBm(struct vnt_private *pDevice, u8 byCurrRSSI, long *pldBm)
+void RFvRSSITodBm(struct vnt_private *priv, u8 rssi, long *dbm)
{
- u8 byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03);
- signed long b = (byCurrRSSI & 0x3F);
- signed long a = 0;
- u8 abyAIROHARF[4] = {0, 18, 0, 40};
+ u8 idx = (((rssi & 0xc0) >> 6) & 0x03);
+ long b = (rssi & 0x3f);
+ long a = 0;
+ u8 airoharf[4] = {0, 18, 0, 40};
- switch (pDevice->byRFType) {
- case RF_AL2230:
- case RF_AL2230S:
- case RF_AIROHA7230:
- case RF_VT3226: //RobertYu:20051111
- case RF_VT3226D0:
- case RF_VT3342A0: //RobertYu:20060609
- a = abyAIROHARF[byIdx];
- break;
- default:
- break;
- }
+ switch (priv->byRFType) {
+ case RF_AL2230:
+ case RF_AL2230S:
+ case RF_AIROHA7230:
+ case RF_VT3226:
+ case RF_VT3226D0:
+ case RF_VT3342A0:
+ a = airoharf[idx];
+ break;
+ default:
+ break;
+ }
- *pldBm = -1 * (a + b * 2);
+ *dbm = -1 * (a + b * 2);
}
void RFbRFTableDownload(struct vnt_private *pDevice)
--
1.8.1.2
^ permalink raw reply related
* [PATCH 2/5] staging: vt6656: rf.c: RFbRawSetPower Remove camel case and cleanup.
From: Malcolm Priestley @ 2013-05-27 13:03 UTC (permalink / raw)
To: gregkh; +Cc: linux-wireless
White space clean up.
Camel case changes;
pDevice -> priv
uRATE -> rate
bResult -> ret
byPwr -> power
Functional change merged as one variable.
dwMax7230Pwr -> power_setting
dwVT3226Pwr -> power_setting
dwVT3342Pwr -> power_setting
Author changes moved to Revision history.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
drivers/staging/vt6656/rf.c | 222 +++++++++++++++++++++++---------------------
1 file changed, 117 insertions(+), 105 deletions(-)
diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 0c537b9..b7aad36 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -29,6 +29,8 @@
* IFRFbWriteEmbedded - Embedded write RF register via MAC
*
* Revision History:
+ * RF_VT3226: RobertYu:20051111, VT3226C0 and before
+ * RF_VT3226D0: RobertYu:20051228
*
*/
@@ -783,136 +785,146 @@ int RFbSetPower(struct vnt_private *priv, u32 rate, u32 channel)
*
*/
-int RFbRawSetPower(struct vnt_private *pDevice, u8 byPwr, u32 uRATE)
+int RFbRawSetPower(struct vnt_private *priv, u8 power, u32 rate)
{
- int bResult = true;
+ u32 power_setting = 0;
+ int ret = true;
- if (pDevice->byCurPwr == byPwr)
- return true;
+ if (priv->byCurPwr == power)
+ return true;
- pDevice->byCurPwr = byPwr;
+ priv->byCurPwr = power;
- switch (pDevice->byRFType) {
-
- case RF_AL2230 :
- if (pDevice->byCurPwr >= AL2230_PWR_IDX_LEN)
- return false;
- bResult &= IFRFbWriteEmbedded(pDevice, dwAL2230PowerTable[pDevice->byCurPwr]);
- if (uRATE <= RATE_11M)
- bResult &= IFRFbWriteEmbedded(pDevice, 0x0001B400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- else
- bResult &= IFRFbWriteEmbedded(pDevice, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- break;
+ switch (priv->byRFType) {
+ case RF_AL2230:
+ if (priv->byCurPwr >= AL2230_PWR_IDX_LEN)
+ return false;
- case RF_AL2230S :
- if (pDevice->byCurPwr >= AL2230_PWR_IDX_LEN)
- return false;
- bResult &= IFRFbWriteEmbedded(pDevice, dwAL2230PowerTable[pDevice->byCurPwr]);
- if (uRATE <= RATE_11M) {
- bResult &= IFRFbWriteEmbedded(pDevice, 0x040C1400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- bResult &= IFRFbWriteEmbedded(pDevice, 0x00299B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- }else {
- bResult &= IFRFbWriteEmbedded(pDevice, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- bResult &= IFRFbWriteEmbedded(pDevice, 0x00099B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- }
- break;
+ ret &= IFRFbWriteEmbedded(priv,
+ dwAL2230PowerTable[priv->byCurPwr]);
- case RF_AIROHA7230:
- {
- u32 dwMax7230Pwr;
+ if (rate <= RATE_11M)
+ ret &= IFRFbWriteEmbedded(priv, 0x0001b400 +
+ (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
+ else
+ ret &= IFRFbWriteEmbedded(priv, 0x0005a400 +
+ (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
+ break;
+ case RF_AL2230S:
+ if (priv->byCurPwr >= AL2230_PWR_IDX_LEN)
+ return false;
+
+ ret &= IFRFbWriteEmbedded(priv,
+ dwAL2230PowerTable[priv->byCurPwr]);
+
+ if (rate <= RATE_11M) {
+ ret &= IFRFbWriteEmbedded(priv, 0x040c1400 +
+ (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
+ ret &= IFRFbWriteEmbedded(priv, 0x00299b00 +
+ (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
+ } else {
+ ret &= IFRFbWriteEmbedded(priv, 0x0005a400 +
+ (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
+ ret &= IFRFbWriteEmbedded(priv, 0x00099b00 +
+ (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
+ }
+ break;
- if (uRATE <= RATE_11M) { //RobertYu:20060426, for better 11b mask
- bResult &= IFRFbWriteEmbedded(pDevice, 0x111BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW);
- }
- else {
- bResult &= IFRFbWriteEmbedded(pDevice, 0x221BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW);
- }
+ case RF_AIROHA7230:
+ if (rate <= RATE_11M)
+ ret &= IFRFbWriteEmbedded(priv, 0x111bb900 +
+ (BY_AL7230_REG_LEN << 3)+IFREGCTL_REGW);
+ else
+ ret &= IFRFbWriteEmbedded(priv, 0x221bb900 +
+ (BY_AL7230_REG_LEN << 3)+IFREGCTL_REGW);
- if (pDevice->byCurPwr > AL7230_PWR_IDX_LEN) return false;
+ if (priv->byCurPwr > AL7230_PWR_IDX_LEN)
+ return false;
- // 0x080F1B00 for 3 wire control TxGain(D10) and 0x31 as TX Gain value
- dwMax7230Pwr = 0x080C0B00 | ( (pDevice->byCurPwr) << 12 ) |
- (BY_AL7230_REG_LEN << 3 ) | IFREGCTL_REGW;
+ /*
+ * 0x080F1B00 for 3 wire control TxGain(D10)
+ * and 0x31 as TX Gain value
+ */
+ power_setting = 0x080c0b00 | ((priv->byCurPwr) << 12) |
+ (BY_AL7230_REG_LEN << 3) | IFREGCTL_REGW;
- bResult &= IFRFbWriteEmbedded(pDevice, dwMax7230Pwr);
- break;
- }
- break;
+ ret &= IFRFbWriteEmbedded(priv, power_setting);
- case RF_VT3226: //RobertYu:20051111, VT3226C0 and before
- {
- u32 dwVT3226Pwr;
+ break;
- if (pDevice->byCurPwr >= VT3226_PWR_IDX_LEN)
- return false;
- dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x17 << 8 ) /* Reg7 */ |
- (BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW;
- bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226Pwr);
- break;
- }
+ case RF_VT3226:
+ if (priv->byCurPwr >= VT3226_PWR_IDX_LEN)
+ return false;
+ power_setting = ((0x3f - priv->byCurPwr) << 20) | (0x17 << 8) |
+ (BY_VT3226_REG_LEN << 3) | IFREGCTL_REGW;
- case RF_VT3226D0: //RobertYu:20051228
- {
- u32 dwVT3226Pwr;
+ ret &= IFRFbWriteEmbedded(priv, power_setting);
- if (pDevice->byCurPwr >= VT3226_PWR_IDX_LEN)
- return false;
+ break;
+ case RF_VT3226D0:
+ if (priv->byCurPwr >= VT3226_PWR_IDX_LEN)
+ return false;
- if (uRATE <= RATE_11M) {
+ if (rate <= RATE_11M) {
+ power_setting = ((0x3f-priv->byCurPwr) << 20) |
+ (0xe07 << 8) | (BY_VT3226_REG_LEN << 3) |
+ IFREGCTL_REGW;
- dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0xE07 << 8 ) /* Reg7 */ | //RobertYu:20060420, TWIF 1.10
- (BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW;
- bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226Pwr);
+ ret &= IFRFbWriteEmbedded(priv, power_setting);
+ ret &= IFRFbWriteEmbedded(priv, 0x03c6a200 +
+ (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
- bResult &= IFRFbWriteEmbedded(pDevice, 0x03C6A200+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
- if (pDevice->vnt_mgmt.eScanState != WMAC_NO_SCANNING) {
- /* scanning, channel number is pDevice->uScanChannel */
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ if (priv->vnt_mgmt.eScanState != WMAC_NO_SCANNING) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "RFbRawSetPower> 11B mode uCurrChannel[%d]\n",
+ priv->vnt_mgmt.uScanChannel);
+ ret &= IFRFbWriteEmbedded(priv,
+ dwVT3226D0LoCurrentTable[priv->
+ vnt_mgmt.uScanChannel - 1]);
+ } else {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"RFbRawSetPower> 11B mode uCurrChannel[%d]\n",
- pDevice->vnt_mgmt.uScanChannel);
- bResult &= IFRFbWriteEmbedded(pDevice,
- dwVT3226D0LoCurrentTable[pDevice->
- vnt_mgmt.uScanChannel - 1]);
+ priv->vnt_mgmt.uCurrChannel);
+ ret &= IFRFbWriteEmbedded(priv,
+ dwVT3226D0LoCurrentTable[priv->
+ vnt_mgmt.uCurrChannel - 1]);
+ }
+
+ ret &= IFRFbWriteEmbedded(priv, 0x015C0800 +
+ (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
} else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
- "RFbRawSetPower> 11B mode uCurrChannel[%d]\n",
- pDevice->vnt_mgmt.uCurrChannel);
- bResult &= IFRFbWriteEmbedded(pDevice,
- dwVT3226D0LoCurrentTable[pDevice->
- vnt_mgmt.uCurrChannel - 1]);
+ "@@@@ RFbRawSetPower> 11G mode\n");
+
+ power_setting = ((0x3f-priv->byCurPwr) << 20) |
+ (0x7 << 8) | (BY_VT3226_REG_LEN << 3) |
+ IFREGCTL_REGW;
+
+ ret &= IFRFbWriteEmbedded(priv, power_setting);
+ ret &= IFRFbWriteEmbedded(priv, 0x00C6A200 +
+ (BY_VT3226_REG_LEN << 3) + IFREGCTL_REGW);
+ ret &= IFRFbWriteEmbedded(priv, 0x016BC600 +
+ (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
+ ret &= IFRFbWriteEmbedded(priv, 0x00900800 +
+ (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
}
+ break;
- bResult &= IFRFbWriteEmbedded(pDevice, 0x015C0800+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060420, ok now, new switching power (mini-pci can have bigger power consumption)
- } else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"@@@@ RFbRawSetPower> 11G mode\n");
- dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x7 << 8 ) /* Reg7 */ | //RobertYu:20060420, TWIF 1.10
- (BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW;
- bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226Pwr);
- bResult &= IFRFbWriteEmbedded(pDevice, 0x00C6A200+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060327
- bResult &= IFRFbWriteEmbedded(pDevice, 0x016BC600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060111
- bResult &= IFRFbWriteEmbedded(pDevice, 0x00900800+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060111
- }
- break;
- }
-
- //{{RobertYu:20060609
- case RF_VT3342A0:
- {
- u32 dwVT3342Pwr;
+ case RF_VT3342A0:
+ if (priv->byCurPwr >= VT3342_PWR_IDX_LEN)
+ return false;
- if (pDevice->byCurPwr >= VT3342_PWR_IDX_LEN)
- return false;
+ power_setting = ((0x3F-priv->byCurPwr) << 20) |
+ (0x27 << 8) | (BY_VT3342_REG_LEN << 3) |
+ IFREGCTL_REGW;
- dwVT3342Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x27 << 8 ) /* Reg7 */ |
- (BY_VT3342_REG_LEN << 3 ) | IFREGCTL_REGW;
- bResult &= IFRFbWriteEmbedded(pDevice, dwVT3342Pwr);
- break;
- }
+ ret &= IFRFbWriteEmbedded(priv, power_setting);
- default :
- break;
- }
- return bResult;
+ break;
+ default:
+ break;
+ }
+ return ret;
}
/*+
--
1.8.1.2
^ permalink raw reply related
* [PATCH 1/5] staging: vt6656: rf.c: RFbSetPower Remove camel case and clean up.
From: Malcolm Priestley @ 2013-05-27 13:02 UTC (permalink / raw)
To: gregkh; +Cc: linux-wireless
White space clean up.
Camel case changes;
pDevice -> priv
uRATE -> rate
uCH -> channel
bResult -> ret
byPwr -> power
No functional changes.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
drivers/staging/vt6656/rf.c | 59 ++++++++++++++++++++++-----------------------
1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 44cfe0b..0c537b9 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -732,42 +732,41 @@ int IFRFbWriteEmbedded(struct vnt_private *pDevice, u32 dwData)
* Return Value: true if succeeded; false if failed.
*
*/
-int RFbSetPower(struct vnt_private *pDevice, u32 uRATE, u32 uCH)
+int RFbSetPower(struct vnt_private *priv, u32 rate, u32 channel)
{
- int bResult = true;
- u8 byPwr = pDevice->byCCKPwr;
+ int ret = true;
+ u8 power = priv->byCCKPwr;
- if (pDevice->dwDiagRefCount)
+ if (priv->dwDiagRefCount)
return true;
- if (uCH == 0)
+ if (channel == 0)
return -EINVAL;
- switch (uRATE) {
- case RATE_1M:
- case RATE_2M:
- case RATE_5M:
- case RATE_11M:
- byPwr = pDevice->abyCCKPwrTbl[uCH-1];
- break;
- case RATE_6M:
- case RATE_9M:
- case RATE_18M:
- case RATE_24M:
- case RATE_36M:
- case RATE_48M:
- case RATE_54M:
- if (uCH > CB_MAX_CHANNEL_24G) {
- byPwr = pDevice->abyOFDMAPwrTbl[uCH-15];
- } else {
- byPwr = pDevice->abyOFDMPwrTbl[uCH-1];
- }
- break;
- }
-
- bResult = RFbRawSetPower(pDevice, byPwr, uRATE);
-
- return bResult;
+ switch (rate) {
+ case RATE_1M:
+ case RATE_2M:
+ case RATE_5M:
+ case RATE_11M:
+ power = priv->abyCCKPwrTbl[channel-1];
+ break;
+ case RATE_6M:
+ case RATE_9M:
+ case RATE_18M:
+ case RATE_24M:
+ case RATE_36M:
+ case RATE_48M:
+ case RATE_54M:
+ if (channel > CB_MAX_CHANNEL_24G)
+ power = priv->abyOFDMAPwrTbl[channel-15];
+ else
+ power = priv->abyOFDMPwrTbl[channel-1];
+ break;
+ }
+
+ ret = RFbRawSetPower(priv, power, rate);
+
+ return ret;
}
/*
--
1.8.1.2
^ permalink raw reply related
* pull-request: mac80211-next 2013-05-27
From: Johannes Berg @ 2013-05-27 12:42 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
[-- Attachment #1: Type: text/plain, Size: 10621 bytes --]
John,
I also have a bunch of new things for cfg80211/mac80211. Just like with
iwlwifi, I had to merge my mac80211 tree, so this pulled in some more
changes that looks spurious. Again, a better looking shortlog all the
way at the end.
The biggest change this time is my cfg80211 locking and MLME/SME work,
cleaning up locking there by greatly reducing the number of different
useless locks. Other than that, some relatively minor things.
Please let me know of any problems.
johannes
The following changes since commit f722406faae2d073cc1d01063d1123c35425939e:
Linux 3.10-rc1 (2013-05-11 17:14:08 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git for-john
for you to fetch changes up to 0dd83174762ff46356824217e69daf374f794ba4:
cfg80211: make WoWLAN configuration available to drivers (2013-05-27 14:37:00 +0200)
----------------------------------------------------------------
Alexander Bondar (1):
mac80211: enable power save only if DTIM period is available
Amitkumar Karwar (1):
mwifiex: fix memory leak issue when driver unload
Ashok Nagarajan (2):
mac80211: Move mesh estab_plinks outside mesh_stats debug group
{cfg,mac}80211: move mandatory rates calculation to cfg80211
Bing Zhao (1):
mwifiex: clear is_suspended flag when interrupt is received early
Colleen Twitty (2):
cfg80211: Userspace may inform kernel of mesh auth method.
mac80211: enable Auth Protocol Identifier on mesh config.
Daniel Drake (1):
mwifiex: fix setting of multicast filter
David S. Miller (1):
Merge branch 'wireless'
Felix Fietkau (5):
ath9k: fix key allocation error handling for powersave keys
mac80211: fix spurious RCU warning and update documentation
cfg80211: add support for per-chain signal strength reporting
mac80211: add support for per-chain signal strength reporting
cfg80211: fix reporting 64-bit station info tx bytes
Ilan Peer (1):
nl80211: Add wdev identifier to some nl80211 notifications
Johannes Berg (30):
cfg80211: fix wiphy_register error path
cfg80211: fix WoWLAN wakeup tracing
mac80211: fix IEEE80211_SDATA_DISCONNECT_RESUME
mac80211: fix HT beacon-based channel switch handling
mac80211: use just spin_lock() in ieee80211_get_tkip_p2k()
mac80211: fix AP-mode frame matching
cfg80211: fix interface down/disconnect state handling
mac80211: report deauth to cfg80211 for local state change
cfg80211: fix sending WoWLAN TCP wakeup settings
mac80211: fix HT beacon-based channel switch handling
wireless: move crypto constants to ieee80211.h
mac80211: write memcpy differently for smatch
cfg80211: use C99 initialisers to simplify code a bit
cfg80211: check wdev->netdev in connection work
mac80211: fix queue handling crash
iwlwifi: mvm: remove P2P_DEVICE support
mac80211_hwsim: remove P2P_DEVICE support
mac80211: assign AP_VLAN hw queues correctly
mac80211: close AP_VLAN interfaces before unregistering all
Merge remote-tracking branch 'mac80211/master' into mac80211-next
cfg80211: move cfg80211_get_dev_from_ifindex under wext
cfg80211: use atomic_t for wiphy counter
cfg80211: vastly simplify locking
cfg80211/mac80211: use cfg80211 wdev mutex in mac80211
cfg80211: simplify and correct P2P-Device scan check
regulatory: use RCU in regulatory_hint_11d()
regulatory: remove reg_mutex
cfg80211: remove some locked wrappers from mlme API
cfg80211: remove some locked wrappers from sme API
cfg80211: make WoWLAN configuration available to drivers
John W. Linville (1):
Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem
Jouni Malinen (1):
cfg80211: Allow TDLS peer AID to be configured for VHT
Marcel Holtmann (1):
nl80211: Add generic netlink module alias for cfg80211/nl80211
Oleksij Rempel (1):
mac80211: add STBC flag for radiotap
Robert P. J. Day (1):
wireless: fix kerneldoc content in *80211.h files.
Sasha Levin (1):
mac80211_hwsim: correctly register the platform driver
Stanislaw Gruszka (3):
ath5k: do not reschedule tx_complete_work on stop
iwl4965: workaround connection regression on passive channel
mac80211: fix direct probe auth
Sujith Manoharan (2):
ath9k: Fix beacon reconfiguration
ath9k: Update initvals for AR9565
Thommy Jakobsson (1):
B43: Handle DMA RX descriptor underrun
Vladimir Kondratiev (1):
cfg80211: add 60GHz regulatory class
Documentation/DocBook/80211.tmpl | 2 -
drivers/net/wireless/ath/ath5k/base.c | 5 +
.../net/wireless/ath/ath9k/ar9565_1p0_initvals.h | 138 +++----
drivers/net/wireless/ath/ath9k/main.c | 10 +-
drivers/net/wireless/b43/dma.c | 19 +
drivers/net/wireless/b43/dma.h | 4 +-
drivers/net/wireless/b43/main.c | 43 +--
drivers/net/wireless/iwlegacy/4965-mac.c | 3 +-
drivers/net/wireless/iwlegacy/commands.h | 8 -
drivers/net/wireless/iwlwifi/dvm/commands.h | 8 -
drivers/net/wireless/iwlwifi/mvm/mac80211.c | 14 +-
drivers/net/wireless/iwlwifi/pcie/tx.c | 6 +-
drivers/net/wireless/mac80211_hwsim.c | 22 +-
drivers/net/wireless/mwifiex/cfg80211.c | 3 -
drivers/net/wireless/mwifiex/cmdevt.c | 1 +
drivers/net/wireless/mwifiex/main.c | 1 +
drivers/net/wireless/mwifiex/sta_ioctl.c | 21 +-
include/linux/ieee80211.h | 9 +
include/net/cfg80211.h | 86 +++--
include/net/ieee80211_radiotap.h | 7 +
include/net/mac80211.h | 26 +-
include/uapi/linux/nl80211.h | 20 +
net/mac80211/aes_ccm.c | 6 +-
net/mac80211/cfg.c | 20 +-
net/mac80211/debugfs_netdev.c | 15 +-
net/mac80211/ht.c | 4 +-
net/mac80211/ibss.c | 49 ++-
net/mac80211/ieee80211_i.h | 29 +-
net/mac80211/iface.c | 18 +-
net/mac80211/key.c | 24 +-
net/mac80211/key.h | 15 +-
net/mac80211/main.c | 4 +-
net/mac80211/mesh.c | 38 +-
net/mac80211/mesh_plink.c | 7 +-
net/mac80211/mlme.c | 410 +++++++++------------
net/mac80211/rate.c | 9 +-
net/mac80211/rx.c | 33 +-
net/mac80211/sta_info.c | 2 +
net/mac80211/sta_info.h | 5 +
net/mac80211/tkip.c | 4 +-
net/mac80211/util.c | 37 +-
net/mac80211/wep.c | 48 +--
net/mac80211/wpa.c | 68 ++--
net/wireless/core.c | 235 +++---------
net/wireless/core.h | 91 +----
net/wireless/debugfs.c | 4 +-
net/wireless/ibss.c | 10 +-
net/wireless/mesh.c | 3 +-
net/wireless/mlme.c | 216 +++--------
net/wireless/nl80211.c | 346 ++++++++---------
net/wireless/reg.c | 136 +++----
net/wireless/scan.c | 47 ++-
net/wireless/sme.c | 113 ++----
net/wireless/sysfs.c | 4 +-
net/wireless/trace.h | 27 +-
net/wireless/util.c | 39 +-
net/wireless/wext-compat.c | 22 +-
net/wireless/wext-sme.c | 41 +--
58 files changed, 1130 insertions(+), 1505 deletions(-)
better shortlog, from rc1 merged with wireless/master:
Alexander Bondar (1):
mac80211: enable power save only if DTIM period is available
Ashok Nagarajan (2):
mac80211: Move mesh estab_plinks outside mesh_stats debug group
{cfg,mac}80211: move mandatory rates calculation to cfg80211
Colleen Twitty (2):
cfg80211: Userspace may inform kernel of mesh auth method.
mac80211: enable Auth Protocol Identifier on mesh config.
Felix Fietkau (2):
cfg80211: add support for per-chain signal strength reporting
mac80211: add support for per-chain signal strength reporting
Johannes Berg (19):
mac80211: fix HT beacon-based channel switch handling
wireless: move crypto constants to ieee80211.h
mac80211: write memcpy differently for smatch
cfg80211: use C99 initialisers to simplify code a bit
iwlwifi: mvm: remove P2P_DEVICE support
mac80211_hwsim: remove P2P_DEVICE support
mac80211: assign AP_VLAN hw queues correctly
mac80211: close AP_VLAN interfaces before unregistering all
Merge remote-tracking branch 'mac80211/master' into mac80211-next
cfg80211: move cfg80211_get_dev_from_ifindex under wext
cfg80211: use atomic_t for wiphy counter
cfg80211: vastly simplify locking
cfg80211/mac80211: use cfg80211 wdev mutex in mac80211
cfg80211: simplify and correct P2P-Device scan check
regulatory: use RCU in regulatory_hint_11d()
regulatory: remove reg_mutex
cfg80211: remove some locked wrappers from mlme API
cfg80211: remove some locked wrappers from sme API
cfg80211: make WoWLAN configuration available to drivers
Jouni Malinen (1):
cfg80211: Allow TDLS peer AID to be configured for VHT
Marcel Holtmann (1):
nl80211: Add generic netlink module alias for cfg80211/nl80211
Oleksij Rempel (1):
mac80211: add STBC flag for radiotap
Robert P. J. Day (1):
wireless: fix kerneldoc content in *80211.h files.
Vladimir Kondratiev (1):
cfg80211: add 60GHz regulatory class
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* [PATCH] cfg80211: make WoWLAN configuration available to drivers
From: Johannes Berg @ 2013-05-27 12:37 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
Make the current WoWLAN configuration available to drivers
at runtime. This isn't really useful for the normal WoWLAN
behaviour and accessing it can also be racy, but drivers
may use it for testing the WoWLAN device behaviour while
the host stays up & running to observe the device.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/net/cfg80211.h | 4 ++++
net/wireless/core.c | 2 +-
net/wireless/core.h | 19 +++++++++---------
net/wireless/nl80211.c | 53 ++++++++++++++++++++++++++------------------------
net/wireless/sysfs.c | 4 ++--
5 files changed, 44 insertions(+), 38 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9f45d74..b3b076a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2583,6 +2583,9 @@ struct wiphy_wowlan_support {
* may request, if implemented.
*
* @wowlan: WoWLAN support information
+ * @wowlan_config: current WoWLAN configuration; this should usually not be
+ * used since access to it is necessarily racy, use the parameter passed
+ * to the suspend() operation instead.
*
* @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
* @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
@@ -2650,6 +2653,7 @@ struct wiphy {
#ifdef CONFIG_PM
struct wiphy_wowlan_support wowlan;
+ struct cfg80211_wowlan *wowlan_config;
#endif
u16 max_remain_on_channel_duration;
diff --git a/net/wireless/core.c b/net/wireless/core.c
index ee42287..45abc45 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -663,7 +663,7 @@ void wiphy_unregister(struct wiphy *wiphy)
flush_work(&rdev->event_work);
cancel_delayed_work_sync(&rdev->dfs_update_channels_wk);
- if (rdev->wowlan && rdev->ops->set_wakeup)
+ if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup)
rdev_set_wakeup(rdev, false);
cfg80211_rdev_free_wowlan(rdev);
}
diff --git a/net/wireless/core.h b/net/wireless/core.h
index b4b4a56..c303627 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -74,8 +74,6 @@ struct cfg80211_registered_device {
struct work_struct conn_work;
struct work_struct event_work;
- struct cfg80211_wowlan *wowlan;
-
struct delayed_work dfs_update_channels_wk;
/* netlink port which started critical protocol (0 means not started) */
@@ -98,15 +96,16 @@ cfg80211_rdev_free_wowlan(struct cfg80211_registered_device *rdev)
{
int i;
- if (!rdev->wowlan)
+ if (!rdev->wiphy.wowlan_config)
return;
- for (i = 0; i < rdev->wowlan->n_patterns; i++)
- kfree(rdev->wowlan->patterns[i].mask);
- kfree(rdev->wowlan->patterns);
- if (rdev->wowlan->tcp && rdev->wowlan->tcp->sock)
- sock_release(rdev->wowlan->tcp->sock);
- kfree(rdev->wowlan->tcp);
- kfree(rdev->wowlan);
+ for (i = 0; i < rdev->wiphy.wowlan_config->n_patterns; i++)
+ kfree(rdev->wiphy.wowlan_config->patterns[i].mask);
+ kfree(rdev->wiphy.wowlan_config->patterns);
+ if (rdev->wiphy.wowlan_config->tcp &&
+ rdev->wiphy.wowlan_config->tcp->sock)
+ sock_release(rdev->wiphy.wowlan_config->tcp->sock);
+ kfree(rdev->wiphy.wowlan_config->tcp);
+ kfree(rdev->wiphy.wowlan_config);
}
extern struct workqueue_struct *cfg80211_wq;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a09f36b..fb6abcb 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7489,28 +7489,29 @@ static int nl80211_leave_mesh(struct sk_buff *skb, struct genl_info *info)
static int nl80211_send_wowlan_patterns(struct sk_buff *msg,
struct cfg80211_registered_device *rdev)
{
+ struct cfg80211_wowlan *wowlan = rdev->wiphy.wowlan_config;
struct nlattr *nl_pats, *nl_pat;
int i, pat_len;
- if (!rdev->wowlan->n_patterns)
+ if (!wowlan->n_patterns)
return 0;
nl_pats = nla_nest_start(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN);
if (!nl_pats)
return -ENOBUFS;
- for (i = 0; i < rdev->wowlan->n_patterns; i++) {
+ for (i = 0; i < wowlan->n_patterns; i++) {
nl_pat = nla_nest_start(msg, i + 1);
if (!nl_pat)
return -ENOBUFS;
- pat_len = rdev->wowlan->patterns[i].pattern_len;
+ pat_len = wowlan->patterns[i].pattern_len;
if (nla_put(msg, NL80211_WOWLAN_PKTPAT_MASK,
DIV_ROUND_UP(pat_len, 8),
- rdev->wowlan->patterns[i].mask) ||
+ wowlan->patterns[i].mask) ||
nla_put(msg, NL80211_WOWLAN_PKTPAT_PATTERN,
- pat_len, rdev->wowlan->patterns[i].pattern) ||
+ pat_len, wowlan->patterns[i].pattern) ||
nla_put_u32(msg, NL80211_WOWLAN_PKTPAT_OFFSET,
- rdev->wowlan->patterns[i].pkt_offset))
+ wowlan->patterns[i].pkt_offset))
return -ENOBUFS;
nla_nest_end(msg, nl_pat);
}
@@ -7573,12 +7574,12 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info)
!rdev->wiphy.wowlan.tcp)
return -EOPNOTSUPP;
- if (rdev->wowlan && rdev->wowlan->tcp) {
+ if (rdev->wiphy.wowlan_config && rdev->wiphy.wowlan_config->tcp) {
/* adjust size to have room for all the data */
- size += rdev->wowlan->tcp->tokens_size +
- rdev->wowlan->tcp->payload_len +
- rdev->wowlan->tcp->wake_len +
- rdev->wowlan->tcp->wake_len / 8;
+ size += rdev->wiphy.wowlan_config->tcp->tokens_size +
+ rdev->wiphy.wowlan_config->tcp->payload_len +
+ rdev->wiphy.wowlan_config->tcp->wake_len +
+ rdev->wiphy.wowlan_config->tcp->wake_len / 8;
}
msg = nlmsg_new(size, GFP_KERNEL);
@@ -7590,33 +7591,34 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info)
if (!hdr)
goto nla_put_failure;
- if (rdev->wowlan) {
+ if (rdev->wiphy.wowlan_config) {
struct nlattr *nl_wowlan;
nl_wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS);
if (!nl_wowlan)
goto nla_put_failure;
- if ((rdev->wowlan->any &&
+ if ((rdev->wiphy.wowlan_config->any &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) ||
- (rdev->wowlan->disconnect &&
+ (rdev->wiphy.wowlan_config->disconnect &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) ||
- (rdev->wowlan->magic_pkt &&
+ (rdev->wiphy.wowlan_config->magic_pkt &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) ||
- (rdev->wowlan->gtk_rekey_failure &&
+ (rdev->wiphy.wowlan_config->gtk_rekey_failure &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) ||
- (rdev->wowlan->eap_identity_req &&
+ (rdev->wiphy.wowlan_config->eap_identity_req &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) ||
- (rdev->wowlan->four_way_handshake &&
+ (rdev->wiphy.wowlan_config->four_way_handshake &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) ||
- (rdev->wowlan->rfkill_release &&
+ (rdev->wiphy.wowlan_config->rfkill_release &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE)))
goto nla_put_failure;
if (nl80211_send_wowlan_patterns(msg, rdev))
goto nla_put_failure;
- if (nl80211_send_wowlan_tcp(msg, rdev->wowlan->tcp))
+ if (nl80211_send_wowlan_tcp(msg,
+ rdev->wiphy.wowlan_config->tcp))
goto nla_put_failure;
nla_nest_end(msg, nl_wowlan);
@@ -7783,7 +7785,7 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
struct cfg80211_wowlan *ntrig;
struct wiphy_wowlan_support *wowlan = &rdev->wiphy.wowlan;
int err, i;
- bool prev_enabled = rdev->wowlan;
+ bool prev_enabled = rdev->wiphy.wowlan_config;
if (!rdev->wiphy.wowlan.flags && !rdev->wiphy.wowlan.n_patterns &&
!rdev->wiphy.wowlan.tcp)
@@ -7791,7 +7793,7 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
if (!info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) {
cfg80211_rdev_free_wowlan(rdev);
- rdev->wowlan = NULL;
+ rdev->wiphy.wowlan_config = NULL;
goto set_wakeup;
}
@@ -7927,11 +7929,12 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
goto error;
}
cfg80211_rdev_free_wowlan(rdev);
- rdev->wowlan = ntrig;
+ rdev->wiphy.wowlan_config = ntrig;
set_wakeup:
- if (rdev->ops->set_wakeup && prev_enabled != !!rdev->wowlan)
- rdev_set_wakeup(rdev, rdev->wowlan);
+ if (rdev->ops->set_wakeup &&
+ prev_enabled != !!rdev->wiphy.wowlan_config)
+ rdev_set_wakeup(rdev, rdev->wiphy.wowlan_config);
return 0;
error:
diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c
index 8f28b9f..dec0f4e 100644
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -100,10 +100,10 @@ static int wiphy_suspend(struct device *dev, pm_message_t state)
rtnl_lock();
if (rdev->wiphy.registered) {
- if (!rdev->wowlan)
+ if (!rdev->wiphy.wowlan_config)
cfg80211_leave_all(rdev);
if (rdev->ops->suspend)
- ret = rdev_suspend(rdev, rdev->wowlan);
+ ret = rdev_suspend(rdev, rdev->wiphy.wowlan_config);
if (ret == 1) {
/* Driver refuse to configure wowlan */
cfg80211_leave_all(rdev);
--
1.8.0
^ permalink raw reply related
* pull-request: iwlwifi-next 2013-05-27
From: Johannes Berg @ 2013-05-27 12:33 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
[-- Attachment #1: Type: text/plain, Size: 11338 bytes --]
John,
I have accumulated a bunch of new things in iwlwifi-next. Unfortunately,
to resolve a (semantic) conflict, I had to merge iwlwifi, which pulled
in some ath9k/mwifiex changes we well since you didn't merge wireless
into wireless-next at any point. If you want to handle this differently
let me know. The shortlog below also looks inflated because of that,
I've also pasted the 'real' one below the pull request.
The 'big features' I have are powersave related, including beacon
filtering and connection monitor (which I have been sitting on for a
while because it required a mac80211 patch) and thermal throttling/CT
kill. The rest is mostly cleanups and small(ish) improvements.
Please pull.
Thanks,
johannes
The following changes since commit f722406faae2d073cc1d01063d1123c35425939e:
Linux 3.10-rc1 (2013-05-11 17:14:08 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git for-john
for you to fetch changes up to 4c5af074f388b607143636cbf3b5722a3283c4e3:
iwlwifi: mvm: add debugfs for powersave (2013-05-27 13:48:48 +0200)
----------------------------------------------------------------
Alexander Bondar (6):
iwlwifi: mvm: Prevent setting assoc flag in MAC_CONTEXT_CMD
iwlwifi: mvm: Add number of DTIMs to skip
iwlwifi: mvm: configure power management in D3
iwlwifi: mvm: Add beacon abort enablement
iwlwifi: mvm: Change number of DTIMs to skip semantics
iwlwifi: mvm: add debugfs for powersave
Amitkumar Karwar (1):
mwifiex: fix memory leak issue when driver unload
Bing Zhao (1):
mwifiex: clear is_suspended flag when interrupt is received early
Daniel Drake (1):
mwifiex: fix setting of multicast filter
David S. Miller (1):
Merge branch 'wireless'
Emmanuel Grumbach (10):
iwlwifi: move BUILD_RAxTID to transport
iwlwifi: pcie: prefer to load the firmware in one shot
iwlwifi: enable shadow registers for 7000
iwlwifi: mvm: tell firmware to let multicast frames in
iwlwifi: mvm: fix aggregation drain flow
iwlwifi: mvm: add a missing define in firmware API
iwlwifi: constify the source buffer of iwl_trans_write_mem
iwlwifi: dvm: fix zero LQ CMD sending avoidance
iwlwifi: mvm: use proper scan type for P2P
iwlwifi: take valid ant for HT caps from TLV
Eran Harary (2):
iwlwifi: support loading NVM data from file
iwlwifi: fix initialisation while RF-kill is asserted
Eytan Lifshitz (1):
iwlwifi: mvm: add thermal throttling and CT kill
Felix Fietkau (1):
ath9k: fix key allocation error handling for powersave keys
Hila Gonen (2):
iwlwifi: mvm: Add beacon filtering support
iwlwifi: mvm: Add support for connection monitor offload
Ilan Peer (4):
iwlwifi: mvm: Loosen the channel context/phy context coupling
iwlwifi: mvm: Change PHY context handling
iwlwifi: mvm: Allow P2P Device to use an existing PHY context
iwlwifi: mvm: Always use SCAN_TYPE_FORCED
Johannes Berg (15):
iwlwifi: mvm: don't assume data section is at 0x800000
iwlwifi: pcie: dump stack on NIC error in sync commands
iwlwifi: nvm: honour VHT enable flag
iwlwifi: mvm: optionally store D3 SRAM after resume
iwlwifi: mvm: sanity check context in iwl_mvm_phy_ctxt_unref()
iwlwifi: mvm: fix NVM parsing error path
iwlwifi: reverse DATA/INST section order
iwlwifi: nvm: don't print NVM section reads by default
iwlwifi: mvm: don't store section offset/length in debugfs
iwlwifi: mvm: adjust firmware D3 configuration API
iwlwifi: move D3_CFG_COMPLETE handling into DVM
iwlwifi: dvm: rename iwl_lib_ops to iwl_dvm_cfg
iwlwifi: move some configuration parameters into DVM
iwlwifi: dvm: constify configuration structs
Merge remote-tracking branch 'iwlwifi-fixes/master' into HEAD
John W. Linville (1):
Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem
Oren Givon (1):
iwlwifi: add new 7260 and 3160 series device IDs
Stanislaw Gruszka (2):
ath5k: do not reschedule tx_complete_work on stop
iwl4965: workaround connection regression on passive channel
Sujith Manoharan (2):
ath9k: Fix beacon reconfiguration
ath9k: Update initvals for AR9565
Thommy Jakobsson (1):
B43: Handle DMA RX descriptor underrun
drivers/net/wireless/ath/ath5k/base.c | 5 +
.../net/wireless/ath/ath9k/ar9565_1p0_initvals.h | 138 +++---
drivers/net/wireless/ath/ath9k/main.c | 10 +-
drivers/net/wireless/b43/dma.c | 19 +
drivers/net/wireless/b43/dma.h | 4 +-
drivers/net/wireless/b43/main.c | 43 +-
drivers/net/wireless/iwlegacy/4965-mac.c | 3 +-
drivers/net/wireless/iwlwifi/dvm/agn.h | 21 +-
drivers/net/wireless/iwlwifi/dvm/calib.c | 8 +-
drivers/net/wireless/iwlwifi/dvm/commands.h | 4 -
drivers/net/wireless/iwlwifi/dvm/dev.h | 57 ++-
drivers/net/wireless/iwlwifi/dvm/devices.c | 107 ++++-
drivers/net/wireless/iwlwifi/dvm/lib.c | 20 +-
drivers/net/wireless/iwlwifi/dvm/mac80211.c | 14 +-
drivers/net/wireless/iwlwifi/dvm/main.c | 45 +-
drivers/net/wireless/iwlwifi/dvm/power.c | 6 +-
drivers/net/wireless/iwlwifi/dvm/rs.c | 8 +-
drivers/net/wireless/iwlwifi/dvm/rx.c | 2 +-
drivers/net/wireless/iwlwifi/dvm/scan.c | 12 +-
drivers/net/wireless/iwlwifi/dvm/sta.c | 2 +-
drivers/net/wireless/iwlwifi/dvm/tt.c | 2 +-
drivers/net/wireless/iwlwifi/dvm/tx.c | 12 +-
drivers/net/wireless/iwlwifi/dvm/ucode.c | 10 +-
drivers/net/wireless/iwlwifi/iwl-1000.c | 3 -
drivers/net/wireless/iwlwifi/iwl-2000.c | 39 +-
drivers/net/wireless/iwlwifi/iwl-5000.c | 4 -
drivers/net/wireless/iwlwifi/iwl-6000.c | 32 +-
drivers/net/wireless/iwlwifi/iwl-7000.c | 53 ++-
drivers/net/wireless/iwlwifi/iwl-config.h | 49 +-
drivers/net/wireless/iwlwifi/iwl-csr.h | 19 +
drivers/net/wireless/iwlwifi/iwl-drv.c | 3 +
drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c | 15 +-
drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h | 3 +-
drivers/net/wireless/iwlwifi/iwl-fw.h | 7 +-
drivers/net/wireless/iwlwifi/iwl-modparams.h | 1 +
drivers/net/wireless/iwlwifi/iwl-nvm-parse.c | 20 +-
drivers/net/wireless/iwlwifi/iwl-nvm-parse.h | 2 +-
drivers/net/wireless/iwlwifi/iwl-prph.h | 12 +
drivers/net/wireless/iwlwifi/iwl-trans.h | 7 +-
drivers/net/wireless/iwlwifi/mvm/Makefile | 2 +-
drivers/net/wireless/iwlwifi/mvm/bt-coex.c | 6 +-
drivers/net/wireless/iwlwifi/mvm/d3.c | 27 ++
drivers/net/wireless/iwlwifi/mvm/debugfs.c | 427 ++++++++++++++++-
drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h | 4 +-
drivers/net/wireless/iwlwifi/mvm/fw-api-power.h | 93 +++-
drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h | 1 +
drivers/net/wireless/iwlwifi/mvm/fw-api.h | 260 +++++++++++
drivers/net/wireless/iwlwifi/mvm/fw.c | 37 +-
drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | 42 +-
drivers/net/wireless/iwlwifi/mvm/mac80211.c | 244 ++++++++--
drivers/net/wireless/iwlwifi/mvm/mvm.h | 197 +++++++-
drivers/net/wireless/iwlwifi/mvm/nvm.c | 212 ++++++++-
drivers/net/wireless/iwlwifi/mvm/ops.c | 31 +-
drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c | 75 +--
drivers/net/wireless/iwlwifi/mvm/power.c | 183 +++++++-
drivers/net/wireless/iwlwifi/mvm/rs.c | 26 ++
drivers/net/wireless/iwlwifi/mvm/rs.h | 5 +
drivers/net/wireless/iwlwifi/mvm/rx.c | 22 +
drivers/net/wireless/iwlwifi/mvm/sta.c | 26 +-
drivers/net/wireless/iwlwifi/mvm/sta.h | 8 +-
drivers/net/wireless/iwlwifi/mvm/tt.c | 508 +++++++++++++++++++++
drivers/net/wireless/iwlwifi/mvm/tx.c | 48 +-
drivers/net/wireless/iwlwifi/mvm/utils.c | 31 ++
drivers/net/wireless/iwlwifi/pcie/drv.c | 50 +-
drivers/net/wireless/iwlwifi/pcie/trans.c | 32 +-
drivers/net/wireless/iwlwifi/pcie/tx.c | 8 +-
drivers/net/wireless/mwifiex/cfg80211.c | 3 -
drivers/net/wireless/mwifiex/cmdevt.c | 1 +
drivers/net/wireless/mwifiex/main.c | 1 +
drivers/net/wireless/mwifiex/sta_ioctl.c | 21 +-
70 files changed, 2906 insertions(+), 546 deletions(-)
create mode 100644 drivers/net/wireless/iwlwifi/mvm/tt.c
shortlog not taking into account iwlwifi-fixes merge:
Alexander Bondar (5):
iwlwifi: mvm: Add number of DTIMs to skip
iwlwifi: mvm: configure power management in D3
iwlwifi: mvm: Add beacon abort enablement
iwlwifi: mvm: Change number of DTIMs to skip semantics
iwlwifi: mvm: add debugfs for powersave
Emmanuel Grumbach (7):
iwlwifi: move BUILD_RAxTID to transport
iwlwifi: pcie: prefer to load the firmware in one shot
iwlwifi: enable shadow registers for 7000
iwlwifi: mvm: add a missing define in firmware API
iwlwifi: constify the source buffer of iwl_trans_write_mem
iwlwifi: mvm: use proper scan type for P2P
iwlwifi: take valid ant for HT caps from TLV
Eran Harary (2):
iwlwifi: support loading NVM data from file
iwlwifi: fix initialisation while RF-kill is asserted
Eytan Lifshitz (1):
iwlwifi: mvm: add thermal throttling and CT kill
Hila Gonen (2):
iwlwifi: mvm: Add beacon filtering support
iwlwifi: mvm: Add support for connection monitor offload
Ilan Peer (3):
iwlwifi: mvm: Loosen the channel context/phy context coupling
iwlwifi: mvm: Change PHY context handling
iwlwifi: mvm: Allow P2P Device to use an existing PHY context
Johannes Berg (15):
iwlwifi: mvm: don't assume data section is at 0x800000
iwlwifi: pcie: dump stack on NIC error in sync commands
iwlwifi: nvm: honour VHT enable flag
iwlwifi: mvm: optionally store D3 SRAM after resume
iwlwifi: mvm: sanity check context in iwl_mvm_phy_ctxt_unref()
iwlwifi: mvm: fix NVM parsing error path
iwlwifi: reverse DATA/INST section order
iwlwifi: nvm: don't print NVM section reads by default
iwlwifi: mvm: don't store section offset/length in debugfs
iwlwifi: mvm: adjust firmware D3 configuration API
iwlwifi: move D3_CFG_COMPLETE handling into DVM
iwlwifi: dvm: rename iwl_lib_ops to iwl_dvm_cfg
iwlwifi: move some configuration parameters into DVM
iwlwifi: dvm: constify configuration structs
Merge remote-tracking branch 'iwlwifi-fixes/master' into HEAD
Oren Givon (1):
iwlwifi: add new 7260 and 3160 series device IDs
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* pull-request: iwlwifi-fixes 2013-05-27
From: Johannes Berg @ 2013-05-27 9:36 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
[-- Attachment #1: Type: text/plain, Size: 882 bytes --]
John,
And here's a pull request for iwlwifi-fixes ...
This fixes a brown paper-bag bug that we really should've caught in
review. More details in the changelog for the fix.
johannes
The following changes since commit e3d4bc8cc0230e8dc8033484666f03f87392a8c4:
iwlwifi: mvm: fix aggregation drain flow (2013-05-16 22:39:07 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-fixes.git for-john
for you to fetch changes up to a87783699b23395c46bbeeb5d28f6db24897bf26:
iwlwifi: dvm: fix zero LQ CMD sending avoidance (2013-05-27 11:33:57 +0200)
----------------------------------------------------------------
Emmanuel Grumbach (1):
iwlwifi: dvm: fix zero LQ CMD sending avoidance
drivers/net/wireless/iwlwifi/dvm/sta.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* [PATCH 3/3] ath10k: Fix bug in max. VHT A-MPDU size
From: Sujith Manoharan @ 2013-05-27 9:28 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless
In-Reply-To: <1369646921-22278-1-git-send-email-sujith@msujith.org>
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
For VHT peers, the maximum A-MPDU size has to be calculated
from the VHT capabilities element and not the HT-cap. The formula
is the same, but a higher value is used in VHT, allowing larger
aggregates to be transmitted.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/mac.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 377e329..08d79ef 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -965,14 +965,19 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar,
struct wmi_peer_assoc_complete_arg *arg)
{
const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
+ u8 ampdu_factor;
if (!vht_cap->vht_supported)
return;
arg->peer_flags |= WMI_PEER_VHT;
-
arg->peer_vht_caps = vht_cap->cap;
+ ampdu_factor =
+ (vht_cap->cap & IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK) >>
+ IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT;
+ arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + ampdu_factor)) - 1;
+
if (sta->bandwidth == IEEE80211_STA_RX_BW_80)
arg->peer_flags |= WMI_PEER_80MHZ;
@@ -985,7 +990,8 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar,
arg->peer_vht_rates.tx_mcs_set =
__le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map);
- ath10k_dbg(ATH10K_DBG_MAC, "mac vht peer\n");
+ ath10k_dbg(ATH10K_DBG_MAC, "VHT peer %pM, max mpdu: %d\n",
+ sta->addr, arg->peer_max_mpdu);
}
static void ath10k_peer_assoc_h_qos(struct ath10k *ar,
--
1.8.3
^ permalink raw reply related
* [PATCH 2/3] ath10k: Calculate correct peer PHY mode for VHT
From: Sujith Manoharan @ 2013-05-27 9:28 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless
In-Reply-To: <1369646921-22278-1-git-send-email-sujith@msujith.org>
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
The peer PHY mode for 11ac operation needs to be determined
properly based on the channel bandwidth being used. Fix
this so that the proper mode is given to the firmware.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/mac.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 74dc3f9..377e329 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1013,8 +1013,6 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
{
enum wmi_phy_mode phymode = MODE_UNKNOWN;
- /* FIXME: add VHT */
-
switch (ar->hw->conf.chandef.chan->band) {
case IEEE80211_BAND_2GHZ:
if (sta->ht_cap.ht_supported) {
@@ -1028,7 +1026,17 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
break;
case IEEE80211_BAND_5GHZ:
- if (sta->ht_cap.ht_supported) {
+ /*
+ * Check VHT first.
+ */
+ if (sta->vht_cap.vht_supported) {
+ if (sta->bandwidth == IEEE80211_STA_RX_BW_80)
+ phymode = MODE_11AC_VHT80;
+ else if (sta->bandwidth == IEEE80211_STA_RX_BW_40)
+ phymode = MODE_11AC_VHT40;
+ else if (sta->bandwidth == IEEE80211_STA_RX_BW_20)
+ phymode = MODE_11AC_VHT20;
+ } else if (sta->ht_cap.ht_supported) {
if (sta->bandwidth == IEEE80211_STA_RX_BW_40)
phymode = MODE_11NA_HT40;
else
@@ -1042,6 +1050,9 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
break;
}
+ ath10k_dbg(ATH10K_DBG_MAC, "Peer %pM phymode: %d\n",
+ sta->addr, phymode);
+
arg->peer_phymode = phymode;
WARN_ON(phymode == MODE_UNKNOWN);
}
--
1.8.3
^ permalink raw reply related
* [PATCH 1/3] ath10k: Use VHT MCS map given by firmware
From: Sujith Manoharan @ 2013-05-27 9:28 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless
In-Reply-To: <20899.9846.857204.903600@gargle.gargle.HOWL>
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
The supported MCS set for VHT is calculated by the firmware based
on the RX chainmask/NSS supported by the chip, which could be
2x2 or 3x3. Instead of hardcoding support for 3-SS, use the map
given by the firmware directly.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/core.h | 1 +
drivers/net/wireless/ath/ath10k/mac.c | 20 +++++++-------------
drivers/net/wireless/ath/ath10k/wmi.c | 1 +
3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 539336d..7b303c0 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -266,6 +266,7 @@ struct ath10k {
u32 hw_max_tx_power;
u32 ht_cap_info;
u32 vht_cap_info;
+ u32 vht_supp_mcs;
struct targetdef *targetdef;
struct hostdef *hostdef;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 2412161..74dc3f9 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2793,23 +2793,17 @@ static const struct ieee80211_iface_combination ath10k_if_comb = {
static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
{
struct ieee80211_sta_vht_cap vht_cap = {0};
- u16 mcs_map;
vht_cap.vht_supported = 1;
+
+ /*
+ * Currently the firmware sends
+ * WMI_VHT_CAP_DEFAULT_ALL | WMI_VHT_CAP_RX_STBC_1SS.
+ */
vht_cap.cap = ar->vht_cap_info;
- /* FIXME: check dynamically how many streams board supports */
- mcs_map = IEEE80211_VHT_MCS_SUPPORT_0_9 << 0 |
- IEEE80211_VHT_MCS_SUPPORT_0_9 << 2 |
- IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 |
- IEEE80211_VHT_MCS_NOT_SUPPORTED << 6 |
- IEEE80211_VHT_MCS_NOT_SUPPORTED << 8 |
- IEEE80211_VHT_MCS_NOT_SUPPORTED << 10 |
- IEEE80211_VHT_MCS_NOT_SUPPORTED << 12 |
- IEEE80211_VHT_MCS_NOT_SUPPORTED << 14;
-
- vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map);
- vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map);
+ vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(ar->vht_supp_mcs);
+ vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(ar->vht_supp_mcs);
return vht_cap;
}
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 7d4b798..df15a82 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -854,6 +854,7 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar,
ar->hw_max_tx_power = __le32_to_cpu(ev->hw_max_tx_power);
ar->ht_cap_info = __le32_to_cpu(ev->ht_cap_info);
ar->vht_cap_info = __le32_to_cpu(ev->vht_cap_info);
+ ar->vht_supp_mcs = __le32_to_cpu(ev->vht_supp_mcs);
ar->fw_version_major =
(__le32_to_cpu(ev->sw_version) & 0xff000000) >> 24;
ar->fw_version_minor = (__le32_to_cpu(ev->sw_version) & 0x00ffffff);
--
1.8.3
^ permalink raw reply related
* pull-request: mac80211 2013-05-27
From: Johannes Berg @ 2013-05-27 9:28 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
[-- Attachment #1: Type: text/plain, Size: 1659 bytes --]
Hi John,
Another pull request for 3.10 with a number of fixes.
This time I have a fix from Stanislaw for a stupid mistake I made in the
auth/assoc timeout changes, a fix from Felix for 64-bit traffic counters
and one from Helmut for address mask handling in mac80211. I also have a
few fixes myself for four different crashes reported by a few people.
Please let me know if there are any issues.
johannes
The following changes since commit e248ad30204eff6559b4d2d94d49d9d46c08185a:
cfg80211: fix sending WoWLAN TCP wakeup settings (2013-05-16 22:38:09 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git for-john
for you to fetch changes up to ac20976dcaeea3e77e40e9aac8f3799d2a22ea2b:
mac80211: Allow single vif mac address change with addr_mask (2013-05-27 11:26:48 +0200)
----------------------------------------------------------------
Felix Fietkau (1):
cfg80211: fix reporting 64-bit station info tx bytes
Helmut Schaa (1):
mac80211: Allow single vif mac address change with addr_mask
Johannes Berg (4):
cfg80211: check wdev->netdev in connection work
mac80211: fix queue handling crash
mac80211: assign AP_VLAN hw queues correctly
mac80211: close AP_VLAN interfaces before unregistering all
Stanislaw Gruszka (1):
mac80211: fix direct probe auth
net/mac80211/iface.c | 44 +++++++++++++++++++++++++++++++++++++-------
net/mac80211/mlme.c | 12 ++++++------
net/wireless/nl80211.c | 2 +-
net/wireless/sme.c | 3 +++
4 files changed, 47 insertions(+), 14 deletions(-)
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* [PATCH 0/3] ath10k fixes
From: Sujith Manoharan @ 2013-05-27 9:25 UTC (permalink / raw)
To: Kalle Valo; +Cc: linux-wireless
Hi,
Patches to fix various 11ac issues.
Sujith
Sujith Manoharan (3):
ath10k: Use VHT MCS map given by firmware
ath10k: Calculate correct peer PHY mode for VHT
ath10k: Fix bug in max. VHT A-MPDU size
drivers/net/wireless/ath/ath10k/core.h | 1 +
drivers/net/wireless/ath/ath10k/mac.c | 47 +++++++++++++++++++++-------------
drivers/net/wireless/ath/ath10k/wmi.c | 1 +
3 files changed, 31 insertions(+), 18 deletions(-)
--
1.8.3
^ permalink raw reply
* [PATCH 0/2] cfg80211: SME cleanups
From: Johannes Berg @ 2013-05-27 9:11 UTC (permalink / raw)
To: linux-wireless
The second patch will have to wait for a wil6210 driver update,
but you can review it in the meantime :)
johannes
^ permalink raw reply
* [PATCH 2/2] cfg80211: separate internal SME implementation
From: Johannes Berg @ 2013-05-27 9:11 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
In-Reply-To: <1369645862-29054-1-git-send-email-johannes@sipsolutions.net>
From: Johannes Berg <johannes.berg@intel.com>
The current internal SME implementation in cfg80211 is
very mixed up with the MLME handling, which has been
causing issues for a long time. There are three things
that the implementation has to provide:
* a basic SME implementation for nl80211's connect()
call (for drivers implementing auth/assoc, which is
really just mac80211) and wireless extensions
* MLME events for the userspace SME
* SME events (connected, disconnected etc.) for all
different SME implementation possibilities (driver,
cfg80211 and userspace)
To achieve these goals it isn't necessary to track the
software SME's connection status outside of it's state
(which is the part that caused many issues.) Instead,
track it only in the SME data (wdev->conn) and in the
general case only track whether the wdev is connected
or not (via wdev->current_bss.)
Also separate the internal implementation to not have
callbacks from the SME events, but rather call it from
the API functions that the driver (or rather mac80211)
calls. This separates the code better.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/net/cfg80211.h | 5 -
net/wireless/core.c | 1 -
net/wireless/core.h | 30 +--
net/wireless/ibss.c | 6 -
net/wireless/mlme.c | 191 ++++++-----------
net/wireless/nl80211.c | 5 +-
net/wireless/sme.c | 542 +++++++++++++++++++++++-------------------------
net/wireless/wext-sme.c | 8 +-
8 files changed, 335 insertions(+), 453 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index cba6c5b..8eb72fd 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2893,11 +2893,6 @@ struct wireless_dev {
/* currently used for IBSS and SME - might be rearranged later */
u8 ssid[IEEE80211_MAX_SSID_LEN];
u8 ssid_len, mesh_id_len, mesh_id_up_len;
- enum {
- CFG80211_SME_IDLE,
- CFG80211_SME_CONNECTING,
- CFG80211_SME_CONNECTED,
- } sme_state;
struct cfg80211_conn *conn;
struct cfg80211_cached_keys *connect_keys;
diff --git a/net/wireless/core.c b/net/wireless/core.c
index ee42287..b929cd5 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -815,7 +815,6 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
pr_err("failed to add phy80211 symlink to netdev!\n");
}
wdev->netdev = dev;
- wdev->sme_state = CFG80211_SME_IDLE;
#ifdef CONFIG_CFG80211_WEXT
wdev->wext.default_key = -1;
wdev->wext.default_mgmt_key = -1;
diff --git a/net/wireless/core.h b/net/wireless/core.h
index b4b4a56..4d040cb 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -307,11 +307,6 @@ int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
bool local_state_change);
void cfg80211_mlme_down(struct cfg80211_registered_device *rdev,
struct net_device *dev);
-void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
- const u8 *req_ie, size_t req_ie_len,
- const u8 *resp_ie, size_t resp_ie_len,
- u16 status, bool wextev,
- struct cfg80211_bss *bss);
int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid,
u16 frame_type, const u8 *match_data,
int match_len);
@@ -327,12 +322,19 @@ void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa,
void cfg80211_oper_and_vht_capa(struct ieee80211_vht_cap *vht_capa,
const struct ieee80211_vht_cap *vht_capa_mask);
-/* SME */
+/* SME events */
int cfg80211_connect(struct cfg80211_registered_device *rdev,
struct net_device *dev,
struct cfg80211_connect_params *connect,
struct cfg80211_cached_keys *connkeys,
const u8 *prev_bssid);
+void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
+ const u8 *req_ie, size_t req_ie_len,
+ const u8 *resp_ie, size_t resp_ie_len,
+ u16 status, bool wextev,
+ struct cfg80211_bss *bss);
+void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
+ size_t ie_len, u16 reason, bool from_ap);
int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
struct net_device *dev, u16 reason,
bool wextev);
@@ -343,21 +345,21 @@ void __cfg80211_roamed(struct wireless_dev *wdev,
int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev);
+/* SME implementation */
void cfg80211_conn_work(struct work_struct *work);
-void cfg80211_sme_failed_assoc(struct wireless_dev *wdev);
-bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev);
+void cfg80211_sme_scan_done(struct net_device *dev);
+bool cfg80211_sme_rx_assoc_resp(struct wireless_dev *wdev, u16 status);
+void cfg80211_sme_rx_auth(struct wireless_dev *wdev, const u8 *buf, size_t len);
+void cfg80211_sme_disassoc(struct wireless_dev *wdev);
+void cfg80211_sme_deauth(struct wireless_dev *wdev);
+void cfg80211_sme_auth_timeout(struct wireless_dev *wdev);
+void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev);
/* internal helpers */
bool cfg80211_supported_cipher_suite(struct wiphy *wiphy, u32 cipher);
int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev,
struct key_params *params, int key_idx,
bool pairwise, const u8 *mac_addr);
-void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
- size_t ie_len, u16 reason, bool from_ap);
-void cfg80211_sme_scan_done(struct net_device *dev);
-void cfg80211_sme_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
-void cfg80211_sme_disassoc(struct net_device *dev,
- struct cfg80211_internal_bss *bss);
void __cfg80211_scan_done(struct work_struct *wk);
void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak);
void __cfg80211_sched_scan_results(struct work_struct *wk);
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 5449c5a..39bff7d 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -43,7 +43,6 @@ void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid)
cfg80211_hold_bss(bss_from_pub(bss));
wdev->current_bss = bss_from_pub(bss);
- wdev->sme_state = CFG80211_SME_CONNECTED;
cfg80211_upload_connect_keys(wdev);
nl80211_send_ibss_bssid(wiphy_to_dev(wdev->wiphy), dev, bssid,
@@ -64,8 +63,6 @@ void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp)
trace_cfg80211_ibss_joined(dev, bssid);
- CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTING);
-
ev = kzalloc(sizeof(*ev), gfp);
if (!ev)
return;
@@ -120,7 +117,6 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
#ifdef CONFIG_CFG80211_WEXT
wdev->wext.ibss.chandef = params->chandef;
#endif
- wdev->sme_state = CFG80211_SME_CONNECTING;
err = cfg80211_can_use_chan(rdev, wdev, params->chandef.chan,
params->channel_fixed
@@ -134,7 +130,6 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
err = rdev_join_ibss(rdev, dev, params);
if (err) {
wdev->connect_keys = NULL;
- wdev->sme_state = CFG80211_SME_IDLE;
return err;
}
@@ -186,7 +181,6 @@ static void __cfg80211_clear_ibss(struct net_device *dev, bool nowext)
}
wdev->current_bss = NULL;
- wdev->sme_state = CFG80211_SME_IDLE;
wdev->ssid_len = 0;
#ifdef CONFIG_CFG80211_WEXT
if (!nowext)
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 4b9c2be..a61a44b 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -21,129 +21,85 @@
void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss,
const u8 *buf, size_t len)
{
- u16 status_code;
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf;
u8 *ie = mgmt->u.assoc_resp.variable;
int ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
+ u16 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
trace_cfg80211_send_rx_assoc(dev, bss);
- status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
-
/*
* This is a bit of a hack, we don't notify userspace of
* a (re-)association reply if we tried to send a reassoc
* and got a reject -- we only try again with an assoc
* frame instead of reassoc.
*/
- if (status_code != WLAN_STATUS_SUCCESS && wdev->conn &&
- cfg80211_sme_failed_reassoc(wdev)) {
+ if (cfg80211_sme_rx_assoc_resp(wdev, status_code)) {
cfg80211_put_bss(wiphy, bss);
return;
}
nl80211_send_rx_assoc(rdev, dev, buf, len, GFP_KERNEL);
-
- if (status_code != WLAN_STATUS_SUCCESS && wdev->conn) {
- cfg80211_sme_failed_assoc(wdev);
- /*
- * do not call connect_result() now because the
- * sme will schedule work that does it later.
- */
- cfg80211_put_bss(wiphy, bss);
- return;
- }
-
- if (!wdev->conn && wdev->sme_state == CFG80211_SME_IDLE) {
- /*
- * This is for the userspace SME, the CONNECTING
- * state will be changed to CONNECTED by
- * __cfg80211_connect_result() below.
- */
- wdev->sme_state = CFG80211_SME_CONNECTING;
- }
-
- /* this consumes the bss reference */
+ /* update current_bss etc., consumes the bss reference */
__cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, ie, len - ieoffs,
status_code,
status_code == WLAN_STATUS_SUCCESS, bss);
}
EXPORT_SYMBOL(cfg80211_rx_assoc_resp);
-static void cfg80211_process_deauth(struct net_device *dev,
+static void cfg80211_process_auth(struct wireless_dev *wdev,
+ const u8 *buf, size_t len)
+{
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+
+ nl80211_send_rx_auth(rdev, wdev->netdev, buf, len, GFP_KERNEL);
+ cfg80211_sme_rx_auth(wdev, buf, len);
+}
+
+static void cfg80211_process_deauth(struct wireless_dev *wdev,
const u8 *buf, size_t len)
{
- struct wireless_dev *wdev = dev->ieee80211_ptr;
- struct wiphy *wiphy = wdev->wiphy;
- struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf;
const u8 *bssid = mgmt->bssid;
- bool was_current = false;
-
- if (wdev->current_bss &&
- ether_addr_equal(wdev->current_bss->pub.bssid, bssid)) {
- cfg80211_unhold_bss(wdev->current_bss);
- cfg80211_put_bss(wiphy, &wdev->current_bss->pub);
- wdev->current_bss = NULL;
- was_current = true;
- }
+ u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
+ bool from_ap = !ether_addr_equal(mgmt->sa, wdev->netdev->dev_addr);
- nl80211_send_deauth(rdev, dev, buf, len, GFP_KERNEL);
+ nl80211_send_deauth(rdev, wdev->netdev, buf, len, GFP_KERNEL);
- if (wdev->sme_state == CFG80211_SME_CONNECTED && was_current) {
- u16 reason_code;
- bool from_ap;
-
- reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
+ if (!wdev->current_bss ||
+ !ether_addr_equal(wdev->current_bss->pub.bssid, bssid))
+ return;
- from_ap = !ether_addr_equal(mgmt->sa, dev->dev_addr);
- __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
- } else if (wdev->sme_state == CFG80211_SME_CONNECTING) {
- __cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, NULL, 0,
- WLAN_STATUS_UNSPECIFIED_FAILURE,
- false, NULL);
- }
+ __cfg80211_disconnected(wdev->netdev, NULL, 0, reason_code, from_ap);
+ cfg80211_sme_deauth(wdev);
}
-static void cfg80211_process_disassoc(struct net_device *dev,
+static void cfg80211_process_disassoc(struct wireless_dev *wdev,
const u8 *buf, size_t len)
{
- struct wireless_dev *wdev = dev->ieee80211_ptr;
- struct wiphy *wiphy = wdev->wiphy;
- struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf;
const u8 *bssid = mgmt->bssid;
- u16 reason_code;
- bool from_ap;
+ u16 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
+ bool from_ap = !ether_addr_equal(mgmt->sa, wdev->netdev->dev_addr);
- nl80211_send_disassoc(rdev, dev, buf, len, GFP_KERNEL);
+ nl80211_send_disassoc(rdev, wdev->netdev, buf, len, GFP_KERNEL);
- if (wdev->sme_state != CFG80211_SME_CONNECTED)
+ if (WARN_ON(!wdev->current_bss ||
+ !ether_addr_equal(wdev->current_bss->pub.bssid, bssid)))
return;
- if (wdev->current_bss &&
- ether_addr_equal(wdev->current_bss->pub.bssid, bssid)) {
- cfg80211_sme_disassoc(dev, wdev->current_bss);
- cfg80211_unhold_bss(wdev->current_bss);
- cfg80211_put_bss(wiphy, &wdev->current_bss->pub);
- wdev->current_bss = NULL;
- } else
- WARN_ON(1);
-
- reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
-
- from_ap = !ether_addr_equal(mgmt->sa, dev->dev_addr);
- __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
+ __cfg80211_disconnected(wdev->netdev, NULL, 0, reason_code, from_ap);
+ cfg80211_sme_disassoc(wdev);
}
void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
- struct wiphy *wiphy = wdev->wiphy;
- struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct ieee80211_mgmt *mgmt = (void *)buf;
ASSERT_WDEV_LOCK(wdev);
@@ -153,14 +109,12 @@ void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len)
if (WARN_ON(len < 2))
return;
- if (ieee80211_is_auth(mgmt->frame_control)) {
- nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL);
- cfg80211_sme_rx_auth(dev, buf, len);
- } else if (ieee80211_is_deauth(mgmt->frame_control)) {
- cfg80211_process_deauth(dev, buf, len);
- } else if (ieee80211_is_disassoc(mgmt->frame_control)) {
- cfg80211_process_disassoc(dev, buf, len);
- }
+ if (ieee80211_is_auth(mgmt->frame_control))
+ cfg80211_process_auth(wdev, buf, len);
+ else if (ieee80211_is_deauth(mgmt->frame_control))
+ cfg80211_process_deauth(wdev, buf, len);
+ else if (ieee80211_is_disassoc(mgmt->frame_control))
+ cfg80211_process_disassoc(wdev, buf, len);
}
EXPORT_SYMBOL(cfg80211_rx_mlme_mgmt);
@@ -173,10 +127,7 @@ void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr)
trace_cfg80211_send_auth_timeout(dev, addr);
nl80211_send_auth_timeout(rdev, dev, addr, GFP_KERNEL);
- if (wdev->sme_state == CFG80211_SME_CONNECTING)
- __cfg80211_connect_result(dev, addr, NULL, 0, NULL, 0,
- WLAN_STATUS_UNSPECIFIED_FAILURE,
- false, NULL);
+ cfg80211_sme_auth_timeout(wdev);
}
EXPORT_SYMBOL(cfg80211_auth_timeout);
@@ -189,10 +140,7 @@ void cfg80211_assoc_timeout(struct net_device *dev, const u8 *addr)
trace_cfg80211_send_assoc_timeout(dev, addr);
nl80211_send_assoc_timeout(rdev, dev, addr, GFP_KERNEL);
- if (wdev->sme_state == CFG80211_SME_CONNECTING)
- __cfg80211_connect_result(dev, addr, NULL, 0, NULL, 0,
- WLAN_STATUS_UNSPECIFIED_FAILURE,
- false, NULL);
+ cfg80211_sme_assoc_timeout(wdev);
}
EXPORT_SYMBOL(cfg80211_assoc_timeout);
@@ -209,9 +157,9 @@ void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len)
return;
if (ieee80211_is_deauth(mgmt->frame_control))
- cfg80211_process_deauth(dev, buf, len);
+ cfg80211_process_deauth(wdev, buf, len);
else
- cfg80211_process_disassoc(dev, buf, len);
+ cfg80211_process_disassoc(wdev, buf, len);
}
EXPORT_SYMBOL(cfg80211_tx_mlme_mgmt);
@@ -336,21 +284,12 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
int err;
- bool was_connected = false;
ASSERT_WDEV_LOCK(wdev);
- if (wdev->current_bss && req->prev_bssid &&
- ether_addr_equal(wdev->current_bss->pub.bssid, req->prev_bssid)) {
- /*
- * Trying to reassociate: Allow this to proceed and let the old
- * association to be dropped when the new one is completed.
- */
- if (wdev->sme_state == CFG80211_SME_CONNECTED) {
- was_connected = true;
- wdev->sme_state = CFG80211_SME_CONNECTING;
- }
- } else if (wdev->current_bss)
+ if (wdev->current_bss &&
+ (!req->prev_bssid || !ether_addr_equal(wdev->current_bss->pub.bssid,
+ req->prev_bssid)))
return -EALREADY;
cfg80211_oper_and_ht_capa(&req->ht_capa_mask,
@@ -360,11 +299,8 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
req->bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len,
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
- if (!req->bss) {
- if (was_connected)
- wdev->sme_state = CFG80211_SME_CONNECTED;
+ if (!req->bss)
return -ENOENT;
- }
err = cfg80211_can_use_chan(rdev, wdev, chan, CHAN_MODE_SHARED);
if (err)
@@ -373,11 +309,8 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
err = rdev_assoc(rdev, dev, req);
out:
- if (err) {
- if (was_connected)
- wdev->sme_state = CFG80211_SME_CONNECTED;
+ if (err)
cfg80211_put_bss(&rdev->wiphy, req->bss);
- }
return err;
}
@@ -398,8 +331,9 @@ int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
ASSERT_WDEV_LOCK(wdev);
- if (local_state_change && (!wdev->current_bss ||
- !ether_addr_equal(wdev->current_bss->pub.bssid, bssid)))
+ if (local_state_change &&
+ (!wdev->current_bss ||
+ !ether_addr_equal(wdev->current_bss->pub.bssid, bssid)))
return 0;
return rdev_deauth(rdev, dev, &req);
@@ -417,13 +351,11 @@ int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
.ie = ie,
.ie_len = ie_len,
};
+ int err;
ASSERT_WDEV_LOCK(wdev);
- if (wdev->sme_state != CFG80211_SME_CONNECTED)
- return -ENOTCONN;
-
- if (WARN(!wdev->current_bss, "sme_state=%d\n", wdev->sme_state))
+ if (!wdev->current_bss)
return -ENOTCONN;
if (ether_addr_equal(wdev->current_bss->pub.bssid, bssid))
@@ -431,7 +363,13 @@ int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
else
return -ENOTCONN;
- return rdev_disassoc(rdev, dev, &req);
+ err = rdev_disassoc(rdev, dev, &req);
+ if (err)
+ return err;
+
+ /* driver should have reported the disassoc */
+ WARN_ON(wdev->current_bss);
+ return 0;
}
void cfg80211_mlme_down(struct cfg80211_registered_device *rdev,
@@ -439,10 +377,6 @@ void cfg80211_mlme_down(struct cfg80211_registered_device *rdev,
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
u8 bssid[ETH_ALEN];
- struct cfg80211_deauth_request req = {
- .reason_code = WLAN_REASON_DEAUTH_LEAVING,
- .bssid = bssid,
- };
ASSERT_WDEV_LOCK(wdev);
@@ -453,13 +387,8 @@ void cfg80211_mlme_down(struct cfg80211_registered_device *rdev,
return;
memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN);
- rdev_deauth(rdev, dev, &req);
-
- if (wdev->current_bss) {
- cfg80211_unhold_bss(wdev->current_bss);
- cfg80211_put_bss(&rdev->wiphy, &wdev->current_bss->pub);
- wdev->current_bss = NULL;
- }
+ cfg80211_mlme_deauth(rdev, dev, bssid, NULL, 0,
+ WLAN_REASON_DEAUTH_LEAVING, false);
}
struct cfg80211_mgmt_registration {
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index afce10f..4d6c676 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -800,12 +800,9 @@ static int nl80211_key_allowed(struct wireless_dev *wdev)
case NL80211_IFTYPE_MESH_POINT:
break;
case NL80211_IFTYPE_ADHOC:
- if (!wdev->current_bss)
- return -ENOLINK;
- break;
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_P2P_CLIENT:
- if (wdev->sme_state != CFG80211_SME_CONNECTED)
+ if (!wdev->current_bss)
return -ENOLINK;
break;
default:
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 81be95f..ae7e2cb 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -1,5 +1,7 @@
/*
- * SME code for cfg80211's connect emulation.
+ * SME code for cfg80211
+ * both driver SME event handling and the SME implementation
+ * (for nl80211's connect() and wext)
*
* Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
* Copyright (C) 2009 Intel Corporation. All rights reserved.
@@ -18,18 +20,24 @@
#include "reg.h"
#include "rdev-ops.h"
+/*
+ * Software SME in cfg80211, using auth/assoc/deauth calls to the
+ * driver. This is is for implementing nl80211's connect/disconnect
+ * and wireless extensions (if configured.)
+ */
+
struct cfg80211_conn {
struct cfg80211_connect_params params;
/* these are sub-states of the _CONNECTING sme_state */
enum {
- CFG80211_CONN_IDLE,
CFG80211_CONN_SCANNING,
CFG80211_CONN_SCAN_AGAIN,
CFG80211_CONN_AUTHENTICATE_NEXT,
CFG80211_CONN_AUTHENTICATING,
CFG80211_CONN_ASSOCIATE_NEXT,
CFG80211_CONN_ASSOCIATING,
- CFG80211_CONN_DEAUTH_ASSOC_FAIL,
+ CFG80211_CONN_DEAUTH,
+ CFG80211_CONN_CONNECTED,
} state;
u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
u8 *ie;
@@ -37,39 +45,16 @@ struct cfg80211_conn {
bool auto_auth, prev_bssid_valid;
};
-static bool cfg80211_is_all_idle(void)
+static void cfg80211_sme_free(struct wireless_dev *wdev)
{
- struct cfg80211_registered_device *rdev;
- struct wireless_dev *wdev;
- bool is_all_idle = true;
-
- /*
- * All devices must be idle as otherwise if you are actively
- * scanning some new beacon hints could be learned and would
- * count as new regulatory hints.
- */
- list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
- list_for_each_entry(wdev, &rdev->wdev_list, list) {
- wdev_lock(wdev);
- if (wdev->sme_state != CFG80211_SME_IDLE)
- is_all_idle = false;
- wdev_unlock(wdev);
- }
- }
-
- return is_all_idle;
-}
+ if (!wdev->conn)
+ return;
-static void disconnect_work(struct work_struct *work)
-{
- rtnl_lock();
- if (cfg80211_is_all_idle())
- regulatory_hint_disconnect();
- rtnl_unlock();
+ kfree(wdev->conn->ie);
+ kfree(wdev->conn);
+ wdev->conn = NULL;
}
-static DECLARE_WORK(cfg80211_disconnect_work, disconnect_work);
-
static int cfg80211_conn_scan(struct wireless_dev *wdev)
{
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
@@ -164,6 +149,9 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev)
params = &wdev->conn->params;
switch (wdev->conn->state) {
+ case CFG80211_CONN_SCANNING:
+ /* didn't find it during scan ... */
+ return -ENOENT;
case CFG80211_CONN_SCAN_AGAIN:
return cfg80211_conn_scan(wdev);
case CFG80211_CONN_AUTHENTICATE_NEXT:
@@ -200,12 +188,11 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev)
WLAN_REASON_DEAUTH_LEAVING,
false);
return err;
- case CFG80211_CONN_DEAUTH_ASSOC_FAIL:
+ case CFG80211_CONN_DEAUTH:
cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
NULL, 0,
WLAN_REASON_DEAUTH_LEAVING, false);
- /* return an error so that we call __cfg80211_connect_result() */
- return -EINVAL;
+ return 0;
default:
return 0;
}
@@ -229,7 +216,8 @@ void cfg80211_conn_work(struct work_struct *work)
wdev_unlock(wdev);
continue;
}
- if (wdev->sme_state != CFG80211_SME_CONNECTING || !wdev->conn) {
+ if (!wdev->conn ||
+ wdev->conn->state == CFG80211_CONN_CONNECTED) {
wdev_unlock(wdev);
continue;
}
@@ -237,12 +225,14 @@ void cfg80211_conn_work(struct work_struct *work)
memcpy(bssid_buf, wdev->conn->params.bssid, ETH_ALEN);
bssid = bssid_buf;
}
- if (cfg80211_conn_do_work(wdev))
+ if (cfg80211_conn_do_work(wdev)) {
__cfg80211_connect_result(
wdev->netdev, bssid,
NULL, 0, NULL, 0,
WLAN_STATUS_UNSPECIFIED_FAILURE,
false, NULL);
+ cfg80211_sme_free(wdev);
+ }
wdev_unlock(wdev);
}
@@ -286,9 +276,6 @@ static void __cfg80211_sme_scan_done(struct net_device *dev)
ASSERT_WDEV_LOCK(wdev);
- if (wdev->sme_state != CFG80211_SME_CONNECTING)
- return;
-
if (!wdev->conn)
return;
@@ -297,20 +284,10 @@ static void __cfg80211_sme_scan_done(struct net_device *dev)
return;
bss = cfg80211_get_conn_bss(wdev);
- if (bss) {
+ if (bss)
cfg80211_put_bss(&rdev->wiphy, bss);
- } else {
- /* not found */
- if (wdev->conn->state == CFG80211_CONN_SCAN_AGAIN)
- schedule_work(&rdev->conn_work);
- else
- __cfg80211_connect_result(
- wdev->netdev,
- wdev->conn->params.bssid,
- NULL, 0, NULL, 0,
- WLAN_STATUS_UNSPECIFIED_FAILURE,
- false, NULL);
- }
+ else
+ schedule_work(&rdev->conn_work);
}
void cfg80211_sme_scan_done(struct net_device *dev)
@@ -322,10 +299,8 @@ void cfg80211_sme_scan_done(struct net_device *dev)
wdev_unlock(wdev);
}
-void cfg80211_sme_rx_auth(struct net_device *dev,
- const u8 *buf, size_t len)
+void cfg80211_sme_rx_auth(struct wireless_dev *wdev, const u8 *buf, size_t len)
{
- struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf;
@@ -333,11 +308,7 @@ void cfg80211_sme_rx_auth(struct net_device *dev,
ASSERT_WDEV_LOCK(wdev);
- /* should only RX auth frames when connecting */
- if (wdev->sme_state != CFG80211_SME_CONNECTING)
- return;
-
- if (WARN_ON(!wdev->conn))
+ if (!wdev->conn || wdev->conn->state == CFG80211_CONN_CONNECTED)
return;
if (status_code == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG &&
@@ -366,46 +337,226 @@ void cfg80211_sme_rx_auth(struct net_device *dev,
wdev->conn->state = CFG80211_CONN_AUTHENTICATE_NEXT;
schedule_work(&rdev->conn_work);
} else if (status_code != WLAN_STATUS_SUCCESS) {
- __cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, NULL, 0,
+ __cfg80211_connect_result(wdev->netdev, mgmt->bssid,
+ NULL, 0, NULL, 0,
status_code, false, NULL);
- } else if (wdev->sme_state == CFG80211_SME_CONNECTING &&
- wdev->conn->state == CFG80211_CONN_AUTHENTICATING) {
+ } else if (wdev->conn->state == CFG80211_CONN_AUTHENTICATING) {
wdev->conn->state = CFG80211_CONN_ASSOCIATE_NEXT;
schedule_work(&rdev->conn_work);
}
}
-bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev)
+bool cfg80211_sme_rx_assoc_resp(struct wireless_dev *wdev, u16 status)
{
- struct wiphy *wiphy = wdev->wiphy;
- struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
- if (WARN_ON(!wdev->conn))
+ if (!wdev->conn)
return false;
- if (!wdev->conn->prev_bssid_valid)
+ if (status == WLAN_STATUS_SUCCESS) {
+ wdev->conn->state = CFG80211_CONN_CONNECTED;
return false;
+ }
- /*
- * Some stupid APs don't accept reassoc, so we
- * need to fall back to trying regular assoc.
- */
- wdev->conn->prev_bssid_valid = false;
- wdev->conn->state = CFG80211_CONN_ASSOCIATE_NEXT;
+ if (wdev->conn->prev_bssid_valid) {
+ /*
+ * Some stupid APs don't accept reassoc, so we
+ * need to fall back to trying regular assoc;
+ * return true so no event is sent to userspace.
+ */
+ wdev->conn->prev_bssid_valid = false;
+ wdev->conn->state = CFG80211_CONN_ASSOCIATE_NEXT;
+ schedule_work(&rdev->conn_work);
+ return true;
+ }
+
+ wdev->conn->state = CFG80211_CONN_DEAUTH;
schedule_work(&rdev->conn_work);
+ return false;
+}
- return true;
+void cfg80211_sme_deauth(struct wireless_dev *wdev)
+{
+ cfg80211_sme_free(wdev);
}
-void cfg80211_sme_failed_assoc(struct wireless_dev *wdev)
+void cfg80211_sme_auth_timeout(struct wireless_dev *wdev)
{
- struct wiphy *wiphy = wdev->wiphy;
- struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+ cfg80211_sme_free(wdev);
+}
- wdev->conn->state = CFG80211_CONN_DEAUTH_ASSOC_FAIL;
+void cfg80211_sme_disassoc(struct wireless_dev *wdev)
+{
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+
+ if (!wdev->conn)
+ return;
+
+ wdev->conn->state = CFG80211_CONN_DEAUTH;
schedule_work(&rdev->conn_work);
}
+void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev)
+{
+ cfg80211_sme_disassoc(wdev);
+}
+
+static int cfg80211_sme_connect(struct wireless_dev *wdev,
+ struct cfg80211_connect_params *connect,
+ const u8 *prev_bssid)
+{
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+ struct cfg80211_bss *bss;
+ int err;
+
+ if (!rdev->ops->auth || !rdev->ops->assoc)
+ return -EOPNOTSUPP;
+
+ if (wdev->current_bss)
+ return -EALREADY;
+
+ if (WARN_ON(wdev->conn))
+ return -EINPROGRESS;
+
+ wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL);
+ if (!wdev->conn)
+ return -ENOMEM;
+
+ /*
+ * Copy all parameters, and treat explicitly IEs, BSSID, SSID.
+ */
+ memcpy(&wdev->conn->params, connect, sizeof(*connect));
+ if (connect->bssid) {
+ wdev->conn->params.bssid = wdev->conn->bssid;
+ memcpy(wdev->conn->bssid, connect->bssid, ETH_ALEN);
+ }
+
+ if (connect->ie) {
+ wdev->conn->ie = kmemdup(connect->ie, connect->ie_len,
+ GFP_KERNEL);
+ wdev->conn->params.ie = wdev->conn->ie;
+ if (!wdev->conn->ie) {
+ kfree(wdev->conn);
+ wdev->conn = NULL;
+ return -ENOMEM;
+ }
+ }
+
+ if (connect->auth_type == NL80211_AUTHTYPE_AUTOMATIC) {
+ wdev->conn->auto_auth = true;
+ /* start with open system ... should mostly work */
+ wdev->conn->params.auth_type =
+ NL80211_AUTHTYPE_OPEN_SYSTEM;
+ } else {
+ wdev->conn->auto_auth = false;
+ }
+
+ wdev->conn->params.ssid = wdev->ssid;
+ wdev->conn->params.ssid_len = connect->ssid_len;
+
+ /* see if we have the bss already */
+ bss = cfg80211_get_conn_bss(wdev);
+
+ if (prev_bssid) {
+ memcpy(wdev->conn->prev_bssid, prev_bssid, ETH_ALEN);
+ wdev->conn->prev_bssid_valid = true;
+ }
+
+ /* we're good if we have a matching bss struct */
+ if (bss) {
+ wdev->conn->state = CFG80211_CONN_AUTHENTICATE_NEXT;
+ err = cfg80211_conn_do_work(wdev);
+ cfg80211_put_bss(wdev->wiphy, bss);
+ } else {
+ /* otherwise we'll need to scan for the AP first */
+ err = cfg80211_conn_scan(wdev);
+
+ /*
+ * If we can't scan right now, then we need to scan again
+ * after the current scan finished, since the parameters
+ * changed (unless we find a good AP anyway).
+ */
+ if (err == -EBUSY) {
+ err = 0;
+ wdev->conn->state = CFG80211_CONN_SCAN_AGAIN;
+ }
+ }
+
+ if (err)
+ cfg80211_sme_free(wdev);
+
+ return err;
+}
+
+static int cfg80211_sme_disconnect(struct wireless_dev *wdev, u16 reason)
+{
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+ int err;
+
+ if (!wdev->conn)
+ return 0;
+
+ if (!rdev->ops->deauth)
+ return -EOPNOTSUPP;
+
+ if (wdev->conn->state == CFG80211_CONN_SCANNING ||
+ wdev->conn->state == CFG80211_CONN_SCAN_AGAIN) {
+ err = 0;
+ goto out;
+ }
+
+ /* wdev->conn->params.bssid must be set if > SCANNING */
+ err = cfg80211_mlme_deauth(rdev, wdev->netdev,
+ wdev->conn->params.bssid,
+ NULL, 0, reason, false);
+ out:
+ cfg80211_sme_free(wdev);
+ return err;
+}
+
+/*
+ * code shared for in-device and software SME
+ */
+
+static bool cfg80211_is_all_idle(void)
+{
+ struct cfg80211_registered_device *rdev;
+ struct wireless_dev *wdev;
+ bool is_all_idle = true;
+
+ /*
+ * All devices must be idle as otherwise if you are actively
+ * scanning some new beacon hints could be learned and would
+ * count as new regulatory hints.
+ */
+ list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
+ list_for_each_entry(wdev, &rdev->wdev_list, list) {
+ wdev_lock(wdev);
+ if (wdev->conn || wdev->current_bss)
+ is_all_idle = false;
+ wdev_unlock(wdev);
+ }
+ }
+
+ return is_all_idle;
+}
+
+static void disconnect_work(struct work_struct *work)
+{
+ rtnl_lock();
+ if (cfg80211_is_all_idle())
+ regulatory_hint_disconnect();
+ rtnl_unlock();
+}
+
+static DECLARE_WORK(cfg80211_disconnect_work, disconnect_work);
+
+
+/*
+ * API calls for drivers implementing connect/disconnect and
+ * SME event handling
+ */
+
void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len,
@@ -424,9 +575,6 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
wdev->iftype != NL80211_IFTYPE_P2P_CLIENT))
return;
- if (wdev->sme_state != CFG80211_SME_CONNECTING)
- return;
-
nl80211_send_connect_result(wiphy_to_dev(wdev->wiphy), dev,
bssid, req_ie, req_ie_len,
resp_ie, resp_ie_len,
@@ -463,15 +611,7 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
wdev->current_bss = NULL;
}
- if (wdev->conn)
- wdev->conn->state = CFG80211_CONN_IDLE;
-
if (status != WLAN_STATUS_SUCCESS) {
- wdev->sme_state = CFG80211_SME_IDLE;
- if (wdev->conn)
- kfree(wdev->conn->ie);
- kfree(wdev->conn);
- wdev->conn = NULL;
kfree(wdev->connect_keys);
wdev->connect_keys = NULL;
wdev->ssid_len = 0;
@@ -480,21 +620,16 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
}
if (!bss)
- bss = cfg80211_get_bss(wdev->wiphy,
- wdev->conn ? wdev->conn->params.channel :
- NULL,
- bssid,
+ bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid,
wdev->ssid, wdev->ssid_len,
WLAN_CAPABILITY_ESS,
WLAN_CAPABILITY_ESS);
-
if (WARN_ON(!bss))
return;
cfg80211_hold_bss(bss_from_pub(bss));
wdev->current_bss = bss_from_pub(bss);
- wdev->sme_state = CFG80211_SME_CONNECTED;
cfg80211_upload_connect_keys(wdev);
rcu_read_lock();
@@ -530,8 +665,6 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
struct cfg80211_event *ev;
unsigned long flags;
- CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTING);
-
ev = kzalloc(sizeof(*ev) + req_ie_len + resp_ie_len, gfp);
if (!ev)
return;
@@ -572,13 +705,8 @@ void __cfg80211_roamed(struct wireless_dev *wdev,
wdev->iftype != NL80211_IFTYPE_P2P_CLIENT))
goto out;
- if (wdev->sme_state != CFG80211_SME_CONNECTED)
- goto out;
-
- /* internal error -- how did we get to CONNECTED w/o BSS? */
- if (WARN_ON(!wdev->current_bss)) {
+ if (WARN_ON(!wdev->current_bss))
goto out;
- }
cfg80211_unhold_bss(wdev->current_bss);
cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub);
@@ -628,8 +756,6 @@ void cfg80211_roamed(struct net_device *dev,
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_bss *bss;
- CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTED);
-
bss = cfg80211_get_bss(wdev->wiphy, channel, bssid, wdev->ssid,
wdev->ssid_len, WLAN_CAPABILITY_ESS,
WLAN_CAPABILITY_ESS);
@@ -651,8 +777,6 @@ void cfg80211_roamed_bss(struct net_device *dev,
struct cfg80211_event *ev;
unsigned long flags;
- CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTED);
-
if (WARN_ON(!bss))
return;
@@ -694,25 +818,14 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
wdev->iftype != NL80211_IFTYPE_P2P_CLIENT))
return;
- if (wdev->sme_state != CFG80211_SME_CONNECTED)
- return;
-
if (wdev->current_bss) {
cfg80211_unhold_bss(wdev->current_bss);
cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub);
}
wdev->current_bss = NULL;
- wdev->sme_state = CFG80211_SME_IDLE;
wdev->ssid_len = 0;
- if (wdev->conn) {
- kfree(wdev->conn->ie);
- wdev->conn->ie = NULL;
- kfree(wdev->conn);
- wdev->conn = NULL;
- }
-
nl80211_send_disconnected(rdev, dev, reason, ie, ie_len, from_ap);
/*
@@ -741,8 +854,6 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason,
struct cfg80211_event *ev;
unsigned long flags;
- CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTED);
-
ev = kzalloc(sizeof(*ev) + ie_len, gfp);
if (!ev)
return;
@@ -760,6 +871,9 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason,
}
EXPORT_SYMBOL(cfg80211_disconnected);
+/*
+ * API calls for nl80211/wext compatibility code
+ */
int cfg80211_connect(struct cfg80211_registered_device *rdev,
struct net_device *dev,
struct cfg80211_connect_params *connect,
@@ -767,14 +881,10 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev,
const u8 *prev_bssid)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
- struct cfg80211_bss *bss = NULL;
int err;
ASSERT_WDEV_LOCK(wdev);
- if (wdev->sme_state != CFG80211_SME_IDLE)
- return -EALREADY;
-
if (WARN_ON(wdev->connect_keys)) {
kfree(wdev->connect_keys);
wdev->connect_keys = NULL;
@@ -810,105 +920,22 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev,
}
}
- if (!rdev->ops->connect) {
- if (!rdev->ops->auth || !rdev->ops->assoc)
- return -EOPNOTSUPP;
-
- if (WARN_ON(wdev->conn))
- return -EINPROGRESS;
-
- wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL);
- if (!wdev->conn)
- return -ENOMEM;
-
- /*
- * Copy all parameters, and treat explicitly IEs, BSSID, SSID.
- */
- memcpy(&wdev->conn->params, connect, sizeof(*connect));
- if (connect->bssid) {
- wdev->conn->params.bssid = wdev->conn->bssid;
- memcpy(wdev->conn->bssid, connect->bssid, ETH_ALEN);
- }
+ wdev->connect_keys = connkeys;
+ memcpy(wdev->ssid, connect->ssid, connect->ssid_len);
+ wdev->ssid_len = connect->ssid_len;
- if (connect->ie) {
- wdev->conn->ie = kmemdup(connect->ie, connect->ie_len,
- GFP_KERNEL);
- wdev->conn->params.ie = wdev->conn->ie;
- if (!wdev->conn->ie) {
- kfree(wdev->conn);
- wdev->conn = NULL;
- return -ENOMEM;
- }
- }
-
- if (connect->auth_type == NL80211_AUTHTYPE_AUTOMATIC) {
- wdev->conn->auto_auth = true;
- /* start with open system ... should mostly work */
- wdev->conn->params.auth_type =
- NL80211_AUTHTYPE_OPEN_SYSTEM;
- } else {
- wdev->conn->auto_auth = false;
- }
-
- memcpy(wdev->ssid, connect->ssid, connect->ssid_len);
- wdev->ssid_len = connect->ssid_len;
- wdev->conn->params.ssid = wdev->ssid;
- wdev->conn->params.ssid_len = connect->ssid_len;
-
- /* see if we have the bss already */
- bss = cfg80211_get_conn_bss(wdev);
-
- wdev->sme_state = CFG80211_SME_CONNECTING;
- wdev->connect_keys = connkeys;
-
- if (prev_bssid) {
- memcpy(wdev->conn->prev_bssid, prev_bssid, ETH_ALEN);
- wdev->conn->prev_bssid_valid = true;
- }
-
- /* we're good if we have a matching bss struct */
- if (bss) {
- wdev->conn->state = CFG80211_CONN_AUTHENTICATE_NEXT;
- err = cfg80211_conn_do_work(wdev);
- cfg80211_put_bss(wdev->wiphy, bss);
- } else {
- /* otherwise we'll need to scan for the AP first */
- err = cfg80211_conn_scan(wdev);
- /*
- * If we can't scan right now, then we need to scan again
- * after the current scan finished, since the parameters
- * changed (unless we find a good AP anyway).
- */
- if (err == -EBUSY) {
- err = 0;
- wdev->conn->state = CFG80211_CONN_SCAN_AGAIN;
- }
- }
- if (err) {
- kfree(wdev->conn->ie);
- kfree(wdev->conn);
- wdev->conn = NULL;
- wdev->sme_state = CFG80211_SME_IDLE;
- wdev->connect_keys = NULL;
- wdev->ssid_len = 0;
- }
-
- return err;
- } else {
- wdev->sme_state = CFG80211_SME_CONNECTING;
- wdev->connect_keys = connkeys;
+ if (!rdev->ops->connect)
+ err = cfg80211_sme_connect(wdev, connect, prev_bssid);
+ else
err = rdev_connect(rdev, dev, connect);
- if (err) {
- wdev->connect_keys = NULL;
- wdev->sme_state = CFG80211_SME_IDLE;
- return err;
- }
- memcpy(wdev->ssid, connect->ssid, connect->ssid_len);
- wdev->ssid_len = connect->ssid_len;
-
- return 0;
+ if (err) {
+ wdev->connect_keys = NULL;
+ wdev->ssid_len = 0;
+ return err;
}
+
+ return 0;
}
int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
@@ -919,78 +946,17 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
ASSERT_WDEV_LOCK(wdev);
- if (wdev->sme_state == CFG80211_SME_IDLE)
- return -EINVAL;
-
kfree(wdev->connect_keys);
wdev->connect_keys = NULL;
- if (!rdev->ops->disconnect) {
- if (!rdev->ops->deauth)
- return -EOPNOTSUPP;
-
- /* was it connected by userspace SME? */
- if (!wdev->conn) {
- cfg80211_mlme_down(rdev, dev);
- goto disconnect;
- }
-
- if (wdev->sme_state == CFG80211_SME_CONNECTING &&
- (wdev->conn->state == CFG80211_CONN_SCANNING ||
- wdev->conn->state == CFG80211_CONN_SCAN_AGAIN)) {
- wdev->sme_state = CFG80211_SME_IDLE;
- kfree(wdev->conn->ie);
- kfree(wdev->conn);
- wdev->conn = NULL;
- wdev->ssid_len = 0;
- return 0;
- }
-
- /* wdev->conn->params.bssid must be set if > SCANNING */
- err = cfg80211_mlme_deauth(rdev, dev,
- wdev->conn->params.bssid,
- NULL, 0, reason, false);
- if (err)
- return err;
+ if (wdev->conn) {
+ err = cfg80211_sme_disconnect(wdev, reason);
+ } else if (!rdev->ops->disconnect) {
+ cfg80211_mlme_down(rdev, dev);
+ err = 0;
} else {
err = rdev_disconnect(rdev, dev, reason);
- if (err)
- return err;
}
- disconnect:
- if (wdev->sme_state == CFG80211_SME_CONNECTED)
- __cfg80211_disconnected(dev, NULL, 0, 0, false);
- else if (wdev->sme_state == CFG80211_SME_CONNECTING)
- __cfg80211_connect_result(dev, NULL, NULL, 0, NULL, 0,
- WLAN_STATUS_UNSPECIFIED_FAILURE,
- wextev, NULL);
-
- return 0;
-}
-
-void cfg80211_sme_disassoc(struct net_device *dev,
- struct cfg80211_internal_bss *bss)
-{
- struct wireless_dev *wdev = dev->ieee80211_ptr;
- struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
- u8 bssid[ETH_ALEN];
-
- ASSERT_WDEV_LOCK(wdev);
-
- if (!wdev->conn)
- return;
-
- if (wdev->conn->state == CFG80211_CONN_IDLE)
- return;
-
- /*
- * Ok, so the association was made by this SME -- we don't
- * want it any more so deauthenticate too.
- */
-
- memcpy(bssid, bss->pub.bssid, ETH_ALEN);
-
- cfg80211_mlme_deauth(rdev, dev, bssid, NULL, 0,
- WLAN_REASON_DEAUTH_LEAVING, false);
+ return err;
}
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index a53f8404..14c9a25 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -89,7 +89,7 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
wdev_lock(wdev);
- if (wdev->sme_state != CFG80211_SME_IDLE) {
+ if (wdev->conn) {
bool event = true;
if (wdev->wext.connect.channel == chan) {
@@ -188,7 +188,7 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev,
err = 0;
- if (wdev->sme_state != CFG80211_SME_IDLE) {
+ if (wdev->conn) {
bool event = true;
if (wdev->wext.connect.ssid && len &&
@@ -277,7 +277,7 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev,
wdev_lock(wdev);
- if (wdev->sme_state != CFG80211_SME_IDLE) {
+ if (wdev->conn) {
err = 0;
/* both automatic */
if (!bssid && !wdev->wext.connect.bssid)
@@ -364,7 +364,7 @@ int cfg80211_wext_siwgenie(struct net_device *dev,
wdev->wext.ie = ie;
wdev->wext.ie_len = ie_len;
- if (wdev->sme_state != CFG80211_SME_IDLE) {
+ if (wdev->conn) {
err = cfg80211_disconnect(rdev, dev,
WLAN_REASON_DEAUTH_LEAVING, false);
if (err)
--
1.8.0
^ permalink raw reply related
* [PATCH 1/2] cfg80211/mac80211: clean up cfg80211 SME APIs
From: Johannes Berg @ 2013-05-27 9:11 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
In-Reply-To: <1369645862-29054-1-git-send-email-johannes@sipsolutions.net>
From: Johannes Berg <johannes.berg@intel.com>
Do some cleanups in the cfg80211 SME APIs, which are
only used by mac80211.
Most of these functions get a frame passed, and there
isn't really any reason to export multiple functions
as cfg80211 can check the frame type instead, do that.
Additionally, the API functions have confusing names
like cfg80211_send_...() which was meant to indicate
that it sends an event to userspace, but gets a bit
confusing when there's both TX and RX and they're not
all clearly labeled.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/net/cfg80211.h | 91 ++++++++++++++++++++------------------------------
net/mac80211/mlme.c | 44 ++++++++++++------------
net/mac80211/rx.c | 26 ++++++---------
net/wireless/mlme.c | 86 +++++++++++++++++++++++++++++------------------
net/wireless/nl80211.c | 30 ++++++++---------
net/wireless/trace.h | 46 ++++++++++++++++++-------
6 files changed, 170 insertions(+), 153 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9f45d74..cba6c5b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3427,59 +3427,66 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
/**
- * cfg80211_send_rx_auth - notification of processed authentication
+ * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
* @dev: network device
* @buf: authentication frame (header + body)
* @len: length of the frame data
*
- * This function is called whenever an authentication has been processed in
- * station mode. The driver is required to call either this function or
- * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
- * call. This function may sleep. The caller must hold the corresponding wdev's
- * mutex.
+ * This function is called whenever an authentication, disassociation or
+ * deauthentication frame has been received and processed in station mode.
+ * After being asked to authenticate via cfg80211_ops::auth() the driver must
+ * call either this function or cfg80211_auth_timeout().
+ * After being asked to associate via cfg80211_ops::assoc() the driver must
+ * call either this function or cfg80211_auth_timeout().
+ * While connected, the driver must calls this for received and processed
+ * disassociation and deauthentication frames. If the frame couldn't be used
+ * because it was unprotected, the driver must call the function
+ * cfg80211_rx_unprot_mlme_mgmt() instead.
+ *
+ * This function may sleep. The caller must hold the corresponding wdev's mutex.
*/
-void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
+void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
/**
- * cfg80211_send_auth_timeout - notification of timed out authentication
+ * cfg80211_auth_timeout - notification of timed out authentication
* @dev: network device
* @addr: The MAC address of the device with which the authentication timed out
*
* This function may sleep. The caller must hold the corresponding wdev's
* mutex.
*/
-void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
+void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
/**
- * cfg80211_send_rx_assoc - notification of processed association
+ * cfg80211_rx_assoc_resp - notification of processed association response
* @dev: network device
- * @bss: the BSS struct association was requested for, the struct reference
- * is owned by cfg80211 after this call
- * @buf: (re)association response frame (header + body)
+ * @bss: the BSS that association was requested with, ownership of the pointer
+ * moves to cfg80211 in this call
+ * @buf: authentication frame (header + body)
* @len: length of the frame data
*
- * This function is called whenever a (re)association response has been
- * processed in station mode. The driver is required to call either this
- * function or cfg80211_send_assoc_timeout() to indicate the result of
- * cfg80211_ops::assoc() call. This function may sleep. The caller must hold
- * the corresponding wdev's mutex.
+ * After being asked to associate via cfg80211_ops::assoc() the driver must
+ * call either this function or cfg80211_auth_timeout().
+ *
+ * This function may sleep. The caller must hold the corresponding wdev's mutex.
*/
-void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
+void cfg80211_rx_assoc_resp(struct net_device *dev,
+ struct cfg80211_bss *bss,
const u8 *buf, size_t len);
/**
- * cfg80211_send_assoc_timeout - notification of timed out association
+ * cfg80211_assoc_timeout - notification of timed out association
* @dev: network device
* @addr: The MAC address of the device with which the association timed out
*
* This function may sleep. The caller must hold the corresponding wdev's mutex.
*/
-void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
+void cfg80211_assoc_timeout(struct net_device *dev, const u8 *addr);
/**
- * cfg80211_send_deauth - notification of processed deauthentication
+ * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
* @dev: network device
- * @buf: deauthentication frame (header + body)
+ * @buf: 802.11 frame (header + body)
* @len: length of the frame data
*
* This function is called whenever deauthentication has been processed in
@@ -3487,46 +3494,20 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
* locally generated ones. This function may sleep. The caller must hold the
* corresponding wdev's mutex.
*/
-void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
+void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
/**
- * cfg80211_send_disassoc - notification of processed disassociation
- * @dev: network device
- * @buf: disassociation response frame (header + body)
- * @len: length of the frame data
- *
- * This function is called whenever disassociation has been processed in
- * station mode. This includes both received disassociation frames and locally
- * generated ones. This function may sleep. The caller must hold the
- * corresponding wdev's mutex.
- */
-void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
-
-/**
- * cfg80211_send_unprot_deauth - notification of unprotected deauthentication
+ * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
* @dev: network device
* @buf: deauthentication frame (header + body)
* @len: length of the frame data
*
- * This function is called whenever a received Deauthentication frame has been
- * dropped in station mode because of MFP being used but the Deauthentication
- * frame was not protected. This function may sleep.
- */
-void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf,
- size_t len);
-
-/**
- * cfg80211_send_unprot_disassoc - notification of unprotected disassociation
- * @dev: network device
- * @buf: disassociation frame (header + body)
- * @len: length of the frame data
- *
- * This function is called whenever a received Disassociation frame has been
- * dropped in station mode because of MFP being used but the Disassociation
+ * This function is called whenever a received deauthentication or dissassoc
+ * frame has been dropped in station mode because of MFP being used but the
* frame was not protected. This function may sleep.
*/
-void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf,
- size_t len);
+void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
+ const u8 *buf, size_t len);
/**
* cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index f44f4ca..42f03ae 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2151,7 +2151,8 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata)
IEEE80211_MAX_QUEUE_MAP,
IEEE80211_QUEUE_STOP_REASON_CSA);
- cfg80211_send_deauth(sdata->dev, frame_buf, IEEE80211_DEAUTH_FRAME_LEN);
+ cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
+ IEEE80211_DEAUTH_FRAME_LEN);
sdata_unlock(sdata);
}
@@ -2298,7 +2299,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
sdata_info(sdata, "%pM denied authentication (status %d)\n",
mgmt->sa, status_code);
ieee80211_destroy_auth_data(sdata, false);
- cfg80211_send_rx_auth(sdata->dev, (u8 *)mgmt, len);
+ cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
return;
}
@@ -2333,7 +2334,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
* Report auth frame to user space for processing since another
* round of Authentication frames is still needed.
*/
- cfg80211_send_rx_auth(sdata->dev, (u8 *)mgmt, len);
+ cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
return;
}
@@ -2350,7 +2351,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
}
mutex_unlock(&sdata->local->sta_mtx);
- cfg80211_send_rx_auth(sdata->dev, (u8 *)mgmt, len);
+ cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
return;
out_err:
mutex_unlock(&sdata->local->sta_mtx);
@@ -2383,7 +2384,7 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
- cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, len);
+ cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
}
@@ -2409,7 +2410,7 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
- cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, len);
+ cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
}
static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
@@ -2707,7 +2708,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
/* oops -- internal error -- send timeout for now */
ieee80211_destroy_assoc_data(sdata, false);
cfg80211_put_bss(sdata->local->hw.wiphy, bss);
- cfg80211_send_assoc_timeout(sdata->dev, mgmt->bssid);
+ cfg80211_assoc_timeout(sdata->dev, mgmt->bssid);
return;
}
sdata_info(sdata, "associated\n");
@@ -2720,7 +2721,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
ieee80211_destroy_assoc_data(sdata, true);
}
- cfg80211_send_rx_assoc(sdata->dev, bss, (u8 *)mgmt, len);
+ cfg80211_rx_assoc_resp(sdata->dev, bss, (u8 *)mgmt, len);
}
static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
@@ -3113,8 +3114,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
WLAN_REASON_DEAUTH_LEAVING,
true, deauth_buf);
- cfg80211_send_deauth(sdata->dev, deauth_buf,
- sizeof(deauth_buf));
+ cfg80211_tx_mlme_mgmt(sdata->dev, deauth_buf,
+ sizeof(deauth_buf));
return;
}
@@ -3232,7 +3233,8 @@ static void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata,
ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason,
tx, frame_buf);
- cfg80211_send_deauth(sdata->dev, frame_buf, IEEE80211_DEAUTH_FRAME_LEN);
+ cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
+ IEEE80211_DEAUTH_FRAME_LEN);
}
static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
@@ -3423,7 +3425,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
ieee80211_destroy_auth_data(sdata, false);
- cfg80211_send_auth_timeout(sdata->dev, bssid);
+ cfg80211_auth_timeout(sdata->dev, bssid);
}
} else if (ifmgd->auth_data && ifmgd->auth_data->timeout_started)
run_again(sdata, ifmgd->auth_data->timeout);
@@ -3439,7 +3441,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
ieee80211_destroy_assoc_data(sdata, false);
- cfg80211_send_assoc_timeout(sdata->dev, bssid);
+ cfg80211_assoc_timeout(sdata->dev, bssid);
}
} else if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started)
run_again(sdata, ifmgd->assoc_data->timeout);
@@ -3988,8 +3990,8 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
WLAN_REASON_UNSPECIFIED,
false, frame_buf);
- cfg80211_send_deauth(sdata->dev, frame_buf,
- sizeof(frame_buf));
+ cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
+ sizeof(frame_buf));
}
sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid);
@@ -4051,8 +4053,8 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
WLAN_REASON_UNSPECIFIED,
false, frame_buf);
- cfg80211_send_deauth(sdata->dev, frame_buf,
- sizeof(frame_buf));
+ cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
+ sizeof(frame_buf));
}
if (ifmgd->auth_data && !ifmgd->auth_data->done) {
@@ -4305,8 +4307,8 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
out:
if (report_frame)
- cfg80211_send_deauth(sdata->dev, frame_buf,
- IEEE80211_DEAUTH_FRAME_LEN);
+ cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
+ IEEE80211_DEAUTH_FRAME_LEN);
return 0;
}
@@ -4336,8 +4338,8 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
req->reason_code, !req->local_state_change,
frame_buf);
- cfg80211_send_disassoc(sdata->dev, frame_buf,
- IEEE80211_DEAUTH_FRAME_LEN);
+ cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
+ IEEE80211_DEAUTH_FRAME_LEN);
return 0;
}
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index bdd7b4a..23dbcfc 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1747,27 +1747,21 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
if (unlikely(!ieee80211_has_protected(fc) &&
ieee80211_is_unicast_robust_mgmt_frame(rx->skb) &&
rx->key)) {
- if (ieee80211_is_deauth(fc))
- cfg80211_send_unprot_deauth(rx->sdata->dev,
- rx->skb->data,
- rx->skb->len);
- else if (ieee80211_is_disassoc(fc))
- cfg80211_send_unprot_disassoc(rx->sdata->dev,
- rx->skb->data,
- rx->skb->len);
+ if (ieee80211_is_deauth(fc) ||
+ ieee80211_is_disassoc(fc))
+ cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev,
+ rx->skb->data,
+ rx->skb->len);
return -EACCES;
}
/* BIP does not use Protected field, so need to check MMIE */
if (unlikely(ieee80211_is_multicast_robust_mgmt_frame(rx->skb) &&
ieee80211_get_mmie_keyidx(rx->skb) < 0)) {
- if (ieee80211_is_deauth(fc))
- cfg80211_send_unprot_deauth(rx->sdata->dev,
- rx->skb->data,
- rx->skb->len);
- else if (ieee80211_is_disassoc(fc))
- cfg80211_send_unprot_disassoc(rx->sdata->dev,
- rx->skb->data,
- rx->skb->len);
+ if (ieee80211_is_deauth(fc) ||
+ ieee80211_is_disassoc(fc))
+ cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev,
+ rx->skb->data,
+ rx->skb->len);
return -EACCES;
}
/*
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 7bde5d9..4b9c2be 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -18,20 +18,7 @@
#include "rdev-ops.h"
-void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len)
-{
- struct wireless_dev *wdev = dev->ieee80211_ptr;
- struct wiphy *wiphy = wdev->wiphy;
- struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
-
- trace_cfg80211_send_rx_auth(dev);
-
- nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL);
- cfg80211_sme_rx_auth(dev, buf, len);
-}
-EXPORT_SYMBOL(cfg80211_send_rx_auth);
-
-void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
+void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss,
const u8 *buf, size_t len)
{
u16 status_code;
@@ -84,10 +71,10 @@ void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
status_code,
status_code == WLAN_STATUS_SUCCESS, bss);
}
-EXPORT_SYMBOL(cfg80211_send_rx_assoc);
+EXPORT_SYMBOL(cfg80211_rx_assoc_resp);
-void cfg80211_send_deauth(struct net_device *dev,
- const u8 *buf, size_t len)
+static void cfg80211_process_deauth(struct net_device *dev,
+ const u8 *buf, size_t len)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
@@ -96,9 +83,6 @@ void cfg80211_send_deauth(struct net_device *dev,
const u8 *bssid = mgmt->bssid;
bool was_current = false;
- trace_cfg80211_send_deauth(dev);
- ASSERT_WDEV_LOCK(wdev);
-
if (wdev->current_bss &&
ether_addr_equal(wdev->current_bss->pub.bssid, bssid)) {
cfg80211_unhold_bss(wdev->current_bss);
@@ -123,10 +107,9 @@ void cfg80211_send_deauth(struct net_device *dev,
false, NULL);
}
}
-EXPORT_SYMBOL(cfg80211_send_deauth);
-void cfg80211_send_disassoc(struct net_device *dev,
- const u8 *buf, size_t len)
+static void cfg80211_process_disassoc(struct net_device *dev,
+ const u8 *buf, size_t len)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
@@ -136,9 +119,6 @@ void cfg80211_send_disassoc(struct net_device *dev,
u16 reason_code;
bool from_ap;
- trace_cfg80211_send_disassoc(dev);
- ASSERT_WDEV_LOCK(wdev);
-
nl80211_send_disassoc(rdev, dev, buf, len, GFP_KERNEL);
if (wdev->sme_state != CFG80211_SME_CONNECTED)
@@ -153,15 +133,38 @@ void cfg80211_send_disassoc(struct net_device *dev,
} else
WARN_ON(1);
-
reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
from_ap = !ether_addr_equal(mgmt->sa, dev->dev_addr);
__cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
}
-EXPORT_SYMBOL(cfg80211_send_disassoc);
-void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr)
+void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len)
+{
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct wiphy *wiphy = wdev->wiphy;
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+ struct ieee80211_mgmt *mgmt = (void *)buf;
+
+ ASSERT_WDEV_LOCK(wdev);
+
+ trace_cfg80211_rx_mlme_mgmt(dev, buf, len);
+
+ if (WARN_ON(len < 2))
+ return;
+
+ if (ieee80211_is_auth(mgmt->frame_control)) {
+ nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL);
+ cfg80211_sme_rx_auth(dev, buf, len);
+ } else if (ieee80211_is_deauth(mgmt->frame_control)) {
+ cfg80211_process_deauth(dev, buf, len);
+ } else if (ieee80211_is_disassoc(mgmt->frame_control)) {
+ cfg80211_process_disassoc(dev, buf, len);
+ }
+}
+EXPORT_SYMBOL(cfg80211_rx_mlme_mgmt);
+
+void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
@@ -175,9 +178,9 @@ void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr)
WLAN_STATUS_UNSPECIFIED_FAILURE,
false, NULL);
}
-EXPORT_SYMBOL(cfg80211_send_auth_timeout);
+EXPORT_SYMBOL(cfg80211_auth_timeout);
-void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr)
+void cfg80211_assoc_timeout(struct net_device *dev, const u8 *addr)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
@@ -191,7 +194,26 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr)
WLAN_STATUS_UNSPECIFIED_FAILURE,
false, NULL);
}
-EXPORT_SYMBOL(cfg80211_send_assoc_timeout);
+EXPORT_SYMBOL(cfg80211_assoc_timeout);
+
+void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len)
+{
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct ieee80211_mgmt *mgmt = (void *)buf;
+
+ ASSERT_WDEV_LOCK(wdev);
+
+ trace_cfg80211_tx_mlme_mgmt(dev, buf, len);
+
+ if (WARN_ON(len < 2))
+ return;
+
+ if (ieee80211_is_deauth(mgmt->frame_control))
+ cfg80211_process_deauth(dev, buf, len);
+ else
+ cfg80211_process_disassoc(dev, buf, len);
+}
+EXPORT_SYMBOL(cfg80211_tx_mlme_mgmt);
void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
enum nl80211_key_type key_type, int key_id,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a09f36b..afce10f 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -9302,31 +9302,27 @@ void nl80211_send_disassoc(struct cfg80211_registered_device *rdev,
NL80211_CMD_DISASSOCIATE, gfp);
}
-void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf,
- size_t len)
+void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, const u8 *buf,
+ size_t len)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+ const struct ieee80211_mgmt *mgmt = (void *)buf;
+ u32 cmd;
- trace_cfg80211_send_unprot_deauth(dev);
- nl80211_send_mlme_event(rdev, dev, buf, len,
- NL80211_CMD_UNPROT_DEAUTHENTICATE, GFP_ATOMIC);
-}
-EXPORT_SYMBOL(cfg80211_send_unprot_deauth);
+ if (WARN_ON(len < 2))
+ return;
-void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf,
- size_t len)
-{
- struct wireless_dev *wdev = dev->ieee80211_ptr;
- struct wiphy *wiphy = wdev->wiphy;
- struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+ if (ieee80211_is_deauth(mgmt->frame_control))
+ cmd = NL80211_CMD_UNPROT_DEAUTHENTICATE;
+ else
+ cmd = NL80211_CMD_UNPROT_DISASSOCIATE;
- trace_cfg80211_send_unprot_disassoc(dev);
- nl80211_send_mlme_event(rdev, dev, buf, len,
- NL80211_CMD_UNPROT_DISASSOCIATE, GFP_ATOMIC);
+ trace_cfg80211_rx_unprot_mlme_mgmt(dev, buf, len);
+ nl80211_send_mlme_event(rdev, dev, buf, len, cmd, GFP_ATOMIC);
}
-EXPORT_SYMBOL(cfg80211_send_unprot_disassoc);
+EXPORT_SYMBOL(cfg80211_rx_unprot_mlme_mgmt);
static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev,
struct net_device *netdev, int cmd,
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 23fafea..e1534baf 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -1911,24 +1911,46 @@ TRACE_EVENT(cfg80211_send_rx_assoc,
NETDEV_PR_ARG, MAC_PR_ARG(bssid), CHAN_PR_ARG)
);
-DEFINE_EVENT(netdev_evt_only, cfg80211_send_deauth,
- TP_PROTO(struct net_device *netdev),
- TP_ARGS(netdev)
+DECLARE_EVENT_CLASS(netdev_frame_event,
+ TP_PROTO(struct net_device *netdev, const u8 *buf, int len),
+ TP_ARGS(netdev, buf, len),
+ TP_STRUCT__entry(
+ NETDEV_ENTRY
+ __dynamic_array(u8, frame, len)
+ ),
+ TP_fast_assign(
+ NETDEV_ASSIGN;
+ memcpy(__get_dynamic_array(frame), buf, len);
+ ),
+ TP_printk(NETDEV_PR_FMT ", ftype:0x%.2x",
+ NETDEV_PR_ARG,
+ le16_to_cpup((__le16 *)__get_dynamic_array(frame)))
);
-DEFINE_EVENT(netdev_evt_only, cfg80211_send_disassoc,
- TP_PROTO(struct net_device *netdev),
- TP_ARGS(netdev)
+DEFINE_EVENT(netdev_frame_event, cfg80211_rx_unprot_mlme_mgmt,
+ TP_PROTO(struct net_device *netdev, const u8 *buf, int len),
+ TP_ARGS(netdev, buf, len)
);
-DEFINE_EVENT(netdev_evt_only, cfg80211_send_unprot_deauth,
- TP_PROTO(struct net_device *netdev),
- TP_ARGS(netdev)
+DEFINE_EVENT(netdev_frame_event, cfg80211_rx_mlme_mgmt,
+ TP_PROTO(struct net_device *netdev, const u8 *buf, int len),
+ TP_ARGS(netdev, buf, len)
);
-DEFINE_EVENT(netdev_evt_only, cfg80211_send_unprot_disassoc,
- TP_PROTO(struct net_device *netdev),
- TP_ARGS(netdev)
+TRACE_EVENT(cfg80211_tx_mlme_mgmt,
+ TP_PROTO(struct net_device *netdev, const u8 *buf, int len),
+ TP_ARGS(netdev, buf, len),
+ TP_STRUCT__entry(
+ NETDEV_ENTRY
+ __dynamic_array(u8, frame, len)
+ ),
+ TP_fast_assign(
+ NETDEV_ASSIGN;
+ memcpy(__get_dynamic_array(frame), buf, len);
+ ),
+ TP_printk(NETDEV_PR_FMT ", ftype:0x%.2x",
+ NETDEV_PR_ARG,
+ le16_to_cpup((__le16 *)__get_dynamic_array(frame)))
);
DECLARE_EVENT_CLASS(netdev_mac_evt,
--
1.8.0
^ permalink raw reply related
* Re: P2P Device support: how to deal with p2p_no_group_iface option
From: Johannes Berg @ 2013-05-27 9:03 UTC (permalink / raw)
To: Arend van Spriel
Cc: Jouni Malinen, hostap@lists.shmoo.com, linux-wireless,
Jithu Jance
In-Reply-To: <51A09F43.5030004@broadcom.com>
Hi,
> I looked into issues around hwsim p2p tests and got all but one p2p test
> passing now (test_autogo_tdls). I had to remove the p2p_no_group_iface
> option from the p2px.conf files, because otherwise it tries to change
> the P2P management interface into a P2P group interface. When using
> P2P_DEVICE and P2P management interface this is not allowed by
> mac80211_hwsim. Also for brcmfmac the P2P_DEVICE interface is dedicated
> and can only be added/deleted, but not changed. Not sure if that is true
> for iwlmvm as well.
>
> So I would like to discuss how to deal with the p2p_no_group_iface
> option. As P2P_DEVICE is a new concept the name of the option may no
> longer match what it intends. Is the option to force all P2P operations
> to be done on a single interface, ie. wlan0 (or whatever is specified on
> the command line) and no P2P_DEVICE is to be created. Or should it
> change the interface from the command line as P2P group interface.
I don't think I'd do either of those. Not creating P2P_DEVICE will
simply not work with drivers expecting it, and changing iftype to/from
P2P-Device isn't supported since it would delete/create the netdev.
I don't really see much choice but reject (or ignore) this option for
drivers using P2P_DEVICE. Why would anyone *really* want P2P operation
on wlan0 when another interface can be used?
johannes
^ permalink raw reply
* Re: [RFC 2/2] cfg80211: separate internal SME implementation
From: Johannes Berg @ 2013-05-27 9:01 UTC (permalink / raw)
To: Kondratiev, Vladimir; +Cc: linux-wireless@vger.kernel.org, qca_vkondrat
In-Reply-To: <A5CA08B46412E243958C77F3825F439519553850@NASANEXD02E.na.qualcomm.com>
On Sat, 2013-05-25 at 15:33 +0000, Kondratiev, Vladimir wrote:
> I prepared the patch, need few days to test it and I'll submit.
Thanks.
> I have conceptual question regarding wdev private data.
> Currently, drivers end up duplicating wdev's data internally. I'd say it is better to track, for example,
> SME connection state once. Maybe, it is worth to provide functions to access wdev's data?
Well, with my changes cfg80211 is no longer tracking the state at all,
unless you're using the cfg80211 SME, which your driver can't even use
since it doesn't implement auth/assoc but connect(). So in that sense,
there's no duplication.
I suppose you could argue that cfg80211 could track whether it was
already connected or not and call cfg80211_connect_result() is you
disconnect while never even connected, and it actually does still track
this (wdev->current_bss). OTOH, you could also argue that a firmware API
that requires tracking this on the host is broken ;-)
johannes
^ permalink raw reply
* Re: [PATCHv2] mac80211: Allow single vif mac address change with addr_mask
From: Johannes Berg @ 2013-05-27 8:55 UTC (permalink / raw)
To: Helmut Schaa
Cc: linux-wireless, Jakub Kicinski, Alessandro Lannocca,
Bruno Randolf
In-Reply-To: <1369644189-13874-1-git-send-email-helmut.schaa@googlemail.com>
On Mon, 2013-05-27 at 10:43 +0200, Helmut Schaa wrote:
> When changing the MAC address of a single vif mac80211 will check if
> the new address fits into the address mask specified by the driver.
> This only needs to be done when using multiple BSSIDs. Hence, check
> the new address only against all other vifs.
>
> Also fix the MAC address assignment on new interfaces if the user
> changed the address of a vif such that perm_addr is not covered by
> addr_mask anymore.
>
> Resolves:
> https://bugzilla.kernel.org/show_bug.cgi?id=57371
Applied for 3.10, thanks.
johannes
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox