Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp586689iog; Mon, 13 Jun 2022 08:38:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVrsHVTt0cje22Dsjt/K4L5Js5zNJjuTBf3ANikkBqHxPA5z6l56cgnIEOjWeK83r5kPMd X-Received: by 2002:a17:90b:3e8b:b0:1e8:66c2:c61c with SMTP id rj11-20020a17090b3e8b00b001e866c2c61cmr16234179pjb.181.1655134708689; Mon, 13 Jun 2022 08:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655134708; cv=none; d=google.com; s=arc-20160816; b=sBi59T4ywLF/Hizykuo6bDOrzciWTRogqVy8e5IsY/ZbHgZ1MhxkLMdvP6fqDjrOKj jDI6F9NZlaPtTyQXAj0uh/lrrR5I8d22LbOtDr4Er03itqlticwcsdg3jTJPDZk65EnP iTeGuAR+jmLk08dIrIZ4TLawVVX3BMuTCuvmAC23SmH9RyHjWmfW9nhVfA7MBk+VC9aq snoQ7xskCIcqVwfQ4OP8PgyWwqOPKWJlReFCdMQSXPM4v6mBydPj1MZ45kC57PN1zE1H yazBtgzeK34a/9JFTN/XzNy3v7L1xbi5VkQL0DOGPljWu305SthgbFrxyOoRUiset8WY 96EQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tB5Hr/6o/jbIwtGwup2rOZKk8fo9rf84Iw9PVygb/1A=; b=lhZ1O/RHDnVlmlJ6iHU3Nee1/3js1moukPIP9pc7B6vIQJQrnl7YV9cJFLYPUbLf1U 2wjfXbfmnLUOMoZ1I9WkTJlBAh9Ob1SnfFE5gDEPeXgq10VYNiRKMXRF4vFFMENiy1SR cjU/W7SA4YwFS3ksytUQouwbSiaDA2AXLyOBcW7zpneVOEa0Qj/nDrSIItAPqqL4kb3d GEKQbEUWsiQ/8YwCqLsFZZQRDCXXFo++yuuPZpmR++ksY/8RIbh/DP1Eu7rZaRqyWBLp JP8xlfda/+8f/dhDfzEbe8WMgpqR+JAHH4/lwJu5+94iox1el5FqfSzFZEe3HddCNJZ/ +ipw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wmz8H73I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g67-20020a636b46000000b004051d974ce4si9296547pgc.458.2022.06.13.08.38.16; Mon, 13 Jun 2022 08:38:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=wmz8H73I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358838AbiFMNIA (ORCPT + 99 others); Mon, 13 Jun 2022 09:08:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358393AbiFMMzU (ORCPT ); Mon, 13 Jun 2022 08:55:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F8B6D120; Mon, 13 Jun 2022 04:15:57 -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 0928560EAE; Mon, 13 Jun 2022 11:15:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FF80C3411E; Mon, 13 Jun 2022 11:15:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655118956; bh=ZYb0T6V6xCY+lMt63atn7qnzmPbVWr5AkRYkK3butuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wmz8H73Ir57yhLo1Gix3RDPL/eSmwB20JE9pkW/wEJDhitB2c0P1LOVCIHHUuQViG DgccOpnivQHt5KffmL74j5RKCxzd4Ks6AGGAWinHEastJpAxRILsAtJZ1m9o3ULxJm sJAs1uYPLNOTxxNm3r6jY+qvB3i2p7fdKAh2tThA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianhao Zhao , =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 089/247] sfc: fix wrong tx channel offset with efx_separate_tx_channels Date: Mon, 13 Jun 2022 12:09:51 +0200 Message-Id: <20220613094925.656044534@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094922.843438024@linuxfoundation.org> References: <20220613094922.843438024@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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-kernel@vger.kernel.org From: Íñigo Huguet [ Upstream commit c308dfd1b43ef0d4c3e57b741bb3462eb7a7f4a2 ] tx_channel_offset is calculated in efx_allocate_msix_channels, but it is also calculated again in efx_set_channels because it was originally done there, and when efx_allocate_msix_channels was introduced it was forgotten to be removed from efx_set_channels. Moreover, the old calculation is wrong when using efx_separate_tx_channels because now we can have XDP channels after the TX channels, so n_channels - n_tx_channels doesn't point to the first TX channel. Remove the old calculation from efx_set_channels, and add the initialization of this variable if MSI or legacy interrupts are used, next to the initialization of the rest of the related variables, where it was missing. Fixes: 3990a8fffbda ("sfc: allocate channels for XDP tx queues") Reported-by: Tianhao Zhao Signed-off-by: Íñigo Huguet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/sfc/efx_channels.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c index d5f2ccd3bca4..b1657e03a74f 100644 --- a/drivers/net/ethernet/sfc/efx_channels.c +++ b/drivers/net/ethernet/sfc/efx_channels.c @@ -308,6 +308,7 @@ int efx_probe_interrupts(struct efx_nic *efx) efx->n_channels = 1; efx->n_rx_channels = 1; efx->n_tx_channels = 1; + efx->tx_channel_offset = 0; efx->n_xdp_channels = 0; efx->xdp_channel_offset = efx->n_channels; rc = pci_enable_msi(efx->pci_dev); @@ -328,6 +329,7 @@ int efx_probe_interrupts(struct efx_nic *efx) efx->n_channels = 1 + (efx_separate_tx_channels ? 1 : 0); efx->n_rx_channels = 1; efx->n_tx_channels = 1; + efx->tx_channel_offset = 1; efx->n_xdp_channels = 0; efx->xdp_channel_offset = efx->n_channels; efx->legacy_irq = efx->pci_dev->irq; @@ -956,10 +958,6 @@ int efx_set_channels(struct efx_nic *efx) struct efx_channel *channel; int rc; - efx->tx_channel_offset = - efx_separate_tx_channels ? - efx->n_channels - efx->n_tx_channels : 0; - if (efx->xdp_tx_queue_count) { EFX_WARN_ON_PARANOID(efx->xdp_tx_queues); -- 2.35.1