summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/qlogic/qed/qed_iwarp.h
blob: 068b8594f1c500667585c4b326da62aaa841d5d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* QLogic qed NIC Driver
 * Copyright (c) 2015-2017  QLogic Corporation
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and /or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
#ifndef _QED_IWARP_H
#define _QED_IWARP_H

enum qed_iwarp_qp_state {
	QED_IWARP_QP_STATE_IDLE,
	QED_IWARP_QP_STATE_RTS,
	QED_IWARP_QP_STATE_TERMINATE,
	QED_IWARP_QP_STATE_CLOSING,
	QED_IWARP_QP_STATE_ERROR,
};

enum qed_iwarp_qp_state qed_roce2iwarp_state(enum qed_roce_qp_state state);

#define QED_IWARP_LL2_SYN_TX_SIZE       (128)
#define QED_IWARP_LL2_SYN_RX_SIZE       (256)
#define QED_IWARP_MAX_SYN_PKT_SIZE      (128)
#define QED_IWARP_HANDLE_INVAL			(0xff)

struct qed_iwarp_ll2_buff {
	void *data;
	dma_addr_t data_phys_addr;
	u32 buff_size;
};

struct qed_iwarp_info {
	spinlock_t iw_lock;	/* for iwarp resources */
	spinlock_t qp_lock;	/* for teardown races */
	u32 rcv_wnd_scale;
	u16 max_mtu;
	u8 mac_addr[ETH_ALEN];
	u8 crc_needed;
	u8 tcp_flags;
	u8 ll2_syn_handle;
	u8 peer2peer;
	enum mpa_negotiation_mode mpa_rev;
	enum mpa_rtr_type rtr_type;
};

int qed_iwarp_alloc(struct qed_hwfn *p_hwfn);

int qed_iwarp_setup(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
		    struct qed_rdma_start_in_params *params);

int qed_iwarp_stop(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);

void qed_iwarp_resc_free(struct qed_hwfn *p_hwfn);

void qed_iwarp_init_devinfo(struct qed_hwfn *p_hwfn);

void qed_iwarp_init_hw(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);

int qed_iwarp_create_qp(struct qed_hwfn *p_hwfn,
			struct qed_rdma_qp *qp,
			struct qed_rdma_create_qp_out_params *out_params);

int qed_iwarp_modify_qp(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp,
			enum qed_iwarp_qp_state new_state, bool internal);

int qed_iwarp_destroy_qp(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp);

int qed_iwarp_fw_destroy(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp);

void qed_iwarp_query_qp(struct qed_rdma_qp *qp,
			struct qed_rdma_query_qp_out_params *out_params);

#endif