From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, eladr@mellanox.com,
sfeldma@gmail.com, f.fainelli@gmail.com, linux@roeck-us.net,
vivien.didelot@savoirfairelinux.com, andrew@lunn.ch,
john.fastabend@gmail.com, David.Laight@ACULAB.COM,
stephen@networkplumber.org
Subject: [patch net-next v3 2/7] switchdev: introduce switchdev workqueue
Date: Mon, 12 Oct 2015 17:45:45 +0200 [thread overview]
Message-ID: <1444664750-11260-3-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1444664750-11260-1-git-send-email-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
This is going to be used for deferred operations.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
include/net/switchdev.h | 5 +++++
net/switchdev/switchdev.c | 20 ++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 1ce7083..d2879f2 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -205,6 +205,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
@@ -326,6 +327,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 a79ee44..f782eba 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
*
@@ -1221,3 +1224,20 @@ 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
next prev parent reply other threads:[~2015-10-12 15:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 15:45 [patch net-next v3 0/7] switchdev: change locking Jiri Pirko
2015-10-12 15:45 ` [patch net-next v3 1/7] switchdev: assert rtnl in switchdev_port_obj_del Jiri Pirko
2015-10-12 15:45 ` Jiri Pirko [this message]
2015-10-12 15:45 ` [patch net-next v3 3/7] switchdev: allow caller to explicitly request attr_set as deferred Jiri Pirko
2015-10-12 15:45 ` [patch net-next v3 4/7] switchdev: remove pointers from switchdev objects Jiri Pirko
2015-10-12 15:45 ` [patch net-next v3 5/7] switchdev: introduce possibility to defer obj_add/del Jiri Pirko
2015-10-12 15:45 ` [patch net-next v3 6/7] bridge: defer switchdev fdb del call in fdb_del_external_learn Jiri Pirko
2015-10-12 15:45 ` [patch net-next v3 7/7] rocker: remove nowait from switchdev callbacks Jiri Pirko
2015-10-12 15:57 ` [patch net-next v3 0/7] switchdev: change locking Jiri Pirko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444664750-11260-3-git-send-email-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=David.Laight@ACULAB.COM \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=eladr@mellanox.com \
--cc=f.fainelli@gmail.com \
--cc=idosch@mellanox.com \
--cc=john.fastabend@gmail.com \
--cc=linux@roeck-us.net \
--cc=netdev@vger.kernel.org \
--cc=sfeldma@gmail.com \
--cc=stephen@networkplumber.org \
--cc=vivien.didelot@savoirfairelinux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox