1. 02 Nov, 2020 5 commits
  2. 31 Oct, 2020 2 commits
  3. 28 Oct, 2020 19 commits
  4. 27 Oct, 2020 1 commit
  5. 26 Oct, 2020 13 commits
    • Bob Pearson's avatar
      RDMA/rxe: Remove unused RXE_MR_TYPE_FMR · eeed6965
      Bob Pearson authored
      This is a left over from the past. It is no longer used.
      
      Link: https://lore.kernel.org/r/20201009165112.271143-1-rpearson@hpe.comSigned-off-by: default avatarBob Pearson <rpearson@hpe.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      eeed6965
    • Joe Perches's avatar
      RDMA: Convert sysfs kobject * show functions to use sysfs_emit() · 3c6bff3c
      Joe Perches authored
      Done with cocci script:
      
      @@
      identifier k_show;
      identifier arg1, arg2, arg3;
      @@
      ssize_t k_show(struct kobject *
      -	arg1
      +	kobj
      	, struct kobj_attribute *
      -	arg2
      +	attr
      	, char *
      -	arg3
      +	buf
      	)
      {
      	...
      (
      -	arg1
      +	kobj
      |
      -	arg2
      +	attr
      |
      -	arg3
      +	buf
      )
      	...
      }
      
      @@
      identifier k_show;
      identifier kobj, attr, buf;
      @@
      
      ssize_t k_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
      {
      	<...
      	return
      -	sprintf(buf,
      +	sysfs_emit(buf,
      	...);
      	...>
      }
      
      @@
      identifier k_show;
      identifier kobj, attr, buf;
      @@
      
      ssize_t k_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
      {
      	<...
      	return
      -	snprintf(buf, PAGE_SIZE,
      +	sysfs_emit(buf,
      	...);
      	...>
      }
      
      @@
      identifier k_show;
      identifier kobj, attr, buf;
      @@
      
      ssize_t k_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
      {
      	<...
      	return
      -	scnprintf(buf, PAGE_SIZE,
      +	sysfs_emit(buf,
      	...);
      	...>
      }
      
      @@
      identifier k_show;
      identifier kobj, attr, buf;
      expression chr;
      @@
      
      ssize_t k_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
      {
      	<...
      	return
      -	strcpy(buf, chr);
      +	sysfs_emit(buf, chr);
      	...>
      }
      
      @@
      identifier k_show;
      identifier kobj, attr, buf;
      identifier len;
      @@
      
      ssize_t k_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
      {
      	<...
      	len =
      -	sprintf(buf,
      +	sysfs_emit(buf,
      	...);
      	...>
      	return len;
      }
      
      @@
      identifier k_show;
      identifier kobj, attr, buf;
      identifier len;
      @@
      
      ssize_t k_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
      {
      	<...
      	len =
      -	snprintf(buf, PAGE_SIZE,
      +	sysfs_emit(buf,
      	...);
      	...>
      	return len;
      }
      
      @@
      identifier k_show;
      identifier kobj, attr, buf;
      identifier len;
      @@
      
      ssize_t k_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
      {
      	<...
      	len =
      -	scnprintf(buf, PAGE_SIZE,
      +	sysfs_emit(buf,
      	...);
      	...>
      	return len;
      }
      
      @@
      identifier k_show;
      identifier kobj, attr, buf;
      identifier len;
      @@
      
      ssize_t k_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
      {
      	<...
      -	len += scnprintf(buf + len, PAGE_SIZE - len,
      +	len += sysfs_emit_at(buf, len,
      	...);
      	...>
      	return len;
      }
      
      @@
      identifier k_show;
      identifier kobj, attr, buf;
      expression chr;
      @@
      
      ssize_t k_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
      {
      	...
      -	strcpy(buf, chr);
      -	return strlen(buf);
      +	return sysfs_emit(buf, chr);
      }
      
      Link: https://lore.kernel.org/r/7761c1efaebb96c432c85171d58405c25a824ccd.1602122880.git.joe@perches.comSigned-off-by: default avatarJoe Perches <joe@perches.com>
      Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Acked-by: default avatarJack Wang <jinpu.wang@cloud.ionos.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      3c6bff3c
    • Joe Perches's avatar
      RDMA: Convert sysfs device * show functions to use sysfs_emit() · 1c7fd726
      Joe Perches authored
      Done with cocci script:
      
      @@
      identifier d_show;
      identifier dev, attr, buf;
      @@
      
      ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
      {
      	<...
      	return
      -	sprintf(buf,
      +	sysfs_emit(buf,
      	...);
      	...>
      }
      
      @@
      identifier d_show;
      identifier dev, attr, buf;
      @@
      
      ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
      {
      	<...
      	return
      -	snprintf(buf, PAGE_SIZE,
      +	sysfs_emit(buf,
      	...);
      	...>
      }
      
      @@
      identifier d_show;
      identifier dev, attr, buf;
      @@
      
      ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
      {
      	<...
      	return
      -	scnprintf(buf, PAGE_SIZE,
      +	sysfs_emit(buf,
      	...);
      	...>
      }
      
      @@
      identifier d_show;
      identifier dev, attr, buf;
      expression chr;
      @@
      
      ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
      {
      	<...
      	return
      -	strcpy(buf, chr);
      +	sysfs_emit(buf, chr);
      	...>
      }
      
      @@
      identifier d_show;
      identifier dev, attr, buf;
      identifier len;
      @@
      
      ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
      {
      	<...
      	len =
      -	sprintf(buf,
      +	sysfs_emit(buf,
      	...);
      	...>
      	return len;
      }
      
      @@
      identifier d_show;
      identifier dev, attr, buf;
      identifier len;
      @@
      
      ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
      {
      	<...
      	len =
      -	snprintf(buf, PAGE_SIZE,
      +	sysfs_emit(buf,
      	...);
      	...>
      	return len;
      }
      
      @@
      identifier d_show;
      identifier dev, attr, buf;
      identifier len;
      @@
      
      ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
      {
      	<...
      	len =
      -	scnprintf(buf, PAGE_SIZE,
      +	sysfs_emit(buf,
      	...);
      	...>
      	return len;
      }
      
      @@
      identifier d_show;
      identifier dev, attr, buf;
      identifier len;
      @@
      
      ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
      {
      	<...
      -	len += scnprintf(buf + len, PAGE_SIZE - len,
      +	len += sysfs_emit_at(buf, len,
      	...);
      	...>
      	return len;
      }
      
      @@
      identifier d_show;
      identifier dev, attr, buf;
      expression chr;
      @@
      
      ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
      {
      	...
      -	strcpy(buf, chr);
      -	return strlen(buf);
      +	return sysfs_emit(buf, chr);
      }
      
      Link: https://lore.kernel.org/r/7f406fa8e3aa2552c022bec680f621e38d1fe414.1602122879.git.joe@perches.comSigned-off-by: default avatarJoe Perches <joe@perches.com>
      Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      1c7fd726
    • Jason Gunthorpe's avatar
      RDMA: Remove AH from uverbs_cmd_mask · 676a80ad
      Jason Gunthorpe authored
      Drivers that need a uverbs AH should instead set the create_user_ah() op
      similar to reg_user_mr(). MODIFY_AH and QUERY_AH cmds were never
      implemented so are just deleted.
      
      Link: https://lore.kernel.org/r/11-v1-caa70ba3d1ab+1436e-ucmd_mask_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      676a80ad
    • Jason Gunthorpe's avatar
      RDMA: Remove uverbs cmds from drivers that don't use them · 628c02bf
      Jason Gunthorpe authored
      Allowing userspace to invoke these commands is probably going to crash
      these drivers as they are not tested and not expecting to use them on a
      user object.
      
      For example pvrdma touches cq->ring_state which is not initialized for
      user QPs.
      
      These commands are effected:
      
      - IB_USER_VERBS_CMD_REQ_NOTIFY_CQ is ibv_cmd_req_notify_cq() in
        rdma-core, only hfi1, ipath and rxe calls it.
      
      - IB_USER_VERBS_CMD_POLL_CQ is ibv_cmd_poll_cq() in rdma-core, only
        ipath and hfi1 calls it.
      
      - IB_USER_VERBS_CMD_POST_SEND/RECV is ibv_cmd_post_send/recv() in
        rdma-core, only ipath and hfi1 call them.
      
      - IB_USER_VERBS_CMD_POST_SRQ_RECV is ibv_cmd_post_srq_recv() in
        rdma-core, only ipath and hfi1 calls it.
      
      - IB_USER_VERBS_CMD_PEEK_CQ isn't even implemented anywhere
      
      - IB_USER_VERBS_CMD_CREATE/DESTROY_AH is ibv_cmd_create/destroy_ah() in
        rdma-core, only bnxt_re, efa, hfi1, ipath, mlx5, orcrdma, and rxe call
        it.
      
      Link: https://lore.kernel.org/r/10-v1-caa70ba3d1ab+1436e-ucmd_mask_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      628c02bf
    • Jason Gunthorpe's avatar
      RDMA/core Remove uverbs_ex_cmd_mask · bd2a40cc
      Jason Gunthorpe authored
      No driver sets it, and the core code sets a maximum mask, simply remove
      it.
      
      Disabled operations are now handled either by having a NULL ops pointer,
      or by having the common driver callbacks check for unsupported extended
      attributes.
      
      Link: https://lore.kernel.org/r/9-v1-caa70ba3d1ab+1436e-ucmd_mask_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      bd2a40cc
    • Jason Gunthorpe's avatar
      RDMA: Check create_flags during create_qp · 1f11a761
      Jason Gunthorpe authored
      Each driver should check that the QP attrs create_flags is supported.
      Unfortuantely when create_flags was added to the QP attrs the drivers were
      not updated. uverbs_ex_cmd_mask was used to block it - even though kernel
      drivers use these flags too.
      
      Check that flags is zero in all drivers that don't use it, remove
      IB_USER_VERBS_EX_CMD_CREATE_QP from uverbs_ex_cmd_mask. Fix the error code
      to be EOPNOTSUPP.
      
      Link: https://lore.kernel.org/r/8-v1-caa70ba3d1ab+1436e-ucmd_mask_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      1f11a761
    • Jason Gunthorpe's avatar
      RDMA: Check flags during create_cq · 1c407cb5
      Jason Gunthorpe authored
      Each driver should check that the CQ attrs is supported. Unfortuantely
      when flags was added to the CQ attrs the drivers were not updated,
      uverbs_ex_cmd_mask was used to block it. This was missed when create CQ
      was converted to ioctl, so non-zero flags could have been passed into
      drivers.
      
      Check that flags is zero in all drivers that don't use it, remove
      IB_USER_VERBS_EX_CMD_CREATE_CQ from uverbs_ex_cmd_mask.
      
      Fixes: 41b2a71f ("IB/uverbs: Move ioctl path of create_cq and destroy_cq to a new file")
      Link: https://lore.kernel.org/r/7-v1-caa70ba3d1ab+1436e-ucmd_mask_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      1c407cb5
    • Jason Gunthorpe's avatar
      RDMA: Check attr_mask during modify_qp · 26e990ba
      Jason Gunthorpe authored
      Each driver should check that it can support the provided attr_mask during
      modify_qp. IB_USER_VERBS_EX_CMD_MODIFY_QP was being used to block
      modify_qp_ex because the driver didn't check RATE_LIMIT.
      
      Link: https://lore.kernel.org/r/6-v1-caa70ba3d1ab+1436e-ucmd_mask_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      26e990ba
    • Jason Gunthorpe's avatar
      RDMA: Check srq_type during create_srq · 652caba5
      Jason Gunthorpe authored
      uverbs was blocking srq_types the driver doesn't support based on the
      CREATE_XSRQ cmd_mask. Fix all drivers to check for supported srq_types
      during create_srq and move CREATE_XSRQ to the core code.
      
      Link: https://lore.kernel.org/r/5-v1-caa70ba3d1ab+1436e-ucmd_mask_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      652caba5
    • Jason Gunthorpe's avatar
      RDMA: Move more uverbs_cmd_mask settings to the core · 44ce37bc
      Jason Gunthorpe authored
      These functions all depend on the driver providing a specific op:
      
      - REREG_MR is rereg_user_mr(). bnxt_re set this without providing the op
      - ATTACH/DEATCH_MCAST is attach_mcast()/detach_mcast(). usnic set this
        without providing the op
      - OPEN_QP doesn't involve the driver but requires a XRCD. qedr provides
        xrcd but forgot to set it, usnic doesn't provide XRCD but set it anyhow.
      - OPEN/CLOSE_XRCD are the ops alloc_xrcd()/dealloc_xrcd()
      - CREATE_SRQ/DESTROY_SRQ are the ops create_srq()/destroy_srq()
      - QUERY/MODIFY_SRQ is op query_srq()/modify_srq(). hns sets this but
        sometimes supplies a NULL op.
      - RESIZE_CQ is op resize_cq(). bnxt_re sets this boes doesn't supply an op
      - ALLOC/DEALLOC_MW is alloc_mw()/dealloc_mw(). cxgb4 provided an
        (now deleted) implementation but no userspace
      
      All drivers were checked that no drivers provide the op without also
      setting uverbs_cmd_mask so this should have no functional change.
      
      Link: https://lore.kernel.org/r/4-v1-caa70ba3d1ab+1436e-ucmd_mask_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      44ce37bc
    • Jason Gunthorpe's avatar
      RDMA: Remove elements in uverbs_cmd_mask that all drivers set · c074bb1e
      Jason Gunthorpe authored
      This is a step toward eliminating uverbs_cmd_mask. Preset this list in the
      core code. Only the op reg_user_mr wasn't already being required from the
      drivers.
      
      Link: https://lore.kernel.org/r/3-v1-caa70ba3d1ab+1436e-ucmd_mask_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      c074bb1e
    • Jason Gunthorpe's avatar
      RDMA: Remove uverbs_ex_cmd_mask values that are linked to functions · b8e3130d
      Jason Gunthorpe authored
      Since a while now the uverbs layer checks if the driver implements a
      function before allowing the ucmd to proceed. This largely obsoletes the
      cmd_mask stuff, but there is some tricky bits in drivers preventing it
      from being removed.
      
      Remove the easy elements of uverbs_ex_cmd_mask by pre-setting them in the
      core code. These are triggered soley based on the related ops function
      pointer.
      
      query_device_ex is not triggered based on an op, but all drivers already
      implement something compatible with the extension, so enable it globally
      too.
      
      Link: https://lore.kernel.org/r/2-v1-caa70ba3d1ab+1436e-ucmd_mask_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      b8e3130d