Commit f8ba50ea authored by Horatiu Vultur's avatar Horatiu Vultur Committed by Paolo Abeni

net: lan966x: Add support for offloading default prio

Add support for offloading default prio.
Reviewed-by: default avatarDaniel Machon <daniel.machon@microchip.com>
Reviewed-by: default avatarPiotr Raczynski <piotr.raczynski@intel.com>
Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 0c88d981
......@@ -64,6 +64,11 @@ static void lan966x_dcb_app_update(struct net_device *dev)
qos.dscp.map[i] = dcb_getapp(dev, &app_itr);
}
/* Get default prio */
qos.default_prio = dcb_ieee_getapp_default_prio_mask(dev);
if (qos.default_prio)
qos.default_prio = fls(qos.default_prio) - 1;
/* Enable use of pcp for queue classification */
if (lan966x_dcb_apptrust_contains(port->chip_port, DCB_APP_SEL_PCP))
qos.pcp.enable = true;
......@@ -106,6 +111,13 @@ static int lan966x_dcb_app_validate(struct net_device *dev,
int err = 0;
switch (app->selector) {
/* Default priority checks */
case IEEE_8021QAZ_APP_SEL_ETHERTYPE:
if (app->protocol)
err = -EINVAL;
else if (app->priority >= NUM_PRIO_QUEUES)
err = -ERANGE;
break;
/* Dscp checks */
case IEEE_8021QAZ_APP_SEL_DSCP:
if (app->protocol >= LAN966X_PORT_QOS_DSCP_COUNT)
......
......@@ -412,6 +412,7 @@ struct lan966x_port_qos_dscp {
struct lan966x_port_qos {
struct lan966x_port_qos_pcp pcp;
struct lan966x_port_qos_dscp dscp;
u8 default_prio;
};
struct lan966x_port {
......
......@@ -443,11 +443,32 @@ static void lan966x_port_qos_dscp_set(struct lan966x_port *port,
lan966x, ANA_DSCP_CFG(i));
}
static int lan966x_port_qos_default_set(struct lan966x_port *port,
struct lan966x_port_qos *qos)
{
/* Set default prio and dp level */
lan_rmw(ANA_QOS_CFG_DP_DEFAULT_VAL_SET(0) |
ANA_QOS_CFG_QOS_DEFAULT_VAL_SET(qos->default_prio),
ANA_QOS_CFG_DP_DEFAULT_VAL |
ANA_QOS_CFG_QOS_DEFAULT_VAL,
port->lan966x, ANA_QOS_CFG(port->chip_port));
/* Set default pcp and dei for untagged frames */
lan_rmw(ANA_VLAN_CFG_VLAN_DEI_SET(0) |
ANA_VLAN_CFG_VLAN_PCP_SET(0),
ANA_VLAN_CFG_VLAN_DEI |
ANA_VLAN_CFG_VLAN_PCP,
port->lan966x, ANA_VLAN_CFG(port->chip_port));
return 0;
}
void lan966x_port_qos_set(struct lan966x_port *port,
struct lan966x_port_qos *qos)
{
lan966x_port_qos_pcp_set(port, &qos->pcp);
lan966x_port_qos_dscp_set(port, &qos->dscp);
lan966x_port_qos_default_set(port, qos);
}
void lan966x_port_init(struct lan966x_port *port)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment