linux/drivers/net/ethernet/marvell/prestera/prestera_switchdev.c

// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/* Copyright (c) 2019-2020 Marvell International Ltd. All rights reserved */

#include <linux/if_bridge.h>
#include <linux/if_vlan.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/notifier.h>
#include <net/netevent.h>
#include <net/switchdev.h>

#include "prestera.h"
#include "prestera_hw.h"
#include "prestera_switchdev.h"

#define PRESTERA_VID_ALL

#define PRESTERA_DEFAULT_AGEING_TIME_MS
#define PRESTERA_MAX_AGEING_TIME_MS
#define PRESTERA_MIN_AGEING_TIME_MS

struct prestera_fdb_event_work {};

struct prestera_switchdev {};

struct prestera_bridge {};

struct prestera_bridge_port {};

struct prestera_bridge_vlan {};

struct prestera_port_vlan {};

struct prestera_br_mdb_port {};

/* Software representation of MDB table. */
struct prestera_br_mdb_entry {};

static struct workqueue_struct *swdev_wq;

static void prestera_bridge_port_put(struct prestera_bridge_port *br_port);

static int prestera_port_vid_stp_set(struct prestera_port *port, u16 vid,
				     u8 state);

static struct prestera_bridge *
prestera_bridge_find(const struct prestera_switch *sw,
		     const struct net_device *br_dev)
{}

static struct prestera_bridge_port *
__prestera_bridge_port_find(const struct prestera_bridge *bridge,
			    const struct net_device *brport_dev)
{}

static struct prestera_bridge_port *
prestera_bridge_port_find(struct prestera_switch *sw,
			  struct net_device *brport_dev)
{}

static void
prestera_br_port_flags_reset(struct prestera_bridge_port *br_port,
			     struct prestera_port *port)
{}

static int prestera_br_port_flags_set(struct prestera_bridge_port *br_port,
				      struct prestera_port *port)
{}

static struct prestera_bridge_vlan *
prestera_bridge_vlan_create(struct prestera_bridge_port *br_port, u16 vid)
{}

static void prestera_bridge_vlan_destroy(struct prestera_bridge_vlan *br_vlan)
{}

static struct prestera_bridge_vlan *
prestera_bridge_vlan_by_vid(struct prestera_bridge_port *br_port, u16 vid)
{}

static int prestera_bridge_vlan_port_count(struct prestera_bridge *bridge,
					   u16 vid)
{}

static void prestera_bridge_vlan_put(struct prestera_bridge_vlan *br_vlan)
{}

static struct prestera_port_vlan *
prestera_port_vlan_by_vid(struct prestera_port *port, u16 vid)
{}

static struct prestera_port_vlan *
prestera_port_vlan_create(struct prestera_port *port, u16 vid, bool untagged)
{}

static int prestera_fdb_add(struct prestera_port *port,
			    const unsigned char *mac, u16 vid, bool dynamic)
{}

static int prestera_fdb_del(struct prestera_port *port,
			    const unsigned char *mac, u16 vid)
{}

static int prestera_fdb_flush_port_vlan(struct prestera_port *port, u16 vid,
					u32 mode)
{}

static int prestera_fdb_flush_port(struct prestera_port *port, u32 mode)
{}

static void
prestera_mdb_port_del(struct prestera_mdb_entry *mdb,
		      struct net_device *orig_dev)
{}

static void
prestera_br_mdb_entry_put(struct prestera_br_mdb_entry *br_mdb)
{}

static void
prestera_br_mdb_port_del(struct prestera_br_mdb_entry *br_mdb,
			 struct prestera_bridge_port *br_port)
{}

static void
prestera_mdb_flush_bridge_port(struct prestera_bridge_port *br_port)
{}

static void
prestera_port_vlan_bridge_leave(struct prestera_port_vlan *port_vlan)
{}

static void prestera_port_vlan_destroy(struct prestera_port_vlan *port_vlan)
{}

static struct prestera_bridge *
prestera_bridge_create(struct prestera_switchdev *swdev, struct net_device *dev)
{}

static void prestera_bridge_destroy(struct prestera_bridge *bridge)
{}

static void prestera_bridge_put(struct prestera_bridge *bridge)
{}

static
struct prestera_bridge *prestera_bridge_by_dev(struct prestera_switchdev *swdev,
					       const struct net_device *dev)
{}

static struct prestera_bridge_port *
__prestera_bridge_port_by_dev(struct prestera_bridge *bridge,
			      struct net_device *dev)
{}

static int prestera_match_upper_bridge_dev(struct net_device *dev,
					   struct netdev_nested_priv *priv)
{}

static struct net_device *prestera_get_upper_bridge_dev(struct net_device *dev)
{}

static struct prestera_bridge_port *
prestera_bridge_port_by_dev(struct prestera_switchdev *swdev,
			    struct net_device *dev)
{}

static struct prestera_bridge_port *
prestera_bridge_port_create(struct prestera_bridge *bridge,
			    struct net_device *dev)
{}

static void
prestera_bridge_port_destroy(struct prestera_bridge_port *br_port)
{}

static void prestera_bridge_port_get(struct prestera_bridge_port *br_port)
{}

static void prestera_bridge_port_put(struct prestera_bridge_port *br_port)
{}

static struct prestera_bridge_port *
prestera_bridge_port_add(struct prestera_bridge *bridge, struct net_device *dev)
{}

static int
prestera_bridge_1d_port_join(struct prestera_bridge_port *br_port)
{}

int prestera_bridge_port_join(struct net_device *br_dev,
			      struct prestera_port *port,
			      struct netlink_ext_ack *extack)
{}

static void prestera_bridge_1q_port_leave(struct prestera_bridge_port *br_port)
{}

static void prestera_bridge_1d_port_leave(struct prestera_bridge_port *br_port)
{}

static int prestera_port_vid_stp_set(struct prestera_port *port, u16 vid,
				     u8 state)
{}

void prestera_bridge_port_leave(struct net_device *br_dev,
				struct prestera_port *port)
{}

static int prestera_port_attr_br_flags_set(struct prestera_port *port,
					   struct net_device *dev,
					   struct switchdev_brport_flags flags)
{}

static int prestera_port_attr_br_ageing_set(struct prestera_port *port,
					    unsigned long ageing_clock_t)
{}

static int prestera_port_attr_br_vlan_set(struct prestera_port *port,
					  struct net_device *dev,
					  bool vlan_enabled)
{}

static int prestera_port_bridge_vlan_stp_set(struct prestera_port *port,
					     struct prestera_bridge_vlan *br_vlan,
					     u8 state)
{}

static int prestera_port_attr_stp_state_set(struct prestera_port *port,
					    struct net_device *dev,
					    u8 state)
{}

static int
prestera_br_port_lag_mdb_mc_enable_sync(struct prestera_bridge_port *br_port,
					bool enabled)
{}

static int prestera_br_mdb_mc_enable_sync(struct prestera_bridge *br_dev)
{}

static bool
prestera_br_mdb_port_is_member(struct prestera_br_mdb_entry *br_mdb,
			       struct net_device *orig_dev)
{}

static int
prestera_mdb_port_add(struct prestera_mdb_entry *mdb,
		      struct net_device *orig_dev,
		      const unsigned char addr[ETH_ALEN], u16 vid)
{}

/* Sync bridge mdb (software table) with HW table (if MC is enabled). */
static int prestera_br_mdb_sync(struct prestera_bridge *br_dev)
{}

static int
prestera_mdb_enable_set(struct prestera_br_mdb_entry *br_mdb, bool enable)
{}

static int
prestera_br_mdb_enable_set(struct prestera_bridge *br_dev, bool enable)
{}

