generic: rtl8366: use SWITCH_TYPE_NOVAL for reset_mib attributes
[openwrt.git] / target / linux / generic / files / drivers / net / phy / rtl8366s.c
index 91030ac..5672c42 100644 (file)
 
 #define RTL8366S_VLAN_MEMCONF_BASE             0x0016
 
+#define RTL8366S_VLAN_MEMBERINGRESS_REG                0x0379
 
 #define RTL8366S_PORT_LINK_STATUS_BASE         0x0060
 #define RTL8366S_PORT_STATUS_SPEED_MASK                0x0003
@@ -299,6 +300,12 @@ static int rtl8366s_hw_init(struct rtl8366_smi *smi)
        /* disable auto ageing for all ports */
        REG_WR(smi, RTL8366S_SSCR1, RTL8366S_PORT_ALL);
 
+       /*
+        * discard VLAN tagged packets if the port is not a member of
+        * the VLAN with which the packets is associated.
+        */
+       REG_WR(smi, RTL8366S_VLAN_MEMBERINGRESS_REG, RTL8366S_PORT_ALL);
+
        /* don't drop packets whose DA has not been learned */
        REG_RMW(smi, RTL8366S_SSCR2, RTL8366S_SSCR2_DROP_UNKNOWN_DA, 0);
 
@@ -657,12 +664,8 @@ static int rtl8366s_sw_reset_mibs(struct switch_dev *dev,
                                  struct switch_val *val)
 {
        struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
-       int err = 0;
-
-       if (val->value.i == 1)
-               err = rtl8366_smi_rmwr(smi, RTL8366S_MIB_CTRL_REG, 0, (1 << 2));
 
-       return err;
+       return rtl8366_smi_rmwr(smi, RTL8366S_MIB_CTRL_REG, 0, (1 << 2));
 }
 
 static int rtl8366s_sw_get_vlan_enable(struct switch_dev *dev,
@@ -1013,12 +1016,10 @@ static struct switch_attr rtl8366s_globals[] = {
                .max = 1,
                .ofs = 2
        }, {
-               .type = SWITCH_TYPE_INT,
+               .type = SWITCH_TYPE_NOVAL,
                .name = "reset_mibs",
                .description = "Reset all MIB counters",
                .set = rtl8366s_sw_reset_mibs,
-               .get = NULL,
-               .max = 1
        }, {
                .type = SWITCH_TYPE_INT,
                .name = "blinkrate",
@@ -1039,12 +1040,10 @@ static struct switch_attr rtl8366s_port[] = {
                .set = NULL,
                .get = rtl8366s_sw_get_port_link,
        }, {
-               .type = SWITCH_TYPE_INT,
+               .type = SWITCH_TYPE_NOVAL,
                .name = "reset_mib",
                .description = "Reset single port MIB counters",
-               .max = 1,
                .set = rtl8366s_sw_reset_port_mibs,
-               .get = NULL,
        }, {
                .type = SWITCH_TYPE_STRING,
                .name = "mib",
This page took 0.03034 seconds and 4 git commands to generate.