Skip to content

Commit 5b2ef20

Browse files
committed
Merge branch 'qed-iWARP-fixes-and-enhancements'
Michal Kalderon says: ==================== qed: iWARP fixes and enhancements This patch series includes several fixes and enhancements related to iWARP. Patch #1 is actually the last of the initial iWARP submission. It has been delayed until now as I wanted to make sure that qedr supports iWARP prior to enabling iWARP device detection. iWARP changes in RDMA tree have been accepted and targeted at kernel 4.15, therefore, all iWARP fixes for this cycle are submitted to net-next. Changes from v1->v2 - Added "Fixes:" tag to commit message of patch #3 ==================== Signed-off by: [email protected] Signed-off-by: Ariel Elior <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2 parents 2091c22 + 1e99c49 commit 5b2ef20

File tree

8 files changed

+90
-14
lines changed

8 files changed

+90
-14
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,6 +2069,12 @@ static void qed_rdma_set_pf_params(struct qed_hwfn *p_hwfn,
20692069

20702070
num_srqs = min_t(u32, 32 * 1024, p_params->num_srqs);
20712071

2072+
if (p_hwfn->mcp_info->func_info.protocol == QED_PCI_ETH_RDMA) {
2073+
DP_NOTICE(p_hwfn,
2074+
"Current day drivers don't support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only\n");
2075+
p_hwfn->hw_info.personality = QED_PCI_ETH_ROCE;
2076+
}
2077+
20722078
switch (p_hwfn->hw_info.personality) {
20732079
case QED_PCI_ETH_IWARP:
20742080
/* Each QP requires one connection */

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

Lines changed: 52 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;
@@ -1725,6 +1733,14 @@ qed_iwarp_ll2_comp_syn_pkt(void *cxt, struct qed_ll2_comp_rx_data *data)
17251733

17261734
memset(&cm_info, 0, sizeof(cm_info));
17271735
ll2_syn_handle = p_hwfn->p_rdma_info->iwarp.ll2_syn_handle;
1736+
1737+
/* Check if packet was received with errors... */
1738+
if (data->err_flags) {
1739+
DP_NOTICE(p_hwfn, "Error received on SYN packet: 0x%x\n",
1740+
data->err_flags);
1741+
goto err;
1742+
}
1743+
17281744
if (GET_FIELD(data->parse_flags,
17291745
PARSING_AND_ERR_FLAGS_L4CHKSMWASCALCULATED) &&
17301746
GET_FIELD(data->parse_flags, PARSING_AND_ERR_FLAGS_L4CHKSMERROR)) {
@@ -1876,6 +1892,16 @@ static int qed_iwarp_ll2_stop(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
18761892
iwarp_info->ll2_syn_handle = QED_IWARP_HANDLE_INVAL;
18771893
}
18781894

1895+
if (iwarp_info->ll2_ooo_handle != QED_IWARP_HANDLE_INVAL) {
1896+
rc = qed_ll2_terminate_connection(p_hwfn,
1897+
iwarp_info->ll2_ooo_handle);
1898+
if (rc)
1899+
DP_INFO(p_hwfn, "Failed to terminate ooo connection\n");
1900+
1901+
qed_ll2_release_connection(p_hwfn, iwarp_info->ll2_ooo_handle);
1902+
iwarp_info->ll2_ooo_handle = QED_IWARP_HANDLE_INVAL;
1903+
}
1904+
18791905
qed_llh_remove_mac_filter(p_hwfn,
18801906
p_ptt, p_hwfn->p_rdma_info->iwarp.mac_addr);
18811907
return rc;
@@ -1927,10 +1953,12 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
19271953
struct qed_iwarp_info *iwarp_info;
19281954
struct qed_ll2_acquire_data data;
19291955
struct qed_ll2_cbs cbs;
1956+
u16 n_ooo_bufs;
19301957
int rc = 0;
19311958

19321959
iwarp_info = &p_hwfn->p_rdma_info->iwarp;
19331960
iwarp_info->ll2_syn_handle = QED_IWARP_HANDLE_INVAL;
1961+
iwarp_info->ll2_ooo_handle = QED_IWARP_HANDLE_INVAL;
19341962

19351963
iwarp_info->max_mtu = params->max_mtu;
19361964

@@ -1978,6 +2006,29 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
19782006
if (rc)
19792007
goto err;
19802008

2009+
/* Start OOO connection */
2010+
data.input.conn_type = QED_LL2_TYPE_OOO;
2011+
data.input.mtu = params->max_mtu;
2012+
2013+
n_ooo_bufs = (QED_IWARP_MAX_OOO * QED_IWARP_RCV_WND_SIZE_DEF) /
2014+
iwarp_info->max_mtu;
2015+
n_ooo_bufs = min_t(u32, n_ooo_bufs, QED_IWARP_LL2_OOO_MAX_RX_SIZE);
2016+
2017+
data.input.rx_num_desc = n_ooo_bufs;
2018+
data.input.rx_num_ooo_buffers = n_ooo_bufs;
2019+
2020+
data.input.tx_max_bds_per_packet = 1; /* will never be fragmented */
2021+
data.input.tx_num_desc = QED_IWARP_LL2_OOO_DEF_TX_SIZE;
2022+
data.p_connection_handle = &iwarp_info->ll2_ooo_handle;
2023+
2024+
rc = qed_ll2_acquire_connection(p_hwfn, &data);
2025+
if (rc)
2026+
goto err;
2027+
2028+
rc = qed_ll2_establish_connection(p_hwfn, iwarp_info->ll2_ooo_handle);
2029+
if (rc)
2030+
goto err;
2031+
19812032
return rc;
19822033
err:
19832034
qed_iwarp_ll2_stop(p_hwfn, p_ptt);
@@ -2014,6 +2065,7 @@ int qed_iwarp_setup(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
20142065

20152066
qed_spq_register_async_cb(p_hwfn, PROTOCOLID_IWARP,
20162067
qed_iwarp_async_event);
2068+
qed_ooo_setup(p_hwfn);
20172069

20182070
return qed_iwarp_ll2_start(p_hwfn, params, p_ptt);
20192071
}

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_ll2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ static void qed_ll2_rxq_parse_reg(struct qed_hwfn *p_hwfn,
413413
struct qed_ll2_comp_rx_data *data)
414414
{
415415
data->parse_flags = le16_to_cpu(p_cqe->rx_cqe_fp.parse_flags.flags);
416+
data->err_flags = le16_to_cpu(p_cqe->rx_cqe_fp.err_flags.flags);
416417
data->length.packet_length =
417418
le16_to_cpu(p_cqe->rx_cqe_fp.packet_length);
418419
data->vlan = le16_to_cpu(p_cqe->rx_cqe_fp.vlan);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,12 +1691,12 @@ qed_mcp_get_shmem_proto_mfw(struct qed_hwfn *p_hwfn,
16911691
case FW_MB_PARAM_GET_PF_RDMA_ROCE:
16921692
*p_proto = QED_PCI_ETH_ROCE;
16931693
break;
1694+
case FW_MB_PARAM_GET_PF_RDMA_IWARP:
1695+
*p_proto = QED_PCI_ETH_IWARP;
1696+
break;
16941697
case FW_MB_PARAM_GET_PF_RDMA_BOTH:
1695-
DP_NOTICE(p_hwfn,
1696-
"Current day drivers don't support RoCE & iWARP. Default to RoCE-only\n");
1697-
*p_proto = QED_PCI_ETH_ROCE;
1698+
*p_proto = QED_PCI_ETH_RDMA;
16981699
break;
1699-
case FW_MB_PARAM_GET_PF_RDMA_IWARP:
17001700
default:
17011701
DP_NOTICE(p_hwfn,
17021702
"MFW answers GET_PF_RDMA_PROTOCOL but param is %08x\n",

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ static int qed_rdma_alloc(struct qed_hwfn *p_hwfn,
156156
return rc;
157157

158158
p_hwfn->p_rdma_info = p_rdma_info;
159-
p_rdma_info->proto = PROTOCOLID_ROCE;
159+
if (QED_IS_IWARP_PERSONALITY(p_hwfn))
160+
p_rdma_info->proto = PROTOCOLID_IWARP;
161+
else
162+
p_rdma_info->proto = PROTOCOLID_ROCE;
160163

161164
num_cons = qed_cxt_get_proto_cid_count(p_hwfn, p_rdma_info->proto,
162165
NULL);
@@ -206,11 +209,11 @@ static int qed_rdma_alloc(struct qed_hwfn *p_hwfn,
206209
goto free_pd_map;
207210
}
208211

209-
/* Allocate bitmap for cq's. The maximum number of CQs is bounded to
210-
* twice the number of QPs.
212+
/* Allocate bitmap for cq's. The maximum number of CQs is bound to
213+
* the number of connections we support. (num_qps in iWARP or
214+
* num_qps/2 in RoCE).
211215
*/
212-
rc = qed_rdma_bmap_alloc(p_hwfn, &p_rdma_info->cq_map,
213-
p_rdma_info->num_qps * 2, "CQ");
216+
rc = qed_rdma_bmap_alloc(p_hwfn, &p_rdma_info->cq_map, num_cons, "CQ");
214217
if (rc) {
215218
DP_VERBOSE(p_hwfn, QED_MSG_RDMA,
216219
"Failed to allocate cq bitmap, rc = %d\n", rc);
@@ -219,10 +222,10 @@ static int qed_rdma_alloc(struct qed_hwfn *p_hwfn,
219222

220223
/* Allocate bitmap for toggle bit for cq icids
221224
* We toggle the bit every time we create or resize cq for a given icid.
222-
* The maximum number of CQs is bounded to twice the number of QPs.
225+
* Size needs to equal the size of the cq bmap.
223226
*/
224227
rc = qed_rdma_bmap_alloc(p_hwfn, &p_rdma_info->toggle_bits,
225-
p_rdma_info->num_qps * 2, "Toggle");
228+
num_cons, "Toggle");
226229
if (rc) {
227230
DP_VERBOSE(p_hwfn, QED_MSG_RDMA,
228231
"Failed to allocate toogle bits, rc = %d\n", rc);
@@ -548,10 +551,13 @@ static int qed_rdma_start_fw(struct qed_hwfn *p_hwfn,
548551
if (rc)
549552
return rc;
550553

551-
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);
552557
p_ramrod = &p_ent->ramrod.iwarp_init_func.rdma;
553-
else
558+
} else {
554559
p_ramrod = &p_ent->ramrod.roce_init_func.rdma;
560+
}
555561

556562
p_params_header = &p_ramrod->params_header;
557563
p_params_header->cnq_start_offset = (u8)RESC_START(p_hwfn,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ int qed_sp_pf_start(struct qed_hwfn *p_hwfn,
377377
p_ramrod->personality = PERSONALITY_ISCSI;
378378
break;
379379
case QED_PCI_ETH_ROCE:
380+
case QED_PCI_ETH_IWARP:
380381
p_ramrod->personality = PERSONALITY_RDMA_AND_ETH;
381382
break;
382383
default:

include/linux/qed/qed_ll2_if.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ struct qed_ll2_comp_rx_data {
101101
void *cookie;
102102
dma_addr_t rx_buf_addr;
103103
u16 parse_flags;
104+
u16 err_flags;
104105
u16 vlan;
105106
bool b_last_packet;
106107
u8 connection_handle;

0 commit comments

Comments
 (0)