Commit | Line | Data |
---|---|---|
2025cf9e | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
51ba902a AK |
2 | /* |
3 | * Huawei HiNIC PCI Express Linux driver | |
4 | * Copyright(c) 2017 Huawei Technologies Co., Ltd | |
51ba902a AK |
5 | */ |
6 | ||
7 | #ifndef HINIC_DEV_H | |
8 | #define HINIC_DEV_H | |
9 | ||
10 | #include <linux/netdevice.h> | |
11 | #include <linux/types.h> | |
25a3ba61 | 12 | #include <linux/semaphore.h> |
c4d06d2d AK |
13 | #include <linux/workqueue.h> |
14 | #include <linux/bitops.h> | |
51ba902a AK |
15 | |
16 | #include "hinic_hw_dev.h" | |
c3e79baf AK |
17 | #include "hinic_tx.h" |
18 | #include "hinic_rx.h" | |
7dd29ee1 | 19 | #include "hinic_sriov.h" |
51ba902a AK |
20 | |
21 | #define HINIC_DRV_NAME "hinic" | |
22 | ||
4aa218a4 L |
23 | #define LP_PKT_CNT 64 |
24 | ||
c4d06d2d AK |
25 | enum hinic_flags { |
26 | HINIC_LINK_UP = BIT(0), | |
27 | HINIC_INTF_UP = BIT(1), | |
421e9526 | 28 | HINIC_RSS_ENABLE = BIT(2), |
7dd29ee1 | 29 | HINIC_LINK_DOWN = BIT(3), |
4aa218a4 | 30 | HINIC_LP_TEST = BIT(4), |
c4d06d2d AK |
31 | }; |
32 | ||
33 | struct hinic_rx_mode_work { | |
34 | struct work_struct work; | |
35 | u32 rx_mode; | |
36 | }; | |
37 | ||
421e9526 XC |
38 | struct hinic_rss_type { |
39 | u8 tcp_ipv6_ext; | |
40 | u8 ipv6_ext; | |
41 | u8 tcp_ipv6; | |
42 | u8 ipv6; | |
43 | u8 tcp_ipv4; | |
44 | u8 ipv4; | |
45 | u8 udp_ipv6; | |
46 | u8 udp_ipv4; | |
47 | }; | |
48 | ||
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, | |
53 | }; | |
54 | ||
a0337c0d L |
55 | struct hinic_intr_coal_info { |
56 | u8 pending_limt; | |
57 | u8 coalesce_timer_cfg; | |
58 | u8 resend_timer_cfg; | |
59 | }; | |
60 | ||
51ba902a AK |
61 | struct hinic_dev { |
62 | struct net_device *netdev; | |
63 | struct hinic_hwdev *hwdev; | |
64 | ||
65 | u32 msg_enable; | |
00e57a6d | 66 | unsigned int tx_weight; |
e2585ea7 | 67 | unsigned int rx_weight; |
421e9526 XC |
68 | u16 num_qps; |
69 | u16 max_qps; | |
25a3ba61 | 70 | |
c4d06d2d AK |
71 | unsigned int flags; |
72 | ||
25a3ba61 AK |
73 | struct semaphore mgmt_lock; |
74 | unsigned long *vlan_bitmap; | |
c4d06d2d AK |
75 | |
76 | struct hinic_rx_mode_work rx_mode_work; | |
77 | struct workqueue_struct *workq; | |
c3e79baf AK |
78 | |
79 | struct hinic_txq *txqs; | |
80 | struct hinic_rxq *rxqs; | |
bcab6782 L |
81 | u16 sq_depth; |
82 | u16 rq_depth; | |
edd384f6 AK |
83 | |
84 | struct hinic_txq_stats tx_stats; | |
85 | struct hinic_rxq_stats rx_stats; | |
421e9526 XC |
86 | |
87 | u8 rss_tmpl_idx; | |
88 | u8 rss_hash_engine; | |
89 | u16 num_rss; | |
90 | u16 rss_limit; | |
91 | struct hinic_rss_type rss_type; | |
4fdc51bb XC |
92 | u8 *rss_hkey_user; |
93 | s32 *rss_indir_user; | |
a0337c0d L |
94 | struct hinic_intr_coal_info *rx_intr_coalesce; |
95 | struct hinic_intr_coal_info *tx_intr_coalesce; | |
7dd29ee1 | 96 | struct hinic_sriov_info sriov_info; |
4aa218a4 L |
97 | int lb_test_rx_idx; |
98 | int lb_pkt_len; | |
99 | u8 *lb_test_rx_buf; | |
5e126e7c L |
100 | struct devlink *devlink; |
101 | }; | |
102 | ||
103 | struct hinic_devlink_priv { | |
104 | struct hinic_hwdev *hwdev; | |
51ba902a AK |
105 | }; |
106 | ||
107 | #endif |