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/netdevice.h>
11 #include <linux/types.h>
12 #include <linux/semaphore.h>
13 #include <linux/workqueue.h>
14 #include <linux/bitops.h>
16 #include "hinic_hw_dev.h"
19 #include "hinic_sriov.h"
21 #define HINIC_DRV_NAME "hinic"
26 HINIC_LINK_UP = BIT(0),
27 HINIC_INTF_UP = BIT(1),
28 HINIC_RSS_ENABLE = BIT(2),
29 HINIC_LINK_DOWN = BIT(3),
30 HINIC_LP_TEST = BIT(4),
33 struct hinic_rx_mode_work {
34 struct work_struct work;
38 struct hinic_rss_type {
49 enum hinic_rss_hash_type {
50 HINIC_RSS_HASH_ENGINE_TYPE_XOR,
51 HINIC_RSS_HASH_ENGINE_TYPE_TOEP,
52 HINIC_RSS_HASH_ENGINE_TYPE_MAX,
55 struct hinic_intr_coal_info {
57 u8 coalesce_timer_cfg;
67 struct hinic_debug_priv {
68 struct hinic_dev *dev;
70 enum hinic_dbg_type type;
76 struct net_device *netdev;
77 struct hinic_hwdev *hwdev;
80 unsigned int tx_weight;
81 unsigned int rx_weight;
87 struct semaphore mgmt_lock;
88 unsigned long *vlan_bitmap;
90 struct hinic_rx_mode_work rx_mode_work;
91 struct workqueue_struct *workq;
93 struct hinic_txq *txqs;
94 struct hinic_rxq *rxqs;
102 struct hinic_rss_type rss_type;
105 struct hinic_intr_coal_info *rx_intr_coalesce;
106 struct hinic_intr_coal_info *tx_intr_coalesce;
107 struct hinic_sriov_info sriov_info;
112 struct dentry *dbgfs_root;
113 struct dentry *sq_dbgfs;
114 struct dentry *rq_dbgfs;
115 struct dentry *func_tbl_dbgfs;
116 struct hinic_debug_priv *dbg;
117 struct devlink *devlink;
118 bool cable_unplugged;
119 bool module_unrecognized;
122 struct hinic_devlink_priv {
123 struct hinic_hwdev *hwdev;
124 struct devlink_health_reporter *hw_fault_reporter;
125 struct devlink_health_reporter *fw_fault_reporter;