Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1908816rwl; Wed, 12 Apr 2023 21:51:21 -0700 (PDT) X-Google-Smtp-Source: AKy350bsvrZQoQSHXTaknk+L8e4zNKe/qZZ0dPFx6PhEJM+Bldx/HLKzXv3/Y0V9aUn8tlRxC0rD X-Received: by 2002:aa7:d74c:0:b0:505:5e8:6641 with SMTP id a12-20020aa7d74c000000b0050505e86641mr1300155eds.19.1681361481043; Wed, 12 Apr 2023 21:51:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681361481; cv=none; d=google.com; s=arc-20160816; b=U56JeYGkdzLkyXb2oJB/GRAib1vBy8PNaaNXh8QKPSrEb+QhhwLSp3HBPWYdQx8CJi BnUk1FqLi7nlF7XcsTP1Z3dJfGhDoHORe+rfrr3SBHTY1yArzQlK7QKIJilMNMK65FP3 siBD/FMwH6bXUlBZ/W4ID6w5JTlvLo9VAym8DjON1WjqOVX+OmYnv1IogOB6EgdtjRYc SCf5FKqFyLIEyYgglnh2gaEFyxg3azOpn0a7cNhQnVIZvtfom5xXSl1VUcZUvf+TwTxc C++2wxxmQ2dWcIltDbGarvX7IPs12KG7s1JLEcEH3lC6YY45DZHPkaucJ6fqEnumkrfY cOFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=DYqKEdPJmdl6aqQHPurZZIOVykgbwb2IZjvq6DDi9SQ=; b=lA0R94ZFgxxkN0cl0O+2LO5UUkd0bsnUD3BVmL2iwStYFdMmqeUdF5eQWRdTWX/Q/7 a6GzOpGY33sQ2PsdEC5y62eJV2aV5Fc/LaK8pbtVGjt0RKH5rtxNxn0pOoT1h49Lni4r MhyNOOE9wVFtlZnPmSk2COdNNa16vOjhTlHIuo72JavQisevdYqaSbLW38xq9y30VkEX MVZPuE4jnS5j95BsYznxO7I0Xit2eu0MXYFYj/1K5L1cEvLQ7zuZOUELEz3MjhKs+6ll xdjXMNEEkxNjs0WMktRzXDygPKkpvlv1Lg+JZricv6j3WKabR9bG6qeT2+V/7uVS8VIZ r64w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v21-20020aa7d9d5000000b005066c6e4c4asi771459eds.403.2023.04.12.21.50.54; Wed, 12 Apr 2023 21:51:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229820AbjDME3w (ORCPT + 99 others); Thu, 13 Apr 2023 00:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjDME3v (ORCPT ); Thu, 13 Apr 2023 00:29:51 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 822FA2708 for ; Wed, 12 Apr 2023 21:29:48 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pmoaY-0005Ck-8l; Thu, 13 Apr 2023 06:29:38 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1pmoaW-0000UJ-95; Thu, 13 Apr 2023 06:29:36 +0200 Date: Thu, 13 Apr 2023 06:29:36 +0200 From: Oleksij Rempel To: "David S. Miller" , Andrew Lunn , Eric Dumazet , Florian Fainelli , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , Woojung Huh , Arun Ramadoss Cc: kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com Subject: Re: [PATCH net-next v1 2/2] net: dsa: microchip: Add partial ACL support for ksz9477 switches Message-ID: <20230413042936.GA12562@pengutronix.de> References: <20230411172456.3003003-1-o.rempel@pengutronix.de> <20230411172456.3003003-3-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230411172456.3003003-3-o.rempel@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 On Tue, Apr 11, 2023 at 07:24:55PM +0200, Oleksij Rempel wrote: ... > drivers/net/dsa/microchip/ksz9477_acl.c | 950 ++++++++++++++++++++++++ I'll better split tc-flower code and ACL code to separate files. This chips support other engines which can be used for priority remaping. For example DiffServ/DSCP > drivers/net/dsa/microchip/ksz_common.c | 40 + > drivers/net/dsa/microchip/ksz_common.h | 1 + ... > +/** > + * ksz9477_acl_port_enable - Enables ACL functionality on a given port. > + * @dev: The ksz_device instance. > + * @port: The port number on which to enable ACL functionality. > + * > + * This function enables ACL functionality on the specified port by configuring > + * the appropriate control registers. It returns 0 if the operation is > + * successful, or a negative error code if an error occurs. > + */ > +static int ksz9477_acl_port_enable(struct ksz_device *dev, int port) > +{ > + int ret; > + > + ret = ksz_prmw8(dev, port, P_PRIO_CTRL, 0, PORT_ACL_PRIO_ENABLE | > + PORT_OR_PRIO); According to KSZ9477S 5.2.8.2 Port Priority Control Register "To achieve the desired functionality, do not set more than one bit at a time in this register. ... Bit 6 - OR’ed Priority ... Bit 2 - 802.1p Priority Classification Bit 1 - Diffserv Priority Classification Bit 0 - ACL Priority Classification " @Arun what will happen if multiple engines are used for packet prioritization? For example ACL || Diffserv || 802.1p... ? If I see it correctly, it is possible but not recommended. Should I prevent usage of multiple prio sources? > + if (ret) > + return ret; > + > + return ksz_pwrite8(dev, port, REG_PORT_MRI_AUTHEN_CTRL, > + PORT_ACL_ENABLE | > + FIELD_PREP(PORT_AUTHEN_MODE, PORT_AUTHEN_PASS)); > +} Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |