Skip to content

Commit b0301a5

Browse files
committed
Merge branch 'qed-next'
Yuval Basson says: ==================== qed: Add xrc core support for RoCE This patch adds support for configuring XRC and provides the necessary APIs for rdma upper layer driver (qedr) to enable the XRC feature. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents d8bed68 + 7bfb399 commit b0301a5

File tree

7 files changed

+258
-32
lines changed

7 files changed

+258
-32
lines changed

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

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ struct src_ent {
110110
ALIGNED_TYPE_SIZE(union conn_context, p_hwfn)
111111

112112
#define SRQ_CXT_SIZE (sizeof(struct rdma_srq_context))
113+
#define XRC_SRQ_CXT_SIZE (sizeof(struct rdma_xrc_srq_context))
113114

114115
#define TYPE0_TASK_CXT_SIZE(p_hwfn) \
115116
ALIGNED_TYPE_SIZE(union type0_task_context, p_hwfn)
@@ -293,18 +294,40 @@ static struct qed_tid_seg *qed_cxt_tid_seg_info(struct qed_hwfn *p_hwfn,
293294
return NULL;
294295
}
295296

296-
static void qed_cxt_set_srq_count(struct qed_hwfn *p_hwfn, u32 num_srqs)
297+
static void qed_cxt_set_srq_count(struct qed_hwfn *p_hwfn,
298+
u32 num_srqs, u32 num_xrc_srqs)
297299
{
298300
struct qed_cxt_mngr *p_mgr = p_hwfn->p_cxt_mngr;
299301

300302
p_mgr->srq_count = num_srqs;
303+
p_mgr->xrc_srq_count = num_xrc_srqs;
301304
}
302305

303-
u32 qed_cxt_get_srq_count(struct qed_hwfn *p_hwfn)
306+
u32 qed_cxt_get_ilt_page_size(struct qed_hwfn *p_hwfn,
307+
enum ilt_clients ilt_client)
308+
{
309+
struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr;
310+
struct qed_ilt_client_cfg *p_cli = &p_mngr->clients[ilt_client];
311+
312+
return ILT_PAGE_IN_BYTES(p_cli->p_size.val);
313+
}
314+
315+
static u32 qed_cxt_xrc_srqs_per_page(struct qed_hwfn *p_hwfn)
316+
{
317+
u32 page_size;
318+
319+
page_size = qed_cxt_get_ilt_page_size(p_hwfn, ILT_CLI_TSDM);
320+
return page_size / XRC_SRQ_CXT_SIZE;
321+
}
322+
323+
u32 qed_cxt_get_total_srq_count(struct qed_hwfn *p_hwfn)
304324
{
305325
struct qed_cxt_mngr *p_mgr = p_hwfn->p_cxt_mngr;
326+
u32 total_srqs;
327+
328+
total_srqs = p_mgr->srq_count + p_mgr->xrc_srq_count;
306329

307-
return p_mgr->srq_count;
330+
return total_srqs;
308331
}
309332

310333
/* set the iids count per protocol */
@@ -692,7 +715,7 @@ int qed_cxt_cfg_ilt_compute(struct qed_hwfn *p_hwfn, u32 *line_count)
692715
}
693716

694717
/* TSDM (SRQ CONTEXT) */
695-
total = qed_cxt_get_srq_count(p_hwfn);
718+
total = qed_cxt_get_total_srq_count(p_hwfn);
696719

