1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Huawei HiNIC PCI Express Linux driver 4 * Copyright(c) 2017 Huawei Technologies Co., Ltd 5 */ 6 7 #ifndef HINIC_DEV_H 8 #define HINIC_DEV_H 9 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> 15 16 #include "hinic_hw_dev.h" 17 #include "hinic_tx.h" 18 #include "hinic_rx.h" 19 #include "hinic_sriov.h" 20 21 #define HINIC_DRV_NAME "hinic" 22 23 enum hinic_flags { 24 HINIC_LINK_UP = BIT(0), 25 HINIC_INTF_UP = BIT(1), 26 HINIC_RSS_ENABLE = BIT(2), 27 HINIC_LINK_DOWN = BIT(3), 28 }; 29 30 struct hinic_rx_mode_work { 31 struct work_struct work; 32 u32 rx_mode; 33 }; 34 35 struct hinic_rss_type { 36 u8 tcp_ipv6_ext; 37 u8 ipv6_ext; 38 u8 tcp_ipv6; 39 u8 ipv6; 40 u8 tcp_ipv4; 41 u8 ipv4; 42 u8 udp_ipv6; 43 u8 udp_ipv4; 44 }; 45 46 enum hinic_rss_hash_type { 47 HINIC_RSS_HASH_ENGINE_TYPE_XOR, 48 HINIC_RSS_HASH_ENGINE_TYPE_TOEP, 49 HINIC_RSS_HASH_ENGINE_TYPE_MAX, 50 }; 51 52 struct hinic_dev { 53 struct net_device *netdev; 54 struct hinic_hwdev *hwdev; 55 56 u32 msg_enable; 57 unsigned int tx_weight; 58 unsigned int rx_weight; 59 u16 num_qps; 60 u16 max_qps; 61 62 unsigned int flags; 63 64 struct semaphore mgmt_lock; 65 unsigned long *vlan_bitmap; 66 67 struct hinic_rx_mode_work rx_mode_work; 68 struct workqueue_struct *workq; 69 70 struct hinic_txq *txqs; 71 struct hinic_rxq *rxqs; 72 u16 sq_depth; 73 u16 rq_depth; 74 75 struct hinic_txq_stats tx_stats; 76 struct hinic_rxq_stats rx_stats; 77 78 u8 rss_tmpl_idx; 79 u8 rss_hash_engine; 80 u16 num_rss; 81 u16 rss_limit; 82 struct hinic_rss_type rss_type; 83 u8 *rss_hkey_user; 84 s32 *rss_indir_user; 85 struct hinic_sriov_info sriov_info; 86 }; 87 88 #endif 89