linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: Fix the MAX MTU calculation
       [not found] <201212211141.qBLBfZdq015078@chaitanya-desktop>
@ 2012-12-21 11:45 ` Chaitanya
  2012-12-21 14:11   ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Chaitanya @ 2012-12-21 11:45 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless


Fix the Max MTU calculations.
Do not take headers in to account, only MAX MSDU size
as per 802.11-2012(8.2.3) is enough.

ToDo: Add support for AMSDU in future.

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

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

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 54fb7f9..5e5e876 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -207,15 +207,24 @@ void ieee80211_recalc_idle(struct ieee80211_local *local)
 
 static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
 {
-	int meshhdrlen;
-	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-
-	meshhdrlen = (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) ? 5 : 0;
+	/* 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 (skb_alloc) its handled properly.
+
+	ToDO: Make the MAX_DATA_LEN driver configurable through its
+	AMSDU capabilities.
+	 */
 
-	/* FIX: what would be proper limits for MTU?
-	 * This interface uses 802.3 frames. */
 	if (new_mtu < 256 ||
-	    new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) {
+	    new_mtu > IEEE80211_MAX_DATA_LEN) {
 		return -EINVAL;
 	}
 





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mac80211: Fix the MAX MTU calculation
  2012-12-21 11:45 ` [PATCH] mac80211: Fix the MAX MTU calculation Chaitanya
@ 2012-12-21 14:11   ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2012-12-21 14:11 UTC (permalink / raw)
  To: Chaitanya; +Cc: linux-wireless

On Fri, 2012-12-21 at 17:15 +0530, Chaitanya wrote:
> Fix the Max MTU calculations.
> Do not take headers in to account, only MAX MSDU size
> as per 802.11-2012(8.2.3) is enough.

Applied, but I rewrote the changelog a bit,

> ToDo: Add support for AMSDU in future.

removed this (AMSDU is irrelevant here)

> -	int meshhdrlen;
> -	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
> -
> -	meshhdrlen = (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) ? 5 : 0;
> +	/* 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 (skb_alloc) its handled properly.
> +
> +	ToDO: Make the MAX_DATA_LEN driver configurable through its
> +	AMSDU capabilities.
> +	 */

and I also removed the big comment that doesn't really apply

johannes


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-21 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <201212211141.qBLBfZdq015078@chaitanya-desktop>
2012-12-21 11:45 ` [PATCH] mac80211: Fix the MAX MTU calculation Chaitanya
2012-12-21 14:11   ` Johannes Berg

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).