Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2844071lqt; Tue, 23 Apr 2024 03:28:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUvGvJhOwv4EniDAI8Cw4xl+stEwO379arfapvs87wil+r9taDTbRk8kmu1pdgD2VYGtDpP6LU+TVpmtvE+RyUgEB3VpPtAcWCWwiHHig== X-Google-Smtp-Source: AGHT+IGGIGnThpZvhDKC506efZhATtAqidepjBPmYsx32yldNhfjCXaXMGaiXL4p5JIwHWBHyX5J X-Received: by 2002:a05:6a20:9702:b0:1a7:c1a0:d33b with SMTP id hr2-20020a056a20970200b001a7c1a0d33bmr10835440pzc.39.1713868125065; Tue, 23 Apr 2024 03:28:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713868125; cv=pass; d=google.com; s=arc-20160816; b=Rx6DMBrm0XqZ+PxUDV3m9DyjP//qmtyHVWDL6EdwvNcxSE/sP4yHxNwSKQ7QeMRk58 couZjhMbcsCIktYbonfSAVREKxDrmUFRJQp/+3sPRObl7b3YBpKAAvzZWF1nAAndXipb AA23qljjYa3VKaNGnTxwY+K5hWeTNhptD/LKIslWLaKSg1jxL5xQq7/jbzcqT1lqTM2Q Dh69TmFaRtMx6ih1svlnekEYReiTpCHEClcbetsCyD7r1Kmt7dF8mVpZf/n7wb75kolh 905xVzpj09NFRYa5hLciGPmEcaBxHG2XNSWlZdHiOcD72ZlxKw/UdvjjC8RvEUlIlrkG /5og== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=slyGjPs2S3z7jnrkI0zpYUagMY3BNsSRFbMdGTaNwz8=; fh=VaGZNRtL2a8L+IBErWotuWnhUHCanI2uY5tbzuzsMD8=; b=xuT7KJzd98lBw4UIcc7bnvweN+NITzgTppqF9d7E4MUydggDjqyjbRHXxB6NioFOhr FSI1akXYHZPtJuJCDXpnwfAlAHq5VI3gE/dSc8SU+LjbapYsoLiPBrjHF+4iFLTJoGM+ Az7C7OXQZiALe+YrG6z/qEtDxg2Ct/hEJQ2ZWDMUTGM/WA8tlJC4kxXi/GPWCaCLjvlv M8zrJNo4NdrIq10YP/GhPWvnMwc3YBVccp+q+oYMTlgzV384jxy9cQoUg3XEZuqP9aqF wAVcRkNnzGFK99I6Jk0coSoSSxHUdYmv6ZAm6FT8/iSlaf89JRJ9DflWeLrYbkZWPMt4 rWxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b="m/eVUzYp"; arc=pass (i=1 spf=pass spfdomain=fiberby.net dkim=pass dkdomain=fiberby.net dmarc=pass fromdomain=fiberby.net); spf=pass (google.com: domain of linux-kernel+bounces-154863-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154863-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g19-20020a63f413000000b005d8e12c85d9si9492004pgi.738.2024.04.23.03.28.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 03:28:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154863-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=@fiberby.net header.s=202008 header.b="m/eVUzYp"; arc=pass (i=1 spf=pass spfdomain=fiberby.net dkim=pass dkdomain=fiberby.net dmarc=pass fromdomain=fiberby.net); spf=pass (google.com: domain of linux-kernel+bounces-154863-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154863-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net 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 65264283658 for ; Tue, 23 Apr 2024 10:28:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E7BB7641E; Tue, 23 Apr 2024 10:28:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="m/eVUzYp" Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (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 04EDD605CE; Tue, 23 Apr 2024 10:28:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713868096; cv=none; b=eor4FLT1YwKQkFGx0CAIBkqJcB1/+uZGVXRpXvI5QX3d2sACtbF0+elWLqI6VR65+UuVP0irCeNYv+OispdeGAh+eYdUJaRyjVoA+bgca/o4nLtDVaH+MKGZEa9KVojp/b1wpuEUc2g/EgCM8UV6m5qCr+zua3yOFe4DtsKLOv8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713868096; c=relaxed/simple; bh=GbgbLIqVueZ79treKLS9iJdrUpv0NyzGAiOwzj39kYE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Pq8sYY15/NVIbZzaDf7QULRUQiYo0VdQzlNYpAbaDg5Mi+5wxeUsrZdJf5OIKY0aT7FTubiqNzyibQ3nH8RnUZH5vwT6u5YPVsMyWvmnonQh+pBekyGcwZ4d745d13g/uL9n2mcYdxfpaR0e3TcnxOgwsr1P3/9zH5H8+2MRIqY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=m/eVUzYp; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 65025600A9; Tue, 23 Apr 2024 10:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1713868084; bh=GbgbLIqVueZ79treKLS9iJdrUpv0NyzGAiOwzj39kYE=; h=From:To:Cc:Subject:Date:From; b=m/eVUzYpskwtknJ9ZxlPozVo6QZWCQ9FbQhylstWuaw96kOicAQ4lt29ijTTjFlzb Tsb1C5zX0fWPEtFFf0e64LTfiK2meqbJCZDi7RFwPRUx+ONsGs4cCkYCyLwiMd2wsU 2TMWHgORu24xnX/c3gSLYNmwtk+trf8Qbpmimf911ZPCzaWD4/eFAezCBcexaioCPq kscjMw2YI9kcOOb4q4WX7QokQbCdXR6u5+haiI6eqPE3gdv+JEhE6k4/osm2Qr/Mtj fZz9bfmZvxDwLrG0Lrel8ewMXXbM2wcbG7TR3PZZe1I7aH0ys5rTeyD+hofwBFizwX f0IlLltH+JjcA== Received: by x201s (Postfix, from userid 1000) id C7456216B91; Tue, 23 Apr 2024 10:27:28 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , Steen Hegelund , Lars Povlsen , Daniel Machon , UNGLinuxDriver@microchip.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, Jacob Keller Subject: [PATCH net-next 1/2] net: sparx5: flower: cleanup sparx5_tc_flower_handler_control_usage() Date: Tue, 23 Apr 2024 10:27:26 +0000 Message-ID: <20240423102728.228765-1-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 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=UTF-8 Content-Transfer-Encoding: 8bit Define extack locally, to reduce line lengths and future users. Only perform fragment handling, when at least one fragment flag is set. Remove goto, as it's only used once, and the error message is specific to that context. Only compile tested. Signed-off-by: Asbjørn Sloth Tønnesen --- .../ethernet/microchip/sparx5/sparx5_tc_flower.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c index 663571fe7b2d..d846edd77a01 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c @@ -159,13 +159,14 @@ sparx5_tc_flower_handler_basic_usage(struct vcap_tc_flower_parse_usage *st) static int sparx5_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st) { + struct netlink_ext_ack *extack = st->fco->common.extack; struct flow_match_control mt; u32 value, mask; int err = 0; flow_rule_match_control(st->frule, &mt); - if (mt.mask->flags) { + if (mt.mask->flags & (FLOW_DIS_IS_FRAGMENT | FLOW_DIS_FIRST_FRAG)) { u8 is_frag_key = !!(mt.key->flags & FLOW_DIS_IS_FRAGMENT); u8 is_frag_mask = !!(mt.mask->flags & FLOW_DIS_IS_FRAGMENT); u8 is_frag_idx = (is_frag_key << 1) | is_frag_mask; @@ -190,17 +191,15 @@ sparx5_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st) err = vcap_rule_add_key_u32(st->vrule, VCAP_KF_L3_FRAGMENT_TYPE, value, mask); - if (err) - goto out; + if (err) { + NL_SET_ERR_MSG_MOD(extack, "ip_frag parse error"); + return err; + } } st->used_keys |= BIT_ULL(FLOW_DISSECTOR_KEY_CONTROL); return err; - -out: - NL_SET_ERR_MSG_MOD(st->fco->common.extack, "ip_frag parse error"); - return err; } static int -- 2.43.0