[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1445369799-2345-2-git-send-email-sfeldma@gmail.com>
Date: Tue, 20 Oct 2015 12:36:38 -0700
From: sfeldma@...il.com
To: netdev@...r.kernel.org
Cc: jiri@...nulli.us, siva.mannem.lnx@...il.com,
vivien.didelot@...oirfairelinux.com
Subject: [PATCH net-next 2/3] switchdev: fix: pass correct obj size when deferring obj add
From: Scott Feldman <sfeldma@...il.com>
Fixes: 0bc05d585d ("switchdev: allow caller to explicitly request attr_set as deferred")
Signed-off-by: Scott Feldman <sfeldma@...il.com>
---
net/switchdev/switchdev.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 56d8479..be8ced1 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -489,7 +489,24 @@ static void switchdev_port_obj_del_deferred(struct net_device *dev,
static int switchdev_port_obj_del_defer(struct net_device *dev,
const struct switchdev_obj *obj)
{
- return switchdev_deferred_enqueue(dev, obj, sizeof(*obj),
+ size_t size = 0;
+
+ switch (obj->id) {
+ case SWITCHDEV_OBJ_ID_PORT_VLAN:
+ size = sizeof(struct switchdev_obj_port_vlan);
+ break;
+ case SWITCHDEV_OBJ_ID_IPV4_FIB:
+ size = sizeof(struct switchdev_obj_ipv4_fib);
+ break;
+ case SWITCHDEV_OBJ_ID_PORT_FDB:
+ size = sizeof(struct switchdev_obj_port_fdb);
+ break;
+ default:
+ WARN_ON(!size);
+ return -EINVAL;
+ }
+
+ return switchdev_deferred_enqueue(dev, obj, size,
switchdev_port_obj_del_deferred);
}
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists