2 * Huawei HiNIC PCI Express Linux driver
3 * Copyright(c) 2017 Huawei Technologies Co., Ltd
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 #include <linux/types.h>
20 #include <linux/etherdevice.h>
21 #include <linux/bitops.h>
23 #include "hinic_dev.h"
26 HINIC_RX_MODE_UC = BIT(0),
27 HINIC_RX_MODE_MC = BIT(1),
28 HINIC_RX_MODE_BC = BIT(2),
29 HINIC_RX_MODE_MC_ALL = BIT(3),
30 HINIC_RX_MODE_PROMISC = BIT(4),
33 enum hinic_port_link_state {
34 HINIC_LINK_STATE_DOWN,
38 enum hinic_port_state {
39 HINIC_PORT_DISABLE = 0,
40 HINIC_PORT_ENABLE = 3,
43 enum hinic_func_port_state {
44 HINIC_FUNC_PORT_DISABLE = 0,
45 HINIC_FUNC_PORT_ENABLE = 2,
48 enum hinic_autoneg_cap {
49 HINIC_AUTONEG_UNSUPPORTED,
50 HINIC_AUTONEG_SUPPORTED,
53 enum hinic_autoneg_state {
54 HINIC_AUTONEG_DISABLED,
64 HINIC_SPEED_10MB_LINK = 0,
65 HINIC_SPEED_100MB_LINK,
66 HINIC_SPEED_1000MB_LINK,
67 HINIC_SPEED_10GB_LINK,
68 HINIC_SPEED_25GB_LINK,
69 HINIC_SPEED_40GB_LINK,
70 HINIC_SPEED_100GB_LINK,
72 HINIC_SPEED_UNKNOWN = 0xFF,
75 enum hinic_tso_state {
76 HINIC_TSO_DISABLE = 0,
80 struct hinic_port_mac_cmd {
88 unsigned char mac[ETH_ALEN];
91 struct hinic_port_mtu_cmd {
101 struct hinic_port_vlan_cmd {
110 struct hinic_port_rx_mode_cmd {
120 struct hinic_port_link_cmd {
130 struct hinic_port_state_cmd {
139 struct hinic_port_link_status {
149 struct hinic_port_func_state_cmd {
160 struct hinic_port_cap {
175 struct hinic_tso_config {
186 int hinic_port_add_mac(struct hinic_dev *nic_dev, const u8 *addr,
189 int hinic_port_del_mac(struct hinic_dev *nic_dev, const u8 *addr,
192 int hinic_port_get_mac(struct hinic_dev *nic_dev, u8 *addr);
194 int hinic_port_set_mtu(struct hinic_dev *nic_dev, int new_mtu);
196 int hinic_port_add_vlan(struct hinic_dev *nic_dev, u16 vlan_id);
198 int hinic_port_del_vlan(struct hinic_dev *nic_dev, u16 vlan_id);
200 int hinic_port_set_rx_mode(struct hinic_dev *nic_dev, u32 rx_mode);
202 int hinic_port_link_state(struct hinic_dev *nic_dev,
203 enum hinic_port_link_state *link_state);
205 int hinic_port_set_state(struct hinic_dev *nic_dev,
206 enum hinic_port_state state);
208 int hinic_port_set_func_state(struct hinic_dev *nic_dev,
209 enum hinic_func_port_state state);
211 int hinic_port_get_cap(struct hinic_dev *nic_dev,
212 struct hinic_port_cap *port_cap);
214 int hinic_port_set_tso(struct hinic_dev *nic_dev, enum hinic_tso_state state);