qede: Add basic Network driver
[linux-2.6-microblaze.git] / drivers / net / ethernet / qlogic / qede / qede.h
1 /* QLogic qede NIC Driver
2 * Copyright (c) 2015 QLogic Corporation
3 *
4 * This software is available under the terms of the GNU General Public License
5 * (GPL) Version 2, available from the file COPYING in the main directory of
6 * this source tree.
7 */
8
9 #ifndef _QEDE_H_
10 #define _QEDE_H_
11 #include <linux/compiler.h>
12 #include <linux/version.h>
13 #include <linux/workqueue.h>
14 #include <linux/netdevice.h>
15 #include <linux/interrupt.h>
16 #include <linux/bitmap.h>
17 #include <linux/kernel.h>
18 #include <linux/mutex.h>
19 #include <linux/io.h>
20 #include <linux/qed/common_hsi.h>
21 #include <linux/qed/eth_common.h>
22 #include <linux/qed/qed_if.h>
23 #include <linux/qed/qed_chain.h>
24 #include <linux/qed/qed_eth_if.h>
25
26 #define QEDE_MAJOR_VERSION              8
27 #define QEDE_MINOR_VERSION              4
28 #define QEDE_REVISION_VERSION           0
29 #define QEDE_ENGINEERING_VERSION        0
30 #define DRV_MODULE_VERSION __stringify(QEDE_MAJOR_VERSION) "."  \
31                 __stringify(QEDE_MINOR_VERSION) "."             \
32                 __stringify(QEDE_REVISION_VERSION) "."          \
33                 __stringify(QEDE_ENGINEERING_VERSION)
34
35 #define QEDE_ETH_INTERFACE_VERSION      300
36
37 #define DRV_MODULE_SYM          qede
38
39 struct qede_dev {
40         struct qed_dev                  *cdev;
41         struct net_device               *ndev;
42         struct pci_dev                  *pdev;
43
44         u32                             dp_module;
45         u8                              dp_level;
46
47         const struct qed_eth_ops        *ops;
48
49         struct qed_dev_eth_info dev_info;
50 #define QEDE_MAX_RSS_CNT(edev)  ((edev)->dev_info.num_queues)
51 #define QEDE_MAX_TSS_CNT(edev)  ((edev)->dev_info.num_queues * \
52                                  (edev)->dev_info.num_tc)
53
54         u16                             num_rss;
55         u8                              num_tc;
56 #define QEDE_RSS_CNT(edev)              ((edev)->num_rss)
57 #define QEDE_TSS_CNT(edev)              ((edev)->num_rss *      \
58                                          (edev)->num_tc)
59 #define QEDE_TSS_IDX(edev, txqidx)      ((txqidx) % (edev)->num_rss)
60 #define QEDE_TC_IDX(edev, txqidx)       ((txqidx) / (edev)->num_rss)
61
62         struct qed_int_info             int_info;
63         unsigned char                   primary_mac[ETH_ALEN];
64
65         /* Smaller private varaiant of the RTNL lock */
66         struct mutex                    qede_lock;
67         u32                             state; /* Protected by qede_lock */
68 };
69
70 /* Debug print definitions */
71 #define DP_NAME(edev) ((edev)->ndev->name)
72
73 #endif /* _QEDE_H_ */