static int prestera_port_attr_br_mc_disabled_set(struct prestera_port *port,
						 struct net_device *orig_dev,
						 bool mc_disabled)
{}

static bool
prestera_bridge_mdb_mc_mrouter_exists(struct prestera_bridge *br_dev)
{}

static int
prestera_port_attr_mrouter_set(struct prestera_port *port,
			       struct net_device *orig_dev,
			       bool is_port_mrouter)
{}

static int prestera_port_obj_attr_set(struct net_device *dev, const void *ctx,
				      const struct switchdev_attr *attr,
				      struct netlink_ext_ack *extack)
{}

static void
prestera_fdb_offload_notify(struct prestera_port *port,
			    struct switchdev_notifier_fdb_info *info)
{}

static int prestera_port_fdb_set(struct prestera_port *port,
				 struct switchdev_notifier_fdb_info *fdb_info,
				 bool adding)
{}

static void prestera_fdb_event_work(struct work_struct *work)
{}

static int prestera_switchdev_event(struct notifier_block *unused,
				    unsigned long event, void *ptr)
{}

static int
prestera_port_vlan_bridge_join(struct prestera_port_vlan *port_vlan,
			       struct prestera_bridge_port *br_port)
{}

static int
prestera_bridge_port_vlan_add(struct prestera_port *port,
			      struct prestera_bridge_port *br_port,
			      u16 vid, bool is_untagged, bool is_pvid,
			      struct netlink_ext_ack *extack)
{}

static void
prestera_bridge_port_vlan_del(struct prestera_port *port,
			      struct prestera_bridge_port *br_port, u16 vid)
{}

static int prestera_port_vlans_add(struct prestera_port *port,
				   const struct switchdev_obj_port_vlan *vlan,
				   struct netlink_ext_ack *extack)
{}

static struct prestera_br_mdb_entry *
prestera_br_mdb_entry_create(struct prestera_switch *sw,
			     struct prestera_bridge *br_dev,
			     const unsigned char *addr, u16 vid)
{}

static int prestera_br_mdb_port_add(struct prestera_br_mdb_entry *br_mdb,
				    struct prestera_bridge_port *br_port)
{}

static struct prestera_br_mdb_entry *
prestera_br_mdb_entry_find(struct prestera_bridge *br_dev,
			   const unsigned char *addr, u16 vid)
{}

static struct prestera_br_mdb_entry *
prestera_br_mdb_entry_get(struct prestera_switch *sw,
			  struct prestera_bridge *br_dev,
			  const unsigned char *addr, u16 vid)
{}

static int
prestera_mdb_port_addr_obj_add(const struct switchdev_obj_port_mdb *mdb)
{}

static int prestera_port_obj_add(struct net_device *dev, const void *ctx,
				 const struct switchdev_obj *obj,
				 struct netlink_ext_ack *extack)
{}

static int prestera_port_vlans_del(struct prestera_port *port,
				   const struct switchdev_obj_port_vlan *vlan)
{}

static int
prestera_mdb_port_addr_obj_del(struct prestera_port *port,
			       const struct switchdev_obj_port_mdb *mdb)
{}

static int prestera_port_obj_del(struct net_device *dev, const void *ctx,
				 const struct switchdev_obj *obj)
{}

static int prestera_switchdev_blk_event(struct notifier_block *unused,
					unsigned long event, void *ptr)
{}

static void prestera_fdb_event(struct prestera_switch *sw,
			       struct prestera_event *evt, void *arg)
{}

static int prestera_fdb_init(struct prestera_switch *sw)
{}

static void prestera_fdb_fini(struct prestera_switch *sw)
{}

static int prestera_switchdev_handler_init(struct prestera_switchdev *swdev)
{}

static void prestera_switchdev_handler_fini(struct prestera_switchdev *swdev)
{}

int prestera_switchdev_init(struct prestera_switch *sw)
{}

void prestera_switchdev_fini(struct prestera_switch *sw)
{}