Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1598481 > unrolled thread
| Started by | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| First post | 2017-03-11 22:20 +0100 |
| Last post | 2017-03-13 08:00 +0100 |
| Articles | 7 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH net-next v2 00/17] net: dsa: mv88e6xxx: rework ATU support Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-03-11 22:20 +0100
[PATCH net-next v2 02/17] net: dsa: mv88e6xxx: move ATU ageing time setter Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-03-11 22:30 +0100
[PATCH net-next v2 03/17] net: dsa: mv88e6xxx: add ATU setup helper Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-03-11 22:30 +0100
Re: [PATCH net-next v2 03/17] net: dsa: mv88e6xxx: add ATU setup helper Andrew Lunn <andrew@lunn.ch> - 2017-03-12 01:00 +0100
Re: [PATCH net-next v2 00/17] net: dsa: mv88e6xxx: rework ATU support Florian Fainelli <f.fainelli@gmail.com> - 2017-03-12 03:30 +0100
Re: [PATCH net-next v2 00/17] net: dsa: mv88e6xxx: rework ATU support Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-03-13 16:00 +0100
Re: [PATCH net-next v2 00/17] net: dsa: mv88e6xxx: rework ATU support David Miller <davem@davemloft.net> - 2017-03-13 08:00 +0100
| From | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| Date | 2017-03-11 22:20 +0100 |
| Subject | [PATCH net-next v2 00/17] net: dsa: mv88e6xxx: rework ATU support |
| Message-ID | <tjWAF-8vE-3@gated-at.bofh.it> |
The purpose of this patch series is to rework the code related to the Address Translation Unit (ATU), and bring support for it to the 88E6390 family of switch chips. All Global (1) ATU related code have been reworked and moved to its own file. Some port related bits used for ATU configuration (such as the Learn2All and MessagePort feature) have also been taken care of. The ports' mode and egress flooding mode have been refactored to fix the egress of frames with unknown unicast or multicast destination address, and write all these bits regardless the port mode (Normal, DSA, etc.) Finally remove the eth_addr_greater which was only used by mv88e6xxx. Changes in v2: - add Reviewed-by tags - split mv88e6xxx_g1_atu_set_age_time and mv88e6xxx_atu_setup addition - remove DSA_TAG_PROTO_TRAILER check - split Message Port and Learn2All addition - remove unused MV88E6XXX_FLAG_G1_ATU_FID flag - add dsa_is_normal_port helper Vivien Didelot (17): net: dsa: mv88e6xxx: add port mask helper net: dsa: mv88e6xxx: move ATU ageing time setter net: dsa: mv88e6xxx: add ATU setup helper net: dsa: mv88e6xxx: setup message ports net: dsa: mv88e6xxx: enable ATU Learn2All net: dsa: mv88e6xxx: rework ATU Load/Purge net: dsa: mv88e6xxx: rework ATU GetNext net: dsa: mv88e6xxx: rework ATU Flush net: dsa: mv88e6xxx: rework ATU Remove net: dsa: mv88e6xxx: rename new FID helper net: dsa: mv88e6xxx: rename the port vector member net: dsa: add dsa_is_normal_port helper net: dsa: mv88e6xxx: rework port mode setup net: dsa: mv88e6xxx: fix port egress flooding mode net: dsa: mv88e6xxx: add port ATU learn limit op net: dsa: mv88e6xxx: add port priority override op etherdevice: remove unused eth_addr_greater drivers/net/dsa/mv88e6xxx/Makefile | 1 + drivers/net/dsa/mv88e6xxx/chip.c | 667 +++++++++++--------------------- drivers/net/dsa/mv88e6xxx/global1.h | 11 + drivers/net/dsa/mv88e6xxx/global1_atu.c | 300 ++++++++++++++ drivers/net/dsa/mv88e6xxx/mv88e6xxx.h | 44 ++- drivers/net/dsa/mv88e6xxx/port.c | 78 +++- drivers/net/dsa/mv88e6xxx/port.h | 16 +- include/linux/etherdevice.h | 15 - include/net/dsa.h | 5 + 9 files changed, 638 insertions(+), 499 deletions(-) create mode 100644 drivers/net/dsa/mv88e6xxx/global1_atu.c -- 2.12.0
[toc] | [next] | [standalone]
| From | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| Date | 2017-03-11 22:30 +0100 |
| Subject | [PATCH net-next v2 02/17] net: dsa: mv88e6xxx: move ATU ageing time setter |
| Message-ID | <tjWKl-7E-5@gated-at.bofh.it> |
| In reply to | #1598481 |
Move the ATU ageing time setter code in a new global1_atu.c file, which
will be extended in future patches to contains all consequent Global (1)
ATU support code.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/mv88e6xxx/Makefile | 1 +
drivers/net/dsa/mv88e6xxx/chip.c | 31 ++----------------------
drivers/net/dsa/mv88e6xxx/global1.h | 3 +++
drivers/net/dsa/mv88e6xxx/global1_atu.c | 43 +++++++++++++++++++++++++++++++++
4 files changed, 49 insertions(+), 29 deletions(-)
create mode 100644 drivers/net/dsa/mv88e6xxx/global1_atu.c
diff --git a/drivers/net/dsa/mv88e6xxx/Makefile b/drivers/net/dsa/mv88e6xxx/Makefile
index c36be318de1a..31d37a90cec7 100644
--- a/drivers/net/dsa/mv88e6xxx/Makefile
+++ b/drivers/net/dsa/mv88e6xxx/Makefile
@@ -1,5 +1,6 @@
obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx.o
mv88e6xxx-objs := chip.o
mv88e6xxx-objs += global1.o
+mv88e6xxx-objs += global1_atu.o
mv88e6xxx-$(CONFIG_NET_DSA_MV88E6XXX_GLOBAL2) += global2.o
mv88e6xxx-objs += port.o
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 03dc886ed3d6..b228b8491afc 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -2697,33 +2697,6 @@ static int mv88e6xxx_g1_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr)
return 0;
}
-static int mv88e6xxx_g1_set_age_time(struct mv88e6xxx_chip *chip,
- unsigned int msecs)
-{
- const unsigned int coeff = chip->info->age_time_coeff;
- const unsigned int min = 0x01 * coeff;
- const unsigned int max = 0xff * coeff;
- u8 age_time;
- u16 val;
- int err;
-
- if (msecs < min || msecs > max)
- return -ERANGE;
-
- /* Round to nearest multiple of coeff */
- age_time = (msecs + coeff / 2) / coeff;
-
- err = mv88e6xxx_g1_read(chip, GLOBAL_ATU_CONTROL, &val);
- if (err)
- return err;
-
- /* AgeTime is 11:4 bits */
- val &= ~0xff0;
- val |= age_time << 4;
-
- return mv88e6xxx_g1_write(chip, GLOBAL_ATU_CONTROL, val);
-}
-
static int mv88e6xxx_set_ageing_time(struct dsa_switch *ds,
unsigned int ageing_time)
{
@@ -2731,7 +2704,7 @@ static int mv88e6xxx_set_ageing_time(struct dsa_switch *ds,
int err;
mutex_lock(&chip->reg_lock);
- err = mv88e6xxx_g1_set_age_time(chip, ageing_time);
+ err = mv88e6xxx_g1_atu_set_age_time(chip, ageing_time);
mutex_unlock(&chip->reg_lock);
return err;
@@ -2783,7 +2756,7 @@ static int mv88e6xxx_g1_setup(struct mv88e6xxx_chip *chip)
if (err)
return err;
- err = mv88e6xxx_g1_set_age_time(chip, 300000);
+ err = mv88e6xxx_g1_atu_set_age_time(chip, 300000);
if (err)
return err;
diff --git a/drivers/net/dsa/mv88e6xxx/global1.h b/drivers/net/dsa/mv88e6xxx/global1.h
index 1aec7382c02d..b8d0fb519bab 100644
--- a/drivers/net/dsa/mv88e6xxx/global1.h
+++ b/drivers/net/dsa/mv88e6xxx/global1.h
@@ -38,4 +38,7 @@ int mv88e6095_g1_set_cpu_port(struct mv88e6xxx_chip *chip, int port);
int mv88e6390_g1_set_cpu_port(struct mv88e6xxx_chip *chip, int port);
int mv88e6390_g1_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip);
+int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip,
+ unsigned int msecs);
+
#endif /* _MV88E6XXX_GLOBAL1_H */
diff --git a/drivers/net/dsa/mv88e6xxx/global1_atu.c b/drivers/net/dsa/mv88e6xxx/global1_atu.c
new file mode 100644
index 000000000000..4d0ada9efc6d
--- /dev/null
+++ b/drivers/net/dsa/mv88e6xxx/global1_atu.c
@@ -0,0 +1,43 @@
+/*
+ * Marvell 88E6xxx Address Translation Unit (ATU) support
+ *
+ * Copyright (c) 2008 Marvell Semiconductor
+ * Copyright (c) 2017 Savoir-faire Linux, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include "mv88e6xxx.h"
+#include "global1.h"
+
+/* Offset 0x0A: ATU Control Register */
+
+int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip,
+ unsigned int msecs)
+{
+ const unsigned int coeff = chip->info->age_time_coeff;
+ const unsigned int min = 0x01 * coeff;
+ const unsigned int max = 0xff * coeff;
+ u8 age_time;
+ u16 val;
+ int err;
+
+ if (msecs < min || msecs > max)
+ return -ERANGE;
+
+ /* Round to nearest multiple of coeff */
+ age_time = (msecs + coeff / 2) / coeff;
+
+ err = mv88e6xxx_g1_read(chip, GLOBAL_ATU_CONTROL, &val);
+ if (err)
+ return err;
+
+ /* AgeTime is 11:4 bits */
+ val &= ~0xff0;
+ val |= age_time << 4;
+
+ return mv88e6xxx_g1_write(chip, GLOBAL_ATU_CONTROL, val);
+}
--
2.12.0
[toc] | [prev] | [next] | [standalone]
| From | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| Date | 2017-03-11 22:30 +0100 |
| Subject | [PATCH net-next v2 03/17] net: dsa: mv88e6xxx: add ATU setup helper |
| Message-ID | <tjWKl-7E-7@gated-at.bofh.it> |
| In reply to | #1598481 |
Move the configuration of the default ageing time in a new
mv88e6xxx_atu_setup function.
That function will be extended later to contain all ATU related
configuration bits.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index b228b8491afc..0ad8200f3321 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1306,6 +1306,11 @@ static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port,
netdev_err(ds->ports[port].netdev, "failed to update state\n");
}
+static int mv88e6xxx_atu_setup(struct mv88e6xxx_chip *chip)
+{
+ return mv88e6xxx_g1_atu_set_age_time(chip, 300000);
+}
+
static void mv88e6xxx_port_fast_age(struct dsa_switch *ds, int port)
{
struct mv88e6xxx_chip *chip = ds->priv;
@@ -2756,10 +2761,6 @@ static int mv88e6xxx_g1_setup(struct mv88e6xxx_chip *chip)
if (err)
return err;
- err = mv88e6xxx_g1_atu_set_age_time(chip, 300000);
- if (err)
- return err;
-
/* Clear all ATU entries */
err = _mv88e6xxx_atu_flush(chip, 0, true);
if (err)
@@ -2845,6 +2846,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
goto unlock;
}
+ err = mv88e6xxx_atu_setup(chip);
+ if (err)
+ goto unlock;
+
/* Some generations have the configuration of sending reserved
* management frames to the CPU in global2, others in
* global1. Hence it does not fit the two setup functions
--
2.12.0
[toc] | [prev] | [next] | [standalone]
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Date | 2017-03-12 01:00 +0100 |
| Subject | Re: [PATCH net-next v2 03/17] net: dsa: mv88e6xxx: add ATU setup helper |
| Message-ID | <tjZ5v-1EP-3@gated-at.bofh.it> |
| In reply to | #1598485 |
On Sat, Mar 11, 2017 at 04:12:49PM -0500, Vivien Didelot wrote:
> Move the configuration of the default ageing time in a new
> mv88e6xxx_atu_setup function.
>
> That function will be extended later to contain all ATU related
> configuration bits.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
[toc] | [prev] | [next] | [standalone]
| From | Florian Fainelli <f.fainelli@gmail.com> |
|---|---|
| Date | 2017-03-12 03:30 +0100 |
| Message-ID | <tk1qG-3is-3@gated-at.bofh.it> |
| In reply to | #1598481 |
Le 03/11/17 à 13:12, Vivien Didelot a écrit : > The purpose of this patch series is to rework the code related to the > Address Translation Unit (ATU), and bring support for it to the 88E6390 > family of switch chips. > > All Global (1) ATU related code have been reworked and moved to its own > file. Some port related bits used for ATU configuration (such as the > Learn2All and MessagePort feature) have also been taken care of. > > The ports' mode and egress flooding mode have been refactored to fix the > egress of frames with unknown unicast or multicast destination address, > and write all these bits regardless the port mode (Normal, DSA, etc.) > > Finally remove the eth_addr_greater which was only used by mv88e6xxx. Just some general note on the way the driver seems to be going there seems to be a multiplication of new ops being introduced, and most of them seem to default to the mv88e6xxx (generic) ones. Should you do something like: if (!ops->foo) ops->foo = mv88e6xxx_foo Such that you reduce the possibility for a specific switch model to lack such an operation? > > Changes in v2: > - add Reviewed-by tags > - split mv88e6xxx_g1_atu_set_age_time and mv88e6xxx_atu_setup addition > - remove DSA_TAG_PROTO_TRAILER check > - split Message Port and Learn2All addition > - remove unused MV88E6XXX_FLAG_G1_ATU_FID flag > - add dsa_is_normal_port helper > > Vivien Didelot (17): > net: dsa: mv88e6xxx: add port mask helper > net: dsa: mv88e6xxx: move ATU ageing time setter > net: dsa: mv88e6xxx: add ATU setup helper > net: dsa: mv88e6xxx: setup message ports > net: dsa: mv88e6xxx: enable ATU Learn2All > net: dsa: mv88e6xxx: rework ATU Load/Purge > net: dsa: mv88e6xxx: rework ATU GetNext > net: dsa: mv88e6xxx: rework ATU Flush > net: dsa: mv88e6xxx: rework ATU Remove > net: dsa: mv88e6xxx: rename new FID helper > net: dsa: mv88e6xxx: rename the port vector member > net: dsa: add dsa_is_normal_port helper > net: dsa: mv88e6xxx: rework port mode setup > net: dsa: mv88e6xxx: fix port egress flooding mode > net: dsa: mv88e6xxx: add port ATU learn limit op > net: dsa: mv88e6xxx: add port priority override op > etherdevice: remove unused eth_addr_greater > > drivers/net/dsa/mv88e6xxx/Makefile | 1 + > drivers/net/dsa/mv88e6xxx/chip.c | 667 +++++++++++--------------------- > drivers/net/dsa/mv88e6xxx/global1.h | 11 + > drivers/net/dsa/mv88e6xxx/global1_atu.c | 300 ++++++++++++++ > drivers/net/dsa/mv88e6xxx/mv88e6xxx.h | 44 ++- > drivers/net/dsa/mv88e6xxx/port.c | 78 +++- > drivers/net/dsa/mv88e6xxx/port.h | 16 +- > include/linux/etherdevice.h | 15 - > include/net/dsa.h | 5 + > 9 files changed, 638 insertions(+), 499 deletions(-) > create mode 100644 drivers/net/dsa/mv88e6xxx/global1_atu.c > -- Florian
[toc] | [prev] | [next] | [standalone]
| From | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| Date | 2017-03-13 16:00 +0100 |
| Message-ID | <tkzC2-1Yl-11@gated-at.bofh.it> |
| In reply to | #1598532 |
Hi Florian,
Florian Fainelli <f.fainelli@gmail.com> writes:
> Just some general note on the way the driver seems to be going there
> seems to be a multiplication of new ops being introduced, and most of
> them seem to default to the mv88e6xxx (generic) ones. Should you do
> something like:
>
> if (!ops->foo)
> ops->foo = mv88e6xxx_foo
>
> Such that you reduce the possibility for a specific switch model to lack
> such an operation?
You are correct, ideally generic library functions (the one starting
with the mv88e6xxx_ prefix) should not be assigned to ops.
The ops are const though. I'll come up with something maintainable.
Thanks!
Vivien
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-03-13 08:00 +0100 |
| Subject | Re: [PATCH net-next v2 00/17] net: dsa: mv88e6xxx: rework ATU support |
| Message-ID | <tks7w-53e-5@gated-at.bofh.it> |
| In reply to | #1598481 |
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Date: Sat, 11 Mar 2017 16:12:46 -0500 > The purpose of this patch series is to rework the code related to the > Address Translation Unit (ATU), and bring support for it to the 88E6390 > family of switch chips. > > All Global (1) ATU related code have been reworked and moved to its own > file. Some port related bits used for ATU configuration (such as the > Learn2All and MessagePort feature) have also been taken care of. > > The ports' mode and egress flooding mode have been refactored to fix the > egress of frames with unknown unicast or multicast destination address, > and write all these bits regardless the port mode (Normal, DSA, etc.) > > Finally remove the eth_addr_greater which was only used by mv88e6xxx. > > Changes in v2: > - add Reviewed-by tags > - split mv88e6xxx_g1_atu_set_age_time and mv88e6xxx_atu_setup addition > - remove DSA_TAG_PROTO_TRAILER check > - split Message Port and Learn2All addition > - remove unused MV88E6XXX_FLAG_G1_ATU_FID flag > - add dsa_is_normal_port helper Series applied.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web