linux/drivers/net/ethernet/marvell/prestera/prestera.h

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

#ifndef _PRESTERA_H_
#define _PRESTERA_H_

#include <linux/notifier.h>
#include <linux/skbuff.h>
#include <linux/workqueue.h>
#include <linux/phylink.h>
#include <net/devlink.h>
#include <uapi/linux/if_ether.h>

#define PRESTERA_DRV_NAME

#define PRESTERA_DEFAULT_VID

struct prestera_fw_rev {};

struct prestera_flood_domain {};

struct prestera_mdb_entry {};

struct prestera_flood_domain_port {};

struct prestera_port_stats {};

#define PRESTERA_AP_PORT_MAX

struct prestera_port_caps {};

struct prestera_lag {};

struct prestera_flow_block;

struct prestera_port_mac_state {};

struct prestera_port_phy_state {};

struct prestera_port_mac_config {};

struct prestera_port_phy_config {};

struct prestera_port {};

struct prestera_device {};

enum prestera_event_type {};

enum prestera_rxtx_event_id {};

enum prestera_port_event_id {};

struct prestera_port_event {};

enum prestera_fdb_entry_type {};

enum prestera_fdb_event_id {};

struct prestera_fdb_event {};

struct prestera_event {};

enum prestera_if_type {};

struct prestera_iface {};

struct prestera_switchdev;
struct prestera_span;
struct prestera_rxtx;
struct prestera_trap_data;
struct prestera_acl;

struct prestera_switch {};

struct prestera_router {};

struct prestera_rxtx_params {};

#define prestera_dev(sw)

static inline void prestera_write(const struct prestera_switch *sw,
				  unsigned int reg, u32 val)
{}

static inline u32 prestera_read(const struct prestera_switch *sw,
				unsigned int reg)
{}

int prestera_device_register(struct prestera_device *dev);
void prestera_device_unregister(struct prestera_device *dev);

struct prestera_port *prestera_port_find_by_hwid(struct prestera_switch *sw,
						 u32 dev_id, u32 hw_id);

int prestera_port_autoneg_set(struct prestera_port *port, u64 link_modes);

int prestera_router_init(struct prestera_switch *sw);
void prestera_router_fini(struct prestera_switch *sw);

struct prestera_port *prestera_find_port(struct prestera_switch *sw, u32 id);

struct prestera_switch *prestera_switch_get(struct net_device *dev);

int prestera_port_cfg_mac_read(struct prestera_port *port,
			       struct prestera_port_mac_config *cfg);

int prestera_port_cfg_mac_write(struct prestera_port *port,
				struct prestera_port_mac_config *cfg);

struct prestera_port *prestera_port_dev_lower_find(struct net_device *dev);

void prestera_queue_work(struct work_struct *work);
void prestera_queue_delayed_work(struct delayed_work *work, unsigned long delay);
void prestera_queue_drain(void);

int prestera_port_learning_set(struct prestera_port *port, bool learn_enable);
int prestera_port_uc_flood_set(struct prestera_port *port, bool flood);
int prestera_port_mc_flood_set(struct prestera_port *port, bool flood);

int prestera_port_br_locked_set(struct prestera_port *port, bool br_locked);

int prestera_port_pvid_set(struct prestera_port *port, u16 vid);

bool prestera_netdev_check(const struct net_device *dev);

int prestera_is_valid_mac_addr(struct prestera_port *port, const u8 *addr);

bool prestera_port_is_lag_member(const struct prestera_port *port);
int prestera_lag_id(struct prestera_switch *sw,
		    struct net_device *lag_dev, u16 *lag_id);

struct prestera_lag *prestera_lag_by_id(struct prestera_switch *sw, u16 id);

u16 prestera_port_lag_id(const struct prestera_port *port);

struct prestera_mdb_entry *
prestera_mdb_entry_create(struct prestera_switch *sw,
			  const unsigned char *addr, u16 vid);
void prestera_mdb_entry_destroy(struct prestera_mdb_entry *mdb_entry);

struct prestera_flood_domain *
prestera_flood_domain_create(struct prestera_switch *sw);
void prestera_flood_domain_destroy(struct prestera_flood_domain *flood_domain);

int
prestera_flood_domain_port_create(struct prestera_flood_domain *flood_domain,
				  struct net_device *dev,
				  u16 vid);
void
prestera_flood_domain_port_destroy(struct prestera_flood_domain_port *port);
struct prestera_flood_domain_port *
prestera_flood_domain_port_find(struct prestera_flood_domain *flood_domain,
				struct net_device *dev, u16 vid);

#endif /* _PRESTERA_H_ */