Skip to content

Commit 96c6f33

Browse files
oleremdavem330
authored andcommitted
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>
1 parent 09ca994 commit 96c6f33

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

include/net/dsa.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,10 @@ struct dsa_switch_ops {
955955
u8 prio);
956956
int (*port_del_dscp_prio)(struct dsa_switch *ds, int port, u8 dscp,
957957
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);
958962

959963
/*
960964
* Suspend and resume

net/dsa/user.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,32 @@ int dsa_user_change_mtu(struct net_device *dev, int new_mtu)
21362136
return err;
21372137
}
21382138

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+
21392165
static int __maybe_unused
21402166
dsa_user_dcbnl_set_default_prio(struct net_device *dev, struct dcb_app *app)
21412167
{
@@ -2376,6 +2402,8 @@ static const struct ethtool_ops dsa_user_ethtool_ops = {
23762402
static const struct dcbnl_rtnl_ops __maybe_unused dsa_user_dcbnl_ops = {
23772403
.ieee_setapp = dsa_user_dcbnl_ieee_setapp,
23782404
.ieee_delapp = dsa_user_dcbnl_ieee_delapp,
2405+
.dcbnl_setapptrust = dsa_user_dcbnl_set_apptrust,
2406+
.dcbnl_getapptrust = dsa_user_dcbnl_get_apptrust,
23792407
};
23802408

23812409
static void dsa_user_get_stats64(struct net_device *dev,

0 commit comments

Comments
 (0)