From patchwork Wed Nov 2 11:57:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 14196 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3572207wru; Wed, 2 Nov 2022 04:58:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5dxnjEugMegfNhRuktt1helSEpUKnP39OfDnKiMHF0TmqOuk9Rn2/SEyTsn76ijsj88brz X-Received: by 2002:a17:906:9b87:b0:733:1795:2855 with SMTP id dd7-20020a1709069b8700b0073317952855mr23594083ejc.156.1667390336449; Wed, 02 Nov 2022 04:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667390336; cv=none; d=google.com; s=arc-20160816; b=Y7e+sNVV3vb5isZnspGSxe0g4r4cfWK3Hhx4fBkf3vogEWYX8Ra9wS/Ve2yYU/c5OB NgTm17PmdJBaI4e4XAZ5VEXNEZx3fI4aosf3nrCYeOSMC0Wr6Psx+gmlCqmy8NJiRcjl um3lx2eEYhWMspwTrByP5nuMjDCGtx8GozPeWhrIn7toeZxsa5cJDKJwfnC7xOhnJryI 94J9oSGkcQMicr0O9c90qVTa7j9G8Nfy9kU5wyJyza9uKoZ8FQTRDOvUkTXCJ3XnYrVY 0uTdtlGAKqE59nXxuN9TaYEHN7o/Bwsq4PFPiGkapX/SgPXq0lEF2GmyVxP4+x21DJlm F4Ow== 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=vx7azENjCJqaj/lsp8ZmBqXhpzs40+bUKkmwr7llbFP97fcYnazeRvL3qr+5OqTlGs h4yIoohqdAMyifq+FY5gWQF9yeNdSyZWA6JhEegmGiDIBUWu+bnqd7yrD093SeJI1fH0 KSFVsGI63gxGDXtCtoM0ZAXxqdroXifu55FkyATo4QuPnFeFin+EArJWblbYJfg/LYtD kklzBwAAyOh2W/b6uFgMNwQiNWAyLmr7dlXhn0BabB4ycuVa2fb5S0YcHPlKDOipz6vr J34eYkO8Zu6zWsqc1liP7umoRDvzyRwv4fRHnjod5oYZZ0URjBR61q7dOEe6/V6BB65a Uw7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="T9/HkbkU"; 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 j8-20020aa7c0c8000000b0043d54ba0a4dsi12575287edp.327.2022.11.02.04.58.32; Wed, 02 Nov 2022 04:58:56 -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="T9/HkbkU"; 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 S230462AbiKBL6D (ORCPT + 99 others); Wed, 2 Nov 2022 07:58:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230366AbiKBL5w (ORCPT ); Wed, 2 Nov 2022 07:57:52 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00FD527FD4; Wed, 2 Nov 2022 04:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1667390271; x=1698926271; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZDHBa9bzc08ycTyWSkWtXZaUle+cl64Y3IvIAL+eqRc=; b=T9/HkbkUiaGtiAu2C8do8t3aTNhX7IpRvp+7zblroKEUJ3IJ+f1bXebU 5VB3TBe4JatVoNvdjYzyzSPNe2FXp/NdKqtvBC+yebn/H0yJyCkjygOvP 1CQZRvRSqeQ5XC2E0ayi7F//PG4UtTDnQC+k+o6xJkBHi8KNHgb1QkgmO 7V1uJ8o7yCnflapIz64js34/v+rk/8l7nfyl1h2ekwzSdLXpCMLDbjYr0 m3l9P540Q6adF+t1+f/zB20iEfO6r9GAI6tkhwp3/YeLGFZt1XZSQR0R9 WTz7oWMcsWa/VIxjqlqwBxqEW3N+JL/4NI2gFTRQBW9gkFix2UmBxeBVj g==; X-IronPort-AV: E=Sophos;i="5.95,232,1661842800"; d="scan'208";a="121449327" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Nov 2022 04:57:51 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Wed, 2 Nov 2022 04:57:49 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Wed, 2 Nov 2022 04:57:46 -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 v4 1/7] net: microchip: sparx5: Differentiate IPv4 and IPv6 traffic in keyset config Date: Wed, 2 Nov 2022 12:57:31 +0100 Message-ID: <20221102115737.4118808-2-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221102115737.4118808-1-steen.hegelund@microchip.com> References: <20221102115737.4118808-1-steen.hegelund@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-5.5 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?1748385489229876624?= X-GMAIL-MSGID: =?utf-8?q?1748385489229876624?= 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,