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

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

#include <linux/etherdevice.h>
#include <linux/if_bridge.h>
#include <linux/ethtool.h>
#include <linux/list.h>

#include "prestera.h"
#include "prestera_hw.h"
#include "prestera_acl.h"
#include "prestera_counter.h"
#include "prestera_router_hw.h"

#define PRESTERA_SWITCH_INIT_TIMEOUT_MS

#define PRESTERA_MIN_MTU

#define PRESTERA_MSG_CHUNK_SIZE

enum prestera_cmd_type_t {};

enum {};

enum {};

enum {};

enum {};

enum {};

enum {};

enum {};

enum {};

enum {};

struct prestera_fw_event_handler {};

enum {};

struct prestera_msg_cmd {};

struct prestera_msg_ret {};

struct prestera_msg_common_req {};

struct prestera_msg_common_resp {};

struct prestera_msg_switch_attr_req {};

struct prestera_msg_switch_init_resp {};

struct prestera_msg_event_port_param {};

struct prestera_msg_port_cap_param {};

struct prestera_msg_port_flood_param {};

prestera_msg_port_param;

struct prestera_msg_port_attr_req {};

struct prestera_msg_port_attr_resp {};

struct prestera_msg_port_stats_resp {};

struct prestera_msg_port_info_req {};

struct prestera_msg_port_info_resp {};

struct prestera_msg_vlan_req {};

struct prestera_msg_fdb_req {};

struct prestera_msg_bridge_req {};

struct prestera_msg_bridge_resp {};

struct prestera_msg_vtcam_create_req {};

struct prestera_msg_vtcam_destroy_req {};

struct prestera_msg_vtcam_rule_del_req {};

struct prestera_msg_vtcam_bind_req {};

struct prestera_msg_vtcam_resp {};

struct prestera_msg_acl_action {};

struct prestera_msg_vtcam_rule_add_req {};

struct prestera_msg_counter_req {};

struct prestera_msg_counter_stats {};

struct prestera_msg_counter_resp {};

struct prestera_msg_span_req {};

struct prestera_msg_span_resp {};

struct prestera_msg_stp_req {};

struct prestera_msg_rxtx_req {};

struct prestera_msg_rxtx_resp {};

struct prestera_msg_iface {};

struct prestera_msg_ip_addr {};

struct prestera_msg_nh {};

struct prestera_msg_rif_req {};

struct prestera_msg_rif_resp {};

struct prestera_msg_lpm_req {};

struct prestera_msg_nh_req {};

struct prestera_msg_nh_chunk_req {};

struct prestera_msg_nh_chunk_resp {};

struct prestera_msg_nh_grp_req {};

struct prestera_msg_nh_grp_resp {};

struct prestera_msg_vr_req {};

struct prestera_msg_vr_resp {};

struct prestera_msg_lag_req {};

struct prestera_msg_cpu_code_counter_req {};

struct mvsw_msg_cpu_code_counter_ret {};

struct prestera_msg_policer_req {};

struct prestera_msg_policer_resp {};

struct prestera_msg_event {};

struct prestera_msg_event_port {};

prestera_msg_event_fdb_param;

struct prestera_msg_event_fdb {};

struct prestera_msg_flood_domain_create_req {};

struct prestera_msg_flood_domain_create_resp {};

struct prestera_msg_flood_domain_destroy_req {};

struct prestera_msg_flood_domain_ports_reset_req {};

struct prestera_msg_flood_domain_port {};

struct prestera_msg_flood_domain_ports_set_req {};

struct prestera_msg_mdb_create_req {};

struct prestera_msg_mdb_destroy_req {};

static void prestera_hw_build_tests(void)
{}

static u8 prestera_hw_mdix_to_eth(u8 mode);
static void prestera_hw_remote_fc_to_eth(u8 fc, bool *pause, bool *asym_pause);

