From patchwork Thu Sep 29 18:52:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 12994560 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7EA5C433FE for ; Thu, 29 Sep 2022 18:44:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=kG8DXUP2H5HRUQQToi70HBcSdzsd+yBXz/Tg5419J94=; b=up/zO5P6klix2d d2brOVWQI+IugzYDpmL2tly3MVzfsx9bfPYO+X6B7ys8DANXANe+XJ48dzDZTMh+HcGHIaOBjDFH5 Stdqgzi6AtgACPY0ZY1ZIXQNQP858AsA47iJ4/7pf/se1Q0gz63IN2QqL1uc5yN6DiZ5wWydlOnT2 h7UKcodEc6sMuNjKHcW3hQAtRymBGYESVP5yJh29MqcbGxUcu4h5zwbCNkCDdOSs4q8heYKr/0yb+ AFx7Y30S5Gq8PTSNY9YvP51RphOSywDZ/g5DYLIlrkySDVyAaLG2Qc/QfKtXVjzYzBbB8uXnZZeDx l6YqPWMl9fseaIOQ1j/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1odyUr-004ykI-QD; Thu, 29 Sep 2022 18:42:57 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1odyUf-004ydg-Fr for linux-arm-kernel@lists.infradead.org; Thu, 29 Sep 2022 18:42:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1664476965; x=1696012965; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=XcFyeGyj+/KZjiaV4KJsJEm4D8dAIds+Oq3niZxyoSA=; b=KzkP3vKWNWo2d1l2Xv01eZGV1I2/xkxitb4QuuSKEHhOFd18uoDBMGh6 eYRaCsMPwcK69Na1LaGTK3fnlRFFmpeDpONGczfnTJYcK/N+qXpJ8ZnqE TDZqPEieigl0YhYoNevn0VfLJzNMQ4UGLCu0ugCJyToHskJ6NJDLHJPWD AIbKPwDCJb3qH0dgKXQGl8fwonJZ72THgWRzbcb2Tns3LYubAU//HuzA6 5vZA32VouMM/nMapRRXl6QBHZUFefgzOaLL7+owJFzpc7sIw0HajcL2Ew wog1oJVHCEltI376mDfHABH9bQr/WUswJv1+nWCYEJTeZ/RxqZSyUBgEL w==; X-IronPort-AV: E=Sophos;i="5.93,356,1654585200"; d="scan'208";a="193094656" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 29 Sep 2022 11:42:32 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Thu, 29 Sep 2022 11:42:28 -0700 Received: from DEN-LT-70577.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; Thu, 29 Sep 2022 11:42:24 -0700 From: Daniel Machon To: CC: , , , , , , , , , , , , , , , , , Subject: [PATCH net-next v2 0/6] Add new PCP and APPTRUST attributes to dcbnl Date: Thu, 29 Sep 2022 20:52:01 +0200 Message-ID: <20220929185207.2183473-1-daniel.machon@microchip.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220929_114245_600696_FB722DC5 X-CRM114-Status: GOOD ( 17.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch series adds new extension attributes to dcbnl, for PCP queue classification and per-selector trust and trust order. Additionally, the microchip sparx5 driver has been dcb-enabled to make use of the new attributes to offload PCP, DSCP and Default prio to the switch, and implement trust order of selectors. For pre-RFC discussion see: https://lore.kernel.org/netdev/Yv9VO1DYAxNduw6A@DEN-LT-70577/ For RFC series see: https://lore.kernel.org/netdev/20220915095757.2861822-1-daniel.machon@microchip.com/ In summary: there currently exist no convenient way to offload per-port PCP-based queue classification to hardware. Similarly, there is no way to indicate the notion of trust for APP table selectors. This patch series addresses both topics. PCP based queue classification: - 8021Q standardizes the Priority Code Point table (see 6.9.3 of IEEE Std 802.1Q-2018). This patch series makes it possible, to offload the PCP classification to said table. The new PCP selector is not a standard part of the APP managed object, therefore it is encapsulated in a new non-std extension attribute. Selector trust: - ASIC's often has the notion of trust DSCP and trust PCP. The new attribute makes it possible to specify a trust order of app selectors, which drivers can then react on. DCB-enable sparx5 driver: - Now supports offloading of DSCP, PCP and default priority. Only one mapping of protocol:priority is allowed. Consecutive mappings of the same protocol to some new priority, will overwrite the previous. This is to keep a consistent view of the app table and the hardware. - Now supports dscp and pcp trust, by use of the introduced dcbnl_set/getapptrust ops. Sparx5 supports trust orders: [], [dscp], [pcp] and [dscp, pcp]. For now, only DSCP and PCP selectors are supported by the driver, everything else is bounced. Patch #1 introduces a new PCP selector to the APP object, which makes it possible to encode PCP and DEI in the app triplet and offload it to the PCP table of the ASIC. Patch #2 Introduces the new extension attributes DCB_ATTR_DCB_APP_TRUST_TABLE and DCB_ATTR_DCB_APP_TRUST. Trusted selectors are passed in the nested DCB_ATTR_DCB_APP_TRUST_TABLE attribute, and assembled into an array of selectors: u8 selectors[256]; where lower indexes has higher precedence. In the array, selectors are stored consecutively, starting from index zero. With a maximum number of 256 unique selectors, the list has the same maximum size. Patch #3 Sets up the dcbnl ops hook, and adds support for offloading pcp app entries, to the PCP table of the switch. Patch #4 Makes use of the dcbnl_set/getapptrust ops, to set a per-port trust order. Patch #5 Adds support for offloading dscp app entries to the DSCP table of the switch. Patch #6 Adds support for offloading default prio app entries to the switch. ================================================================================ RFC v1: https://lore.kernel.org/netdev/20220908120442.3069771-1-daniel.machon@microchip.com/ RFC v1 -> RFC v2: - Added new nested attribute type DCB_ATTR_DCB_APP_TRUST_TABLE. - Renamed attributes from DCB_ATTR_IEEE_* to DCB_ATTR_DCB_*. - Renamed ieee_set/getapptrust to dcbnl_set/getapptrust. - Added -EOPNOTSUPP if dcbnl_setapptrust is not set. - Added sanitization of selector array, before passing to driver. RFC v2 -> (non-RFC) v1 - Added additional check for selector validity. - Fixed a few style errors. - using nla_start_nest() instead of nla_start_nest_no_flag(). - Moved DCB_ATTR_DCB_APP_TRUST into new enum. - Added new DCB_ATTR_DCB_APP extension attribute, for non-std selector values. - Added support for offloading dscp, pcp and default prio in the sparx5 driver. - Added support for per-selector trust and trust order in the sparx5 driver. v1 -> v2 - Fixed compiler and kdoc warning Daniel Machon (6): net: dcb: add new pcp selector to app object net: dcb: add new apptrust attribute net: microchip: sparx5: add support for offloading pcp table net: microchip: sparx5: add support for apptrust net: microchip: sparx5: add support for offloading dscp table net: microchip: sparx5: add support for offloading default prio .../net/ethernet/microchip/sparx5/Makefile | 2 +- .../ethernet/microchip/sparx5/sparx5_dcb.c | 287 ++++++++++++++++++ .../ethernet/microchip/sparx5/sparx5_main.h | 4 + .../microchip/sparx5/sparx5_main_regs.h | 127 +++++++- .../ethernet/microchip/sparx5/sparx5_netdev.c | 1 + .../ethernet/microchip/sparx5/sparx5_port.c | 99 ++++++ .../ethernet/microchip/sparx5/sparx5_port.h | 33 ++ .../ethernet/microchip/sparx5/sparx5_qos.c | 4 + include/net/dcbnl.h | 4 + include/uapi/linux/dcbnl.h | 15 + net/dcb/dcbnl.c | 126 +++++++- 11 files changed, 691 insertions(+), 11 deletions(-) create mode 100644 drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c --- 2.34.1