net: bridge: resolve forwarding path for VLAN tag actions in bridge devices
[linux-2.6-microblaze.git] / net / 8021q / vlan_dev.c
index dc1a197..4db3f06 100644 (file)
@@ -776,6 +776,26 @@ static int vlan_dev_get_iflink(const struct net_device *dev)
        return real_dev->ifindex;
 }
 
+static int vlan_dev_fill_forward_path(struct net_device_path_ctx *ctx,
+                                     struct net_device_path *path)
+{
+       struct vlan_dev_priv *vlan = vlan_dev_priv(ctx->dev);
+
+       path->type = DEV_PATH_VLAN;
+       path->encap.id = vlan->vlan_id;
+       path->encap.proto = vlan->vlan_proto;
+       path->dev = ctx->dev;
+       ctx->dev = vlan->real_dev;
+       if (ctx->num_vlans >= ARRAY_SIZE(ctx->vlan))
+               return -ENOSPC;
+
+       ctx->vlan[ctx->num_vlans].id = vlan->vlan_id;
+       ctx->vlan[ctx->num_vlans].proto = vlan->vlan_proto;
+       ctx->num_vlans++;
+
+       return 0;
+}
+
 static const struct ethtool_ops vlan_ethtool_ops = {
        .get_link_ksettings     = vlan_ethtool_get_link_ksettings,
        .get_drvinfo            = vlan_ethtool_get_drvinfo,
@@ -814,6 +834,7 @@ static const struct net_device_ops vlan_netdev_ops = {
 #endif
        .ndo_fix_features       = vlan_dev_fix_features,
        .ndo_get_iflink         = vlan_dev_get_iflink,
+       .ndo_fill_forward_path  = vlan_dev_fill_forward_path,
 };
 
 static void vlan_dev_free(struct net_device *dev)