Skip to content

Commit ae2778a

Browse files
Xiaoliang Yangkuba-moo
authored andcommitted
net: dsa: tag_ocelot: use traffic class to map priority on injected header
For Ocelot switches, the CPU injected frames have an injection header where it can specify the QoS class of the packet and the DSA tag, now it uses the SKB priority to set that. If a traffic class to priority mapping is configured on the netdevice (with mqprio for example ...), it won't be considered for CPU injected headers. This patch make the QoS class aligned to the priority to traffic class mapping if it exists. Fixes: 8dce89a ("net: dsa: ocelot: add tagger for Ocelot/Felix switches") Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com> Signed-off-by: Marouen Ghodhbane <marouen.ghodhbane@nxp.com> Link: https://lore.kernel.org/r/20211223072211.33130-1-xiaoliang.yang_1@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 9695b7d commit ae2778a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

net/dsa/tag_ocelot.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,21 @@ static void ocelot_xmit_common(struct sk_buff *skb, struct net_device *netdev,
4747
void *injection;
4848
__be32 *prefix;
4949
u32 rew_op = 0;
50+
u64 qos_class;
5051

5152
ocelot_xmit_get_vlan_info(skb, dp, &vlan_tci, &tag_type);
5253

54+
qos_class = netdev_get_num_tc(netdev) ?
55+
netdev_get_prio_tc_map(netdev, skb->priority) : skb->priority;
56+
5357
injection = skb_push(skb, OCELOT_TAG_LEN);
5458
prefix = skb_push(skb, OCELOT_SHORT_PREFIX_LEN);
5559

5660
*prefix = ifh_prefix;
5761
memset(injection, 0, OCELOT_TAG_LEN);
5862
ocelot_ifh_set_bypass(injection, 1);
5963
ocelot_ifh_set_src(injection, ds->num_ports);
60-
ocelot_ifh_set_qos_class(injection, skb->priority);
64+
ocelot_ifh_set_qos_class(injection, qos_class);
6165
ocelot_ifh_set_vlan_tci(injection, vlan_tci);
6266
ocelot_ifh_set_tag_type(injection, tag_type);
6367

0 commit comments

Comments
 (0)