linux/drivers/net/ethernet/huawei/hinic/hinic_port.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Huawei HiNIC PCI Express Linux driver
 * Copyright(c) 2017 Huawei Technologies Co., Ltd
 */

#ifndef HINIC_PORT_H
#define HINIC_PORT_H

#include <linux/types.h>
#include <linux/ethtool.h>
#include <linux/etherdevice.h>
#include <linux/bitops.h>

#include "hinic_dev.h"

#define HINIC_RSS_KEY_SIZE
#define HINIC_RSS_INDIR_SIZE
#define HINIC_PORT_STATS_VERSION
#define HINIC_FW_VERSION_NAME
#define HINIC_COMPILE_TIME_LEN
#define HINIC_MGMT_VERSION_MAX_LEN

struct hinic_version_info {};

enum hinic_rx_mode {};

enum hinic_port_link_state {};

enum hinic_port_state {};

enum hinic_func_port_state {};

enum hinic_autoneg_cap {};

enum hinic_autoneg_state {};

enum hinic_duplex {};

enum hinic_speed {};

enum hinic_link_mode {};

enum hinic_port_type {};

enum hinic_valid_link_settings {};

enum hinic_tso_state {};

struct hinic_port_mac_cmd {};

struct hinic_port_mtu_cmd {};

struct hinic_port_vlan_cmd {};

struct hinic_port_rx_mode_cmd {};

struct hinic_port_link_cmd {};

struct hinic_port_state_cmd {};

struct hinic_port_link_status {};

struct hinic_cable_plug_event {};

enum link_err_type {};

struct hinic_link_err_event {};

struct hinic_port_func_state_cmd {};

struct hinic_port_cap {};

struct hinic_link_mode_cmd {};

struct hinic_speed_cmd {};

struct hinic_set_autoneg_cmd {};

struct hinic_link_ksettings_info {};

struct hinic_tso_config {};

struct hinic_checksum_offload {};

struct hinic_rq_num {};

struct hinic_lro_config {};

struct hinic_lro_timer {};

struct hinic_vlan_cfg {};

struct hinic_vlan_filter {};

struct hinic_rss_template_mgmt {};

struct hinic_rss_template_key {};

struct hinic_rss_context_tbl {};

struct hinic_rss_context_table {};

struct hinic_rss_indirect_tbl {};

struct hinic_rss_indir_table {};

struct hinic_rss_key {};

struct hinic_rss_engine_type {};

struct hinic_rss_config {};

struct hinic_stats {};

struct hinic_vport_stats {};

struct hinic_phy_port_stats {};

struct hinic_port_stats_info {};

struct hinic_port_stats {};

struct hinic_cmd_vport_stats {};

struct hinic_tx_rate_cfg_max_min {};

struct hinic_tx_rate_cfg {};

enum nic_speed_level {};

struct hinic_spoofchk_set {};

struct hinic_pause_config {};

struct hinic_set_pfc {};

/* get or set loopback mode, need to modify by base API */
#define HINIC_INTERNAL_LP_MODE
#define LOOP_MODE_MIN
#define LOOP_MODE_MAX

struct hinic_port_loopback {};

struct hinic_led_info {};

#define STD_SFP_INFO_MAX_SIZE

struct hinic_cmd_get_light_module_abs {};

#define STD_SFP_INFO_MAX_SIZE

struct hinic_cmd_get_std_sfp_info {};

struct hinic_cmd_update_fw {};

int hinic_port_add_mac(struct hinic_dev *nic_dev, const u8 *addr,
		       u16 vlan_id);

int hinic_port_del_mac(struct hinic_dev *nic_dev, const u8 *addr,
		       u16 vlan_id);

int hinic_port_get_mac(struct hinic_dev *nic_dev, u8 *addr);

int hinic_port_set_mtu(struct hinic_dev *nic_dev, int new_mtu);

int hinic_port_add_vlan(struct hinic_dev *nic_dev, u16 vlan_id);

int hinic_port_del_vlan(struct hinic_dev *nic_dev, u16 vlan_id);

int hinic_port_set_rx_mode(struct hinic_dev *nic_dev, u32 rx_mode);

int hinic_port_link_state(struct hinic_dev *nic_dev,
			  enum hinic_port_link_state *link_state);

