diff mbox series

[net-next] net: dsa: tag_ocelot: use traffic class to map priority on injected header

Message ID 20211221110209.31309-1-xiaoliang.yang_1@nxp.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: dsa: tag_ocelot: use traffic class to map priority on injected header | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: line length of 82 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Xiaoliang Yang Dec. 21, 2021, 11:02 a.m. UTC
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.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
Signed-off-by: Marouen Ghodhbane <marouen.ghodhbane@nxp.com>
---
 net/dsa/tag_ocelot.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski Dec. 22, 2021, 10:23 p.m. UTC | #1
On Tue, 21 Dec 2021 19:02:09 +0800 Xiaoliang Yang wrote:
> 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.
> 
> Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
> Signed-off-by: Marouen Ghodhbane <marouen.ghodhbane@nxp.com>

Is this a fix? Looks like one.
Xiaoliang Yang Dec. 23, 2021, 4:27 a.m. UTC | #2
On Wed, 23 Dec 2021 06:24 Jakub Kicinski wrote:
> > 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.
> >
> > Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
> > Signed-off-by: Marouen Ghodhbane <marouen.ghodhbane@nxp.com>
> 
> Is this a fix? Looks like one.
Yes, It can be seen as a fix, I will add fix tag and resend to net, thanks.
diff mbox series

Patch

diff --git a/net/dsa/tag_ocelot.c b/net/dsa/tag_ocelot.c
index 4ba460c5a880..0d81f172b7a6 100644
--- a/net/dsa/tag_ocelot.c
+++ b/net/dsa/tag_ocelot.c
@@ -47,9 +47,13 @@  static void ocelot_xmit_common(struct sk_buff *skb, struct net_device *netdev,
 	void *injection;
 	__be32 *prefix;
 	u32 rew_op = 0;
+	u64 qos_class;
 
 	ocelot_xmit_get_vlan_info(skb, dp, &vlan_tci, &tag_type);
 
+	qos_class = netdev_get_num_tc(netdev) ?
+		    netdev_get_prio_tc_map(netdev, skb->priority) : skb->priority;
+
 	injection = skb_push(skb, OCELOT_TAG_LEN);
 	prefix = skb_push(skb, OCELOT_SHORT_PREFIX_LEN);
 
@@ -57,7 +61,7 @@  static void ocelot_xmit_common(struct sk_buff *skb, struct net_device *netdev,
 	memset(injection, 0, OCELOT_TAG_LEN);
 	ocelot_ifh_set_bypass(injection, 1);
 	ocelot_ifh_set_src(injection, ds->num_ports);
-	ocelot_ifh_set_qos_class(injection, skb->priority);
+	ocelot_ifh_set_qos_class(injection, qos_class);
 	ocelot_ifh_set_vlan_tci(injection, vlan_tci);
 	ocelot_ifh_set_tag_type(injection, tag_type);