]> git.sur5r.net Git - u-boot/commitdiff
drivers: net: vsc9953: Fix FDB aging time
authorCodrin Ciubotariu <codrin.ciubotariu@freescale.com>
Tue, 15 Dec 2015 13:21:03 +0000 (15:21 +0200)
committerJoe Hershberger <joe.hershberger@ni.com>
Thu, 28 Jan 2016 18:22:08 +0000 (12:22 -0600)
By default, the aging period is set to 0, so the dynamic
FDB entries are never removed. This patch sets the aging
time to 300 seconds.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/vsc9953.c
include/vsc9953.h

index 7595db1acbd3e368d1a1f0d7a04811350aa3da03..160f4782e412f92c28706bb17937132030e32f94 100644 (file)
@@ -593,6 +593,25 @@ static void vsc9953_port_all_vlan_egress_untagged_set(
                vsc9953_port_vlan_egr_untag_set(i, mode);
 }
 
+static int vsc9953_autoage_time_set(int age_period)
+{
+       u32 autoage;
+       struct vsc9953_analyzer *l2ana_reg;
+
+       l2ana_reg = (struct vsc9953_analyzer *)(VSC9953_OFFSET +
+                                               VSC9953_ANA_OFFSET);
+
+       if (age_period < 0 || age_period > VSC9953_AUTOAGE_PERIOD_MASK)
+               return -EINVAL;
+
+       autoage = bitfield_replace_by_mask(in_le32(&l2ana_reg->ana.auto_age),
+                                          VSC9953_AUTOAGE_PERIOD_MASK,
+                                          age_period);
+       out_le32(&l2ana_reg->ana.auto_age, autoage);
+
+       return 0;
+}
+
 #ifdef CONFIG_CMD_ETHSW
 
 /* Enable/disable status of a VSC9953 port */
@@ -2107,6 +2126,10 @@ void vsc9953_default_configuration(void)
 {
        int i;
 
+       if (vsc9953_autoage_time_set(VSC9953_DEFAULT_AGE_TIME))
+               debug("VSC9953: failed to set AGE time to %d\n",
+                     VSC9953_DEFAULT_AGE_TIME);
+
        for (i = 0; i < VSC9953_MAX_VLAN; i++)
                vsc9953_vlan_table_membership_all_set(i, 0);
        vsc9953_port_all_vlan_aware_set(1);
index 00aa2227f45f97ac3449531ad81774b45d010e47..35fcbb51cc5c92c587ec144eef364876802714a3 100644 (file)
 /* Macros for vsc9953_ana_ana.adv_learn register */
 #define VSC9953_VLAN_CHK               0x00000400
 
+/* Macros for vsc9953_ana_ana.auto_age register */
+#define VSC9953_AUTOAGE_PERIOD_MASK    0x001ffffe
+
 /* Macros for vsc9953_rew_port.port_tag_cfg register */
 #define VSC9953_TAG_CFG_MASK           0x00000180
 #define VSC9953_TAG_CFG_NONE           0x00000000
 #define VSC9953_MAX_VLAN               4096
 #define VSC9953_VLAN_CHECK(vid)        \
        (((vid) < 0 || (vid) >= VSC9953_MAX_VLAN) ? 0 : 1)
+#define VSC9953_DEFAULT_AGE_TIME       300
 
 #define DEFAULT_VSC9953_MDIO_NAME      "VSC9953_MDIO0"