Skip to content

Commit 7d54999

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma fixes from Jason Gunthorpe: "Nothing very exciting here, mainly just a bunch of irdma fixes. irdma is a new driver this cycle so it to be expected. - Many more irdma fixups from bots/etc - bnxt_re regression in their counters from a FW upgrade - User triggerable memory leak in rxe" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: RDMA/irdma: Change returned type of irdma_setup_virt_qp to void RDMA/irdma: Change the returned type of irdma_set_hw_rsrc to void RDMA/irdma: change the returned type of irdma_sc_repost_aeq_entries to void RDMA/irdma: Check vsi pointer before using it RDMA/rxe: Fix memory leak in error path code RDMA/irdma: Change the returned type to void RDMA/irdma: Make spdxcheck.py happy RDMA/irdma: Fix unused variable total_size warning RDMA/bnxt_re: Fix stats counters
2 parents 51bbe7e + dc6afef commit 7d54999

File tree

11 files changed

+43
-48
lines changed

11 files changed

+43
-48
lines changed

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode)
120120
if (!chip_ctx)
121121
return -ENOMEM;
122122
chip_ctx->chip_num = bp->chip_num;
123+
chip_ctx->hw_stats_size = bp->hw_ring_stats_size;
123124

124125
rdev->chip_ctx = chip_ctx;
125126
/* rest members to follow eventually */
@@ -550,6 +551,7 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev,
550551
dma_addr_t dma_map,
551552
u32 *fw_stats_ctx_id)
552553
{
554+
struct bnxt_qplib_chip_ctx *chip_ctx = rdev->chip_ctx;
553555
struct hwrm_stat_ctx_alloc_output resp = {0};
554556
struct hwrm_stat_ctx_alloc_input req = {0};
555557
struct bnxt_en_dev *en_dev = rdev->en_dev;
@@ -566,7 +568,7 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev,
566568
bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_ALLOC, -1, -1);
567569
req.update_period_ms = cpu_to_le32(1000);
568570
req.stats_dma_addr = cpu_to_le64(dma_map);
569-
req.stats_dma_length = cpu_to_le16(sizeof(struct ctx_hw_stats_ext));
571+
req.stats_dma_length = cpu_to_le16(chip_ctx->hw_stats_size);
570572
req.stat_ctx_flags = STAT_CTX_ALLOC_REQ_STAT_CTX_FLAGS_ROCE;
571573
bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
572574
sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);

drivers/infiniband/hw/bnxt_re/qplib_res.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
static void bnxt_qplib_free_stats_ctx(struct pci_dev *pdev,
5757
struct bnxt_qplib_stats *stats);
5858
static int bnxt_qplib_alloc_stats_ctx(struct pci_dev *pdev,
59+
struct bnxt_qplib_chip_ctx *cctx,
5960
struct bnxt_qplib_stats *stats);
6061

