Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1368726
| From | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH net-next v2 1/6] net: dsa: mv88e6xxx: protect SID register access |
| Date | 2016-03-31 23:00 +0200 |
| Message-ID | <riRR9-291-29@gated-at.bofh.it> (permalink) |
| References | <riRR7-291-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Introduce a mv88e6xxx_has_stu() helper to protect the access to the
GLOBAL_VTU_SID register, instead of checking switch families.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/mv88e6xxx.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index fa086e0..19a8208 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -482,6 +482,16 @@ static bool mv88e6xxx_6352_family(struct dsa_switch *ds)
return false;
}
+static bool mv88e6xxx_has_stu(struct dsa_switch *ds)
+{
+ /* Does the device have STU and dedicated SID registers for VTU ops? */
+ if (mv88e6xxx_6097_family(ds) || mv88e6xxx_6165_family(ds) ||
+ mv88e6xxx_6351_family(ds) || mv88e6xxx_6352_family(ds))
+ return true;
+
+ return false;
+}
+
/* We expect the switch to perform auto negotiation if there is a real
* phy. However, in the case of a fixed link phy, we force the port
* settings from the fixed link settings.
@@ -1329,7 +1339,9 @@ static int _mv88e6xxx_vtu_getnext(struct dsa_switch *ds,
return ret;
next.fid = ret & GLOBAL_VTU_FID_MASK;
+ }
+ if (mv88e6xxx_has_stu(ds)) {
ret = _mv88e6xxx_reg_read(ds, REG_GLOBAL,
GLOBAL_VTU_SID);
if (ret < 0)
@@ -1412,8 +1424,7 @@ static int _mv88e6xxx_vtu_loadpurge(struct dsa_switch *ds,
if (ret < 0)
return ret;
- if (mv88e6xxx_6097_family(ds) || mv88e6xxx_6165_family(ds) ||
- mv88e6xxx_6351_family(ds) || mv88e6xxx_6352_family(ds)) {
+ if (mv88e6xxx_has_stu(ds)) {
reg = entry->sid & GLOBAL_VTU_SID_MASK;
ret = _mv88e6xxx_reg_write(ds, REG_GLOBAL, GLOBAL_VTU_SID, reg);
if (ret < 0)
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH net-next v2 0/6] net: dsa: mv88e6131: HW bridging support for 6185 Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-03-31 23:00 +0200
[PATCH net-next v2 2/6] net: dsa: mv88e6xxx: protect FID registers access Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-03-31 23:00 +0200
[PATCH net-next v2 3/6] net: dsa: mv88e6xxx: variable number of databases Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-03-31 23:00 +0200
[PATCH net-next v2 1/6] net: dsa: mv88e6xxx: protect SID register access Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-03-31 23:00 +0200
[PATCH net-next v2 4/6] net: dsa: mv88e6xxx: support 256 databases Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-03-31 23:00 +0200
[PATCH net-next v2 5/6] net: dsa: mv88e6xxx: map destination addresses for 6185 Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-03-31 23:00 +0200
[PATCH net-next v2 6/6] net: dsa: mv88e6131: enable hardware bridging Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-03-31 23:00 +0200
Re: [PATCH net-next v2 0/6] net: dsa: mv88e6131: HW bridging support for 6185 Andrew Lunn <andrew@lunn.ch> - 2016-04-01 14:50 +0200
Re: [PATCH net-next v2 0/6] net: dsa: mv88e6131: HW bridging support for 6185 Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-04-01 15:40 +0200
csiph-web