Skip to content

Commit aef1e0d

Browse files
committed
Merge branch 'dsa-b53-Support-prepended-Broadcom-tags'
Florian Fainelli says: ==================== net: dsa: b53: Support prepended Broadcom tags This patch series adds support for prepended 4-bytes Broadcom tags that we already support. This type of tag will typically be used when interfaced to a SoC like BCM58xx (NorthStar Plus) which supports a Flow Accelerator (WIP). In that case, we need to support a slightly different tagging format. The first patch does a bit of re-factoring and passes a port index to the get_tag_protocol() function since at least two different drivers need that type of information (mt7530, b53) to support tagging or not. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents ee9d342 + 1160603 commit aef1e0d

18 files changed

Lines changed: 109 additions & 44 deletions

File tree

‎drivers/net/dsa/b53/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ menuconfig B53
22
tristate "Broadcom BCM53xx managed switch support"
33
depends on NET_DSA
44
select NET_DSA_TAG_BRCM
5+
select NET_DSA_TAG_BRCM_PREPEND
56
help
67
This driver adds support for Broadcom managed switch chips. It supports
78
BCM5325E, BCM5365, BCM539x, BCM53115 and BCM53125 as well as BCM63XX

‎drivers/net/dsa/b53/b53_common.c‎

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,8 @@ EXPORT_SYMBOL(b53_disable_port);
541541

542542
void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
543543
{
544-
bool tag_en = !!(ds->ops->get_tag_protocol(ds) == DSA_TAG_PROTO_BRCM);
544+
bool tag_en = !(ds->ops->get_tag_protocol(ds, port) ==
545+
DSA_TAG_PROTO_NONE);
545546
struct b53_device *dev = ds->priv;
546547
u8 hdr_ctl, val;
547548
u16 reg;
@@ -1478,41 +1479,40 @@ void b53_br_fast_age(struct dsa_switch *ds, int port)
14781479
}
14791480
EXPORT_SYMBOL(b53_br_fast_age);
14801481

1481-
static bool b53_can_enable_brcm_tags(struct dsa_switch *ds)
1482+
static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port)
14821483
{
1483-
unsigned int brcm_tag_mask;
1484-
unsigned int i;
1485-
14861484
/* Broadcom switches will accept enabling Broadcom tags on the
14871485
* following ports: 5, 7 and 8, any other port is not supported
14881486
*/
1489-
brcm_tag_mask = BIT(B53_CPU_PORT_25) | BIT(7) | BIT(B53_CPU_PORT);
1490-
1491-
for (i = 0; i < ds->num_ports; i++) {
1492-
if (dsa_is_cpu_port(ds, i)) {
1493-
if (!(BIT(i) & brcm_tag_mask)) {
1494-
dev_warn(ds->dev,
1495-
"Port %d is not Broadcom tag capable\n",
1496-
i);
1497-
return false;
1498-
}
1499-
}
1487+
switch (port) {
1488+
case B53_CPU_PORT_25:
1489+
case 7:
1490+
case B53_CPU_PORT:
1491+
return true;
15001492
}
15011493

1502-
return true;
1494+
dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n", port);
1495+
return false;
15031496
}
15041497

1505-
static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds)
1498+
static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds,
1499+
int port)
15061500
{
15071501
struct b53_device *dev = ds->priv;
15081502

15091503
/* Older models support a different tag format that we do not
15101504
* support in net/dsa/tag_brcm.c yet.
15111505
*/
1512-
if (is5325(dev) || is5365(dev) || !b53_can_enable_brcm_tags(ds))
1506+
if (is5325(dev) || is5365(dev) || !b53_can_enable_brcm_tags(ds, port))
15131507
return DSA_TAG_PROTO_NONE;
1514-
else
1515-
return DSA_TAG_PROTO_BRCM;
1508+
1509+
/* Broadcom BCM58xx chips have a flow accelerator on Port 8
1510+
* which requires us to use the prepended Broadcom tag type
1511+
*/
1512+
if (dev->chip_id == BCM58XX_DEVICE_ID && port == B53_CPU_PORT)
1513+
return DSA_TAG_PROTO_BRCM_PREPEND;
1514+
1515+
return DSA_TAG_PROTO_BRCM;
15161516
}
15171517

