Skip to content

Commit 64ff2ae

Browse files
ffainellidavem330
authored andcommitted
net: dsa: bcm_sf2: Allow non-IMP ports to have Broadcom tags enabled
Parse the "brcm,use-bcm-hdr" boolean property during ports identification to fill a bitmask of ports that should have Broadcom tags enabled. This is needed in some configurations where per-packet metadata can be exchanged using Broadcom tags between the switch and an on-chip acceleration device. Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ebb2ac4 commit 64ff2ae

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

Documentation/devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ Optional properties:
4141
Admission Control Block supports reporting the number of packets in-flight in a
4242
switch queue
4343

44+
Port subnodes:
45+
46+
Optional properties:
47+
48+
- brcm,use-bcm-hdr: boolean property, if present, indicates that the switch
49+
port has Broadcom tags enabled (per-packet metadata)
50+
4451
Example:
4552

4653
switch_top@f0b00000 {
@@ -114,6 +121,7 @@ switch_top@f0b00000 {
114121
port@0 {
115122
label = "gphy";
116123
reg = <0>;
124+
brcm,use-bcm-hdr;
117125
};
118126
...
119127
};

drivers/net/dsa/bcm_sf2.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,
236236
reg &= ~P_TXQ_PSM_VDD(port);
237237
core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL);
238238

239+
/* Enable Broadcom tags for that port if requested */
240+
if (priv->brcm_tag_mask & BIT(port))
241+
bcm_sf2_brcm_hdr_setup(priv, port);
242+
239243
/* Clear the Rx and Tx disable bits and set to no spanning tree */
240244
core_writel(priv, 0, CORE_G_PCTL_PORT(port));
241245

@@ -515,6 +519,9 @@ static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv,
515519

516520
if (mode == PHY_INTERFACE_MODE_MOCA)
517521
priv->moca_port = port_num;
522+
523+
if (of_property_read_bool(port, "brcm,use-bcm-hdr"))
524+
priv->brcm_tag_mask |= 1 << port_num;
518525
}
519526
}
520527

drivers/net/dsa/bcm_sf2.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ struct bcm_sf2_priv {
100100
struct device_node *master_mii_dn;
101101
struct mii_bus *slave_mii_bus;
102102
struct mii_bus *master_mii_bus;
103+
104+
/* Bitmask of ports needing BRCM tags */
105+
unsigned int brcm_tag_mask;
103106
};
104107

105108
static inline struct bcm_sf2_priv *bcm_sf2_to_priv(struct dsa_switch *ds)

0 commit comments

Comments
 (0)