From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3A0BD44D7C for ; Wed, 6 Nov 2024 15:00:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 9338F80B8B; Wed, 6 Nov 2024 15:00:23 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id x9H6A1BV7WvH; Wed, 6 Nov 2024 15:00:23 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org CCDF380B97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1730905222; bh=WM8w3mk+ce5hVeb8nwVco9GsYJ9kEPcdt9QsjGXN7K0=; h=Date:From:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CffFHrpJ5gobgc0ibVlQtSIlw0qLFrhi7KagxM4dyUAZmT2uP0sUBpNMmXKQyCAnn upaNNxo5Sd8skeVNpcVY8Nm8UMS58iEGtO7L0nBOwgE+2+vvAuLjIA5+lwEmbLa9PU +wGb38ZBs9V8ZzmMjsiFBvQ7DuHvXtkNcf2IW7itkBPQPI/zM0BpWAQvIYFYfen65/ AhZYo+AZbScEm40Q1/qzPFwqOROCGFq1R+JUJ6LYk44+EC820cTNQS73bQkrHesesE KqT6eES8I3bzZHWR6UWY+4St7KuMIR2l8UOx9hlofu//R3O5OI+9ZC/CMstLrs34FH p2ozp61oHgvxQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id CCDF380B97; Wed, 6 Nov 2024 15:00:22 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists1.osuosl.org (Postfix) with ESMTP id 336FB3B for ; Wed, 6 Nov 2024 15:00:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id ED1BD608B8 for ; Wed, 6 Nov 2024 15:00:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Crosp4BBXOJY for ; Wed, 6 Nov 2024 15:00:20 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=147.75.193.91; helo=nyc.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 3410D60729 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3410D60729 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by smtp3.osuosl.org (Postfix) with ESMTPS id 3410D60729 for ; Wed, 6 Nov 2024 15:00:20 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id BE105A43E41; Wed, 6 Nov 2024 14:58:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44FEAC4CEC6; Wed, 6 Nov 2024 15:00:17 +0000 (UTC) Date: Wed, 6 Nov 2024 15:00:15 +0000 From: Simon Horman To: Mateusz Polchlopek Cc: intel-wired-lan@lists.osuosl.org, david.m.ertman@intel.com, netdev@vger.kernel.org, Przemek Kitszel Message-ID: <20241106150015.GQ4507@kernel.org> References: <20241028165922.7188-1-mateusz.polchlopek@intel.com> <20241102143818.GM1838431@kernel.org> <748c0685-cd16-4f7e-b359-91b095fc3d26@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <748c0685-cd16-4f7e-b359-91b095fc3d26@intel.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730905218; bh=ZxhHGcVMGkOTmRlXHYf2j9fcy44PbxWGEr5K4E/whr0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NaryHrI6t/SKwyRhRkOiIJZWKINoEtt+Q9pO4Mnts9c3ze1EBKf9KgSz2/oYegdws KljaPXs2Q00MR6Ouxm8Hwy+HbaiNKnw7VIkrqNgH9NgdYgHRm01qDgGKmEqPlyZpmD 9H5SGhzg+Dk8/hsPnZK+G99lrnN3KSL/ff24bhW8MpstCBr5d0gBCWolQDL0dsrxs7 JEcfdaWp20Ow3+myi2l9umKlGs03m9i7b6oJrT++XLtCn98gsmfvWAmVH2HDzM6VGC pxQtf+MkSae7dvAqH/aRrYxFu8v6na+uHweNEbbNAMQYAdrFM9463hbpTeC/1ub/Xy 9pYXeyMG/KDAw== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=NaryHrI6 Subject: Re: [Intel-wired-lan] [PATCH iwl-net] ice: change q_index variable type to s16 to store -1 value X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Mon, Nov 04, 2024 at 01:56:20PM +0100, Mateusz Polchlopek wrote: > > > On 11/2/2024 3:38 PM, Simon Horman wrote: > > On Mon, Oct 28, 2024 at 12:59:22PM -0400, Mateusz Polchlopek wrote: > > > Fix Flow Director not allowing to re-map traffic to 0th queue when action > > > is configured to drop (and vice versa). > > > > > > The current implementation of ethtool callback in the ice driver forbids > > > change Flow Director action from 0 to -1 and from -1 to 0 with an error, > > > e.g: > > > > > > # ethtool -U eth2 flow-type tcp4 src-ip 1.1.1.1 loc 1 action 0 > > > # ethtool -U eth2 flow-type tcp4 src-ip 1.1.1.1 loc 1 action -1 > > > rmgr: Cannot insert RX class rule: Invalid argument > > > > > > We set the value of `u16 q_index = 0` at the beginning of the function > > > ice_set_fdir_input_set(). In case of "drop traffic" action (which is > > > equal to -1 in ethtool) we store the 0 value. Later, when want to change > > > traffic rule to redirect to queue with index 0 it returns an error > > > caused by duplicate found. > > > > > > Fix this behaviour by change of the type of field `q_index` from u16 to s16 > > > in `struct ice_fdir_fltr`. This allows to store -1 in the field in case > > > of "drop traffic" action. What is more, change the variable type in the > > > function ice_set_fdir_input_set() and assign at the beginning the new > > > `#define ICE_FDIR_NO_QUEUE_IDX` which is -1. Later, if the action is set > > > to another value (point specific queue index) the variable value is > > > overwritten in the function. > > > > > > Fixes: cac2a27cd9ab ("ice: Support IPv4 Flow Director filters") > > > Reviewed-by: Przemek Kitszel > > > Signed-off-by: Mateusz Polchlopek > > > > This looks good, although I am interested to know what the maximum value > > for q_index is. And, considering unsigned values are used elsewhere, if > > using 0xffff within this driver was considered instead of -1. > > > > That notwithstanding, > > > > Reviewed-by: Simon Horman > > Hi Simon! > > Thanks for Your review. > What is about q_index: it stores queue index which can be theoretically > up to few thousands. So in this case s16 should be enough and will be > able to hold all indexes. I didn't consider 0xffff as this may be > misleading, I decided to stay with -1. Thanks. I agree that if we are expecting the maximum (positive) value to be a few thousand, then the s16-based approach you have taken is a good one.