Skip to content

Commit 5f06c63

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: sja1105: Advertise the 8 TX queues
This is a preparation patch for the tc-taprio offload (and potentially for other future offloads such as tc-mqprio). Instead of looking directly at skb->priority during xmit, let's get the netdev queue and the queue-to-traffic-class mapping, and put the resulting traffic class into the dsa_8021q PCP field. The switch is configured with a 1-to-1 PCP-to-ingress-queue-to-egress-queue mapping (see vlan_pmap in sja1105_main.c), so the effect is that we can inject into a front-panel's egress traffic class through VLAN tagging from Linux, completely transparently. Unfortunately the switch doesn't look at the VLAN PCP in the case of management traffic to/from the CPU (link-local frames at 01-80-C2-xx-xx-xx or 01-1B-19-xx-xx-xx) so we can't alter the transmission queue of this type of traffic on a frame-by-frame basis. It is only selected through the "hostprio" setting which ATM is harcoded in the driver to 7. Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7f1e4ba commit 5f06c63

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

drivers/net/dsa/sja1105/sja1105_main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,9 @@ static int sja1105_init_general_params(struct sja1105_private *priv)
384384
/* Disallow dynamic changing of the mirror port */
385385
.mirr_ptacu = 0,
386386
.switchid = priv->ds->index,
387-
/* Priority queue for link-local frames trapped to CPU */
387+
/* Priority queue for link-local management frames
388+
* (both ingress to and egress from CPU - PTP, STP etc)
389+
*/
388390
.hostprio = 7,
389391
.mac_fltres1 = SJA1105_LINKLOCAL_FILTER_A,
390392
.mac_flt1 = SJA1105_LINKLOCAL_FILTER_A_MASK,
@@ -1711,6 +1713,9 @@ static int sja1105_setup(struct dsa_switch *ds)
17111713
*/
17121714
ds->vlan_filtering_is_global = true;
17131715

1716+
/* Advertise the 8 egress queues */
1717+
ds->num_tx_queues = SJA1105_NUM_TC;
1718+
17141719
/* The DSA/switchdev model brings up switch ports in standalone mode by
17151720
* default, and that means vlan_filtering is 0 since they're not under
17161721
* a bridge, so it's safe to set up switch tagging at this time.

net/dsa/tag_sja1105.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ static struct sk_buff *sja1105_xmit(struct sk_buff *skb,
8989
struct dsa_port *dp = dsa_slave_to_port(netdev);
9090
struct dsa_switch *ds = dp->ds;
9191
u16 tx_vid = dsa_8021q_tx_vid(ds, dp->index);
92-
u8 pcp = skb->priority;
92+
u16 queue_mapping = skb_get_queue_mapping(skb);
93+
u8 pcp = netdev_txq_to_tc(netdev, queue_mapping);
9394

9495
/* Transmitting management traffic does not rely upon switch tagging,
9596
* but instead SPI-installed management routes. Part 2 of this

0 commit comments

Comments
 (0)