Skip to content

Commit d1abfd0

Browse files
mkalderondavem330
authored andcommitted
qed: Add iWARP out of order support
iWARP requires OOO support which is already provided by the ll2 interface (until now was used only for iSCSI offload). The changes mostly include opening a ll2 dedicated connection for OOO and notifiying the FW about the handle id. Signed-off-by: Michal Kalderon <[email protected]> Signed-off-by: Ariel Elior <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e0a8f9d commit d1abfd0

File tree

3 files changed

+59
-3
lines changed

3 files changed

+59
-3
lines changed

drivers/net/ethernet/qlogic/qed/qed_iwarp.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "qed_rdma.h"
4242
#include "qed_reg_addr.h"
4343
#include "qed_sp.h"
44+
#include "qed_ooo.h"
4445

4546
#define QED_IWARP_ORD_DEFAULT 32
4647
#define QED_IWARP_IRD_DEFAULT 32
@@ -119,6 +120,13 @@ static void qed_iwarp_cid_cleaned(struct qed_hwfn *p_hwfn, u32 cid)
119120
spin_unlock_bh(&p_hwfn->p_rdma_info->lock);
120121
}
121122

123+
void qed_iwarp_init_fw_ramrod(struct qed_hwfn *p_hwfn,
124+
struct iwarp_init_func_params *p_ramrod)
125+
{
126+
p_ramrod->ll2_ooo_q_index = RESC_START(p_hwfn, QED_LL2_QUEUE) +
127+
p_hwfn->p_rdma_info->iwarp.ll2_ooo_handle;
128+
}
129+
122130
static int qed_iwarp_alloc_cid(struct qed_hwfn *p_hwfn, u32 *cid)
123131
{
124132
int rc;
@@ -1876,6 +1884,16 @@ static int qed_iwarp_ll2_stop(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
18761884
iwarp_info->ll2_syn_handle = QED_IWARP_HANDLE_INVAL;
18771885
}
18781886

1887+
if (iwarp_info->ll2_ooo_handle != QED_IWARP_HANDLE_INVAL) {
1888+
rc = qed_ll2_terminate_connection(p_hwfn,
1889+
iwarp_info->ll2_ooo_handle);
1890+
if (rc)
1891+
DP_INFO(p_hwfn, "Failed to terminate ooo connection\n");
1892+
1893+
qed_ll2_release_connection(p_hwfn, iwarp_info->ll2_ooo_handle);
1894+
iwarp_info->ll2_ooo_handle = QED_IWARP_HANDLE_INVAL;
1895+
}
1896+
18791897
qed_llh_remove_mac_filter(p_hwfn,
18801898
p_ptt, p_hwfn->p_rdma_info->iwarp.mac_addr);
18811899
return rc;
@@ -1927,10 +1945,12 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
19271945
struct qed_iwarp_info *iwarp_info;
19281946
struct qed_ll2_acquire_data data;
19291947
struct qed_ll2_cbs cbs;
1948+
u16 n_ooo_bufs;
19301949
int rc = 0;
19311950

19321951
iwarp_info = &p_hwfn->p_rdma_info->iwarp;
19331952
iwarp_info->ll2_syn_handle = QED_IWARP_HANDLE_INVAL;
1953+
iwarp_info->ll2_ooo_handle = QED_IWARP_HANDLE_INVAL;
19341954

19351955
iwarp_info->max_mtu = params->max_mtu;
19361956

@@ -1978,6 +1998,29 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
19781998
if (rc)
19791999
goto err;
19802000

2001+
/* Start OOO connection */
2002+
data.input.conn_type = QED_LL2_TYPE_OOO;
2003+
data.input.mtu = params->max_mtu;
2004+
2005+
n_ooo_bufs = (QED_IWARP_MAX_OOO * QED_IWARP_RCV_WND_SIZE_DEF) /
2006+
iwarp_info->max_mtu;
2007+
n_ooo_bufs = min_t(u32, n_ooo_bufs, QED_IWARP_LL2_OOO_MAX_RX_SIZE);
2008+
2009+
data.input.rx_num_desc = n_ooo_bufs;
2010+
data.input.rx_num_ooo_buffers = n_ooo_bufs;
2011+
2012+
data.input.tx_max_bds_per_packet = 1; /* will never be fragmented */
2013+
data.input.tx_num_desc = QED_IWARP_LL2_OOO_DEF_TX_SIZE;
2014+
data.p_connection_handle = &iwarp_info->ll2_ooo_handle;
2015+
2016+
rc = qed_ll2_acquire_connection(p_hwfn, &data);
2017+
if (rc)
2018+
goto err;
2019+
2020+
rc = qed_ll2_establish_connection(p_hwfn, iwarp_info->ll2_ooo_handle);
2021+
if (rc)
2022+
goto err;
2023+
19812024
return rc;
19822025
err:
19832026
qed_iwarp_ll2_stop(p_hwfn, p_ptt);
@@ -2014,6 +2057,7 @@ int qed_iwarp_setup(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
20142057

20152058
qed_spq_register_async_cb(p_hwfn, PROTOCOLID_IWARP,
20162059
qed_iwarp_async_event);
2060+
qed_ooo_setup(p_hwfn);
20172061

20182062
return qed_iwarp_ll2_start(p_hwfn, params, p_ptt);
20192063
}

drivers/net/ethernet/qlogic/qed/qed_iwarp.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ enum qed_iwarp_qp_state qed_roce2iwarp_state(enum qed_roce_qp_state state);
4747
#define QED_IWARP_LL2_SYN_TX_SIZE (128)
4848
#define QED_IWARP_LL2_SYN_RX_SIZE (256)
4949
#define QED_IWARP_MAX_SYN_PKT_SIZE (128)
50-
#define QED_IWARP_HANDLE_INVAL (0xff)
50+
51+
#define QED_IWARP_LL2_OOO_DEF_TX_SIZE (256)
52+
#define QED_IWARP_MAX_OOO (16)
53+
#define QED_IWARP_LL2_OOO_MAX_RX_SIZE (16384)
54+
55+
#define QED_IWARP_HANDLE_INVAL (0xff)
5156

5257
struct qed_iwarp_ll2_buff {
5358
void *data;
@@ -67,6 +72,7 @@ struct qed_iwarp_info {
6772
u8 crc_needed;
6873
u8 tcp_flags;
6974
u8 ll2_syn_handle;
75+
u8 ll2_ooo_handle;
7076
u8 peer2peer;
7177
enum mpa_negotiation_mode mpa_rev;
7278
enum mpa_rtr_type rtr_type;
@@ -147,6 +153,9 @@ int qed_iwarp_alloc(struct qed_hwfn *p_hwfn);
147153
int qed_iwarp_setup(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
148154
struct qed_rdma_start_in_params *params);
149155

156+
void qed_iwarp_init_fw_ramrod(struct qed_hwfn *p_hwfn,
157+
struct iwarp_init_func_params *p_ramrod);
158+
150159
int qed_iwarp_stop(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
151160

152161
void qed_iwarp_resc_free(struct qed_hwfn *p_hwfn);

drivers/net/ethernet/qlogic/qed/qed_rdma.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,10 +551,13 @@ static int qed_rdma_start_fw(struct qed_hwfn *p_hwfn,
551551
if (rc)
552552
return rc;
553553

554-
if (QED_IS_IWARP_PERSONALITY(p_hwfn))
554+
if (QED_IS_IWARP_PERSONALITY(p_hwfn)) {
555+
qed_iwarp_init_fw_ramrod(p_hwfn,
556+
&p_ent->ramrod.iwarp_init_func.iwarp);
555557
p_ramrod = &p_ent->ramrod.iwarp_init_func.rdma;
556-
else
558+
} else {
557559
p_ramrod = &p_ent->ramrod.roce_init_func.rdma;
560+
}
558561

559562
p_params_header = &p_ramrod->params_header;
560563
p_params_header->cnq_start_offset = (u8)RESC_START(p_hwfn,

0 commit comments

Comments
 (0)