From: Ivo van Doorn <ivdoorn@gmail.com>
To: Jiri Benc <jbenc@suse.cz>
Cc: "John Linville" <linville@tuxdriver.com>, netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] d80211: Add software sequence support
Date: Sat, 3 Feb 2007 12:45:26 +0100 [thread overview]
Message-ID: <200702031245.27035.IvDoorn@gmail.com> (raw)
In-Reply-To: <200701312016.52221.IvDoorn@gmail.com>
On Wednesday 31 January 2007 20:16, Ivo van Doorn wrote:
> Most hardware can keep track of sequence numbers themselves,
> unfortunately *most* doesn't cover all devices. ;)
> This patch will keep track of the sequence number if the flag
> IEEE80211_HW_SOFTWARE_SEQUENCE has been set.
>
> Signed-off-by Ivo van Doorn <IvDoorn@gmail.com>
Previous version had a small bug in it.
Signed-off-by Ivo van Doorn <IvDoorn@gmail.com>
---
diff -rNU3 dscape/include/net/d80211.h dscape_seq/include/net/d80211.h
--- dscape/include/net/d80211.h 2007-01-31 19:38:14.000000000 +0100
+++ dscape_seq/include/net/d80211.h 2007-01-31 19:55:55.000000000 +0100
@@ -534,6 +534,9 @@
/* Does the device need the stack to create a RTS frame */
#define IEEE80211_HW_SOFTWARE_RTS (1<<15)
+ /* Does the HOST need to insert the frame sequence counter */
+#define IEEE80211_HW_SOFTWARE_SEQUENCE (1<<16)
+
u32 flags; /* hardware flags defined above */
/* Set to the size of a needed device specific skb headroom for TX skbs. */
diff -rNU3 dscape/net/d80211/ieee80211.c dscape_seq/net/d80211/ieee80211.c
--- dscape/net/d80211/ieee80211.c 2007-01-31 19:41:18.000000000 +0100
+++ dscape_seq/net/d80211/ieee80211.c 2007-02-03 12:42:25.000000000 +0100
@@ -441,6 +441,7 @@
size_t hdrlen, per_fragm, num_fragm, payload_len, left;
struct sk_buff **frags, *first, *frag;
int i;
+ u16 seq;
u8 *pos;
int frag_threshold = tx->local->fragmentation_threshold;
@@ -458,6 +459,7 @@
if (!frags)
goto fail;
+ seq = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ;
hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREFRAGS);
pos = first->data + hdrlen + per_fragm;
left = payload_len - per_fragm;
@@ -486,7 +488,7 @@
memcpy(fhdr, first->data, hdrlen);
if (i == num_fragm - 2)
fhdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREFRAGS);
- fhdr->seq_ctrl = cpu_to_le16(i + 1);
+ fhdr->seq_ctrl = cpu_to_le16(seq + ((i + 1) & IEEE80211_SCTL_FRAG));
copylen = left > per_fragm ? per_fragm : left;
memcpy(skb_put(frag, copylen), pos, copylen);
@@ -933,6 +935,17 @@
return TXRX_CONTINUE;
}
+static ieee80211_txrx_result
+ieee80211_tx_h_sequence(struct ieee80211_txrx_data *tx)
+{
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
+
+ if ((tx->local->hw.flags & IEEE80211_HW_SOFTWARE_SEQUENCE) &&
+ ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control)) > 24)
+ ieee80211_include_sequence(tx->local, hdr);
+
+ return TXRX_CONTINUE;
+}
/* This function is called whenever the AP is about to exceed the maximum limit
* of buffered frames for power saving STAs. This situation should not really
@@ -1806,6 +1819,10 @@
memcpy(skb_put(skb, bh_len), b_head, bh_len);
+ if (hw->flags & IEEE80211_HW_SOFTWARE_SEQUENCE)
+ ieee80211_include_sequence(local,
+ (struct ieee80211_hdr *)skb->data);
+
ieee80211_beacon_add_tim(local, ap, skb);
if (b_tail) {
@@ -4323,6 +4340,7 @@
static ieee80211_tx_handler ieee80211_tx_handlers[] =
{
ieee80211_tx_h_check_assoc,
+ ieee80211_tx_h_sequence,
ieee80211_tx_h_ps_buf,
ieee80211_tx_h_select_key,
ieee80211_tx_h_michael_mic_add,
@@ -4497,6 +4515,7 @@
local->bridge_packets = 1;
+ local->seq_counter = 0;
local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
local->short_retry_limit = 7;
diff -rNU3 dscape/net/d80211/ieee80211_i.h dscape_seq/net/d80211/ieee80211_i.h
--- dscape/net/d80211/ieee80211_i.h 2007-01-31 19:41:53.000000000 +0100
+++ dscape_seq/net/d80211/ieee80211_i.h 2007-01-31 20:06:26.000000000 +0100
@@ -405,6 +405,7 @@
int *supp_rates[NUM_IEEE80211_MODES];
int *basic_rates[NUM_IEEE80211_MODES];
+ u16 seq_counter;
int rts_threshold;
int cts_protect_erp_frames;
int fragmentation_threshold;
@@ -601,6 +602,20 @@
spin_unlock_bh(&local->sta_lock);
}
+static inline void ieee80211_include_sequence(struct ieee80211_local *local,
+ struct ieee80211_hdr *hdr)
+{
+ /*
+ * Set the sequence number for this frame.
+ */
+ hdr->seq_ctrl = cpu_to_le16(local->seq_counter & IEEE80211_SCTL_SEQ);
+
+ /*
+ * Increase the sequence number.
+ */
+ local->seq_counter = (local->seq_counter + 0x10) & IEEE80211_SCTL_SEQ;
+}
+
/* ieee80211.c */
void ieee80211_release_hw(struct ieee80211_local *local);
int ieee80211_hw_config(struct ieee80211_local *local);
next prev parent reply other threads:[~2007-02-03 11:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-31 19:16 [PATCH 2/2] d80211: Add software sequence support Ivo van Doorn
2007-02-03 11:45 ` Ivo van Doorn [this message]
2007-02-05 17:37 ` Jiri Benc
2007-02-05 17:56 ` Ivo van Doorn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200702031245.27035.IvDoorn@gmail.com \
--to=ivdoorn@gmail.com \
--cc=jbenc@suse.cz \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.