11f4d4ed6SAlexander Lobakin /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
21e128c81SArun Easi /* QLogic qed NIC Driver
31e128c81SArun Easi  * Copyright (c) 2015-2017  QLogic Corporation
4663eacd8SAlexander Lobakin  * Copyright (c) 2019-2020 Marvell International Ltd.
51e128c81SArun Easi  */
61e128c81SArun Easi 
71e128c81SArun Easi #ifndef _QED_FCOE_H
81e128c81SArun Easi #define _QED_FCOE_H
91e128c81SArun Easi #include <linux/types.h>
101e128c81SArun Easi #include <linux/list.h>
111e128c81SArun Easi #include <linux/slab.h>
121e128c81SArun Easi #include <linux/spinlock.h>
131e128c81SArun Easi #include <linux/qed/qed_fcoe_if.h>
141e128c81SArun Easi #include <linux/qed/qed_chain.h>
151e128c81SArun Easi #include "qed.h"
161e128c81SArun Easi #include "qed_hsi.h"
171e128c81SArun Easi #include "qed_mcp.h"
181e128c81SArun Easi #include "qed_sp.h"
191e128c81SArun Easi 
201e128c81SArun Easi struct qed_fcoe_info {
211e128c81SArun Easi 	spinlock_t lock; /* Connection resources. */
221e128c81SArun Easi 	struct list_head free_list;
231e128c81SArun Easi };
241e128c81SArun Easi 
251e128c81SArun Easi #if IS_ENABLED(CONFIG_QED_FCOE)
263587cb87STomer Tayar int qed_fcoe_alloc(struct qed_hwfn *p_hwfn);
271e128c81SArun Easi 
283587cb87STomer Tayar void qed_fcoe_setup(struct qed_hwfn *p_hwfn);
291e128c81SArun Easi 
303587cb87STomer Tayar void qed_fcoe_free(struct qed_hwfn *p_hwfn);
31*e346e231SKonstantin Khorenko /**
32*e346e231SKonstantin Khorenko  * qed_get_protocol_stats_fcoe(): Fills provided statistics
33*e346e231SKonstantin Khorenko  *				  struct with statistics.
34*e346e231SKonstantin Khorenko  *
35*e346e231SKonstantin Khorenko  * @cdev: Qed dev pointer.
36*e346e231SKonstantin Khorenko  * @stats: Points to struct that will be filled with statistics.
37*e346e231SKonstantin Khorenko  * @is_atomic: Hint from the caller - if the func can sleep or not.
38*e346e231SKonstantin Khorenko  *
39*e346e231SKonstantin Khorenko  * Context: The function should not sleep in case is_atomic == true.
40*e346e231SKonstantin Khorenko  * Return: Void.
41*e346e231SKonstantin Khorenko  */
421e128c81SArun Easi void qed_get_protocol_stats_fcoe(struct qed_dev *cdev,
43*e346e231SKonstantin Khorenko 				 struct qed_mcp_fcoe_stats *stats,
44*e346e231SKonstantin Khorenko 				 bool is_atomic);
451e128c81SArun Easi #else /* CONFIG_QED_FCOE */
qed_fcoe_alloc(struct qed_hwfn * p_hwfn)463587cb87STomer Tayar static inline int qed_fcoe_alloc(struct qed_hwfn *p_hwfn)
471e128c81SArun Easi {
483587cb87STomer Tayar 	return -EINVAL;
491e128c81SArun Easi }
501e128c81SArun Easi 
qed_fcoe_setup(struct qed_hwfn * p_hwfn)513587cb87STomer Tayar static inline void qed_fcoe_setup(struct qed_hwfn *p_hwfn) {}
qed_fcoe_free(struct qed_hwfn * p_hwfn)523587cb87STomer Tayar static inline void qed_fcoe_free(struct qed_hwfn *p_hwfn) {}
531e128c81SArun Easi 
qed_get_protocol_stats_fcoe(struct qed_dev * cdev,struct qed_mcp_fcoe_stats * stats,bool is_atomic)541e128c81SArun Easi static inline void qed_get_protocol_stats_fcoe(struct qed_dev *cdev,
55*e346e231SKonstantin Khorenko 					       struct qed_mcp_fcoe_stats *stats,
56*e346e231SKonstantin Khorenko 					       bool is_atomic)
571e128c81SArun Easi {
581e128c81SArun Easi }
591e128c81SArun Easi #endif /* CONFIG_QED_FCOE */
601e128c81SArun Easi 
611e128c81SArun Easi #endif /* _QED_FCOE_H */
62