Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp104471iof; Sun, 5 Jun 2022 22:30:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6Fh/MpURgNoGkeavU4bTnk9fXnCgzq2YIA+aQnljgQtOlS3KBAJB+n6IedbJ0LYx10Ihn X-Received: by 2002:a17:902:8343:b0:167:8899:2f92 with SMTP id z3-20020a170902834300b0016788992f92mr548486pln.117.1654493439356; Sun, 05 Jun 2022 22:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654493439; cv=none; d=google.com; s=arc-20160816; b=kag9WlJrUz4RSZ6sLf1YQFcBJYmdp0e2iBGTcvkZZVcxYjsJDi1sJR6FPnSjhSQ9Ep K64VsGTuAdZJySlfDwFhuO4if/BMTIwM5l33DJa7RCM9X49EhuUlAT+YRjhDCeOdxpCO W4tH5VmC2UDs4fn0rR8Y/lri40Y4dN6MKc1WKAHz0lZnRWD+GbOozrCCI3koZdTmkeOc Pxzwvqahmooa7fcldOKCviZa7cDmjwISXn2KeJEM/ASwH+OpVghg3b5zfsDS6Nkwd4IX dk/aQBN0gphhzGlrc7WpyIeNEUyjOZvEHYRxzQkr566OCXVlR1/aMEBJOrqgOwaEUNRk e34A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=xeWUEBrUs8G3WXbFqgDaVyYlnjDmkLc2Nd9fY2d77Ts=; b=BROeIRciaKnlJUNSNB0vVMBFuYca3rQy7OA7QdPNVOSZWViRr//Ma9hafgTD4N+IQQ ahkv7KFddvLDznrkSimvjhbemKG3ywAD9/QqfS2zVR46b2zAFBzcwgYNx4jrOgs3Hm+R XBN/91clT8Qp/0O/9EglHZlBpwP/Gos0U017/ZGGTntD2kFOtMvQth7aqUdfuNqVWEtF uXXfX7Bru4xWpeaAxLfbiUdFfRs+INr5S7QUzPeJisuIjTqxpPv9Svfm8oUtfDY1i/lZ 2tmrNqIIwnt9tQsSIWw16jbC6JpbAGH5V7BSdBXvzMOzQIVriITeu8kUPIWKYxI6lWqV Ib8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Kamgo85W; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a10-20020a634d0a000000b003fbfc221ef4si19723285pgb.424.2022.06.05.22.30.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 22:30:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Kamgo85W; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AF93B20041A; Sun, 5 Jun 2022 21:30:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236585AbiFERSm (ORCPT + 67 others); Sun, 5 Jun 2022 13:18:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232266AbiFERSl (ORCPT ); Sun, 5 Jun 2022 13:18:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BA4265B7 for ; Sun, 5 Jun 2022 10:18:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AB4FC6115D for ; Sun, 5 Jun 2022 17:18:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F97AC385A5; Sun, 5 Jun 2022 17:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654449520; bh=xeWUEBrUs8G3WXbFqgDaVyYlnjDmkLc2Nd9fY2d77Ts=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Kamgo85WVfXeJRk4v4ETi43oGuzy8JjShF6RRlSOmLIFagam06Kkxcd17g8Rcl/zd h4o0pXARHL+A8XCSbBlVSjzQp04eH/NSTwqIBd/cL4DxZYbSMmLTqZWZ+OVned0OP5 ivFunIKozyxK22yY5OP9kzYX5A/KBmzEIINXkdcjMNQy0JWrq+hK8sdk9eK1cfptS5 04t3Vf2ueu9nlWLfKp3BSiweyBG92fk/z12g7KDLb/AhqY+LkLyXiJ6cn913qSzXGQ S7rx6pQzsgRpzIer2bdppqu9hHP/+a9sGyoFoxSJKGos5U3vsBnsdaM8Ss0K02MtnY Ds55HCvtfCH7w== Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id E7E4140551D; Sun, 5 Jun 2022 19:18:14 +0200 (CEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Felix Fietkau , linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net Subject: Re: [PATCH 1/2] mac80211: fix overflow issues in airtime fairness code In-Reply-To: <20220603164307.92189-1-nbd@nbd.name> References: <20220603164307.92189-1-nbd@nbd.name> X-Clacks-Overhead: GNU Terry Pratchett Date: Sun, 05 Jun 2022 19:18:14 +0200 Message-ID: <87bkv7owq1.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Felix Fietkau writes: > The airtime weight calculation overflows with a default weight value of 256 > whenever more than 8ms worth of airtime is reported. > Bigger weight values impose even smaller limits on maximum airtime values. > This can mess up airtime based calculations for drivers that don't report > per-PPDU airtime values, but batch up values instead. > > Fix this by reordering multiplications/shifts and by reducing unnecessary > intermediate precision (which was lost in a later stage anyway). > > The new shift value limits the maximum weight to 4096, which should be more > than enough. Any values bigger than that will be clamped to the upper limit. > > Signed-off-by: Felix Fietkau The weights are UAPI, so I guess we could run into applications that expect to be able to set a weight higher than 4096? I don't think this is too likely, but maybe it is better to reject such attempts instead of silently clamping the value, to flush out any breakage if it does occur? -Toke