Skip to content

Commit 0189efb

Browse files
Yuval Mintzdavem330
authored andcommitted
qed*: Fix Kconfig dependencies with INFINIBAND_QEDR
The qedr driver would require a tristate Kconfig option [to allow it to compile as a module], and toward that end we've added the INFINIBAND_QEDR option. But as we've made the compilation of the qed/qede infrastructure required for RoCE dependent on the option we'd be facing linking difficulties in case that QED=y or QEDE=y, and INFINIBAND_QEDR=m. To resolve this, we seperate between the INFINIBAND_QEDR option and the infrastructure support in qed/qede by introducing a new QED_RDMA option which would be selected by INFINIBAND_QEDR but would be a boolean instead of a tristate; Following that, the qed/qede is fixed based on this new option so that all config combinations would be supported. Fixes: cee9fbd ("qede: add qedr framework") Reported-by: Arnd Bergmann <[email protected]> Signed-off-by: Yuval Mintz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ce6b04e commit 0189efb

File tree

12 files changed

+120
-130
lines changed

12 files changed

+120
-130
lines changed

drivers/net/ethernet/qlogic/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,14 @@ config QEDE
107107
---help---
108108
This enables the support for ...
109109

110+
config QED_RDMA
111+
bool
112+
110113
config INFINIBAND_QEDR
111114
tristate "QLogic qede RoCE sources [debug]"
112115
depends on QEDE && 64BIT
113116
select QED_LL2
117+
select QED_RDMA
114118
default n
115119
---help---
116120
This provides a temporary node that allows the compilation

drivers/net/ethernet/qlogic/qed/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ qed-y := qed_cxt.o qed_dev.o qed_hw.o qed_init_fw_funcs.o qed_init_ops.o \
55
qed_selftest.o qed_dcbx.o qed_debug.o
66
qed-$(CONFIG_QED_SRIOV) += qed_sriov.o qed_vf.o
77
qed-$(CONFIG_QED_LL2) += qed_ll2.o
8-
qed-$(CONFIG_INFINIBAND_QEDR) += qed_roce.o
8+
qed-$(CONFIG_QED_RDMA) += qed_roce.o

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,8 @@
4747
#define TM_ALIGN BIT(TM_SHIFT)
4848
#define TM_ELEM_SIZE 4
4949

50-
/* ILT constants */
51-
#if IS_ENABLED(CONFIG_INFINIBAND_QEDR)
5250
/* For RoCE we configure to 64K to cover for RoCE max tasks 256K purpose. */
53-
#define ILT_DEFAULT_HW_P_SIZE 4
54-
#else
55-
#define ILT_DEFAULT_HW_P_SIZE 3
56-
#endif
51+
#define ILT_DEFAULT_HW_P_SIZE (IS_ENABLED(CONFIG_QED_RDMA) ? 4 : 3)
5752

5853
#define ILT_PAGE_IN_BYTES(hw_p_size) (1U << ((hw_p_size) + 12))
5954
#define ILT_CFG_REG(cli, reg) PSWRQ2_REG_ ## cli ## _ ## reg ## _RT_OFFSET

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,19 +1422,19 @@ static void qed_hw_set_feat(struct qed_hwfn *p_hwfn)
14221422
u32 *feat_num = p_hwfn->hw_info.feat_num;
14231423
int num_features = 1;
14241424