static int __prestera_cmd_ret(struct prestera_switch *sw,
			      enum prestera_cmd_type_t type,
			      struct prestera_msg_cmd *cmd, size_t clen,
			      struct prestera_msg_ret *ret, size_t rlen,
			      int waitms)
{}

static int prestera_cmd_ret(struct prestera_switch *sw,
			    enum prestera_cmd_type_t type,
			    struct prestera_msg_cmd *cmd, size_t clen,
			    struct prestera_msg_ret *ret, size_t rlen)
{}

static int prestera_cmd_ret_wait(struct prestera_switch *sw,
				 enum prestera_cmd_type_t type,
				 struct prestera_msg_cmd *cmd, size_t clen,
				 struct prestera_msg_ret *ret, size_t rlen,
				 int waitms)
{}

static int prestera_cmd(struct prestera_switch *sw,
			enum prestera_cmd_type_t type,
			struct prestera_msg_cmd *cmd, size_t clen)
{}

static int prestera_fw_parse_port_evt(void *msg, struct prestera_event *evt)
{}

static int prestera_fw_parse_fdb_evt(void *msg, struct prestera_event *evt)
{}

static struct prestera_fw_evt_parser {} fw_event_parsers[PRESTERA_EVENT_TYPE_MAX] =;

static struct prestera_fw_event_handler *
__find_event_handler(const struct prestera_switch *sw,
		     enum prestera_event_type type)
{}

static int prestera_find_event_handler(const struct prestera_switch *sw,
				       enum prestera_event_type type,
				       struct prestera_fw_event_handler *eh)
{}

static int prestera_evt_recv(struct prestera_device *dev, void *buf, size_t size)
{}

static void prestera_pkt_recv(struct prestera_device *dev)
{}

static u8 prestera_hw_mdix_to_eth(u8 mode)
{}

static u8 prestera_hw_mdix_from_eth(u8 mode)
{}

int prestera_hw_port_info_get(const struct prestera_port *port,
			      u32 *dev_id, u32 *hw_id, u16 *fp_id)
{}

int prestera_hw_switch_mac_set(struct prestera_switch *sw, const char *mac)
{}

int prestera_hw_switch_init(struct prestera_switch *sw)
{}

void prestera_hw_switch_fini(struct prestera_switch *sw)
{}

int prestera_hw_switch_ageing_set(struct prestera_switch *sw, u32 ageing_ms)
{}

int prestera_hw_port_mac_mode_get(const struct prestera_port *port,
				  u32 *mode, u32 *speed, u8 *duplex, u8 *fec)
{}

int prestera_hw_port_mac_mode_set(const struct prestera_port *port,
				  bool admin, u32 mode, u8 inband,
				  u32 speed, u8 duplex, u8 fec)
{}

int prestera_hw_port_phy_mode_get(const struct prestera_port *port,
				  u8 *mdix, u64 *lmode_bmap,
				  bool *fc_pause, bool *fc_asym)
{}

int prestera_hw_port_phy_mode_set(const struct prestera_port *port,
				  bool admin, bool adv, u32 mode, u64 modes,
				  u8 mdix)
{}

int prestera_hw_port_mtu_set(const struct prestera_port *port, u32 mtu)
{}

int prestera_hw_port_mac_set(const struct prestera_port *port, const char *mac)
{}

int prestera_hw_port_accept_frm_type(struct prestera_port *port,
				     enum prestera_accept_frm_type type)
{}

int prestera_hw_port_cap_get(const struct prestera_port *port,
			     struct prestera_port_caps *caps)
{}

static void prestera_hw_remote_fc_to_eth(u8 fc, bool *pause, bool *asym_pause)
{}

int prestera_hw_vtcam_create(struct prestera_switch *sw,
			     u8 lookup, const u32 *keymask, u32 *vtcam_id,
			     enum prestera_hw_vtcam_direction_t dir)
{}

