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