1 | /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ |
2 | /* QLogic qed NIC Driver |
3 | * Copyright (c) 2015-2017 QLogic Corporation |
4 | * Copyright (c) 2019-2020 Marvell International Ltd. |
5 | */ |
6 | |
7 | #ifndef _QED_ISCSI_H |
8 | #define _QED_ISCSI_H |
9 | #include <linux/types.h> |
10 | #include <linux/list.h> |
11 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> |
13 | #include <linux/qed/tcp_common.h> |
14 | #include <linux/qed/qed_iscsi_if.h> |
15 | #include <linux/qed/qed_chain.h> |
16 | #include "qed.h" |
17 | #include "qed_hsi.h" |
18 | #include "qed_mcp.h" |
19 | #include "qed_sp.h" |
20 | |
21 | struct qed_iscsi_info { |
22 | spinlock_t lock; /* Connection resources. */ |
23 | struct list_head free_list; |
24 | u16 max_num_outstanding_tasks; |
25 | void *event_context; |
26 | iscsi_event_cb_t event_cb; |
27 | }; |
28 | |
29 | #if IS_ENABLED(CONFIG_QED_ISCSI) |
30 | int qed_iscsi_alloc(struct qed_hwfn *p_hwfn); |
31 | |
32 | void qed_iscsi_setup(struct qed_hwfn *p_hwfn); |
33 | |
34 | void qed_iscsi_free(struct qed_hwfn *p_hwfn); |
35 | |
36 | /** |
37 | * qed_get_protocol_stats_iscsi(): Fills provided statistics |
38 | * struct with statistics. |
39 | * |
40 | * @cdev: Qed dev pointer. |
41 | * @stats: Points to struct that will be filled with statistics. |
42 | * @is_atomic: Hint from the caller - if the func can sleep or not. |
43 | * |
44 | * Context: The function should not sleep in case is_atomic == true. |
45 | * Return: Void. |
46 | */ |
47 | void qed_get_protocol_stats_iscsi(struct qed_dev *cdev, |
48 | struct qed_mcp_iscsi_stats *stats, |
49 | bool is_atomic); |
50 | #else /* IS_ENABLED(CONFIG_QED_ISCSI) */ |
51 | static inline int qed_iscsi_alloc(struct qed_hwfn *p_hwfn) |
52 | { |
53 | return -EINVAL; |
54 | } |
55 | |
56 | static inline void qed_iscsi_setup(struct qed_hwfn *p_hwfn) {} |
57 | |
58 | static inline void qed_iscsi_free(struct qed_hwfn *p_hwfn) {} |
59 | |
60 | static inline void |
61 | qed_get_protocol_stats_iscsi(struct qed_dev *cdev, |
62 | struct qed_mcp_iscsi_stats *stats, |
63 | bool is_atomic) {} |
64 | #endif /* IS_ENABLED(CONFIG_QED_ISCSI) */ |
65 | |
66 | #endif |
67 | |