int prestera_hw_vtcam_destroy(struct prestera_switch *sw, u32 vtcam_id)
{}

static int
prestera_acl_rule_add_put_action(struct prestera_msg_acl_action *action,
				 struct prestera_acl_hw_action_info *info)
{}

int prestera_hw_vtcam_rule_add(struct prestera_switch *sw,
			       u32 vtcam_id, u32 prio, void *key, void *keymask,
			       struct prestera_acl_hw_action_info *act,
			       u8 n_act, u32 *rule_id)
{}

int prestera_hw_vtcam_rule_del(struct prestera_switch *sw,
			       u32 vtcam_id, u32 rule_id)
{}

int prestera_hw_vtcam_iface_bind(struct prestera_switch *sw,
				 struct prestera_acl_iface *iface,
				 u32 vtcam_id, u16 pcl_id)
{}

int prestera_hw_vtcam_iface_unbind(struct prestera_switch *sw,
				   struct prestera_acl_iface *iface,
				   u32 vtcam_id)
{}

int prestera_hw_span_get(const struct prestera_port *port, u8 *span_id)
{}

int prestera_hw_span_bind(const struct prestera_port *port, u8 span_id,
			  bool ingress)
{}

int prestera_hw_span_unbind(const struct prestera_port *port, bool ingress)
{}

int prestera_hw_span_release(struct prestera_switch *sw, u8 span_id)
{}

int prestera_hw_port_type_get(const struct prestera_port *port, u8 *type)
{}

int prestera_hw_port_speed_get(const struct prestera_port *port, u32 *speed)
{}

int prestera_hw_port_autoneg_restart(struct prestera_port *port)
{}

int prestera_hw_port_stats_get(const struct prestera_port *port,
			       struct prestera_port_stats *st)
{}

int prestera_hw_port_learning_set(struct prestera_port *port, bool enable)
{}

int prestera_hw_port_uc_flood_set(const struct prestera_port *port, bool flood)
{}

int prestera_hw_port_mc_flood_set(const struct prestera_port *port, bool flood)
{}

int prestera_hw_port_br_locked_set(const struct prestera_port *port,
				   bool br_locked)
{}

int prestera_hw_vlan_create(struct prestera_switch *sw, u16 vid)
{}

int prestera_hw_vlan_delete(struct prestera_switch *sw, u16 vid)
{}

int prestera_hw_vlan_port_set(struct prestera_port *port, u16 vid,
			      bool is_member, bool untagged)
{}

int prestera_hw_vlan_port_vid_set(struct prestera_port *port, u16 vid)
{}

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

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

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

int prestera_hw_lag_fdb_add(struct prestera_switch *sw, u16 lag_id,
			    const unsigned char *mac, u16 vid, bool dynamic)
{}

int prestera_hw_lag_fdb_del(struct prestera_switch *sw, u16 lag_id,
			    const unsigned char *mac, u16 vid)
{}

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

int prestera_hw_fdb_flush_vlan(struct prestera_switch *sw, u16 vid, u32 mode)
{}

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

int prestera_hw_fdb_flush_lag(struct prestera_switch *sw, u16 lag_id,
			      u32 mode)
{}

int prestera_hw_fdb_flush_lag_vlan(struct prestera_switch *sw,
				   u16 lag_id, u16 vid, u32 mode)
{}

int prestera_hw_bridge_create(struct prestera_switch *sw, u16 *bridge_id)
{}

int prestera_hw_bridge_delete(struct prestera_switch *sw, u16 bridge_id)
{}

int prestera_hw_bridge_port_add(struct prestera_port *port, u16 bridge_id)
{}

int prestera_hw_bridge_port_delete(struct prestera_port *port, u16 bridge_id)
{}

static int prestera_iface_to_msg(struct prestera_iface *iface,
				 struct prestera_msg_iface *msg_if)
{}

int prestera_hw_rif_create(struct prestera_switch *sw,
			   struct prestera_iface *iif, u8 *mac, u16 *rif_id)
{}

