Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp2242lqd; Tue, 23 Apr 2024 12:35:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXwcRDigy2Od0AvceuXQUmCYV/QMXhUfykMMbsFaPhzbn6ZZRde6CEYhPxarfsqzKfruLj7ZFKx/S6ofMEBGiVgVkB8PUEJlTatR45OYA== X-Google-Smtp-Source: AGHT+IGR6XOngIxyJsn7jIny8gY/UO017efMVZzWvuY3pmSVIWuSXJ0H3mThmRI3bxGFI7dOPks2 X-Received: by 2002:a05:6a21:3981:b0:1ad:7e4d:6dae with SMTP id ad1-20020a056a21398100b001ad7e4d6daemr401028pzc.6.1713900921580; Tue, 23 Apr 2024 12:35:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713900921; cv=pass; d=google.com; s=arc-20160816; b=StW0euSerIQC6dQVrJSPeSnUgTM7ahPRTftt42pKF5TNLNSavqfw2dhZBbeURXuvTq QWPiHjc1CP1Wll9a4rKXBvUC0PeoONl9DVWTYp9uu4vQX608bqkrjUarLS3R2o0qKuk8 4E+hO1FVcntsd/UR+FI8jSlpBDehQz7XDdwcFjHKa3jMnpTF1wBmfGh1FLqUIKeDu8Vb 1tJahe1DPsy6AuuliuVA8XOpwXCH6wMO0vTQDEuNZXgbWG62EOyHybzlJQSk1fHqQ5eF ZvM4MviiwvLJjZj3Czuebnn1TKUWJ8cupYfLfzsqlGb0vdjQ9kIra8QDkIETAk4qMEUI f2yg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5QkWEsjSlic11zsHJlVfBJkI2DHefGMGv2edG64OWvE=; fh=jiqagxLbWbBMF93Si4vwFidqAQD8bI0mu9AP9AdUwbE=; b=j8bW7d+PleeOjjKd4A1tGgvxJRBbBCQ4qH8TO8/9rcuFcNAC3wPbkjqJ33jukmGsfv wYEuu06MwBPHmIFxZF+IQQzAhmEReV4aA95yzDvej41572GA6VKQiC2FKRrkYoRPHsCw DB8fVk7V0zJx9PzAm8Z4QwQlTm6ZqTM2GD/w3PWEqVL8gUFRq8RJSbWKP50GtpXuUqKx ApePe6+1LABri7t+oL1HyRRT+XnJrN4sSAVY9h9ShsIxefmAG2P68oCpjo7ncn+e++BR vqeFb9Lhsft4UAYXSwMchLLIJqAvIOSHD26XfG9fRedj0Dyj/q0WGWOgL/EOEx9p8Atn wsUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=hzFa8ov+; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-155786-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155786-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i2-20020a17090a058200b002a6aa10da05si10011048pji.156.2024.04.23.12.35.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 12:35:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155786-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=hzFa8ov+; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-155786-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155786-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D8566B22E7B for ; Tue, 23 Apr 2024 19:15:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55D6213FD99; Tue, 23 Apr 2024 19:15:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="hzFa8ov+" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 4D8C413F458; Tue, 23 Apr 2024 19:15:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713899730; cv=none; b=Mz82otAydzd6Cp88CbMbFqSVep5/lfQqfXEabO6G7f8K32Xsd2nYZgOf/+I1Z/pJdv4z42WYToSgmW8IJF/h6/iFsx0eJfRUxbSNnoKu+FwTB490RorrViwdRiX+c5n77hAR2Jweyx9ibK1yLImDV5xyYoDUPireS1bbGzTy2p4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713899730; c=relaxed/simple; bh=NamVyGNhcAdeE0FhFAkCQho8WPc4LSkNyW3eImgeIWg=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=o2cUGzottuBXjSgTk0ebQNsnDB2BCpS2fM/hRxJuSKrw0uhRwg25Ja3GYDrv8PXnxv+mHDHFqZ4hDzg0MoKPp9xRdIParWijagDG5q1G/EE6cZJh33TE/T1XuE4SAinDBNM0sRRRZGVNOj2A88uLedhWSQcgQ26H5lnXMhLmD3k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=hzFa8ov+; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1713899728; x=1745435728; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=NamVyGNhcAdeE0FhFAkCQho8WPc4LSkNyW3eImgeIWg=; b=hzFa8ov+I39C5k+TN8xuPYAJgxKYhGTThO8EvPyZlaIeyeTQmsV3ALzd l/xkfGbMAFyGSKwot86jYtQWnaOZ7ge01zWMVzlN49UUu31rJso1/G2wD 8P0KTgIkMP7fqINgL0NTnf3xjRI2QPimaKZzfLBi2Fk61L6ToA5YkjmEe 9i7M9OYLs2HXBjQtnIo+8i2eDmAcF0E9kL3oRVgAvaAWJNlGme8F/hu18 h3m9wGigXYgoqrWt6AdHs4LzF964AQ3bIO2Ox0453Tg+RPb2Z3apA8t5H vXcBTfzTVkfQdaQlwkzrV/NRYV8dps62aSkGGlGmt6UFmNOKB4gS+NNgJ A==; X-CSE-ConnectionGUID: Kl1sSzTvQmW3T0xKu8i8cQ== X-CSE-MsgGUID: kh67dMNmQUKYdaHvQwgKZQ== X-IronPort-AV: E=Sophos;i="6.07,222,1708412400"; d="scan'208";a="189648523" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 23 Apr 2024 12:15:27 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 23 Apr 2024 12:15:19 -0700 Received: from DEN-DL-M70577 (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 23 Apr 2024 12:15:16 -0700 Date: Tue, 23 Apr 2024 19:15:16 +0000 From: Daniel Machon To: =?utf-8?Q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= CC: , Steen Hegelund , Lars Povlsen , , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , , Jacob Keller Subject: Re: [PATCH net-next 1/2] net: sparx5: flower: cleanup sparx5_tc_flower_handler_control_usage() Message-ID: <20240423191516.o6ssgqhrsk7hizdk@DEN-DL-M70577> References: <20240423102728.228765-1-ast@fiberby.net> <20240423111515.wzvclnlxdwv77zy7@DEN-DL-M70577> <8e112b31-0168-4e82-a378-87211ea99cfa@fiberby.net> 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="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8e112b31-0168-4e82-a378-87211ea99cfa@fiberby.net> > > > - if (mt.mask->flags) { > > > + if (mt.mask->flags & (FLOW_DIS_IS_FRAGMENT | FLOW_DIS_FIRST_FRAG)) { > > > > Since these flags are used here and in the next patch, maybe assign them > > to a variable: > > > > u32 supp_flags = FLOW_DIS_IS_FRAGMENT | FLOW_DIS_FIRST_FRAG > > > > And update the use throughout. > > In an earlier state this patch had a #define SPARX5_FLOWER_SUPPORTED_CTLFLAGS, > in the same style as nfp in drivers/net/ethernet/netronome/nfp/flower/offload.c > > Right now, this driver supports all currently defined flags (which are used with mask), > so the point of using flow_rule_is_supp_control_flags() to this dirver, is to > make it possible to introduce new flags in the future, without having to update > all drivers to explicitly not support a new flag. > > My problem with using supp_flags in both places is: What happens when support > for a new flag is introduced? > > u32 supp_flags = FLOW_DIS_IS_FRAGMENT | FLOW_DIS_FIRST_FRAG | FLOW_DIS_NEW_FLAG; > > if (mt.mask->flags & (FLOW_DIS_IS_FRAGMENT | FLOW_DIS_FIRST_FRAG)) > /* handle fragment flags through lookup table */ > > if (mt.mask->flags & FLOW_DIS_NEW_FLAG) > /* do something */ > > if (!flow_rule_is_supp_control_flags(supp_flags, mt.mask->flags, extack)) > return -EOPNOTSUPP; > > The fragment lookup table code currently requires the above guarding, > as [0][0] in the lookup table is FRAG_INVAL, and not FRAG_SHRUG. > > What do you think? Yes - lets only check for fragment flags when doing the lookup. I am fine with your original impl. If you can fix the remaining issue, I will take the patches for a test spin tomorrow. Thanks! > > -- > Best regards > Asbj?rn Sloth T?nnesen > Network Engineer > Fiberby - AS42541