* [PATCH 0/3] d80211: AP mode fixes
@ 2006-06-23 18:16 Jiri Benc
2006-06-23 18:16 ` [PATCH 1/3] d80211: do not receive through master interface Jiri Benc
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Jiri Benc @ 2006-06-23 18:16 UTC (permalink / raw)
To: netdev; +Cc: John W. Linville, Michael Buesch, Alexander Tsvyashchenko
This a series of experimental AP mode fixes.
It is also available (together with patches for bcm43xx AP mode support) in
a 'devel' branch of my dscape tree at:
git://git.kernel.org/pub/scm/linux/kernel/git/jbenc/dscape.git devel
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] d80211: do not receive through master interface
2006-06-23 18:16 [PATCH 0/3] d80211: AP mode fixes Jiri Benc
@ 2006-06-23 18:16 ` Jiri Benc
2006-06-24 11:50 ` [PATCH 1/3] d80211: experimental: do not receive through master interface when not scanning Jiri Benc
2006-06-23 18:16 ` [PATCH 2/3] d80211: host_gen_beacon_template flag Jiri Benc
2006-06-23 18:16 ` [PATCH 3/3] bcm43xx-d80211: use host_gen_beacon_template Jiri Benc
2 siblings, 1 reply; 7+ messages in thread
From: Jiri Benc @ 2006-06-23 18:16 UTC (permalink / raw)
To: netdev; +Cc: John W. Linville, Michael Buesch, Alexander Tsvyashchenko
Arrived packets should not go into master interface - it leads to duplicate
packets reception.
Signed-off-by: Jiri Benc <jbenc@suse.cz>
---
net/d80211/ieee80211.c | 4 ++++
1 files changed, 4 insertions(+)
--- dscape.orig/net/d80211/ieee80211.c
+++ dscape/net/d80211/ieee80211.c
@@ -3586,6 +3586,10 @@ void __ieee80211_rx(struct net_device *d
!ieee80211_bssid_match(bssid,
sdata->dev->dev_addr))
continue;
+ if (sdata->dev == sdata->master)
+ /* do not receive anything via
+ * master device */
+ continue;
break;
case IEEE80211_IF_TYPE_WDS:
if (bssid ||
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] d80211: host_gen_beacon_template flag
2006-06-23 18:16 [PATCH 0/3] d80211: AP mode fixes Jiri Benc
2006-06-23 18:16 ` [PATCH 1/3] d80211: do not receive through master interface Jiri Benc
@ 2006-06-23 18:16 ` Jiri Benc
2006-06-23 18:16 ` [PATCH 3/3] bcm43xx-d80211: use host_gen_beacon_template Jiri Benc
2 siblings, 0 replies; 7+ messages in thread
From: Jiri Benc @ 2006-06-23 18:16 UTC (permalink / raw)
To: netdev; +Cc: John W. Linville, Michael Buesch, Alexander Tsvyashchenko
This is a partial support for devices requiring beacon template. Please note
that there is no support for PS mode for such cards yet.
Signed-off-by: Jiri Benc <jbenc@suse.cz>
---
include/net/d80211.h | 6 ++++++
net/d80211/ieee80211.c | 22 +++++++++++++++++++++-
net/d80211/ieee80211_i.h | 1 +
net/d80211/ieee80211_ioctl.c | 2 +-
4 files changed, 29 insertions(+), 2 deletions(-)
--- dscape.orig/include/net/d80211.h
+++ dscape/include/net/d80211.h
@@ -349,6 +349,9 @@ struct ieee80211_if_init_conf {
* only during config_interface() callback (so copy the value somewhere
* if you need it).
* @generic_elem_len: length of the generic element.
+ * @beacon: beacon template. Valid only if @host_gen_beacon_template in
+ * &struct ieee80211_hw is set. The driver is responsible of freeing
+ * the sk_buff.
*
* This structure is passed to config_interface() callback of
* &struct ieee80211_hw.
@@ -360,6 +363,7 @@ struct ieee80211_if_conf {
size_t ssid_len;
u8 *generic_elem;
size_t generic_elem_len;
+ struct sk_buff *beacon;
};
typedef enum { ALG_NONE, ALG_WEP, ALG_TKIP, ALG_CCMP, ALG_NULL }
@@ -439,6 +443,8 @@ struct ieee80211_hw {
* beacon frame. */
int host_gen_beacon:1;
+ /* The device needs to be supplied with a beacon template only. */
+ int host_gen_beacon_template:1;
/* Some devices handle decryption internally and do not
* indicate whether the frame was encrypted (unencrypted frames
--- dscape.orig/net/d80211/ieee80211.c
+++ dscape/net/d80211/ieee80211.c
@@ -1902,7 +1902,8 @@ ieee80211_get_buffered_bc(struct net_dev
return skb;
}
-int ieee80211_if_config(struct net_device *dev)
+static int __ieee80211_if_config(struct net_device *dev,
+ struct sk_buff *beacon)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = dev->ieee80211_ptr;
@@ -1925,10 +1926,29 @@ int ieee80211_if_config(struct net_devic
conf.ssid_len = sdata->u.ap.ssid_len;
conf.generic_elem = sdata->u.ap.generic_elem;
conf.generic_elem_len = sdata->u.ap.generic_elem_len;
+ conf.beacon = beacon;
}
return local->hw->config_interface(local->mdev, dev->ifindex, &conf);
}
+int ieee80211_if_config(struct net_device *dev)
+{
+ return __ieee80211_if_config(dev, NULL);
+}
+
+int ieee80211_if_config_beacon(struct net_device *dev)
+{
+ struct ieee80211_local *local = dev->ieee80211_ptr;
+ struct sk_buff *skb;
+
+ if (!local->hw->host_gen_beacon_template)
+ return 0;
+ skb = ieee80211_beacon_get(local->mdev, dev->ifindex, NULL);
+ if (!skb)
+ return -ENOMEM;
+ return __ieee80211_if_config(dev, skb);
+}
+
int ieee80211_hw_config(struct net_device *dev)
{
struct ieee80211_local *local = dev->ieee80211_ptr;
--- dscape.orig/net/d80211/ieee80211_i.h
+++ dscape/net/d80211/ieee80211_i.h
@@ -545,6 +545,7 @@ struct sta_attribute {
void ieee80211_release_hw(struct ieee80211_local *local);
int ieee80211_hw_config(struct net_device *dev);
int ieee80211_if_config(struct net_device *dev);
+int ieee80211_if_config_beacon(struct net_device *dev);
struct ieee80211_key_conf *
ieee80211_key_data2conf(struct ieee80211_local *local,
struct ieee80211_key *data);
--- dscape.orig/net/d80211/ieee80211_ioctl.c
+++ dscape/net/d80211/ieee80211_ioctl.c
@@ -110,7 +110,7 @@ static int ieee80211_ioctl_set_beacon(st
}
}
- return 0;
+ return ieee80211_if_config_beacon(dev);
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] bcm43xx-d80211: use host_gen_beacon_template
2006-06-23 18:16 [PATCH 0/3] d80211: AP mode fixes Jiri Benc
2006-06-23 18:16 ` [PATCH 1/3] d80211: do not receive through master interface Jiri Benc
2006-06-23 18:16 ` [PATCH 2/3] d80211: host_gen_beacon_template flag Jiri Benc
@ 2006-06-23 18:16 ` Jiri Benc
2006-06-23 21:12 ` Michael Buesch
2 siblings, 1 reply; 7+ messages in thread
From: Jiri Benc @ 2006-06-23 18:16 UTC (permalink / raw)
To: netdev; +Cc: John W. Linville, Michael Buesch, Alexander Tsvyashchenko
Use new host_gen_beacon_template flag. This also means workaround with
"iwconfig essid" after hostapd is run is not necessary anymore.
Signed-off-by: Jiri Benc <jbenc@suse.cz>
---
drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c | 36 ++++++---------------
1 files changed, 11 insertions(+), 25 deletions(-)
--- dscape.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
+++ dscape/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
@@ -1710,17 +1710,12 @@ static void bcm43xx_write_probe_resp_tem
kfree(probe_resp_data);
}
-static int bcm43xx_refresh_cached_beacon(struct bcm43xx_private *bcm)
+static int bcm43xx_refresh_cached_beacon(struct bcm43xx_private *bcm,
+ struct sk_buff *beacon)
{
- struct ieee80211_tx_control control;
-
if (bcm->cached_beacon)
kfree_skb(bcm->cached_beacon);
- bcm->cached_beacon = ieee80211_beacon_get(bcm->net_dev,
- bcm->interface.if_id,
- &control);
- if (unlikely(!bcm->cached_beacon))
- return -ENOMEM;
+ bcm->cached_beacon = beacon;
return 0;
}
@@ -1743,16 +1738,15 @@ static void bcm43xx_update_templates(str
bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD, status);
}
-static void bcm43xx_refresh_templates(struct bcm43xx_private *bcm)
+static void bcm43xx_refresh_templates(struct bcm43xx_private *bcm,
+ struct sk_buff *beacon)
{
int err;
- err = bcm43xx_refresh_cached_beacon(bcm);
+ err = bcm43xx_refresh_cached_beacon(bcm, beacon);
if (unlikely(err))
return;
bcm43xx_update_templates(bcm);
- kfree_skb(bcm->cached_beacon);
- bcm->cached_beacon = NULL;
}
static void bcm43xx_set_ssid(struct bcm43xx_private *bcm,
@@ -1792,19 +1786,11 @@ static void bcm43xx_set_beacon_int(struc
static void handle_irq_beacon(struct bcm43xx_private *bcm)
{
u32 status;
- int err;
bcm->irq_savedstate &= ~BCM43xx_IRQ_BEACON;
status = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD);
- if (!bcm->cached_beacon) {
- err = bcm43xx_refresh_cached_beacon(bcm);
- if (unlikely(err))
- goto ack;
- }
-
- if ((status & 0x1) && (status & 0x2)) {
-ack:
+ if (!bcm->cached_beacon || ((status & 0x1) && (status & 0x2))) {
/* ACK beacon IRQ. */
bcm43xx_write32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON,
BCM43xx_IRQ_BEACON);
@@ -4382,7 +4368,6 @@ static int bcm43xx_net_config(struct net
if (bcm43xx_is_mode(bcm, IEEE80211_IF_TYPE_AP)) {
bcm43xx_set_beacon_int(bcm, conf->beacon_int);
- bcm43xx_refresh_templates(bcm);
}
bcm43xx_unlock_irqonly(bcm, flags);
@@ -4553,7 +4538,7 @@ static int bcm43xx_add_interface(struct
if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) {
bcm43xx_select_opmode(bcm);
if (bcm43xx_is_mode(bcm, IEEE80211_IF_TYPE_AP))
- bcm43xx_refresh_templates(bcm);
+ bcm43xx_refresh_templates(bcm, NULL);
}
err = 0;
@@ -4606,7 +4591,8 @@ static int bcm43xx_config_interface(stru
if (bcm43xx_is_mode(bcm, IEEE80211_IF_TYPE_AP)) {
assert(conf->type == IEEE80211_IF_TYPE_AP);
bcm43xx_set_ssid(bcm, conf->ssid, conf->ssid_len);
- bcm43xx_refresh_templates(bcm);
+ if (conf->beacon)
+ bcm43xx_refresh_templates(bcm, conf->beacon);
}
}
bcm43xx_unlock_irqsafe(bcm, flags);
@@ -4701,7 +4687,7 @@ static int __devinit bcm43xx_init_one(st
goto out;
ieee->version = IEEE80211_VERSION;
ieee->name = KBUILD_MODNAME;
- ieee->host_gen_beacon = 1;
+ ieee->host_gen_beacon_template = 1;
ieee->rx_includes_fcs = 1;
ieee->monitor_during_oper = 1;
ieee->tx = bcm43xx_net_hard_start_xmit;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] bcm43xx-d80211: use host_gen_beacon_template
2006-06-23 18:16 ` [PATCH 3/3] bcm43xx-d80211: use host_gen_beacon_template Jiri Benc
@ 2006-06-23 21:12 ` Michael Buesch
2006-06-24 11:17 ` Jiri Benc
0 siblings, 1 reply; 7+ messages in thread
From: Michael Buesch @ 2006-06-23 21:12 UTC (permalink / raw)
To: Jiri Benc, John W. Linville; +Cc: netdev, Alexander Tsvyashchenko
On Friday 23 June 2006 20:16, Jiri Benc wrote:
> Use new host_gen_beacon_template flag. This also means workaround with
> "iwconfig essid" after hostapd is run is not necessary anymore.
>
> Signed-off-by: Jiri Benc <jbenc@suse.cz>
Signed-off-by: Michael Buesch <mb@bu3sch.de>
John, please apply.
> ---
>
> drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c | 36 ++++++---------------
> 1 files changed, 11 insertions(+), 25 deletions(-)
>
> --- dscape.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
> +++ dscape/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
> @@ -1710,17 +1710,12 @@ static void bcm43xx_write_probe_resp_tem
> kfree(probe_resp_data);
> }
>
> -static int bcm43xx_refresh_cached_beacon(struct bcm43xx_private *bcm)
> +static int bcm43xx_refresh_cached_beacon(struct bcm43xx_private *bcm,
> + struct sk_buff *beacon)
> {
> - struct ieee80211_tx_control control;
> -
> if (bcm->cached_beacon)
> kfree_skb(bcm->cached_beacon);
> - bcm->cached_beacon = ieee80211_beacon_get(bcm->net_dev,
> - bcm->interface.if_id,
> - &control);
> - if (unlikely(!bcm->cached_beacon))
> - return -ENOMEM;
> + bcm->cached_beacon = beacon;
>
> return 0;
> }
> @@ -1743,16 +1738,15 @@ static void bcm43xx_update_templates(str
> bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD, status);
> }
>
> -static void bcm43xx_refresh_templates(struct bcm43xx_private *bcm)
> +static void bcm43xx_refresh_templates(struct bcm43xx_private *bcm,
> + struct sk_buff *beacon)
> {
> int err;
>
> - err = bcm43xx_refresh_cached_beacon(bcm);
> + err = bcm43xx_refresh_cached_beacon(bcm, beacon);
> if (unlikely(err))
> return;
> bcm43xx_update_templates(bcm);
> - kfree_skb(bcm->cached_beacon);
> - bcm->cached_beacon = NULL;
> }
>
> static void bcm43xx_set_ssid(struct bcm43xx_private *bcm,
> @@ -1792,19 +1786,11 @@ static void bcm43xx_set_beacon_int(struc
> static void handle_irq_beacon(struct bcm43xx_private *bcm)
> {
> u32 status;
> - int err;
>
> bcm->irq_savedstate &= ~BCM43xx_IRQ_BEACON;
> status = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD);
>
> - if (!bcm->cached_beacon) {
> - err = bcm43xx_refresh_cached_beacon(bcm);
> - if (unlikely(err))
> - goto ack;
> - }
> -
> - if ((status & 0x1) && (status & 0x2)) {
> -ack:
> + if (!bcm->cached_beacon || ((status & 0x1) && (status & 0x2))) {
> /* ACK beacon IRQ. */
> bcm43xx_write32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON,
> BCM43xx_IRQ_BEACON);
> @@ -4382,7 +4368,6 @@ static int bcm43xx_net_config(struct net
>
> if (bcm43xx_is_mode(bcm, IEEE80211_IF_TYPE_AP)) {
> bcm43xx_set_beacon_int(bcm, conf->beacon_int);
> - bcm43xx_refresh_templates(bcm);
> }
>
> bcm43xx_unlock_irqonly(bcm, flags);
> @@ -4553,7 +4538,7 @@ static int bcm43xx_add_interface(struct
> if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) {
> bcm43xx_select_opmode(bcm);
> if (bcm43xx_is_mode(bcm, IEEE80211_IF_TYPE_AP))
> - bcm43xx_refresh_templates(bcm);
> + bcm43xx_refresh_templates(bcm, NULL);
> }
> err = 0;
>
> @@ -4606,7 +4591,8 @@ static int bcm43xx_config_interface(stru
> if (bcm43xx_is_mode(bcm, IEEE80211_IF_TYPE_AP)) {
> assert(conf->type == IEEE80211_IF_TYPE_AP);
> bcm43xx_set_ssid(bcm, conf->ssid, conf->ssid_len);
> - bcm43xx_refresh_templates(bcm);
> + if (conf->beacon)
> + bcm43xx_refresh_templates(bcm, conf->beacon);
> }
> }
> bcm43xx_unlock_irqsafe(bcm, flags);
> @@ -4701,7 +4687,7 @@ static int __devinit bcm43xx_init_one(st
> goto out;
> ieee->version = IEEE80211_VERSION;
> ieee->name = KBUILD_MODNAME;
> - ieee->host_gen_beacon = 1;
> + ieee->host_gen_beacon_template = 1;
> ieee->rx_includes_fcs = 1;
> ieee->monitor_during_oper = 1;
> ieee->tx = bcm43xx_net_hard_start_xmit;
>
--
Greetings Michael.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] bcm43xx-d80211: use host_gen_beacon_template
2006-06-23 21:12 ` Michael Buesch
@ 2006-06-24 11:17 ` Jiri Benc
0 siblings, 0 replies; 7+ messages in thread
From: Jiri Benc @ 2006-06-24 11:17 UTC (permalink / raw)
To: John W. Linville; +Cc: Michael Buesch, netdev, Alexander Tsvyashchenko
Fri, 23 Jun 2006 23:12:15 +0200, Michael Buesch wrote:
> John, please apply.
Please do not apply the whole series yet, it is experimental and not well
tested (I wrote it in the introduction e-mail but will ensure I put it also
in subjects next time).
For example, I just realized that the first patch breaks scanning in STA
mode.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] d80211: experimental: do not receive through master interface when not scanning
2006-06-23 18:16 ` [PATCH 1/3] d80211: do not receive through master interface Jiri Benc
@ 2006-06-24 11:50 ` Jiri Benc
0 siblings, 0 replies; 7+ messages in thread
From: Jiri Benc @ 2006-06-24 11:50 UTC (permalink / raw)
To: netdev; +Cc: John W. Linville, Michael Buesch, Alexander Tsvyashchenko
This is a corrected version of the patch. I also updated the 'devel' branch
of my tree.
---
Arrived packets should not go into master interface except when scanning
- it leads to duplicate packets reception. This also fixes a race when
scanning is finished during invoking of rx handlers.
Signed-off-by: Jiri Benc <jbenc@suse.cz>
---
net/d80211/ieee80211.c | 17 +++++++++++++++--
net/d80211/ieee80211_i.h | 1 +
2 files changed, 16 insertions(+), 2 deletions(-)
--- dscape.orig/net/d80211/ieee80211.c
+++ dscape/net/d80211/ieee80211.c
@@ -3348,6 +3348,12 @@ ieee80211_rx_h_passive_scan(struct ieee8
}
}
+ if (unlikely(rx->u.rx.in_scan)) {
+ /* scanning finished during invoking of handlers */
+ I802_DEBUG_INC(local->rx_handlers_drop_passive_scan);
+ return TXRX_DROP;
+ }
+
return TXRX_CONTINUE;
}
@@ -3539,6 +3545,9 @@ void __ieee80211_rx(struct net_device *d
goto end;
}
+ if (unlikely(local->sta_scanning || local->scan.in_scan))
+ rx.u.rx.in_scan = 1;
+
if (sta && !sta->assoc_ap && !(sta->flags & WLAN_STA_WDS) &&
!local->iff_promiscs && !multicast) {
rx.dev = sta->dev;
@@ -3581,11 +3590,15 @@ void __ieee80211_rx(struct net_device *d
if (memcmp(sdata->dev->dev_addr,
hdr->addr1, ETH_ALEN) != 0)
continue;
- } else if (!local->sta_scanning &&
- !local->scan.in_scan &&
+ } else if (!rx.u.rx.in_scan &&
!ieee80211_bssid_match(bssid,
sdata->dev->dev_addr))
continue;
+ if (sdata->dev == sdata->master &&
+ !rx.u.rx.in_scan)
+ /* do not receive anything via
+ * master device when not scanning */
+ continue;
break;
case IEEE80211_IF_TYPE_WDS:
if (bssid ||
--- dscape.orig/net/d80211/ieee80211_i.h
+++ dscape/net/d80211/ieee80211_i.h
@@ -137,6 +137,7 @@ struct ieee80211_txrx_data {
struct ieee80211_rx_status *status;
int sent_ps_buffered;
int queue;
+ int in_scan:1;
} rx;
} u;
#ifdef CONFIG_HOSTAPD_WPA_TESTING
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-06-24 11:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-23 18:16 [PATCH 0/3] d80211: AP mode fixes Jiri Benc
2006-06-23 18:16 ` [PATCH 1/3] d80211: do not receive through master interface Jiri Benc
2006-06-24 11:50 ` [PATCH 1/3] d80211: experimental: do not receive through master interface when not scanning Jiri Benc
2006-06-23 18:16 ` [PATCH 2/3] d80211: host_gen_beacon_template flag Jiri Benc
2006-06-23 18:16 ` [PATCH 3/3] bcm43xx-d80211: use host_gen_beacon_template Jiri Benc
2006-06-23 21:12 ` Michael Buesch
2006-06-24 11:17 ` Jiri Benc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).