linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chaitanya <chaitanyatk@posedge.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless <linux-wireless@vger.kernel.org>
Subject: [RFC] mac80211: Fix MAX MTU Calculation
Date: Thu, 20 Dec 2012 18:13:41 +0530	[thread overview]
Message-ID: <50D307FD.9010508@posedge.com> (raw)
In-Reply-To: <201212201236.qBKCakFZ011657@chaitanya-desktop>

Fix the MTU calculation, we should check for data_len+ mesh hdr len
and shouldn't include any header lengths.

ToDo: Get the MAX_DATA_LEN based on driver's AMSDU capability.

Signed-off-by: T Krishna Chaitanya <chaitanyatk@posedge.com>

---

 net/mac80211/iface.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 54fb7f9..da74ef9 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -214,8 +214,23 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
 
 	/* FIX: what would be proper limits for MTU?
 	 * This interface uses 802.3 frames. */
+	/* Fixed: MTU needn't worry about headers*/
+
+	/* 802.11-2012: 8.2.3: The maximum frame body size is determined by
+	1. The maximum MSDU size (2304 octets),
+	2. plus the length of the Mesh Control field (6, 12, or 18 octets)
+		if present,
+	3. the maximum unencrypted MMPDU size excluding the MAC header and
+		FCS (2304 octets) or
+	4. the maximum A- MSDU size (3839 or 7935 octets),
+		plus any overhead from security encapsulation.
+	Note1: IEEE80211_MAX_DATA_LEN doesnt include any headers (2304),
+		so it can be used directly+ Mesh HDR Len
+	Note2: In Other places (like skb_alloc) its handled properly.
+	 */
+
 	if (new_mtu < 256 ||
-	    new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) {
+	    new_mtu > IEEE80211_MAX_DATA_LEN + meshhdrlen) {
 		return -EINVAL;
 	}
 





       reply	other threads:[~2012-12-20 12:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201212201236.qBKCakFZ011657@chaitanya-desktop>
2012-12-20 12:43 ` Chaitanya [this message]
2012-12-20 13:07   ` [RFC] mac80211: Fix MAX MTU Calculation Johannes Berg
2012-12-20 13:17     ` Chaitanya

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=50D307FD.9010508@posedge.com \
    --to=chaitanyatk@posedge.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@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 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).