Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1834549lqe; Tue, 9 Apr 2024 01:29:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWPv6XR3eUw0QTDSzPpG5aL6akQNAiauWfNLhU3OzNcfcL3Mb1h2upMzwQ5ESZWVN3lvSCI/Mq8ol3+/U+UpKMdN5SsBSskT5wzlyX3rA== X-Google-Smtp-Source: AGHT+IGWossgxLXhP4xMNbXWbHsYnp33JJSiFc8WaU2W/HRhdmxwUOF7vcNbtdiRCOL4AScoVkxg X-Received: by 2002:a05:6a00:80f:b0:6ea:b818:f499 with SMTP id m15-20020a056a00080f00b006eab818f499mr14395453pfk.19.1712651352340; Tue, 09 Apr 2024 01:29:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712651352; cv=pass; d=google.com; s=arc-20160816; b=UWgDm1ancFnq0Z8mJgQ8EEOCBVMEoiCy+eQtDxgeIXzHt6Ot3IgSEU6ahfMDINkqvx nqgM7U5HCt7l3C9alpxASQjA59FnjtnVdUnH1XlMzXuf0yG5DT986HCUHWIhRliVzNRi 4QEZTW6MA0wMQEZvo2uDOf64HZwkk8Kvrvg0PURMPvzYbrroh9oxJmZXXQXatNMN2MW4 NBHbuCkC1CDCDJCHTS75Jvxi2mgBXRPML2UJH5XNTulDGkjPTOPXuASZ338il4JVarmY 0y2LVMoOfulruGF5A6Co/WcggGKAcNAh7N2aty7eNxGyEwp5Wbd1bC4EoHGRVa7oFh/U U1mA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=OLWyNlUnm/ELCi2k9ZIiqBgPKByADMK+MLfRRHYbKG8=; fh=xy3EDVSRMNlSFVsP5Wn2j5SWi/RhhBunByN2Qm789Fk=; b=A8z+q2VdYl7j5MjjFo6dws5gcF0JiK/kxGMXFusHqSdrLjzTuq2T4WFr3y0SFm8ISh sTb149rMLSl89+8iJC46bVT/R6JblR6BNfLs0JKLx8c31+xZECjYLqh+a55kbkqhIevH WmcmcOL+Tw/ZyqkqlgqbRC4teNeGonhPkG72L7bSr31Ykjqi1sBOd5K6/ZL+NCEi+N8A eHhv7wStzgpa5GmuttLP0NPGDKx+2R6QC1Tzp8yYx4JNXL1WQYDUh2B7wB3QQs7DNByy FjuqxsprjXihmzZEFbn5uN/kQLDBnGhauk4PsjoR7N84LdAQ9fR4TgkE1tqH35+dFH7O MCBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-136441-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136441-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p16-20020a056a000b5000b006ed0c9751d3si6727485pfo.324.2024.04.09.01.29.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 01:29:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136441-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-136441-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136441-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7600FB23D84 for ; Tue, 9 Apr 2024 08:21:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F38D84A2B; Tue, 9 Apr 2024 08:19:05 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85A867E765 for ; Tue, 9 Apr 2024 08:19:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712650743; cv=none; b=sSHx3FtLZSMAbMAcCwXQf08+psKwR2PB8dLXWVOwnyDYUKfoqzWcYuCfz15vYQ80foTS68XOV1LBQ0jzeBKLLZn9vGfwGWzhhe42GIZAL3Sa+vixDKo5g4rDCMWjWvyuKcYHl74W2AjyIthFnA5O8C3fhInbMg9jpJRI6VRfdT0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712650743; c=relaxed/simple; bh=oNE2Ro8bkWHCpERvlQWe0qFnsxIFXbaTSbvqasJT+GU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QbBwe17rAW+Uz1aBtQbF4lzUIsDDEKP35j32Y1wELsteSkVbzEelmUC9yMwft8GJkkAGJXRcl1ZYAv53sKxFq5wwu/u7lB/ACPPsTwOiBLQ06dudsmYuZ1/ytc0I0yNVoXdvnwcNod0fYVt1UM3HPTtKcUZgClQ933AZBUUE6p0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ru6gw-0006VH-PK; Tue, 09 Apr 2024 10:18:54 +0200 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ru6gu-00BGpO-Lf; Tue, 09 Apr 2024 10:18:52 +0200 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1ru6gu-00EoUa-1v; Tue, 09 Apr 2024 10:18:52 +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: Oleksij Rempel , Florian Fainelli , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com, David Ahern , Simon Horman , Willem de Bruijn , =?UTF-8?q?S=C3=B8ren=20Andersen?= Subject: [PATCH net-next v5 1/9] net: dsa: add support for DCB get/set apptrust configuration Date: Tue, 9 Apr 2024 10:18:43 +0200 Message-Id: <20240409081851.3530641-2-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240409081851.3530641-1-o.rempel@pengutronix.de> References: <20240409081851.3530641-1-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Add DCB support to get/set trust configuration for different packet priority information sources. Some switch allow to chose different source of packet priority classification. For example on KSZ switches it is possible to configure VLAN PCP and/or DSCP sources. Signed-off-by: Oleksij Rempel Reviewed-by: Florian Fainelli --- changes v3: - s/to choice/to chose/ --- include/net/dsa.h | 4 ++++ net/dsa/user.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 7c0da9effe4e9..96bde2aa86efd 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -955,6 +955,10 @@ struct dsa_switch_ops { u8 prio); int (*port_del_dscp_prio)(struct dsa_switch *ds, int port, u8 dscp, u8 prio); + int (*port_set_apptrust)(struct dsa_switch *ds, int port, + const u8 *sel, int nsel); + int (*port_get_apptrust)(struct dsa_switch *ds, int port, u8 *sel, + int *nsel); /* * Suspend and resume diff --git a/net/dsa/user.c b/net/dsa/user.c index 16d395bb1a1fe..b6aec6615c76e 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -2136,6 +2136,32 @@ int dsa_user_change_mtu(struct net_device *dev, int new_mtu) return err; } +static int __maybe_unused +dsa_user_dcbnl_set_apptrust(struct net_device *dev, u8 *sel, int nsel) +{ + struct dsa_port *dp = dsa_user_to_port(dev); + struct dsa_switch *ds = dp->ds; + int port = dp->index; + + if (!ds->ops->port_get_apptrust) + return -EOPNOTSUPP; + + return ds->ops->port_set_apptrust(ds, port, sel, nsel); +} + +static int __maybe_unused +dsa_user_dcbnl_get_apptrust(struct net_device *dev, u8 *sel, int *nsel) +{ + struct dsa_port *dp = dsa_user_to_port(dev); + struct dsa_switch *ds = dp->ds; + int port = dp->index; + + if (!ds->ops->port_get_apptrust) + return -EOPNOTSUPP; + + return ds->ops->port_get_apptrust(ds, port, sel, nsel); +} + static int __maybe_unused dsa_user_dcbnl_set_default_prio(struct net_device *dev, struct dcb_app *app) { @@ -2376,6 +2402,8 @@ static const struct ethtool_ops dsa_user_ethtool_ops = { static const struct dcbnl_rtnl_ops __maybe_unused dsa_user_dcbnl_ops = { .ieee_setapp = dsa_user_dcbnl_ieee_setapp, .ieee_delapp = dsa_user_dcbnl_ieee_delapp, + .dcbnl_setapptrust = dsa_user_dcbnl_set_apptrust, + .dcbnl_getapptrust = dsa_user_dcbnl_get_apptrust, }; static void dsa_user_get_stats64(struct net_device *dev, -- 2.39.2