Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp931653rwn; Thu, 8 Sep 2022 10:41:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR5iQnHnh+W0pRaNoImz3BrVpNc8RNk9Sf69re/QM+g78qdkhlNi1xgh5TsMVqeX2iNlGFwM X-Received: by 2002:a05:6512:12d5:b0:494:9e95:e97e with SMTP id p21-20020a05651212d500b004949e95e97emr3224594lfg.80.1662658897204; Thu, 08 Sep 2022 10:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662658897; cv=none; d=google.com; s=arc-20160816; b=rkaBJJAM3dH/CVxhzjIVd5gmryEk3h28Rs8OEvj/I4H7skyn8ebKmPbdHyX3UXq/e+ 7ANq40Kf8Mx0JYGdbNB2pFVgJUMsjnLsbvDFzPKj4WCdovw7TDEn8AOrp7hOJIY59WkP gsWdQ9QfELUiY/NnuNX/NiqSKOmm3zGrIYJULIarnq/7HkyZ2vfuYngIEG878M2ZVKQ3 OI38uYQqxQrkW8XVClRm35YXbModxswqDEFEq4sxbbGsMOFnx/SutwbXq/pE4q9KMspe z66/oXqyxHTQbmyFDX0giVVtnZY12fqFw8q0M3GAJN+kXR0hQnEyD3V/BszeXcm+NYYy dYmw== 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=GB9xWxS+/dNB7blBCx/W0Z14NcIRuFDQzfOB+6TIMWU=; b=aQSDPQXHkMnlYtulXxswJnq2Ts5A/QWpOfzpJOLkx2ZDD9uhOsdehaxmizJYTzYe7D QCQif+xZGcCLpxyuItTZizR6+TNdOyPAN+7+rxrH3GoLncdnsjHYqHwua16aHXnOSYiS ockOPGM0oebnjQDPilcmvpnPAwGWfEN0Gye6t/jM7D0Z1hX1vJ9s0b1ehBIckom5S8T8 sG+rPz577InVTQLw6WKgrdpIaD/tl5xBF+HxWUNjAC1+R+A7LA1TeVtPZ7f8eWeO5tZJ BtAB9AZ7v2xVel7TsHcGI+YIeRY0eI0V4YyrW8FjnUNfjDhMho7lZqDfnXxdwO/AHMC+ Qcjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NNRNuipr; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l24-20020a2e9098000000b0026acbac28b0si2703331ljg.115.2022.09.08.10.41.18; Thu, 08 Sep 2022 10:41:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NNRNuipr; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232116AbiIHRgg (ORCPT + 63 others); Thu, 8 Sep 2022 13:36:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbiIHRgc (ORCPT ); Thu, 8 Sep 2022 13:36:32 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BD13E915F for ; Thu, 8 Sep 2022 10:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662658590; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GB9xWxS+/dNB7blBCx/W0Z14NcIRuFDQzfOB+6TIMWU=; b=NNRNuiprwic2B73lF3YsXcvXA5G1HO/AUL2AlYkCKm9gOj2Ei4Mz7EqpRU2vwCXNwfGVsw OFO8f+PgTHuKtk6XGv6kGIntLzcTLhjNCMCR8lHawSfYnCeUW/dplBKE2385gpny6vV+zy JWlO6icpTcYQcK51WXVmjCkjTqKFpIQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-BsUuiJcYPwOJWUVxszhJ-Q-1; Thu, 08 Sep 2022 13:36:27 -0400 X-MC-Unique: BsUuiJcYPwOJWUVxszhJ-Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2509E101A54E; Thu, 8 Sep 2022 17:36:26 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56533C15BB3; Thu, 8 Sep 2022 17:36:25 +0000 (UTC) From: Hans de Goede To: Stanislaw Gruszka , Helmut Schaa , Kalle Valo Cc: Hans de Goede , linux-wireless@vger.kernel.org Subject: [PATCH 1/1] wifi: rt2x00: Fix "Error - Attempt to send packet over invalid queue 2" Date: Thu, 8 Sep 2022 19:36:18 +0200 Message-Id: <20220908173618.155291-2-hdegoede@redhat.com> In-Reply-To: <20220908173618.155291-1-hdegoede@redhat.com> References: <20220908173618.155291-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Even though ieee80211_hw.queues is set to 2, the ralink rt2x00 driver is seeing tx skbs submitted to it with the queue-id set to 2 / set to IEEE80211_AC_BE on a rt2500 card when associating with an access-point. This causes rt2x00queue_get_tx_queue() to return NULL and the following error to be logged: "ieee80211 phy0: rt2x00mac_tx: Error - Attempt to send packet over invalid queue 2", after which association with the AP fails. This patch works around this by mapping QID_AC_BE and QID_AC_BK to QID_AC_VI when there are only 2 tx_queues. Signed-off-by: Hans de Goede --- The net/mac80211 code has checks for local->hw.queues < IEEE80211_NUM_ACS in various places and returns queue-id 0 when this condition is true. So it looks like the rt2x00 driver receiving a queue-id of 2 / IEEE80211_AC_BE might actually be a bug in the mac80211 core code, I will send out a separate email about this. --- drivers/net/wireless/ralink/rt2x00/rt2x00.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h index 8f5772b98f58..07a6a5a9ce13 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h @@ -1309,8 +1309,11 @@ void rt2x00queue_unmap_skb(struct queue_entry *entry); */ static inline struct data_queue * rt2x00queue_get_tx_queue(struct rt2x00_dev *rt2x00dev, - const enum data_queue_qid queue) + enum data_queue_qid queue) { + if (queue >= rt2x00dev->ops->tx_queues && queue < IEEE80211_NUM_ACS) + queue = rt2x00dev->ops->tx_queues - 1; + if (queue < rt2x00dev->ops->tx_queues && rt2x00dev->tx) return &rt2x00dev->tx[queue]; -- 2.37.2