15181518
int b53_mirror_add(struct dsa_switch *ds, int port,

‎drivers/net/dsa/bcm_sf2.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
#include "b53/b53_priv.h"
3636
#include "b53/b53_regs.h"
3737

38-
static enum dsa_tag_protocol bcm_sf2_sw_get_tag_protocol(struct dsa_switch *ds)
38+
static enum dsa_tag_protocol bcm_sf2_sw_get_tag_protocol(struct dsa_switch *ds,
39+
int port)
3940
{
4041
return DSA_TAG_PROTO_BRCM;
4142
}

‎drivers/net/dsa/dsa_loop.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ struct dsa_loop_priv {
6464

6565
static struct phy_device *phydevs[PHY_MAX_ADDR];
6666

67-
static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds)
67+
static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds,
68+
int port)
6869
{
6970
dev_dbg(ds->dev, "%s\n", __func__);
7071

‎drivers/net/dsa/lan9303-core.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,8 @@ static int lan9303_check_device(struct lan9303 *chip)
894894

895895
/* ---------------------------- DSA -----------------------------------*/
896896

897-
static enum dsa_tag_protocol lan9303_get_tag_protocol(struct dsa_switch *ds)
897+
static enum dsa_tag_protocol lan9303_get_tag_protocol(struct dsa_switch *ds,
898+
int port)
898899
{
899900
return DSA_TAG_PROTO_LAN9303;
900901
}

‎drivers/net/dsa/microchip/ksz_common.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ static int ksz_setup(struct dsa_switch *ds)
394394
return 0;
395395
}
396396

397-
static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds)
397+
static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds,
398+
int port)
398399
{
399400
return DSA_TAG_PROTO_KSZ;
400401
}

‎drivers/net/dsa/mt7530.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,11 +907,11 @@ mt7530_port_fdb_dump(struct dsa_switch *ds, int port,
907907
}
908908

909909
static enum dsa_tag_protocol
910-
mtk_get_tag_protocol(struct dsa_switch *ds)
910+
mtk_get_tag_protocol(struct dsa_switch *ds, int port)
911911
{
912912
struct mt7530_priv *priv = ds->priv;
913913

914-
if (!dsa_is_cpu_port(ds, MT7530_CPU_PORT)) {
914+
if (port != MT7530_CPU_PORT) {
915915
dev_warn(priv->dev,
916916
"port not matched with tagging CPU port\n");
917917
return DSA_TAG_PROTO_NONE;

‎drivers/net/dsa/mv88e6060.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ static const char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)
7070
return NULL;
7171
}
7272

73-
static enum dsa_tag_protocol mv88e6060_get_tag_protocol(struct dsa_switch *ds)
73+
static enum dsa_tag_protocol mv88e6060_get_tag_protocol(struct dsa_switch *ds,
74+
int port)
7475
{
7576
return DSA_TAG_PROTO_TRAILER;
7677
}

‎drivers/net/dsa/mv88e6xxx/chip.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3731,7 +3731,8 @@ static int mv88e6xxx_smi_init(struct mv88e6xxx_chip *chip,
37313731
return 0;
37323732
}
37333733

3734-
static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds)
3734+
static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds,
3735+
int port)
37353736
{
37363737
struct mv88e6xxx_chip *chip = ds->priv;
37373738

‎drivers/net/dsa/qca8k.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ qca8k_port_fdb_dump(struct dsa_switch *ds, int port,
823823
}
824824

825825
static enum dsa_tag_protocol
826-
qca8k_get_tag_protocol(struct dsa_switch *ds)
826+
qca8k_get_tag_protocol(struct dsa_switch *ds, int port)
827827
{
828828
return DSA_TAG_PROTO_QCA;
829829
}

0 commit comments

Comments
 (0)