167b40dccSKalderon, Michal /* QLogic qed NIC Driver 267b40dccSKalderon, Michal * Copyright (c) 2015-2017 QLogic Corporation 367b40dccSKalderon, Michal * 467b40dccSKalderon, Michal * This software is available to you under a choice of one of two 567b40dccSKalderon, Michal * licenses. You may choose to be licensed under the terms of the GNU 667b40dccSKalderon, Michal * General Public License (GPL) Version 2, available from the file 767b40dccSKalderon, Michal * COPYING in the main directory of this source tree, or the 867b40dccSKalderon, Michal * OpenIB.org BSD license below: 967b40dccSKalderon, Michal * 1067b40dccSKalderon, Michal * Redistribution and use in source and binary forms, with or 1167b40dccSKalderon, Michal * without modification, are permitted provided that the following 1267b40dccSKalderon, Michal * conditions are met: 1367b40dccSKalderon, Michal * 1467b40dccSKalderon, Michal * - Redistributions of source code must retain the above 1567b40dccSKalderon, Michal * copyright notice, this list of conditions and the following 1667b40dccSKalderon, Michal * disclaimer. 1767b40dccSKalderon, Michal * 1867b40dccSKalderon, Michal * - Redistributions in binary form must reproduce the above 1967b40dccSKalderon, Michal * copyright notice, this list of conditions and the following 2067b40dccSKalderon, Michal * disclaimer in the documentation and /or other materials 2167b40dccSKalderon, Michal * provided with the distribution. 2267b40dccSKalderon, Michal * 2367b40dccSKalderon, Michal * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 2467b40dccSKalderon, Michal * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 2567b40dccSKalderon, Michal * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 2667b40dccSKalderon, Michal * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 2767b40dccSKalderon, Michal * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 2867b40dccSKalderon, Michal * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 2967b40dccSKalderon, Michal * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 3067b40dccSKalderon, Michal * SOFTWARE. 3167b40dccSKalderon, Michal */ 3267b40dccSKalderon, Michal #ifndef _QED_IWARP_H 3367b40dccSKalderon, Michal #define _QED_IWARP_H 3467b40dccSKalderon, Michal 3567b40dccSKalderon, Michal enum qed_iwarp_qp_state { 3667b40dccSKalderon, Michal QED_IWARP_QP_STATE_IDLE, 3767b40dccSKalderon, Michal QED_IWARP_QP_STATE_RTS, 3867b40dccSKalderon, Michal QED_IWARP_QP_STATE_TERMINATE, 3967b40dccSKalderon, Michal QED_IWARP_QP_STATE_CLOSING, 4067b40dccSKalderon, Michal QED_IWARP_QP_STATE_ERROR, 4167b40dccSKalderon, Michal }; 4267b40dccSKalderon, Michal 4367b40dccSKalderon, Michal enum qed_iwarp_qp_state qed_roce2iwarp_state(enum qed_roce_qp_state state); 4467b40dccSKalderon, Michal 45b5c29ca7SKalderon, Michal #define QED_IWARP_LL2_SYN_TX_SIZE (128) 46b5c29ca7SKalderon, Michal #define QED_IWARP_LL2_SYN_RX_SIZE (256) 47b5c29ca7SKalderon, Michal #define QED_IWARP_MAX_SYN_PKT_SIZE (128) 48b5c29ca7SKalderon, Michal #define QED_IWARP_HANDLE_INVAL (0xff) 49b5c29ca7SKalderon, Michal 50b5c29ca7SKalderon, Michal struct qed_iwarp_ll2_buff { 51b5c29ca7SKalderon, Michal void *data; 52b5c29ca7SKalderon, Michal dma_addr_t data_phys_addr; 53b5c29ca7SKalderon, Michal u32 buff_size; 54b5c29ca7SKalderon, Michal }; 55b5c29ca7SKalderon, Michal 5667b40dccSKalderon, Michal struct qed_iwarp_info { 5765a91a6cSKalderon, Michal struct list_head listen_list; /* qed_iwarp_listener */ 5867b40dccSKalderon, Michal spinlock_t iw_lock; /* for iwarp resources */ 5967b40dccSKalderon, Michal spinlock_t qp_lock; /* for teardown races */ 6067b40dccSKalderon, Michal u32 rcv_wnd_scale; 6167b40dccSKalderon, Michal u16 max_mtu; 6267b40dccSKalderon, Michal u8 mac_addr[ETH_ALEN]; 6367b40dccSKalderon, Michal u8 crc_needed; 6467b40dccSKalderon, Michal u8 tcp_flags; 65b5c29ca7SKalderon, Michal u8 ll2_syn_handle; 6667b40dccSKalderon, Michal u8 peer2peer; 6767b40dccSKalderon, Michal enum mpa_negotiation_mode mpa_rev; 6867b40dccSKalderon, Michal enum mpa_rtr_type rtr_type; 6967b40dccSKalderon, Michal }; 7067b40dccSKalderon, Michal 7165a91a6cSKalderon, Michal struct qed_iwarp_listener { 7265a91a6cSKalderon, Michal struct list_head list_entry; 7365a91a6cSKalderon, Michal 7465a91a6cSKalderon, Michal /* The event_cb function is called for connection requests. 7565a91a6cSKalderon, Michal * The cb_context is passed to the event_cb function. 7665a91a6cSKalderon, Michal */ 7765a91a6cSKalderon, Michal iwarp_event_handler event_cb; 7865a91a6cSKalderon, Michal void *cb_context; 7965a91a6cSKalderon, Michal u32 max_backlog; 8065a91a6cSKalderon, Michal u32 ip_addr[4]; 8165a91a6cSKalderon, Michal u16 port; 8265a91a6cSKalderon, Michal u16 vlan; 8365a91a6cSKalderon, Michal u8 ip_version; 8465a91a6cSKalderon, Michal }; 8565a91a6cSKalderon, Michal 8667b40dccSKalderon, Michal int qed_iwarp_alloc(struct qed_hwfn *p_hwfn); 8767b40dccSKalderon, Michal 8867b40dccSKalderon, Michal int qed_iwarp_setup(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, 8967b40dccSKalderon, Michal struct qed_rdma_start_in_params *params); 9067b40dccSKalderon, Michal 9167b40dccSKalderon, Michal int qed_iwarp_stop(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); 9267b40dccSKalderon, Michal 9367b40dccSKalderon, Michal void qed_iwarp_resc_free(struct qed_hwfn *p_hwfn); 9467b40dccSKalderon, Michal 9567b40dccSKalderon, Michal void qed_iwarp_init_devinfo(struct qed_hwfn *p_hwfn); 9667b40dccSKalderon, Michal 9767b40dccSKalderon, Michal void qed_iwarp_init_hw(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); 9867b40dccSKalderon, Michal 9967b40dccSKalderon, Michal int qed_iwarp_create_qp(struct qed_hwfn *p_hwfn, 10067b40dccSKalderon, Michal struct qed_rdma_qp *qp, 10167b40dccSKalderon, Michal struct qed_rdma_create_qp_out_params *out_params); 10267b40dccSKalderon, Michal 10367b40dccSKalderon, Michal int qed_iwarp_modify_qp(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp, 10467b40dccSKalderon, Michal enum qed_iwarp_qp_state new_state, bool internal); 10567b40dccSKalderon, Michal 10667b40dccSKalderon, Michal int qed_iwarp_destroy_qp(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp); 10767b40dccSKalderon, Michal 10867b40dccSKalderon, Michal int qed_iwarp_fw_destroy(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp); 10967b40dccSKalderon, Michal 11067b40dccSKalderon, Michal void qed_iwarp_query_qp(struct qed_rdma_qp *qp, 11167b40dccSKalderon, Michal struct qed_rdma_query_qp_out_params *out_params); 11267b40dccSKalderon, Michal 11365a91a6cSKalderon, Michal int 11465a91a6cSKalderon, Michal qed_iwarp_create_listen(void *rdma_cxt, 11565a91a6cSKalderon, Michal struct qed_iwarp_listen_in *iparams, 11665a91a6cSKalderon, Michal struct qed_iwarp_listen_out *oparams); 11765a91a6cSKalderon, Michal 11865a91a6cSKalderon, Michal int qed_iwarp_destroy_listen(void *rdma_cxt, void *handle); 11965a91a6cSKalderon, Michal 12067b40dccSKalderon, Michal #endif 121