Re: [PATCH net-next 6/7] net: dsa: mv88e6xxx: add number of database to info

2016-04-15 Thread Andrew Lunn
On Fri, Apr 15, 2016 at 04:24:26PM -0400, Vivien Didelot wrote:
> Hi Andrew,
> 
> Andrew Lunn  writes:
> 
> > On Fri, Apr 15, 2016 at 02:25:49PM -0400, Vivien Didelot wrote:
> >> Move the number of databases to the info structure.
> >
> > Isn't the number of databases a property of the family?
> 
> No.

O.K, then lets put it in the device info table.

 Andrew


Re: [PATCH net-next 6/7] net: dsa: mv88e6xxx: add number of database to info

2016-04-15 Thread Vivien Didelot
Hi Andrew,

Andrew Lunn  writes:

> On Fri, Apr 15, 2016 at 02:25:49PM -0400, Vivien Didelot wrote:
>> Move the number of databases to the info structure.
>
> Isn't the number of databases a property of the family?

No.

We've seen [1] for instance that 6061 and 6065 are both part of the 6065
family, but 6061 has 16 databases while 6065 has 64 databases.

> I would add a table indexed by family.

I'm not even sure every Marvell switch has a family. I think we really
want a table of supported *devices*.

To go further, with the coming feature-based logic, checking the family
might not even be that valuable.

[1] https://lkml.org/lkml/2016/3/26/155

Thanks,
Vivien


Re: [PATCH net-next 6/7] net: dsa: mv88e6xxx: add number of database to info

2016-04-15 Thread Andrew Lunn
On Fri, Apr 15, 2016 at 02:25:49PM -0400, Vivien Didelot wrote:
> Move the number of databases to the info structure.

Isn't the number of databases a property of the family?

I would add a table indexed by family.

  Andrew


[PATCH net-next 6/7] net: dsa: mv88e6xxx: add number of database to info

2016-04-15 Thread Vivien Didelot
Move the number of databases to the info structure.

Signed-off-by: Vivien Didelot 
---
 drivers/net/dsa/mv88e6123.c |  6 +++---
 drivers/net/dsa/mv88e6131.c |  8 
 drivers/net/dsa/mv88e6171.c |  8 
 drivers/net/dsa/mv88e6352.c | 12 ++--
 drivers/net/dsa/mv88e6xxx.c | 19 +--
 drivers/net/dsa/mv88e6xxx.h |  4 +++-
 6 files changed, 21 insertions(+), 36 deletions(-)

