net/qede/base: changes for VF queue zone
[dpdk.git] / drivers / net / qede / base / ecore_vf.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 __ECORE_VF_H__
10 #define __ECORE_VF_H__
11
12 #include "ecore_status.h"
13 #include "ecore_vf_api.h"
14 #include "ecore_l2_api.h"
15 #include "ecore_vfpf_if.h"
16
17 /* Default number of CIDs [total of both Rx and Tx] to be requested
18  * by default.
19  */
20 #define ECORE_ETH_VF_DEFAULT_NUM_CIDS   (32)
21
22 /* This data is held in the ecore_hwfn structure for VFs only. */
23 struct ecore_vf_iov {
24         union vfpf_tlvs                 *vf2pf_request;
25         dma_addr_t                      vf2pf_request_phys;
26         union pfvf_tlvs                 *pf2vf_reply;
27         dma_addr_t                      pf2vf_reply_phys;
28
29         /* Should be taken whenever the mailbox buffers are accessed */
30         osal_mutex_t                    mutex;
31         u8                              *offset;
32
33         /* Bulletin Board */
34         struct ecore_bulletin           bulletin;
35         struct ecore_bulletin_content   bulletin_shadow;
36
37         /* we set aside a copy of the acquire response */
38         struct pfvf_acquire_resp_tlv    acquire_resp;
39
40         /* In case PF originates prior to the fp-hsi version comparison,
41          * this has to be propagated as it affects the fastpath.
42          */
43         bool b_pre_fp_hsi;
44 };
45
46
47 enum _ecore_status_t ecore_set_rxq_coalesce(struct ecore_hwfn *p_hwfn,
48                                             struct ecore_ptt *p_ptt,
49                                             u16 coalesce,
50                                             struct ecore_queue_cid *p_cid);
51 enum _ecore_status_t ecore_set_txq_coalesce(struct ecore_hwfn *p_hwfn,
52                                             struct ecore_ptt *p_ptt,
53                                             u16 coalesce,
54                                             struct ecore_queue_cid *p_cid);
55 /**
56  * @brief VF - Set Rx/Tx coalesce per VF's relative queue.
57  *      Coalesce value '0' will omit the configuration.
58  *
59  *      @param p_hwfn
60  *      @param rx_coal - coalesce value in micro second for rx queue
61  *      @param tx_coal - coalesce value in micro second for tx queue
62  *      @param queue_cid
63  *
64  **/
65 enum _ecore_status_t ecore_vf_pf_set_coalesce(struct ecore_hwfn *p_hwfn,
66                                               u16 rx_coal, u16 tx_coal,
67                                               struct ecore_queue_cid *p_cid);
68
69 #ifdef CONFIG_ECORE_SRIOV
70 /**
71  * @brief hw preparation for VF
72  *      sends ACQUIRE message
73  *
74  * @param p_hwfn
75  *
76  * @return enum _ecore_status_t
77  */
78 enum _ecore_status_t ecore_vf_hw_prepare(struct ecore_hwfn *p_hwfn);
79
80 /**
81  * @brief VF - start the RX Queue by sending a message to the PF
82  *
83  * @param p_hwfn
84  * @param p_cid                 - Only relative fields are relevant
85  * @param bd_max_bytes          - maximum number of bytes per bd
86  * @param bd_chain_phys_addr    - physical address of bd chain
87  * @param cqe_pbl_addr          - physical address of pbl
88  * @param cqe_pbl_size          - pbl size
89  * @param pp_prod               - pointer to the producer to be
90  *                                used in fasthpath
91  *
92  * @return enum _ecore_status_t
93  */
94 enum _ecore_status_t ecore_vf_pf_rxq_start(struct ecore_hwfn *p_hwfn,
95                                            struct ecore_queue_cid *p_cid,
96                                            u16 bd_max_bytes,
97                                            dma_addr_t bd_chain_phys_addr,
98                                            dma_addr_t cqe_pbl_addr,
99                                            u16 cqe_pbl_size,
100                                            void OSAL_IOMEM **pp_prod);
101
102 /**
103  * @brief VF - start the TX queue by sending a message to the
104  *        PF.
105  *
106  * @param p_hwfn
107  * @param p_cid
108  * @param bd_chain_phys_addr    - physical address of tx chain
109  * @param pp_doorbell           - pointer to address to which to
110  *                              write the doorbell too..
111  *
112  * @return enum _ecore_status_t
113  */
114 enum _ecore_status_t
115 ecore_vf_pf_txq_start(struct ecore_hwfn *p_hwfn,
116                       struct ecore_queue_cid *p_cid,
117                       dma_addr_t pbl_addr, u16 pbl_size,
118                       void OSAL_IOMEM **pp_doorbell);
119
120 /**
121  * @brief VF - stop the RX queue by sending a message to the PF
122  *
123  * @param p_hwfn
124  * @param p_cid
125  * @param cqe_completion
126  *
127  * @return enum _ecore_status_t
128  */
129 enum _ecore_status_t ecore_vf_pf_rxq_stop(struct ecore_hwfn *p_hwfn,
130                                           struct ecore_queue_cid *p_cid,
131                                           bool cqe_completion);
132
133 /**
134  * @brief VF - stop the TX queue by sending a message to the PF
135  *
136  * @param p_hwfn
137  * @param p_cid
138  *
139  * @return enum _ecore_status_t
140  */
141 enum _ecore_status_t ecore_vf_pf_txq_stop(struct ecore_hwfn *p_hwfn,
142                                           struct ecore_queue_cid *p_cid);
143
144 /* TODO - fix all the !SRIOV prototypes */
145
146 #ifndef LINUX_REMOVE
147 /**
148  * @brief VF - update the RX queue by sending a message to the
149  *        PF
150  *
151  * @param p_hwfn
152  * @param pp_cid - list of queue-cids which we want to update
153  * @param num_rxqs
154  * @param comp_cqe_flg
155  * @param comp_event_flg
156  *
157  * @return enum _ecore_status_t
158  */
159 enum _ecore_status_t ecore_vf_pf_rxqs_update(struct ecore_hwfn *p_hwfn,
160                                              struct ecore_queue_cid **pp_cid,
161                                              u8 num_rxqs,
162                                              u8 comp_cqe_flg,
163                                              u8 comp_event_flg);
164 #endif
165
166 /**
167  * @brief VF - send a vport update command
168  *
169  * @param p_hwfn
170  * @param params
171  *
172  * @return enum _ecore_status_t
173  */
174 enum _ecore_status_t
175 ecore_vf_pf_vport_update(struct ecore_hwfn *p_hwfn,
176                          struct ecore_sp_vport_update_params *p_params);
177
178 /**
179  * @brief VF - send a close message to PF
180  *
181  * @param p_hwfn
182  *
183  * @return enum _ecore_status
184  */
185 enum _ecore_status_t ecore_vf_pf_reset(struct ecore_hwfn *p_hwfn);
186
187 /**
188  * @brief VF - free vf`s memories
189  *
190  * @param p_hwfn
191  *
192  * @return enum _ecore_status
193  */
194 enum _ecore_status_t ecore_vf_pf_release(struct ecore_hwfn *p_hwfn);
195
196 /**
197  * @brief ecore_vf_get_igu_sb_id - Get the IGU SB ID for a given
198  *        sb_id. For VFs igu sbs don't have to be contiguous
199  *
200  * @param p_hwfn
201  * @param sb_id
202  *
203  * @return INLINE u16
204  */
205 u16 ecore_vf_get_igu_sb_id(struct ecore_hwfn *p_hwfn,
206                            u16               sb_id);
207
208
209 /**
210  * @brief ecore_vf_pf_vport_start - perform vport start for VF.
211  *
212  * @param p_hwfn
213  * @param vport_id
214  * @param mtu
215  * @param inner_vlan_removal
216  * @param tpa_mode
217  * @param max_buffers_per_cqe,
218  * @param only_untagged - default behavior regarding vlan acceptance
219  *
220  * @return enum _ecore_status
221  */
222 enum _ecore_status_t ecore_vf_pf_vport_start(
223                         struct ecore_hwfn *p_hwfn,
224                         u8 vport_id,
225                         u16 mtu,
226                         u8 inner_vlan_removal,
227                         enum ecore_tpa_mode tpa_mode,
228                         u8 max_buffers_per_cqe,
229                         u8 only_untagged);
230
231 /**
232  * @brief ecore_vf_pf_vport_stop - stop the VF's vport
233  *
234  * @param p_hwfn
235  *
236  * @return enum _ecore_status
237  */
238 enum _ecore_status_t ecore_vf_pf_vport_stop(struct ecore_hwfn *p_hwfn);
239
240 enum _ecore_status_t ecore_vf_pf_filter_ucast(
241                         struct ecore_hwfn *p_hwfn,
242                         struct ecore_filter_ucast *p_param);
243
244 void ecore_vf_pf_filter_mcast(struct ecore_hwfn *p_hwfn,
245                               struct ecore_filter_mcast *p_filter_cmd);
246
247 /**
248  * @brief ecore_vf_pf_int_cleanup - clean the SB of the VF
249  *
250  * @param p_hwfn
251  *
252  * @return enum _ecore_status
253  */
254 enum _ecore_status_t ecore_vf_pf_int_cleanup(struct ecore_hwfn *p_hwfn);
255
256 /**
257  * @brief - return the link params in a given bulletin board
258  *
259  * @param p_hwfn
260  * @param p_params - pointer to a struct to fill with link params
261  * @param p_bulletin
262  */
263 void __ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn,
264                                 struct ecore_mcp_link_params *p_params,
265                                 struct ecore_bulletin_content *p_bulletin);
266
267 /**
268  * @brief - return the link state in a given bulletin board
269  *
270  * @param p_hwfn
271  * @param p_link - pointer to a struct to fill with link state
272  * @param p_bulletin
273  */
274 void __ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn,
275                                struct ecore_mcp_link_state *p_link,
276                                struct ecore_bulletin_content *p_bulletin);
277
278 /**
279  * @brief - return the link capabilities in a given bulletin board
280  *
281  * @param p_hwfn
282  * @param p_link - pointer to a struct to fill with link capabilities
283  * @param p_bulletin
284  */
285 void __ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn,
286                               struct ecore_mcp_link_capabilities *p_link_caps,
287                               struct ecore_bulletin_content *p_bulletin);
288
289 enum _ecore_status_t
290 ecore_vf_pf_tunnel_param_update(struct ecore_hwfn *p_hwfn,
291                                 struct ecore_tunnel_info *p_tunn);
292
293 void ecore_vf_set_vf_start_tunn_update_param(struct ecore_tunnel_info *p_tun);
294 #endif
295 #endif /* __ECORE_VF_H__ */