Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1156635lqo; Sat, 11 May 2024 09:38:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWhk+4KqKnd5lGsC56YMn28QBUT+oNjRRHZA8XKPJmwO34Cpur5RrtOLIOX3M5nC4Z9QeX08M+A+K3BVedfX0tg+CpZdewCmkfAWtV7zQ== X-Google-Smtp-Source: AGHT+IFCcnaM6qDVE1V/cT517TWl0Umttw3oCTCeRVYZAA1YEvjQ/KvHRUvZcolQPPXjXI1diehp X-Received: by 2002:a05:6214:5413:b0:6a0:ccab:6fcd with SMTP id 6a1803df08f44-6a16821eb10mr75997116d6.46.1715445507155; Sat, 11 May 2024 09:38:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715445507; cv=pass; d=google.com; s=arc-20160816; b=BpmJ+CMaDaoMawXwmGsIaOCkL7UIvK4qYsehGGOhZuOD/nwYP3o94/7ddUaVu/qqxl WojXrJw8F0tvxbL9oW//VmTSAJNpVlFBnOACXSHaAR0IjWMMr1aRAzIRkoL/tKOwTEbz ORxP21WraNlBcWfUnPLECyO+jzsJn0oAkBZed1ZVXMCiyEMfP6e6cvvnBlmsuqKxTTQM XYA2CiaX6Nwj4sXIE6uER2bvukEJs+tQ6q6cZgt3rjYPALmMcfkVIbUygpC+jGO0ls2p idRo2HGFz92uY2dIMpmc+DKEYMyiZfuDEFVgq71p6puOCSxCfgWKVQfBln9XrACo/xWp QihQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7J1xmzGKPUM55K5Sly7CDs9dMAn1ZAdmK+bW5GRdQX0=; fh=YtUbvzVxJYGOXvEHWV9pOBIA+beARLSuka80wSqUptE=; b=xlL5JRspVTEtUa6xtmNyySdELGKbWTOTy9M9kuRHG4MLFX/LatWQZv9t4EPRU6uWr9 Fs+0Zydb3gDkzXevHFr/33rQ/6PIKO3fGf40YSxu9U1qecxw6O+LlHwZmSEsxpcivJYq xpf8+M/4XJzCdcpQnOhoI3avXFjbeHFabMm2/MkJCVQ48HhIovwRwr+Dl7w6uxfcJSA5 dRXj7K1OVPduF/Upprs6731GagJVxrxFp5uGUaNf/4eT962PPqse4VJgrkwJoJQoYDU4 1RdhKyIp611WDRuTa57nDzqjI81RKShoI12QBw+3mBx3QY/r2Fw5EDZIZJxWeslVMPPZ AYzQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BKfptXyB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-176647-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176647-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f1d74e9si60907496d6.89.2024.05.11.09.38.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 09:38:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176647-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BKfptXyB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-176647-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176647-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BC2C71C20B21 for ; Sat, 11 May 2024 16:38:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A152418E1F; Sat, 11 May 2024 16:38:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BKfptXyB" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C62DF1B7E9; Sat, 11 May 2024 16:38:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715445496; cv=none; b=L7eZPIEEVQ/THMDHF8rElVU78QM2dXY0r3dO6YAOJLDeBj6vFa/tvvl0s5FR638HqdDm9/xJcapTbBjc6uiZ2DxSfxKypRydKo32ww4J4CdxXcc1ljsyKaX7bi8UaD87mYsb5mju6SeSttgEYToTO/0GlQY5A8/w8zSCe/XgnPI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715445496; c=relaxed/simple; bh=e94BgLcLEdR+T6CinJz6xb5bntXFyDdNlBr4TIoWFHQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fllR+wKqAGWsliTNUSTTWb2q0IzXWx0kq0UvdObSXyYEpBfAE+eam559bfeuqHKLtNEWUT61NCo42t+KMdYYUThb2cuiC3S9WgSkMd8vdNMUwNLlw47ASedunECBQYK7PdjXKRRup0+bnFwo9S4gBhl7T55/xNfKSpBCaaVwwA4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BKfptXyB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22C5AC2BBFC; Sat, 11 May 2024 16:38:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715445496; bh=e94BgLcLEdR+T6CinJz6xb5bntXFyDdNlBr4TIoWFHQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BKfptXyBYmoClepdP/CjknBDwgtvv7FtGgfdpmQKpJSA8mp1gTDxw7zJEq1CPE+lP EQ+LzPPY6INJ6SyEqNngj5VixGphDfyn6Wlg3Wn+Dk22GlOggjq/oTiYnEg5lCU/fP Am7B+lRaSGxZC+8NU0FE3ia80oI/tgR9/mcJ+nznzHpnD8AyRMolsQg5fxz1UFC0Gg sWEUC0BgONbmRKBdifda+X66NiBZJw8u5JRvdqw8ggSrfmE0wv8Id/f1KwQw7HhVtm S+lkesdmCXnOMZEtGQOKotoXYZ6lM1zY5Qqi46qx01VZS0UmNV1AUIKHqmKLpT+tlf AhnTPdext5dGA== Date: Sat, 11 May 2024 17:38:10 +0100 From: Simon Horman To: Larysa Zaremba Cc: Tony Nguyen , intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, alan.brady@intel.com, maciej.fijalkowski@intel.com, jesse.brandeburg@intel.com, Emil Tantilov , Pavan Kumar Linga , joshua.a.hay@intel.com, Przemek Kitszel , Igor Bagnucki Subject: Re: [PATCH iwl-net] idpf: Interpret .set_channels() input differently Message-ID: <20240511163810.GN2347895@kernel.org> References: <20240426154125.235977-1-larysa.zaremba@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240426154125.235977-1-larysa.zaremba@intel.com> On Fri, Apr 26, 2024 at 05:41:22PM +0200, Larysa Zaremba wrote: > Unlike ice, idpf does not check, if user has requested at least 1 combined > channel. Instead, it relies on a check in the core code. Unfortunately, the > check does not trigger for us because of the hacky .set_channels() > interpretation logic that is not consistent with the core code. > > This naturally leads to user being able to trigger a crash with an invalid > input. This is how: > > 1. ethtool -l -> combined: 40 > 2. ethtool -L rx 0 tx 0 > combined number is not specified, so command becomes {rx_count = 0, > tx_count = 0, combined_count = 40}. > 3. ethnl_set_channels checks, if there is at least 1 RX and 1 TX channel, > comparing (combined_count + rx_count) and (combined_count + tx_count) > to zero. Obviously, (40 + 0) is greater than zero, so the core code > deems the input OK. > 4. idpf interprets `rx 0 tx 0` as 0 channels and tries to proceed with such > configuration. > > The issue has to be solved fundamentally, as current logic is also known to > cause AF_XDP problems in ice [0]. > > Interpret the command in a way that is more consistent with ethtool > manual [1] (--show-channels and --set-channels) and new ice logic. > > Considering that in the idpf driver only the difference between RX and TX > queues forms dedicated channels, change the correct way to set number of > channels to: > > ethtool -L combined 10 /* For symmetric queues */ > ethtool -L combined 8 tx 2 rx 0 /* For asymmetric queues */ > > [0] https://lore.kernel.org/netdev/20240418095857.2827-1-larysa.zaremba@intel.com/ > [1] https://man7.org/linux/man-pages/man8/ethtool.8.html > > Fixes: 02cbfba1add5 ("idpf: add ethtool callbacks") > Reviewed-by: Przemek Kitszel > Reviewed-by: Igor Bagnucki > Signed-off-by: Larysa Zaremba Reviewed-by: Simon Horman