From patchwork Fri Nov 4 14:18:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 15579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432079wru; Fri, 4 Nov 2022 07:19:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kjQwv1Xmjr01QCRnGCyaBoCzALA920Oi78JuMUct8EMLpqhzcRdAngSRIkSR8YQRgXf1y X-Received: by 2002:a17:90a:5a02:b0:212:f91b:b2d0 with SMTP id b2-20020a17090a5a0200b00212f91bb2d0mr55376987pjd.244.1667571577909; Fri, 04 Nov 2022 07:19:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667571577; cv=none; d=google.com; s=arc-20160816; b=H+dpu4aV3AE7hm5iVSYJz3N1V4b31eBQ4ATwzAmOoXROuB+i1cljRNOmrYoLOxr8FC w5nfwGbZDQoq4IFlowsRjG6AIQod0rOPiC+Cdxx2q2ree4lWkqtyQ6QeET99ZRNyNSl+ 0Xl2HOxTGGb8YBBbV5Fui+6icVLg4/9he1CBNPEvgLq5dnMimMmlpjsRPYObYPkkPhxt pPv3yMEDARciPuvhdMTSV7ogFODhPxf7luZTIyz4w941uyyrh5M7DkasNpIa8hSrqAmH Qy/6uvUTyGhRXQzNKPU8YYF/+urktGtd2udPftkYerxqa6aFjoE/s8+OFNoLHqszFDuL UWdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KcQryTHGjqhABISRhAXii3FQJt4T/YbDUDibv+jRExs=; b=BNKqQsZpsMO6qC47Ro6Hq+sp9l5XWNl0Q86NgiyLWBrYZBN01QDG0QMsthoTpruOke PqtSvIGwEudcMIX+85dhaKcWgVRW/GGn63aXRkI1v0dbZnEYi6t6FmXJ7z0e1abIrH1j L4YHEfno4z2E+KYUeGd43G7XXC7NrrgD10Q+Lm+g7hQWqtH3OS636WITQScgLc+OtJv/ f54gxxIp1RRHfNfKO0LXIzn0EQhj7v4jNJ1OIDD30Lrb+1uq1jzLdYfozFtg9o7VyXSz dfnvfvbwKHWVaZCMN4q7WKF9BFP7jswIVOHTWoTCZPDzzerKYToBkKhCwSUkSVCOmw73 ypLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=RV7U20GU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i17-20020a63e451000000b0046edc0a9123si4338738pgk.634.2022.11.04.07.19.24; Fri, 04 Nov 2022 07:19:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=RV7U20GU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232007AbiKDOS7 (ORCPT + 99 others); Fri, 4 Nov 2022 10:18:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230474AbiKDOSs (ORCPT ); Fri, 4 Nov 2022 10:18:48 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FFAE2DA9D; Fri, 4 Nov 2022 07:18:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1667571527; x=1699107527; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZDHBa9bzc08ycTyWSkWtXZaUle+cl64Y3IvIAL+eqRc=; b=RV7U20GU78v0Fjcq+crsVK3A+aUcFiDViDgIUjb9suNm8FomFSnj+Lx0 HmhWTdepyEN1zzxJkCPNA/GSlRHT12jXWM3141dWEQj3/Kv/vOVCfA5Us IvZWdfzPi8fyHnrUoIfJOMpT8GDlFeA5jJglv7je1XvNjR0f/YnccYgDQ bAk2n/C66DoWZvpsBEjFDt3fJnwBulR+ABBnknFUP+LXUp2Pgvu1nGP9Z p/Hz3arAj56PU2jcrGn0Ld8zf9cY56a4IX+/UCsJSup9+yIWEggHrBVsq GrlwPAUrT3PdEb1P6EP2/GBafVg0blUJr3unuT2iqE5NqqyZ+o26xWYjJ Q==; X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="185411539" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Nov 2022 07:18:46 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) 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.12; Fri, 4 Nov 2022 07:18:41 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 4 Nov 2022 07:18:38 -0700 From: Steen Hegelund To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: Steen Hegelund , , Randy Dunlap , "Casper Andersson" , Russell King , Wan Jiabing , "Nathan Huckleberry" , , , , "Daniel Machon" , Horatiu Vultur , Lars Povlsen Subject: [PATCH net-next v5 1/8] net: microchip: sparx5: Differentiate IPv4 and IPv6 traffic in keyset config Date: Fri, 4 Nov 2022 15:18:23 +0100 Message-ID: <20221104141830.1527159-2-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221104141830.1527159-1-steen.hegelund@microchip.com> References: <20221104141830.1527159-1-steen.hegelund@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748575535345993693?= X-GMAIL-MSGID: =?utf-8?q?1748575535345993693?= This changes the port keyset configuration for Sparx5 IS2 so that - IPv4 generates a IP4_TCP_UDP keyset for IPv4 TCP/UDP frames and a IP4_OTHER keyset for other IPv4 frames (both UC and MC) - IPv6 generates a IP_7TUPLE keyset (both UC and MC) ARP and non-IP traffic continues to generate the MAC_ETYPE keyset Signed-off-by: Steen Hegelund --- .../microchip/sparx5/sparx5_vcap_impl.c | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c b/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c index 50153264179e..e4428d55af2b 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c @@ -21,6 +21,14 @@ #define STREAMSIZE (64 * 4) /* bytes in the VCAP cache area */ #define SPARX5_IS2_LOOKUPS 4 +#define VCAP_IS2_KEYSEL(_ena, _noneth, _v4_mc, _v4_uc, _v6_mc, _v6_uc, _arp) \ + (ANA_ACL_VCAP_S2_KEY_SEL_KEY_SEL_ENA_SET(_ena) | \ + ANA_ACL_VCAP_S2_KEY_SEL_NON_ETH_KEY_SEL_SET(_noneth) | \ + ANA_ACL_VCAP_S2_KEY_SEL_IP4_MC_KEY_SEL_SET(_v4_mc) | \ + ANA_ACL_VCAP_S2_KEY_SEL_IP4_UC_KEY_SEL_SET(_v4_uc) | \ + ANA_ACL_VCAP_S2_KEY_SEL_IP6_MC_KEY_SEL_SET(_v6_mc) | \ + ANA_ACL_VCAP_S2_KEY_SEL_IP6_UC_KEY_SEL_SET(_v6_uc) | \ + ANA_ACL_VCAP_S2_KEY_SEL_ARP_KEY_SEL_SET(_arp)) /* IS2 port keyset selection control */ @@ -368,13 +376,12 @@ static void sparx5_vcap_port_key_selection(struct sparx5 *sparx5, /* all traffic types generate the MAC_ETYPE keyset for now in all * lookups on all ports */ - keysel = ANA_ACL_VCAP_S2_KEY_SEL_KEY_SEL_ENA_SET(true) | - ANA_ACL_VCAP_S2_KEY_SEL_NON_ETH_KEY_SEL_SET(VCAP_IS2_PS_NONETH_MAC_ETYPE) | - ANA_ACL_VCAP_S2_KEY_SEL_IP4_MC_KEY_SEL_SET(VCAP_IS2_PS_IPV4_MC_MAC_ETYPE) | - ANA_ACL_VCAP_S2_KEY_SEL_IP4_UC_KEY_SEL_SET(VCAP_IS2_PS_IPV4_UC_MAC_ETYPE) | - ANA_ACL_VCAP_S2_KEY_SEL_IP6_MC_KEY_SEL_SET(VCAP_IS2_PS_IPV6_MC_MAC_ETYPE) | - ANA_ACL_VCAP_S2_KEY_SEL_IP6_UC_KEY_SEL_SET(VCAP_IS2_PS_IPV6_UC_MAC_ETYPE) | - ANA_ACL_VCAP_S2_KEY_SEL_ARP_KEY_SEL_SET(VCAP_IS2_PS_ARP_MAC_ETYPE); + keysel = VCAP_IS2_KEYSEL(true, VCAP_IS2_PS_NONETH_MAC_ETYPE, + VCAP_IS2_PS_IPV4_MC_IP4_TCP_UDP_OTHER, + VCAP_IS2_PS_IPV4_UC_IP4_TCP_UDP_OTHER, + VCAP_IS2_PS_IPV6_MC_IP_7TUPLE, + VCAP_IS2_PS_IPV6_UC_IP_7TUPLE, + VCAP_IS2_PS_ARP_MAC_ETYPE); for (lookup = 0; lookup < admin->lookups; ++lookup) { for (portno = 0; portno < SPX5_PORTS; ++portno) { spx5_wr(keysel, sparx5,