linux/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h

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

#ifndef _HNS_DSAF_MAC_H
#define _HNS_DSAF_MAC_H

#include <linux/if_vlan.h>
#include <linux/kernel.h>
#include <linux/phy.h>
#include <linux/regmap.h>
#include "hns_dsaf_main.h"

struct dsaf_device;

#define MAC_GMAC_SUPPORTED

#define MAC_DEFAULT_MTU
#define MAC_MAX_MTU
#define MAC_MAX_MTU_V2
#define MAC_MIN_MTU
#define MAC_MAX_MTU_DBG

#define MAC_DEFAULT_PAUSE_TIME

#define MAC_GMAC_IDX
#define MAC_XGMAC_IDX

#define ETH_STATIC_REG
#define ETH_DUMP_REG
/* check mac addr broadcast */
#define MAC_IS_BROADCAST(p)

/* check mac addr is 01-00-5e-xx-xx-xx*/
#define MAC_IS_L3_MULTICAST(p)

/*check the mac addr is 0 in all bit*/
#define MAC_IS_ALL_ZEROS(p)

/*check mac addr multicast*/
#define MAC_IS_MULTICAST(p)

struct mac_priv {};

/* net speed */
enum mac_speed {};

/*mac interface keyword	*/
enum mac_intf {};

/*mac mode */
enum mac_mode {};

/*mac communicate mode*/
enum mac_commom_mode {};

/*mac statistics */
struct mac_statistics {};

/*mac para struct ,mac get param from nic or dsaf when initialize*/
struct mac_params {};

struct mac_info {};

struct mac_entry_idx {};

struct mac_hw_stats {};

struct hns_mac_cb {};

struct mac_driver {};

struct mac_stats_string {};

#define MAC_MAKE_MODE(interface, speed)
#define MAC_INTERFACE_FROM_MODE(mode)
#define MAC_SPEED_FROM_MODE(mode)
#define MAC_STATS_FIELD_OFF(field)

static inline struct mac_driver *hns_mac_get_drv(
	const struct hns_mac_cb *mac_cb)
{}

void *hns_gmac_config(struct hns_mac_cb *mac_cb,
		      struct mac_params *mac_param);
void *hns_xgmac_config(struct hns_mac_cb *mac_cb,
		       struct mac_params *mac_param);

int hns_mac_init(struct dsaf_device *dsaf_dev);
bool hns_mac_need_adjust_link(struct hns_mac_cb *mac_cb, int speed, int duplex);
void hns_mac_get_link_status(struct hns_mac_cb *mac_cb,	u32 *link_status);
int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb, u32 vmid,
			   const char *addr);
int hns_mac_set_multi(struct hns_mac_cb *mac_cb,
		      u32 port_num, char *addr, bool enable);
int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vm, bool enable);
void hns_mac_start(struct hns_mac_cb *mac_cb);
void hns_mac_stop(struct hns_mac_cb *mac_cb);
void hns_mac_uninit(struct dsaf_device *dsaf_dev);
void hns_mac_adjust_link(struct hns_mac_cb *mac_cb, int speed, int duplex);
void hns_mac_reset(struct hns_mac_cb *mac_cb);
void hns_mac_get_autoneg(struct hns_mac_cb *mac_cb, u32 *auto_neg);
void hns_mac_get_pauseparam(struct hns_mac_cb *mac_cb, u32 *rx_en, u32 *tx_en);
int hns_mac_set_autoneg(struct hns_mac_cb *mac_cb, u8 enable);
int hns_mac_set_pauseparam(struct hns_mac_cb *mac_cb, u32 rx_en, u32 tx_en);
int hns_mac_set_mtu(struct hns_mac_cb *mac_cb, u32 new_mtu, u32 buf_size);
int hns_mac_get_port_info(struct hns_mac_cb *mac_cb,
			  u8 *auto_neg, u16 *speed, u8 *duplex);
int hns_mac_config_mac_loopback(struct hns_mac_cb *mac_cb,
				enum hnae_loop loop, int en);
void hns_mac_update_stats(struct hns_mac_cb *mac_cb);
void hns_mac_get_stats(struct hns_mac_cb *mac_cb, u64 *data);
void hns_mac_get_strings(struct hns_mac_cb *mac_cb, int stringset, u8 *data);
int hns_mac_get_sset_count(struct hns_mac_cb *mac_cb, int stringset);
void hns_mac_get_regs(struct hns_mac_cb *mac_cb, void *data);
int hns_mac_get_regs_count(struct hns_mac_cb *mac_cb);
void hns_set_led_opt(struct hns_mac_cb *mac_cb);
int hns_cpld_led_set_id(struct hns_mac_cb *mac_cb,
			enum hnae_led_state status);
void hns_mac_set_promisc(struct hns_mac_cb *mac_cb, u8 en);
int hns_mac_get_inner_port_num(struct hns_mac_cb *mac_cb,
			       u8 vmid, u8 *port_num);
int hns_mac_add_uc_addr(struct hns_mac_cb *mac_cb, u8 vf_id,
			const unsigned char *addr);
int hns_mac_rm_uc_addr(struct hns_mac_cb *mac_cb, u8 vf_id,
		       const unsigned char *addr);
int hns_mac_clr_multicast(struct hns_mac_cb *mac_cb, int vfn);
void hns_mac_enable(struct hns_mac_cb *mac_cb, enum mac_commom_mode mode);
void hns_mac_disable(struct hns_mac_cb *mac_cb, enum mac_commom_mode mode);
int hns_mac_wait_fifo_clean(struct hns_mac_cb *mac_cb);

#endif /* _HNS_DSAF_MAC_H */