Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp451522pxb; Thu, 9 Sep 2021 04:55:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweRDCuQFXWtoUHTq2OFY8zp3dwnnNfYiCBZPbuukhOTQeeEko7pBjjvKxSCktrZGkzctck X-Received: by 2002:a92:c8c3:: with SMTP id c3mr506480ilq.43.1631188522236; Thu, 09 Sep 2021 04:55:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631188522; cv=none; d=google.com; s=arc-20160816; b=AcNkWwuVjTSswAlxe+YQoIzf3Cq4sNsPN2LUwz69PmDuObSZ9CVW1XXd8UIkwNBamE JZ8nrxFfyRbT7qnIFbm0E7Tm3gpJvURASyTcOh4X6cI2aDyJBc1DLmn0oL2XgdeQbNq9 m+7Vc37aTNZ2z3GVpzmP6vAIEF6CKjYQxvDEe3FXjuK+vHGr4GTwSJy9P9b4mmbbUjgq vdkkisBv2NYCWSKpENf312NiHEdWRjKevh5JGgUayF/joyZljGnH7c5ZScded07/Rut6 yncyn/RarGJmQRMim4jk/soZdEY5y+EnhCXlyEMJz2/UKxgwpJk54w+Wa2vxwmB0gpOy ZygQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aSKg0P8nwmWJwzspoFghB93aAC32623/imggCLoxnK0=; b=LHVMcWaXxIBwWlF70l4waA5cZnTeggXaicWSWkAkcm27K2FSsoeI3lahOkedKnSnkd 24qXnIUkJkLsMNjt1ccXOloQkTLbZ/JS/ZzD8vDdmjsJOHA9QF5r0jNdT6vNq19VTGQM gwK3HaQjKJGwyPJQ1ohZx6JYJ5kwjT8JUUgdHc31xFRSGQj2h85/7znftYv+kOx4tLza IHOvJ6Z1U1e90Fn7LyN5WRtxnoZ7oRfPPMaQxaAAkNF8dAUKUI4F4Ch1+i5985r8lq6W 6Cz1en6XaiaPzv/Rhz+Tpl7awvt0YtrFTD+aojOG1I9nir1OSEoKx5p8mtZi68TkhHfN IkRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sVwcZKh+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h26si1561455ioz.60.2021.09.09.04.55.10; Thu, 09 Sep 2021 04:55:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sVwcZKh+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238744AbhIILza (ORCPT + 99 others); Thu, 9 Sep 2021 07:55:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:54740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242573AbhIILwX (ORCPT ); Thu, 9 Sep 2021 07:52:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0115A61100; Thu, 9 Sep 2021 11:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187861; bh=xHfzP72TZyDPRk8pGAwmlKS+B0g1x+9BYa0SUdCdils=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sVwcZKh+hzP2J+67+aMTvK9u02C7XhI3iKnQaL2Af8Tfxt2yxGMFhEKOThIN8NTFb QvnpANeHudBkBjpB31xZ3/8jD0rejWMxEnxNcyUGeoEyoU9nxhMDJqaGYj/w9KM5Hv 4KWiBSIkD0GhZjrO71PU1Ws0E1WdV8+pkHOIvhJjLg6/GLlcXK93FajVDnhB/zM1cD ntzAiUvEBZMnxeFCkqwWSLdXbmWe1u+20JhUyoxmwb5uqsuDkvrWaFJkkr4y/SnD+0 7z+MPWgac0VpzN3haHFGt3miWsdpa7VYmgXx2fnGucq380JlRyG2NwzB3W5ISDHJEY bofMoDpoGi7hw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johan Almbladh , Johannes Berg , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.14 149/252] mac80211: Fix monitor MTU limit so that A-MSDUs get through Date: Thu, 9 Sep 2021 07:39:23 -0400 Message-Id: <20210909114106.141462-149-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Almbladh [ Upstream commit 79f5962baea74ce1cd4e5949598944bff854b166 ] The maximum MTU was set to 2304, which is the maximum MSDU size. While this is valid for normal WLAN interfaces, it is too low for monitor interfaces. A monitor interface may receive and inject MPDU frames, and the maximum MPDU frame size is larger than 2304. The MPDU may also contain an A-MSDU frame, in which case the size may be much larger than the MTU limit. Since the maximum size of an A-MSDU depends on the PHY mode of the transmitting STA, it is not possible to set an exact MTU limit for a monitor interface. Now the maximum MTU for a monitor interface is unrestricted. Signed-off-by: Johan Almbladh Link: https://lore.kernel.org/r/20210628123246.2070558-1-johan.almbladh@anyfinetworks.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/iface.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 1e5e9fc45523..cd96cd337aa8 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -2001,9 +2001,16 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops); - /* MTU range: 256 - 2304 */ + /* MTU range is normally 256 - 2304, where the upper limit is + * the maximum MSDU size. Monitor interfaces send and receive + * MPDU and A-MSDU frames which may be much larger so we do + * not impose an upper limit in that case. + */ ndev->min_mtu = 256; - ndev->max_mtu = local->hw.max_mtu; + if (type == NL80211_IFTYPE_MONITOR) + ndev->max_mtu = 0; + else + ndev->max_mtu = local->hw.max_mtu; ret = cfg80211_register_netdevice(ndev); if (ret) { -- 2.30.2