2009-04-14 18:10:12

by Gábor Stefanik

[permalink] [raw]
Subject: [PATCH] rtl8187: Disable TX retries if IEEE80211_TX_CTL_NO_ACK is set

Currently we always wait for an ACK even if IEEE80211_TX_CTL_NO_ACK is
set, and retry if no ACK is received. This means that if a multicast
packet is transmitted, it will always be retransmitted until the
excessive retries limit is reached, which AFAIK is against the IEEE
802.11 specification. Fix this by setting the retry limit to 0 if
IEEE80211_TX_CTL_NO_ACK is set.
This is also required for proper implementation of the proposed TX
Flags Radiotap field, specifically the No-ACK flag, which allows
userspace to transmit arbitrary packets without retrying or waiting
for an ACK.

Signed-off-by: G?bor Stefanik <[email protected]>
---
Patch is also available as an attachment if Gmail linewraps it.

rtl8187_dev.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c
b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index fd81884..ec80e0b 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -258,7 +258,10 @@ static int rtl8187_tx(struct ieee80211_hw *dev,
struct sk_buff *skb)
hdr->flags = cpu_to_le32(flags);
hdr->len = 0;
hdr->rts_duration = rts_dur;
- hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
+ if (!info->flags & IEEE80211_TX_CTL_NO_ACK))
+ hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
+ else
+ hdr->retry = 0;
buf = hdr;

ep = 2;
@@ -276,7 +279,10 @@ static int rtl8187_tx(struct ieee80211_hw *dev,
struct sk_buff *skb)
memset(hdr, 0, sizeof(*hdr));
hdr->flags = cpu_to_le32(flags);
hdr->rts_duration = rts_dur;
- hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
+ if (!info->flags & IEEE80211_TX_CTL_NO_ACK))
+ hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
+ else
+ hdr->retry = 0;
hdr->tx_duration =
ieee80211_generic_frame_duration(dev, priv->vif,
skb->len, txrate);


Attachments:
rtl8187-honor-no-ack.patch (1.21 kB)

2009-04-14 18:28:17

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH] rtl8187: Disable TX retries if IEEE80211_TX_CTL_NO_ACK is set

2009/4/14 Johannes Berg <[email protected]>:
> On Tue, 2009-04-14 at 20:09 +0200, G=E1bor Stefanik wrote:
>
>> + =A0 =A0 =A0 =A0 =A0 =A0 if (!info->flags & IEEE80211_TX_CTL_NO_ACK=
))
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 hdr->retry =3D cpu_to_le32=
((info->control.rates[0].count - 1) << 8);
>> + =A0 =A0 =A0 =A0 =A0 =A0 else
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 hdr->retry =3D 0;
>
> Umm. You obviously didn't even _COMPILE_ that patch. Let alone test i=
t
> properly.
>
> johannes
>

Oops... yes, it ways a straight rewrite of my old patch for
2.6.28-rc6-wl, and I apparently got the rewrite wrong.

--=20
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

2009-04-14 18:25:44

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] rtl8187: Disable TX retries if IEEE80211_TX_CTL_NO_ACK is set

On Tue, 2009-04-14 at 20:23 +0200, Johannes Berg wrote:
> On Tue, 2009-04-14 at 20:09 +0200, Gábor Stefanik wrote:
>
> > + if (!info->flags & IEEE80211_TX_CTL_NO_ACK))
> > + hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
> > + else
> > + hdr->retry = 0;
>
> Umm. You obviously didn't even _COMPILE_ that patch. Let alone test it
> properly.

Besides, it seems it would be a mac80211 bug to give the driver retry
information for a no-ack frame.

johannes


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2009-04-14 18:34:30

by Hin-Tak Leung

[permalink] [raw]
Subject: Re: [PATCH] rtl8187: Disable TX retries if IEEE80211_TX_CTL_NO_ACK is set


--- On Tue, 14/4/09, Johannes Berg <[email protected]> wrote:

> On Tue, 2009-04-14 at 20:09 +0200,
> G=E1bor Stefanik wrote:
>=20
> > + if (!info->flags & IEEE80211_TX_CTL_NO_ACK))
> > + hdr->retry =3D cpu_to_le32((info->control.rates[0].cou=
nt - 1) << 8);
> > + else
> > + hdr->retry =3D 0;
>=20
> Umm. You obviously didn't even _COMPILE_ that patch. Let
> alone test it
> properly.

Yeah, very naughty... patches should at a minimum satisfy the eat-you-o=
ld-dog-food criteria, i.e. work on your own computer and do nothing bad=
there...



=20

2009-04-14 18:24:19

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] rtl8187: Disable TX retries if IEEE80211_TX_CTL_NO_ACK is set

On Tue, 2009-04-14 at 20:09 +0200, Gábor Stefanik wrote:

> + if (!info->flags & IEEE80211_TX_CTL_NO_ACK))
> + hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
> + else
> + hdr->retry = 0;

Umm. You obviously didn't even _COMPILE_ that patch. Let alone test it
properly.

johannes


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part