Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1235253

[PATCH net-next 6/6] net: switchdev: extract struct switchdev_obj_*

From Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Newsgroups linux.kernel
Subject [PATCH net-next 6/6] net: switchdev: extract struct switchdev_obj_*
Date 2015-09-29 17:30 +0200
Message-ID <qe50U-1Za-57@gated-at.bofh.it> (permalink)
References <qe4Rb-1Nk-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Now that switchdev and its drivers directly use specific switchdev_obj_*
structures, move them out of the switchdev_obj union and get rif of this
outer structure.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 include/net/switchdev.h | 53 ++++++++++++++++++++++++-------------------------
 1 file changed, 26 insertions(+), 27 deletions(-)

diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 230fcfc..8a3bacc 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -64,30 +64,29 @@ enum switchdev_obj_id {
 	SWITCHDEV_OBJ_PORT_FDB,
 };
 
-struct switchdev_obj {
-	enum switchdev_obj_id id;
-	int (*cb)(struct switchdev_obj *obj);
-	union {
-		struct switchdev_obj_vlan {		/* PORT_VLAN */
-			u16 flags;
-			u16 vid_begin;
-			u16 vid_end;
-		} vlan;
-		struct switchdev_obj_ipv4_fib {		/* IPV4_FIB */
-			u32 dst;
-			int dst_len;
-			struct fib_info *fi;
-			u8 tos;
-			u8 type;
-			u32 nlflags;
-			u32 tb_id;
-		} ipv4_fib;
-		struct switchdev_obj_fdb {		/* PORT_FDB */
-			const unsigned char *addr;
-			u16 vid;
-			u16 ndm_state;
-		} fdb;
-	} u;
+/* SWITCHDEV_OBJ_PORT_VLAN */
+struct switchdev_obj_vlan {
+	u16 flags;
+	u16 vid_begin;
+	u16 vid_end;
+};
+
+/* SWITCHDEV_OBJ_IPV4_FIB */
+struct switchdev_obj_ipv4_fib {
+	u32 dst;
+	int dst_len;
+	struct fib_info *fi;
+	u8 tos;
+	u8 type;
+	u32 nlflags;
+	u32 tb_id;
+};
+
+/* SWITCHDEV_OBJ_PORT_FDB */
+struct switchdev_obj_fdb {
+	const unsigned char *addr;
+	u16 vid;
+	u16 ndm_state;
 };
 
 void switchdev_trans_item_enqueue(struct switchdev_trans *trans,
@@ -102,11 +101,11 @@ void *switchdev_trans_item_dequeue(struct switchdev_trans *trans);
  *
  * @switchdev_port_attr_set: Set a port attribute (see switchdev_attr).
  *
- * @switchdev_port_obj_add: Add an object to port (see switchdev_obj).
+ * @switchdev_port_obj_add: Add an object to port (see switchdev_obj_*).
  *
- * @switchdev_port_obj_del: Delete an object from port (see switchdev_obj).
+ * @switchdev_port_obj_del: Delete an object from port (see switchdev_obj_*).
  *
- * @switchdev_port_obj_dump: Dump port objects (see switchdev_obj).
+ * @switchdev_port_obj_dump: Dump port objects (see switchdev_obj_*).
  */
 struct switchdev_ops {
 	int	(*switchdev_port_attr_get)(struct net_device *dev,
-- 
2.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 0/6] net: switchdev: use specific switchdev_obj_* Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-09-29 17:20 +0200
  [PATCH net-next 3/6] net: switchdev: remove dev from switchdev_obj cb Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-09-29 17:20 +0200
  [PATCH net-next 1/6] net: switchdev: remove dev in port_vlan_dump_put Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-09-29 17:20 +0200
  [PATCH net-next 6/6] net: switchdev: extract struct switchdev_obj_* Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-09-29 17:30 +0200
  [PATCH net-next 5/6] net: switchdev: abstract object in add/del ops Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-09-29 17:40 +0200

csiph-web