netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sfeldma@gmail.com
To: netdev@vger.kernel.org
Cc: jiri@resnulli.us, roopa@cumulusnetworks.com, simon.horman@netronome.com
Subject: [PATCH net-next v2 1/3] switchdev: add swdev ops
Date: Sun, 15 Mar 2015 18:45:19 -0700	[thread overview]
Message-ID: <1426470321-48669-2-git-send-email-sfeldma@gmail.com> (raw)
In-Reply-To: <1426470321-48669-1-git-send-email-sfeldma@gmail.com>

From: Scott Feldman <sfeldma@gmail.com>

As discussed at netconf, introduce swdev_ops as first step to move switchdev
ops from ndo to swdev.  This will keep switchdev from cluttering up ndo ops
space.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
---
 include/linux/netdevice.h |    3 +++
 include/net/switchdev.h   |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ddab1a2..9e8a2a9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1577,6 +1577,9 @@ struct net_device {
 	const struct net_device_ops *netdev_ops;
 	const struct ethtool_ops *ethtool_ops;
 	const struct forwarding_accel_ops *fwd_ops;
+#ifdef CONFIG_NET_SWITCHDEV
+	const struct swdev_ops *swdev_ops;
+#endif
 
 	const struct header_ops *header_ops;
 
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 1a9382f..e5de53f 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -14,6 +14,44 @@
 #include <linux/netdevice.h>
 #include <linux/notifier.h>
 
+struct fib_info;
+
+/**
+ * struct switchdev_ops - switchdev operations
+ *
+ * int (*swdev_parent_id_get)(struct net_device *dev,
+ *			      struct netdev_phys_item_id *psid);
+ *	Called to get an ID of the switch chip this port is part of.
+ *	If driver implements this, it indicates that it represents a port
+ *	of a switch chip.
+ *
+ * int (*swdev_port_stp_update)(struct net_device *dev, u8 state);
+ *	Called to notify switch device port of bridge port STP
+ *	state change.
+ *
+ * int (*swdev_fib_ipv4_add)(struct net_device *dev, __be32 dst,
+ *			     int dst_len, struct fib_info *fi,
+ *			     u8 tos, u8 type, u32 nlflags, u32 tb_id);
+ *	Called to add/modify IPv4 route to switch device.
+ *
+ * int (*swdev_fib_ipv4_del)(struct net_device *dev, __be32 dst,
+ *			     int dst_len, struct fib_info *fi,
+ *			     u8 tos, u8 type, u32 tb_id);
+ *	Called to delete IPv4 route from switch device.
+ */
+struct swdev_ops {
+	int	(*swdev_parent_id_get)(struct net_device *dev,
+				       struct netdev_phys_item_id *psid);
+	int	(*swdev_port_stp_update)(struct net_device *dev, u8 state);
+	int	(*swdev_fib_ipv4_add)(struct net_device *dev, __be32 dst,
+				      int dst_len, struct fib_info *fi,
+				      u8 tos, u8 type, u32 nlflags,
+				      u32 tb_id);
+	int	(*swdev_fib_ipv4_del)(struct net_device *dev, __be32 dst,
+				      int dst_len, struct fib_info *fi,
+				      u8 tos, u8 type, u32 tb_id);
+};
+
 enum netdev_switch_notifier_type {
 	NETDEV_SWITCH_FDB_ADD = 1,
 	NETDEV_SWITCH_FDB_DEL,
-- 
1.7.10.4

  reply	other threads:[~2015-03-16  1:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16  1:45 [PATCH net-next v2 0/3] switchdev: add swdev ops sfeldma
2015-03-16  1:45 ` sfeldma [this message]
2015-03-20 23:00   ` [PATCH net-next v2 1/3] " Ben Hutchings
2015-03-20 23:58     ` Scott Feldman
2015-03-21  0:04       ` Ben Hutchings
2015-03-16  1:45 ` [PATCH net-next v2 2/3] switchdev: use new " sfeldma
2015-03-16  1:45 ` [PATCH net-next v2 3/3] netdev: remove ndo ops for switchdev sfeldma
2015-03-16  1:51 ` [PATCH net-next v2 0/3] switchdev: add swdev ops David Miller
2015-03-16  1:55   ` 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=1426470321-48669-2-git-send-email-sfeldma@gmail.com \
    --to=sfeldma@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.com \
    --cc=simon.horman@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).