697720
if (total) {
698721
p_cli = qed_cxt_set_cli(&p_mngr->clients[ILT_CLI_TSDM]);
@@ -1962,11 +1985,9 @@ static void qed_rdma_set_pf_params(struct qed_hwfn *p_hwfn,
19621985
struct qed_rdma_pf_params *p_params,
19631986
u32 num_tasks)
19641987
{
1965-
u32 num_cons, num_qps, num_srqs;
1988+
u32 num_cons, num_qps;
19661989
enum protocol_type proto;
19671990

1968-
num_srqs = min_t(u32, QED_RDMA_MAX_SRQS, p_params->num_srqs);
1969-
19701991
if (p_hwfn->mcp_info->func_info.protocol == QED_PCI_ETH_RDMA) {
19711992
DP_NOTICE(p_hwfn,
19721993
"Current day drivers don't support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only\n");
@@ -1989,6 +2010,8 @@ static void qed_rdma_set_pf_params(struct qed_hwfn *p_hwfn,
19892010
}
19902011

19912012
if (num_cons && num_tasks) {
2013+
u32 num_srqs, num_xrc_srqs;
2014+
19922015
qed_cxt_set_proto_cid_count(p_hwfn, proto, num_cons, 0);
19932016

19942017
/* Deliberatly passing ROCE for tasks id. This is because
@@ -1997,7 +2020,13 @@ static void qed_rdma_set_pf_params(struct qed_hwfn *p_hwfn,
19972020
qed_cxt_set_proto_tid_count(p_hwfn, PROTOCOLID_ROCE,
19982021
QED_CXT_ROCE_TID_SEG, 1,
19992022
num_tasks, false);
2000-
qed_cxt_set_srq_count(p_hwfn, num_srqs);
2023+
2024+
num_srqs = min_t(u32, QED_RDMA_MAX_SRQS, p_params->num_srqs);
2025+
2026+
/* XRC SRQs populate a single ILT page */
2027+
num_xrc_srqs = qed_cxt_xrc_srqs_per_page(p_hwfn);
2028+
2029+
qed_cxt_set_srq_count(p_hwfn, num_srqs, num_xrc_srqs);
20012030
} else {
20022031
DP_INFO(p_hwfn->cdev,
20032032
"RDMA personality used without setting params!\n");
@@ -2163,10 +2192,17 @@ qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn,
21632192
p_blk = &p_cli->pf_blks[CDUC_BLK];
21642193
break;
21652194
case QED_ELEM_SRQ:
2195+
/* The first ILT page is not used for regular SRQs. Skip it. */
2196+
iid += p_hwfn->p_cxt_mngr->xrc_srq_count;
21662197
p_cli = &p_hwfn->p_cxt_mngr->clients[ILT_CLI_TSDM];
21672198
elem_size = SRQ_CXT_SIZE;
21682199
p_blk = &p_cli->pf_blks[SRQ_BLK];
21692200
break;
2201+
case QED_ELEM_XRC_SRQ:
2202+
p_cli = &p_hwfn->p_cxt_mngr->clients[ILT_CLI_TSDM];
2203+
elem_size = XRC_SRQ_CXT_SIZE;
2204+
p_blk = &p_cli->pf_blks[SRQ_BLK];
2205+
break;
21702206
case QED_ELEM_TASK:
21712207
p_cli = &p_hwfn->p_cxt_mngr->clients[ILT_CLI_CDUT];
21722208
elem_size = TYPE1_TASK_CXT_SIZE(p_hwfn);
@@ -2386,8 +2422,12 @@ int qed_cxt_free_proto_ilt(struct qed_hwfn *p_hwfn, enum protocol_type proto)
23862422
return rc;
23872423

23882424
/* Free TSDM CXT */
2389-
rc = qed_cxt_free_ilt_range(p_hwfn, QED_ELEM_SRQ, 0,
2390-
qed_cxt_get_srq_count(p_hwfn));
2425+
rc = qed_cxt_free_ilt_range(p_hwfn, QED_ELEM_XRC_SRQ, 0,
2426+
p_hwfn->p_cxt_mngr->xrc_srq_count);
2427+
2428+
rc = qed_cxt_free_ilt_range(p_hwfn, QED_ELEM_SRQ,
2429+
p_hwfn->p_cxt_mngr->xrc_srq_count,
2430+
p_hwfn->p_cxt_mngr->srq_count);
23912431

23922432
return rc;
23932433
}

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ int qed_cxt_get_tid_mem_info(struct qed_hwfn *p_hwfn,
8282
enum qed_cxt_elem_type {
8383
QED_ELEM_CXT,
8484
QED_ELEM_SRQ,
85-
QED_ELEM_TASK
85+
QED_ELEM_TASK,
86+
QED_ELEM_XRC_SRQ,
8687
};
8788

8889
u32 qed_cxt_get_proto_cid_count(struct qed_hwfn *p_hwfn,
@@ -235,7 +236,6 @@ u32 qed_cxt_get_proto_tid_count(struct qed_hwfn *p_hwfn,
235236
enum protocol_type type);
236237
u32 qed_cxt_get_proto_cid_start(struct qed_hwfn *p_hwfn,
237238
enum protocol_type type);
238-
u32 qed_cxt_get_srq_count(struct qed_hwfn *p_hwfn);
239239
int qed_cxt_free_proto_ilt(struct qed_hwfn *p_hwfn, enum protocol_type proto);
240240

241241
#define QED_CTX_WORKING_MEM 0
@@ -358,6 +358,7 @@ struct qed_cxt_mngr {
358358

359359
/* total number of SRQ's for this hwfn */
360360
u32 srq_count;
361+
u32 xrc_srq_count;
361362

362363
/* Maximal number of L2 steering filters */
363364
u32 arfs_count;
@@ -372,4 +373,9 @@ u16 qed_get_cdut_num_vf_init_pages(struct qed_hwfn *p_hwfn);
372373
u16 qed_get_cdut_num_pf_work_pages(struct qed_hwfn *p_hwfn);
373374
u16 qed_get_cdut_num_vf_work_pages(struct qed_hwfn *p_hwfn);
374375

376+
u32 qed_cxt_get_ilt_page_size(struct qed_hwfn *p_hwfn,
377+
enum ilt_clients ilt_client);
378+
379+
u32 qed_cxt_get_total_srq_count(struct qed_hwfn *p_hwfn);
380+
375381
#endif

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2269,6 +2269,7 @@ int qed_resc_alloc(struct qed_dev *cdev)
22692269
/* EQ */
22702270
n_eqes = qed_chain_get_capacity(&p_hwfn->p_spq->chain);
22712271
if (QED_IS_RDMA_PERSONALITY(p_hwfn)) {
2272+
u32 n_srq = qed_cxt_get_total_srq_count(p_hwfn);
22722273
enum protocol_type rdma_proto;
22732274

22742275
if (QED_IS_ROCE_PERSONALITY(p_hwfn))
@@ -2279,7 +2280,10 @@ int qed_resc_alloc(struct qed_dev *cdev)
22792280
num_cons = qed_cxt_get_proto_cid_count(p_hwfn,
22802281
rdma_proto,
22812282
NULL) * 2;
2282-
n_eqes += num_cons + 2 * MAX_NUM_VFS_BB;
2283+
/* EQ should be able to get events from all SRQ's
2284+
* at the same time
2285+
*/
2286+
n_eqes += num_cons + 2 * MAX_NUM_VFS_BB + n_srq;
22832287
} else if (p_hwfn->hw_info.personality == QED_PCI_ISCSI) {
22842288
num_cons =
22852289
qed_cxt_get_proto_cid_count(p_hwfn,

0 commit comments

Comments
 (0)