Linux wireless drivers development
 help / color / mirror / Atom feed
* Re: [PATCH] net/wireless: add COUNTRY to to regulatory device uevent
From: Johannes Berg @ 2011-11-08 22:15 UTC (permalink / raw)
  To: Scott James Remnant
  Cc: John W. Linville, linux-wireless, Kay Sievers, Greg Kroah-Hartman,
	Sam Leffler, keybuk, Luis R. Rodriguez
In-Reply-To: <1299609930-14011-1-git-send-email-scott@netsplit.com>

On Tue, 2011-03-08 at 10:45 -0800, Scott James Remnant wrote:
> From: Scott James Remnant <keybuk@google.com>
> 
> Regulatory devices issue change uevents to inform userspace of a need
> to call the crda tool; however these can often be sent before udevd is
> running, and were not previously included in the results of
> udevadm trigger (which requests a new change event using the /uevent
> attribute of the sysfs object).
> 
> Add a uevent function to the device type which includes the COUNTRY
> information from the last request if it has yet to be processed, the
> case of multiple requests is already handled in the code by checking
> whether an unprocessed one is queued in the same manner and refusing
> to queue a new one.
> 
> The existing udev rule continues to work as before.

Luis points out that it looks like this caused the crash I reported
earlier today -- in the module exit path we have a use-after-free of
last_request now.

johannes


^ permalink raw reply

* [PATCH] cfg80211: fix bug on regulatory core exit on access to last_request
From: Luis R. Rodriguez @ 2011-11-08 22:28 UTC (permalink / raw)
  To: linville, johannes; +Cc: keybuk, linux-wireless, Luis R. Rodriguez, stable

Commit 4d9d88d1 by Scott James Remnant <keybuk@google.com> added
the .uevent() callback for the regulatory device used during
the platform device registration. The change was done to account
for queuing up udev change requests through udevadm triggers.
The change also meant that upon regulatory core exit we will now
send a uevent() but the uevent() callback, reg_device_uevent(),
also accessed last_request. Right before commiting device suicide
we free'd last_request but never set it to NULL so
platform_device_unregister() would lead to bogus kernel paging
request. Fix this and also simply supress uevents right before
we commit suicide as they are pointless.

This fix is required for kernels >= v2.6.39

$ git describe --contains 4d9d88d1
v2.6.39-rc1~468^2~25^2^2~21

The impact of not having this present is that a bogus paging
access may occur (only read) upon cfg80211 unload time. You
may also get this BUG complaint below. Although Johannes
could not reproduce the issue this fix is theoretically correct.

mac80211_hwsim: unregister radios
mac80211_hwsim: closing netlink
BUG: unable to handle kernel paging request at ffff88001a06b5ab
IP: [<ffffffffa030df9a>] reg_device_uevent+0x1a/0x50 [cfg80211]
PGD 1836063 PUD 183a063 PMD 1ffcb067 PTE 1a06b160
Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
CPU 0
Modules linked in: cfg80211(-) [last unloaded: mac80211]

Pid: 2279, comm: rmmod Tainted: G        W   3.1.0-wl+ #663 Bochs Bochs
RIP: 0010:[<ffffffffa030df9a>]  [<ffffffffa030df9a>] reg_device_uevent+0x1a/0x50 [cfg80211]
RSP: 0000:ffff88001c5f9d58  EFLAGS: 00010286
RAX: 0000000000000000 RBX: ffff88001d2eda88 RCX: ffff88001c7468fc
RDX: ffff88001a06b5a0 RSI: ffff88001c7467b0 RDI: ffff88001c7467b0
RBP: ffff88001c5f9d58 R08: 000000000000ffff R09: 000000000000ffff
R10: 0000000000000000 R11: 0000000000000001 R12: ffff88001c7467b0
R13: ffff88001d2eda78 R14: ffffffff8164a840 R15: 0000000000000001
FS:  00007f8a91d8a6e0(0000) GS:ffff88001fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: ffff88001a06b5ab CR3: 000000001c62e000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process rmmod (pid: 2279, threadinfo ffff88001c5f8000, task ffff88000023c780)
Stack:
 ffff88001c5f9d98 ffffffff812ff7e5 ffffffff8176ab3d ffff88001c7468c2
 000000000000ffff ffff88001d2eda88 ffff88001c7467b0 ffff880000114820
 ffff88001c5f9e38 ffffffff81241dc7 ffff88001c5f9db8 ffffffff81040189
Call Trace:
 [<ffffffff812ff7e5>] dev_uevent+0xc5/0x170
 [<ffffffff81241dc7>] kobject_uevent_env+0x1f7/0x490
 [<ffffffff81040189>] ? sub_preempt_count+0x29/0x60
 [<ffffffff814cab1a>] ? _raw_spin_unlock_irqrestore+0x4a/0x90
 [<ffffffff81305307>] ? devres_release_all+0x27/0x60
 [<ffffffff8124206b>] kobject_uevent+0xb/0x10
 [<ffffffff812fee27>] device_del+0x157/0x1b0
 [<ffffffff8130377d>] platform_device_del+0x1d/0x90
 [<ffffffff81303b76>] platform_device_unregister+0x16/0x30
 [<ffffffffa030fffd>] regulatory_exit+0x5d/0x180 [cfg80211]
 [<ffffffffa032bec3>] cfg80211_exit+0x2b/0x45 [cfg80211]
 [<ffffffff8109a84c>] sys_delete_module+0x16c/0x220
 [<ffffffff8108a23e>] ? trace_hardirqs_on_caller+0x7e/0x120
 [<ffffffff814cba02>] system_call_fastpath+0x16/0x1b
Code: <all your base are belong to me>
RIP  [<ffffffffa030df9a>] reg_device_uevent+0x1a/0x50 [cfg80211]
 RSP <ffff88001c5f9d58>
CR2: ffff88001a06b5ab
---[ end trace 147c5099a411e8c0 ]---

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Scott James Remnant <keybuk@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
---
 net/wireless/reg.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 2520a1b..bc1ec2c 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2263,6 +2263,9 @@ void /* __init_or_exit */ regulatory_exit(void)
 
 	kfree(last_request);
 
+	last_request = NULL;
+	dev_set_uevent_suppress(&reg_pdev->dev, true);
+
 	platform_device_unregister(reg_pdev);
 
 	spin_lock_bh(&reg_pending_beacons_lock);
-- 
1.7.4.15.g7811d


^ permalink raw reply related

* Re: [PATCH] net/wireless: add COUNTRY to to regulatory device uevent
From: Luis R. Rodriguez @ 2011-11-08 22:31 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Scott James Remnant, John W. Linville, linux-wireless,
	Kay Sievers, Greg Kroah-Hartman, Sam Leffler, keybuk
In-Reply-To: <1320790500.23056.0.camel@jlt3.sipsolutions.net>

On Tue, Nov 8, 2011 at 2:15 PM, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Tue, 2011-03-08 at 10:45 -0800, Scott James Remnant wrote:
>> From: Scott James Remnant <keybuk@google.com>
>>
>> Regulatory devices issue change uevents to inform userspace of a need
>> to call the crda tool; however these can often be sent before udevd is
>> running, and were not previously included in the results of
>> udevadm trigger (which requests a new change event using the /uevent
>> attribute of the sysfs object).
>>
>> Add a uevent function to the device type which includes the COUNTRY
>> information from the last request if it has yet to be processed, the
>> case of multiple requests is already handled in the code by checking
>> whether an unprocessed one is queued in the same manner and refusing
>> to queue a new one.
>>
>> The existing udev rule continues to work as before.
>
> Luis points out that it looks like this caused the crash I reported
> earlier today -- in the module exit path we have a use-after-free of
> last_request now.

Sent patch.

  Luis

^ permalink raw reply

* Re: [PATCH v3 1/3] NFC: Update names and structs to NCI spec 1.0 d18
From: Lauro Ramos Venancio @ 2011-11-08 22:33 UTC (permalink / raw)
  To: ilanelias78; +Cc: aloisio.almeida, samuel, linville, linux-wireless, Ilan Elias
In-Reply-To: <1320152097-2711-2-git-send-email-ilane@ti.com>

SGkgSWxhbiwKCjIwMTEvMTEvMSAgPGlsYW5lbGlhczc4QGdtYWlsLmNvbT46Cj4gRnJvbTogSWxh
biBFbGlhcyA8aWxhbmVAdGkuY29tPgo+Cj4gQWRkaXRpb24sIGRlbGV0aW9uIGFuZCBtb2RpZmlj
YXRpb24gb2YgTkNJIGNvbnN0YW50cy4KPiBDaGFuZ2VzIGluIE5DSSBjb21tYW5kcywgcmVzcG9u
c2VzIGFuZCBub3RpZmljYXRpb25zIHN0cnVjdHVyZXMuCj4KPiBTaWduZWQtb2ZmLWJ5OiBJbGFu
IEVsaWFzIDxpbGFuZUB0aS5jb20+Cj4gLS0tCj4gwqBpbmNsdWRlL25ldC9uZmMvbmNpLmggwqAg
wqAgwqB8IMKgMTgzICsrKysrKysrKysrK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BQ1RJVkVfTkZDRUVfSU5URVJGQUNFU19SRUFDSEVEIMKgIMKgIMKg
IMKgIDB4YzAKPiArI2RlZmluZSBOQ0lfU1RBVFVTX05GQ0VFX0lOVEVSRkFDRV9BQ1RJVkFUSU9O
X0ZBSUxFRCDCoCDCoCDCoCDCoCDCoCAweGMxCj4gKyNkZWZpbmUgTkNJX1NUQVRVU19ORkNFRV9U
UkFOU01JU1NJT05fRVJST1IgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAweGMyCj4gKyNk
ZWZpbmUgTkNJX1NUQVRVU19ORkNFRV9QUk9UT0NPTF9FUlJPUiDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoDB4YzMKPiDCoCNkZWZpbmUgTkNJX1NUQVRVU19O
RkNFRV9USU1FT1VUX0VSUk9SIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIDB4
YzQKCllvdSBhcmUgbWl4aW5nIGluZGVudGF0aW9uIGNoYW5nZXMgd2l0aCBjaGFuZ2VzIGluIGNv
bnN0YW50cy4gSXQgd291bGQKYmUgYmV0dGVyIHRvIHB1dCB0aGUgaW5kZW50YXRpb24gY2hhbmdl
cyBpbiBhIGFub3RoZXIgcGF0Y2guCgoKCkxhdXJvCg==

^ permalink raw reply

* Re: [PATCH v3 2/3] NFC: Removal of unused operations for NCI spec 1.0 d18
From: Lauro Ramos Venancio @ 2011-11-08 22:35 UTC (permalink / raw)
  To: ilanelias78; +Cc: aloisio.almeida, samuel, linville, linux-wireless, Ilan Elias
In-Reply-To: <1320152097-2711-3-git-send-email-ilane@ti.com>

2011/11/1  <ilanelias78@gmail.com>:
> From: Ilan Elias <ilane@ti.com>
>
> Remove unused NCI operations, e.g. create static rf connection.
>
> Signed-off-by: Ilan Elias <ilane@ti.com>
Acked-by: Lauro Ramos Venancio <lauro.venancio@openbossa.org>

^ permalink raw reply

* Re: [PATCH v3 3/3] NFC: Check if NCI data flow control is used
From: Lauro Ramos Venancio @ 2011-11-08 22:38 UTC (permalink / raw)
  To: ilanelias78; +Cc: aloisio.almeida, samuel, linville, linux-wireless, Ilan Elias
In-Reply-To: <1320152097-2711-4-git-send-email-ilane@ti.com>

2011/11/1  <ilanelias78@gmail.com>:
> From: Ilan Elias <ilane@ti.com>
>
> Check if NCI data flow control is used in nci_tx_work.
>
> Signed-off-by: Ilan Elias <ilane@ti.com>
> ---
>  net/nfc/nci/core.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
> index 9d0b530..056cd37 100644
> --- a/net/nfc/nci/core.c
> +++ b/net/nfc/nci/core.c
> @@ -722,7 +722,9 @@ static void nci_tx_work(struct work_struct *work)
>                if (!skb)
>                        return;
>
> -               atomic_dec(&ndev->credits_cnt);
> +               /* Check if data flow control is used */
> +               if (atomic_read(&ndev->credits_cnt) != 0xff)
> +                       atomic_dec(&ndev->credits_cnt);

It would be better to replace the 0xff by a define.

Lauro

^ permalink raw reply

* Re: [PATCH v8 2/2] mac80211:  Support ht-cap over-rides.
From: Ben Greear @ 2011-11-08 23:11 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1320786130.24797.78.camel@jlt3.sipsolutions.net>

