Commit 67652d34 authored by Rahul Thakur's avatar Rahul Thakur

netifd: update vlanconf for tvid

Option to support vlan translation added to network uci file and
hence netifd updated. In case its a broadcom chip, that is, if
vlanconf is detected, then use this option to configure vlan
translation.

Test via autotest and also manually (to verify the p-bit is not
overwritten). Rest of the scenarios work as expected wih the
existing conf so no regression
parent 9e695b7f
......@@ -1400,10 +1400,10 @@ int system_vlandev_add(struct device *vlandev, struct device *dev, struct vlande
if(vlanconf_exists()) {
snprintf(cmd, 256,
"/sbin/vlanconf create --name %s --ifname %s --type %s \
--vlan-id %d --priority %d --inner-vlan-id %d --inner-priority %d --dscp %d \
--vlan-id %d --translated-vlan-id %d --priority %d --inner-vlan-id %d --inner-priority %d --dscp %d \
--multicast-mode %s",
vlandev->ifname, dev->ifname, proto,
cfg->vid, cfg->priority, cfg->inner_vid, cfg->inner_priority, cfg->dscp,
cfg->vid, cfg->tvid, cfg->priority, cfg->inner_vid, cfg->inner_priority, cfg->dscp,
(cfg->mcmode == MULTICAST_MODE_ONT) ? "ont":"rg");
return system(cmd);
}
......
......@@ -168,6 +168,7 @@ struct vlandev_config {
enum vlan_proto proto;
enum iface_mode mcmode;
uint16_t vid;
uint16_t tvid;
uint16_t priority;
uint16_t inner_vid;
uint16_t inner_priority;
......
......@@ -23,6 +23,7 @@
enum {
VLANDEV_ATTR_IFNAME,
VLANDEV_ATTR_VID,
VLANDEV_ATTR_TVID,
VLANDEV_ATTR_PRIORITY,
VLANDEV_ATTR_INNER_VID,
VLANDEV_ATTR_INNER_PRIORITY,
......@@ -34,6 +35,7 @@ enum {
static const struct blobmsg_policy vlandev_attrs[__VLANDEV_ATTR_MAX] = {
[VLANDEV_ATTR_IFNAME] = { "ifname", BLOBMSG_TYPE_STRING },
[VLANDEV_ATTR_VID] = { "vid", BLOBMSG_TYPE_INT32 },
[VLANDEV_ATTR_TVID] = { "tvid", BLOBMSG_TYPE_INT32 },
[VLANDEV_ATTR_PRIORITY] = { "priority", BLOBMSG_TYPE_INT32 },
[VLANDEV_ATTR_INNER_VID] = { "inner_vid", BLOBMSG_TYPE_INT32 },
[VLANDEV_ATTR_INNER_PRIORITY] = { "inner_priority", BLOBMSG_TYPE_INT32 },
......@@ -166,6 +168,7 @@ vlandev_apply_settings(struct vlandev_device *mvdev, struct blob_attr **tb)
cfg->proto = (mvdev->dev.type == &vlan8021q_device_type) ?
VLAN_PROTO_8021Q : VLAN_PROTO_8021AD;
cfg->vid = 1;
cfg->tvid = 0;
cfg->priority = 0;
if (mvdev->dev.type == &vlanuntagged_device_type)
......@@ -174,6 +177,9 @@ vlandev_apply_settings(struct vlandev_device *mvdev, struct blob_attr **tb)
if ((cur = tb[VLANDEV_ATTR_VID]))
cfg->vid = (uint16_t) blobmsg_get_u32(cur);
if ((cur = tb[VLANDEV_ATTR_TVID]))
cfg->tvid = (uint16_t) blobmsg_get_u32(cur);
if ((cur = tb[VLANDEV_ATTR_PRIORITY]))
cfg->priority = (uint16_t) blobmsg_get_u32(cur);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment