Skip to content

Commit

Permalink
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/rdma/rdma

Pull rdma updates from Jason Gunthorpe:
 "Another small cycle. Mostly cleanups and bug fixes, quite a bit
  assisted from bots. There are a few new syzkaller splats that haven't
  been solved yet but they should get into the rcs in a few weeks, I
  think.

  Summary:

   - Update drivers to use common helpers for GUIDs, pkeys, bitmaps,
     memset_startat, and others

   - General code cleanups from bots

   - Simplify some of the rxe pool code in preparation for a larger
     rework

   - Clean out old stuff from hns, including all support for hip06
     devices

   - Fix a bug where GID table entries could be missed if the table had
     holes in it

   - Rename paths and sessions in rtrs for better understandability

   - Consolidate the roce source port selection code

   - NDR speed support in mlx5"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (83 commits)
  RDMA/irdma: Remove the redundant return
  RDMA/rxe: Use the standard method to produce udp source port
  RDMA/irdma: Make the source udp port vary
  RDMA/hns: Replace get_udp_sport with rdma_get_udp_sport
  RDMA/core: Calculate UDP source port based on flow label or lqpn/rqpn
  IB/qib: Fix typos
  RDMA/rtrs-clt: Rename rtrs_clt to rtrs_clt_sess
  RDMA/rtrs-srv: Rename rtrs_srv to rtrs_srv_sess
  RDMA/rtrs-clt: Rename rtrs_clt_sess to rtrs_clt_path
  RDMA/rtrs-srv: Rename rtrs_srv_sess to rtrs_srv_path
  RDMA/rtrs: Rename rtrs_sess to rtrs_path
  RDMA/hns: Modify the hop num of HIP09 EQ to 1
  IB/iser: Align coding style across driver
  IB/iser: Remove un-needed casting to/from void pointer
  IB/iser: Don't suppress send completions
  IB/iser: Rename ib_ret local variable
  IB/iser: Fix RNR errors
  IB/iser: Remove deprecated pi_guard module param
  IB/mlx5: Expose NDR speed through MAD
  RDMA/cxgb4: Set queue pair state when being queried
  ...
  • Loading branch information
Linus Torvalds committed Jan 13, 2022
2 parents feb7a43 + c0fe82b commit 747c19e
Show file tree
Hide file tree
Showing 105 changed files with 2,232 additions and 8,797 deletions.
4 changes: 2 additions & 2 deletions drivers/block/rnbd/rnbd-clt.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ static void msg_conf(void *priv, int errno)
schedule_work(&iu->work);
}