diff --git a/drivers/net/dsa/mv88e6123.c b/drivers/net/dsa/mv88e6123.c
index 2048719..9731e56 100644
--- a/drivers/net/dsa/mv88e6123.c
+++ b/drivers/net/dsa/mv88e6123.c
@@ -18,9 +18,9 @@
 #include "mv88e6xxx.h"
 
 static const struct mv88e6xxx_info mv88e6123_table[] = {
-   { MV88E6XXX_INFO(6165, 0x121, 3, "Marvell 88E6123") },
-   { MV88E6XXX_INFO(6165, 0x161, 6, "Marvell 88E6161") },
-   { MV88E6XXX_INFO(6165, 0x165, 6, "Marvell 88E6165") },
+   { MV88E6XXX_INFO(6165, 0x121, 3, 4096, "Marvell 88E6123") },
+   { MV88E6XXX_INFO(6165, 0x161, 6, 4096, "Marvell 88E6161") },
+   { MV88E6XXX_INFO(6165, 0x165, 6, 4096, "Marvell 88E6165") },
 };
 
 static char *mv88e6123_drv_probe(struct device *dsa_dev,
diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c
index 2eb9fa3..c507ecb 100644
--- a/drivers/net/dsa/mv88e6131.c
+++ b/drivers/net/dsa/mv88e6131.c
@@ -18,10 +18,10 @@
 #include "mv88e6xxx.h"
 
 static const struct mv88e6xxx_info mv88e6131_table[] = {
-   { MV88E6XXX_INFO(6095, 0x095, 11, "Marvell 88E6095/88E6095F") },
-   { MV88E6XXX_INFO(6097, 0x04a, 10, "Marvell 88E6085") },
-   { MV88E6XXX_INFO(6185, 0x106, 8,  "Marvell 88E6131") },
-   { MV88E6XXX_INFO(6185, 0x1a7, 10, "Marvell 88E6185") },
+   { MV88E6XXX_INFO(6095, 0x095, 11, 256,  "Marvell 88E6095/88E6095F") },
+   { MV88E6XXX_INFO(6097, 0x04a, 10, 4096, "Marvell 88E6085") },
+   { MV88E6XXX_INFO(6185, 0x106, 8,  256,  "Marvell 88E6131") },
+   { MV88E6XXX_INFO(6185, 0x1a7, 10, 256,  "Marvell 88E6185") },
 };
 
 static char *mv88e6131_drv_probe(struct device *dsa_dev,
diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c
index d5f33d7..bce8f40 100644
--- a/drivers/net/dsa/mv88e6171.c
+++ b/drivers/net/dsa/mv88e6171.c
@@ -18,10 +18,10 @@
 #include "mv88e6xxx.h"
 
 static const struct mv88e6xxx_info mv88e6171_table[] = {
-   { MV88E6XXX_INFO(6351, 0x171, 7, "Marvell 88E6171") },
-   { MV88E6XXX_INFO(6351, 0x175, 7, "Marvell 88E6175") },
-   { MV88E6XXX_INFO(6351, 0x371, 7, "Marvell 88E6350") },
-   { MV88E6XXX_INFO(6351, 0x375, 7, "Marvell 88E6351") },
+   { MV88E6XXX_INFO(6351, 0x171, 7, 4096, "Marvell 88E6171") },
+   { MV88E6XXX_INFO(6351, 0x175, 7, 4096, "Marvell 88E6175") },
+   { MV88E6XXX_INFO(6351, 0x371, 7, 4096, "Marvell 88E6350") },
+   { MV88E6XXX_INFO(6351, 0x375, 7, 4096, "Marvell 88E6351") },
 };
 
 static char *mv88e6171_drv_probe(struct device *dsa_dev,
diff --git a/drivers/net/dsa/mv88e6352.c b/drivers/net/dsa/mv88e6352.c
index e529c18..c26d674 100644
--- a/drivers/net/dsa/mv88e6352.c
+++ b/drivers/net/dsa/mv88e6352.c
@@ -23,12 +23,12 @@
 #include "mv88e6xxx.h"
 
 static const struct mv88e6xxx_info mv88e6352_table[] = {
-   { MV88E6XXX_INFO(6320, 0x115, 7, "Marvell 88E6320") },
-   { MV88E6XXX_INFO(6320, 0x310, 7, "Marvell 88E6321") },
-   { MV88E6XXX_INFO(6352, 0x172, 7, "Marvell 88E6172") },
-   { MV88E6XXX_INFO(6352, 0x176, 7, "Marvell 88E6176") },
-   { MV88E6XXX_INFO(6352, 0x240, 7, "Marvell 88E6240") },
-   { MV88E6XXX_INFO(6352, 0x352, 7, "Marvell 88E6352") },
+   { MV88E6XXX_INFO(6320, 0x115, 7, 4096, "Marvell 88E6320") },
+   { MV88E6XXX_INFO(6320, 0x310, 7, 4096, "Marvell 88E6321") },
+   { MV88E6XXX_INFO(6352, 0x172, 7, 4096, "Marvell 88E6172") },
+   { MV88E6XXX_INFO(6352, 0x176, 7, 4096, "Marvell 88E6176") },
+   { MV88E6XXX_INFO(6352, 0x240, 7, 4096, "Marvell 88E6240") },
+   { MV88E6XXX_INFO(6352, 0x352, 7, 4096, "Marvell 88E6352") },
 };
 
 static char *mv88e6352_drv_probe(struct device *dsa_dev,
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index f3e8c68..d40ac4d 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -425,24 +425,7 @@ static unsigned int mv88e6xxx_num_databases(struct 
dsa_switch *ds)
 {
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
 
-   /* The following devices have 4-bit identifiers for 16 databases */
-   if (ps->id == PORT_SWITCH_ID_6061)
-   return 16;
-
-   /* The following devices have 6-bit identifiers for 64 databases */
-   if (ps->id == PORT_SWITCH_ID_6065)
-   return 64;
-
-   /* The following devices have 8-bit identifiers for 256 databases */
-   if (mv88e6xxx_6095_family(ds) || mv88e6xxx_6185_family(ds))
-   return 256;
-
-   /* The following devices have 12-bit identifiers for 4096 databases */
-   if (mv88e6xxx_6097_family(ds) || mv88e6xxx_6165_family(ds)