int prestera_hw_rif_delete(struct prestera_switch *sw, u16 rif_id,
			   struct prestera_iface *iif)
{}

int prestera_hw_vr_create(struct prestera_switch *sw, u16 *vr_id)
{}

int prestera_hw_vr_delete(struct prestera_switch *sw, u16 vr_id)
{}

int prestera_hw_lpm_add(struct prestera_switch *sw, u16 vr_id,
			__be32 dst, u32 dst_len, u32 grp_id)
{}

int prestera_hw_lpm_del(struct prestera_switch *sw, u16 vr_id,
			__be32 dst, u32 dst_len)
{}

int prestera_hw_nh_entries_set(struct prestera_switch *sw, int count,
			       struct prestera_neigh_info *nhs, u32 grp_id)
{}

int prestera_hw_nhgrp_blk_get(struct prestera_switch *sw,
			      u8 *hw_state, u32 buf_size /* Buffer in bytes */)
{}

int prestera_hw_nh_group_create(struct prestera_switch *sw, u16 nh_count,
				u32 *grp_id)
{}

int prestera_hw_nh_group_delete(struct prestera_switch *sw, u16 nh_count,
				u32 grp_id)
{}

int prestera_hw_rxtx_init(struct prestera_switch *sw,
			  struct prestera_rxtx_params *params)
{}

int prestera_hw_lag_member_add(struct prestera_port *port, u16 lag_id)
{}

int prestera_hw_lag_member_del(struct prestera_port *port, u16 lag_id)
{}

int prestera_hw_lag_member_enable(struct prestera_port *port, u16 lag_id,
				  bool enable)
{}

int
prestera_hw_cpu_code_counters_get(struct prestera_switch *sw, u8 code,
				  enum prestera_hw_cpu_code_cnt_t counter_type,
				  u64 *packet_count)
{}

int prestera_hw_event_handler_register(struct prestera_switch *sw,
				       enum prestera_event_type type,
				       prestera_event_cb_t fn,
				       void *arg)
{}

void prestera_hw_event_handler_unregister(struct prestera_switch *sw,
					  enum prestera_event_type type,
					  prestera_event_cb_t fn)
{}

int prestera_hw_counter_trigger(struct prestera_switch *sw, u32 block_id)
{}

int prestera_hw_counter_abort(struct prestera_switch *sw)
{}

int prestera_hw_counters_get(struct prestera_switch *sw, u32 idx,
			     u32 *len, bool *done,
			     struct prestera_counter_stats *stats)
{}

int prestera_hw_counter_block_get(struct prestera_switch *sw,
				  u32 client, u32 *block_id, u32 *offset,
				  u32 *num_counters)
{}

int prestera_hw_counter_block_release(struct prestera_switch *sw,
				      u32 block_id)
{}

int prestera_hw_counter_clear(struct prestera_switch *sw, u32 block_id,
			      u32 counter_id)
{}

int prestera_hw_policer_create(struct prestera_switch *sw, u8 type,
			       u32 *policer_id)
{}

int prestera_hw_policer_release(struct prestera_switch *sw,
				u32 policer_id)
{}

int prestera_hw_policer_sr_tcm_set(struct prestera_switch *sw,
				   u32 policer_id, u64 cir, u32 cbs)
{}

int prestera_hw_flood_domain_create(struct prestera_flood_domain *domain)
{}

int prestera_hw_flood_domain_destroy(struct prestera_flood_domain *domain)
{}

int prestera_hw_flood_domain_ports_set(struct prestera_flood_domain *domain)
{}

int prestera_hw_flood_domain_ports_reset(struct prestera_flood_domain *domain)
{}

int prestera_hw_mdb_create(struct prestera_mdb_entry *mdb)
{}

int prestera_hw_mdb_destroy(struct prestera_mdb_entry *mdb)
{}