int hinic_port_set_state(struct hinic_dev *nic_dev,
			 enum hinic_port_state state);

int hinic_port_set_func_state(struct hinic_dev *nic_dev,
			      enum hinic_func_port_state state);

int hinic_port_get_cap(struct hinic_dev *nic_dev,
		       struct hinic_port_cap *port_cap);

int hinic_set_max_qnum(struct hinic_dev *nic_dev, u8 num_rqs);

int hinic_port_set_tso(struct hinic_dev *nic_dev, enum hinic_tso_state state);

int hinic_set_rx_csum_offload(struct hinic_dev *nic_dev, u32 en);

int hinic_set_rx_lro_state(struct hinic_dev *nic_dev, u8 lro_en,
			   u32 lro_timer, u32 wqe_num);

int hinic_set_rss_type(struct hinic_dev *nic_dev, u32 tmpl_idx,
		       struct hinic_rss_type rss_type);

int hinic_rss_set_indir_tbl(struct hinic_dev *nic_dev, u32 tmpl_idx,
			    const u32 *indir_table);

int hinic_rss_set_template_tbl(struct hinic_dev *nic_dev, u32 template_id,
			       const u8 *temp);

int hinic_rss_set_hash_engine(struct hinic_dev *nic_dev, u8 template_id,
			      u8 type);

int hinic_rss_cfg(struct hinic_dev *nic_dev, u8 rss_en, u8 template_id);

int hinic_rss_template_alloc(struct hinic_dev *nic_dev, u8 *tmpl_idx);

int hinic_rss_template_free(struct hinic_dev *nic_dev, u8 tmpl_idx);

void hinic_set_ethtool_ops(struct net_device *netdev);

int hinic_get_rss_type(struct hinic_dev *nic_dev, u32 tmpl_idx,
		       struct hinic_rss_type *rss_type);

int hinic_rss_get_indir_tbl(struct hinic_dev *nic_dev, u32 tmpl_idx,
			    u32 *indir_table);

int hinic_rss_get_template_tbl(struct hinic_dev *nic_dev, u32 tmpl_idx,
			       u8 *temp);

int hinic_rss_get_hash_engine(struct hinic_dev *nic_dev, u8 tmpl_idx,
			      u8 *type);

int hinic_get_phy_port_stats(struct hinic_dev *nic_dev,
			     struct hinic_phy_port_stats *stats);

int hinic_get_vport_stats(struct hinic_dev *nic_dev,
			  struct hinic_vport_stats *stats);

int hinic_set_rx_vlan_offload(struct hinic_dev *nic_dev, u8 en);

int hinic_set_vlan_fliter(struct hinic_dev *nic_dev, u32 en);

int hinic_get_mgmt_version(struct hinic_dev *nic_dev, u8 *mgmt_ver);

int hinic_set_link_settings(struct hinic_hwdev *hwdev,
			    struct hinic_link_ksettings_info *info);

int hinic_get_link_mode(struct hinic_hwdev *hwdev,
			struct hinic_link_mode_cmd *link_mode);

int hinic_set_autoneg(struct hinic_hwdev *hwdev, bool enable);

int hinic_set_speed(struct hinic_hwdev *hwdev, enum nic_speed_level speed);

int hinic_get_hw_pause_info(struct hinic_hwdev *hwdev,
			    struct hinic_pause_config *pause_info);

int hinic_set_hw_pause_info(struct hinic_hwdev *hwdev,
			    struct hinic_pause_config *pause_info);

int hinic_dcb_set_pfc(struct hinic_hwdev *hwdev, u8 pfc_en, u8 pfc_bitmap);

int hinic_set_loopback_mode(struct hinic_hwdev *hwdev, u32 mode, u32 enable);

enum hinic_led_mode {};

enum hinic_led_type {};

int hinic_reset_led_status(struct hinic_hwdev *hwdev, u8 port);

int hinic_set_led_status(struct hinic_hwdev *hwdev, u8 port,
			 enum hinic_led_type type, enum hinic_led_mode mode);

int hinic_get_sfp_type(struct hinic_hwdev *hwdev, u8 *data0, u8 *data1);

int hinic_get_sfp_eeprom(struct hinic_hwdev *hwdev, u8 *data, u16 *len);

int hinic_open(struct net_device *netdev);

int hinic_close(struct net_device *netdev);

#endif