1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Huawei HiNIC PCI Express Linux driver
4 * Copyright(c) 2017 Huawei Technologies Co., Ltd
10 #include <linux/types.h>
11 #include <linux/etherdevice.h>
12 #include <linux/bitops.h>
14 #include "hinic_dev.h"
17 HINIC_RX_MODE_UC = BIT(0),
18 HINIC_RX_MODE_MC = BIT(1),
19 HINIC_RX_MODE_BC = BIT(2),
20 HINIC_RX_MODE_MC_ALL = BIT(3),
21 HINIC_RX_MODE_PROMISC = BIT(4),
24 enum hinic_port_link_state {
25 HINIC_LINK_STATE_DOWN,
29 enum hinic_port_state {
30 HINIC_PORT_DISABLE = 0,
31 HINIC_PORT_ENABLE = 3,
34 enum hinic_func_port_state {
35 HINIC_FUNC_PORT_DISABLE = 0,
36 HINIC_FUNC_PORT_ENABLE = 2,
39 enum hinic_autoneg_cap {
40 HINIC_AUTONEG_UNSUPPORTED,
41 HINIC_AUTONEG_SUPPORTED,
44 enum hinic_autoneg_state {
45 HINIC_AUTONEG_DISABLED,
55 HINIC_SPEED_10MB_LINK = 0,
56 HINIC_SPEED_100MB_LINK,
57 HINIC_SPEED_1000MB_LINK,
58 HINIC_SPEED_10GB_LINK,
59 HINIC_SPEED_25GB_LINK,
60 HINIC_SPEED_40GB_LINK,
61 HINIC_SPEED_100GB_LINK,
63 HINIC_SPEED_UNKNOWN = 0xFF,
66 enum hinic_tso_state {
67 HINIC_TSO_DISABLE = 0,
71 struct hinic_port_mac_cmd {
79 unsigned char mac[ETH_ALEN];
82 struct hinic_port_mtu_cmd {
92 struct hinic_port_vlan_cmd {
101 struct hinic_port_rx_mode_cmd {
111 struct hinic_port_link_cmd {
121 struct hinic_port_state_cmd {
130 struct hinic_port_link_status {
140 struct hinic_port_func_state_cmd {
151 struct hinic_port_cap {
166 struct hinic_tso_config {
177 struct hinic_checksum_offload {
187 struct hinic_rq_num {
198 struct hinic_lro_config {
211 struct hinic_lro_timer {
216 u8 type; /* 0: set timer value, 1: get timer value */
217 u8 enable; /* when set lro time, enable should be 1 */
222 int hinic_port_add_mac(struct hinic_dev *nic_dev, const u8 *addr,
225 int hinic_port_del_mac(struct hinic_dev *nic_dev, const u8 *addr,
228 int hinic_port_get_mac(struct hinic_dev *nic_dev, u8 *addr);
230 int hinic_port_set_mtu(struct hinic_dev *nic_dev, int new_mtu);
232 int hinic_port_add_vlan(struct hinic_dev *nic_dev, u16 vlan_id);
234 int hinic_port_del_vlan(struct hinic_dev *nic_dev, u16 vlan_id);
236 int hinic_port_set_rx_mode(struct hinic_dev *nic_dev, u32 rx_mode);
238 int hinic_port_link_state(struct hinic_dev *nic_dev,
239 enum hinic_port_link_state *link_state);
241 int hinic_port_set_state(struct hinic_dev *nic_dev,
242 enum hinic_port_state state);
244 int hinic_port_set_func_state(struct hinic_dev *nic_dev,
245 enum hinic_func_port_state state);
247 int hinic_port_get_cap(struct hinic_dev *nic_dev,
248 struct hinic_port_cap *port_cap);
250 int hinic_set_max_qnum(struct hinic_dev *nic_dev, u8 num_rqs);
252 int hinic_port_set_tso(struct hinic_dev *nic_dev, enum hinic_tso_state state);
254 int hinic_set_rx_csum_offload(struct hinic_dev *nic_dev, u32 en);
256 int hinic_set_rx_lro_state(struct hinic_dev *nic_dev, u8 lro_en,
257 u32 lro_timer, u32 wqe_num);