From: Yogesh Ashok Powar <yogeshp@marvell.com>
To: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: "John W. Linville" <linville@tuxdriver.com>,
Bing Zhao <bzhao@marvell.com>
Subject: [PATCH 3/4] mwifiex: adding check for enough space before padding
Date: Mon, 6 Jun 2011 14:53:02 +0530 [thread overview]
Message-ID: <20110606092300.GC28199@hertz.marvell.com> (raw)
In-Reply-To: <20110606091615.GA28184@hertz.marvell.com>
All MSDUs, except the last one in an AMSDU, should end up at 4
bytes boundary. There is need to check if enough skb_tailroom
space exists before padding the skb.
Also re-arranging code for better readablity.
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
---
drivers/net/wireless/mwifiex/11n_aggr.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c
index aee3491..25312e4 100644
--- a/drivers/net/wireless/mwifiex/11n_aggr.c
+++ b/drivers/net/wireless/mwifiex/11n_aggr.c
@@ -185,16 +185,15 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
tx_info_aggr->bss_index = tx_info_src->bss_index;
skb_aggr->priority = skb_src->priority;
- while (skb_src && ((skb_headroom(skb_aggr) + skb_src->len
- + LLC_SNAP_LEN)
- <= adapter->tx_buf_size)) {
+ do {
+ /* Check if AMSDU can accommodate this MSDU */
+ if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN))
+ break;
skb_src = skb_dequeue(&pra_list->skb_head);
- if (skb_src) {
- pra_list->total_pkts_size -= skb_src->len;
- pra_list->total_pkts--;
- }
+ pra_list->total_pkts_size -= skb_src->len;
+ pra_list->total_pkts--;
atomic_dec(&priv->wmm.tx_pkts_queued);
@@ -212,8 +211,15 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
return -1;
}
+ if (skb_tailroom(skb_aggr) < pad) {
+ pad = 0;
+ break;
+ }
+ skb_put(skb_aggr, pad);
+
skb_src = skb_peek(&pra_list->skb_head);
- }
+
+ } while (skb_src);
spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags);
--
1.7.3.5
next prev parent reply other threads:[~2011-06-06 9:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 9:16 [PATCH 0/4] AMSDU TX optimization Yogesh Ashok Powar
2011-06-06 9:19 ` [PATCH 1/4] mwifiex: remove list traversal in mwifiex_num_pkts_in_txq Yogesh Ashok Powar
2011-06-06 9:20 ` [PATCH 2/4] mwifiex: Remove redundant skb_queue_empty checks Yogesh Ashok Powar
2011-06-06 9:23 ` Yogesh Ashok Powar [this message]
2011-06-06 9:24 ` [PATCH 4/4] mwifiex: disable transmission buffer aggregation for AMSDU packets Yogesh Ashok Powar
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=20110606092300.GC28199@hertz.marvell.com \
--to=yogeshp@marvell.com \
--cc=bzhao@marvell.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/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 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).