lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160915130556.GA26069@leon.nu>
Date:   Thu, 15 Sep 2016 16:05:56 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Ram Amrani <Ram.Amrani@...gic.com>
Cc:     dledford@...hat.com, davem@...emloft.net, Yuval.Mintz@...gic.com,
        Ariel.Elior@...gic.com, Michal.Kalderon@...gic.com,
        rajesh.borundia@...gic.com, linux-rdma@...r.kernel.org,
        netdev@...r.kernel.org
Subject: Re: [RFC 06/11] Add support for QP verbs

On Mon, Sep 12, 2016 at 07:07:40PM +0300, Ram Amrani wrote:
> Add support for Queue Pair verbs which adds, deletes,
> modifies and queries Queue Pairs.
>
> Signed-off-by: Rajesh Borundia <rajesh.borundia@...gic.com>
> Signed-off-by: Ram Amrani <Ram.Amrani@...gic.com>
> ---
>  drivers/infiniband/hw/qedr/main.c          |   15 +-
>  drivers/infiniband/hw/qedr/qedr.h          |  126 +++
>  drivers/infiniband/hw/qedr/qedr_cm.h       |   40 +
>  drivers/infiniband/hw/qedr/qedr_hsi_rdma.h |   11 +
>  drivers/infiniband/hw/qedr/qedr_user.h     |   34 +
>  drivers/infiniband/hw/qedr/verbs.c         | 1098 ++++++++++++++++++++++++-
>  drivers/infiniband/hw/qedr/verbs.h         |    7 +
>  drivers/net/ethernet/qlogic/qed/qed_cxt.h  |    1 +
>  drivers/net/ethernet/qlogic/qed/qed_roce.c | 1211 ++++++++++++++++++++++++++++
>  drivers/net/ethernet/qlogic/qed/qed_roce.h |   71 ++
>  include/linux/qed/qed_roce_if.h            |  144 ++++
>  11 files changed, 2756 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/infiniband/hw/qedr/qedr_cm.h
>

<....>

> +
> +static inline int get_gid_info_from_table(struct ib_qp *ibqp,
> +					  struct ib_qp_attr *attr,
> +					  int attr_mask,
> +					  struct qed_rdma_modify_qp_in_params
> +					  *qp_params)
> +{
> +	enum rdma_network_type nw_type;
> +	struct ib_gid_attr gid_attr;
> +	union ib_gid gid;
> +	u32 ipv4_addr;
> +	int rc = 0;
> +	int i;
> +
> +	rc = ib_get_cached_gid(ibqp->device, attr->ah_attr.port_num,
> +			       attr->ah_attr.grh.sgid_index, &gid, &gid_attr);
> +	if (!rc && !memcmp(&gid, &zgid, sizeof(gid)))
> +		rc = -ENOENT;
> +
> +	if (!rc && gid_attr.ndev) {
> +		qp_params->vlan_id = rdma_vlan_dev_vlan_id(gid_attr.ndev);
> +
> +		dev_put(gid_attr.ndev);
> +		nw_type = ib_gid_to_network_type(gid_attr.gid_type, &gid);
> +		switch (nw_type) {
> +		case RDMA_NETWORK_IPV6:
> +			memcpy(&qp_params->sgid.bytes[0], &gid.raw[0],
> +			       sizeof(qp_params->sgid));
> +			memcpy(&qp_params->dgid.bytes[0],
> +			       &attr->ah_attr.grh.dgid,
> +			       sizeof(qp_params->dgid));
> +			qp_params->roce_mode = ROCE_V2_IPV6;
> +			SET_FIELD(qp_params->modify_flags,
> +				  QED_ROCE_MODIFY_QP_VALID_ROCE_MODE, 1);
> +			break;
> +		case RDMA_NETWORK_IB:
> +			memcpy(&qp_params->sgid.bytes[0], &gid.raw[0],
> +			       sizeof(qp_params->sgid));
> +			memcpy(&qp_params->dgid.bytes[0],
> +			       &attr->ah_attr.grh.dgid,
> +			       sizeof(qp_params->dgid));
> +			qp_params->roce_mode = ROCE_V1;
> +			break;
> +		case RDMA_NETWORK_IPV4:
> +			memset(&qp_params->sgid, 0, sizeof(qp_params->sgid));
> +			memset(&qp_params->dgid, 0, sizeof(qp_params->dgid));
> +			ipv4_addr = qedr_get_ipv4_from_gid(gid.raw);
> +			qp_params->sgid.ipv4_addr = ipv4_addr;
> +			ipv4_addr =
> +			    qedr_get_ipv4_from_gid(attr->ah_attr.grh.dgid.raw);
> +			qp_params->dgid.ipv4_addr = ipv4_addr;
> +			SET_FIELD(qp_params->modify_flags,
> +				  QED_ROCE_MODIFY_QP_VALID_ROCE_MODE, 1);
> +			qp_params->roce_mode = ROCE_V2_IPV4;
> +			break;
> +		}
> +	}
> +	if (rc)
> +		return -EINVAL;

I think it is better to check "rc" right after call to
ib_get_cached_gid().


Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