Merge tag 'fs.vfsuid.ima.v6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / net / dsa / tag_8021q.c
index 34e5ec5..5ee9ef0 100644 (file)
@@ -7,7 +7,10 @@
 #include <linux/if_vlan.h>
 #include <linux/dsa/8021q.h>
 
-#include "dsa_priv.h"
+#include "port.h"
+#include "switch.h"
+#include "tag.h"
+#include "tag_8021q.h"
 
 /* Binary structure of the fake 12-bit VID field (when the TPID is
  * ETH_P_DSA_8021Q):
 #define DSA_8021Q_PORT(x)              (((x) << DSA_8021Q_PORT_SHIFT) & \
                                                 DSA_8021Q_PORT_MASK)
 
+struct dsa_tag_8021q_vlan {
+       struct list_head list;
+       int port;
+       u16 vid;
+       refcount_t refcount;
+};
+
+struct dsa_8021q_context {
+       struct dsa_switch *ds;
+       struct list_head vlans;
+       /* EtherType of RX VID, used for filtering on master interface */
+       __be16 proto;
+};
+
 u16 dsa_tag_8021q_bridge_vid(unsigned int bridge_num)
 {
        /* The VBID value of 0 is reserved for precise TX, but it is also
@@ -398,6 +415,7 @@ static void dsa_tag_8021q_teardown(struct dsa_switch *ds)
 int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto)
 {
        struct dsa_8021q_context *ctx;
+       int err;
 
        ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
        if (!ctx)
@@ -410,7 +428,15 @@ int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto)
 
        ds->tag_8021q_ctx = ctx;
 
-       return dsa_tag_8021q_setup(ds);
+       err = dsa_tag_8021q_setup(ds);
+       if (err)
+               goto err_free;
+
+       return 0;
+
+err_free:
+       kfree(ctx);
+       return err;
 }
 EXPORT_SYMBOL_GPL(dsa_tag_8021q_register);