net/qede/base: set driver type before sending load request
[dpdk.git] / drivers / net / qede / qede_if.h
1 /*
2  * Copyright (c) 2016 QLogic Corporation.
3  * All rights reserved.
4  * www.qlogic.com
5  *
6  * See LICENSE.qede_pmd for copyright and licensing details.
7  */
8
9 #ifndef _QEDE_IF_H
10 #define _QEDE_IF_H
11
12 #include "qede_ethdev.h"
13
14 /* forward */
15 struct ecore_dev;
16 struct qed_sb_info;
17 struct qed_pf_params;
18 enum ecore_int_mode;
19
20 struct qed_dev_info {
21         uint8_t num_hwfns;
22         uint8_t hw_mac[ETHER_ADDR_LEN];
23         bool is_mf_default;
24
25         /* FW version */
26         uint16_t fw_major;
27         uint16_t fw_minor;
28         uint16_t fw_rev;
29         uint16_t fw_eng;
30
31         /* MFW version */
32         uint32_t mfw_rev;
33 #define QED_MFW_VERSION_0_MASK          0x000000FF
34 #define QED_MFW_VERSION_0_OFFSET        0
35 #define QED_MFW_VERSION_1_MASK          0x0000FF00
36 #define QED_MFW_VERSION_1_OFFSET        8
37 #define QED_MFW_VERSION_2_MASK          0x00FF0000
38 #define QED_MFW_VERSION_2_OFFSET        16
39 #define QED_MFW_VERSION_3_MASK          0xFF000000
40 #define QED_MFW_VERSION_3_OFFSET        24
41
42         uint32_t flash_size;
43         uint8_t mf_mode;
44         bool tx_switching;
45         u16 mtu;
46 };
47
48 enum qed_sb_type {
49         QED_SB_TYPE_L2_QUEUE,
50         QED_SB_TYPE_STORAGE,
51         QED_SB_TYPE_CNQ,
52 };
53
54 enum qed_protocol {
55         QED_PROTOCOL_ETH,
56 };
57
58 struct qed_link_params {
59         bool link_up;
60
61 #define QED_LINK_OVERRIDE_SPEED_AUTONEG         (1 << 0)
62 #define QED_LINK_OVERRIDE_SPEED_ADV_SPEEDS      (1 << 1)
63 #define QED_LINK_OVERRIDE_SPEED_FORCED_SPEED    (1 << 2)
64 #define QED_LINK_OVERRIDE_PAUSE_CONFIG          (1 << 3)
65         uint32_t override_flags;
66         bool autoneg;
67         uint32_t adv_speeds;
68         uint32_t forced_speed;
69 #define QED_LINK_PAUSE_AUTONEG_ENABLE           (1 << 0)
70 #define QED_LINK_PAUSE_RX_ENABLE                (1 << 1)
71 #define QED_LINK_PAUSE_TX_ENABLE                (1 << 2)
72         uint32_t pause_config;
73 };
74
75 struct qed_link_output {
76         bool link_up;
77         uint32_t supported_caps;        /* In SUPPORTED defs */
78         uint32_t advertised_caps;       /* In ADVERTISED defs */
79         uint32_t lp_caps;       /* In ADVERTISED defs */
80         uint32_t speed;         /* In Mb/s */
81         uint32_t adv_speed;     /* Speed mask */
82         uint8_t duplex;         /* In DUPLEX defs */
83         uint8_t port;           /* In PORT defs */
84         bool autoneg;
85         uint32_t pause_config;
86 };
87
88 struct qed_slowpath_params {
89         uint32_t int_mode;
90         uint8_t drv_major;
91         uint8_t drv_minor;
92         uint8_t drv_rev;
93         uint8_t drv_eng;
94         uint8_t name[NAME_SIZE];
95 };
96
97 #define ILT_PAGE_SIZE_TCFC 0x8000       /* 32KB */
98
99 struct qed_common_cb_ops {
100         void (*link_update)(void *dev, struct qed_link_output *link);
101 };
102
103 struct qed_selftest_ops {
104 /**
105  * @brief registers - Perform register tests
106  *
107  * @param edev
108  *
109  * @return 0 on success, error otherwise.
110  */
111         int (*registers)(struct ecore_dev *edev);
112 };
113
114 struct qed_common_ops {
115         int (*probe)(struct ecore_dev *edev,
116                      struct rte_pci_device *pci_dev,
117                      enum qed_protocol protocol,
118                      uint32_t dp_module, uint8_t dp_level, bool is_vf);
119         void (*set_name)(struct ecore_dev *edev, char name[]);
120         enum _ecore_status_t
121                 (*chain_alloc)(struct ecore_dev *edev,
122                                enum ecore_chain_use_mode
123                                intended_use,
124                                enum ecore_chain_mode mode,
125                                enum ecore_chain_cnt_type cnt_type,
126                                uint32_t num_elems,
127                                osal_size_t elem_size,
128                                struct ecore_chain *p_chain,
129                                struct ecore_chain_ext_pbl *ext_pbl);
130
131         void (*chain_free)(struct ecore_dev *edev,
132                            struct ecore_chain *p_chain);
133
134         void (*get_link)(struct ecore_dev *edev,
135                          struct qed_link_output *if_link);
136         int (*set_link)(struct ecore_dev *edev,
137                         struct qed_link_params *params);
138
139         int (*drain)(struct ecore_dev *edev);
140
141         void (*remove)(struct ecore_dev *edev);
142
143         int (*slowpath_stop)(struct ecore_dev *edev);
144
145         void (*update_pf_params)(struct ecore_dev *edev,
146                                  struct ecore_pf_params *params);
147
148         int (*slowpath_start)(struct ecore_dev *edev,
149                               struct qed_slowpath_params *params);
150
151         int (*set_fp_int)(struct ecore_dev *edev, uint16_t cnt);
152
153         uint32_t (*sb_init)(struct ecore_dev *edev,
154                             struct ecore_sb_info *sb_info,
155                             void *sb_virt_addr,
156                             dma_addr_t sb_phy_addr,
157                             uint16_t sb_id, enum qed_sb_type type);
158
159         bool (*can_link_change)(struct ecore_dev *edev);
160
161         void (*update_msglvl)(struct ecore_dev *edev,
162                               uint32_t dp_module, uint8_t dp_level);
163
164         int (*send_drv_state)(struct ecore_dev *edev, bool active);
165 };
166
167 #endif /* _QEDE_IF_H */