Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp545338lqh; Thu, 28 Mar 2024 09:07:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXozU/YwxB/4F5B+kW4Xs1sASQz3rklyTBWBNbKhkFIhj5KtImJRrF+0NBASYp/YEmNou5izaQhw/ha5k2VaGbJX+1WrQZIzeLJBzpxtw== X-Google-Smtp-Source: AGHT+IE7b3IG8PLzj3KESmM1U3NmfDQWYzq4LcCbWSq0Lqpf2xvAXHy6VB7M++DOZBjFiQ20C/+X X-Received: by 2002:a0c:e805:0:b0:696:8234:3ab with SMTP id y5-20020a0ce805000000b00696823403abmr2895145qvn.49.1711642029359; Thu, 28 Mar 2024 09:07:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711642029; cv=pass; d=google.com; s=arc-20160816; b=MLaZnfcG5A5lbwsr7wBFYpArrxXbPZMrsFqaZ+OGhCQpekm8o7oxNpr1sWeCuD034t +nHOcvNL3pwCfdSfPi8XdhJuZshNM+ZzkehNI3eu/7+gOS6XfWLQTUBJeiwvxMU5iOoO hpw5EtJjIlrBZm5V6WRpcs+wRvW1dVVpMpDKizi+Lz4APnWrN5Us24EzWZ3BjL51p7kV edsFya5u6bMbfd5cTjythMlEZXF3ytZg8l9tfW6Ru/hivkF6nMkfUkkioAPhcJn+qOYf rWn6FtEhOAyVFH4p6KfP4hJvFpP9L4Xs4hFOq7FBqdrvviFCxeZpGaACBJUNHb0wd8/q gfVg== 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=pmlI5vGZ7gyaOp9PUctba3mT658fFtdesZtV81bJKS8=; fh=tqC39tIlS6D/RAQt4n0YdpNSF39XxlRBPCEXedsdbGs=; b=LYxR9Vwr9U0502hw7gYCG4XqvS2JZ0t4l8H+ql4d6lYb0P7AN9b/jidlQje1UlwlPQ DmztQjzYDV+J//67qS52alnwH/isg7wGbM1vp3/dw+xLuQpdVoNCBMQp6Vo+2rVK5XsM 8/k6Qqs4rAgRCGts3s97elcg9siDl3lSyrn0IyMDkHDuxdVB/1IlZbt1g5+4q+CvG7pW ihkaYm7Z1J7oI+3QuaVfz4Gfvb51Rggtu1TzLz68ZMY1AiR5086myAFxQi77Erh8YPgK YZLSm9PAlULdEEzJbuGsDg9O8Nbhh/r8dYMOmQhJY1l3Y1aLhFYpaOW4/B444b2otax7 xd2A==; 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-123212-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123212-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x14-20020a0cda0e000000b0069697f3a217si1678681qvj.213.2024.03.28.09.07.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 09:07:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123212-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-123212-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123212-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 180691C234E0 for ; Thu, 28 Mar 2024 16:07:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04C9113775E; Thu, 28 Mar 2024 16:05:42 +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 C0B44131184 for ; Thu, 28 Mar 2024 16:05:35 +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=1711641940; cv=none; b=c7SzWMearCzL5Kn/LjN5nM5wvF1Gvh8Nbh+tAYgW+6+UOL14cqRZAeZcoRw53hvOptuBn9+IRukuMhXF5CCFoHbl5fMtAGZgL49Q5//XUI7f4aPVse2Y720Olcm+mC2dIxzdfQxP1AFe0+WRbN6jpyOl29p6UHeMHCkfiR8y0kA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711641940; c=relaxed/simple; bh=vsaEL1t0++xJC7FZUll6AKUGV22QFjdx4TTZg6Yz+EY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MOR9h2cD9kk0Lig4lQPd3ZLTWCA41vb464muFMCJSkQMiMtpakvA/KBNmwHNgrhtDzkTfKl19OLIsbjt+gyQ8aj74aEqBGp69w1bMJrk9JabiNxUgVAdTrI0e+oeaa7vY8nE8TyTaVA9hPnORDrAbNrH0jXGF9cFFtygAqZ2FIc= 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 1rpsFm-00058h-N5; Thu, 28 Mar 2024 17:05:22 +0100 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 1rpsFj-0092JH-Ct; Thu, 28 Mar 2024 17:05:19 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rpsFj-00A3Nn-14; Thu, 28 Mar 2024 17:05:19 +0100 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 , 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 v1 1/9] net: dsa: add support for DCB get/set apptrust configuration Date: Thu, 28 Mar 2024 17:05:10 +0100 Message-Id: <20240328160518.2396238-2-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328160518.2396238-1-o.rempel@pengutronix.de> References: <20240328160518.2396238-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 choice 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 --- 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