1425-
#if IS_ENABLED(CONFIG_INFINIBAND_QEDR)
1426-
/* Roce CNQ each requires: 1 status block + 1 CNQ. We divide the
1427-
* status blocks equally between L2 / RoCE but with consideration as
1428-
* to how many l2 queues / cnqs we have
1429-
*/
1430-
if (p_hwfn->hw_info.personality == QED_PCI_ETH_ROCE) {
1425+
if (IS_ENABLED(CONFIG_QED_RDMA) &&
1426+
p_hwfn->hw_info.personality == QED_PCI_ETH_ROCE) {
1427+
/* Roce CNQ each requires: 1 status block + 1 CNQ. We divide
1428+
* the status blocks equally between L2 / RoCE but with
1429+
* consideration as to how many l2 queues / cnqs we have.
1430+
*/
14311431
num_features++;
14321432

14331433
feat_num[QED_RDMA_CNQ] =
14341434
min_t(u32, RESC_NUM(p_hwfn, QED_SB) / num_features,
14351435
RESC_NUM(p_hwfn, QED_RDMA_CNQ_RAM));
14361436
}
1437-
#endif
1437+
14381438
feat_num[QED_PF_L2_QUE] = min_t(u32, RESC_NUM(p_hwfn, QED_SB) /
14391439
num_features,
14401440
RESC_NUM(p_hwfn, QED_L2_QUEUE));

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "qed_mcp.h"
3939
#include "qed_reg_addr.h"
4040
#include "qed_sp.h"
41+
#include "qed_roce.h"
4142

4243
#define QED_LL2_RX_REGISTERED(ll2) ((ll2)->rx_queue.b_cb_registred)
4344
#define QED_LL2_TX_REGISTERED(ll2) ((ll2)->tx_queue.b_cb_registred)

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -293,24 +293,4 @@ void qed_ll2_setup(struct qed_hwfn *p_hwfn,
293293
*/
294294
void qed_ll2_free(struct qed_hwfn *p_hwfn,
295295
struct qed_ll2_info *p_ll2_connections);
296-
void qed_ll2b_complete_rx_gsi_packet(struct qed_hwfn *p_hwfn,
297-
u8 connection_handle,
298-
void *cookie,
299-
dma_addr_t rx_buf_addr,
300-
u16 data_length,
301-
u8 data_length_error,
302-
u16 parse_flags,
303-
u16 vlan,
304-
u32 src_mac_addr_hi,
305-
u16 src_mac_addr_lo, bool b_last_packet);
306-
void qed_ll2b_complete_tx_gsi_packet(struct qed_hwfn *p_hwfn,
307-
u8 connection_handle,
308-
void *cookie,
309-
dma_addr_t first_frag_addr,
310-
bool b_last_fragment, bool b_last_packet);
311-
void qed_ll2b_release_tx_gsi_packet(struct qed_hwfn *p_hwfn,
312-
u8 connection_handle,
313-
void *cookie,
314-
dma_addr_t first_frag_addr,
315-
bool b_last_fragment, bool b_last_packet);
316296
#endif

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@
3333
#include "qed_hw.h"
3434
#include "qed_selftest.h"
3535

36-
#if IS_ENABLED(CONFIG_INFINIBAND_QEDR)
3736
#define QED_ROCE_QPS (8192)
3837
#define QED_ROCE_DPIS (8)
39-
#endif
4038

4139
static char version[] =
4240
"QLogic FastLinQ 4xxxx Core Module qed " DRV_MODULE_VERSION "\n";
@@ -682,9 +680,7 @@ static int qed_slowpath_setup_int(struct qed_dev *cdev,
682680
enum qed_int_mode int_mode)
683681
{
684682
struct qed_sb_cnt_info sb_cnt_info;
685-
#if IS_ENABLED(CONFIG_INFINIBAND_QEDR)
686-
int num_l2_queues;
687-
#endif
683+
int num_l2_queues = 0;
688684
int rc;
689685
int i;
690686

@@ -715,8 +711,9 @@ static int qed_slowpath_setup_int(struct qed_dev *cdev,
715711
cdev->int_params.fp_msix_cnt = cdev->int_params.out.num_vectors -
716712
cdev->num_hwfns;
717713

718-
#if IS_ENABLED(CONFIG_INFINIBAND_QEDR)
719-
num_l2_queues = 0;
714+
if (!IS_ENABLED(CONFIG_QED_RDMA))
715+
return 0;
716+
720717
for_each_hwfn(cdev, i)
721718
num_l2_queues += FEAT_NUM(&cdev->hwfns[i], QED_PF_L2_QUE);
722719

@@ -738,7 +735,6 @@ static int qed_slowpath_setup_int(struct qed_dev *cdev,
738735
DP_VERBOSE(cdev, QED_MSG_RDMA, "roce_msix_cnt=%d roce_msix_base=%d\n",
739736
cdev->int_params.rdma_msix_cnt,
740737
cdev->int_params.rdma_msix_base);
741-
#endif
742738

743739
return 0;
744740
}
@@ -843,18 +839,20 @@ static void qed_update_pf_params(struct qed_dev *cdev,
843839
{
844840
int i;
845841

846-
#if IS_ENABLED(CONFIG_INFINIBAND_QEDR)
847-
params->rdma_pf_params.num_qps = QED_ROCE_QPS;
848-
params->rdma_pf_params.min_dpis = QED_ROCE_DPIS;
849-
/* divide by 3 the MRs to avoid MF ILT overflow */
850-
params->rdma_pf_params.num_mrs = RDMA_MAX_TIDS;
851-
params->rdma_pf_params.gl_pi = QED_ROCE_PROTOCOL_INDEX;
852-
#endif
853842
for (i = 0; i < cdev->num_hwfns; i++) {
854843
struct qed_hwfn *p_hwfn = &cdev->hwfns[i];
855844

856845
p_hwfn->pf_params = *params;
857846
}
847+
848+
if (!IS_ENABLED(CONFIG_QED_RDMA))
849+
return;
850+
851+
params->rdma_pf_params.num_qps = QED_ROCE_QPS;
852+
params->rdma_pf_params.min_dpis = QED_ROCE_DPIS;
853+
/* divide by 3 the MRs to avoid MF ILT overflow */
854+
params->rdma_pf_params.num_mrs = RDMA_MAX_TIDS;
855+
params->rdma_pf_params.gl_pi = QED_ROCE_PROTOCOL_INDEX;
858856
}
859857

860858
static int qed_slowpath_start(struct qed_dev *cdev,

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

Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,12 @@ static void qed_bmap_release_id(struct qed_hwfn *p_hwfn,
129129
}
130130
}
131131

132-
u32 qed_rdma_get_sb_id(void *p_hwfn, u32 rel_sb_id)
132+
static u32 qed_rdma_get_sb_id(void *p_hwfn, u32 rel_sb_id)
133133
{
134134
/* First sb id for RoCE is after all the l2 sb */
135135
return FEAT_NUM((struct qed_hwfn *)p_hwfn, QED_PF_L2_QUE) + rel_sb_id;
136136
}
137137

138-
u32 qed_rdma_query_cau_timer_res(void *rdma_cxt)
139-
{
140-
return QED_CAU_DEF_RX_TIMER_RES;
141-
}
142-
143138
static int qed_rdma_alloc(struct qed_hwfn *p_hwfn,
144139
struct qed_ptt *p_ptt,
145140
struct qed_rdma_start_in_params *params)
@@ -275,7 +270,7 @@ static int qed_rdma_alloc(struct qed_hwfn *p_hwfn,
275270
return rc;
276271
}
277272

278-
void qed_rdma_resc_free(struct qed_hwfn *p_hwfn)
273+
static void qed_rdma_resc_free(struct qed_hwfn *p_hwfn)
279274
{
280275
struct qed_rdma_info *p_rdma_info = p_hwfn->p_rdma_info;
281276

@@ -527,6 +522,26 @@ static int qed_rdma_start_fw(struct qed_hwfn *p_hwfn,
527522
return qed_spq_post(p_hwfn, p_ent, NULL);
528523
}
529524

525+
static int qed_rdma_alloc_tid(void *rdma_cxt, u32 *itid)
526+
{
527+
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
528+
int rc;
529+
530+
DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "Allocate TID\n");
531+
532+
spin_lock_bh(&p_hwfn->p_rdma_info->lock);
533+
rc = qed_rdma_bmap_alloc_id(p_hwfn,
534+
&p_hwfn->p_rdma_info->tid_map, itid);
535+
spin_unlock_bh(&p_hwfn->p_rdma_info->lock);
536+
if (rc)
537+
goto out;
538+
539+
rc = qed_cxt_dynamic_ilt_alloc(p_hwfn, QED_ELEM_TASK, *itid);
540+
out:
541+
DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "Allocate TID - done, rc = %d\n", rc);
542+
return rc;
543+
}
544+
530545
static int qed_rdma_reserve_lkey(struct qed_hwfn *p_hwfn)
531546
{
532547
struct qed_rdma_device *dev = p_hwfn->p_rdma_info->dev;
@@ -573,7 +588,7 @@ static int qed_rdma_setup(struct qed_hwfn *p_hwfn,
573588
return qed_rdma_start_fw(p_hwfn, params, p_ptt);
574589
}
575590

576-
int qed_rdma_stop(void *rdma_cxt)
591+
static int qed_rdma_stop(void *rdma_cxt)
577592
{
578593
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
579594
struct rdma_close_func_ramrod_data *p_ramrod;
@@ -629,8 +644,8 @@ int qed_rdma_stop(void *rdma_cxt)
629644
return rc;
630645
}
631646

632-
int qed_rdma_add_user(void *rdma_cxt,
633-
struct qed_rdma_add_user_out_params *out_params)
647+
static int qed_rdma_add_user(void *rdma_cxt,
648+
struct qed_rdma_add_user_out_params *out_params)
634649
{
635650
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
636651
u32 dpi_start_offset;
@@ -664,7 +679,7 @@ int qed_rdma_add_user(void *rdma_cxt,
664679
return rc;
665680
}
666681

667-
struct qed_rdma_port *qed_rdma_query_port(void *rdma_cxt)
682+
static struct qed_rdma_port *qed_rdma_query_port(void *rdma_cxt)
668683
{
669684
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
670685
struct qed_rdma_port *p_port = p_hwfn->p_rdma_info->port;
@@ -680,7 +695,7 @@ struct qed_rdma_port *qed_rdma_query_port(void *rdma_cxt)
680695
return p_port;
681696
}
682697

683-
struct qed_rdma_device *qed_rdma_query_device(void *rdma_cxt)
698+
static struct qed_rdma_device *qed_rdma_query_device(void *rdma_cxt)
684699
{
685700
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
686701

@@ -690,7 +705,7 @@ struct qed_rdma_device *qed_rdma_query_device(void *rdma_cxt)
690705
return p_hwfn->p_rdma_info->dev;
691706
}
692707

693-
void qed_rdma_free_tid(void *rdma_cxt, u32 itid)
708+
static void qed_rdma_free_tid(void *rdma_cxt, u32 itid)
694709
{
695710
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
696711

@@ -701,27 +716,7 @@ void qed_rdma_free_tid(void *rdma_cxt, u32 itid)
701716
spin_unlock_bh(&p_hwfn->p_rdma_info->lock);
702717
}
703718

704-
int qed_rdma_alloc_tid(void *rdma_cxt, u32 *itid)
705-
{
706-
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
707-
int rc;
708-
709-
DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "Allocate TID\n");
710-
711-
spin_lock_bh(&p_hwfn->p_rdma_info->lock);
712-
rc = qed_rdma_bmap_alloc_id(p_hwfn,
713-
&p_hwfn->p_rdma_info->tid_map, itid);
714-
spin_unlock_bh(&p_hwfn->p_rdma_info->lock);
715-
if (rc)
716-
goto out;
717-
718-
rc = qed_cxt_dynamic_ilt_alloc(p_hwfn, QED_ELEM_TASK, *itid);
719-
out:
720-
DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "Allocate TID - done, rc = %d\n", rc);
721-
return rc;
722-
}
723-
724-
void qed_rdma_cnq_prod_update(void *rdma_cxt, u8 qz_offset, u16 prod)
719+
static void qed_rdma_cnq_prod_update(void *rdma_cxt, u8 qz_offset, u16 prod)
725720
{
726721
struct qed_hwfn *p_hwfn;
727722
u16 qz_num;
@@ -816,7 +811,7 @@ static int qed_rdma_get_int(struct qed_dev *cdev, struct qed_int_info *info)
816811
return 0;
817812
}
818813

819-
int qed_rdma_alloc_pd(void *rdma_cxt, u16 *pd)
814+
static int qed_rdma_alloc_pd(void *rdma_cxt, u16 *pd)
820815
{
821816
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
822817
u32 returned_id;
@@ -1985,9 +1980,9 @@ int qed_roce_destroy_qp(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp)
19851980
return 0;
19861981
}
19871982

1988-
int qed_rdma_query_qp(void *rdma_cxt,
1989-
struct qed_rdma_qp *qp,
1990-
struct qed_rdma_query_qp_out_params *out_params)
1983+
static int qed_rdma_query_qp(void *rdma_cxt,
1984+
struct qed_rdma_qp *qp,
1985+
struct qed_rdma_query_qp_out_params *out_params)
19911986
{
19921987
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
19931988
int rc;
@@ -2022,7 +2017,7 @@ int qed_rdma_query_qp(void *rdma_cxt,
20222017
return rc;
20232018
}
20242019

2025-
int qed_rdma_destroy_qp(void *rdma_cxt, struct qed_rdma_qp *qp)
2020+
static int qed_rdma_destroy_qp(void *rdma_cxt, struct qed_rdma_qp *qp)
20262021
{
20272022
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
20282023
int rc = 0;
@@ -2215,9 +2210,9 @@ static int qed_roce_modify_qp(struct qed_hwfn *p_hwfn,
22152210
return rc;
22162211
}
22172212

2218-
int qed_rdma_modify_qp(void *rdma_cxt,
2219-
struct qed_rdma_qp *qp,
2220-
struct qed_rdma_modify_qp_in_params *params)
2213+
static int qed_rdma_modify_qp(void *rdma_cxt,
2214+
struct qed_rdma_qp *qp,
2215+
struct qed_rdma_modify_qp_in_params *params)
22212216
{
22222217
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
22232218
enum qed_roce_qp_state prev_state;
@@ -2312,8 +2307,9 @@ int qed_rdma_modify_qp(void *rdma_cxt,
23122307
return rc;
23132308
}
23142309

2315-
int qed_rdma_register_tid(void *rdma_cxt,
2316-
struct qed_rdma_register_tid_in_params *params)
2310+
static int
2311+
qed_rdma_register_tid(void *rdma_cxt,
2312+
struct qed_rdma_register_tid_in_params *params)
23172313
{
23182314
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
23192315
struct rdma_register_tid_ramrod_data *p_ramrod;
@@ -2450,7 +2446,7 @@ int qed_rdma_register_tid(void *rdma_cxt,
24502446
return rc;
24512447
}
24522448

2453-
int qed_rdma_deregister_tid(void *rdma_cxt, u32 itid)
2449+
static int qed_rdma_deregister_tid(void *rdma_cxt, u32 itid)
24542450
{
24552451
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
24562452
struct rdma_deregister_tid_ramrod_data *p_ramrod;
@@ -2561,7 +2557,8 @@ void qed_rdma_dpm_bar(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
25612557
qed_rdma_dpm_conf(p_hwfn, p_ptt);
25622558
}
25632559

2564-
int qed_rdma_start(void *rdma_cxt, struct qed_rdma_start_in_params *params)
2560+
static int qed_rdma_start(void *rdma_cxt,
2561+
struct qed_rdma_start_in_params *params)
25652562
{
25662563
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
25672564
struct qed_ptt *p_ptt;
@@ -2601,7 +2598,7 @@ static int qed_rdma_init(struct qed_dev *cdev,
26012598
return qed_rdma_start(QED_LEADING_HWFN(cdev), params);
26022599
}
26032600

2604-
void qed_rdma_remove_user(void *rdma_cxt, u16 dpi)
2601+
static void qed_rdma_remove_user(void *rdma_cxt, u16 dpi)
26052602
{
26062603
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
26072604

0 commit comments

Comments
 (0)