diff options
author | John Crispin <john@phrozen.org> | 2017-08-22 09:10:58 +0200 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2017-08-22 09:10:58 +0200 |
commit | b5731bfbabaf7aab0fc47143bd6ad0b12cc3df0a (patch) | |
tree | 747743efa83dc28a6b3b73bda992ad970786af48 /device.c | |
parent | 2a29d1a8d45f164e9a3fda31264bf70b8f90d9ad (diff) |
allow setting rps/xps defualt values via uci
Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -33,6 +33,9 @@ static struct list_head devtypes = LIST_HEAD_INIT(devtypes); static struct avl_tree devices; static bool default_ps = true; +static int default_rps_val; +static int default_rps_flow_cnt; +static int default_xps_val; static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = { [DEV_ATTR_TYPE] = { .name = "type", .type = BLOBMSG_TYPE_STRING }, @@ -912,14 +915,18 @@ device_reset_old(void) } void -device_set_default_ps(bool state) +device_set_default_ps(bool state, int xps, int rps, int rps_flow_cnt) { struct device *dev; - if (state == default_ps) + if ((state == default_ps) && (default_rps_val == rps) && + (default_xps_val == xps) && (default_rps_flow_cnt == rps_flow_cnt)) return; default_ps = state; + default_rps_val = rps; + default_rps_flow_cnt = rps_flow_cnt; + default_xps_val = xps; avl_for_each_element(&devices, dev, avl) { struct device_settings *s = &dev->settings; @@ -927,11 +934,14 @@ device_set_default_ps(bool state) if (!(s->flags & DEV_OPT_RPS)) { s->rps = default_ps; + s->rps_val = default_rps_val; + s->rps_flow_cnt = default_rps_flow_cnt; apply_mask |= DEV_OPT_RPS; } if (!(s->flags & DEV_OPT_XPS)) { s->xps = default_ps; + s->xps_val = default_xps_val; apply_mask |= DEV_OPT_XPS; } |