Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1974043lqe; Tue, 9 Apr 2024 06:21:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWi/7bgpuRh7VoZFfPwnsiQuVsQUCjwG+45gqnx+FrnQHDXHpMAYxGeXFktsnMvIpzfeZOSZSyHvqUjDpwcJzazi4XxlCNZ2L+7foNxwg== X-Google-Smtp-Source: AGHT+IGFRBCQvFrS2dTme+nlPmyY0fiXLpoSr6xg3QJrvVD9+Cd411zmWjsP2PjP0CNIf/jMHAmK X-Received: by 2002:a05:6a20:9155:b0:1a5:6b5b:c0c5 with SMTP id x21-20020a056a20915500b001a56b5bc0c5mr13065154pzc.14.1712668896555; Tue, 09 Apr 2024 06:21:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712668896; cv=pass; d=google.com; s=arc-20160816; b=f3mwNKXs0yXhOPG7bBe/hhg2hh55K20c9Z7p/SjX2TaA3L48x/9SRM6yHb5k4LkcLC Qp7wAtu07H5Ka+Yb0583sgyIyqWuEMDe5hJJpZbxpEdDZUPPrcfomygMWfKw2Fm36uGQ o1PgOAEYCWpeH1I08kOUVowaikDeK+i+GqVlcG8zgmNAeQDXLiw4VI08crH8pTKstUsv afsEstd5lEQv8WDP6pH5QjVyCR+x+z9XNqDlbTSgZBCbQfFwEodVu4bBlyNMJYaGdOwl +mepYA7fbJ0PXzUJlXDLB/GG+qYEnA44o30O57BiJMPXGbHliJ7MBuysYUKwI5LgX8lE OitQ== 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=/+aXGF7QnNHGVR0vZ6lS5/hmnAvGpMYtxJl/kMOLPgQ=; fh=E8jjMbq+IIeuklg9WrtLwFMig4bF6+Ti9AW8YIYVQqw=; b=hLnmiLU+fJpCvjLWjX7dtivz/9YvXZEgKFXBDzdXHGNMhGnMppZigSDKr4GWAcXZZJ eX7B6kwkZCBUC2jdA78cYZGoHOk0NhzgXwydNXMUXt+mRWqMRAg/w8waWHG7o3lZeHeX ygY41DEvFdepi1xySEZQ43Lux/cr5TA0CRKeLJJznzvE8Np95M8X9DLyBgHpn5c49Hyl FgtMeLCVAPksRfyOhFiOTdP0Afeq76wW/E/NljD3MKd1Bv8Ma0eCrWBOFn6n2uQPXX/e ltaItesK5Nmc6XPwYAahzXo3An4fSq0dKLtQYb5tqPDhtkCfCwzbfbbVQsJgRNDBfP5x V7SQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="m/7BQlwH"; 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-136928-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136928-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i5-20020a170902cf0500b001e4809380e0si2176561plg.444.2024.04.09.06.21.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 06:21:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136928-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="m/7BQlwH"; 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-136928-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136928-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3854C282FB5 for ; Tue, 9 Apr 2024 13:21:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55C0112F38D; Tue, 9 Apr 2024 13:21:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="m/7BQlwH" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 697A78175E; Tue, 9 Apr 2024 13:21:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712668885; cv=none; b=eeHKuSVZFFf7pICPbAGADuWI3g3G6EJyutywAlGUFwLvWYhapuOCGxvWYWpIZ61ZbvgJWmied+yM7AnOL3uqeH1NLkHVrpkmaOh1/P41UkBQNib0t57gfku9DLPQjAisR6ubHgT2/p74FzLEQ7UFkJ58DkD2TqckSTL9n1D+Blw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712668885; c=relaxed/simple; bh=+d2BOCUd0ebFCs99YmQIURG9qs3Tl6AOpmQ6gm+Q00M=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WlfRPnPlLbXPTxvznA16va+QlEudi2blWaR0AHq/LwCJestU72ZCuFviPVeSZSzdoYIZMEnzGcdadYCYgTlZEV3i+yWJUyn47b1w3AvSu7iGA9CJgNWuNKbFOPJknj6mTaVnqThz9PVZQb/i9Y6W6zcahYlckADJSPxOmiVHO78= 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=m/7BQlwH; arc=none smtp.client-ip=68.232.153.233 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=1712668884; x=1744204884; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=+d2BOCUd0ebFCs99YmQIURG9qs3Tl6AOpmQ6gm+Q00M=; b=m/7BQlwHeXj8N03SKkW683M0xs4NQ+oEEu3ZikGsQVwnDEq4mNaKZ3JW pk/VeLVyuUnGLxiO2aAp+GJ0CtSb2qe18il09JazY7Pq3ohMEBVynt9+M iP2FIQgE5nndzdJAzqKugphERBFtCZwn8tfVUYohJte6AFnUcTYkKe9uW fTSazvB77rGSD10yf75r0KaFTWqOlPq3VYncvkelrrHUcmuHb9pFA+wXy A35E60Q/+wrePe2ZFhiS+I2aECUcXxBG4SpczZC/7JS+7MU6IAgV3WHDS /9Is7ollbqtjvoMHmUamKBihGzGXu4JlAC9u3/Ph61MwvTZdcNd3xXfRK Q==; X-CSE-ConnectionGUID: 4u0sR9+kRH2p6uXBRTNgRQ== X-CSE-MsgGUID: 4ejcv+uLRd6CbWIvbWcoaQ== X-IronPort-AV: E=Sophos;i="6.07,189,1708412400"; d="scan'208";a="20192869" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Apr 2024 06:21:17 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 9 Apr 2024 06:20:48 -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, 9 Apr 2024 06:20:44 -0700 Date: Tue, 9 Apr 2024 13:20:43 +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 , , , Subject: Re: [PATCH net] net: sparx5: flower: fix fragment flags handling Message-ID: <20240409132043.gaf5heor5vx42j3j@DEN-DL-M70577> References: <20240408172738.96447-1-ast@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="us-ascii" Content-Disposition: inline In-Reply-To: <20240408172738.96447-1-ast@fiberby.net> > I noticed that only 3 out of the 4 input bits were used, > mt.key->flags & FLOW_DIS_IS_FRAGMENT was never checked. > > In order to avoid a complicated maze, I converted it to > use a 16 byte mapping table. > > As shown in the table below the old heuristics doesn't > always do the right thing, ie. when FLOW_DIS_IS_FRAGMENT=1/1 > then it used to only match follow-up fragment packets. > > Here are all the combinations, and their resulting new/old > VCAP key/mask filter: > > /- FLOW_DIS_IS_FRAGMENT (key/mask) > | /- FLOW_DIS_FIRST_FRAG (key/mask) > | | /-- new VCAP fragment (key/mask) > v v v v- old VCAP fragment (key/mask) > > 0/0 0/0 -/- -/- impossible (due to entry cond. on mask) > 0/0 0/1 -/- 0/3 !! invalid (can't match non-fragment + follow-up frag) > 0/0 1/0 -/- -/- impossible (key > mask) > 0/0 1/1 1/3 1/3 first fragment > > 0/1 0/0 0/3 3/3 !! not fragmented > 0/1 0/1 0/3 3/3 !! not fragmented (+ not first fragment) > 0/1 1/0 -/- -/- impossible (key > mask) > 0/1 1/1 -/- 1/3 !! invalid (non-fragment and first frag) > > 1/0 0/0 -/- -/- impossible (key > mask) > 1/0 0/1 -/- -/- impossible (key > mask) > 1/0 1/0 -/- -/- impossible (key > mask) > 1/0 1/1 -/- -/- impossible (key > mask) > > 1/1 0/0 1/1 3/3 !! some fragment > 1/1 0/1 3/3 3/3 follow-up fragment > 1/1 1/0 -/- -/- impossible (key > mask) > 1/1 1/1 1/3 1/3 first fragment > > In the datasheet the VCAP fragment values are documented as: > 0 = no fragment > 1 = initial fragment > 2 = suspicious fragment > 3 = valid follow-up fragment > > Result: 3 combinations match the old behavior, > 3 combinations have been corrected, > 2 combinations are now invalid, and fail, > 8 combinations are impossible. > > It should now be aligned with how FLOW_DIS_IS_FRAGMENT > and FLOW_DIS_FIRST_FRAG is set in __skb_flow_dissect() in > net/core/flow_dissector.c > > Since the VCAP fragment values are not a bitfield, we have > to ignore the suspicious fragment value, eg. when matching > on any kind of fragment with FLOW_DIS_IS_FRAGMENT=1/1. > > Only compile tested, and logic tested in userspace, as I > unfortunately don't have access to this switch chip (yet). Ran VCAP test-suites - seems good. Thanks! Tested-by: Daniel Machon