Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: add support for DCB get/set apptrust configuration

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 <o.rempel@pengutronix.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Oleksij Rempel and committed by
David S. Miller
96c6f337 09ca9940

+32
+4
include/net/dsa.h
··· 955 955 u8 prio); 956 956 int (*port_del_dscp_prio)(struct dsa_switch *ds, int port, u8 dscp, 957 957 u8 prio); 958 + int (*port_set_apptrust)(struct dsa_switch *ds, int port, 959 + const u8 *sel, int nsel); 960 + int (*port_get_apptrust)(struct dsa_switch *ds, int port, u8 *sel, 961 + int *nsel); 958 962 959 963 /* 960 964 * Suspend and resume
+28
net/dsa/user.c
··· 2137 2137 } 2138 2138 2139 2139 static int __maybe_unused 2140 + dsa_user_dcbnl_set_apptrust(struct net_device *dev, u8 *sel, int nsel) 2141 + { 2142 + struct dsa_port *dp = dsa_user_to_port(dev); 2143 + struct dsa_switch *ds = dp->ds; 2144 + int port = dp->index; 2145 + 2146 + if (!ds->ops->port_set_apptrust) 2147 + return -EOPNOTSUPP; 2148 + 2149 + return ds->ops->port_set_apptrust(ds, port, sel, nsel); 2150 + } 2151 + 2152 + static int __maybe_unused 2153 + dsa_user_dcbnl_get_apptrust(struct net_device *dev, u8 *sel, int *nsel) 2154 + { 2155 + struct dsa_port *dp = dsa_user_to_port(dev); 2156 + struct dsa_switch *ds = dp->ds; 2157 + int port = dp->index; 2158 + 2159 + if (!ds->ops->port_get_apptrust) 2160 + return -EOPNOTSUPP; 2161 + 2162 + return ds->ops->port_get_apptrust(ds, port, sel, nsel); 2163 + } 2164 + 2165 + static int __maybe_unused 2140 2166 dsa_user_dcbnl_set_default_prio(struct net_device *dev, struct dcb_app *app) 2141 2167 { 2142 2168 struct dsa_port *dp = dsa_user_to_port(dev); ··· 2402 2376 static const struct dcbnl_rtnl_ops __maybe_unused dsa_user_dcbnl_ops = { 2403 2377 .ieee_setapp = dsa_user_dcbnl_ieee_setapp, 2404 2378 .ieee_delapp = dsa_user_dcbnl_ieee_delapp, 2379 + .dcbnl_setapptrust = dsa_user_dcbnl_set_apptrust, 2380 + .dcbnl_getapptrust = dsa_user_dcbnl_get_apptrust, 2405 2381 }; 2406 2382 2407 2383 static void dsa_user_get_stats64(struct net_device *dev,