111e25f0dSDavid C Somayajulu /*
211e25f0dSDavid C Somayajulu * Copyright (c) 2017-2018 Cavium, Inc.
311e25f0dSDavid C Somayajulu * All rights reserved.
411e25f0dSDavid C Somayajulu *
511e25f0dSDavid C Somayajulu * Redistribution and use in source and binary forms, with or without
611e25f0dSDavid C Somayajulu * modification, are permitted provided that the following conditions
711e25f0dSDavid C Somayajulu * are met:
811e25f0dSDavid C Somayajulu *
911e25f0dSDavid C Somayajulu * 1. Redistributions of source code must retain the above copyright
1011e25f0dSDavid C Somayajulu * notice, this list of conditions and the following disclaimer.
1111e25f0dSDavid C Somayajulu * 2. Redistributions in binary form must reproduce the above copyright
1211e25f0dSDavid C Somayajulu * notice, this list of conditions and the following disclaimer in the
1311e25f0dSDavid C Somayajulu * documentation and/or other materials provided with the distribution.
1411e25f0dSDavid C Somayajulu *
1511e25f0dSDavid C Somayajulu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1611e25f0dSDavid C Somayajulu * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1711e25f0dSDavid C Somayajulu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1811e25f0dSDavid C Somayajulu * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
1911e25f0dSDavid C Somayajulu * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2011e25f0dSDavid C Somayajulu * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2111e25f0dSDavid C Somayajulu * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2211e25f0dSDavid C Somayajulu * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2311e25f0dSDavid C Somayajulu * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2411e25f0dSDavid C Somayajulu * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2511e25f0dSDavid C Somayajulu * POSSIBILITY OF SUCH DAMAGE.
2611e25f0dSDavid C Somayajulu *
2711e25f0dSDavid C Somayajulu */
2811e25f0dSDavid C Somayajulu
2911e25f0dSDavid C Somayajulu #ifndef __ECORE_ISCSI_H__
3011e25f0dSDavid C Somayajulu #define __ECORE_ISCSI_H__
3111e25f0dSDavid C Somayajulu
3211e25f0dSDavid C Somayajulu #include "ecore.h"
3311e25f0dSDavid C Somayajulu #include "ecore_chain.h"
3411e25f0dSDavid C Somayajulu #include "ecore_hsi_common.h"
3511e25f0dSDavid C Somayajulu #include "tcp_common.h"
3611e25f0dSDavid C Somayajulu #include "ecore_hsi_iscsi.h"
3711e25f0dSDavid C Somayajulu #include "ecore_sp_commands.h"
3811e25f0dSDavid C Somayajulu #include "ecore_iscsi_api.h"
3911e25f0dSDavid C Somayajulu
40*217ec208SDavid C Somayajulu #ifndef __EXTRACT__LINUX__H__
4111e25f0dSDavid C Somayajulu struct ecore_iscsi_info {
4211e25f0dSDavid C Somayajulu osal_spinlock_t lock;
4311e25f0dSDavid C Somayajulu osal_list_t free_list;
4411e25f0dSDavid C Somayajulu u16 max_num_outstanding_tasks;
4511e25f0dSDavid C Somayajulu void *event_context;
4611e25f0dSDavid C Somayajulu iscsi_event_cb_t event_cb;
4711e25f0dSDavid C Somayajulu };
4811e25f0dSDavid C Somayajulu
49*217ec208SDavid C Somayajulu #ifdef CONFIG_ECORE_ISCSI
5011e25f0dSDavid C Somayajulu enum _ecore_status_t ecore_iscsi_alloc(struct ecore_hwfn *p_hwfn);
5111e25f0dSDavid C Somayajulu
5211e25f0dSDavid C Somayajulu void ecore_iscsi_setup(struct ecore_hwfn *p_hwfn);
5311e25f0dSDavid C Somayajulu
5411e25f0dSDavid C Somayajulu void ecore_iscsi_free(struct ecore_hwfn *p_hwfn);
55*217ec208SDavid C Somayajulu #else
56*217ec208SDavid C Somayajulu static inline enum _ecore_status_t
ecore_iscsi_alloc(struct ecore_hwfn OSAL_UNUSED * p_hwfn)57*217ec208SDavid C Somayajulu ecore_iscsi_alloc(struct ecore_hwfn OSAL_UNUSED *p_hwfn)
58*217ec208SDavid C Somayajulu {
59*217ec208SDavid C Somayajulu return ECORE_INVAL;
60*217ec208SDavid C Somayajulu }
61*217ec208SDavid C Somayajulu
62*217ec208SDavid C Somayajulu static inline void
ecore_iscsi_setup(struct ecore_hwfn OSAL_UNUSED * p_hwfn)63*217ec208SDavid C Somayajulu ecore_iscsi_setup(struct ecore_hwfn OSAL_UNUSED *p_hwfn) {}
64*217ec208SDavid C Somayajulu
65*217ec208SDavid C Somayajulu static inline void
ecore_iscsi_free(struct ecore_hwfn OSAL_UNUSED * p_hwfn)66*217ec208SDavid C Somayajulu ecore_iscsi_free(struct ecore_hwfn OSAL_UNUSED *p_hwfn) {}
67*217ec208SDavid C Somayajulu #endif
68*217ec208SDavid C Somayajulu #endif
6911e25f0dSDavid C Somayajulu
7011e25f0dSDavid C Somayajulu void ecore_iscsi_free_connection(struct ecore_hwfn *p_hwfn,
7111e25f0dSDavid C Somayajulu struct ecore_iscsi_conn *p_conn);
7211e25f0dSDavid C Somayajulu
7311e25f0dSDavid C Somayajulu /**
7411e25f0dSDavid C Somayajulu * @brief ecore_sp_iscsi_conn_offload - iSCSI connection offload
7511e25f0dSDavid C Somayajulu *
7611e25f0dSDavid C Somayajulu * This ramrod offloads iSCSI connection to FW
7711e25f0dSDavid C Somayajulu *
7811e25f0dSDavid C Somayajulu * @param p_path
7911e25f0dSDavid C Somayajulu * @param p_conn
8011e25f0dSDavid C Somayajulu * @param comp_mode
8111e25f0dSDavid C Somayajulu * @param comp_addr
8211e25f0dSDavid C Somayajulu *
8311e25f0dSDavid C Somayajulu * @return enum _ecore_status_t
8411e25f0dSDavid C Somayajulu */
8511e25f0dSDavid C Somayajulu enum _ecore_status_t
8611e25f0dSDavid C Somayajulu ecore_sp_iscsi_conn_offload(struct ecore_hwfn *p_hwfn,
8711e25f0dSDavid C Somayajulu struct ecore_iscsi_conn *p_conn,
8811e25f0dSDavid C Somayajulu enum spq_mode comp_mode,
8911e25f0dSDavid C Somayajulu struct ecore_spq_comp_cb *p_comp_addr);
9011e25f0dSDavid C Somayajulu
9111e25f0dSDavid C Somayajulu /**
9211e25f0dSDavid C Somayajulu * @brief ecore_sp_iscsi_conn_update - iSCSI connection update
9311e25f0dSDavid C Somayajulu *
9411e25f0dSDavid C Somayajulu * This ramrod updatess iSCSI ofloadedconnection in FW
9511e25f0dSDavid C Somayajulu *
9611e25f0dSDavid C Somayajulu * @param p_path
9711e25f0dSDavid C Somayajulu * @param p_conn
9811e25f0dSDavid C Somayajulu * @param comp_mode
9911e25f0dSDavid C Somayajulu * @param comp_addr
10011e25f0dSDavid C Somayajulu *
10111e25f0dSDavid C Somayajulu * @return enum _ecore_status_t
10211e25f0dSDavid C Somayajulu */
10311e25f0dSDavid C Somayajulu enum _ecore_status_t
10411e25f0dSDavid C Somayajulu ecore_sp_iscsi_conn_update(struct ecore_hwfn *p_hwfn,
10511e25f0dSDavid C Somayajulu struct ecore_iscsi_conn *p_conn,
10611e25f0dSDavid C Somayajulu enum spq_mode comp_mode,
10711e25f0dSDavid C Somayajulu struct ecore_spq_comp_cb *p_comp_addr);
10811e25f0dSDavid C Somayajulu
10911e25f0dSDavid C Somayajulu /**
11011e25f0dSDavid C Somayajulu * @brief ecore_sp_iscsi_mac_update - iSCSI connection's MAC update
11111e25f0dSDavid C Somayajulu *
11211e25f0dSDavid C Somayajulu * This ramrod updates remote MAC for iSCSI offloaded connection in FW
11311e25f0dSDavid C Somayajulu *
11411e25f0dSDavid C Somayajulu * @param p_path
11511e25f0dSDavid C Somayajulu * @param p_conn
11611e25f0dSDavid C Somayajulu * @param comp_mode
11711e25f0dSDavid C Somayajulu * @param comp_addr
11811e25f0dSDavid C Somayajulu *
11911e25f0dSDavid C Somayajulu * @return enum _ecore_status_t
12011e25f0dSDavid C Somayajulu */
12111e25f0dSDavid C Somayajulu enum _ecore_status_t
12211e25f0dSDavid C Somayajulu ecore_sp_iscsi_mac_update(struct ecore_hwfn *p_hwfn,
12311e25f0dSDavid C Somayajulu struct ecore_iscsi_conn *p_conn,
12411e25f0dSDavid C Somayajulu enum spq_mode comp_mode,
12511e25f0dSDavid C Somayajulu struct ecore_spq_comp_cb *p_comp_addr);
12611e25f0dSDavid C Somayajulu
12711e25f0dSDavid C Somayajulu /**
128*217ec208SDavid C Somayajulu * @brief ecore_sp_iscsi_mac_update - iSCSI connection's MAC update
129*217ec208SDavid C Somayajulu *
130*217ec208SDavid C Somayajulu * This ramrod updates remote MAC for iSCSI offloaded connection in FW
131*217ec208SDavid C Somayajulu *
132*217ec208SDavid C Somayajulu * @param p_path
133*217ec208SDavid C Somayajulu * @param p_conn
134*217ec208SDavid C Somayajulu * @param reset
135*217ec208SDavid C Somayajulu * @param comp_mode
136*217ec208SDavid C Somayajulu * @param comp_addr
137*217ec208SDavid C Somayajulu *
138*217ec208SDavid C Somayajulu * @return enum _ecore_status_t
139*217ec208SDavid C Somayajulu */
140*217ec208SDavid C Somayajulu enum _ecore_status_t
141*217ec208SDavid C Somayajulu ecore_sp_iscsi_stats_tcp_update(struct ecore_hwfn *p_hwfn,
142*217ec208SDavid C Somayajulu struct ecore_iscsi_conn *p_conn,
143*217ec208SDavid C Somayajulu bool reset,
144*217ec208SDavid C Somayajulu enum spq_mode comp_mode,
145*217ec208SDavid C Somayajulu struct ecore_spq_comp_cb *p_comp_addr);
146*217ec208SDavid C Somayajulu
147*217ec208SDavid C Somayajulu /**
14811e25f0dSDavid C Somayajulu * @brief ecore_sp_iscsi_conn_terminate - iSCSI connection
14911e25f0dSDavid C Somayajulu * terminate
15011e25f0dSDavid C Somayajulu *
15111e25f0dSDavid C Somayajulu * This ramrod deletes iSCSI offloaded connection in FW
15211e25f0dSDavid C Somayajulu *
15311e25f0dSDavid C Somayajulu * @param p_path
15411e25f0dSDavid C Somayajulu * @param p_conn
15511e25f0dSDavid C Somayajulu * @param comp_mode
15611e25f0dSDavid C Somayajulu * @param comp_addr
15711e25f0dSDavid C Somayajulu *
15811e25f0dSDavid C Somayajulu * @return enum _ecore_status_t
15911e25f0dSDavid C Somayajulu */
16011e25f0dSDavid C Somayajulu enum _ecore_status_t
16111e25f0dSDavid C Somayajulu ecore_sp_iscsi_conn_terminate(struct ecore_hwfn *p_hwfn,
16211e25f0dSDavid C Somayajulu struct ecore_iscsi_conn *p_conn,
16311e25f0dSDavid C Somayajulu enum spq_mode comp_mode,
16411e25f0dSDavid C Somayajulu struct ecore_spq_comp_cb *p_comp_addr);
16511e25f0dSDavid C Somayajulu
16611e25f0dSDavid C Somayajulu /**
16711e25f0dSDavid C Somayajulu * @brief ecore_sp_iscsi_conn_clear_sq - iSCSI connection
16811e25f0dSDavid C Somayajulu * clear SQ
16911e25f0dSDavid C Somayajulu *
17011e25f0dSDavid C Somayajulu * This ramrod clears connection's SQ in FW
17111e25f0dSDavid C Somayajulu *
17211e25f0dSDavid C Somayajulu * @param p_path
17311e25f0dSDavid C Somayajulu * @param p_conn
17411e25f0dSDavid C Somayajulu * @param comp_mode
17511e25f0dSDavid C Somayajulu * @param comp_addr
17611e25f0dSDavid C Somayajulu *
17711e25f0dSDavid C Somayajulu * @return enum _ecore_status_t
17811e25f0dSDavid C Somayajulu */
17911e25f0dSDavid C Somayajulu enum _ecore_status_t
18011e25f0dSDavid C Somayajulu ecore_sp_iscsi_conn_clear_sq(struct ecore_hwfn *p_hwfn,
18111e25f0dSDavid C Somayajulu struct ecore_iscsi_conn *p_conn,
18211e25f0dSDavid C Somayajulu enum spq_mode comp_mode,
18311e25f0dSDavid C Somayajulu struct ecore_spq_comp_cb *p_comp_addr);
18411e25f0dSDavid C Somayajulu
18511e25f0dSDavid C Somayajulu #endif /*__ECORE_ISCSI_H__*/
186