netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@netronome.com>
To: David Miller <davem@davemloft.net>,
	Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: netdev@vger.kernel.org, oss-drivers@netronome.com,
	Or Gerlitz <gerlitz.or@gmail.com>,
	Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>,
	Simon Horman <simon.horman@netronome.com>
Subject: [PATCH net-next v3 1/9] net: switchdev: add SET_SWITCHDEV_OPS helper
Date: Thu, 29 Jun 2017 22:08:11 +0200	[thread overview]
Message-ID: <1498766899-30707-2-git-send-email-simon.horman@netronome.com> (raw)
In-Reply-To: <1498766899-30707-1-git-send-email-simon.horman@netronome.com>

Add a helper to allow switchdev ops to be set if NET_SWITCHDEV is configured
and do nothing otherwise. This allows for slightly cleaner code which
uses switchdev but does not select NET_SWITCHDEV.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
 include/net/switchdev.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index c784a6ac6ef1..8ae9e3b6392e 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -217,6 +217,8 @@ void switchdev_port_fwd_mark_set(struct net_device *dev,
 
 bool switchdev_port_same_parent_id(struct net_device *a,
 				   struct net_device *b);
+
+#define SWITCHDEV_SET_OPS(netdev, ops) ((netdev)->switchdev_ops = (ops))
 #else
 
 static inline void switchdev_deferred_process(void)
@@ -322,6 +324,8 @@ static inline bool switchdev_port_same_parent_id(struct net_device *a,
 	return false;
 }
 
+#define SWITCHDEV_SET_OPS(netdev, ops) do {} while (0)
+
 #endif
 
 #endif /* _LINUX_SWITCHDEV_H_ */
-- 
2.1.4

  reply	other threads:[~2017-06-29 20:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 20:08 [PATCH net-next v3 0/9] introduce flower offload capabilities Simon Horman
2017-06-29 20:08 ` Simon Horman [this message]
2017-06-30 14:03   ` [PATCH net-next v3 1/9] net: switchdev: add SET_SWITCHDEV_OPS helper Ivan Vecera
2017-06-29 20:08 ` [PATCH net-next v3 2/9] nfp: add phys_switch_id support Simon Horman
2017-06-29 20:08 ` [PATCH net-next v3 3/9] nfp: provide infrastructure for offloading flower based TC filters Simon Horman
2017-06-29 20:08 ` [PATCH net-next v3 4/9] nfp: extend flower add flow offload Simon Horman
2017-06-29 20:08 ` [PATCH net-next v3 5/9] nfp: extend flower matching capabilities Simon Horman
2017-06-29 20:08 ` [PATCH net-next v3 6/9] nfp: add basic action capabilities to flower offloads Simon Horman
2017-06-29 20:08 ` [PATCH net-next v3 7/9] nfp: add metadata to each flow offload Simon Horman
2017-06-29 20:08 ` [PATCH net-next v3 8/9] nfp: add a stats handler for flower offloads Simon Horman
2017-06-29 20:08 ` [PATCH net-next v3 9/9] nfp: add control message passing capabilities to " Simon Horman
2017-06-29 22:56 ` [PATCH net-next v3 0/9] introduce flower offload capabilities Jakub Kicinski
2017-07-01 15:52 ` David Miller

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=1498766899-30707-2-git-send-email-simon.horman@netronome.com \
    --to=simon.horman@netronome.com \
    --cc=davem@davemloft.net \
    --cc=gerlitz.or@gmail.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    --cc=pieter.jansenvanvuuren@netronome.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;
as well as URLs for NNTP newsgroup(s).