6162
/* PBL */
@@ -559,7 +560,7 @@ int bnxt_qplib_alloc_ctx(struct bnxt_qplib_res *res,
559560
goto fail;
560561
stats_alloc:
561562
/* Stats */
562-
rc = bnxt_qplib_alloc_stats_ctx(res->pdev, &ctx->stats);
563+
rc = bnxt_qplib_alloc_stats_ctx(res->pdev, res->cctx, &ctx->stats);
563564
if (rc)
564565
goto fail;
565566

@@ -889,15 +890,12 @@ static void bnxt_qplib_free_stats_ctx(struct pci_dev *pdev,
889890
}
890891

891892
static int bnxt_qplib_alloc_stats_ctx(struct pci_dev *pdev,
893+
struct bnxt_qplib_chip_ctx *cctx,
892894
struct bnxt_qplib_stats *stats)
893895
{
894896
memset(stats, 0, sizeof(*stats));
895897
stats->fw_id = -1;
896-
/* 128 byte aligned context memory is required only for 57500.
897-
* However making this unconditional, it does not harm previous
898-
* generation.
899-
*/
900-
stats->size = ALIGN(sizeof(struct ctx_hw_stats), 128);
898+
stats->size = cctx->hw_stats_size;
901899
stats->dma = dma_alloc_coherent(&pdev->dev, stats->size,
902900
&stats->dma_map, GFP_KERNEL);
903901
if (!stats->dma) {

drivers/infiniband/hw/bnxt_re/qplib_res.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct bnxt_qplib_chip_ctx {
5454
u16 chip_num;
5555
u8 chip_rev;
5656
u8 chip_metal;
57+
u16 hw_stats_size;
5758
struct bnxt_qplib_drv_modes modes;
5859
};
5960

drivers/infiniband/hw/irdma/ctrl.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2845,7 +2845,7 @@ static u64 irdma_sc_decode_fpm_commit(struct irdma_sc_dev *dev, __le64 *buf,
28452845
* parses fpm commit info and copy base value
28462846
* of hmc objects in hmc_info
28472847
*/
2848-
static enum irdma_status_code
2848+
static void
28492849
irdma_sc_parse_fpm_commit_buf(struct irdma_sc_dev *dev, __le64 *buf,
28502850
struct irdma_hmc_obj_info *info, u32 *sd)
28512851
{
@@ -2915,7 +2915,6 @@ irdma_sc_parse_fpm_commit_buf(struct irdma_sc_dev *dev, __le64 *buf,
29152915
else
29162916
*sd = (u32)(size >> 21);
29172917

2918-
return 0;
29192918
}
29202919

29212920
/**
@@ -4187,11 +4186,9 @@ enum irdma_status_code irdma_sc_get_next_aeqe(struct irdma_sc_aeq *aeq,
41874186
* @dev: sc device struct
41884187
* @count: allocate count
41894188
*/
4190-
enum irdma_status_code irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev, u32 count)
4189+
void irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev, u32 count)
41914190
{
41924191
writel(count, dev->hw_regs[IRDMA_AEQALLOC]);
4193-
4194-
return 0;
41954192
}
41964193

41974194
/**
@@ -4434,9 +4431,9 @@ static enum irdma_status_code irdma_sc_cfg_iw_fpm(struct irdma_sc_dev *dev,
44344431
ret_code = irdma_sc_commit_fpm_val(dev->cqp, 0, hmc_info->hmc_fn_id,
44354432
&commit_fpm_mem, true, wait_type);
44364433
if (!ret_code)
4437-
ret_code = irdma_sc_parse_fpm_commit_buf(dev, dev->fpm_commit_buf,
4438-
hmc_info->hmc_obj,
4439-
&hmc_info->sd_table.sd_cnt);
4434+
irdma_sc_parse_fpm_commit_buf(dev, dev->fpm_commit_buf,
4435+
hmc_info->hmc_obj,
4436+
&hmc_info->sd_table.sd_cnt);
44404437
print_hex_dump_debug("HMC: COMMIT FPM BUFFER", DUMP_PREFIX_OFFSET, 16,
44414438
8, commit_fpm_mem.va, IRDMA_COMMIT_FPM_BUF_SIZE,
44424439
false);

drivers/infiniband/hw/irdma/hw.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,7 @@ enum irdma_status_code irdma_ctrl_init_hw(struct irdma_pci_f *rf)
19201920
* irdma_set_hw_rsrc - set hw memory resources.
19211921
* @rf: RDMA PCI function
19221922
*/
1923-
static u32 irdma_set_hw_rsrc(struct irdma_pci_f *rf)
1923+
static void irdma_set_hw_rsrc(struct irdma_pci_f *rf)
19241924
{
19251925
rf->allocated_qps = (void *)(rf->mem_rsrc +
19261926
(sizeof(struct irdma_arp_entry) * rf->arp_table_size));
@@ -1937,8 +1937,6 @@ static u32 irdma_set_hw_rsrc(struct irdma_pci_f *rf)
19371937
spin_lock_init(&rf->arp_lock);
19381938
spin_lock_init(&rf->qptable_lock);
19391939
spin_lock_init(&rf->qh_list_lock);
1940-
1941-
return 0;
19421940
}
19431941

19441942
/**
@@ -2000,9 +1998,7 @@ u32 irdma_initialize_hw_rsrc(struct irdma_pci_f *rf)
20001998

20011999
rf->arp_table = (struct irdma_arp_entry *)rf->mem_rsrc;
20022000

2003-
ret = irdma_set_hw_rsrc(rf);
2004-
if (ret)
2005-
goto set_hw_rsrc_fail;
2001+
irdma_set_hw_rsrc(rf);
20062002

20072003
set_bit(0, rf->allocated_mrs);
20082004
set_bit(0, rf->allocated_qps);
@@ -2025,9 +2021,6 @@ u32 irdma_initialize_hw_rsrc(struct irdma_pci_f *rf)
20252021

20262022
return 0;
20272023

2028-
set_hw_rsrc_fail:
2029-
kfree(rf->mem_rsrc);
2030-
rf->mem_rsrc = NULL;
20312024
mem_rsrc_kzalloc_fail:
20322025
kfree(rf->allocated_ws_nodes);
20332026
rf->allocated_ws_nodes = NULL;

drivers/infiniband/hw/irdma/main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ static void irdma_remove(struct auxiliary_device *aux_dev)
215215
pr_debug("INIT: Gen2 PF[%d] device remove success\n", PCI_FUNC(pf->pdev->devfn));
216216
}
217217

218-
static void irdma_fill_device_info(struct irdma_device *iwdev, struct ice_pf *pf)
218+
static void irdma_fill_device_info(struct irdma_device *iwdev, struct ice_pf *pf,
219+
struct ice_vsi *vsi)
219220
{
220221
struct irdma_pci_f *rf = iwdev->rf;
221-
struct ice_vsi *vsi = ice_get_main_vsi(pf);
222222

223223
rf->cdev = pf;
224224
rf->gen_ops.register_qset = irdma_lan_register_qset;
@@ -253,12 +253,15 @@ static int irdma_probe(struct auxiliary_device *aux_dev, const struct auxiliary_
253253
struct iidc_auxiliary_dev,
254254
adev);
255255
struct ice_pf *pf = iidc_adev->pf;
256+
struct ice_vsi *vsi = ice_get_main_vsi(pf);
256257
struct iidc_qos_params qos_info = {};
257258
struct irdma_device *iwdev;
258259
struct irdma_pci_f *rf;
259260
struct irdma_l2params l2params = {};
260261
int err;
261262

263+
if (!vsi)
264+
return -EIO;
262265
iwdev = ib_alloc_device(irdma_device, ibdev);
263266
if (!iwdev)
264267
return -ENOMEM;
@@ -268,7 +271,7 @@ static int irdma_probe(struct auxiliary_device *aux_dev, const struct auxiliary_
268271
return -ENOMEM;
269272
}
270273

271-
irdma_fill_device_info(iwdev, pf);
274+
irdma_fill_device_info(iwdev, pf, vsi);
272275
rf = iwdev->rf;
273276

274277
if (irdma_ctrl_init_hw(rf)) {

drivers/infiniband/hw/irdma/type.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,8 +1222,7 @@ enum irdma_status_code irdma_sc_aeq_init(struct irdma_sc_aeq *aeq,
12221222
struct irdma_aeq_init_info *info);
12231223
enum irdma_status_code irdma_sc_get_next_aeqe(struct irdma_sc_aeq *aeq,
12241224
struct irdma_aeqe_info *info);
1225-
enum irdma_status_code irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev,
1226-
u32 count);
1225+
void irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev, u32 count);
12271226

12281227
void irdma_sc_pd_init(struct irdma_sc_dev *dev, struct irdma_sc_pd *pd, u32 pd_id,
12291228
int abi_ver);

drivers/infiniband/hw/irdma/uk.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -931,17 +931,14 @@ enum irdma_status_code irdma_uk_mw_bind(struct irdma_qp_uk *qp,
931931
enum irdma_status_code irdma_uk_post_receive(struct irdma_qp_uk *qp,
932932
struct irdma_post_rq_info *info)
933933
{
934-
u32 total_size = 0, wqe_idx, i, byte_off;
934+
u32 wqe_idx, i, byte_off;
935935
u32 addl_frag_cnt;
936936
__le64 *wqe;
937937
u64 hdr;
938938

939939
if (qp->max_rq_frag_cnt < info->num_sges)
940940
return IRDMA_ERR_INVALID_FRAG_COUNT;
941941

942-
for (i = 0; i < info->num_sges; i++)
943-
total_size += info->sg_list[i].len;
944-
945942
wqe = irdma_qp_get_next_recv_wqe(qp, &wqe_idx);
946943
if (!wqe)
947944
return IRDMA_ERR_QP_TOOMANY_WRS_POSTED;

drivers/infiniband/hw/irdma/verbs.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ static int irdma_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
557557
* @iwqp: qp ptr
558558
* @init_info: initialize info to return
559559
*/
560-
static int irdma_setup_virt_qp(struct irdma_device *iwdev,
560+
static void irdma_setup_virt_qp(struct irdma_device *iwdev,
561561
struct irdma_qp *iwqp,
562562
struct irdma_qp_init_info *init_info)
563563
{
@@ -574,8 +574,6 @@ static int irdma_setup_virt_qp(struct irdma_device *iwdev,
574574
init_info->sq_pa = qpmr->sq_pbl.addr;
575575
init_info->rq_pa = qpmr->rq_pbl.addr;
576576
}
577-
578-
return 0;
579577
}
580578

581579
/**
@@ -914,7 +912,7 @@ static struct ib_qp *irdma_create_qp(struct ib_pd *ibpd,
914912
}
915913
}
916914
init_info.qp_uk_init_info.abi_ver = iwpd->sc_pd.abi_ver;
917-
err_code = irdma_setup_virt_qp(iwdev, iwqp, &init_info);
915+
irdma_setup_virt_qp(iwdev, iwqp, &init_info);
918916
} else {
919917
init_info.qp_uk_init_info.abi_ver = IRDMA_ABI_VER;
920918
err_code = irdma_setup_kmode_qp(iwdev, iwqp, &init_info, init_attr);

drivers/infiniband/sw/rxe/rxe_mr.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,14 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
113113
int num_buf;
114114
void *vaddr;
115115
int err;
116+
int i;
116117

117118
umem = ib_umem_get(pd->ibpd.device, start, length, access);
118119
if (IS_ERR(umem)) {
119-
pr_warn("err %d from rxe_umem_get\n",
120-
(int)PTR_ERR(umem));
120+
pr_warn("%s: Unable to pin memory region err = %d\n",
121+
__func__, (int)PTR_ERR(umem));
121122
err = PTR_ERR(umem);
122-
goto err1;
123+
goto err_out;
123124
}
124125

125126
mr->umem = umem;
@@ -129,9 +130,9 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
129130

130131
err = rxe_mr_alloc(mr, num_buf);
131132
if (err) {
132-
pr_warn("err %d from rxe_mr_alloc\n", err);
133-
ib_umem_release(umem);
134-
goto err1;
133+
pr_warn("%s: Unable to allocate memory for map\n",
134+
__func__);
135+
goto err_release_umem;
135136
}
136137

137138
mr->page_shift = PAGE_SHIFT;
@@ -151,10 +152,10 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
151152

152153
vaddr = page_address(sg_page_iter_page(&sg_iter));
153154
if (!vaddr) {
154-
pr_warn("null vaddr\n");
155-
ib_umem_release(umem);
155+
pr_warn("%s: Unable to get virtual address\n",
156+
__func__);
156157
err = -ENOMEM;
157-
goto err1;
158+
goto err_cleanup_map;
158159
}
159160

160161
buf->addr = (uintptr_t)vaddr;
@@ -177,7 +178,13 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
177178

178179
return 0;
179180

180-
err1:
181+
err_cleanup_map:
182+
for (i = 0; i < mr->num_map; i++)
183+
kfree(mr->map[i]);
184+
kfree(mr->map);
185+
err_release_umem:
186+
ib_umem_release(umem);
187+
err_out:
181188
return err;
182189
}
183190

0 commit comments

Comments
 (0)