Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1770126lqm; Fri, 3 May 2024 06:16:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVK9XcGUk8cDNMjSmfFLkPaKBot6Qw/HdV6MC7ioA1ELHSUe5qVb+JdevKZLeIyu8Oc79+FO1x55u2utdMSWvAtdOT1K2tUN4dKYJHtEA== X-Google-Smtp-Source: AGHT+IHHiAFRD1LMwjlxOFcRSamLSgUIkH7m0OqWygHS+/kzkexZz0C7wBvsv3sveWBCNZtrBBpf X-Received: by 2002:a17:902:ea0e:b0:1e5:3d8a:75fd with SMTP id s14-20020a170902ea0e00b001e53d8a75fdmr2687047plg.69.1714742163951; Fri, 03 May 2024 06:16:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714742163; cv=pass; d=google.com; s=arc-20160816; b=uyLbksdfbVcGm8BRlMWqf1J+IYOHy22L62tTGRbc15djW8esKOqhHYO9AE6VTOvYBQ Ve/yG21Ws/jy+Kq2N3ZOwgoedw8la2qqJI3qJcDoiogMriPTlXR7eg+pZHxoHjtuhdtv ON1e94zcPC/QljT3b8m6ZN+Kt7FvmKddLPOKAAyBmFSOnNTOv/jC4sUHx2HZXxEeZ61h VkWQcduGUsy+N9t8/Qzlrz1+zCVy4gZe6vGmPgvJ16Cqnw2gUl/AiC0Hzj/JTA51DvQP 7z7lvJuxgCUd3hCqgL6L4UeCj32vs2PoCq4N2v69/5kB98gMgaQVQPa6fZpMjbwCv3y1 cj+Q== 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=BjvuAB/807SFp1zwG7tuprIWeW4Sp/0ztS3NpQ++XME=; fh=xy3EDVSRMNlSFVsP5Wn2j5SWi/RhhBunByN2Qm789Fk=; b=PpZulvlfGsBNFS3ZCQOlyoHiIG3kpVaa9FJFo34R6wWsSKwAbxJchTYYidTHGEq1Js vjfRvyscFx3bOu5d/1qy0Bx/tUkvkCKmSv6dv6e6Zuq3zU+IVIWV0NRPW3fwthJRASj3 k5FCYd1jo/Bb5eNwTts5Y/IEa1BpmyxrPQuZ2ajNULysJ81aqFvXD1O+8L8R7G/OmQT7 lEcbs7SSEUztWpjY5x+nbrJkXOcqIGRBK5ZzeFcCDLJW/qOOHcVhP1m7DOt5sdGH1P26 Pwi/nDRmxG1NXNfsmwNB6B2egLc2Mq2PO25RDPiEimCB69Ih4uzeDVuTLr5J96ec3L5X 3elQ==; 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-167679-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167679-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e8-20020a170902784800b001ed3702f782si1301300pln.415.2024.05.03.06.16.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 06:16:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167679-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-167679-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167679-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 44920282279 for ; Fri, 3 May 2024 13:16:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A3E8A1553B7; Fri, 3 May 2024 13:14:15 +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 A45D115381D for ; Fri, 3 May 2024 13:14:08 +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=1714742053; cv=none; b=AYIKJPvYQz25h3dPNT5IdXQOZXTvHNuE+mHGAFx5lfea9B2qF/GVViBXEHn+rmR3a3kKdfvwAcCZDCRSRR/EjGBCO6/0G5/c+H5UlueDm5oLBZLSTd+C4VJN3GFLEWxkAlBH2x1jG+oJ6kz4PaFlLdj1qcKpYljaJyS4rxYrQD4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714742053; c=relaxed/simple; bh=cwxDuuddERvShfACnijq+3yQm2vN8GA4nkMIteJZJ4Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iR3GZHPAUjUGZTqdj7CBScWPN6tfI7R7qMlnXdx7GiYyRpM8R8bKrHy2wBii4gDNhHZFU2Oh71ZvP8Ns84TUbIXWQ0PD3APXasfbU4xH8iDCK8ENG/7zb8bWFTi/MzmaSWaO4faciPP9cfVLtnbyQL6OwhOROejiF6XU4Kf1iE4= 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 1s2sjb-0006EF-Ci; Fri, 03 May 2024 15:13:55 +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 1s2sjZ-00FiK7-LV; Fri, 03 May 2024 15:13:53 +0200 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1s2sjZ-008GGU-1s; Fri, 03 May 2024 15:13:53 +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 v7 01/12] net: dsa: add support for DCB get/set apptrust configuration Date: Fri, 3 May 2024 15:13:40 +0200 Message-Id: <20240503131351.1969097-2-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240503131351.1969097-1-o.rempel@pengutronix.de> References: <20240503131351.1969097-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 v6: - port_set_apptrust pointer should be tested in dsa_user_dcbnl_set_apptrust() 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 eef702dbea78b..40c127a301878 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 c94b868855aa1..f4ac82e8a39e8 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_set_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