From patchwork Wed Jul 25 13:53:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10544043 X-Patchwork-Delegate: idosch@idosch.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EB43139A for ; Wed, 25 Jul 2018 13:53:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C6FD2A020 for ; Wed, 25 Jul 2018 13:53:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80A942A063; Wed, 25 Jul 2018 13:53:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C71922A020 for ; Wed, 25 Jul 2018 13:53:57 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41bGsw0z8FzDrdf for ; Wed, 25 Jul 2018 23:53:56 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="Ch7eRIHb"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=40.107.0.60; helo=eur02-am5-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="Ch7eRIHb"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00060.outbound.protection.outlook.com [40.107.0.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41bGsn2LqxzDrHN for ; Wed, 25 Jul 2018 23:53:49 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0ApNhXjIx7Tjv6uwyLsxIBqJtz7ESwJGejnKWRctu1Y=; b=Ch7eRIHbV9zDbuAZB5M3aDbRzgxmbrQ0PtQReHDTMiwxkoCfWxWq4bJLFmEdH7JIc9r/WcMezPSH0HMKB2O6f3CnSGRiXde27gKEgsLHfnbL94DEZHS3MpB5l7xUhNv5FqghXb3KnmkL+mygpCVef+wJ7rxPQmwjIjJe04uU0UU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4188.eurprd05.prod.outlook.com (2603:10a6:5:18::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Wed, 25 Jul 2018 13:53:42 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 4/8] mlxsw: reg: Add QoS Priority Trust State Register In-Reply-To: References: Message-Id: Date: Wed, 25 Jul 2018 15:53:37 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: AM4PR0101CA0053.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::21) To DB7PR05MB4188.eurprd05.prod.outlook.com (2603:10a6:5:18::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6819765e-e2b3-47c0-5031-08d5f2360848 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4188; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4188; 3:8yRLqcVA324zDYRWgTvXo7CFBh1XzI4R7q3DXNDV93LdyQMDlEx8SUbMNWNKBZAyl95kKHOpnJ0U0Rl/Hthgzq4NB1PqGEO6CJVKmhRbbLemcUwIi78vx5khbJoBipnnnlRks9WyPvIMs5HL1gs6Do4Di1uKVlI6ME6yfgA3wJgDidwpig2vVa0NQwRB77FqY4te4pXL4TTtqKQLQ+azI6FfOu3IaRK9WrFB8/3wenAqO7+QqwOxlVD0AV7h3hni; 25:flu+fDzg5F1TOCev6N8wRXqFXcUVQPW3B+EZUlsG6lx726WUQxSO/hy428xpgE0o+xsX95F7p4oOOB0cpWTqDBTtK8HfMwtqTTLYEF6zPHd0gUqML1CewwwQYFsmF4feuPwMF/eqTOvg6PcXzWpxVqjrksrxs/PkPlLEnHEXaYvh/WGIHMEOEVbULDg6OcaqpYuvO0YS2JdkZZWWPy4tFk8zlBSBSB/mRAESq1UUV34WHpakUCl7Omo4O+PJX6H/LsoxKcpPhFI9OSBtwFNPu1KyX1IliJoJ8CeDDDKJ2NOlAvMX1Vah2jdZ0uDinlQBBHgaJaABhbcead0HTScfRw==; 31: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IG992vQAi3OefIH6Eva0nw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4188; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4188; X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(346002)(376002)(366004)(136003)(199004)(189003)(106356001)(956004)(2616005)(8676002)(476003)(50466002)(5660300001)(6862004)(105586002)(6496006)(37006003)(81166006)(81156014)(53936002)(58126008)(48376002)(6666003)(118296001)(68736007)(478600001)(6636002)(316002)(16586007)(36756003)(446003)(11346002)(186003)(14444005)(2906002)(8936002)(305945005)(7736002)(66066001)(47776003)(6486002)(16526019)(486006)(25786009)(86362001)(26005)(386003)(6116002)(3846002)(51416003)(52116002)(2351001)(97736004)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4188; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB7PR05MB4188; 23:hG9UONBUn2JKsZuwrgafKbgQOMjOGcT1MpcPoWUlH?= +IOOmzRwXdSpmsAGnHgDV7mTLj8diFK9F4uVbuoJHajUXo0+QWpbHPaiD0DeEAK/rg2B/TDrHnkI/U1kIxN/QwN7AbwSxbz8ROdpvXuqKpN/HuGI+71TPrW2U2WekqYTYNvYtLfth5a0zwGdOZpFuVejaLJPEiYchzrpx2PO9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lQnGZp53bbAsazyGs5VZ1vZks1eYlmH8O5smm/6n9aHUMNWO1sgD5WuhNBEtsWRqUimCOMfQJ2Kc3v+B+8pS7DogXdPoI/PuKmvWkhuo1RMW6jJs5pJpB1imJJPNUpNm77VXbfQnrx3RAioAbY/xahLcb6DNaOk+ptRUX1NKqDgivH3xpZda9f0ik7PvXjdURet34xY+MT+xrYBnjev4rFAXE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 13:53:42.1233 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6819765e-e2b3-47c0-5031-08d5f2360848 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4188 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP The QPTS register controls the port policy to calculate the switch priority and packet color based on incoming packet fields. Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/reg.h | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index fd8745bce13c..efc989e7c842 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -2732,6 +2732,44 @@ static inline void mlxsw_reg_iedr_rec_pack(char *payload, int rec_index, mlxsw_reg_iedr_rec_index_start_set(payload, rec_index, rec_index_start); } +/* QPTS - QoS Priority Trust State Register + * ---------------------------------------- + * This register controls the port policy to calculate the switch priority and + * packet color based on incoming packet fields. + */ +#define MLXSW_REG_QPTS_ID 0x4002 +#define MLXSW_REG_QPTS_LEN 0x8 + +MLXSW_REG_DEFINE(qpts, MLXSW_REG_QPTS_ID, MLXSW_REG_QPTS_LEN); + +/* reg_qpts_local_port + * Local port number. + * Access: Index + * + * Note: CPU port is supported. + */ +MLXSW_ITEM32(reg, qpts, local_port, 0x00, 16, 8); + +enum mlxsw_reg_qpts_trust_state { + MLXSW_REG_QPTS_TRUST_STATE_PCP = 1, + MLXSW_REG_QPTS_TRUST_STATE_DSCP = 2, /* For MPLS, trust EXP. */ +}; + +/* reg_qpts_trust_state + * Trust state for a given port. + * Access: RW + */ +MLXSW_ITEM32(reg, qpts, trust_state, 0x04, 0, 3); + +static inline void mlxsw_reg_qpts_pack(char *payload, u8 local_port, + enum mlxsw_reg_qpts_trust_state ts) +{ + MLXSW_REG_ZERO(qpts, payload); + + mlxsw_reg_qpts_local_port_set(payload, local_port); + mlxsw_reg_qpts_trust_state_set(payload, ts); +} + /* QPCR - QoS Policer Configuration Register * ----------------------------------------- * The QPCR register is used to create policers - that limit @@ -8303,6 +8341,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = { MLXSW_REG(percr), MLXSW_REG(pererp), MLXSW_REG(iedr), + MLXSW_REG(qpts), MLXSW_REG(qpcr), MLXSW_REG(qtct), MLXSW_REG(qeec),