blob: 15130805d792dd7918bf8e04dca33fa84cd238d7 [file] [log] [blame]
Yuval Mintz25c089d2015-10-26 11:02:26 +02001/* QLogic qed 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 _QED_ETH_IF_H
10#define _QED_ETH_IF_H
11
12#include <linux/list.h>
13#include <linux/if_link.h>
14#include <linux/qed/eth_common.h>
15#include <linux/qed/qed_if.h>
Yuval Mintz0b55e272016-05-11 16:36:15 +030016#include <linux/qed/qed_iov_if.h>
Yuval Mintz25c089d2015-10-26 11:02:26 +020017
18struct qed_dev_eth_info {
19 struct qed_dev_info common;
20
21 u8 num_queues;
22 u8 num_tc;
23
24 u8 port_mac[ETH_ALEN];
25 u8 num_vlan_filters;
Yuval Mintz7b7e70f2016-10-14 05:19:20 -040026 u16 num_mac_filters;
Yuval Mintzd8c2c7e2016-08-22 13:25:11 +030027
28 /* Legacy VF - this affects the datapath, so qede has to know */
29 bool is_legacy;
Yuval Mintz25c089d2015-10-26 11:02:26 +020030};
31
Manish Chopracee4d262015-10-26 11:02:28 +020032struct qed_update_vport_rss_params {
33 u16 rss_ind_table[128];
34 u32 rss_key[10];
Sudarsana Reddy Kalluru8c5ebd02016-04-10 12:43:00 +030035 u8 rss_caps;
Manish Chopracee4d262015-10-26 11:02:28 +020036};
37
38struct qed_update_vport_params {
39 u8 vport_id;
40 u8 update_vport_active_flg;
41 u8 vport_active_flg;
Yuval Mintz831bfb0e2016-05-11 16:36:25 +030042 u8 update_tx_switching_flg;
43 u8 tx_switching_flg;
Yuval Mintz3f9b4a62016-02-18 17:00:39 +020044 u8 update_accept_any_vlan_flg;
45 u8 accept_any_vlan;
Manish Chopracee4d262015-10-26 11:02:28 +020046 u8 update_rss_flg;
47 struct qed_update_vport_rss_params rss_params;
48};
49
Manish Chopra088c8612016-03-04 12:35:05 -050050struct qed_start_vport_params {
51 bool remove_inner_vlan;
52 bool gro_enable;
53 bool drop_ttl0;
54 u8 vport_id;
55 u16 mtu;
Yuval Mintza0d26d52016-06-19 15:18:13 +030056 bool clear_stats;
Manish Chopra088c8612016-03-04 12:35:05 -050057};
58
Manish Chopracee4d262015-10-26 11:02:28 +020059struct qed_stop_rxq_params {
60 u8 rss_id;
61 u8 rx_queue_id;
62 u8 vport_id;
63 bool eq_completion_only;
64};
65
66struct qed_stop_txq_params {
67 u8 rss_id;
68 u8 tx_queue_id;
69};
70
71enum qed_filter_rx_mode_type {
72 QED_FILTER_RX_MODE_TYPE_REGULAR,
73 QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC,
74 QED_FILTER_RX_MODE_TYPE_PROMISC,
75};
76
77enum qed_filter_xcast_params_type {
78 QED_FILTER_XCAST_TYPE_ADD,
79 QED_FILTER_XCAST_TYPE_DEL,
80 QED_FILTER_XCAST_TYPE_REPLACE,
81};
82
83struct qed_filter_ucast_params {
84 enum qed_filter_xcast_params_type type;
85 u8 vlan_valid;
86 u16 vlan;
87 u8 mac_valid;
88 unsigned char mac[ETH_ALEN];
89};
90
91struct qed_filter_mcast_params {
92 enum qed_filter_xcast_params_type type;
93 u8 num;
94 unsigned char mac[64][ETH_ALEN];
95};
96
97union qed_filter_type_params {
98 enum qed_filter_rx_mode_type accept_flags;
99 struct qed_filter_ucast_params ucast;
100 struct qed_filter_mcast_params mcast;
101};
102
103enum qed_filter_type {
104 QED_FILTER_TYPE_UCAST,
105 QED_FILTER_TYPE_MCAST,
106 QED_FILTER_TYPE_RX_MODE,
107 QED_MAX_FILTER_TYPES,
108};
109
110struct qed_filter_params {
111 enum qed_filter_type type;
112 union qed_filter_type_params filter;
113};
114
115struct qed_queue_start_common_params {
116 u8 rss_id;
117 u8 queue_id;
118 u8 vport_id;
119 u16 sb;
120 u16 sb_idx;
Yuval Mintz351a4ded2016-06-02 10:23:29 +0300121 u16 vf_qid;
Manish Chopracee4d262015-10-26 11:02:28 +0200122};
123
Manish Chopra464f6642016-04-14 01:38:29 -0400124struct qed_tunn_params {
125 u16 vxlan_port;
126 u8 update_vxlan_port;
127 u16 geneve_port;
128 u8 update_geneve_port;
129};
130
Manish Chopracee4d262015-10-26 11:02:28 +0200131struct qed_eth_cb_ops {
132 struct qed_common_cb_ops common;
Yuval Mintzc3aaa402016-10-14 05:19:17 -0400133 void (*force_mac) (void *dev, u8 *mac, bool forced);
Manish Chopracee4d262015-10-26 11:02:28 +0200134};
135
Sudarsana Reddy Kallurua1d8d8a2016-06-08 06:22:11 -0400136#ifdef CONFIG_DCB
137/* Prototype declaration of qed_eth_dcbnl_ops should match with the declaration
138 * of dcbnl_rtnl_ops structure.
139 */
140struct qed_eth_dcbnl_ops {
141 /* IEEE 802.1Qaz std */
142 int (*ieee_getpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc);
143 int (*ieee_setpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc);
144 int (*ieee_getets)(struct qed_dev *cdev, struct ieee_ets *ets);
145 int (*ieee_setets)(struct qed_dev *cdev, struct ieee_ets *ets);
146 int (*ieee_peer_getets)(struct qed_dev *cdev, struct ieee_ets *ets);
147 int (*ieee_peer_getpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc);
148 int (*ieee_getapp)(struct qed_dev *cdev, struct dcb_app *app);
149 int (*ieee_setapp)(struct qed_dev *cdev, struct dcb_app *app);
150
151 /* CEE std */
152 u8 (*getstate)(struct qed_dev *cdev);
153 u8 (*setstate)(struct qed_dev *cdev, u8 state);
154 void (*getpgtccfgtx)(struct qed_dev *cdev, int prio, u8 *prio_type,
155 u8 *pgid, u8 *bw_pct, u8 *up_map);
156 void (*getpgbwgcfgtx)(struct qed_dev *cdev, int pgid, u8 *bw_pct);
157 void (*getpgtccfgrx)(struct qed_dev *cdev, int prio, u8 *prio_type,
158 u8 *pgid, u8 *bw_pct, u8 *up_map);
159 void (*getpgbwgcfgrx)(struct qed_dev *cdev, int pgid, u8 *bw_pct);
160 void (*getpfccfg)(struct qed_dev *cdev, int prio, u8 *setting);
161 void (*setpfccfg)(struct qed_dev *cdev, int prio, u8 setting);
162 u8 (*getcap)(struct qed_dev *cdev, int capid, u8 *cap);
163 int (*getnumtcs)(struct qed_dev *cdev, int tcid, u8 *num);
164 u8 (*getpfcstate)(struct qed_dev *cdev);
165 int (*getapp)(struct qed_dev *cdev, u8 idtype, u16 id);
166 u8 (*getfeatcfg)(struct qed_dev *cdev, int featid, u8 *flags);
167
168 /* DCBX configuration */
169 u8 (*getdcbx)(struct qed_dev *cdev);
170 void (*setpgtccfgtx)(struct qed_dev *cdev, int prio,
171 u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map);
172 void (*setpgtccfgrx)(struct qed_dev *cdev, int prio,
173 u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map);
174 void (*setpgbwgcfgtx)(struct qed_dev *cdev, int pgid, u8 bw_pct);
175 void (*setpgbwgcfgrx)(struct qed_dev *cdev, int pgid, u8 bw_pct);
176 u8 (*setall)(struct qed_dev *cdev);
177 int (*setnumtcs)(struct qed_dev *cdev, int tcid, u8 num);
178 void (*setpfcstate)(struct qed_dev *cdev, u8 state);
179 int (*setapp)(struct qed_dev *cdev, u8 idtype, u16 idval, u8 up);
180 u8 (*setdcbx)(struct qed_dev *cdev, u8 state);
181 u8 (*setfeatcfg)(struct qed_dev *cdev, int featid, u8 flags);
182
183 /* Peer apps */
184 int (*peer_getappinfo)(struct qed_dev *cdev,
185 struct dcb_peer_app_info *info,
186 u16 *app_count);
187 int (*peer_getapptable)(struct qed_dev *cdev, struct dcb_app *table);
188
189 /* CEE peer */
190 int (*cee_peer_getpfc)(struct qed_dev *cdev, struct cee_pfc *pfc);
191 int (*cee_peer_getpg)(struct qed_dev *cdev, struct cee_pg *pg);
192};
193#endif
194
Yuval Mintz25c089d2015-10-26 11:02:26 +0200195struct qed_eth_ops {
196 const struct qed_common_ops *common;
Yuval Mintz0b55e272016-05-11 16:36:15 +0300197#ifdef CONFIG_QED_SRIOV
198 const struct qed_iov_hv_ops *iov;
199#endif
Sudarsana Reddy Kallurua1d8d8a2016-06-08 06:22:11 -0400200#ifdef CONFIG_DCB
201 const struct qed_eth_dcbnl_ops *dcb;
202#endif
Yuval Mintz25c089d2015-10-26 11:02:26 +0200203
204 int (*fill_dev_info)(struct qed_dev *cdev,
205 struct qed_dev_eth_info *info);
206
Yuval Mintzcc875c22015-10-26 11:02:31 +0200207 void (*register_ops)(struct qed_dev *cdev,
208 struct qed_eth_cb_ops *ops,
209 void *cookie);
210
Yuval Mintzeff16962016-05-11 16:36:21 +0300211 bool(*check_mac) (struct qed_dev *cdev, u8 *mac);
212
Manish Chopracee4d262015-10-26 11:02:28 +0200213 int (*vport_start)(struct qed_dev *cdev,
Manish Chopra088c8612016-03-04 12:35:05 -0500214 struct qed_start_vport_params *params);
Manish Chopracee4d262015-10-26 11:02:28 +0200215
216 int (*vport_stop)(struct qed_dev *cdev,
217 u8 vport_id);
218
219 int (*vport_update)(struct qed_dev *cdev,
220 struct qed_update_vport_params *params);
221
222 int (*q_rx_start)(struct qed_dev *cdev,
223 struct qed_queue_start_common_params *params,
224 u16 bd_max_bytes,
225 dma_addr_t bd_chain_phys_addr,
226 dma_addr_t cqe_pbl_addr,
227 u16 cqe_pbl_size,
228 void __iomem **pp_prod);
229
230 int (*q_rx_stop)(struct qed_dev *cdev,
231 struct qed_stop_rxq_params *params);
232
233 int (*q_tx_start)(struct qed_dev *cdev,
234 struct qed_queue_start_common_params *params,
235 dma_addr_t pbl_addr,
236 u16 pbl_size,
237 void __iomem **pp_doorbell);
238
239 int (*q_tx_stop)(struct qed_dev *cdev,
240 struct qed_stop_txq_params *params);
241
242 int (*filter_config)(struct qed_dev *cdev,
243 struct qed_filter_params *params);
244
245 int (*fastpath_stop)(struct qed_dev *cdev);
246
247 int (*eth_cqe_completion)(struct qed_dev *cdev,
248 u8 rss_id,
249 struct eth_slow_path_rx_cqe *cqe);
Manish Chopra9df2ed02015-10-26 11:02:33 +0200250
251 void (*get_vport_stats)(struct qed_dev *cdev,
252 struct qed_eth_stats *stats);
Manish Chopra464f6642016-04-14 01:38:29 -0400253
254 int (*tunn_config)(struct qed_dev *cdev,
255 struct qed_tunn_params *params);
Yuval Mintz25c089d2015-10-26 11:02:26 +0200256};
257
Rahul Verma95114342016-04-10 12:42:59 +0300258const struct qed_eth_ops *qed_get_eth_ops(void);
Yuval Mintz25c089d2015-10-26 11:02:26 +0200259void qed_put_eth_ops(void);
260
261#endif