net: add rte prefix to ether structures
[dpdk.git] / drivers / net / qede / qede_if.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2016 - 2018 Cavium Inc.
3  * All rights reserved.
4  * www.cavium.com
5  */
6
7 #ifndef _QEDE_IF_H
8 #define _QEDE_IF_H
9
10 #include "qede_ethdev.h"
11
12 /* forward */
13 struct ecore_dev;
14 struct qed_sb_info;
15 struct qed_pf_params;
16 enum ecore_int_mode;
17
18 struct qed_dev_info {
19         uint8_t num_hwfns;
20         uint8_t hw_mac[ETHER_ADDR_LEN];
21         bool is_mf_default;
22
23         /* FW version */
24         uint16_t fw_major;
25         uint16_t fw_minor;
26         uint16_t fw_rev;
27         uint16_t fw_eng;
28
29         /* MFW version */
30         uint32_t mfw_rev;
31 #define QED_MFW_VERSION_0_MASK          0x000000FF
32 #define QED_MFW_VERSION_0_OFFSET        0
33 #define QED_MFW_VERSION_1_MASK          0x0000FF00
34 #define QED_MFW_VERSION_1_OFFSET        8
35 #define QED_MFW_VERSION_2_MASK          0x00FF0000
36 #define QED_MFW_VERSION_2_OFFSET        16
37 #define QED_MFW_VERSION_3_MASK          0xFF000000
38 #define QED_MFW_VERSION_3_OFFSET        24
39
40         uint32_t flash_size;
41         bool b_arfs_capable;
42         bool b_inter_pf_switch;
43         bool tx_switching;
44         u16 mtu;
45
46         bool smart_an;
47
48         /* Out param for qede */
49         bool vxlan_enable;
50         bool gre_enable;
51         bool geneve_enable;
52
53         enum ecore_dev_type dev_type;
54 };
55
56 struct qed_dev_eth_info {
57         struct qed_dev_info common;
58
59         uint8_t num_queues;
60         uint8_t num_tc;
61
62         struct rte_ether_addr port_mac;
63         uint16_t num_vlan_filters;
64         uint32_t num_mac_filters;
65
66         /* Legacy VF - this affects the datapath */
67         bool is_legacy;
68 };
69
70 #define INIT_STRUCT_FIELD(field, value) .field = value
71
72 struct qed_eth_ops {
73         const struct qed_common_ops *common;
74         int (*fill_dev_info)(struct ecore_dev *edev,
75                              struct qed_dev_eth_info *info);
76 };
77
78 struct qed_link_params {
79         bool link_up;
80
81 #define QED_LINK_OVERRIDE_SPEED_AUTONEG         (1 << 0)
82 #define QED_LINK_OVERRIDE_SPEED_ADV_SPEEDS      (1 << 1)
83 #define QED_LINK_OVERRIDE_SPEED_FORCED_SPEED    (1 << 2)
84 #define QED_LINK_OVERRIDE_PAUSE_CONFIG          (1 << 3)
85 #define QED_LINK_OVERRIDE_EEE_CONFIG            (1 << 5)
86         uint32_t override_flags;
87         bool autoneg;
88         uint32_t adv_speeds;
89         uint32_t forced_speed;
90 #define QED_LINK_PAUSE_AUTONEG_ENABLE           (1 << 0)
91 #define QED_LINK_PAUSE_RX_ENABLE                (1 << 1)
92 #define QED_LINK_PAUSE_TX_ENABLE                (1 << 2)
93         uint32_t pause_config;
94         struct ecore_link_eee_params eee;
95 };
96
97 struct qed_link_output {
98         bool link_up;
99         uint32_t supported_caps;        /* In SUPPORTED defs */
100         uint32_t advertised_caps;       /* In ADVERTISED defs */
101         uint32_t lp_caps;       /* In ADVERTISED defs */
102         uint32_t speed;         /* In Mb/s */
103         uint32_t adv_speed;     /* Speed mask */
104         uint8_t duplex;         /* In DUPLEX defs */
105         uint16_t port;          /* In PORT defs */
106         bool autoneg;
107         uint32_t pause_config;
108
109         /* EEE - capability & param */
110         bool eee_supported;
111         bool eee_active;
112         u8 sup_caps;
113         struct ecore_link_eee_params eee;
114 };
115
116 struct qed_slowpath_params {
117         uint32_t int_mode;
118         uint8_t drv_major;
119         uint8_t drv_minor;
120         uint8_t drv_rev;
121         uint8_t drv_eng;
122         uint8_t name[NAME_SIZE];
123 };
124
125 struct qed_common_cb_ops {
126         void (*link_update)(void *dev, struct qed_link_output *link);
127 };
128
129 struct qed_common_ops {
130         int (*probe)(struct ecore_dev *edev,
131                      struct rte_pci_device *pci_dev,
132                      uint32_t dp_module, uint8_t dp_level, bool is_vf);
133         void (*set_name)(struct ecore_dev *edev, char name[]);
134         enum _ecore_status_t
135                 (*chain_alloc)(struct ecore_dev *edev,
136                                enum ecore_chain_use_mode
137                                intended_use,
138                                enum ecore_chain_mode mode,
139                                enum ecore_chain_cnt_type cnt_type,
140                                uint32_t num_elems,
141                                osal_size_t elem_size,
142                                struct ecore_chain *p_chain,
143                                struct ecore_chain_ext_pbl *ext_pbl);
144
145         void (*chain_free)(struct ecore_dev *edev,
146                            struct ecore_chain *p_chain);
147
148         void (*get_link)(struct ecore_dev *edev,
149                          struct qed_link_output *if_link);
150         int (*set_link)(struct ecore_dev *edev,
151                         struct qed_link_params *params);
152
153         int (*drain)(struct ecore_dev *edev);
154
155         void (*remove)(struct ecore_dev *edev);
156
157         int (*slowpath_stop)(struct ecore_dev *edev);
158
159         void (*update_pf_params)(struct ecore_dev *edev,
160                                  struct ecore_pf_params *params);
161
162         int (*slowpath_start)(struct ecore_dev *edev,
163                               struct qed_slowpath_params *params);
164
165         int (*set_fp_int)(struct ecore_dev *edev, uint16_t cnt);
166
167         uint32_t (*sb_init)(struct ecore_dev *edev,
168                             struct ecore_sb_info *sb_info,
169                             void *sb_virt_addr,
170                             dma_addr_t sb_phy_addr,
171                             uint16_t sb_id);
172
173         int (*get_sb_info)(struct ecore_dev *edev,
174                            struct ecore_sb_info *sb, u16 qid,
175                            struct ecore_sb_info_dbg *sb_dbg);
176
177         bool (*can_link_change)(struct ecore_dev *edev);
178
179         void (*update_msglvl)(struct ecore_dev *edev,
180                               uint32_t dp_module, uint8_t dp_level);
181
182         int (*send_drv_state)(struct ecore_dev *edev, bool active);
183 };
184
185 /* Externs */
186
187 const struct qed_eth_ops *qed_get_eth_ops(void);
188
189 #endif /* _QEDE_IF_H */