Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp638913pxj; Fri, 11 Jun 2021 07:50:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMH5rPt5BZfqXH7q0YZFsGkgnOJ2eLPaI3XWikyasIV6eZDBRzQQZrUtau6X9rkzM2jrLx X-Received: by 2002:aa7:cb5a:: with SMTP id w26mr4236251edt.139.1623423025564; Fri, 11 Jun 2021 07:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623423025; cv=none; d=google.com; s=arc-20160816; b=IgTuo874fypyOTcmiXOwTrXBwsWLj6SnKelDsIPVgu/UgH6h6tq01u11lMeucOsyYK BeAWqt7PBCXSvcps+qwlO9nG/UK3wWqRN0o95LhME+PHvGuh3yiUt2ms24CH9gVJvUTg GM49FBSG2MwwjFv+IcxCma2O2JwbACB05+4KK59ac8oKkAEbuhwJNgDN7s1TBlT3PPNg 2JE+T63H+aTjPUTZDkQaowb5i2Ra/XoN+m8CCmX+ykuwBobif3Mit4Qv+1ObKULGV/gc bxtwb/jBLR8G0hkTnOZr1OZbQppoA/PVnQrCgnurrKwSiAG0+AD2O2AyaPQXU8opZc5J +9dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=HM/OpCdDbXxCKOPzELJHKGAfyo0GFyK7Y/hjzFUi874=; b=sCDu3KHtX17dxIIheghfxZw04yp06QHm1hsS2KHJSWZ3AciP7HaYlfEj+LmF0QuLnS EU3bUlPHzcZ2raIG0/bqjdkYjJa7iHYrXv87slWdr0wUu2DxLDnRaUSHAZRvUEZS4y3B PJkcjLizkWMjoiiZ1OH7kRHtcKx27UBTWSc+X3W5sjjGsPVM62g8lwMei998iU5Zn9je +J++xygmx+ybygg+8hdcsr/w19HTBiKiQT9CYHeX2P3uSlUs3v9p4KXomsreTGbQPfny SVBjQB59r34VrlCyNQT+OXSGOiQT0KyQVW67vOCPUYty+IvxOXOI9l5jbP8pH8owczgZ iyIA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si5235401edt.35.2021.06.11.07.50.02; Fri, 11 Jun 2021 07:50:25 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231796AbhFKOtb (ORCPT + 99 others); Fri, 11 Jun 2021 10:49:31 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:33055 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231755AbhFKOta (ORCPT ); Fri, 11 Jun 2021 10:49:30 -0400 Received: from mail-oi1-f197.google.com ([209.85.167.197]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lriRW-0002cx-3f for linux-kernel@vger.kernel.org; Fri, 11 Jun 2021 14:47:32 +0000 Received: by mail-oi1-f197.google.com with SMTP id y137-20020aca4b8f0000b02901f1fb748c74so2908890oia.21 for ; Fri, 11 Jun 2021 07:47:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HM/OpCdDbXxCKOPzELJHKGAfyo0GFyK7Y/hjzFUi874=; b=rUhiSVN+4jryE7VD2076sBJTv6n9flh+WYDs9oo2w3XKrJj4pIlfhFLw+bInGq9twW BviUwuAYSYQqXYAHqlLoWVS/6k08wwjrmFy4qOJb1uegy48/7hWaxBJdg7M5yOI62m9d O/I6v4RhN1Q9mUPHFImu4gJaTKqZR0JJ3YM+mBAiQ6F30fCfFk49UiSABq1m/xv9EfNN yLMLEGsDomD+VF4eARrTs2eu2N7upZC4BBOtD9v5ZViuFZeSMn14qiEQ2IgX5EbKwOYL ZGb1nWT2t2JxNYi+Bb2NeNLsGPg9FOTih1wCCxg6oIYduXfuYCI2h3kq1skyzNAKMObP 3BYA== X-Gm-Message-State: AOAM532ykEpMgtt7qnjUjeWadLZr7Pz7+28E4/BPij1FkoMMqvN4BHkb hcbCZbUvhpOgzWAhNAJu6q/iHkSY5J2Xqu+ybo6UwYk2RVyLRdPeBFHr4SxvuHjsClkjOzIkQEQ JO0Xx3em1MbZgyFDQXZDbF/2OPRRUWYLQOfZmWChkOTpGkqHOL90T0G1zOQ== X-Received: by 2002:a9d:12eb:: with SMTP id g98mr3366600otg.303.1623422849087; Fri, 11 Jun 2021 07:47:29 -0700 (PDT) X-Received: by 2002:a9d:12eb:: with SMTP id g98mr3366582otg.303.1623422848860; Fri, 11 Jun 2021 07:47:28 -0700 (PDT) MIME-Version: 1.0 References: <20210603120609.58932-1-chris.chiu@canonical.com> <20210603120609.58932-2-chris.chiu@canonical.com> <5bb08a2db092c590119ff706ac3654de14c984fc.camel@sipsolutions.net> In-Reply-To: <5bb08a2db092c590119ff706ac3654de14c984fc.camel@sipsolutions.net> From: Chris Chiu Date: Fri, 11 Jun 2021 22:47:18 +0800 Message-ID: Subject: Re: [PATCH v2 1/2] rtl8xxxu: unset the hw capability HAS_RATE_CONTROL To: Johannes Berg Cc: Jes.Sorensen@gmail.com, kvalo@codeaurora.org, davem@davemloft.net, kuba@kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Linux Kernel , code@reto-schneider.ch Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 11, 2021 at 4:18 AM Johannes Berg wrote: > > Hi Chris, > > > Since AMPDU_AGGREGATION is set so packets will be handed to the > > driver with a flag indicating A-MPDU aggregation and device should > > be responsible for setting up and starting the TX aggregation with > > the AMPDU_TX_START action. The TX aggregation is usually started by > > the rate control algorithm so the HAS_RATE_CONTROL has to be unset > > for the mac80211 to start BA session by ieee80211_start_tx_ba_session. > > > > The realtek chips tx rate will still be handled by the rate adaptive > > mechanism in the underlying firmware which is controlled by the > > rate mask H2C command in the driver. Unset HAS_RATE_CONTROL cause > > no change for the tx rate control and the TX BA session can be started > > by the mac80211 default rate control mechanism. > > This seems ... strange, to say the least? You want to run the full > minstrel algorithm just to have it start aggregation sessions at the > beginning? > > I really don't think this makes sense, and it's super confusing. It may > also result in things like reporting a TX rate to userspace/other > components that *minstrel* thinks is the best rate, rather than your > driver's implementation, etc. > > I suggest you instead just call ieee80211_start_tx_ba_session() at some > appropriate time, maybe copying parts of the logic of > minstrel_aggr_check(). > > johannes > > Based on the description in https://github.com/torvalds/linux/blob/master/net/mac80211/agg-tx.c#L32 to L36, if we set HAS_RATE_CONTROL, which means we don't want the software rate control (default minstrel), then we will have to deal with both the rate control and the TX aggregation in the driver, and the .ampdu_action is not really required. Since the rtl8xxxu driver doesn't handle the TX aggregation, and the minstrel is the default rate control (can't even be disabled), that's the reason why I want to unset the HAS_RATE_CONTROL to make use of the existing mac80211 aggregation handling. And the minstrel doesn't really take effect for rate selection in HT mode because most drivers don't provide HT/VHT rates in .bitrates of the ieee80211_supported_band data structure which is required for hw->wiphy->bands. The mac80211 API ieee80211_get_tx_rate() will return 0 when the IEEE80211_TX_RC_MCS is set in rate flags. The tx rate which is filled in the tx descriptor makes no difference because the underlying rate selection will be actually controlled by the controller which we can set rate mask via H2C command. Unless we force the fixed rate in the TX descriptor, we don't really have to fill the tx rate. Reporting TX rate of each packet will not depend on the rate from the minstrel, drivers have to handle it by itself. I'll also try to address that in my next PATCH series. Chris