.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ |
---|
1 | 2 | /* QLogic qed NIC Driver |
---|
2 | 3 | * Copyright (c) 2015-2017 QLogic Corporation |
---|
3 | | - * |
---|
4 | | - * This software is available to you under a choice of one of two |
---|
5 | | - * licenses. You may choose to be licensed under the terms of the GNU |
---|
6 | | - * General Public License (GPL) Version 2, available from the file |
---|
7 | | - * COPYING in the main directory of this source tree, or the |
---|
8 | | - * OpenIB.org BSD license below: |
---|
9 | | - * |
---|
10 | | - * Redistribution and use in source and binary forms, with or |
---|
11 | | - * without modification, are permitted provided that the following |
---|
12 | | - * conditions are met: |
---|
13 | | - * |
---|
14 | | - * - Redistributions of source code must retain the above |
---|
15 | | - * copyright notice, this list of conditions and the following |
---|
16 | | - * disclaimer. |
---|
17 | | - * |
---|
18 | | - * - Redistributions in binary form must reproduce the above |
---|
19 | | - * copyright notice, this list of conditions and the following |
---|
20 | | - * disclaimer in the documentation and /or other materials |
---|
21 | | - * provided with the distribution. |
---|
22 | | - * |
---|
23 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
---|
24 | | - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
---|
25 | | - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
---|
26 | | - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
---|
27 | | - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
---|
28 | | - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
---|
29 | | - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
---|
30 | | - * SOFTWARE. |
---|
| 4 | + * Copyright (c) 2019-2020 Marvell International Ltd. |
---|
31 | 5 | */ |
---|
32 | 6 | |
---|
33 | 7 | #ifndef _QED_DEV_API_H |
---|
.. | .. |
---|
230 | 204 | QED_DMAE_ADDRESS_GRC |
---|
231 | 205 | }; |
---|
232 | 206 | |
---|
233 | | -/* value of flags If QED_DMAE_FLAG_RW_REPL_SRC flag is set and the |
---|
234 | | - * source is a block of length DMAE_MAX_RW_SIZE and the |
---|
235 | | - * destination is larger, the source block will be duplicated as |
---|
236 | | - * many times as required to fill the destination block. This is |
---|
237 | | - * used mostly to write a zeroed buffer to destination address |
---|
238 | | - * using DMA |
---|
239 | | - */ |
---|
240 | | -#define QED_DMAE_FLAG_RW_REPL_SRC 0x00000001 |
---|
241 | | -#define QED_DMAE_FLAG_VF_SRC 0x00000002 |
---|
242 | | -#define QED_DMAE_FLAG_VF_DST 0x00000004 |
---|
243 | | -#define QED_DMAE_FLAG_COMPLETION_DST 0x00000008 |
---|
244 | | - |
---|
245 | | -struct qed_dmae_params { |
---|
246 | | - u32 flags; /* consists of QED_DMAE_FLAG_* values */ |
---|
247 | | - u8 src_vfid; |
---|
248 | | - u8 dst_vfid; |
---|
249 | | -}; |
---|
250 | | - |
---|
251 | 207 | /** |
---|
252 | 208 | * @brief qed_dmae_host2grc - copy data from source addr to |
---|
253 | 209 | * dmae registers using the given ptt |
---|
.. | .. |
---|
257 | 213 | * @param source_addr |
---|
258 | 214 | * @param grc_addr (dmae_data_offset) |
---|
259 | 215 | * @param size_in_dwords |
---|
260 | | - * @param flags (one of the flags defined above) |
---|
| 216 | + * @param p_params (default parameters will be used in case of NULL) |
---|
261 | 217 | */ |
---|
262 | 218 | int |
---|
263 | 219 | qed_dmae_host2grc(struct qed_hwfn *p_hwfn, |
---|
.. | .. |
---|
265 | 221 | u64 source_addr, |
---|
266 | 222 | u32 grc_addr, |
---|
267 | 223 | u32 size_in_dwords, |
---|
268 | | - u32 flags); |
---|
| 224 | + struct qed_dmae_params *p_params); |
---|
269 | 225 | |
---|
270 | 226 | /** |
---|
271 | 227 | * @brief qed_dmae_grc2host - Read data from dmae data offset |
---|
.. | .. |
---|
275 | 231 | * @param grc_addr (dmae_data_offset) |
---|
276 | 232 | * @param dest_addr |
---|
277 | 233 | * @param size_in_dwords |
---|
278 | | - * @param flags - one of the flags defined above |
---|
| 234 | + * @param p_params (default parameters will be used in case of NULL) |
---|
279 | 235 | */ |
---|
280 | 236 | int qed_dmae_grc2host(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, |
---|
281 | 237 | u32 grc_addr, dma_addr_t dest_addr, u32 size_in_dwords, |
---|
282 | | - u32 flags); |
---|
| 238 | + struct qed_dmae_params *p_params); |
---|
283 | 239 | |
---|
284 | 240 | /** |
---|
285 | 241 | * @brief qed_dmae_host2host - copy data from to source address |
---|
.. | .. |
---|
290 | 246 | * @param source_addr |
---|
291 | 247 | * @param dest_addr |
---|
292 | 248 | * @param size_in_dwords |
---|
293 | | - * @param params |
---|
| 249 | + * @param p_params (default parameters will be used in case of NULL) |
---|
294 | 250 | */ |
---|
295 | 251 | int qed_dmae_host2host(struct qed_hwfn *p_hwfn, |
---|
296 | 252 | struct qed_ptt *p_ptt, |
---|
.. | .. |
---|
298 | 254 | dma_addr_t dest_addr, |
---|
299 | 255 | u32 size_in_dwords, struct qed_dmae_params *p_params); |
---|
300 | 256 | |
---|
301 | | -/** |
---|
302 | | - * @brief qed_chain_alloc - Allocate and initialize a chain |
---|
303 | | - * |
---|
304 | | - * @param p_hwfn |
---|
305 | | - * @param intended_use |
---|
306 | | - * @param mode |
---|
307 | | - * @param num_elems |
---|
308 | | - * @param elem_size |
---|
309 | | - * @param p_chain |
---|
310 | | - * @param ext_pbl - a possible external PBL |
---|
311 | | - * |
---|
312 | | - * @return int |
---|
313 | | - */ |
---|
314 | | -int |
---|
315 | | -qed_chain_alloc(struct qed_dev *cdev, |
---|
316 | | - enum qed_chain_use_mode intended_use, |
---|
317 | | - enum qed_chain_mode mode, |
---|
318 | | - enum qed_chain_cnt_type cnt_type, |
---|
319 | | - u32 num_elems, |
---|
320 | | - size_t elem_size, |
---|
321 | | - struct qed_chain *p_chain, struct qed_chain_ext_pbl *ext_pbl); |
---|
322 | | - |
---|
323 | | -/** |
---|
324 | | - * @brief qed_chain_free - Free chain DMA memory |
---|
325 | | - * |
---|
326 | | - * @param p_hwfn |
---|
327 | | - * @param p_chain |
---|
328 | | - */ |
---|
329 | | -void qed_chain_free(struct qed_dev *cdev, struct qed_chain *p_chain); |
---|
| 257 | +int qed_chain_alloc(struct qed_dev *cdev, struct qed_chain *chain, |
---|
| 258 | + struct qed_chain_init_params *params); |
---|
| 259 | +void qed_chain_free(struct qed_dev *cdev, struct qed_chain *chain); |
---|
330 | 260 | |
---|
331 | 261 | /** |
---|
332 | 262 | * @@brief qed_fw_l2_queue - Get absolute L2 queue ID |
---|
.. | .. |
---|
368 | 298 | u8 *dst_id); |
---|
369 | 299 | |
---|
370 | 300 | /** |
---|
371 | | - * @brief qed_llh_add_mac_filter - configures a MAC filter in llh |
---|
| 301 | + * @brief qed_llh_get_num_ppfid - Return the allocated number of LLH filter |
---|
| 302 | + * banks that are allocated to the PF. |
---|
372 | 303 | * |
---|
373 | | - * @param p_hwfn |
---|
374 | | - * @param p_ptt |
---|
375 | | - * @param p_filter - MAC to add |
---|
| 304 | + * @param cdev |
---|
| 305 | + * |
---|
| 306 | + * @return u8 - Number of LLH filter banks |
---|
376 | 307 | */ |
---|
377 | | -int qed_llh_add_mac_filter(struct qed_hwfn *p_hwfn, |
---|
378 | | - struct qed_ptt *p_ptt, u8 *p_filter); |
---|
| 308 | +u8 qed_llh_get_num_ppfid(struct qed_dev *cdev); |
---|
| 309 | + |
---|
| 310 | +enum qed_eng { |
---|
| 311 | + QED_ENG0, |
---|
| 312 | + QED_ENG1, |
---|
| 313 | + QED_BOTH_ENG, |
---|
| 314 | +}; |
---|
379 | 315 | |
---|
380 | 316 | /** |
---|
381 | | - * @brief qed_llh_remove_mac_filter - removes a MAC filter from llh |
---|
| 317 | + * @brief qed_llh_set_ppfid_affinity - Set the engine affinity for the given |
---|
| 318 | + * LLH filter bank. |
---|
382 | 319 | * |
---|
383 | | - * @param p_hwfn |
---|
| 320 | + * @param cdev |
---|
| 321 | + * @param ppfid - relative within the allocated ppfids ('0' is the default one). |
---|
| 322 | + * @param eng |
---|
| 323 | + * |
---|
| 324 | + * @return int |
---|
| 325 | + */ |
---|
| 326 | +int qed_llh_set_ppfid_affinity(struct qed_dev *cdev, |
---|
| 327 | + u8 ppfid, enum qed_eng eng); |
---|
| 328 | + |
---|
| 329 | +/** |
---|
| 330 | + * @brief qed_llh_set_roce_affinity - Set the RoCE engine affinity |
---|
| 331 | + * |
---|
| 332 | + * @param cdev |
---|
| 333 | + * @param eng |
---|
| 334 | + * |
---|
| 335 | + * @return int |
---|
| 336 | + */ |
---|
| 337 | +int qed_llh_set_roce_affinity(struct qed_dev *cdev, enum qed_eng eng); |
---|
| 338 | + |
---|
| 339 | +/** |
---|
| 340 | + * @brief qed_llh_add_mac_filter - Add a LLH MAC filter into the given filter |
---|
| 341 | + * bank. |
---|
| 342 | + * |
---|
| 343 | + * @param cdev |
---|
| 344 | + * @param ppfid - relative within the allocated ppfids ('0' is the default one). |
---|
| 345 | + * @param mac_addr - MAC to add |
---|
| 346 | + */ |
---|
| 347 | +int qed_llh_add_mac_filter(struct qed_dev *cdev, |
---|
| 348 | + u8 ppfid, u8 mac_addr[ETH_ALEN]); |
---|
| 349 | + |
---|
| 350 | +/** |
---|
| 351 | + * @brief qed_llh_remove_mac_filter - Remove a LLH MAC filter from the given |
---|
| 352 | + * filter bank. |
---|
| 353 | + * |
---|
384 | 354 | * @param p_ptt |
---|
385 | 355 | * @param p_filter - MAC to remove |
---|
386 | 356 | */ |
---|
387 | | -void qed_llh_remove_mac_filter(struct qed_hwfn *p_hwfn, |
---|
388 | | - struct qed_ptt *p_ptt, u8 *p_filter); |
---|
| 357 | +void qed_llh_remove_mac_filter(struct qed_dev *cdev, |
---|
| 358 | + u8 ppfid, u8 mac_addr[ETH_ALEN]); |
---|
389 | 359 | |
---|
390 | | -enum qed_llh_port_filter_type_t { |
---|
| 360 | +enum qed_llh_prot_filter_type_t { |
---|
391 | 361 | QED_LLH_FILTER_ETHERTYPE, |
---|
392 | 362 | QED_LLH_FILTER_TCP_SRC_PORT, |
---|
393 | 363 | QED_LLH_FILTER_TCP_DEST_PORT, |
---|
.. | .. |
---|
398 | 368 | }; |
---|
399 | 369 | |
---|
400 | 370 | /** |
---|
401 | | - * @brief qed_llh_add_protocol_filter - configures a protocol filter in llh |
---|
| 371 | + * @brief qed_llh_add_protocol_filter - Add a LLH protocol filter into the |
---|
| 372 | + * given filter bank. |
---|
402 | 373 | * |
---|
403 | | - * @param p_hwfn |
---|
404 | | - * @param p_ptt |
---|
| 374 | + * @param cdev |
---|
| 375 | + * @param ppfid - relative within the allocated ppfids ('0' is the default one). |
---|
| 376 | + * @param type - type of filters and comparing |
---|
405 | 377 | * @param source_port_or_eth_type - source port or ethertype to add |
---|
406 | 378 | * @param dest_port - destination port to add |
---|
407 | 379 | * @param type - type of filters and comparing |
---|
408 | 380 | */ |
---|
409 | 381 | int |
---|
410 | | -qed_llh_add_protocol_filter(struct qed_hwfn *p_hwfn, |
---|
411 | | - struct qed_ptt *p_ptt, |
---|
412 | | - u16 source_port_or_eth_type, |
---|
413 | | - u16 dest_port, |
---|
414 | | - enum qed_llh_port_filter_type_t type); |
---|
| 382 | +qed_llh_add_protocol_filter(struct qed_dev *cdev, |
---|
| 383 | + u8 ppfid, |
---|
| 384 | + enum qed_llh_prot_filter_type_t type, |
---|
| 385 | + u16 source_port_or_eth_type, u16 dest_port); |
---|
415 | 386 | |
---|
416 | 387 | /** |
---|
417 | | - * @brief qed_llh_remove_protocol_filter - remove a protocol filter in llh |
---|
| 388 | + * @brief qed_llh_remove_protocol_filter - Remove a LLH protocol filter from |
---|
| 389 | + * the given filter bank. |
---|
418 | 390 | * |
---|
419 | | - * @param p_hwfn |
---|
420 | | - * @param p_ptt |
---|
| 391 | + * @param cdev |
---|
| 392 | + * @param ppfid - relative within the allocated ppfids ('0' is the default one). |
---|
| 393 | + * @param type - type of filters and comparing |
---|
421 | 394 | * @param source_port_or_eth_type - source port or ethertype to add |
---|
422 | 395 | * @param dest_port - destination port to add |
---|
423 | | - * @param type - type of filters and comparing |
---|
424 | 396 | */ |
---|
425 | 397 | void |
---|
426 | | -qed_llh_remove_protocol_filter(struct qed_hwfn *p_hwfn, |
---|
427 | | - struct qed_ptt *p_ptt, |
---|
428 | | - u16 source_port_or_eth_type, |
---|
429 | | - u16 dest_port, |
---|
430 | | - enum qed_llh_port_filter_type_t type); |
---|
| 398 | +qed_llh_remove_protocol_filter(struct qed_dev *cdev, |
---|
| 399 | + u8 ppfid, |
---|
| 400 | + enum qed_llh_prot_filter_type_t type, |
---|
| 401 | + u16 source_port_or_eth_type, u16 dest_port); |
---|
431 | 402 | |
---|
432 | 403 | /** |
---|
433 | 404 | * *@brief Cleanup of previous driver remains prior to load |
---|
.. | .. |
---|
472 | 443 | int |
---|
473 | 444 | qed_set_queue_coalesce(u16 rx_coal, u16 tx_coal, void *p_handle); |
---|
474 | 445 | |
---|
| 446 | +/** |
---|
| 447 | + * @brief qed_pglueb_set_pfid_enable - Enable or disable PCI BUS MASTER |
---|
| 448 | + * |
---|
| 449 | + * @param p_hwfn |
---|
| 450 | + * @param p_ptt |
---|
| 451 | + * @param b_enable - true/false |
---|
| 452 | + * |
---|
| 453 | + * @return int |
---|
| 454 | + */ |
---|
| 455 | +int qed_pglueb_set_pfid_enable(struct qed_hwfn *p_hwfn, |
---|
| 456 | + struct qed_ptt *p_ptt, bool b_enable); |
---|
| 457 | + |
---|
| 458 | +/** |
---|
| 459 | + * @brief db_recovery_add - add doorbell information to the doorbell |
---|
| 460 | + * recovery mechanism. |
---|
| 461 | + * |
---|
| 462 | + * @param cdev |
---|
| 463 | + * @param db_addr - doorbell address |
---|
| 464 | + * @param db_data - address of where db_data is stored |
---|
| 465 | + * @param db_width - doorbell is 32b pr 64b |
---|
| 466 | + * @param db_space - doorbell recovery addresses are user or kernel space |
---|
| 467 | + */ |
---|
| 468 | +int qed_db_recovery_add(struct qed_dev *cdev, |
---|
| 469 | + void __iomem *db_addr, |
---|
| 470 | + void *db_data, |
---|
| 471 | + enum qed_db_rec_width db_width, |
---|
| 472 | + enum qed_db_rec_space db_space); |
---|
| 473 | + |
---|
| 474 | +/** |
---|
| 475 | + * @brief db_recovery_del - remove doorbell information from the doorbell |
---|
| 476 | + * recovery mechanism. db_data serves as key (db_addr is not unique). |
---|
| 477 | + * |
---|
| 478 | + * @param cdev |
---|
| 479 | + * @param db_addr - doorbell address |
---|
| 480 | + * @param db_data - address where db_data is stored. Serves as key for the |
---|
| 481 | + * entry to delete. |
---|
| 482 | + */ |
---|
| 483 | +int qed_db_recovery_del(struct qed_dev *cdev, |
---|
| 484 | + void __iomem *db_addr, void *db_data); |
---|
| 485 | + |
---|
475 | 486 | |
---|
476 | 487 | const char *qed_hw_get_resc_name(enum qed_resources res_id); |
---|
477 | 488 | #endif |
---|