Skip to content

Commit bd2b316

Browse files
Xiaoliang Yangdavem330
authored andcommitted
net: dsa: felix: qos classified based on pcp
Set the default QoS Classification based on PCP and DEI of vlan tag, after that, frames can be Classified to different Qos based on PCP tag. If there is no vlan tag or vlan ignored, use port default Qos. Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fb9f2e9 commit bd2b316

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/net/dsa/ocelot/felix.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,27 @@ static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port,
289289
QSYS_SWITCH_PORT_MODE, port);
290290
}
291291

292+
static void felix_port_qos_map_init(struct ocelot *ocelot, int port)
293+
{
294+
int i;
295+
296+
ocelot_rmw_gix(ocelot,
297+
ANA_PORT_QOS_CFG_QOS_PCP_ENA,
298+
ANA_PORT_QOS_CFG_QOS_PCP_ENA,
299+
ANA_PORT_QOS_CFG,
300+
port);
301+
302+
for (i = 0; i < FELIX_NUM_TC * 2; i++) {
303+
ocelot_rmw_ix(ocelot,
304+
(ANA_PORT_PCP_DEI_MAP_DP_PCP_DEI_VAL & i) |
305+
ANA_PORT_PCP_DEI_MAP_QOS_PCP_DEI_VAL(i),
306+
ANA_PORT_PCP_DEI_MAP_DP_PCP_DEI_VAL |
307+
ANA_PORT_PCP_DEI_MAP_QOS_PCP_DEI_VAL_M,
308+
ANA_PORT_PCP_DEI_MAP,
309+
port, i);
310+
}
311+
}
312+
292313
static void felix_get_strings(struct dsa_switch *ds, int port,
293314
u32 stringset, u8 *data)
294315
{
@@ -547,6 +568,11 @@ static int felix_setup(struct dsa_switch *ds)
547568
ocelot_configure_cpu(ocelot, port,
548569
OCELOT_TAG_PREFIX_NONE,
549570
OCELOT_TAG_PREFIX_LONG);
571+
572+
/* Set the default QoS Classification based on PCP and DEI
573+
* bits of vlan tag.
574+
*/
575+
felix_port_qos_map_init(ocelot, port);
550576
}
551577

552578
/* Include the CPU port module in the forwarding mask for unknown

0 commit comments

Comments
 (0)