On 11/08/2011 01:02 PM, Johannes Berg wrote:
> On Tue, 2011-11-08 at 12:58 -0800, Ben Greear wrote:
>
>>>> +bool ieee80111_cfg_override_disables_ht40(struct ieee80211_sub_if_data *sdata)
>>>> +{
>>>> +	if ((sdata->u.mgd.ht_capa_mask.cap_info&
>>>> +	     IEEE80211_HT_CAP_SUP_WIDTH_20_40)&&
>>>> +	    !(sdata->u.mgd.ht_capa.cap_info&
>>>> +	      IEEE80211_HT_CAP_SUP_WIDTH_20_40))
>>>> +		return true;
>>>> +	return false;
>>>
>>> Would it really go above 80 cols if you didn't line-wrap it? Maybe
>>> remove the extra sets of parentheses? And even if it goes to a little
>>> bit above 80 it's still be more readable without the wrapping ...
>>
>> It is more readable w/out the wrapping, but hard to know when
>> patches get rejected about that or not, so I tried to keep
>> checkpatch happy.  If you'll take slightly longer lines I'll
>> happily un-wrap it.
>
> Please. I'd rather go over a bit than read the above :-)

I just fixed this by using a tmp variable.  Hopefully the
compiler is smart enough to make it disappear.

>>> For example here:
>>>
>>>>    		if (!(ap_ht_cap_flags&   IEEE80211_HT_CAP_40MHZ_INTOLERANT)&&
>>>> +		    !ieee80111_cfg_override_disables_ht40(sdata)&&
>>>>    		(sband->ht_cap.cap&   IEEE80211_HT_CAP_SUP_WIDTH_20_40)&&
>>>>    		(hti->ht_param&   IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) {
>>>>    			switch(hti->ht_param&   IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
>>>
>>> This just adds complexity. If you calculate sdata->used_ht_caps first
>>> then you can replace the sband->ht_cap.cap check with an
>>> sdata->used_ht_caps.cap check and be done with it, instead of having to
>>> check both.
>>
>> I think that's a bad idea, but will change it if you insist.
>
> I really think that'd be much nicer. As it is now we have to add all
> these checks everywhere, if we just calculate it once and then change
> places to use it we just have to remember to use the right thing.

I'm quite nervous about attempting this change.  I'm pretty
confident my current patch works as designed, and over all,
it's pretty non-intrusive.  I am afraid that if I start trying
to substitute something for sband->ht_cap that I'm going
to end up changing a lot of code and possibly adding all sorts
of strange bugs.

Out of curiousity, if one is doing off-channel work, wouldn't
sband be different from when we associated and possibly different
in it's ht-capabilities?  If so, the used-ht-caps would not
be valid for that work?

I'm posting a v9 with just the minimum MCS rates stuff removed
and some formatting cleanup.

If this used-ht-caps stuff is required, I'll see
what I can do.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply

* [PATCH v9 2/2] mac80211:  Support ht-cap over-rides.
From: greearb @ 2011-11-08 23:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

This implements ht-cap over-rides for mac80211 drivers.
HT may be disabled, making an /a/b/g/n station act like an
a/b/g station.  HT40 may be disabled forcing the station to
be HT20 even if the AP and local hardware support HT40.

MAX-AMSDU may be disabled.
AMPDU-Density may be increased.
AMPDU-Factor may be decreased.

This has been successfully tested with ath9k using patched
wpa_supplicant and iw.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---

v9:  Remove minimum mcs rate advertising.  Just let
     users advertise as few rates as they desire.

NOTE:  Did not make the suggested change of caching the
     derived ht-cap struct.

:100644 100644 a9ded52... 7f4389e... M	net/mac80211/cfg.c
:100644 100644 f80a35c... e631925... M	net/mac80211/ht.c
:100644 100644 ea10a51... cefcbc6... M	net/mac80211/ieee80211_i.h
:100644 100644 d4ee6d2... 7be5ad8... M	net/mac80211/main.c
:100644 100644 2fbd652... 84d6943... M	net/mac80211/mlme.c
:100644 100644 6c53b6d... dd1e00b... M	net/mac80211/work.c
 net/mac80211/cfg.c         |    2 +-
 net/mac80211/ht.c          |   75 +++++++++++++++++++++++++++++++++++++++++++-
 net/mac80211/ieee80211_i.h |    9 +++++-
 net/mac80211/main.c        |   14 ++++++++
 net/mac80211/mlme.c        |   12 ++++++-
 net/mac80211/work.c        |   30 ++++++++++++------
 6 files changed, 127 insertions(+), 15 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a9ded52..7f4389e 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -778,7 +778,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
 	}
 
 	if (params->ht_capa)
-		ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
+		ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
 						  params->ht_capa,
 						  &sta->sta.ht_cap);
 
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index f80a35c..e631925 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -18,7 +18,74 @@
 #include "ieee80211_i.h"
 #include "rate.h"
 
-void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
+bool ieee80111_cfg_override_disables_ht40(struct ieee80211_sub_if_data *sdata)
+{
+	const u16 flg = IEEE80211_HT_CAP_SUP_WIDTH_20_40;
+	if ((sdata->u.mgd.ht_capa_mask.cap_info & flg) &&
+	    !(sdata->u.mgd.ht_capa.cap_info & flg))
+		return true;
+	return false;
+}
+
+void __check_htcap_disable(struct ieee80211_sub_if_data *sdata,
+			   struct ieee80211_sta_ht_cap *ht_cap,
+			   u16 flag)
+{
+	if (sdata->u.mgd.ht_capa_mask.cap_info & flag) {
+		if (!(sdata->u.mgd.ht_capa.cap_info & flag))
+			ht_cap->cap &= ~flag;
+	}
+}
+
+void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
+				     struct ieee80211_sta_ht_cap *ht_cap)
+{
+	u8 *scaps = (u8 *)(&sdata->u.mgd.ht_capa.mcs.rx_mask);
+	u8 *smask = (u8 *)(&sdata->u.mgd.ht_capa_mask.mcs.rx_mask);
+	int i;
+
+	/* NOTE:  If you add more over-rides here, update register_hw
+	 * ht_capa_mod_msk logic in main.c as well.
+	 */
+
+	/* check for HT over-rides, MCS rates first. */
+	for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) {
+		u8 m = smask[i];
+		ht_cap->mcs.rx_mask[i] &= ~m; /* turn off all masked bits */
+		/* Add back rates that are supported */
+		ht_cap->mcs.rx_mask[i] |= (m & scaps[i]);
+	}
+
+	/* Force removal of HT-40 capabilities? */
+	__check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_SUP_WIDTH_20_40);
+	__check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_SGI_40);
+
+	/* Allow user to disable the max-AMSDU bit. */
+	__check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_MAX_AMSDU);
+
+	/* Allow user to decrease AMPDU factor */
+	if (sdata->u.mgd.ht_capa_mask.ampdu_params_info &
+	    IEEE80211_HT_AMPDU_PARM_FACTOR) {
+		u16 n = sdata->u.mgd.ht_capa.ampdu_params_info
+			& IEEE80211_HT_AMPDU_PARM_FACTOR;
+		if (n < ht_cap->ampdu_factor)
+			ht_cap->ampdu_factor = n;
+	}
+
+	/* Allow the user to increase AMPDU density. */
+	if (sdata->u.mgd.ht_capa_mask.ampdu_params_info &
+	    IEEE80211_HT_AMPDU_PARM_DENSITY) {
+		u16 n = (sdata->u.mgd.ht_capa.ampdu_params_info &
+			 IEEE80211_HT_AMPDU_PARM_DENSITY)
+			>> IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT;
+		if (n > ht_cap->ampdu_density)
+			ht_cap->ampdu_density = n;
+	}
+}
+
+
+void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
+				       struct ieee80211_supported_band *sband,
 				       struct ieee80211_ht_cap *ht_cap_ie,
 				       struct ieee80211_sta_ht_cap *ht_cap)
 {
@@ -102,6 +169,12 @@ void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
 	/* handle MCS rate 32 too */
 	if (sband->ht_cap.mcs.rx_mask[32/8] & ht_cap_ie->mcs.rx_mask[32/8] & 1)
 		ht_cap->mcs.rx_mask[32/8] |= 1;
+
+	/*
+	 * If user has specified capability over-rides, take care
+	 * of that here.
+	 */
+	ieee80211_apply_htcap_overrides(sdata, ht_cap);
 }
 
 void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, bool tx)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index ea10a51..cefcbc6 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -443,6 +443,9 @@ struct ieee80211_if_managed {
 	 */
 	int rssi_min_thold, rssi_max_thold;
 	int last_ave_beacon_signal;
+	struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
+	struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
+
 };
 
 struct ieee80211_if_ibss {
@@ -1179,7 +1182,11 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 				       struct net_device *dev);
 
 /* HT */
-void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
+bool ieee80111_cfg_override_disables_ht40(struct ieee80211_sub_if_data *sdata);
+void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
+				     struct ieee80211_sta_ht_cap *ht_cap);
+void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
+				       struct ieee80211_supported_band *sband,
 				       struct ieee80211_ht_cap *ht_cap_ie,
 				       struct ieee80211_sta_ht_cap *ht_cap);
 void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index d4ee6d2..7be5ad8 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -560,6 +560,19 @@ ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
 	},
 };
 
+static const struct ieee80211_ht_cap mac80211_ht_capa_mod_mask = {
+	.ampdu_params_info = IEEE80211_HT_AMPDU_PARM_FACTOR |
+			     IEEE80211_HT_AMPDU_PARM_DENSITY,
+
+	.cap_info = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
+		    IEEE80211_HT_CAP_MAX_AMSDU |
+		    IEEE80211_HT_CAP_SGI_40,
+	.mcs = {
+		.rx_mask = { 0xff, 0xff, 0xff, 0xff, 0xff,
+			     0xff, 0xff, 0xff, 0xff, 0xff, },
+	},
+};
+
 struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
 					const struct ieee80211_ops *ops)
 {
@@ -628,6 +641,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
 	local->user_power_level = -1;
 	local->uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
 	local->uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
+	wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask;
 
 	INIT_LIST_HEAD(&local->interfaces);
 
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2fbd652..84d6943 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -207,6 +207,7 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
 		channel_type = NL80211_CHAN_HT20;
 
 		if (!(ap_ht_cap_flags & IEEE80211_HT_CAP_40MHZ_INTOLERANT) &&
+		    !ieee80111_cfg_override_disables_ht40(sdata) &&
 		    (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
 		    (hti->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) {
 			switch(hti->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
@@ -1603,7 +1604,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
 		sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
 
 	if (elems.ht_cap_elem && !(ifmgd->flags & IEEE80211_STA_DISABLE_11N))
-		ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
+		ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
 				elems.ht_cap_elem, &sta->sta.ht_cap);
 
 	ap_ht_cap_flags = sta->sta.ht_cap.cap;
@@ -1972,7 +1973,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 
 		sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
 
-		ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
+		ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
 				elems.ht_cap_elem, &sta->sta.ht_cap);
 
 		ap_ht_cap_flags = sta->sta.ht_cap.cap;
@@ -2630,6 +2631,13 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
 			ifmgd->flags |= IEEE80211_STA_DISABLE_11N;
 
 
+	if (req->flags & ASSOC_REQ_DISABLE_HT)
+		ifmgd->flags |= IEEE80211_STA_DISABLE_11N;
+
+	memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa));
+	memcpy(&ifmgd->ht_capa_mask, &req->ht_capa_mask,
+	       sizeof(ifmgd->ht_capa_mask));
+
 	if (req->ie && req->ie_len) {
 		memcpy(wk->ie, req->ie, req->ie_len);
 		wk->ie_len = req->ie_len;
diff --git a/net/mac80211/work.c b/net/mac80211/work.c
index 6c53b6d..dd1e00b 100644
--- a/net/mac80211/work.c
+++ b/net/mac80211/work.c
@@ -94,7 +94,8 @@ static int ieee80211_compatible_rates(const u8 *supp_rates, int supp_rates_len,
 
 /* frame sending functions */
 
-static void ieee80211_add_ht_ie(struct sk_buff *skb, const u8 *ht_info_ie,
+static void ieee80211_add_ht_ie(struct ieee80211_sub_if_data *sdata,
+				struct sk_buff *skb, const u8 *ht_info_ie,
 				struct ieee80211_supported_band *sband,
 				struct ieee80211_channel *channel,
 				enum ieee80211_smps_mode smps)
@@ -102,11 +103,11 @@ static void ieee80211_add_ht_ie(struct sk_buff *skb, const u8 *ht_info_ie,
 	struct ieee80211_ht_info *ht_info;
 	u8 *pos;
 	u32 flags = channel->flags;
-	u16 cap = sband->ht_cap.cap;
+	u16 cap;
 	__le16 tmp;
+	struct ieee80211_sta_ht_cap ht_cap;
 
-	if (!sband->ht_cap.ht_supported)
-		return;
+	BUILD_BUG_ON(sizeof(ht_cap) != sizeof(sband->ht_cap));
 
 	if (!ht_info_ie)
 		return;
@@ -114,6 +115,15 @@ static void ieee80211_add_ht_ie(struct sk_buff *skb, const u8 *ht_info_ie,
 	if (ht_info_ie[1] < sizeof(struct ieee80211_ht_info))
 		return;
 
+	memcpy(&ht_cap, &sband->ht_cap, sizeof(ht_cap));
+
+	ieee80211_apply_htcap_overrides(sdata, &ht_cap);
+
+	cap = ht_cap.cap;
+
+	if (!ht_cap.ht_supported)
+		return;
+
 	ht_info = (struct ieee80211_ht_info *)(ht_info_ie + 2);
 
 	/* determine capability flags */
@@ -166,13 +176,13 @@ static void ieee80211_add_ht_ie(struct sk_buff *skb, const u8 *ht_info_ie,
 	pos += sizeof(u16);
 
 	/* AMPDU parameters */
-	*pos++ = sband->ht_cap.ampdu_factor |
-		 (sband->ht_cap.ampdu_density <<
-			IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
+	*pos++ = ht_cap.ampdu_factor |
+		 (ht_cap.ampdu_density <<
+		  IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
 
 	/* MCS set */
-	memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
-	pos += sizeof(sband->ht_cap.mcs);
+	memcpy(pos, &ht_cap.mcs, sizeof(ht_cap.mcs));
+	pos += sizeof(ht_cap.mcs);
 
 	/* extended capabilities */
 	pos += sizeof(__le16);
@@ -356,7 +366,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
 
 	if (wk->assoc.use_11n && wk->assoc.wmm_used &&
 	    local->hw.queues >= 4)
-		ieee80211_add_ht_ie(skb, wk->assoc.ht_information_ie,
+		ieee80211_add_ht_ie(sdata, skb, wk->assoc.ht_information_ie,
 				    sband, wk->chan, wk->assoc.smps);
 
 	/* if present, add any custom non-vendor IEs that go after HT */
-- 
1.7.3.4


^ permalink raw reply related

* Re: iwlagn is getting very shaky
From: Norbert Preining @ 2011-11-09  5:11 UTC (permalink / raw)
  To: Emmanuel Grumbach
  Cc: Guy, Wey-Yi, David Rientjes, linux-kernel@vger.kernel.org,
	ipw3945-devel@lists.sourceforge.net, ilw@linux.intel.com,
	linux-wireless@vger.kernel.org, Pekka Enberg
In-Reply-To: <CANUX_P06ww42p6N1k_P-Y1KMKOd1QgR_DxVWe19qtsEX2rfWpw@mail.gmail.com>

Hi Emmanuel,

On Di, 08 Nov 2011, Emmanuel Grumbach wrote:
> I would like to see what happens in terms or power.
> Please set the power debug flag: modprobe iwlwifi debug=0x100

> It may be worth to disable Link Power save too. I would be glad if you
> could try this patch (attached and inlined), with the power debug flag
> set.

With both done, I see things like that:
[  690.597221] iwlwifi 0000:06:00.0: L1 Enabled; Disabling L0S
[  690.601979] iwlwifi 0000:06:00.0: Radio type=0x1-0x2-0x0
[  690.644716] iwlwifi 0000:06:00.0: U iwl_power_sleep_cam_cmd Sleep command for CAM
[  690.644721] iwlwifi 0000:06:00.0: U iwl_set_power Sending power/sleep command
[  690.644724] iwlwifi 0000:06:00.0: U iwl_set_power Flags value = 0x00000000
[  690.644726] iwlwifi 0000:06:00.0: U iwl_set_power Tx timeout = 0
[  690.644728] iwlwifi 0000:06:00.0: U iwl_set_power Rx timeout = 0
[  690.644731] iwlwifi 0000:06:00.0: U iwl_set_power Sleep interval vector = { 0 , 0 , 0 , 0 , 0 }
[  690.645649] iwlwifi 0000:06:00.0: U iwl_power_sleep_cam_cmd Sleep command for CAM

Does this help you, or do you need more?

Best wishes

Norbert
------------------------------------------------------------------------
Norbert Preining            preining@{jaist.ac.jp, logic.at, debian.org}
JAIST, Japan                                 TeX Live & Debian Developer
DSA: 0x09C5B094   fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
------------------------------------------------------------------------
SNITTER (n.)
One of the rather unfunny newspaper clippings pinned to an office
wall, the humour of which is supposed to derive from the fact that the
headline contains a name similar to that of one of the occupants to
the office.
			--- Douglas Adams, The Meaning of Liff

^ permalink raw reply

* [PATCH] x86: Add amilo-rfkill driver for some Fujitsu-Siemens Amilo laptops
From: Ben Hutchings @ 2011-11-09  5:44 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, linux-wireless, Martin Večeřa,
	Alejandro Vidal Mata, Javier Vidal Mata, Tino Schmidt, 631664

[-- Attachment #1: Type: text/plain, Size: 7015 bytes --]

An rfkill driver based on the fsaa1655g and fsam7440 drivers for
Fujitsu-Siemens Amilo A1655 and M7440 models found at:

http://sourceforge.net/projects/fsaa1655g/
http://sourceforge.net/projects/fsam7440/

This adds DMI matching and replaces the procfs files with rfkill
devices.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Tested-by: Tino Schmidt <mailtinoshomepage@gmx.net> [with A1655G, v3.0]
---
 drivers/platform/x86/Kconfig        |    7 ++
 drivers/platform/x86/Makefile       |    1 +
 drivers/platform/x86/amilo-rfkill.c |  187 +++++++++++++++++++++++++++++++++++
 3 files changed, 195 insertions(+), 0 deletions(-)
 create mode 100644 drivers/platform/x86/amilo-rfkill.c

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index f4e3d82..c5936e7 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -141,6 +141,13 @@ config FUJITSU_LAPTOP_DEBUG
 
 	  If you are not sure, say N here.
 
+config AMILO_RFKILL
+	tristate "Fujitsu-Siemens Amilo rfkill support"
+	depends on RFKILL
+	---help---
+	  This is a driver for enabling wifi on some Fujitsu-Siemens Amilo
+	  laptops.
+
 config TC1100_WMI
 	tristate "HP Compaq TC1100 Tablet WMI Extras (EXPERIMENTAL)"
 	depends on !X86_64
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 293a320..3acbaad 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_ACER_WMI)		+= acer-wmi.o
 obj-$(CONFIG_ACERHDF)		+= acerhdf.o
 obj-$(CONFIG_HP_ACCEL)		+= hp_accel.o
 obj-$(CONFIG_HP_WMI)		+= hp-wmi.o
+obj-$(CONFIG_AMILO_RFKILL)	+= amilo-rfkill.o
 obj-$(CONFIG_TC1100_WMI)	+= tc1100-wmi.o
 obj-$(CONFIG_SONY_LAPTOP)	+= sony-laptop.o
 obj-$(CONFIG_IDEAPAD_LAPTOP)	+= ideapad-laptop.o
diff --git a/drivers/platform/x86/amilo-rfkill.c b/drivers/platform/x86/amilo-rfkill.c
new file mode 100644
index 0000000..a27fea2
--- /dev/null
+++ b/drivers/platform/x86/amilo-rfkill.c
@@ -0,0 +1,187 @@
+/*
+ * Support for rfkill on some Fujitsu-Siemens Amilo laptops.
+ * Copyright 2011 Ben Hutchings.
+ *
+ * Based in part on the fsam7440 driver, which is:
+ * Copyright 2005 Alejandro Vidal Mata & Javier Vidal Mata.
+ * and on the fsaa1655g driver, which is:
+ * Copyright 2006 Martin Martin Večeřa.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/dmi.h>
+#include <linux/io.h>
+#include <linux/moduleparam.h>
+#include <linux/platform_device.h>
+#include <linux/rfkill.h>
+
+static bool init_blocked = false;
+
+/* Initial state set by 'radio' parameter, as in the fsaa1655g driver */
+module_param_named(radio, init_blocked, invbool, 0);
+
+/*
+ * These values were obtained from disassembling and debugging the
+ * PM.exe program installed in the Fujitsu-Siemens AMILO A1655G
+ */
+#define A1655_STATE_PORT	0x64
+#define A1655_COMMAND_PORT	0x64
+#define A1655_DATA_PORT		0x60
+#define A1655_WIFI_COMMAND	0xC5
+#define A1655_WIFI_ON		0x25
+#define A1655_WIFI_OFF		0x45
+
+static int amilo_a1655_rfkill_set_block(void *data, bool blocked)
+{
+	u8 val;
+
+	do
+		val = inb(A1655_STATE_PORT);
+	while ((val & 2) == 2);
+	outb(A1655_WIFI_COMMAND, A1655_COMMAND_PORT);
+	do
+		val = inb(A1655_STATE_PORT);
+	while ((val & 2) == 2);
+	outb(blocked ? A1655_WIFI_OFF : A1655_WIFI_ON, A1655_DATA_PORT);
+
+	return 0;
+}
+
+static const struct rfkill_ops amilo_a1655_rfkill_ops = {
+	.set_block = amilo_a1655_rfkill_set_block
+};
+
+/*
+ * These values were obtained from disassembling the PM.exe program
+ * installed in the Fujitsu-Siemens AMILO M 7440
+ */
+#define M7440_PORT1		0x118f
+#define M7440_PORT2		0x118e
+#define M7440_RADIO_ON1		0x12
+#define M7440_RADIO_ON2		0x80
+#define M7440_RADIO_OFF1	0x10
+#define M7440_RADIO_OFF2	0x00
+
+static int amilo_m7440_rfkill_set_block(void *data, bool blocked)
+{
+	u8 val1 = blocked ? M7440_RADIO_OFF1 : M7440_RADIO_ON1;
+	u8 val2 = blocked ? M7440_RADIO_OFF2 : M7440_RADIO_ON2;
+
+	outb(val1, M7440_PORT1);
+	outb(val2, M7440_PORT2);
+
+	/* Check whether the state has changed correctly */
+	if (inb(M7440_PORT1) != val1 || inb(M7440_PORT2) != val2)
+		return -EIO;
+
+	return 0;
+}
+
+static const struct rfkill_ops amilo_m7440_rfkill_ops = {
+	.set_block = amilo_m7440_rfkill_set_block
+};
+
+static const struct dmi_system_id __devinitdata amilo_rfkill_id_table[] = {
+	{
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
+			DMI_MATCH(DMI_BOARD_NAME, "AMILO A1655"),
+		},
+		.driver_data = (void *)&amilo_a1655_rfkill_ops
+	},
+	{
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
+			DMI_MATCH(DMI_BOARD_NAME, "AMILO M7440"),
+		},
+		.driver_data = (void *)&amilo_m7440_rfkill_ops
+	},
+	{}
+};
+
+static struct platform_device *amilo_rfkill_pdev;
+static struct rfkill *amilo_rfkill_dev;
+
+static int __devinit amilo_rfkill_probe(struct platform_device *device)
+{
+	const struct dmi_system_id *system_id =
+		dmi_first_match(amilo_rfkill_id_table);
+	int rc;
+
+	amilo_rfkill_dev = rfkill_alloc(KBUILD_MODNAME, &device->dev,
+					RFKILL_TYPE_WLAN,
+					system_id->driver_data, NULL);
+	if (!amilo_rfkill_dev)
+		return -ENOMEM;
+
+	rfkill_init_sw_state(amilo_rfkill_dev, init_blocked);
+
+	rc = rfkill_register(amilo_rfkill_dev);
+	if (rc)
+		goto fail;
+
+	return 0;
+
+fail:
+	rfkill_destroy(amilo_rfkill_dev);
+	return rc;
+}
+
+static int amilo_rfkill_remove(struct platform_device *device)
+{
+	rfkill_unregister(amilo_rfkill_dev);
+	rfkill_destroy(amilo_rfkill_dev);
+	return 0;
+}
+
+static struct platform_driver amilo_rfkill_driver = {
+	.driver = {
+		.name	= KBUILD_MODNAME,
+		.owner	= THIS_MODULE,
+	},
+	.probe	= amilo_rfkill_probe,
+	.remove	= amilo_rfkill_remove,
+};
+
+static int __init amilo_rfkill_init(void)
+{
+	int rc;
+
+	if (dmi_first_match(amilo_rfkill_id_table) == NULL)
+		return -ENODEV;
+
+	rc = platform_driver_register(&amilo_rfkill_driver);
+	if (rc)
+		return rc;
+
+	amilo_rfkill_pdev = platform_device_register_simple(KBUILD_MODNAME, -1,
+							    NULL, 0);
+	if (IS_ERR(amilo_rfkill_pdev)) {
+		rc = PTR_ERR(amilo_rfkill_pdev);
+		goto fail;
+	}
+
+	return 0;
+
+fail:
+	platform_driver_unregister(&amilo_rfkill_driver);
+	return rc;
+}
+
+static void __exit amilo_rfkill_exit(void)
+{
+	platform_device_unregister(amilo_rfkill_pdev);
+	platform_driver_unregister(&amilo_rfkill_driver);
+}
+
+MODULE_AUTHOR("Ben Hutchings <ben@decadent.org.uk>");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(dmi, amilo_rfkill_id_table);
+
+module_init(amilo_rfkill_init);
+module_exit(amilo_rfkill_exit);
-- 
1.7.7



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply related

* Re: iwlagn is getting very shaky
From: Emmanuel Grumbach @ 2011-11-09  7:15 UTC (permalink / raw)
  To: Norbert Preining
  Cc: Guy, Wey-Yi, David Rientjes, linux-kernel@vger.kernel.org,
	ipw3945-devel@lists.sourceforge.net, ilw@linux.intel.com,
	linux-wireless@vger.kernel.org, Pekka Enberg
In-Reply-To: <20111109051152.GA16006@gamma.logic.tuwien.ac.at>

> On Di, 08 Nov 2011, Emmanuel Grumbach wrote:
> > I would like to see what happens in terms or power.
> > Please set the power debug flag: modprobe iwlwifi debug=0x100
>
> > It may be worth to disable Link Power save too. I would be glad if you
> > could try this patch (attached and inlined), with the power debug flag
> > set.
>
> With both done, I see things like that:
> [  690.597221] iwlwifi 0000:06:00.0: L1 Enabled; Disabling L0S
> [  690.601979] iwlwifi 0000:06:00.0: Radio type=0x1-0x2-0x0
> [  690.644716] iwlwifi 0000:06:00.0: U iwl_power_sleep_cam_cmd Sleep command for CAM
> [  690.644721] iwlwifi 0000:06:00.0: U iwl_set_power Sending power/sleep command
> [  690.644724] iwlwifi 0000:06:00.0: U iwl_set_power Flags value = 0x00000000
> [  690.644726] iwlwifi 0000:06:00.0: U iwl_set_power Tx timeout = 0
> [  690.644728] iwlwifi 0000:06:00.0: U iwl_set_power Rx timeout = 0
> [  690.644731] iwlwifi 0000:06:00.0: U iwl_set_power Sleep interval vector = { 0 , 0 , 0 , 0 , 0 }
> [  690.645649] iwlwifi 0000:06:00.0: U iwl_power_sleep_cam_cmd Sleep command for CAM
>
> Does this help you, or do you need more?
>

This look fine, thanks. I now would like to now if the bug reproduces
with these settings :-)
With these settings the NIC will stay up all the times, it can help.

Thanks !

^ permalink raw reply

* Re: [PATCH] cfg80211: deprecate CFG80211_WEXT
From: Kalle Valo @ 2011-11-09  7:49 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John Linville, linux-wireless
In-Reply-To: <1320781153.24797.41.camel@jlt3.sipsolutions.net>

Johannes Berg <johannes@sipsolutions.net> writes:

> Almost all wireless tools have transitioned to
> or at least added compatibility with nl80211 so
> there's no real need for CONFIG_CFG80211_WEXT
> any more. Mark it for removal, and also change
> the default to not be enabled.

Maybe CC lkml for more visibility?

-- 
Kalle Valo

^ permalink raw reply

* RE: [PATCH v3 1/3] NFC: Update names and structs to NCI spec 1.0 d18
From: Elias, Ilan @ 2011-11-09  7:53 UTC (permalink / raw)
  To: Lauro Ramos Venancio
  Cc: aloisio.almeida@openbossa.org, samuel@sortiz.org,
	linville@tuxdriver.com, linux-wireless@vger.kernel.org
In-Reply-To: <CAK3JMAYq62VuPQGdwv=Qu6QnakG6biOQfYDj=kOKaOzW6QdT1Q@mail.gmail.com>

Hi Lauro, 

> >  /* NFCEE Interface Specific Status Codes */
> > -#define        
> NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED          0xc0
> > -#define        
> NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED            0xc1
> > -#define        NCI_STATUS_NFCEE_TRANSMISSION_ERROR         
>             0xc2
> > -#define        NCI_STATUS_NFCEE_PROTOCOL_ERROR             
>             0xc3
> > +#define NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED         0xc0
> > +#define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED           0xc1
> > +#define NCI_STATUS_NFCEE_TRANSMISSION_ERROR                    0xc2
> > +#define NCI_STATUS_NFCEE_PROTOCOL_ERROR                    
>             0xc3
> >  #define NCI_STATUS_NFCEE_TIMEOUT_ERROR                         0xc4
> 
> You are mixing indentation changes with changes in constants. It would
> be better to put the indentation changes in a another patch.
OK, I'll remove the indentation changes from this patch set (and fix it in a different patch).

> 
> 
> 
> Lauro
> 

Thanks & BR,
Ilan

^ permalink raw reply

* RE: [PATCH v3 3/3] NFC: Check if NCI data flow control is used
From: Elias, Ilan @ 2011-11-09  7:54 UTC (permalink / raw)
  To: Lauro Ramos Venancio
  Cc: aloisio.almeida@openbossa.org, samuel@sortiz.org,
	linville@tuxdriver.com, linux-wireless@vger.kernel.org
In-Reply-To: <CAK3JMAbtL1wmsY3d9phV+nCKRnH8sFdpPgKybxcAKmsfu1DDSA@mail.gmail.com>

Hi Lauro, 

> > -               atomic_dec(&ndev->credits_cnt);
> > +               /* Check if data flow control is used */
> > +               if (atomic_read(&ndev->credits_cnt) != 0xff)
> > +                       atomic_dec(&ndev->credits_cnt);
> 
> It would be better to replace the 0xff by a define.
OK, I'll use a define instead of 0xff.

> 
> Lauro
> 

Thanks & BR,
Ilan

^ permalink raw reply

* Re: [PATCH] x86: Add amilo-rfkill driver for some Fujitsu-Siemens Amilo laptops
From: Johannes Berg @ 2011-11-09  8:30 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Matthew Garrett, platform-driver-x86, linux-wireless,
	Martin Večeřa, Alejandro Vidal Mata, Javier Vidal Mata,
	Tino Schmidt, 631664
In-Reply-To: <1320817459.18929.50.camel@deadeye>

On Wed, 2011-11-09 at 05:44 +0000, Ben Hutchings wrote:

> +static bool init_blocked = false;
> +
> +/* Initial state set by 'radio' parameter, as in the fsaa1655g driver */
> +module_param_named(radio, init_blocked, invbool, 0);

I wonder what you need this for -- it shouldn't be necessary and the way
rfkill_init_sw_state() works might cause unexpected behaviour. I
recommend leaving that out, if you do leave it out rfkill will set the
desired state of the device as soon as the device is registered.

johannes


^ permalink raw reply

* [PATCH] wireless: libertas: fix unaligned le64 accesses
From: Steven Miao @ 2011-11-09  8:30 UTC (permalink / raw)
  To: Dan Williams, John W. Linville, libertas-dev
  Cc: Steven Miao, open list:NETWORKING [WIREL...,
	open list:NETWORKING DRIVERS, open list

use get_unaligned_le64() to get timestamp

Signed-off-by: Steven Miao <realmz6@gmail.com>
---
 drivers/net/wireless/libertas/cfg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index b456a53..f23c2b1 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -630,7 +630,7 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy,
 			if (channel &&
 			    !(channel->flags & IEEE80211_CHAN_DISABLED))
 				cfg80211_inform_bss(wiphy, channel,
-					bssid, le64_to_cpu(*(__le64 *)tsfdesc),
+					bssid, get_unaligned_le64(tsfdesc),
 					capa, intvl, ie, ielen,
 					LBS_SCAN_RSSI_TO_MBM(rssi),
 					GFP_KERNEL);
-- 
1.7.0.4



^ permalink raw reply related

* Re: [PATCH v8 2/2] mac80211:  Support ht-cap over-rides.
From: Johannes Berg @ 2011-11-09  8:37 UTC (permalink / raw)
  To: Ben Greear; +Cc: linux-wireless
In-Reply-To: <4EB9B70B.6000406@candelatech.com>

On Tue, 2011-11-08 at 15:11 -0800, Ben Greear wrote:

> > Please. I'd rather go over a bit than read the above :-)
> 
> I just fixed this by using a tmp variable.  Hopefully the
> compiler is smart enough to make it disappear.

That works, yeah.

> > I really think that'd be much nicer. As it is now we have to add all
> > these checks everywhere, if we just calculate it once and then change
> > places to use it we just have to remember to use the right thing.
> 
> I'm quite nervous about attempting this change.  I'm pretty
> confident my current patch works as designed, and over all,
> it's pretty non-intrusive.  I am afraid that if I start trying
> to substitute something for sband->ht_cap that I'm going
> to end up changing a lot of code and possibly adding all sorts
> of strange bugs.

You should only have to change the places where you now added the
overrides, no?

> Out of curiousity, if one is doing off-channel work, wouldn't
> sband be different from when we associated and possibly different
> in it's ht-capabilities?  If so, the used-ht-caps would not
> be valid for that work?

Well the off-channel work will be on the channel that you're going to be
using after a successful connection, so that should be OK.

I'd at least like to try. If it ends up a disaster maybe we shouldn't,
but the way you go back to the mask & set all the time makes me a bit
nervous.

johannes


^ permalink raw reply

* Compability Issue regarding Freescale i.MX356 and Marvell 88w8688 Wifi-Module
From: Harald Freitag @ 2011-11-09  9:13 UTC (permalink / raw)
  To: linux-wireless

Hello!

I am a student from Germany currently working on a solution to combine the Freescale i.MX356 application processor with the Marvell 88w8688 Wifi-Module over the SDIO interface of the processor.

My main problem is that the application processor of Freescale got an embedded linux 2.6.31 system including the necessary driver support (specially for the SDIO interface) implemented and the driver for the Marvell 88w8688 Wifi-Module is coming with a linux 2.6.35 firmware/driver support.

Now the question is, how do I get them both working together? (I am still a novice on that field of expertise!)

Option 1: Backporting the Marvell 88w8688 SDIO driver from linux 2.6.35 to 2.6.31
Option 2: Finding an older Marvell 88w8688 SDIO compatible with linux 2.6.31

I already did some research (on http://kernelnewbies.org/) trying to figure out what general differences and changes in the libertas driver support have been made (with moderate success, since I am still lacking quite alot of the necessary coding understanding). 
I also downloaded the latest software/firmware packages from Freescale and Marvell in order to learn something about the functionality of SDIO interface drivers (pretty much hitting a wall though...).
After some time looking through the archives here on "http://linuxwireless.org/" and on "http://lists.infradead.org/mailman/listinfo/libertas-dev" I saw a few articles that could be partially helpful for my problem, but that didnt got me very far yet...

Since the embedded linux 2.6.31 system on the application processor got already adapted and configured for the intended feature support, it is not an option to upgrade/patch the linux system on the application processor. 

I would be most grateful for any helpful information regarding this issue or hint towards the right place to look, if there have been similar problems solved/delt with in the past.

Thank you very much and I appreciate that you took some time reading through this...

Regards Harald


-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

^ permalink raw reply

* [PATCH v2] net: add wireless TX status socket option
From: Johannes Berg @ 2011-11-09  9:15 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, netdev
In-Reply-To: <1320317796.3950.43.camel@jlt3.sipsolutions.net>

From: Johannes Berg <johannes.berg@intel.com>

The 802.1X EAPOL handshake hostapd does requires
knowing whether the frame was ack'ed by the peer.
Currently, we fudge this pretty badly by not even
transmitting the frame as a normal data frame but
injecting it with radiotap and getting the status
out of radiotap monitor as well. This is rather
complex, confuses users (mon.wlan0 presence) and
doesn't work with all hardware.

To get rid of that hack, introduce a real wifi TX
status option for data frame transmissions.

This works similar to the existing TX timestamping
in that it reflects the SKB back to the socket's
error queue with a SCM_WIFI_STATUS cmsg that has
an int indicating ACK status (0/1).

Since it is possible that at some point we will
want to have TX timestamping and wifi status in a
single errqueue SKB (there's little point in not
doing that), redefine SO_EE_ORIGIN_TIMESTAMPING
to SO_EE_ORIGIN_TXSTATUS which can collect more
than just the timestamp; keep the old constant
as an alias of course. Currently the internal APIs
don't make that possible, but it wouldn't be hard
to split them up in a way that makes it possible.

Thanks to Neil Horman for helping me figure out
the functions that add the control messages.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
v2: rebase onto net-next coming into wireless-next

 arch/alpha/include/asm/socket.h   |    3 +++
 arch/arm/include/asm/socket.h     |    3 +++
 arch/avr32/include/asm/socket.h   |    3 +++
 arch/cris/include/asm/socket.h    |    3 +++
 arch/frv/include/asm/socket.h     |    3 +++
 arch/h8300/include/asm/socket.h   |    3 +++
 arch/ia64/include/asm/socket.h    |    3 +++
 arch/m32r/include/asm/socket.h    |    3 +++
 arch/m68k/include/asm/socket.h    |    3 +++
 arch/mips/include/asm/socket.h    |    3 +++
 arch/mn10300/include/asm/socket.h |    3 +++
 arch/parisc/include/asm/socket.h  |    3 +++
 arch/powerpc/include/asm/socket.h |    3 +++
 arch/s390/include/asm/socket.h    |    3 +++
 arch/sparc/include/asm/socket.h   |    3 +++
 arch/xtensa/include/asm/socket.h  |    3 +++
 include/asm-generic/socket.h      |    3 +++
 include/linux/errqueue.h          |    3 ++-
 include/linux/skbuff.h            |   19 +++++++++++++++++--
 include/net/sock.h                |    6 ++++++
 net/core/skbuff.c                 |   20 ++++++++++++++++++++
 net/core/sock.c                   |    9 +++++++++
 net/socket.c                      |   18 ++++++++++++++++++
 23 files changed, 123 insertions(+), 3 deletions(-)

--- a/include/asm-generic/socket.h	2011-11-08 22:32:30.000000000 +0100
+++ b/include/asm-generic/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -64,4 +64,7 @@
 #define SO_DOMAIN		39
 
 #define SO_RXQ_OVFL             40
+
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS	SO_WIFI_STATUS
 #endif /* __ASM_GENERIC_SOCKET_H */
--- a/net/core/sock.c	2011-11-09 10:07:34.000000000 +0100
+++ b/net/core/sock.c	2011-11-09 10:12:02.000000000 +0100
@@ -740,6 +740,11 @@ set_rcvbuf:
 	case SO_RXQ_OVFL:
 		sock_valbool_flag(sk, SOCK_RXQ_OVFL, valbool);
 		break;
+
+	case SO_WIFI_STATUS:
+		sock_valbool_flag(sk, SOCK_WIFI_STATUS, valbool);
+		break;
+
 	default:
 		ret = -ENOPROTOOPT;
 		break;
@@ -961,6 +966,10 @@ int sock_getsockopt(struct socket *sock,
 		v.val = !!sock_flag(sk, SOCK_RXQ_OVFL);
 		break;
 
+	case SO_WIFI_STATUS:
+		v.val = !!sock_flag(sk, SOCK_WIFI_STATUS);
+		break;
+
 	default:
 		return -ENOPROTOOPT;
 	}
--- a/include/net/sock.h	2011-11-09 10:07:30.000000000 +0100
+++ b/include/net/sock.h	2011-11-09 10:12:02.000000000 +0100
@@ -563,6 +563,7 @@ enum sock_flags {
 	SOCK_FASYNC, /* fasync() active */
 	SOCK_RXQ_OVFL,
 	SOCK_ZEROCOPY, /* buffers from userspace */
+	SOCK_WIFI_STATUS, /* push wifi status to userspace */
 };
 
 static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -1714,6 +1715,8 @@ static inline int sock_intr_errno(long t
 
 extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
 	struct sk_buff *skb);
+extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
+	struct sk_buff *skb);
 
 static __inline__ void
 sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
@@ -1741,6 +1744,9 @@ sock_recv_timestamp(struct msghdr *msg,
 		__sock_recv_timestamp(msg, sk, skb);
 	else
 		sk->sk_stamp = kt;
+
+	if (sock_flag(sk, SOCK_WIFI_STATUS) && skb->wifi_acked_valid)
+		__sock_recv_wifi_status(msg, sk, skb);
 }
 
 extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
--- a/arch/alpha/include/asm/socket.h	2011-11-08 22:32:30.000000000 +0100
+++ b/arch/alpha/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -69,6 +69,9 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 /* O_NONBLOCK clashes with the bits used for socket types.  Therefore we
  * have to define SOCK_NONBLOCK to a different value here.
  */
--- a/arch/arm/include/asm/socket.h	2011-11-08 22:32:30.000000000 +0100
+++ b/arch/arm/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -62,4 +62,7 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #endif /* _ASM_SOCKET_H */
--- a/arch/avr32/include/asm/socket.h	2011-11-08 22:32:29.000000000 +0100
+++ b/arch/avr32/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -62,4 +62,7 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #endif /* __ASM_AVR32_SOCKET_H */
--- a/arch/cris/include/asm/socket.h	2011-11-08 22:32:30.000000000 +0100
+++ b/arch/cris/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -64,6 +64,9 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #endif /* _ASM_SOCKET_H */
 
 
--- a/arch/frv/include/asm/socket.h	2011-11-08 22:32:29.000000000 +0100
+++ b/arch/frv/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -62,5 +62,8 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #endif /* _ASM_SOCKET_H */
 
--- a/arch/h8300/include/asm/socket.h	2011-11-08 22:32:29.000000000 +0100
+++ b/arch/h8300/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -62,4 +62,7 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #endif /* _ASM_SOCKET_H */
--- a/arch/ia64/include/asm/socket.h	2011-11-08 22:32:30.000000000 +0100
+++ b/arch/ia64/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -71,4 +71,7 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #endif /* _ASM_IA64_SOCKET_H */
--- a/arch/m32r/include/asm/socket.h	2011-11-08 22:32:30.000000000 +0100
+++ b/arch/m32r/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -62,4 +62,7 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #endif /* _ASM_M32R_SOCKET_H */
--- a/arch/m68k/include/asm/socket.h	2011-11-08 22:32:29.000000000 +0100
+++ b/arch/m68k/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -62,4 +62,7 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #endif /* _ASM_SOCKET_H */
--- a/arch/mips/include/asm/socket.h	2011-11-08 22:32:29.000000000 +0100
+++ b/arch/mips/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -82,6 +82,9 @@ To add: #define SO_REUSEPORT 0x0200	/* A
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #ifdef __KERNEL__
 
 /** sock_type - Socket types
--- a/arch/mn10300/include/asm/socket.h	2011-11-08 22:32:29.000000000 +0100
+++ b/arch/mn10300/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -62,4 +62,7 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #endif /* _ASM_SOCKET_H */
--- a/arch/parisc/include/asm/socket.h	2011-11-08 22:32:29.000000000 +0100
+++ b/arch/parisc/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -61,6 +61,9 @@
 
 #define SO_RXQ_OVFL             0x4021
 
+#define SO_WIFI_STATUS		0x4022
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 /* O_NONBLOCK clashes with the bits used for socket types.  Therefore we
  * have to define SOCK_NONBLOCK to a different value here.
  */
--- a/arch/powerpc/include/asm/socket.h	2011-11-08 22:32:29.000000000 +0100
+++ b/arch/powerpc/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -69,4 +69,7 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #endif	/* _ASM_POWERPC_SOCKET_H */
--- a/arch/s390/include/asm/socket.h	2011-11-08 22:32:29.000000000 +0100
+++ b/arch/s390/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -70,4 +70,7 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #endif /* _ASM_SOCKET_H */
--- a/arch/sparc/include/asm/socket.h	2011-11-08 22:32:29.000000000 +0100
+++ b/arch/sparc/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -58,6 +58,9 @@
 
 #define SO_RXQ_OVFL             0x0024
 
+#define SO_WIFI_STATUS		0x0025
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 /* Security levels - as per NRL IPv6 - don't actually do anything */
 #define SO_SECURITY_AUTHENTICATION		0x5001
 #define SO_SECURITY_ENCRYPTION_TRANSPORT	0x5002
--- a/arch/xtensa/include/asm/socket.h	2011-11-08 22:32:29.000000000 +0100
+++ b/arch/xtensa/include/asm/socket.h	2011-11-09 10:12:02.000000000 +0100
@@ -73,4 +73,7 @@
 
 #define SO_RXQ_OVFL             40
 
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 #endif	/* _XTENSA_SOCKET_H */
--- a/include/linux/errqueue.h	2011-11-08 22:32:30.000000000 +0100
+++ b/include/linux/errqueue.h	2011-11-09 10:12:02.000000000 +0100
@@ -17,7 +17,8 @@ struct sock_extended_err {
 #define SO_EE_ORIGIN_LOCAL	1
 #define SO_EE_ORIGIN_ICMP	2
 #define SO_EE_ORIGIN_ICMP6	3
-#define SO_EE_ORIGIN_TIMESTAMPING 4
+#define SO_EE_ORIGIN_TXSTATUS	4
+#define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
 
 #define SO_EE_OFFENDER(ee)	((struct sockaddr*)((ee)+1))
 
--- a/include/linux/skbuff.h	2011-11-09 10:07:30.000000000 +0100
+++ b/include/linux/skbuff.h	2011-11-09 10:12:41.000000000 +0100
@@ -218,6 +218,9 @@ enum {
 
 	/* device driver supports TX zero-copy buffers */
 	SKBTX_DEV_ZEROCOPY = 1 << 4,
+
+	/* generate wifi status information (where possible) */
+	SKBTX_WIFI_STATUS = 1 << 5,
 };
 
 /*
@@ -352,6 +355,8 @@ typedef unsigned char *sk_buff_data_t;
  *	@ooo_okay: allow the mapping of a socket to a queue to be changed
  *	@l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport
  *		ports.
+ *	@wifi_acked_valid: wifi_acked was set
+ *	@wifi_acked: whether frame was acked on wifi or not
  *	@dma_cookie: a cookie to one of several possible DMA operations
  *		done by skb DMA functions
  *	@secmark: security marking
@@ -445,10 +450,11 @@ struct sk_buff {
 #endif
 	__u8			ooo_okay:1;
 	__u8			l4_rxhash:1;
+	__u8			wifi_acked_valid:1;
+	__u8			wifi_acked:1;
+	/* 10/12 bit hole (depending on ndisc_nodetype presence) */
 	kmemcheck_bitfield_end(flags2);
 
-	/* 0/13 bit hole */
-
 #ifdef CONFIG_NET_DMA
 	dma_cookie_t		dma_cookie;
 #endif
@@ -2263,6 +2269,15 @@ static inline void skb_tx_timestamp(stru
 	sw_tx_timestamp(skb);
 }
 
+/**
+ * skb_complete_wifi_ack - deliver skb with wifi status
+ *
+ * @skb: the original outgoing packet
+ * @acked: ack status
+ *
+ */
+void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
+
 extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
 extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
 
--- a/net/core/skbuff.c	2011-11-09 10:07:34.000000000 +0100
+++ b/net/core/skbuff.c	2011-11-09 10:12:02.000000000 +0100
@@ -3169,6 +3169,26 @@ void skb_tstamp_tx(struct sk_buff *orig_
 }
 EXPORT_SYMBOL_GPL(skb_tstamp_tx);
 
+void skb_complete_wifi_ack(struct sk_buff *skb, bool acked)
+{
+	struct sock *sk = skb->sk;
+	struct sock_exterr_skb *serr;
+	int err;
+
+	skb->wifi_acked_valid = 1;
+	skb->wifi_acked = acked;
+
+	serr = SKB_EXT_ERR(skb);
+	memset(serr, 0, sizeof(*serr));
+	serr->ee.ee_errno = ENOMSG;
+	serr->ee.ee_origin = SO_EE_ORIGIN_TXSTATUS;
+
+	err = sock_queue_err_skb(sk, skb);
+	if (err)
+		kfree_skb(skb);
+}
+EXPORT_SYMBOL_GPL(skb_complete_wifi_ack);
+
 
 /**
  * skb_partial_csum_set - set up and verify partial csum values for packet
--- a/net/socket.c	2011-11-09 10:07:34.000000000 +0100
+++ b/net/socket.c	2011-11-09 10:12:02.000000000 +0100
@@ -538,6 +538,8 @@ int sock_tx_timestamp(struct sock *sk, _
 		*tx_flags |= SKBTX_HW_TSTAMP;
 	if (sock_flag(sk, SOCK_TIMESTAMPING_TX_SOFTWARE))
 		*tx_flags |= SKBTX_SW_TSTAMP;
+	if (sock_flag(sk, SOCK_WIFI_STATUS))
+		*tx_flags |= SKBTX_WIFI_STATUS;
 	return 0;
 }
 EXPORT_SYMBOL(sock_tx_timestamp);
@@ -674,6 +676,22 @@ void __sock_recv_timestamp(struct msghdr
 }
 EXPORT_SYMBOL_GPL(__sock_recv_timestamp);
 
+void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
+	struct sk_buff *skb)
+{
+	int ack;
+
+	if (!sock_flag(sk, SOCK_WIFI_STATUS))
+		return;
+	if (!skb->wifi_acked_valid)
+		return;
+
+	ack = skb->wifi_acked;
+
+	put_cmsg(msg, SOL_SOCKET, SCM_WIFI_STATUS, sizeof(ack), &ack);
+}
+EXPORT_SYMBOL_GPL(__sock_recv_wifi_status);
+
 static inline void sock_recv_drops(struct msghdr *msg, struct sock *sk,
 				   struct sk_buff *skb)
 {



^ permalink raw reply

* [PATCH v3] mac80211/cfg80211: report monitor channel in wireless extensions
From: Johannes Berg @ 2011-11-09  9:30 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless
In-Reply-To: <1320778887.24797.38.camel@jlt3.sipsolutions.net>

From: Johannes Berg <johannes.berg@intel.com>

Just add API to get the channel & report it. Trivial really.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
So trivial it didn't even work ;-)

 include/net/cfg80211.h     |    5 +++++
 net/mac80211/cfg.c         |    9 +++++++++
 net/wireless/wext-compat.c |   12 ++++++++++++
 3 files changed, 26 insertions(+)

--- a/include/net/cfg80211.h	2011-11-09 10:13:05.000000000 +0100
+++ b/include/net/cfg80211.h	2011-11-09 10:27:47.000000000 +0100
@@ -1342,6 +1342,9 @@ struct cfg80211_gtk_rekey_data {
  *	doesn't verify much. Note, however, that the passed netdev may be
  *	%NULL as well if the user requested changing the channel for the
  *	device itself, or for a monitor interface.
+ * @get_channel: Get the current operating channel, should return %NULL if
+ *	there's no single defined operating channel if for example the
+ *	device implements channel hopping for multi-channel virtual interfaces.
  *
  * @scan: Request to do a scan. If returning zero, the scan request is given
  *	the driver, and will be valid until passed to cfg80211_scan_done().
@@ -1627,6 +1630,8 @@ struct cfg80211_ops {
 
 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
 				const u8 *peer, u64 *cookie);
+
+	struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy);
 };
 
 /*
--- a/net/wireless/wext-compat.c	2011-11-09 10:07:35.000000000 +0100
+++ b/net/wireless/wext-compat.c	2011-11-09 10:13:18.000000000 +0100
@@ -819,12 +819,24 @@ static int cfg80211_wext_giwfreq(struct
 				 struct iw_freq *freq, char *extra)
 {
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
+	struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+	struct ieee80211_channel *chan;
 
 	switch (wdev->iftype) {
 	case NL80211_IFTYPE_STATION:
 		return cfg80211_mgd_wext_giwfreq(dev, info, freq, extra);
 	case NL80211_IFTYPE_ADHOC:
 		return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
+	case NL80211_IFTYPE_MONITOR:
+		if (!rdev->ops->get_channel)
+			return -EINVAL;
+
+		chan = rdev->ops->get_channel(wdev->wiphy);
+		if (!chan)
+			return -EINVAL;
+		freq->m = chan->center_freq;
+		freq->e = 6;
+		return 0;
 	default:
 		if (!wdev->channel)
 			return -EINVAL;
--- a/net/mac80211/cfg.c	2011-11-09 10:10:56.000000000 +0100
+++ b/net/mac80211/cfg.c	2011-11-09 10:29:40.000000000 +0100
@@ -2579,6 +2579,14 @@ static int ieee80211_probe_client(struct
 	return 0;
 }
 
+static struct ieee80211_channel *
+ieee80211_wiphy_get_channel(struct wiphy *wiphy)
+{
+	struct ieee80211_local *local = wiphy_priv(wiphy);
+
+	return local->oper_channel;
+}
+
 struct cfg80211_ops mac80211_config_ops = {
 	.add_virtual_intf = ieee80211_add_iface,
 	.del_virtual_intf = ieee80211_del_iface,
@@ -2645,4 +2653,5 @@ struct cfg80211_ops mac80211_config_ops
 	.tdls_oper = ieee80211_tdls_oper,
 	.tdls_mgmt = ieee80211_tdls_mgmt,
 	.probe_client = ieee80211_probe_client,
+	.get_channel = ieee80211_wiphy_get_channel,
 };



^ permalink raw reply

* Re: Compability Issue regarding Freescale i.MX356 and Marvell 88w8688 Wifi-Module
From: Hauke Mehrtens @ 2011-11-09  9:39 UTC (permalink / raw)
  To: Harald Freitag; +Cc: linux-wireless
In-Reply-To: <20111109091341.83440@gmx.net>

On 11/09/2011 10:13 AM, Harald Freitag wrote:
> Hello!
> 
> I am a student from Germany currently working on a solution to combine the Freescale i.MX356 application processor with the Marvell 88w8688 Wifi-Module over the SDIO interface of the processor.
> 
> My main problem is that the application processor of Freescale got an embedded linux 2.6.31 system including the necessary driver support (specially for the SDIO interface) implemented and the driver for the Marvell 88w8688 Wifi-Module is coming with a linux 2.6.35 firmware/driver support.
> 
> Now the question is, how do I get them both working together? (I am still a novice on that field of expertise!)
> 
> Option 1: Backporting the Marvell 88w8688 SDIO driver from linux 2.6.35 to 2.6.31
> Option 2: Finding an older Marvell 88w8688 SDIO compatible with linux 2.6.31
> 
> I already did some research (on http://kernelnewbies.org/) trying to figure out what general differences and changes in the libertas driver support have been made (with moderate success, since I am still lacking quite alot of the necessary coding understanding). 
> I also downloaded the latest software/firmware packages from Freescale and Marvell in order to learn something about the functionality of SDIO interface drivers (pretty much hitting a wall though...).
> After some time looking through the archives here on "http://linuxwireless.org/" and on "http://lists.infradead.org/mailman/listinfo/libertas-dev" I saw a few articles that could be partially helpful for my problem, but that didnt got me very far yet...
> 
> Since the embedded linux 2.6.31 system on the application processor got already adapted and configured for the intended feature support, it is not an option to upgrade/patch the linux system on the application processor. 
> 
> I would be most grateful for any helpful information regarding this issue or hint towards the right place to look, if there have been similar problems solved/delt with in the past.
> 
> Thank you very much and I appreciate that you took some time reading through this...
> 
> Regards Harald
Hi Harald,

we have compat-wireless [0] which backports a recent wireless subsystem
to older kernel versions. This seams to be exactly what you are
searching for, but libertas_sdio is just working for kernel >= 2.6.32,
because of some changes in the power management API in recent kernel
versions. You could implement a backport for the power management
interface into compat-wireless or just backport the new power management
API into your kernel.

Hauke

[0]: http://linuxwireless.org/en/users/Download

--
Now with mailing list in CC

^ permalink raw reply

* [PATCH v4 1/3] NFC: Update names and structs to NCI spec 1.0 d18
From: ilanelias78 @ 2011-11-09 10:09 UTC (permalink / raw)
  To: aloisio.almeida, lauro.venancio, samuel, linville
  Cc: linux-wireless, Ilan Elias
In-Reply-To: <1320833356-19132-1-git-send-email-ilane@ti.com>

From: Ilan Elias <ilane@ti.com>

Addition, deletion and modification of NCI constants.
Changes in NCI commands, responses and notifications structures.

Signed-off-by: Ilan Elias <ilane@ti.com>
---
 include/net/nfc/nci.h      |   81 ++++++++++++++++++--------
 include/net/nfc/nci_core.h |   11 ++--
 net/nfc/nci/core.c         |    7 ++-
 net/nfc/nci/data.c         |    5 +-
 net/nfc/nci/lib.c          |    8 +--
 net/nfc/nci/ntf.c          |  137 ++++++++++++++++++++++++++++----------------
 net/nfc/nci/rsp.c          |   58 +++++++++++-------
 7 files changed, 193 insertions(+), 114 deletions(-)

diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 39b85bc..0ebf842 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -36,24 +36,23 @@
 /* NCI Status Codes */
 #define	NCI_STATUS_OK						0x00
 #define	NCI_STATUS_REJECTED					0x01
-#define	NCI_STATUS_MESSAGE_CORRUPTED				0x02
-#define	NCI_STATUS_BUFFER_FULL					0x03
-#define	NCI_STATUS_FAILED					0x04
-#define	NCI_STATUS_NOT_INITIALIZED				0x05
-#define	NCI_STATUS_SYNTAX_ERROR					0x06
-#define	NCI_STATUS_SEMANTIC_ERROR				0x07
-#define	NCI_STATUS_UNKNOWN_GID					0x08
-#define	NCI_STATUS_UNKNOWN_OID					0x09
-#define	NCI_STATUS_INVALID_PARAM				0x0a
-#define	NCI_STATUS_MESSAGE_SIZE_EXCEEDED			0x0b
+#define	NCI_STATUS_RF_FRAME_CORRUPTED				0x02
+#define	NCI_STATUS_FAILED					0x03
+#define	NCI_STATUS_NOT_INITIALIZED				0x04
+#define	NCI_STATUS_SYNTAX_ERROR					0x05
+#define	NCI_STATUS_SEMANTIC_ERROR				0x06
+#define	NCI_STATUS_UNKNOWN_GID					0x07
+#define	NCI_STATUS_UNKNOWN_OID					0x08
+#define	NCI_STATUS_INVALID_PARAM				0x09
+#define	NCI_STATUS_MESSAGE_SIZE_EXCEEDED			0x0a
 /* Discovery Specific Status Codes */
 #define	NCI_STATUS_DISCOVERY_ALREADY_STARTED			0xa0
 #define	NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED		0xa1
+#define	NCI_STATUS_DISCOVERY_TEAR_DOWN				0xa2
 /* RF Interface Specific Status Codes */
 #define	NCI_STATUS_RF_TRANSMISSION_ERROR			0xb0
 #define	NCI_STATUS_RF_PROTOCOL_ERROR				0xb1
 #define	NCI_STATUS_RF_TIMEOUT_ERROR				0xb2
-#define	NCI_STATUS_RF_LINK_LOSS_ERROR				0xb3
 /* NFCEE Interface Specific Status Codes */
 #define	NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED		0xc0
 #define	NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED		0xc1
@@ -73,6 +72,21 @@
 #define NCI_NFC_A_ACTIVE_LISTEN_MODE				0x83
 #define NCI_NFC_F_ACTIVE_LISTEN_MODE				0x85
 
+/* NCI RF Technologies */
+#define NCI_NFC_RF_TECHNOLOGY_A					0x00
+#define NCI_NFC_RF_TECHNOLOGY_B					0x01
+#define NCI_NFC_RF_TECHNOLOGY_F					0x02
+#define NCI_NFC_RF_TECHNOLOGY_15693				0x03
+
+/* NCI Bit Rates */
+#define NCI_NFC_BIT_RATE_106					0x00
+#define NCI_NFC_BIT_RATE_212					0x01
+#define NCI_NFC_BIT_RATE_424					0x02
+#define NCI_NFC_BIT_RATE_848					0x03
+#define NCI_NFC_BIT_RATE_1696					0x04
+#define NCI_NFC_BIT_RATE_3392					0x05
+#define NCI_NFC_BIT_RATE_6784					0x06
+
 /* NCI RF Protocols */
 #define NCI_RF_PROTOCOL_UNKNOWN					0x00
 #define NCI_RF_PROTOCOL_T1T					0x01
@@ -82,11 +96,18 @@
 #define NCI_RF_PROTOCOL_NFC_DEP					0x05
 
 /* NCI RF Interfaces */
-#define NCI_RF_INTERFACE_RFU					0x00
+#define NCI_RF_INTERFACE_NFCEE_DIRECT				0x00
 #define	NCI_RF_INTERFACE_FRAME					0x01
 #define	NCI_RF_INTERFACE_ISO_DEP				0x02
 #define	NCI_RF_INTERFACE_NFC_DEP				0x03
 
+/* NCI Reset types */
+#define NCI_RESET_TYPE_KEEP_CONFIG				0x00
+#define NCI_RESET_TYPE_RESET_CONFIG				0x01
+
+/* NCI Static RF connection ID */
+#define NCI_STATIC_RF_CONN_ID					0x00
+
 /* NCI RF_DISCOVER_MAP_CMD modes */
 #define NCI_DISC_MAP_MODE_POLL					0x01
 #define NCI_DISC_MAP_MODE_LISTEN				0x02
@@ -98,8 +119,6 @@
 #define	NCI_DISCOVERY_TYPE_POLL_F_PASSIVE			0x02
 #define	NCI_DISCOVERY_TYPE_POLL_A_ACTIVE			0x03
 #define	NCI_DISCOVERY_TYPE_POLL_F_ACTIVE			0x05
-#define	NCI_DISCOVERY_TYPE_WAKEUP_A_PASSIVE			0x06
-#define	NCI_DISCOVERY_TYPE_WAKEUP_B_PASSIVE			0x07
 #define	NCI_DISCOVERY_TYPE_WAKEUP_A_ACTIVE			0x09
 #define	NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE			0x80
 #define	NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE			0x81
@@ -111,8 +130,7 @@
 #define	NCI_DEACTIVATE_TYPE_IDLE_MODE				0x00
 #define	NCI_DEACTIVATE_TYPE_SLEEP_MODE				0x01
 #define	NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE			0x02
-#define	NCI_DEACTIVATE_TYPE_RF_LINK_LOSS			0x03
-#define	NCI_DEACTIVATE_TYPE_DISCOVERY_ERROR			0x04
+#define	NCI_DEACTIVATE_TYPE_DISCOVERY				0x03
 
 /* Message Type (MT) */
 #define NCI_MT_DATA_PKT						0x00
@@ -169,6 +187,9 @@ struct nci_data_hdr {
 /* -----  NCI Commands ---- */
 /* ------------------------ */
 #define NCI_OP_CORE_RESET_CMD		nci_opcode_pack(NCI_GID_CORE, 0x00)
+struct nci_core_reset_cmd {
+	__u8	reset_type;
+} __packed;
 
 #define NCI_OP_CORE_INIT_CMD		nci_opcode_pack(NCI_GID_CORE, 0x01)
 
@@ -218,6 +239,7 @@ struct nci_rf_deactivate_cmd {
 struct nci_core_reset_rsp {
 	__u8	status;
 	__u8	nci_ver;
+	__u8	config_status;
 } __packed;
 
 #define NCI_OP_CORE_INIT_RSP		nci_opcode_pack(NCI_GID_CORE, 0x01)
@@ -232,10 +254,12 @@ struct nci_core_init_rsp_1 {
 struct nci_core_init_rsp_2 {
 	__u8	max_logical_connections;
 	__le16	max_routing_table_size;
-	__u8	max_control_packet_payload_length;
-	__le16	rf_sending_buffer_size;
-	__le16	rf_receiving_buffer_size;
-	__le16	manufacturer_id;
+	__u8	max_ctrl_pkt_payload_len;
+	__le16	max_size_for_large_params;
+	__u8	max_data_pkt_payload_size;
+	__u8	initial_num_credits;
+	__u8	manufact_id;
+	__le32	manufact_specific_info;
 } __packed;
 
 #define NCI_OP_CORE_SET_CONFIG_RSP	nci_opcode_pack(NCI_GID_CORE, 0x02)
@@ -275,7 +299,7 @@ struct nci_rf_field_info_ntf {
 	__u8	rf_field_status;
 } __packed;
 
-#define NCI_OP_RF_ACTIVATE_NTF		nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
+#define NCI_OP_RF_INTF_ACTIVATED_NTF	nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
 struct rf_tech_specific_params_nfca_poll {
 	__u16	sens_res;
 	__u8	nfcid1_len;	/* 0, 4, 7, or 10 Bytes */
@@ -289,17 +313,20 @@ struct activation_params_nfca_poll_iso_dep {
 	__u8	rats_res[20];
 };
 
-struct nci_rf_activate_ntf {
-	__u8	target_handle;
+struct nci_rf_intf_activated_ntf {
+	__u8	rf_discovery_id;
+	__u8	rf_interface_type;
 	__u8	rf_protocol;
-	__u8	rf_tech_and_mode;
+	__u8	activation_rf_tech_and_mode;
 	__u8	rf_tech_specific_params_len;
 
 	union {
 		struct rf_tech_specific_params_nfca_poll nfca_poll;
 	} rf_tech_specific_params;
 
-	__u8	rf_interface_type;
+	__u8	data_exch_rf_tech_and_mode;
+	__u8	data_exch_tx_bit_rate;
+	__u8	data_exch_rx_bit_rate;
 	__u8	activation_params_len;
 
 	union {
@@ -309,5 +336,9 @@ struct nci_rf_activate_ntf {
 } __packed;
 
 #define NCI_OP_RF_DEACTIVATE_NTF	nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
+struct nci_rf_deactivate_ntf {
+	__u8	type;
+	__u8	reason;
+} __packed;
 
 #endif /* __NCI_H */
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index b8b4bbd..6e6a7be 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -109,14 +109,15 @@ struct nci_dev {
 				[NCI_MAX_SUPPORTED_RF_INTERFACES];
 	__u8			max_logical_connections;
 	__u16			max_routing_table_size;
-	__u8			max_control_packet_payload_length;
-	__u16			rf_sending_buffer_size;
-	__u16			rf_receiving_buffer_size;
-	__u16			manufacturer_id;
+	__u8			max_ctrl_pkt_payload_len;
+	__u16			max_size_for_large_params;
+	__u8			max_data_pkt_payload_size;
+	__u8			initial_num_credits;
+	__u8			manufact_id;
+	__u32			manufact_specific_info;
 
 	/* received during NCI_OP_CORE_CONN_CREATE_RSP for static conn 0 */
 	__u8			max_pkt_payload_size;
-	__u8			initial_num_credits;
 	__u8			conn_id;
 
 	/* stored during nci_data_exchange */
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 3925c65..4b6ae5d 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -126,7 +126,10 @@ static inline int nci_request(struct nci_dev *ndev,
 
 static void nci_reset_req(struct nci_dev *ndev, unsigned long opt)
 {
-	nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 0, NULL);
+	struct nci_core_reset_cmd cmd;
+
+	cmd.reset_type = NCI_RESET_TYPE_RESET_CONFIG;
+	nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 1, &cmd);
 }
 
 static void nci_init_req(struct nci_dev *ndev, unsigned long opt)
@@ -470,7 +473,7 @@ static int nci_data_exchange(struct nfc_dev *nfc_dev, __u32 target_idx,
 	ndev->data_exchange_cb = cb;
 	ndev->data_exchange_cb_context = cb_context;
 
-	rc = nci_send_data(ndev, ndev->conn_id, skb);
+	rc = nci_send_data(ndev, NCI_STATIC_RF_CONN_ID, skb);
 	if (rc)
 		clear_bit(NCI_DATA_EXCHANGE, &ndev->flags);
 
diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c
index e5ed90f..511fb96 100644
--- a/net/nfc/nci/data.c
+++ b/net/nfc/nci/data.c
@@ -95,7 +95,8 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev,
 	__skb_queue_head_init(&frags_q);
 
 	while (total_len) {
-		frag_len = min_t(int, total_len, ndev->max_pkt_payload_size);
+		frag_len =
+			min_t(int, total_len, ndev->max_data_pkt_payload_size);
 
 		skb_frag = nci_skb_alloc(ndev,
 					(NCI_DATA_HDR_SIZE + frag_len),
@@ -151,7 +152,7 @@ int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb)
 	nfc_dbg("entry, conn_id 0x%x, plen %d", conn_id, skb->len);
 
 	/* check if the packet need to be fragmented */
-	if (skb->len <= ndev->max_pkt_payload_size) {
+	if (skb->len <= ndev->max_data_pkt_payload_size) {
 		/* no need to fragment packet */
 		nci_push_data_hdr(ndev, conn_id, skb, NCI_PBF_LAST);
 
diff --git a/net/nfc/nci/lib.c b/net/nfc/nci/lib.c
index b19dc2f..e99adcf 100644
--- a/net/nfc/nci/lib.c
+++ b/net/nfc/nci/lib.c
@@ -42,12 +42,9 @@ int nci_to_errno(__u8 code)
 	case NCI_STATUS_REJECTED:
 		return -EBUSY;
 
-	case NCI_STATUS_MESSAGE_CORRUPTED:
+	case NCI_STATUS_RF_FRAME_CORRUPTED:
 		return -EBADMSG;
 
-	case NCI_STATUS_BUFFER_FULL:
-		return -ENOBUFS;
-
 	case NCI_STATUS_NOT_INITIALIZED:
 		return -EHOSTDOWN;
 
@@ -80,9 +77,6 @@ int nci_to_errno(__u8 code)
 	case NCI_STATUS_NFCEE_TIMEOUT_ERROR:
 		return -ETIMEDOUT;
 
-	case NCI_STATUS_RF_LINK_LOSS_ERROR:
-		return -ENOLINK;
-
 	case NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED:
 		return -EDQUOT;
 
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index 96633f5..6789f48 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -54,7 +54,7 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev,
 			ntf->conn_entries[i].conn_id,
 			ntf->conn_entries[i].credits);
 
-		if (ntf->conn_entries[i].conn_id == ndev->conn_id) {
+		if (ntf->conn_entries[i].conn_id == NCI_STATIC_RF_CONN_ID) {
 			/* found static rf connection */
 			atomic_add(ntf->conn_entries[i].credits,
 				&ndev->credits_cnt);
@@ -74,14 +74,12 @@ static void nci_rf_field_info_ntf_packet(struct nci_dev *ndev,
 	nfc_dbg("entry, rf_field_status %d", ntf->rf_field_status);
 }
 
-static int nci_rf_activate_nfca_passive_poll(struct nci_dev *ndev,
-			struct nci_rf_activate_ntf *ntf, __u8 *data)
+static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
+			struct nci_rf_intf_activated_ntf *ntf, __u8 *data)
 {
 	struct rf_tech_specific_params_nfca_poll *nfca_poll;
-	struct activation_params_nfca_poll_iso_dep *nfca_poll_iso_dep;
 
 	nfca_poll = &ntf->rf_tech_specific_params.nfca_poll;
-	nfca_poll_iso_dep = &ntf->activation_params.nfca_poll_iso_dep;
 
 	nfca_poll->sens_res = __le16_to_cpu(*((__u16 *)data));
 	data += 2;
@@ -100,32 +98,32 @@ static int nci_rf_activate_nfca_passive_poll(struct nci_dev *ndev,
 	if (nfca_poll->sel_res_len != 0)
 		nfca_poll->sel_res = *data++;
 
-	ntf->rf_interface_type = *data++;
-	ntf->activation_params_len = *data++;
-
-	nfc_dbg("sel_res_len %d, sel_res 0x%x, rf_interface_type %d, activation_params_len %d",
+	nfc_dbg("sel_res_len %d, sel_res 0x%x",
 		nfca_poll->sel_res_len,
-		nfca_poll->sel_res,
-		ntf->rf_interface_type,
-		ntf->activation_params_len);
-
-	switch (ntf->rf_interface_type) {
-	case NCI_RF_INTERFACE_ISO_DEP:
-		nfca_poll_iso_dep->rats_res_len = *data++;
-		if (nfca_poll_iso_dep->rats_res_len > 0) {
-			memcpy(nfca_poll_iso_dep->rats_res,
+		nfca_poll->sel_res);
+
+	return data;
+}
+
+static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,
+			struct nci_rf_intf_activated_ntf *ntf, __u8 *data)
+{
+	struct activation_params_nfca_poll_iso_dep *nfca_poll;
+
+	switch (ntf->activation_rf_tech_and_mode) {
+	case NCI_NFC_A_PASSIVE_POLL_MODE:
+		nfca_poll = &ntf->activation_params.nfca_poll_iso_dep;
+		nfca_poll->rats_res_len = *data++;
+		if (nfca_poll->rats_res_len > 0) {
+			memcpy(nfca_poll->rats_res,
 				data,
-				nfca_poll_iso_dep->rats_res_len);
+				nfca_poll->rats_res_len);
 		}
 		break;
 
-	case NCI_RF_INTERFACE_FRAME:
-		/* no activation params */
-		break;
-
 	default:
-		nfc_err("unsupported rf_interface_type 0x%x",
-			ntf->rf_interface_type);
+		nfc_err("unsupported activation_rf_tech_and_mode 0x%x",
+			ntf->activation_rf_tech_and_mode);
 		return -EPROTO;
 	}
 
@@ -133,7 +131,7 @@ static int nci_rf_activate_nfca_passive_poll(struct nci_dev *ndev,
 }
 
 static void nci_target_found(struct nci_dev *ndev,
-				struct nci_rf_activate_ntf *ntf)
+				struct nci_rf_intf_activated_ntf *ntf)
 {
 	struct nfc_target nfc_tgt;
 
@@ -141,6 +139,8 @@ static void nci_target_found(struct nci_dev *ndev,
 		nfc_tgt.supported_protocols = NFC_PROTO_MIFARE_MASK;
 	else if (ntf->rf_protocol == NCI_RF_PROTOCOL_ISO_DEP)	/* 4A */
 		nfc_tgt.supported_protocols = NFC_PROTO_ISO14443_MASK;
+	else
+		nfc_tgt.supported_protocols = 0;
 
 	nfc_tgt.sens_res = ntf->rf_tech_specific_params.nfca_poll.sens_res;
 	nfc_tgt.sel_res = ntf->rf_tech_specific_params.nfca_poll.sel_res;
@@ -158,49 +158,86 @@ static void nci_target_found(struct nci_dev *ndev,
 	nfc_targets_found(ndev->nfc_dev, &nfc_tgt, 1);
 }
 
-static void nci_rf_activate_ntf_packet(struct nci_dev *ndev,
-					struct sk_buff *skb)
+static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
+						struct sk_buff *skb)
 {
-	struct nci_rf_activate_ntf ntf;
+	struct nci_rf_intf_activated_ntf ntf;
 	__u8 *data = skb->data;
-	int rc = -1;
+	int err = 0;
 
 	clear_bit(NCI_DISCOVERY, &ndev->flags);
 	set_bit(NCI_POLL_ACTIVE, &ndev->flags);
 
-	ntf.target_handle = *data++;
+	ntf.rf_discovery_id = *data++;
+	ntf.rf_interface_type = *data++;
 	ntf.rf_protocol = *data++;
-	ntf.rf_tech_and_mode = *data++;
+	ntf.activation_rf_tech_and_mode = *data++;
 	ntf.rf_tech_specific_params_len = *data++;
 
-	nfc_dbg("target_handle %d, rf_protocol 0x%x, rf_tech_and_mode 0x%x, rf_tech_specific_params_len %d",
-		ntf.target_handle,
-		ntf.rf_protocol,
-		ntf.rf_tech_and_mode,
+	nfc_dbg("rf_discovery_id %d", ntf.rf_discovery_id);
+	nfc_dbg("rf_interface_type 0x%x", ntf.rf_interface_type);
+	nfc_dbg("rf_protocol 0x%x", ntf.rf_protocol);
+	nfc_dbg("activation_rf_tech_and_mode 0x%x",
+		ntf.activation_rf_tech_and_mode);
+	nfc_dbg("rf_tech_specific_params_len %d",
 		ntf.rf_tech_specific_params_len);
 
-	switch (ntf.rf_tech_and_mode) {
-	case NCI_NFC_A_PASSIVE_POLL_MODE:
-		rc = nci_rf_activate_nfca_passive_poll(ndev, &ntf,
-			data);
-		break;
+	if (ntf.rf_tech_specific_params_len > 0) {
+		switch (ntf.activation_rf_tech_and_mode) {
+		case NCI_NFC_A_PASSIVE_POLL_MODE:
+			data = nci_extract_rf_params_nfca_passive_poll(ndev,
+				&ntf, data);
+			break;
+
+		default:
+			nfc_err("unsupported activation_rf_tech_and_mode 0x%x",
+				ntf.activation_rf_tech_and_mode);
+			return;
+		}
+	}
 
-	default:
-		nfc_err("unsupported rf_tech_and_mode 0x%x",
-			ntf.rf_tech_and_mode);
-		return;
+	ntf.data_exch_rf_tech_and_mode = *data++;
+	ntf.data_exch_tx_bit_rate = *data++;
+	ntf.data_exch_rx_bit_rate = *data++;
+	ntf.activation_params_len = *data++;
+
+	nfc_dbg("data_exch_rf_tech_and_mode 0x%x",
+		ntf.data_exch_rf_tech_and_mode);
+	nfc_dbg("data_exch_tx_bit_rate 0x%x",
+		ntf.data_exch_tx_bit_rate);
+	nfc_dbg("data_exch_rx_bit_rate 0x%x",
+		ntf.data_exch_rx_bit_rate);
+	nfc_dbg("activation_params_len %d",
+		ntf.activation_params_len);
+
+	if (ntf.activation_params_len > 0) {
+		switch (ntf.rf_interface_type) {
+		case NCI_RF_INTERFACE_ISO_DEP:
+			err = nci_extract_activation_params_iso_dep(ndev,
+				&ntf, data);
+			break;
+
+		case NCI_RF_INTERFACE_FRAME:
+			/* no activation params */
+			break;
+
+		default:
+			nfc_err("unsupported rf_interface_type 0x%x",
+				ntf.rf_interface_type);
+			return;
+		}
 	}
 
-	if (!rc)
+	if (!err)
 		nci_target_found(ndev, &ntf);
 }
 
 static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev,
 					struct sk_buff *skb)
 {
-	__u8 type = skb->data[0];
+	struct nci_rf_deactivate_ntf *ntf = (void *) skb->data;
 
-	nfc_dbg("entry, type 0x%x", type);
+	nfc_dbg("entry, type 0x%x, reason 0x%x", ntf->type, ntf->reason);
 
 	clear_bit(NCI_POLL_ACTIVE, &ndev->flags);
 	ndev->target_active_prot = 0;
@@ -241,8 +278,8 @@ void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
 		nci_rf_field_info_ntf_packet(ndev, skb);
 		break;
 
-	case NCI_OP_RF_ACTIVATE_NTF:
-		nci_rf_activate_ntf_packet(ndev, skb);
+	case NCI_OP_RF_INTF_ACTIVATED_NTF:
+		nci_rf_intf_activated_ntf_packet(ndev, skb);
 		break;
 
 	case NCI_OP_RF_DEACTIVATE_NTF:
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index 0403d4c..64fc58a 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -42,10 +42,11 @@ static void nci_core_reset_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
 
 	nfc_dbg("entry, status 0x%x", rsp->status);
 
-	if (rsp->status == NCI_STATUS_OK)
+	if (rsp->status == NCI_STATUS_OK) {
 		ndev->nci_ver = rsp->nci_ver;
-
-	nfc_dbg("nci_ver 0x%x", ndev->nci_ver);
+		nfc_dbg("nci_ver 0x%x, config_status 0x%x",
+			rsp->nci_ver, rsp->config_status);
+	}
 
 	nci_req_complete(ndev, rsp->status);
 }
@@ -58,13 +59,13 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
 	nfc_dbg("entry, status 0x%x", rsp_1->status);
 
 	if (rsp_1->status != NCI_STATUS_OK)
-		return;
+		goto exit;
 
 	ndev->nfcc_features = __le32_to_cpu(rsp_1->nfcc_features);
 	ndev->num_supported_rf_interfaces = rsp_1->num_supported_rf_interfaces;
 
 	if (ndev->num_supported_rf_interfaces >
-		NCI_MAX_SUPPORTED_RF_INTERFACES) {
+			NCI_MAX_SUPPORTED_RF_INTERFACES) {
 		ndev->num_supported_rf_interfaces =
 			NCI_MAX_SUPPORTED_RF_INTERFACES;
 	}
@@ -73,20 +74,26 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
 		rsp_1->supported_rf_interfaces,
 		ndev->num_supported_rf_interfaces);
 
-	rsp_2 = (void *) (skb->data + 6 + ndev->num_supported_rf_interfaces);
+	rsp_2 = (void *) (skb->data + 6 + rsp_1->num_supported_rf_interfaces);
 
 	ndev->max_logical_connections =
 		rsp_2->max_logical_connections;
 	ndev->max_routing_table_size =
 		__le16_to_cpu(rsp_2->max_routing_table_size);
-	ndev->max_control_packet_payload_length =
-		rsp_2->max_control_packet_payload_length;
-	ndev->rf_sending_buffer_size =
-		__le16_to_cpu(rsp_2->rf_sending_buffer_size);
-	ndev->rf_receiving_buffer_size =
-		__le16_to_cpu(rsp_2->rf_receiving_buffer_size);
-	ndev->manufacturer_id =
-		__le16_to_cpu(rsp_2->manufacturer_id);
+	ndev->max_ctrl_pkt_payload_len =
+		rsp_2->max_ctrl_pkt_payload_len;
+	ndev->max_size_for_large_params =
+		__le16_to_cpu(rsp_2->max_size_for_large_params);
+	ndev->max_data_pkt_payload_size =
+		rsp_2->max_data_pkt_payload_size;
+	ndev->initial_num_credits =
+		rsp_2->initial_num_credits;
+	ndev->manufact_id =
+		rsp_2->manufact_id;
+	ndev->manufact_specific_info =
+		__le32_to_cpu(rsp_2->manufact_specific_info);
+
+	atomic_set(&ndev->credits_cnt, ndev->initial_num_credits);
 
 	nfc_dbg("nfcc_features 0x%x",
 		ndev->nfcc_features);
@@ -104,15 +111,20 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
 		ndev->max_logical_connections);
 	nfc_dbg("max_routing_table_size %d",
 		ndev->max_routing_table_size);
-	nfc_dbg("max_control_packet_payload_length %d",
-		ndev->max_control_packet_payload_length);
-	nfc_dbg("rf_sending_buffer_size %d",
-		ndev->rf_sending_buffer_size);
-	nfc_dbg("rf_receiving_buffer_size %d",
-		ndev->rf_receiving_buffer_size);
-	nfc_dbg("manufacturer_id 0x%x",
-		ndev->manufacturer_id);
-
+	nfc_dbg("max_ctrl_pkt_payload_len %d",
+		ndev->max_ctrl_pkt_payload_len);
+	nfc_dbg("max_size_for_large_params %d",
+		ndev->max_size_for_large_params);
+	nfc_dbg("max_data_pkt_payload_size %d",
+		ndev->max_data_pkt_payload_size);
+	nfc_dbg("initial_num_credits %d",
+		ndev->initial_num_credits);
+	nfc_dbg("manufact_id 0x%x",
+		ndev->manufact_id);
+	nfc_dbg("manufact_specific_info 0x%x",
+		ndev->manufact_specific_info);
+
+exit:
 	nci_req_complete(ndev, rsp_1->status);
 }
 
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH v4 2/3] NFC: Removal of unused operations for NCI spec 1.0 d18
From: ilanelias78 @ 2011-11-09 10:09 UTC (permalink / raw)
  To: aloisio.almeida, lauro.venancio, samuel, linville
  Cc: linux-wireless, Ilan Elias
In-Reply-To: <1320833356-19132-1-git-send-email-ilane@ti.com>

From: Ilan Elias <ilane@ti.com>

Remove unused NCI operations, e.g. create static rf connection.

Signed-off-by: Ilan Elias <ilane@ti.com>
---
 include/net/nfc/nci.h      |   27 ---------------------------
 include/net/nfc/nci_core.h |    4 ----
 net/nfc/nci/core.c         |    6 ------
 net/nfc/nci/ntf.c          |   15 +++------------
 net/nfc/nci/rsp.c          |   25 -------------------------
 5 files changed, 3 insertions(+), 74 deletions(-)

diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 0ebf842..0b34fde 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -193,16 +193,6 @@ struct nci_core_reset_cmd {
 
 #define NCI_OP_CORE_INIT_CMD		nci_opcode_pack(NCI_GID_CORE, 0x01)
 
-#define NCI_OP_CORE_SET_CONFIG_CMD	nci_opcode_pack(NCI_GID_CORE, 0x02)
-
-#define NCI_OP_CORE_CONN_CREATE_CMD	nci_opcode_pack(NCI_GID_CORE, 0x04)
-struct nci_core_conn_create_cmd {
-	__u8	target_handle;
-	__u8	num_target_specific_params;
-} __packed;
-
-#define NCI_OP_CORE_CONN_CLOSE_CMD	nci_opcode_pack(NCI_GID_CORE, 0x06)
-
 #define NCI_OP_RF_DISCOVER_MAP_CMD	nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
 struct disc_map_config {
 	__u8	rf_protocol;
@@ -262,18 +252,6 @@ struct nci_core_init_rsp_2 {
 	__le32	manufact_specific_info;
 } __packed;
 
-#define NCI_OP_CORE_SET_CONFIG_RSP	nci_opcode_pack(NCI_GID_CORE, 0x02)
-
-#define NCI_OP_CORE_CONN_CREATE_RSP	nci_opcode_pack(NCI_GID_CORE, 0x04)
-struct nci_core_conn_create_rsp {
-	__u8	status;
-	__u8	max_pkt_payload_size;
-	__u8	initial_num_credits;
-	__u8	conn_id;
-} __packed;
-
-#define NCI_OP_CORE_CONN_CLOSE_RSP	nci_opcode_pack(NCI_GID_CORE, 0x06)
-
 #define NCI_OP_RF_DISCOVER_MAP_RSP	nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
 
 #define NCI_OP_RF_DISCOVER_RSP		nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
@@ -294,11 +272,6 @@ struct nci_core_conn_credit_ntf {
 	struct conn_credit_entry	conn_entries[NCI_MAX_NUM_CONN];
 } __packed;
 
-#define NCI_OP_RF_FIELD_INFO_NTF	nci_opcode_pack(NCI_GID_CORE, 0x08)
-struct nci_rf_field_info_ntf {
-	__u8	rf_field_status;
-} __packed;
-
 #define NCI_OP_RF_INTF_ACTIVATED_NTF	nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
 struct rf_tech_specific_params_nfca_poll {
 	__u16	sens_res;
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 6e6a7be..c92b69d 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -116,10 +116,6 @@ struct nci_dev {
 	__u8			manufact_id;
 	__u32			manufact_specific_info;
 
-	/* received during NCI_OP_CORE_CONN_CREATE_RSP for static conn 0 */
-	__u8			max_pkt_payload_size;
-	__u8			conn_id;
-
 	/* stored during nci_data_exchange */
 	data_exchange_cb_t	data_exchange_cb;
 	void			*data_exchange_cb_context;
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 4b6ae5d..803f6d1 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -139,17 +139,11 @@ static void nci_init_req(struct nci_dev *ndev, unsigned long opt)
 
 static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt)
 {
-	struct nci_core_conn_create_cmd conn_cmd;
 	struct nci_rf_disc_map_cmd cmd;
 	struct disc_map_config *cfg = cmd.mapping_configs;
 	__u8 *num = &cmd.num_mapping_configs;
 	int i;
 
-	/* create static rf connection */
-	conn_cmd.target_handle = 0;
-	conn_cmd.num_target_specific_params = 0;
-	nci_send_cmd(ndev, NCI_OP_CORE_CONN_CREATE_CMD, 2, &conn_cmd);
-
 	/* set rf mapping configurations */
 	*num = 0;
 
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index 6789f48..c1bf541 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -66,14 +66,6 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev,
 		queue_work(ndev->tx_wq, &ndev->tx_work);
 }
 
-static void nci_rf_field_info_ntf_packet(struct nci_dev *ndev,
-					struct sk_buff *skb)
-{
-	struct nci_rf_field_info_ntf *ntf = (void *) skb->data;
-
-	nfc_dbg("entry, rf_field_status %d", ntf->rf_field_status);
-}
-
 static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
 			struct nci_rf_intf_activated_ntf *ntf, __u8 *data)
 {
@@ -251,6 +243,9 @@ static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev,
 		ndev->rx_data_reassembly = 0;
 	}
 
+	/* set the available credits to initial value */
+	atomic_set(&ndev->credits_cnt, ndev->initial_num_credits);
+
 	/* complete the data exchange transaction, if exists */
 	if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags))
 		nci_data_exchange_complete(ndev, NULL, -EIO);
@@ -274,10 +269,6 @@ void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
 		nci_core_conn_credits_ntf_packet(ndev, skb);
 		break;
 
-	case NCI_OP_RF_FIELD_INFO_NTF:
-		nci_rf_field_info_ntf_packet(ndev, skb);
-		break;
-
 	case NCI_OP_RF_INTF_ACTIVATED_NTF:
 		nci_rf_intf_activated_ntf_packet(ndev, skb);
 		break;
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index 64fc58a..0591f5a 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -128,27 +128,6 @@ exit:
 	nci_req_complete(ndev, rsp_1->status);
 }
 
-static void nci_core_conn_create_rsp_packet(struct nci_dev *ndev,
-						struct sk_buff *skb)
-{
-	struct nci_core_conn_create_rsp *rsp = (void *) skb->data;
-
-	nfc_dbg("entry, status 0x%x", rsp->status);
-
-	if (rsp->status != NCI_STATUS_OK)
-		return;
-
-	ndev->max_pkt_payload_size = rsp->max_pkt_payload_size;
-	ndev->initial_num_credits = rsp->initial_num_credits;
-	ndev->conn_id = rsp->conn_id;
-
-	atomic_set(&ndev->credits_cnt, ndev->initial_num_credits);
-
-	nfc_dbg("max_pkt_payload_size %d", ndev->max_pkt_payload_size);
-	nfc_dbg("initial_num_credits %d", ndev->initial_num_credits);
-	nfc_dbg("conn_id %d", ndev->conn_id);
-}
-
 static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev,
 					struct sk_buff *skb)
 {
@@ -208,10 +187,6 @@ void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
 		nci_core_init_rsp_packet(ndev, skb);
 		break;
 
-	case NCI_OP_CORE_CONN_CREATE_RSP:
-		nci_core_conn_create_rsp_packet(ndev, skb);
-		break;
-
 	case NCI_OP_RF_DISCOVER_MAP_RSP:
 		nci_rf_disc_map_rsp_packet(ndev, skb);
 		break;
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH v4 3/3] NFC: Check if NCI data flow control is used
From: ilanelias78 @ 2011-11-09 10:09 UTC (permalink / raw)
  To: aloisio.almeida, lauro.venancio, samuel, linville
  Cc: linux-wireless, Ilan Elias
In-Reply-To: <1320833356-19132-1-git-send-email-ilane@ti.com>

From: Ilan Elias <ilane@ti.com>

Check if NCI data flow control is used in nci_tx_work.

Signed-off-by: Ilan Elias <ilane@ti.com>
---
 include/net/nfc/nci.h |    3 +++
 net/nfc/nci/core.c    |    5 ++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 0b34fde..cdbe671 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -108,6 +108,9 @@
 /* NCI Static RF connection ID */
 #define NCI_STATIC_RF_CONN_ID					0x00
 
+/* NCI Data Flow Control */
+#define NCI_DATA_FLOW_CONTROL_NOT_USED				0xff
+
 /* NCI RF_DISCOVER_MAP_CMD modes */
 #define NCI_DISC_MAP_MODE_POLL					0x01
 #define NCI_DISC_MAP_MODE_LISTEN				0x02
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 803f6d1..fe5ca89 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -723,7 +723,10 @@ static void nci_tx_work(struct work_struct *work)
 		if (!skb)
 			return;
 
-		atomic_dec(&ndev->credits_cnt);
+		/* Check if data flow control is used */
+		if (atomic_read(&ndev->credits_cnt) !=
+				NCI_DATA_FLOW_CONTROL_NOT_USED)
+			atomic_dec(&ndev->credits_cnt);
 
 		nfc_dbg("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d",
 				nci_pbf(skb->data),
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH v4 0/3] NFC: update to NCI spec 1.0 draft 18
From: ilanelias78 @ 2011-11-09 10:09 UTC (permalink / raw)
  To: aloisio.almeida, lauro.venancio, samuel, linville
  Cc: linux-wireless, Ilan Elias

From: Ilan Elias <ilane@ti.com>

v1->2: added detailed commit log.
v2->3: split the patch into a set of 3 patches.
v3->4: remove indentation changes and use a define instead of 0xff.

This series of patches update the supported features according to 
NCI spec 1.0 draft 18. No new features were introduced.
The changes are related only to the NCI protocol layer.

Summary of the main changes:
- Addition, deletion, and modification of NCI constants
- Changes in NCI commands, responses and notifications structures
- Check if data flow control is used in nci_tx_work
- No need to create the static rf connection anymore
- Set available credits to initial value when target is deactivated

Ilan Elias (3):
  NFC: Update names and structs to NCI spec 1.0 d18
  NFC: Removal of unused operations for NCI spec 1.0 d18
  NFC: Check if NCI data flow control is used

 include/net/nfc/nci.h      |  109 +++++++++++++++++---------------
 include/net/nfc/nci_core.h |   13 ++--
 net/nfc/nci/core.c         |   18 +++---
 net/nfc/nci/data.c         |    5 +-
 net/nfc/nci/lib.c          |    8 +--
 net/nfc/nci/ntf.c          |  152 ++++++++++++++++++++++++++------------------
 net/nfc/nci/rsp.c          |   83 ++++++++++--------------
 7 files changed, 201 insertions(+), 187 deletions(-)


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox