1fc831825SYuval Mintz /* QLogic qed NIC Driver
2e8f1cb50SMintz, Yuval  * Copyright (c) 2015-2017  QLogic Corporation
3fc831825SYuval Mintz  *
4e8f1cb50SMintz, Yuval  * This software is available to you under a choice of one of two
5e8f1cb50SMintz, Yuval  * licenses.  You may choose to be licensed under the terms of the GNU
6e8f1cb50SMintz, Yuval  * General Public License (GPL) Version 2, available from the file
7e8f1cb50SMintz, Yuval  * COPYING in the main directory of this source tree, or the
8e8f1cb50SMintz, Yuval  * OpenIB.org BSD license below:
9e8f1cb50SMintz, Yuval  *
10e8f1cb50SMintz, Yuval  *     Redistribution and use in source and binary forms, with or
11e8f1cb50SMintz, Yuval  *     without modification, are permitted provided that the following
12e8f1cb50SMintz, Yuval  *     conditions are met:
13e8f1cb50SMintz, Yuval  *
14e8f1cb50SMintz, Yuval  *      - Redistributions of source code must retain the above
15e8f1cb50SMintz, Yuval  *        copyright notice, this list of conditions and the following
16e8f1cb50SMintz, Yuval  *        disclaimer.
17e8f1cb50SMintz, Yuval  *
18e8f1cb50SMintz, Yuval  *      - Redistributions in binary form must reproduce the above
19e8f1cb50SMintz, Yuval  *        copyright notice, this list of conditions and the following
20e8f1cb50SMintz, Yuval  *        disclaimer in the documentation and /or other materials
21e8f1cb50SMintz, Yuval  *        provided with the distribution.
22e8f1cb50SMintz, Yuval  *
23e8f1cb50SMintz, Yuval  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24e8f1cb50SMintz, Yuval  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25e8f1cb50SMintz, Yuval  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26e8f1cb50SMintz, Yuval  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27e8f1cb50SMintz, Yuval  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28e8f1cb50SMintz, Yuval  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29e8f1cb50SMintz, Yuval  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30e8f1cb50SMintz, Yuval  * SOFTWARE.
31fc831825SYuval Mintz  */
32fc831825SYuval Mintz 
33fc831825SYuval Mintz #ifndef _QED_ISCSI_H
34fc831825SYuval Mintz #define _QED_ISCSI_H
35fc831825SYuval Mintz #include <linux/types.h>
36fc831825SYuval Mintz #include <linux/list.h>
37fc831825SYuval Mintz #include <linux/slab.h>
38fc831825SYuval Mintz #include <linux/spinlock.h>
39fc831825SYuval Mintz #include <linux/qed/tcp_common.h>
40fc831825SYuval Mintz #include <linux/qed/qed_iscsi_if.h>
41fc831825SYuval Mintz #include <linux/qed/qed_chain.h>
42fc831825SYuval Mintz #include "qed.h"
43fc831825SYuval Mintz #include "qed_hsi.h"
44fc831825SYuval Mintz #include "qed_mcp.h"
45fc831825SYuval Mintz #include "qed_sp.h"
46fc831825SYuval Mintz 
47fc831825SYuval Mintz struct qed_iscsi_info {
48fc831825SYuval Mintz 	spinlock_t lock; /* Connection resources. */
49fc831825SYuval Mintz 	struct list_head free_list;
50fc831825SYuval Mintz 	u16 max_num_outstanding_tasks;
51fc831825SYuval Mintz 	void *event_context;
52fc831825SYuval Mintz 	iscsi_event_cb_t event_cb;
53fc831825SYuval Mintz };
54fc831825SYuval Mintz 
55fc831825SYuval Mintz #ifdef CONFIG_QED_LL2
56fc831825SYuval Mintz extern const struct qed_ll2_ops qed_ll2_ops_pass;
57fc831825SYuval Mintz #endif
58fc831825SYuval Mintz 
59fc831825SYuval Mintz #if IS_ENABLED(CONFIG_QED_ISCSI)
60fc831825SYuval Mintz struct qed_iscsi_info *qed_iscsi_alloc(struct qed_hwfn *p_hwfn);
61fc831825SYuval Mintz 
62fc831825SYuval Mintz void qed_iscsi_setup(struct qed_hwfn *p_hwfn,
63fc831825SYuval Mintz 		     struct qed_iscsi_info *p_iscsi_info);
64fc831825SYuval Mintz 
65fc831825SYuval Mintz void qed_iscsi_free(struct qed_hwfn *p_hwfn,
66fc831825SYuval Mintz 		    struct qed_iscsi_info *p_iscsi_info);
672f2b2614SMintz, Yuval 
682f2b2614SMintz, Yuval /**
692f2b2614SMintz, Yuval  * @brief - Fills provided statistics struct with statistics.
702f2b2614SMintz, Yuval  *
712f2b2614SMintz, Yuval  * @param cdev
722f2b2614SMintz, Yuval  * @param stats - points to struct that will be filled with statistics.
732f2b2614SMintz, Yuval  */
742f2b2614SMintz, Yuval void qed_get_protocol_stats_iscsi(struct qed_dev *cdev,
752f2b2614SMintz, Yuval 				  struct qed_mcp_iscsi_stats *stats);
76fc831825SYuval Mintz #else /* IS_ENABLED(CONFIG_QED_ISCSI) */
77fc831825SYuval Mintz static inline struct qed_iscsi_info *qed_iscsi_alloc(
78fc831825SYuval Mintz 		struct qed_hwfn *p_hwfn) { return NULL; }
79fc831825SYuval Mintz static inline void qed_iscsi_setup(struct qed_hwfn *p_hwfn,
80fc831825SYuval Mintz 				   struct qed_iscsi_info *p_iscsi_info) {}
81fc831825SYuval Mintz static inline void qed_iscsi_free(struct qed_hwfn *p_hwfn,
82fc831825SYuval Mintz 				 struct qed_iscsi_info *p_iscsi_info) {}
832f2b2614SMintz, Yuval static inline void
842f2b2614SMintz, Yuval qed_get_protocol_stats_iscsi(struct qed_dev *cdev,
852f2b2614SMintz, Yuval 			     struct qed_mcp_iscsi_stats *stats) {}
86fc831825SYuval Mintz #endif /* IS_ENABLED(CONFIG_QED_ISCSI) */
87fc831825SYuval Mintz 
88fc831825SYuval Mintz #endif
89