Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de0089e6 authored by Kalderon, Michal's avatar Kalderon, Michal Committed by Doug Ledford
Browse files

RDMA/qedr: Add iWARP connection management qp related callbacks



This patch implements the following iWARP callbacks:
qp_add_ref
qp_rem_ref
get_qp

Signed-off-by: default avatarMichal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: default avatarRam Amrani <Ram.Amrani@cavium.com>
Signed-off-by: default avatarAriel Elior <Ariel.Elior@cavium.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent fb1a22be
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
obj-$(CONFIG_INFINIBAND_QEDR) := qedr.o
obj-$(CONFIG_INFINIBAND_QEDR) := qedr.o


qedr-y := main.o verbs.o qedr_roce_cm.o
qedr-y := main.o verbs.o qedr_roce_cm.o qedr_iw_cm.o
+10 −0
Original line number Original line Diff line number Diff line
@@ -39,12 +39,14 @@
#include <linux/iommu.h>
#include <linux/iommu.h>
#include <linux/pci.h>
#include <linux/pci.h>
#include <net/addrconf.h>
#include <net/addrconf.h>
#include <linux/idr.h>


#include <linux/qed/qed_chain.h>
#include <linux/qed/qed_chain.h>
#include <linux/qed/qed_if.h>
#include <linux/qed/qed_if.h>
#include "qedr.h"
#include "qedr.h"
#include "verbs.h"
#include "verbs.h"
#include <rdma/qedr-abi.h>
#include <rdma/qedr-abi.h>
#include "qedr_iw_cm.h"


MODULE_DESCRIPTION("QLogic 40G/100G ROCE Driver");
MODULE_DESCRIPTION("QLogic 40G/100G ROCE Driver");
MODULE_AUTHOR("QLogic Corporation");
MODULE_AUTHOR("QLogic Corporation");
@@ -143,6 +145,9 @@ int qedr_iw_register_device(struct qedr_dev *dev)
	dev->ibdev.iwcm = kzalloc(sizeof(*dev->ibdev.iwcm), GFP_KERNEL);
	dev->ibdev.iwcm = kzalloc(sizeof(*dev->ibdev.iwcm), GFP_KERNEL);
	if (!dev->ibdev.iwcm)
	if (!dev->ibdev.iwcm)
		return -ENOMEM;
		return -ENOMEM;
	dev->ibdev.iwcm->add_ref = qedr_iw_qp_add_ref;
	dev->ibdev.iwcm->rem_ref = qedr_iw_qp_rem_ref;
	dev->ibdev.iwcm->get_qp = qedr_iw_get_qp;


	memcpy(dev->ibdev.iwcm->ifname,
	memcpy(dev->ibdev.iwcm->ifname,
	       dev->ndev->name, sizeof(dev->ibdev.iwcm->ifname));
	       dev->ndev->name, sizeof(dev->ibdev.iwcm->ifname));
@@ -315,6 +320,11 @@ static int qedr_alloc_resources(struct qedr_dev *dev)


	spin_lock_init(&dev->sgid_lock);
	spin_lock_init(&dev->sgid_lock);


	if (IS_IWARP(dev)) {
		spin_lock_init(&dev->idr_lock);
		idr_init(&dev->qpidr);
	}

	/* Allocate Status blocks for CNQ */
	/* Allocate Status blocks for CNQ */
	dev->sb_array = kcalloc(dev->num_cnq, sizeof(*dev->sb_array),
	dev->sb_array = kcalloc(dev->num_cnq, sizeof(*dev->sb_array),
				GFP_KERNEL);
				GFP_KERNEL);
+4 −1
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@
#define __QEDR_H__
#define __QEDR_H__


#include <linux/pci.h>
#include <linux/pci.h>
#include <linux/idr.h>
#include <rdma/ib_addr.h>
#include <rdma/ib_addr.h>
#include <linux/qed/qed_if.h>
#include <linux/qed/qed_if.h>
#include <linux/qed/qed_chain.h>
#include <linux/qed/qed_chain.h>
@@ -164,7 +165,8 @@ struct qedr_dev {
	struct qedr_cq		*gsi_rqcq;
	struct qedr_cq		*gsi_rqcq;
	struct qedr_qp		*gsi_qp;
	struct qedr_qp		*gsi_qp;
	enum qed_rdma_type	rdma_type;
	enum qed_rdma_type	rdma_type;

	spinlock_t		idr_lock; /* Protect qpidr data-structure */
	struct idr		qpidr;
	unsigned long enet_state;
	unsigned long enet_state;
};
};


@@ -399,6 +401,7 @@ struct qedr_qp {
	/* Relevant to qps created from user space only (applications) */
	/* Relevant to qps created from user space only (applications) */
	struct qedr_userq usq;
	struct qedr_userq usq;
	struct qedr_userq urq;
	struct qedr_userq urq;
	atomic_t refcnt;
};
};


struct qedr_ah {
struct qedr_ah {
+57 −0
Original line number Original line Diff line number Diff line
/* QLogic qedr NIC Driver
 * Copyright (c) 2015-2017  QLogic Corporation
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and /or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
#include "qedr.h"
void qedr_iw_qp_add_ref(struct ib_qp *ibqp)
{
	struct qedr_qp *qp = get_qedr_qp(ibqp);

	atomic_inc(&qp->refcnt);
}

void qedr_iw_qp_rem_ref(struct ib_qp *ibqp)
{
	struct qedr_qp *qp = get_qedr_qp(ibqp);

	if (atomic_dec_and_test(&qp->refcnt)) {
		spin_lock_irq(&qp->dev->idr_lock);
		idr_remove(&qp->dev->qpidr, qp->qp_id);
		spin_unlock_irq(&qp->dev->idr_lock);
		kfree(qp);
	}
}

struct ib_qp *qedr_iw_get_qp(struct ib_device *ibdev, int qpn)
{
	struct qedr_dev *dev = get_qedr_dev(ibdev);

	return idr_find(&dev->qpidr, qpn);
}
+37 −0
Original line number Original line Diff line number Diff line
/* QLogic qed NIC Driver
 * Copyright (c) 2015-2017  QLogic Corporation
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and /or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
#include <rdma/iw_cm.h>
void qedr_iw_qp_add_ref(struct ib_qp *qp);

void qedr_iw_qp_rem_ref(struct ib_qp *qp);

struct ib_qp *qedr_iw_get_qp(struct ib_device *dev, int qpn);
Loading