linux/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (c) 2014-2015 Hisilicon Limited.
 */

#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/mfd/syscon.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/vmalloc.h>

#include "hns_dsaf_mac.h"
#include "hns_dsaf_main.h"
#include "hns_dsaf_ppe.h"
#include "hns_dsaf_rcb.h"
#include "hns_dsaf_misc.h"

static const char *g_dsaf_mode_match[DSAF_MODE_MAX] =;

static const struct acpi_device_id hns_dsaf_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, hns_dsaf_acpi_match);

static int hns_dsaf_get_cfg(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_sbm_link_sram_init_en - config dsaf_sbm_init_en
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_sbm_link_sram_init_en(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_reg_cnt_clr_ce - config hns_dsaf_reg_cnt_clr_ce
 * @dsaf_dev: dsa fabric id
 * @reg_cnt_clr_ce: config value
 */
static void
hns_dsaf_reg_cnt_clr_ce(struct dsaf_device *dsaf_dev, u32 reg_cnt_clr_ce)
{}

/**
 * hns_dsaf_ppe_qid_cfg - config ppe qid
 * @dsaf_dev: dsa fabric id
 * @qid_cfg: value array
 */
static void
hns_dsaf_ppe_qid_cfg(struct dsaf_device *dsaf_dev, u32 qid_cfg)
{}

static void hns_dsaf_mix_def_qid_cfg(struct dsaf_device *dsaf_dev)
{}

static void hns_dsaf_inner_qid_cfg(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_sw_port_type_cfg - cfg sw type
 * @dsaf_dev: dsa fabric id
 * @port_type: array
 */
static void hns_dsaf_sw_port_type_cfg(struct dsaf_device *dsaf_dev,
				      enum dsaf_sw_port_type port_type)
{}

/**
 * hns_dsaf_stp_port_type_cfg - cfg stp type
 * @dsaf_dev: dsa fabric id
 * @port_type: array
 */
static void hns_dsaf_stp_port_type_cfg(struct dsaf_device *dsaf_dev,
				       enum dsaf_stp_port_type port_type)
{}

#define HNS_DSAF_SBM_NUM(dev)
/**
 * hns_dsaf_sbm_cfg - config sbm
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_sbm_cfg(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_sbm_cfg_mib_en - config sbm
 * @dsaf_dev: dsa fabric id
 */
static int hns_dsaf_sbm_cfg_mib_en(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_sbm_bp_wl_cfg - config sbm
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_sbm_bp_wl_cfg(struct dsaf_device *dsaf_dev)
{}

static void hns_dsafv2_sbm_bp_wl_cfg(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_voq_bp_all_thrd_cfg -  voq
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_voq_bp_all_thrd_cfg(struct dsaf_device *dsaf_dev)
{}

static void hns_dsaf_tbl_tcam_match_cfg(
	struct dsaf_device *dsaf_dev,
	struct dsaf_tbl_tcam_data *ptbl_tcam_data)
{}

/**
 * hns_dsaf_tbl_tcam_data_cfg - tbl
 * @dsaf_dev: dsa fabric id
 * @ptbl_tcam_data: addr
 */
static void hns_dsaf_tbl_tcam_data_cfg(
	struct dsaf_device *dsaf_dev,
	struct dsaf_tbl_tcam_data *ptbl_tcam_data)
{}

/**
 * hns_dsaf_tbl_tcam_mcast_cfg - tbl
 * @dsaf_dev: dsa fabric id
 * @mcast: addr
 */
static void hns_dsaf_tbl_tcam_mcast_cfg(
	struct dsaf_device *dsaf_dev,
	struct dsaf_tbl_tcam_mcast_cfg *mcast)
{}

/**
 * hns_dsaf_tbl_tcam_ucast_cfg - tbl
 * @dsaf_dev: dsa fabric id
 * @tbl_tcam_ucast: addr
 */
static void hns_dsaf_tbl_tcam_ucast_cfg(
	struct dsaf_device *dsaf_dev,
	struct dsaf_tbl_tcam_ucast_cfg *tbl_tcam_ucast)
{}

/**
 * hns_dsaf_tbl_line_cfg - tbl
 * @dsaf_dev: dsa fabric id
 * @tbl_lin: addr
 */
static void hns_dsaf_tbl_line_cfg(struct dsaf_device *dsaf_dev,
				  struct dsaf_tbl_line_cfg *tbl_lin)
{}

/**
 * hns_dsaf_tbl_tcam_mcast_pul - tbl
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_tbl_tcam_mcast_pul(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_tbl_line_pul - tbl
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_tbl_line_pul(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_tbl_tcam_data_mcast_pul - tbl
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_tbl_tcam_data_mcast_pul(
	struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_tbl_tcam_data_ucast_pul - tbl
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_tbl_tcam_data_ucast_pul(
	struct dsaf_device *dsaf_dev)
{}

void hns_dsaf_set_promisc_mode(struct dsaf_device *dsaf_dev, u32 en)
{}

/**
 * hns_dsaf_tbl_stat_en - tbl
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_tbl_stat_en(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_rocee_bp_en - rocee back press enable
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_rocee_bp_en(struct dsaf_device *dsaf_dev)
{}

/* set msk for dsaf exception irq*/
static void hns_dsaf_int_xge_msk_set(struct dsaf_device *dsaf_dev,
				     u32 chnn_num, u32 mask_set)
{}

static void hns_dsaf_int_ppe_msk_set(struct dsaf_device *dsaf_dev,
				     u32 chnn_num, u32 msk_set)
{}

static void hns_dsaf_int_rocee_msk_set(struct dsaf_device *dsaf_dev,
				       u32 chnn, u32 msk_set)
{}

static void
hns_dsaf_int_tbl_msk_set(struct dsaf_device *dsaf_dev, u32 msk_set)
{}

/* clr dsaf exception irq*/
static void hns_dsaf_int_xge_src_clr(struct dsaf_device *dsaf_dev,
				     u32 chnn_num, u32 int_src)
{}

static void hns_dsaf_int_ppe_src_clr(struct dsaf_device *dsaf_dev,
				     u32 chnn, u32 int_src)
{}

static void hns_dsaf_int_rocee_src_clr(struct dsaf_device *dsaf_dev,
				       u32 chnn, u32 int_src)
{}

static void hns_dsaf_int_tbl_src_clr(struct dsaf_device *dsaf_dev,
				     u32 int_src)
{}

/**
 * hns_dsaf_single_line_tbl_cfg - INT
 * @dsaf_dev: dsa fabric id
 * @address: the address
 * @ptbl_line: the line
 */
static void hns_dsaf_single_line_tbl_cfg(
	struct dsaf_device *dsaf_dev,
	u32 address, struct dsaf_tbl_line_cfg *ptbl_line)
{}

/**
 * hns_dsaf_tcam_uc_cfg - INT
 * @dsaf_dev: dsa fabric id
 * @address: the address
 * @ptbl_tcam_data: the data
 * @ptbl_tcam_ucast: unicast
 */
static void hns_dsaf_tcam_uc_cfg(
	struct dsaf_device *dsaf_dev, u32 address,
	struct dsaf_tbl_tcam_data *ptbl_tcam_data,
	struct dsaf_tbl_tcam_ucast_cfg *ptbl_tcam_ucast)
{}

/**
 * hns_dsaf_tcam_mc_cfg - cfg the tcam for mc
 * @dsaf_dev: dsa fabric device struct pointer
 * @address: tcam index
 * @ptbl_tcam_data: tcam data struct pointer
 * @ptbl_tcam_mask: tcam mask struct pointer, it must be null for HNSv1
 * @ptbl_tcam_mcast: tcam data struct pointer
 */
static void hns_dsaf_tcam_mc_cfg(
	struct dsaf_device *dsaf_dev, u32 address,
	struct dsaf_tbl_tcam_data *ptbl_tcam_data,
	struct dsaf_tbl_tcam_data *ptbl_tcam_mask,
	struct dsaf_tbl_tcam_mcast_cfg *ptbl_tcam_mcast)
{}

/**
 * hns_dsaf_tcam_uc_cfg_vague - INT
 * @dsaf_dev: dsa fabric device struct pointer
 * @address: the address
 * @tcam_data: the data
 * @tcam_mask: the mask
 * @tcam_uc: the unicast data
 */
static void hns_dsaf_tcam_uc_cfg_vague(struct dsaf_device *dsaf_dev,
				       u32 address,
				       struct dsaf_tbl_tcam_data *tcam_data,
				       struct dsaf_tbl_tcam_data *tcam_mask,
				       struct dsaf_tbl_tcam_ucast_cfg *tcam_uc)
{}

/**
 * hns_dsaf_tcam_mc_cfg_vague - INT
 * @dsaf_dev: dsa fabric device struct pointer
 * @address: the address
 * @tcam_data: the data
 * @tcam_mask: the mask
 * @tcam_mc: the multicast data
 */
static void hns_dsaf_tcam_mc_cfg_vague(struct dsaf_device *dsaf_dev,
				       u32 address,
				       struct dsaf_tbl_tcam_data *tcam_data,
				       struct dsaf_tbl_tcam_data *tcam_mask,
				       struct dsaf_tbl_tcam_mcast_cfg *tcam_mc)
{}

/**
 * hns_dsaf_tcam_mc_invld - INT
 * @dsaf_dev: dsa fabric id
 * @address: the address
 */
static void hns_dsaf_tcam_mc_invld(struct dsaf_device *dsaf_dev, u32 address)
{}

static void
hns_dsaf_tcam_addr_get(struct dsaf_drv_tbl_tcam_key *mac_key, u8 *addr)
{}

/**
 * hns_dsaf_tcam_uc_get - INT
 * @dsaf_dev: dsa fabric id
 * @address: the address
 * @ptbl_tcam_data: the data
 * @ptbl_tcam_ucast: unicast
 */
static void hns_dsaf_tcam_uc_get(
	struct dsaf_device *dsaf_dev, u32 address,
	struct dsaf_tbl_tcam_data *ptbl_tcam_data,
	struct dsaf_tbl_tcam_ucast_cfg *ptbl_tcam_ucast)
{}

/**
 * hns_dsaf_tcam_mc_get - INT
 * @dsaf_dev: dsa fabric id
 * @address: the address
 * @ptbl_tcam_data: the data
 * @ptbl_tcam_mcast: tcam multicast data
 */
static void hns_dsaf_tcam_mc_get(
	struct dsaf_device *dsaf_dev, u32 address,
	struct dsaf_tbl_tcam_data *ptbl_tcam_data,
	struct dsaf_tbl_tcam_mcast_cfg *ptbl_tcam_mcast)
{}

/**
 * hns_dsaf_tbl_line_init - INT
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_tbl_line_init(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_tbl_tcam_init - INT
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_tbl_tcam_init(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_pfc_en_cfg - dsaf pfc pause cfg
 * @dsaf_dev: dsa fabric id
 * @mac_id: mac contrl block
 * @tc_en: traffic class
 */
static void hns_dsaf_pfc_en_cfg(struct dsaf_device *dsaf_dev,
				int mac_id, int tc_en)
{}

static void hns_dsaf_set_pfc_pause(struct dsaf_device *dsaf_dev,
				   int mac_id, int tx_en, int rx_en)
{}

int hns_dsaf_set_rx_mac_pause_en(struct dsaf_device *dsaf_dev, int mac_id,
				 u32 en)
{}

void hns_dsaf_get_rx_mac_pause_en(struct dsaf_device *dsaf_dev, int mac_id,
				  u32 *en)
{}

/**
 * hns_dsaf_comm_init - INT
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_comm_init(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_inode_init - INT
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_inode_init(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_sbm_init - INT
 * @dsaf_dev: dsa fabric id
 */
static int hns_dsaf_sbm_init(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_tbl_init - INT
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_tbl_init(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_voq_init - INT
 * @dsaf_dev: dsa fabric id
 */
static void hns_dsaf_voq_init(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_init_hw - init dsa fabric hardware
 * @dsaf_dev: dsa fabric device struct pointer
 */
static int hns_dsaf_init_hw(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_remove_hw - uninit dsa fabric hardware
 * @dsaf_dev: dsa fabric device struct pointer
 */
static void hns_dsaf_remove_hw(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_init - init dsa fabric
 * @dsaf_dev: dsa fabric device struct pointer
 * return 0 - success , negative --fail
 */
static int hns_dsaf_init(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_free - free dsa fabric
 * @dsaf_dev: dsa fabric device struct pointer
 */
static void hns_dsaf_free(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_find_soft_mac_entry - find dsa fabric soft entry
 * @dsaf_dev: dsa fabric device struct pointer
 * @mac_key: mac entry struct pointer
 */
static u16 hns_dsaf_find_soft_mac_entry(
	struct dsaf_device *dsaf_dev,
	struct dsaf_drv_tbl_tcam_key *mac_key)
{}

/**
 * hns_dsaf_find_empty_mac_entry - search dsa fabric soft empty-entry
 * @dsaf_dev: dsa fabric device struct pointer
 */
static u16 hns_dsaf_find_empty_mac_entry(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_find_empty_mac_entry_reverse
 * search dsa fabric soft empty-entry from the end
 * @dsaf_dev: dsa fabric device struct pointer
 */
static u16 hns_dsaf_find_empty_mac_entry_reverse(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_set_mac_key - set mac key
 * @dsaf_dev: dsa fabric device struct pointer
 * @mac_key: tcam key pointer
 * @vlan_id: vlan id
 * @in_port_num: input port num
 * @addr: mac addr
 */
static void hns_dsaf_set_mac_key(
	struct dsaf_device *dsaf_dev,
	struct dsaf_drv_tbl_tcam_key *mac_key, u16 vlan_id, u8 in_port_num,
	u8 *addr)
{}

/**
 * hns_dsaf_set_mac_uc_entry - set mac uc-entry
 * @dsaf_dev: dsa fabric device struct pointer
 * @mac_entry: uc-mac entry
 */
int hns_dsaf_set_mac_uc_entry(
	struct dsaf_device *dsaf_dev,
	struct dsaf_drv_mac_single_dest_entry *mac_entry)
{}

int hns_dsaf_rm_mac_addr(
	struct dsaf_device *dsaf_dev,
	struct dsaf_drv_mac_single_dest_entry *mac_entry)
{}

static void hns_dsaf_setup_mc_mask(struct dsaf_device *dsaf_dev,
				   u8 port_num, u8 *mask, u8 *addr)
{}

static void hns_dsaf_mc_mask_bit_clear(char *dst, const char *src)
{}

/**
 * hns_dsaf_add_mac_mc_port - add mac mc-port
 * @dsaf_dev: dsa fabric device struct pointer
 * @mac_entry: mc-mac entry
 */
int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev,
			     struct dsaf_drv_mac_single_dest_entry *mac_entry)
{}

/**
 * hns_dsaf_del_mac_entry - del mac mc-port
 * @dsaf_dev: dsa fabric device struct pointer
 * @vlan_id: vlian id
 * @in_port_num: input port num
 * @addr : mac addr
 */
int hns_dsaf_del_mac_entry(struct dsaf_device *dsaf_dev, u16 vlan_id,
			   u8 in_port_num, u8 *addr)
{}

/**
 * hns_dsaf_del_mac_mc_port - del mac mc- port
 * @dsaf_dev: dsa fabric device struct pointer
 * @mac_entry: mac entry
 */
int hns_dsaf_del_mac_mc_port(struct dsaf_device *dsaf_dev,
			     struct dsaf_drv_mac_single_dest_entry *mac_entry)
{}

int hns_dsaf_clr_mac_mc_port(struct dsaf_device *dsaf_dev, u8 mac_id,
			     u8 port_num)
{}

static struct dsaf_device *hns_dsaf_alloc_dev(struct device *dev,
					      size_t sizeof_priv)
{}

/**
 * hns_dsaf_free_dev - free dev mem
 * @dsaf_dev: struct device pointer
 */
static void hns_dsaf_free_dev(struct dsaf_device *dsaf_dev)
{}

/**
 * hns_dsaf_pfc_unit_cnt - set pfc unit count
 * @dsaf_dev: dsa fabric id
 * @mac_id: id in use
 * @rate:  value array
 */
static void hns_dsaf_pfc_unit_cnt(struct dsaf_device *dsaf_dev, int  mac_id,
				  enum dsaf_port_rate_mode rate)
{}

/**
 * hns_dsaf_port_work_rate_cfg - fifo
 * @dsaf_dev: dsa fabric id
 * @mac_id: mac contrl block
 * @rate_mode: value array
 */
static void
hns_dsaf_port_work_rate_cfg(struct dsaf_device *dsaf_dev, int mac_id,
			    enum dsaf_port_rate_mode rate_mode)
{}

/**
 * hns_dsaf_fix_mac_mode - dsaf modify mac mode
 * @mac_cb: mac contrl block
 */
void hns_dsaf_fix_mac_mode(struct hns_mac_cb *mac_cb)
{}

static u32 hns_dsaf_get_inode_prio_reg(int index)
{}

void hns_dsaf_update_stats(struct dsaf_device *dsaf_dev, u32 node_num)
{}

/**
 *hns_dsaf_get_regs - dump dsaf regs
 *@ddev: dsaf device
 *@port: port
 *@data:data for value of regs
 */
void hns_dsaf_get_regs(struct dsaf_device *ddev, u32 port, void *data)
{}

static char *hns_dsaf_get_node_stats_strings(char *data, int node,
					     struct dsaf_device *dsaf_dev)
{}

static u64 *hns_dsaf_get_node_stats(struct dsaf_device *ddev, u64 *data,
				    int node_num)
{}

/**
 *hns_dsaf_get_stats - get dsaf statistic
 *@ddev: dsaf device
 *@data:statistic value
 *@port: port num
 */
void hns_dsaf_get_stats(struct dsaf_device *ddev, u64 *data, int port)
{}

/**
 *hns_dsaf_get_sset_count - get dsaf string set count
 *@dsaf_dev: dsaf device
 *@stringset: type of values in data
 *return dsaf string name count
 */
int hns_dsaf_get_sset_count(struct dsaf_device *dsaf_dev, int stringset)
{}

/**
 *hns_dsaf_get_strings - get dsaf string set
 *@stringset:srting set index
 *@data:strings name value
 *@port:port index
 *@dsaf_dev: dsaf device
 */
void hns_dsaf_get_strings(int stringset, u8 *data, int port,
			  struct dsaf_device *dsaf_dev)
{}

/**
 *hns_dsaf_get_regs_count - get dsaf regs count
 *return dsaf regs count
 */
int hns_dsaf_get_regs_count(void)
{}

static int hns_dsaf_get_port_id(u8 port)
{}

static void set_promisc_tcam_enable(struct dsaf_device *dsaf_dev, u32 port)
{}

static void set_promisc_tcam_disable(struct dsaf_device *dsaf_dev, u32 port)
{}

/* Reserve the last TCAM entry for promisc support */
void hns_dsaf_set_promisc_tcam(struct dsaf_device *dsaf_dev,
			       u32 port, bool enable)
{}

int hns_dsaf_wait_pkt_clean(struct dsaf_device *dsaf_dev, int port)
{}

/**
 * hns_dsaf_probe - probo dsaf dev
 * @pdev: dasf platform device
 * return 0 - success , negative --fail
 */
static int hns_dsaf_probe(struct platform_device *pdev)
{}

/**
 * hns_dsaf_remove - remove dsaf dev
 * @pdev: dasf platform device
 */
static void hns_dsaf_remove(struct platform_device *pdev)
{}

static const struct of_device_id g_dsaf_match[] =;
MODULE_DEVICE_TABLE(of, g_dsaf_match);

static struct platform_driver g_dsaf_driver =;

module_platform_driver();

/**
 * hns_dsaf_roce_reset - reset dsaf and roce
 * @dsaf_fwnode: Pointer to framework node for the dasf
 * @dereset: false - request reset , true - drop reset
 * return 0 - success , negative -fail
 */
int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset)
{}
EXPORT_SYMBOL();

MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_VERSION();