Commit 7ae6f2a3 authored by Doug Ledford's avatar Doug Ledford

Merge branch 'qedr' into k.o/for-next

Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parents 0d9c2ff1 bd491d2a
...@@ -11068,6 +11068,7 @@ F: drivers/net/ethernet/qlogic/qede/ ...@@ -11068,6 +11068,7 @@ F: drivers/net/ethernet/qlogic/qede/
QLOGIC QL4xxx RDMA DRIVER QLOGIC QL4xxx RDMA DRIVER
M: Ram Amrani <Ram.Amrani@cavium.com> M: Ram Amrani <Ram.Amrani@cavium.com>
M: Michal Kalderon <Michal.Kalderon@cavium.com>
M: Ariel Elior <Ariel.Elior@cavium.com> M: Ariel Elior <Ariel.Elior@cavium.com>
L: linux-rdma@vger.kernel.org L: linux-rdma@vger.kernel.org
S: Supported S: Supported
......
obj-$(CONFIG_INFINIBAND_QEDR) := qedr.o obj-$(CONFIG_INFINIBAND_QEDR) := qedr.o
qedr-y := main.o verbs.o qedr_cm.o qedr-y := main.o verbs.o qedr_roce_cm.o qedr_iw_cm.o
...@@ -33,16 +33,20 @@ ...@@ -33,16 +33,20 @@
#include <rdma/ib_verbs.h> #include <rdma/ib_verbs.h>
#include <rdma/ib_addr.h> #include <rdma/ib_addr.h>
#include <rdma/ib_user_verbs.h> #include <rdma/ib_user_verbs.h>
#include <rdma/iw_cm.h>
#include <rdma/ib_mad.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#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");
...@@ -92,8 +96,84 @@ static struct net_device *qedr_get_netdev(struct ib_device *dev, u8 port_num) ...@@ -92,8 +96,84 @@ static struct net_device *qedr_get_netdev(struct ib_device *dev, u8 port_num)
return qdev->ndev; return qdev->ndev;
} }
int qedr_roce_port_immutable(struct ib_device *ibdev, u8 port_num,
struct ib_port_immutable *immutable)
{
struct ib_port_attr attr;
int err;
err = qedr_query_port(ibdev, port_num, &attr);
if (err)
return err;
immutable->pkey_tbl_len = attr.pkey_tbl_len;
immutable->gid_tbl_len = attr.gid_tbl_len;
immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE |
RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP;
immutable->max_mad_size = IB_MGMT_MAD_SIZE;
return 0;
}
int qedr_iw_port_immutable(struct ib_device *ibdev, u8 port_num,
struct ib_port_immutable *immutable)
{
struct ib_port_attr attr;
int err;
err = qedr_query_port(ibdev, port_num, &attr);
if (err)
return err;
immutable->pkey_tbl_len = 1;
immutable->gid_tbl_len = 1;
immutable->core_cap_flags = RDMA_CORE_PORT_IWARP;
immutable->max_mad_size = 0;
return 0;
}
int qedr_iw_register_device(struct qedr_dev *dev)
{
dev->ibdev.node_type = RDMA_NODE_RNIC;
dev->ibdev.query_gid = qedr_iw_query_gid;
dev->ibdev.get_port_immutable = qedr_iw_port_immutable;
dev->ibdev.iwcm = kzalloc(sizeof(*dev->ibdev.iwcm), GFP_KERNEL);
if (!dev->ibdev.iwcm)
return -ENOMEM;
dev->ibdev.iwcm->connect = qedr_iw_connect;
dev->ibdev.iwcm->accept = qedr_iw_accept;
dev->ibdev.iwcm->reject = qedr_iw_reject;
dev->ibdev.iwcm->create_listen = qedr_iw_create_listen;
dev->ibdev.iwcm->destroy_listen = qedr_iw_destroy_listen;
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,
dev->ndev->name, sizeof(dev->ibdev.iwcm->ifname));
return 0;
}
void qedr_roce_register_device(struct qedr_dev *dev)
{
dev->ibdev.node_type = RDMA_NODE_IB_CA;
dev->ibdev.query_gid = qedr_query_gid;
dev->ibdev.add_gid = qedr_add_gid;
dev->ibdev.del_gid = qedr_del_gid;
dev->ibdev.get_port_immutable = qedr_roce_port_immutable;
}
static int qedr_register_device(struct qedr_dev *dev) static int qedr_register_device(struct qedr_dev *dev)
{ {
int rc;
strlcpy(dev->ibdev.name, "qedr%d", IB_DEVICE_NAME_MAX); strlcpy(dev->ibdev.name, "qedr%d", IB_DEVICE_NAME_MAX);
dev->ibdev.node_guid = dev->attr.node_guid; dev->ibdev.node_guid = dev->attr.node_guid;
...@@ -121,18 +201,21 @@ static int qedr_register_device(struct qedr_dev *dev) ...@@ -121,18 +201,21 @@ static int qedr_register_device(struct qedr_dev *dev)
QEDR_UVERBS(POST_SEND) | QEDR_UVERBS(POST_SEND) |
QEDR_UVERBS(POST_RECV); QEDR_UVERBS(POST_RECV);
if (IS_IWARP(dev)) {
rc = qedr_iw_register_device(dev);
if (rc)
return rc;
} else {
qedr_roce_register_device(dev);
}
dev->ibdev.phys_port_cnt = 1; dev->ibdev.phys_port_cnt = 1;
dev->ibdev.num_comp_vectors = dev->num_cnq; dev->ibdev.num_comp_vectors = dev->num_cnq;
dev->ibdev.node_type = RDMA_NODE_IB_CA;
dev->ibdev.query_device = qedr_query_device; dev->ibdev.query_device = qedr_query_device;
dev->ibdev.query_port = qedr_query_port; dev->ibdev.query_port = qedr_query_port;
dev->ibdev.modify_port = qedr_modify_port; dev->ibdev.modify_port = qedr_modify_port;
dev->ibdev.query_gid = qedr_query_gid;
dev->ibdev.add_gid = qedr_add_gid;
dev->ibdev.del_gid = qedr_del_gid;
dev->ibdev.alloc_ucontext = qedr_alloc_ucontext; dev->ibdev.alloc_ucontext = qedr_alloc_ucontext;
dev->ibdev.dealloc_ucontext = qedr_dealloc_ucontext; dev->ibdev.dealloc_ucontext = qedr_dealloc_ucontext;
dev->ibdev.mmap = qedr_mmap; dev->ibdev.mmap = qedr_mmap;
...@@ -166,7 +249,7 @@ static int qedr_register_device(struct qedr_dev *dev) ...@@ -166,7 +249,7 @@ static int qedr_register_device(struct qedr_dev *dev)
dev->ibdev.post_recv = qedr_post_recv; dev->ibdev.post_recv = qedr_post_recv;
dev->ibdev.process_mad = qedr_process_mad; dev->ibdev.process_mad = qedr_process_mad;
dev->ibdev.get_port_immutable = qedr_port_immutable;
dev->ibdev.get_netdev = qedr_get_netdev; dev->ibdev.get_netdev = qedr_get_netdev;
dev->ibdev.dev.parent = &dev->pdev->dev; dev->ibdev.dev.parent = &dev->pdev->dev;
...@@ -217,6 +300,9 @@ static void qedr_free_resources(struct qedr_dev *dev) ...@@ -217,6 +300,9 @@ static void qedr_free_resources(struct qedr_dev *dev)
{ {
int i; int i;
if (IS_IWARP(dev))
destroy_workqueue(dev->iwarp_wq);
for (i = 0; i < dev->num_cnq; i++) { for (i = 0; i < dev->num_cnq; i++) {
qedr_free_mem_sb(dev, &dev->sb_array[i], dev->sb_start + i); qedr_free_mem_sb(dev, &dev->sb_array[i], dev->sb_start + i);
dev->ops->common->chain_free(dev->cdev, &dev->cnq_array[i].pbl); dev->ops->common->chain_free(dev->cdev, &dev->cnq_array[i].pbl);
...@@ -241,6 +327,12 @@ static int qedr_alloc_resources(struct qedr_dev *dev) ...@@ -241,6 +327,12 @@ 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);
dev->iwarp_wq = create_singlethread_workqueue("qedr_iwarpq");
}
/* 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);
...@@ -716,6 +808,7 @@ static int qedr_init_hw(struct qedr_dev *dev) ...@@ -716,6 +808,7 @@ static int qedr_init_hw(struct qedr_dev *dev)
in_params->events = &events; in_params->events = &events;
in_params->cq_mode = QED_RDMA_CQ_MODE_32_BITS; in_params->cq_mode = QED_RDMA_CQ_MODE_32_BITS;
in_params->max_mtu = dev->ndev->mtu; in_params->max_mtu = dev->ndev->mtu;
dev->iwarp_max_mtu = dev->ndev->mtu;
ether_addr_copy(&in_params->mac_addr[0], dev->ndev->dev_addr); ether_addr_copy(&in_params->mac_addr[0], dev->ndev->dev_addr);
rc = dev->ops->rdma_init(dev->cdev, in_params); rc = dev->ops->rdma_init(dev->cdev, in_params);
......
...@@ -33,6 +33,7 @@ ...@@ -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>
...@@ -43,6 +44,8 @@ ...@@ -43,6 +44,8 @@
#define QEDR_NODE_DESC "QLogic 579xx RoCE HCA" #define QEDR_NODE_DESC "QLogic 579xx RoCE HCA"
#define DP_NAME(dev) ((dev)->ibdev.name) #define DP_NAME(dev) ((dev)->ibdev.name)
#define IS_IWARP(_dev) ((_dev)->rdma_type == QED_RDMA_TYPE_IWARP)
#define IS_ROCE(_dev) ((_dev)->rdma_type == QED_RDMA_TYPE_ROCE)
#define DP_DEBUG(dev, module, fmt, ...) \ #define DP_DEBUG(dev, module, fmt, ...) \
pr_debug("(%s) " module ": " fmt, \ pr_debug("(%s) " module ": " fmt, \
...@@ -56,6 +59,7 @@ ...@@ -56,6 +59,7 @@
#define QEDR_MSG_SQ " SQ" #define QEDR_MSG_SQ " SQ"
#define QEDR_MSG_QP " QP" #define QEDR_MSG_QP " QP"
#define QEDR_MSG_GSI " GSI" #define QEDR_MSG_GSI " GSI"
#define QEDR_MSG_IWARP " IW"
#define QEDR_CQ_MAGIC_NUMBER (0x11223344) #define QEDR_CQ_MAGIC_NUMBER (0x11223344)
...@@ -160,6 +164,11 @@ struct qedr_dev { ...@@ -160,6 +164,11 @@ struct qedr_dev {
struct qedr_cq *gsi_sqcq; struct qedr_cq *gsi_sqcq;
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;
spinlock_t idr_lock; /* Protect qpidr data-structure */
struct idr qpidr;
struct workqueue_struct *iwarp_wq;
u16 iwarp_max_mtu;
unsigned long enet_state; unsigned long enet_state;
...@@ -317,6 +326,9 @@ struct qedr_qp_hwq_info { ...@@ -317,6 +326,9 @@ struct qedr_qp_hwq_info {
/* DB */ /* DB */
void __iomem *db; void __iomem *db;
union db_prod32 db_data; union db_prod32 db_data;
void __iomem *iwarp_db2;
union db_prod32 iwarp_db2_data;
}; };
#define QEDR_INC_SW_IDX(p_info, index) \ #define QEDR_INC_SW_IDX(p_info, index) \
...@@ -337,7 +349,7 @@ enum qedr_qp_err_bitmap { ...@@ -337,7 +349,7 @@ enum qedr_qp_err_bitmap {
struct qedr_qp { struct qedr_qp {
struct ib_qp ibqp; /* must be first */ struct ib_qp ibqp; /* must be first */
struct qedr_dev *dev; struct qedr_dev *dev;
struct qedr_iw_ep *ep;
struct qedr_qp_hwq_info sq; struct qedr_qp_hwq_info sq;
struct qedr_qp_hwq_info rq; struct qedr_qp_hwq_info rq;
...@@ -394,6 +406,8 @@ struct qedr_qp { ...@@ -394,6 +406,8 @@ 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;
bool destroyed;
}; };
struct qedr_ah { struct qedr_ah {
...@@ -474,6 +488,21 @@ static inline int qedr_get_dmac(struct qedr_dev *dev, ...@@ -474,6 +488,21 @@ static inline int qedr_get_dmac(struct qedr_dev *dev,
return 0; return 0;
} }
struct qedr_iw_listener {
struct qedr_dev *dev;
struct iw_cm_id *cm_id;
int backlog;
void *qed_handle;
};
struct qedr_iw_ep {
struct qedr_dev *dev;
struct iw_cm_id *cm_id;
struct qedr_qp *qp;
void *qed_context;
u8 during_connect;
};
static inline static inline
struct qedr_ucontext *get_qedr_ucontext(struct ib_ucontext *ibucontext) struct qedr_ucontext *get_qedr_ucontext(struct ib_ucontext *ibucontext)
{ {
......
...@@ -655,8 +655,10 @@ struct rdma_sq_rdma_wqe_1st { ...@@ -655,8 +655,10 @@ struct rdma_sq_rdma_wqe_1st {
#define RDMA_SQ_RDMA_WQE_1ST_INLINE_FLG_SHIFT 4 #define RDMA_SQ_RDMA_WQE_1ST_INLINE_FLG_SHIFT 4
#define RDMA_SQ_RDMA_WQE_1ST_DIF_ON_HOST_FLG_MASK 0x1 #define RDMA_SQ_RDMA_WQE_1ST_DIF_ON_HOST_FLG_MASK 0x1
#define RDMA_SQ_RDMA_WQE_1ST_DIF_ON_HOST_FLG_SHIFT 5 #define RDMA_SQ_RDMA_WQE_1ST_DIF_ON_HOST_FLG_SHIFT 5
#define RDMA_SQ_RDMA_WQE_1ST_RESERVED0_MASK 0x3 #define RDMA_SQ_RDMA_WQE_1ST_READ_INV_FLG_MASK 0x1
#define RDMA_SQ_RDMA_WQE_1ST_RESERVED0_SHIFT 6 #define RDMA_SQ_RDMA_WQE_1ST_READ_INV_FLG_SHIFT 6
#define RDMA_SQ_RDMA_WQE_1ST_RESERVED0_MASK 0x1
#define RDMA_SQ_RDMA_WQE_1ST_RESERVED0_SHIFT 7
u8 wqe_size; u8 wqe_size;
u8 prev_wqe_size; u8 prev_wqe_size;
}; };
......
This diff is collapsed.
/* 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>
int qedr_iw_connect(struct iw_cm_id *cm_id,
struct iw_cm_conn_param *conn_param);
int qedr_iw_create_listen(struct iw_cm_id *cm_id, int backlog);
int qedr_iw_destroy_listen(struct iw_cm_id *cm_id);
int qedr_iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param);
int qedr_iw_reject(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len);
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);
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include "qedr.h" #include "qedr.h"
#include "verbs.h" #include "verbs.h"
#include <rdma/qedr-abi.h> #include <rdma/qedr-abi.h>
#include "qedr_cm.h" #include "qedr_roce_cm.h"
void qedr_inc_sw_gsi_cons(struct qedr_qp_hwq_info *info) void qedr_inc_sw_gsi_cons(struct qedr_qp_hwq_info *info)
{ {
......
This diff is collapsed.
...@@ -39,6 +39,8 @@ int qedr_modify_port(struct ib_device *, u8 port, int mask, ...@@ -39,6 +39,8 @@ int qedr_modify_port(struct ib_device *, u8 port, int mask,
struct ib_port_modify *props); struct ib_port_modify *props);
int qedr_query_gid(struct ib_device *, u8 port, int index, union ib_gid *gid); int qedr_query_gid(struct ib_device *, u8 port, int index, union ib_gid *gid);
int qedr_iw_query_gid(struct ib_device *ibdev, u8 port,
int index, union ib_gid *gid);
int qedr_query_pkey(struct ib_device *, u8 port, u16 index, u16 *pkey); int qedr_query_pkey(struct ib_device *, u8 port, u16 index, u16 *pkey);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment