diff options
author | Jiri Pirko <jiri@mellanox.com> | 2016-02-16 15:14:45 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-18 05:08:34 +0100 |
commit | e420114eef4a3a5025a243b89b0dc343101e3d3c (patch) | |
tree | 34c2ebdfa412e4ca5b159dbc9c6d2819b1a8cd5b /drivers/net/ethernet/rocker/rocker.h | |
parent | rocker: move rocker and rocker_port structs into header (diff) | |
download | linux-e420114eef4a3a5025a243b89b0dc343101e3d3c.tar.xz linux-e420114eef4a3a5025a243b89b0dc343101e3d3c.zip |
rocker: introduce worlds infrastructure
This is another step on the way to per-world clean cut. Introduce world
ops hooks which each world can implement in world-specific way.
Also introduce world infrastructure along with OF-DPA world stub.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/rocker/rocker.h')
-rw-r--r-- | drivers/net/ethernet/rocker/rocker.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/drivers/net/ethernet/rocker/rocker.h b/drivers/net/ethernet/rocker/rocker.h index 05c1e1aa2002..5fd0e3520fd6 100644 --- a/drivers/net/ethernet/rocker/rocker.h +++ b/drivers/net/ethernet/rocker/rocker.h @@ -12,9 +12,13 @@ #ifndef _ROCKER_H #define _ROCKER_H +#include <linux/kernel.h> #include <linux/types.h> #include <linux/hashtable.h> #include <linux/if_vlan.h> +#include <linux/netdevice.h> +#include <net/neighbour.h> +#include <net/switchdev.h> #include "rocker_hw.h" @@ -57,6 +61,7 @@ struct rocker_port { struct net_device *dev; struct net_device *bridge_dev; struct rocker *rocker; + void *wpriv; unsigned int port_number; u32 pport; __be16 internal_vlan_id; @@ -71,6 +76,8 @@ struct rocker_port { struct rocker_dma_ring_info rx_ring; }; +struct rocker_world_ops; + struct rocker { struct pci_dev *pdev; u8 __iomem *hw_addr; @@ -83,6 +90,8 @@ struct rocker { spinlock_t cmd_ring_lock; /* for cmd ring accesses */ struct rocker_dma_ring_info cmd_ring; struct rocker_dma_ring_info event_ring; + struct rocker_world_ops *wops; + void *wpriv; DECLARE_HASHTABLE(flow_tbl, 16); spinlock_t flow_tbl_lock; /* for flow tbl accesses */ u64 flow_tbl_next_cookie; @@ -99,4 +108,64 @@ struct rocker { u32 neigh_tbl_next_index; }; +struct rocker_world_ops { + const char *kind; + size_t priv_size; + size_t port_priv_size; + u8 mode; + int (*init)(struct rocker *rocker); + void (*fini)(struct rocker *rocker); + int (*port_pre_init)(struct rocker_port *rocker_port); + int (*port_init)(struct rocker_port *rocker_port); + void (*port_fini)(struct rocker_port *rocker_port); + void (*port_post_fini)(struct rocker_port *rocker_port); + int (*port_open)(struct rocker_port *rocker_port); + void (*port_stop)(struct rocker_port *rocker_port); + int (*port_attr_stp_state_set)(struct rocker_port *rocker_port, + u8 state, + struct switchdev_trans *trans); + int (*port_attr_bridge_flags_set)(struct rocker_port *rocker_port, + unsigned long brport_flags, + struct switchdev_trans *trans); + int (*port_attr_bridge_flags_get)(const struct rocker_port *rocker_port, + unsigned long *p_brport_flags); + int (*port_attr_bridge_ageing_time_set)(struct rocker_port *rocker_port, + u32 ageing_time, + struct switchdev_trans *trans); + int (*port_obj_vlan_add)(struct rocker_port *rocker_port, + const struct switchdev_obj_port_vlan *vlan, + struct switchdev_trans *trans); + int (*port_obj_vlan_del)(struct rocker_port *rocker_port, + const struct switchdev_obj_port_vlan *vlan); + int (*port_obj_vlan_dump)(const struct rocker_port *rocker_port, + struct switchdev_obj_port_vlan *vlan, + switchdev_obj_dump_cb_t *cb); + int (*port_obj_fib4_add)(struct rocker_port *rocker_port, + const struct switchdev_obj_ipv4_fib *fib4, + struct switchdev_trans *trans); + int (*port_obj_fib4_del)(struct rocker_port *rocker_port, + const struct switchdev_obj_ipv4_fib *fib4); + int (*port_obj_fdb_add)(struct rocker_port *rocker_port, + const struct switchdev_obj_port_fdb *fdb, + struct switchdev_trans *trans); + int (*port_obj_fdb_del)(struct rocker_port *rocker_port, + const struct switchdev_obj_port_fdb *fdb); + int (*port_obj_fdb_dump)(const struct rocker_port *rocker_port, + struct switchdev_obj_port_fdb *fdb, + switchdev_obj_dump_cb_t *cb); + int (*port_master_linked)(struct rocker_port *rocker_port, + struct net_device *master); + int (*port_master_unlinked)(struct rocker_port *rocker_port, + struct net_device *master); + int (*port_neigh_update)(struct rocker_port *rocker_port, + struct neighbour *n); + int (*port_neigh_destroy)(struct rocker_port *rocker_port, + struct neighbour *n); + int (*port_ev_mac_vlan_seen)(struct rocker_port *rocker_port, + const unsigned char *addr, + __be16 vlan_id); +}; + +extern struct rocker_world_ops rocker_ofdpa_ops; + #endif |