Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions device.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = {
[DEV_ATTR_MASTER] = { .name = "conduit", .type = BLOBMSG_TYPE_STRING },
[DEV_ATTR_EEE] = { .name = "eee", .type = BLOBMSG_TYPE_BOOL },
[DEV_ATTR_TAGS] = { .name = "tags", .type = BLOBMSG_TYPE_ARRAY },
[DEV_ATTR_PSE] = { .name = "pse", .type = BLOBMSG_TYPE_BOOL },
[DEV_ATTR_PSE_PODL] = { .name = "pse_podl", .type = BLOBMSG_TYPE_BOOL },
[DEV_ATTR_PSE_POWER_LIMIT] = { .name = "pse_power_limit", .type = BLOBMSG_TYPE_INT32 },
[DEV_ATTR_PSE_PRIORITY] = { .name = "pse_priority", .type = BLOBMSG_TYPE_INT32 },
};

const struct uci_blob_param_list device_attr_list = {
Expand Down Expand Up @@ -310,6 +314,10 @@ device_merge_settings(struct device *dev, struct device_settings *n)
n->gro = s->flags & DEV_OPT_GRO ? s->gro : os->gro;
n->eee = s->flags & DEV_OPT_EEE ? s->eee : os->eee;
n->master_ifindex = s->flags & DEV_OPT_MASTER ? s->master_ifindex : os->master_ifindex;
n->pse = s->flags & DEV_OPT_PSE ? s->pse : os->pse;
n->pse_podl = s->flags & DEV_OPT_PSE_PODL ? s->pse_podl : os->pse_podl;
n->pse_power_limit = s->flags & DEV_OPT_PSE_POWER_LIMIT ? s->pse_power_limit : os->pse_power_limit;
n->pse_priority = s->flags & DEV_OPT_PSE_PRIORITY ? s->pse_priority : os->pse_priority;
n->flags = s->flags | os->flags | os->valid_flags;
}

Expand Down Expand Up @@ -579,6 +587,26 @@ device_init_settings(struct device *dev, struct blob_attr **tb)
s->flags |= DEV_OPT_EEE;
}

if ((cur = tb[DEV_ATTR_PSE])) {
s->pse = blobmsg_get_bool(cur);
s->flags |= DEV_OPT_PSE;
}

if ((cur = tb[DEV_ATTR_PSE_PODL])) {
s->pse_podl = blobmsg_get_bool(cur);
s->flags |= DEV_OPT_PSE_PODL;
}

if ((cur = tb[DEV_ATTR_PSE_POWER_LIMIT])) {
s->pse_power_limit = blobmsg_get_u32(cur);
s->flags |= DEV_OPT_PSE_POWER_LIMIT;
}

if ((cur = tb[DEV_ATTR_PSE_PRIORITY])) {
s->pse_priority = blobmsg_get_u32(cur);
s->flags |= DEV_OPT_PSE_PRIORITY;
}

/* Remember the settings present in UCI */
s->valid_flags = s->flags;

Expand Down
12 changes: 12 additions & 0 deletions device.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ enum {
DEV_ATTR_MASTER,
DEV_ATTR_EEE,
DEV_ATTR_TAGS,
DEV_ATTR_PSE,
DEV_ATTR_PSE_PODL,
DEV_ATTR_PSE_POWER_LIMIT,
DEV_ATTR_PSE_PRIORITY,
__DEV_ATTR_MAX,
};

Expand Down Expand Up @@ -145,6 +149,10 @@ enum {
DEV_OPT_GRO = (1ULL << 37),
DEV_OPT_MASTER = (1ULL << 38),
DEV_OPT_EEE = (1ULL << 39),
DEV_OPT_PSE = (1ULL << 40),
DEV_OPT_PSE_PODL = (1ULL << 41),
DEV_OPT_PSE_POWER_LIMIT = (1ULL << 42),
DEV_OPT_PSE_PRIORITY = (1ULL << 43),
};

/* events broadcasted to all users of a device */
Expand Down Expand Up @@ -230,6 +238,10 @@ struct device_settings {
bool gro;
int master_ifindex;
bool eee;
bool pse;
bool pse_podl;
unsigned int pse_power_limit;
unsigned int pse_priority;
};

struct device_vlan_range {
Expand Down
Loading