[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1444576871-19138-2-git-send-email-jiri@resnulli.us>
Date: Sun, 11 Oct 2015 17:21:05 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, idosch@...lanox.com, eladr@...lanox.com,
sfeldma@...il.com, f.fainelli@...il.com, linux@...ck-us.net,
vivien.didelot@...oirfairelinux.com, andrew@...n.ch,
john.fastabend@...il.com, David.Laight@...LAB.COM,
stephen@...workplumber.org
Subject: [patch net-next 1/7] switchdev: introduce switchdev workqueue
From: Jiri Pirko <jiri@...lanox.com>
This is going to be used for deferred operations.
Signed-off-by: Jiri Pirko <jiri@...lanox.com>
---
include/net/switchdev.h | 5 +++++
net/switchdev/switchdev.c | 19 +++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 89266a3..cc7f772 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -202,6 +202,7 @@ int switchdev_port_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
void switchdev_port_fwd_mark_set(struct net_device *dev,
struct net_device *group_dev,
bool joining);
+void switchdev_flush_deferred(void);
#else
@@ -323,6 +324,10 @@ static inline void switchdev_port_fwd_mark_set(struct net_device *dev,
{
}
+static inline void switchdev_flush_deferred(void)
+{
+}
+
#endif
#endif /* _LINUX_SWITCHDEV_H_ */
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 6e4a4f9..10306b6 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -17,9 +17,12 @@
#include <linux/netdevice.h>
#include <linux/if_bridge.h>
#include <linux/list.h>
+#include <linux/workqueue.h>
#include <net/ip_fib.h>
#include <net/switchdev.h>
+static struct workqueue_struct *switchdev_wq;
+
/**
* switchdev_trans_item_enqueue - Enqueue data item to transaction queue
*
@@ -1210,3 +1213,19 @@ void switchdev_port_fwd_mark_set(struct net_device *dev,
dev->offload_fwd_mark = mark;
}
EXPORT_SYMBOL_GPL(switchdev_port_fwd_mark_set);
+
+void switchdev_flush_deferred(void)
+{
+ flush_workqueue(switchdev_wq);
+}
+EXPORT_SYMBOL_GPL(switchdev_flush_deferred);
+
+static int __init switchdev_init(void)
+{
+ switchdev_wq = create_workqueue("switchdev");
+ if (!switchdev_wq)
+ return -ENOMEM;
+ return 0;
+}
+
+subsys_initcall(switchdev_init);
--
1.9.3
--
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