From nobody Fri Dec 19 21:47:57 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFFDBC00144 for ; Mon, 1 Aug 2022 12:16:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234409AbiHAMQo (ORCPT ); Mon, 1 Aug 2022 08:16:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234320AbiHAMPc (ORCPT ); Mon, 1 Aug 2022 08:15:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1D1441981; Mon, 1 Aug 2022 04:58:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9282BB80EAC; Mon, 1 Aug 2022 11:58:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E304AC433D7; Mon, 1 Aug 2022 11:58:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659355102; bh=LARZAiDrC/yVd6yIGxBo8r5qc1cW9qVjsXp3JdlPGDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NI1M9BddxTbnQ6Mlsp6AV+SrQUKZmPCQvIk2ygze5s+Nif3oGFCSn/97JwlS8o5GQ WaqFb8sf77CilotN/qQotAjUXCuwYePnXPhutGxVt8iejLA4E3pGCiczbs7z+JmSfD QfQt3IbkPae8Phs+0j6IGs4RFPz85cdwUWVcyppI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Subbaraya Sundeep , Sunil Goutham , Paolo Abeni Subject: [PATCH 5.18 33/88] octeontx2-pf: Fix UDP/TCP src and dst port tc filters Date: Mon, 1 Aug 2022 13:46:47 +0200 Message-Id: <20220801114139.546511574@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220801114138.041018499@linuxfoundation.org> References: <20220801114138.041018499@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Subbaraya Sundeep commit 59e1be6f83b928a04189bbf3ab683a1fc6248db3 upstream. Check the mask for non-zero value before installing tc filters for L4 source and destination ports. Otherwise installing a filter for source port installs destination port too and vice-versa. Fixes: 1d4d9e42c240 ("octeontx2-pf: Add tc flower hardware offload on ingre= ss traffic") Signed-off-by: Subbaraya Sundeep Signed-off-by: Sunil Goutham Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 30 +++++++++++---= ----- 1 file changed, 18 insertions(+), 12 deletions(-) --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c @@ -614,21 +614,27 @@ static int otx2_tc_prepare_flow(struct o =20 flow_spec->dport =3D match.key->dst; flow_mask->dport =3D match.mask->dst; - if (ip_proto =3D=3D IPPROTO_UDP) - req->features |=3D BIT_ULL(NPC_DPORT_UDP); - else if (ip_proto =3D=3D IPPROTO_TCP) - req->features |=3D BIT_ULL(NPC_DPORT_TCP); - else if (ip_proto =3D=3D IPPROTO_SCTP) - req->features |=3D BIT_ULL(NPC_DPORT_SCTP); + + if (flow_mask->dport) { + if (ip_proto =3D=3D IPPROTO_UDP) + req->features |=3D BIT_ULL(NPC_DPORT_UDP); + else if (ip_proto =3D=3D IPPROTO_TCP) + req->features |=3D BIT_ULL(NPC_DPORT_TCP); + else if (ip_proto =3D=3D IPPROTO_SCTP) + req->features |=3D BIT_ULL(NPC_DPORT_SCTP); + } =20 flow_spec->sport =3D match.key->src; flow_mask->sport =3D match.mask->src; - if (ip_proto =3D=3D IPPROTO_UDP) - req->features |=3D BIT_ULL(NPC_SPORT_UDP); - else if (ip_proto =3D=3D IPPROTO_TCP) - req->features |=3D BIT_ULL(NPC_SPORT_TCP); - else if (ip_proto =3D=3D IPPROTO_SCTP) - req->features |=3D BIT_ULL(NPC_SPORT_SCTP); + + if (flow_mask->sport) { + if (ip_proto =3D=3D IPPROTO_UDP) + req->features |=3D BIT_ULL(NPC_SPORT_UDP); + else if (ip_proto =3D=3D IPPROTO_TCP) + req->features |=3D BIT_ULL(NPC_SPORT_TCP); + else if (ip_proto =3D=3D IPPROTO_SCTP) + req->features |=3D BIT_ULL(NPC_SPORT_SCTP); + } } =20 return otx2_tc_parse_actions(nic, &rule->action, req, f, node);