Skip to content

Commit 5733fe2

Browse files
vladimirolteankuba-moo
authored andcommitted
net: dsa: tag_ocelot: use the dsa_xmit_port_mask() helper
The "ocelot" and "seville" tagging protocols populate a bit mask for the TX ports, so we can use dsa_xmit_port_mask() to centralize the decision of how to set that field. This protocol used BIT_ULL() rather than simple BIT() to silence Smatch, as explained in commit 1f778d5 ("net: mscc: ocelot: avoid type promotion when calling ocelot_ifh_set_dest"). I would expect that this tool no longer complains now, when the BIT(dp->index) is hidden inside the dsa_xmit_port_mask() function, the return value of which is promoted to u64. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Link: https://patch.msgid.link/20251127120902.292555-9-vladimir.oltean@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent a4a00d9 commit 5733fe2

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

net/dsa/tag_ocelot.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,21 @@ static void ocelot_xmit_common(struct sk_buff *skb, struct net_device *netdev,
4646
static struct sk_buff *ocelot_xmit(struct sk_buff *skb,
4747
struct net_device *netdev)
4848
{
49-
struct dsa_port *dp = dsa_user_to_port(netdev);
5049
void *injection;
5150

5251
ocelot_xmit_common(skb, netdev, cpu_to_be32(0x8880000a), &injection);
53-
ocelot_ifh_set_dest(injection, BIT_ULL(dp->index));
52+
ocelot_ifh_set_dest(injection, dsa_xmit_port_mask(skb, netdev));
5453

5554
return skb;
5655
}
5756

5857
static struct sk_buff *seville_xmit(struct sk_buff *skb,
5958
struct net_device *netdev)
6059
{
61-
struct dsa_port *dp = dsa_user_to_port(netdev);
6260
void *injection;
6361

6462
ocelot_xmit_common(skb, netdev, cpu_to_be32(0x88800005), &injection);
65-
seville_ifh_set_dest(injection, BIT_ULL(dp->index));
63+
seville_ifh_set_dest(injection, dsa_xmit_port_mask(skb, netdev));
6664

6765
return skb;
6866
}

0 commit comments

Comments
 (0)