GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / net / ethernet / huawei / hinic / hinic_dev.h
1 /*
2  * Huawei HiNIC PCI Express Linux driver
3  * Copyright(c) 2017 Huawei Technologies Co., Ltd
4  *
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.
8  *
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
12  * for more details.
13  *
14  */
15
16 #ifndef HINIC_DEV_H
17 #define HINIC_DEV_H
18
19 #include <linux/netdevice.h>
20 #include <linux/types.h>
21 #include <linux/semaphore.h>
22 #include <linux/workqueue.h>
23 #include <linux/bitops.h>
24
25 #include "hinic_hw_dev.h"
26 #include "hinic_tx.h"
27 #include "hinic_rx.h"
28
29 #define HINIC_DRV_NAME          "hinic"
30
31 enum hinic_flags {
32         HINIC_LINK_UP = BIT(0),
33         HINIC_INTF_UP = BIT(1),
34 };
35
36 struct hinic_rx_mode_work {
37         struct work_struct      work;
38         u32                     rx_mode;
39 };
40
41 struct hinic_dev {
42         struct net_device               *netdev;
43         struct hinic_hwdev              *hwdev;
44
45         u32                             msg_enable;
46         unsigned int                    tx_weight;
47         unsigned int                    rx_weight;
48
49         unsigned int                    flags;
50
51         struct semaphore                mgmt_lock;
52         unsigned long                   *vlan_bitmap;
53
54         struct hinic_rx_mode_work       rx_mode_work;
55         struct workqueue_struct         *workq;
56
57         struct hinic_txq                *txqs;
58         struct hinic_rxq                *rxqs;
59
60         struct hinic_txq_stats          tx_stats;
61         struct hinic_rxq_stats          rx_stats;
62 };
63
64 #endif