static int send_usr_msg(struct rtrs_clt *rtrs, int dir,
static int send_usr_msg(struct rtrs_clt_sess *rtrs, int dir,
struct rnbd_iu *iu, struct kvec *vec,
size_t len, struct scatterlist *sg, unsigned int sg_len,
void (*conf)(struct work_struct *work),
Expand Down Expand Up @@ -1010,7 +1010,7 @@ static int rnbd_client_xfer_request(struct rnbd_clt_dev *dev,
struct request *rq,
struct rnbd_iu *iu)
{
struct rtrs_clt *rtrs = dev->sess->rtrs;
struct rtrs_clt_sess *rtrs = dev->sess->rtrs;
struct rtrs_permit *permit = iu->permit;
struct rnbd_msg_io msg;
struct rtrs_clt_req_ops req_ops;
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/rnbd/rnbd-clt.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct rnbd_cpu_qlist {

struct rnbd_clt_session {
struct list_head list;
struct rtrs_clt *rtrs;
struct rtrs_clt_sess *rtrs;
wait_queue_head_t rtrs_waitq;
bool rtrs_ready;
struct rnbd_cpu_qlist __percpu
Expand Down
16 changes: 8 additions & 8 deletions drivers/block/rnbd/rnbd-srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,15 @@ static void destroy_sess(struct rnbd_srv_session *srv_sess)
kfree(srv_sess);
}

static int create_sess(struct rtrs_srv *rtrs)
static int create_sess(struct rtrs_srv_sess *rtrs)
{
struct rnbd_srv_session *srv_sess;
char sessname[NAME_MAX];
char pathname[NAME_MAX];
int err;

err = rtrs_srv_get_sess_name(rtrs, sessname, sizeof(sessname));
err = rtrs_srv_get_path_name(rtrs, pathname, sizeof(pathname));
if (err) {
pr_err("rtrs_srv_get_sess_name(%s): %d\n", sessname, err);
pr_err("rtrs_srv_get_path_name(%s): %d\n", pathname, err);

return err;
}
Expand All @@ -284,8 +284,8 @@ static int create_sess(struct rtrs_srv *rtrs)
offsetof(struct rnbd_dev_blk_io, bio),
BIOSET_NEED_BVECS);
if (err) {
pr_err("Allocating srv_session for session %s failed\n",
sessname);
pr_err("Allocating srv_session for path %s failed\n",
pathname);
kfree(srv_sess);
return err;
}
Expand All @@ -298,14 +298,14 @@ static int create_sess(struct rtrs_srv *rtrs)
mutex_unlock(&sess_lock);

srv_sess->rtrs = rtrs;
strscpy(srv_sess->sessname, sessname, sizeof(srv_sess->sessname));
strscpy(srv_sess->sessname, pathname, sizeof(srv_sess->sessname));

rtrs_srv_set_sess_priv(rtrs, srv_sess);

return 0;
}

static int rnbd_srv_link_ev(struct rtrs_srv *rtrs,
static int rnbd_srv_link_ev(struct rtrs_srv_sess *rtrs,
enum rtrs_srv_link_ev ev, void *priv)
{
struct rnbd_srv_session *srv_sess = priv;
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/rnbd/rnbd-srv.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
struct rnbd_srv_session {
/* Entry inside global sess_list */
struct list_head list;
struct rtrs_srv *rtrs;
struct rtrs_srv_sess *rtrs;
char sessname[NAME_MAX];
int queue_depth;
struct bio_set sess_bio_set;
Expand Down
12 changes: 9 additions & 3 deletions drivers/infiniband/core/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,17 +956,23 @@ int rdma_query_gid(struct ib_device *device, u32 port_num,
{
struct ib_gid_table *table;
unsigned long flags;
int res = -EINVAL;
int res;

if (!rdma_is_port_valid(device, port_num))
return -EINVAL;

table = rdma_gid_table(device, port_num);
read_lock_irqsave(&table->rwlock, flags);

if (index < 0 || index >= table->sz ||
!is_gid_entry_valid(table->data_vec[index]))
if (index < 0 || index >= table->sz) {
res = -EINVAL;
goto done;
}

if (!is_gid_entry_valid(table->data_vec[index])) {
res = -ENOENT;
goto done;
}

memcpy(gid, &table->data_vec[index]->attr.gid, sizeof(*gid));
res = 0;
Expand Down
18 changes: 11 additions & 7 deletions drivers/infiniband/core/cma.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
unsigned int p;
u16 pkey, index;
enum ib_port_state port_state;
int ret;
int i;

cma_dev = NULL;
Expand All @@ -784,9 +785,14 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)

if (ib_get_cached_port_state(cur_dev->device, p, &port_state))
continue;
for (i = 0; !rdma_query_gid(cur_dev->device,
p, i, &gid);
i++) {

for (i = 0; i < cur_dev->device->port_data[p].immutable.gid_tbl_len;
++i) {
ret = rdma_query_gid(cur_dev->device, p, i,
&gid);
if (ret)
continue;

if (!memcmp(&gid, dgid, sizeof(gid))) {
cma_dev = cur_dev;
sgid = gid;
Expand Down Expand Up @@ -4033,8 +4039,7 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv,

memset(&req, 0, sizeof req);
offset = cma_user_data_offset(id_priv);
req.private_data_len = offset + conn_param->private_data_len;
if (req.private_data_len < conn_param->private_data_len)
if (check_add_overflow(offset, conn_param->private_data_len, &req.private_data_len))
return -EINVAL;

if (req.private_data_len) {
Expand Down Expand Up @@ -4093,8 +4098,7 @@ static int cma_connect_ib(struct rdma_id_private *id_priv,

memset(&req, 0, sizeof req);
offset = cma_user_data_offset(id_priv);
req.private_data_len = offset + conn_param->private_data_len;
if (req.private_data_len < conn_param->private_data_len)
if (check_add_overflow(offset, conn_param->private_data_len, &req.private_data_len))
return -EINVAL;

if (req.private_data_len) {
Expand Down
3 changes: 2 additions & 1 deletion drivers/infiniband/core/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -2461,7 +2461,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid,
++i) {
ret = rdma_query_gid(device, port, i, &tmp_gid);
if (ret)
return ret;
continue;

if (!memcmp(&tmp_gid, gid, sizeof *gid)) {
*port_num = port;
if (index)
Expand Down
3 changes: 2 additions & 1 deletion drivers/infiniband/core/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ static struct attribute *port_default_attrs[] = {
&ib_port_attr_link_layer.attr,
NULL
};
ATTRIBUTE_GROUPS(port_default);

static ssize_t print_ndev(const struct ib_gid_attr *gid_attr, char *buf)
{
Expand Down Expand Up @@ -774,7 +775,7 @@ static void ib_port_gid_attr_release(struct kobject *kobj)
static struct kobj_type port_type = {
.release = ib_port_release,
.sysfs_ops = &port_sysfs_ops,
.default_attrs = port_default_attrs
.default_groups = port_default_groups,
};

static struct kobj_type gid_attr_type = {
Expand Down
3 changes: 1 addition & 2 deletions drivers/infiniband/core/umem_odp.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ struct ib_umem_odp *ib_umem_odp_get(struct ib_device *device,
const struct mmu_interval_notifier_ops *ops)
{
struct ib_umem_odp *umem_odp;
struct mm_struct *mm;
int ret;

if (WARN_ON_ONCE(!(access & IB_ACCESS_ON_DEMAND)))
Expand All @@ -241,7 +240,7 @@ struct ib_umem_odp *ib_umem_odp_get(struct ib_device *device,
umem_odp->umem.length = size;
umem_odp->umem.address = addr;
umem_odp->umem.writable = ib_access_writable(access);
umem_odp->umem.owning_mm = mm = current->mm;
umem_odp->umem.owning_mm = current->mm;
umem_odp->notifier.ops = ops;

umem_odp->page_shift = PAGE_SHIFT;
Expand Down
1 change: 0 additions & 1 deletion drivers/infiniband/core/uverbs_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,6 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
attr.sq_sig_type = cmd->sq_sig_all ? IB_SIGNAL_ALL_WR :
IB_SIGNAL_REQ_WR;
attr.qp_type = cmd->qp_type;
attr.create_flags = 0;

attr.cap.max_send_wr = cmd->max_send_wr;
attr.cap.max_recv_wr = cmd->max_recv_wr;
Expand Down
9 changes: 4 additions & 5 deletions drivers/infiniband/hw/bnxt_re/ib_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,12 @@ void bnxt_re_query_fw_str(struct ib_device *ibdev, char *str)
int bnxt_re_query_pkey(struct ib_device *ibdev, u32 port_num,
u16 index, u16 *pkey)
{
struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev);
if (index > 0)
return -EINVAL;

/* Ignore port_num */
*pkey = IB_DEFAULT_PKEY_FULL;

memset(pkey, 0, sizeof(*pkey));
return bnxt_qplib_get_pkey(&rdev->qplib_res,
&rdev->qplib_res.pkey_tbl, index, pkey);
return 0;
}

int bnxt_re_query_gid(struct ib_device *ibdev, u32 port_num,
Expand Down
3 changes: 1 addition & 2 deletions drivers/infiniband/hw/bnxt_re/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,6 @@ static int bnxt_re_srqn_handler(struct bnxt_qplib_nq *nq,
struct bnxt_re_srq *srq = container_of(handle, struct bnxt_re_srq,
qplib_srq);
struct ib_event ib_event;
int rc = 0;

ib_event.device = &srq->rdev->ibdev;
ib_event.element.srq = &srq->ib_srq;
Expand All @@ -907,7 +906,7 @@ static int bnxt_re_srqn_handler(struct bnxt_qplib_nq *nq,
(*srq->ib_srq.event_handler)(&ib_event,
srq->ib_srq.srq_context);
}
return rc;
return 0;
}

static int bnxt_re_cqn_handler(struct bnxt_qplib_nq *nq,
Expand Down
11 changes: 5 additions & 6 deletions drivers/infiniband/hw/bnxt_re/qplib_fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include <linux/delay.h>
#include <linux/prefetch.h>
#include <linux/if_ether.h>
#include <rdma/ib_mad.h>

#include "roce_hsi.h"

Expand Down Expand Up @@ -1232,7 +1233,7 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
struct cmdq_modify_qp req;
struct creq_modify_qp_resp resp;
u16 cmd_flags = 0, pkey;
u16 cmd_flags = 0;
u32 temp32[4];
u32 bmask;
int rc;
Expand All @@ -1255,11 +1256,9 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
if (bmask & CMDQ_MODIFY_QP_MODIFY_MASK_ACCESS)
req.access = qp->access;

if (bmask & CMDQ_MODIFY_QP_MODIFY_MASK_PKEY) {
if (!bnxt_qplib_get_pkey(res, &res->pkey_tbl,
qp->pkey_index, &pkey))
req.pkey = cpu_to_le16(pkey);
}
if (bmask & CMDQ_MODIFY_QP_MODIFY_MASK_PKEY)
req.pkey = cpu_to_le16(IB_DEFAULT_PKEY_FULL);

if (bmask & CMDQ_MODIFY_QP_MODIFY_MASK_QKEY)
req.qkey = cpu_to_le32(qp->qkey);

Expand Down
12 changes: 4 additions & 8 deletions drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,

void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)
{
kfree(rcfw->cmdq.cmdq_bitmap);
bitmap_free(rcfw->cmdq.cmdq_bitmap);
kfree(rcfw->qp_tbl);
kfree(rcfw->crsqe_tbl);
bnxt_qplib_free_hwq(rcfw->res, &rcfw->cmdq.hwq);
Expand All @@ -572,7 +572,6 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,
struct bnxt_qplib_sg_info sginfo = {};
struct bnxt_qplib_cmdq_ctx *cmdq;
struct bnxt_qplib_creq_ctx *creq;
u32 bmap_size = 0;

rcfw->pdev = res->pdev;
cmdq = &rcfw->cmdq;
Expand Down Expand Up @@ -613,13 +612,10 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,
if (!rcfw->crsqe_tbl)
goto fail;

bmap_size = BITS_TO_LONGS(rcfw->cmdq_depth) * sizeof(unsigned long);
cmdq->cmdq_bitmap = kzalloc(bmap_size, GFP_KERNEL);
cmdq->cmdq_bitmap = bitmap_zalloc(rcfw->cmdq_depth, GFP_KERNEL);
if (!cmdq->cmdq_bitmap)
goto fail;

cmdq->bmap_size = bmap_size;

/* Allocate one extra to hold the QP1 entries */
rcfw->qp_tbl_size = qp_tbl_sz + 1;
rcfw->qp_tbl = kcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_node),
Expand Down Expand Up @@ -667,8 +663,8 @@ void bnxt_qplib_disable_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)
iounmap(cmdq->cmdq_mbox.reg.bar_reg);
iounmap(creq->creq_db.reg.bar_reg);

indx = find_first_bit(cmdq->cmdq_bitmap, cmdq->bmap_size);
if (indx != cmdq->bmap_size)
indx = find_first_bit(cmdq->cmdq_bitmap, rcfw->cmdq_depth);
if (indx != rcfw->cmdq_depth)
dev_err(&rcfw->pdev->dev,
"disabling RCFW with pending cmd-bit %lx\n", indx);

Expand Down
1 change: 0 additions & 1 deletion drivers/infiniband/hw/bnxt_re/qplib_rcfw.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ struct bnxt_qplib_cmdq_ctx {
wait_queue_head_t waitq;
unsigned long flags;
unsigned long *cmdq_bitmap;
u32 bmap_size;
u32 seq_num;
};

Expand Down
Loading

0 comments on commit 747c19e

Please sign in to comment.