forked from Ivasoft/openwrt
generic: ar8216: group MIB counters and use two basic ones only by default
There are too many MIB counters that almost nobody needs since commit
d6366ce366 ("generic: ar8216: mib_work_func: read all port mibs
everytime").
In the worker function to poll MIB data, it deals with all ports instead
of only one port every time, which introduces too many mdio operations
that it becomes a heavy CPU load even on not-emulated MDIO bus.
This commit groups MIB counters and enable only TxBytes and RxGoodBytes
by default (both of which are necessary to get swconfig led working.)
and adds an swconfig attribute to allow enabling all counters if users
need them.
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
This commit is contained in:
committed by
Petr Štetiar
parent
107dc4326c
commit
01c0d7f86f
@@ -389,6 +389,12 @@ enum {
|
||||
AR8216_PORT_STATE_FORWARD = 4
|
||||
};
|
||||
|
||||
/* mib counter type */
|
||||
enum {
|
||||
AR8XXX_MIB_BASIC = 0,
|
||||
AR8XXX_MIB_EXTENDED = 1
|
||||
};
|
||||
|
||||
enum {
|
||||
AR8XXX_VER_AR8216 = 0x01,
|
||||
AR8XXX_VER_AR8236 = 0x03,
|
||||
@@ -415,6 +421,7 @@ struct ar8xxx_mib_desc {
|
||||
unsigned int size;
|
||||
unsigned int offset;
|
||||
const char *name;
|
||||
u8 type;
|
||||
};
|
||||
|
||||
struct ar8xxx_chip {
|
||||
@@ -490,6 +497,7 @@ struct ar8xxx_priv {
|
||||
struct delayed_work mib_work;
|
||||
u64 *mib_stats;
|
||||
u32 mib_poll_interval;
|
||||
u8 mib_type;
|
||||
|
||||
struct list_head list;
|
||||
unsigned int use_count;
|
||||
@@ -552,6 +560,14 @@ ar8xxx_sw_get_mib_poll_interval(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val);
|
||||
int
|
||||
ar8xxx_sw_set_mib_type(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val);
|
||||
int
|
||||
ar8xxx_sw_get_mib_type(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val);
|
||||
int
|
||||
ar8xxx_sw_set_mirror_rx_enable(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val);
|
||||
|
||||
Reference in New Issue
Block a user