generic: ar8216: add mib_poll_interval switch attribute
[openwrt/staging/dedeckeh.git] / target / linux / generic / files / drivers / net / phy / ar8327.c
index 36a4520678f9c8fd1447dfa1a8d4e223801840a3..c2964169eb26bbde085100d7ed3699d86a5250df 100644 (file)
@@ -1321,6 +1321,13 @@ static const struct switch_attr ar8327_sw_attr_globals[] = {
                .description = "Reset all MIB counters",
                .set = ar8xxx_sw_set_reset_mibs,
        },
+       {
+               .type = SWITCH_TYPE_INT,
+               .name = "ar8xxx_mib_poll_interval",
+               .description = "MIB polling interval in msecs (0 to disable)",
+               .set = ar8xxx_sw_set_mib_poll_interval,
+               .get = ar8xxx_sw_get_mib_poll_interval
+       },
        {
                .type = SWITCH_TYPE_INT,
                .name = "enable_mirror_rx",
@@ -1457,16 +1464,7 @@ static const struct switch_dev_ops ar8327_sw_ops = {
        .apply_config = ar8327_sw_hw_apply,
        .reset_switch = ar8xxx_sw_reset_switch,
        .get_port_link = ar8xxx_sw_get_port_link,
-/* The following op is disabled as it hogs the CPU and degrades performance.
-   An implementation has been attempted in 4d8a66d but reading MIB data is slow
-   on ar8xxx switches.
-
-   The high CPU load has been traced down to the ar8xxx_reg_wait() call in
-   ar8xxx_mib_op(), which has to usleep_range() till the MIB busy flag set by
-   the request to update the MIB counter is cleared. */
-#if 0
        .get_port_stats = ar8xxx_sw_get_port_stats,
-#endif
 };
 
 const struct ar8xxx_chip ar8327_chip = {
@@ -1501,7 +1499,9 @@ const struct ar8xxx_chip ar8327_chip = {
 
        .num_mibs = ARRAY_SIZE(ar8236_mibs),
        .mib_decs = ar8236_mibs,
-       .mib_func = AR8327_REG_MIB_FUNC
+       .mib_func = AR8327_REG_MIB_FUNC,
+       .mib_rxb_id = AR8236_MIB_RXB_ID,
+       .mib_txb_id = AR8236_MIB_TXB_ID,
 };
 
 const struct ar8xxx_chip ar8337_chip = {
@@ -1537,5 +1537,7 @@ const struct ar8xxx_chip ar8337_chip = {
 
        .num_mibs = ARRAY_SIZE(ar8236_mibs),
        .mib_decs = ar8236_mibs,
-       .mib_func = AR8327_REG_MIB_FUNC
+       .mib_func = AR8327_REG_MIB_FUNC,
+       .mib_rxb_id = AR8236_MIB_RXB_ID,
+       .mib_txb_id = AR8236_MIB_TXB_ID,
 };