mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma updates from Jason Gunthorpe: - Minor bug fixes in mlx5, mthca, pvrdma, rtrs, mlx4, hfi1, hns - Minor cleanups: coding style, useless includes and documentation - Reorganize how multicast processing works in rxe - Replace a red/black tree with xarray in rxe which improves performance - DSCP support and HW address handle re-use in irdma - Simplify the mailbox command handling in hns - Simplify iser now that FMR is eliminated * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (93 commits) RDMA/nldev: Prevent underflow in nldev_stat_set_counter_dynamic_doit() IB/iser: Fix error flow in case of registration failure IB/iser: Generalize map/unmap dma tasks IB/iser: Use iser_fr_desc as registration context IB/iser: Remove iser_reg_data_sg helper function RDMA/rxe: Use standard names for ref counting RDMA/rxe: Replace red-black trees by xarrays RDMA/rxe: Shorten pool names in rxe_pool.c RDMA/rxe: Move max_elem into rxe_type_info RDMA/rxe: Replace obj by elem in declaration RDMA/rxe: Delete _locked() APIs for pool objects RDMA/rxe: Reverse the sense of RXE_POOL_NO_ALLOC RDMA/rxe: Replace mr by rkey in responder resources RDMA/rxe: Fix ref error in rxe_av.c RDMA/hns: Use the reserved loopback QPs to free MR before destroying MPT RDMA/irdma: Add support for address handle re-use RDMA/qib: Fix typos in comments RDMA/mlx5: Fix memory leak in error flow for subscribe event routine Revert "RDMA/core: Fix ib_qp_usecnt_dec() called when error" RDMA/rxe: Remove useless argument for update_state() ...
This commit is contained in:
@@ -37,7 +37,6 @@
|
||||
#include <linux/inetdevice.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/module.h>
|
||||
#include <net/arp.h>
|
||||
#include <net/neighbour.h>
|
||||
#include <net/route.h>
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
@@ -2642,7 +2642,7 @@ int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout)
|
||||
{
|
||||
struct rdma_id_private *id_priv;
|
||||
|
||||
if (id->qp_type != IB_QPT_RC)
|
||||
if (id->qp_type != IB_QPT_RC && id->qp_type != IB_QPT_XRC_INI)
|
||||
return -EINVAL;
|
||||
|
||||
id_priv = container_of(id, struct rdma_id_private, id);
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/configfs.h>
|
||||
#include <rdma/ib_verbs.h>
|
||||
#include <rdma/rdma_cm.h>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015 HGST, a Western Digital Company.
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/slab.h>
|
||||
#include <rdma/ib_verbs.h>
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#ifndef _IWPM_UTIL_H
|
||||
#define _IWPM_UTIL_H
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/in6.h>
|
||||
|
||||
@@ -1951,9 +1951,10 @@ static int nldev_stat_set_counter_dynamic_doit(struct nlattr *tb[],
|
||||
u32 port)
|
||||
{
|
||||
struct rdma_hw_stats *stats;
|
||||
int rem, i, index, ret = 0;
|
||||
struct nlattr *entry_attr;
|
||||
unsigned long *target;
|
||||
int rem, i, ret = 0;
|
||||
u32 index;
|
||||
|
||||
stats = ib_get_hw_stats_port(device, port);
|
||||
if (!stats)
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/random.h>
|
||||
|
||||
@@ -268,9 +268,6 @@ struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags,
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
pd->device = device;
|
||||
pd->uobject = NULL;
|
||||
pd->__internal_mr = NULL;
|
||||
atomic_set(&pd->usecnt, 0);
|
||||
pd->flags = flags;
|
||||
|
||||
rdma_restrack_new(&pd->res, RDMA_RESTRACK_PD);
|
||||
@@ -341,11 +338,6 @@ int ib_dealloc_pd_user(struct ib_pd *pd, struct ib_udata *udata)
|
||||
pd->__internal_mr = NULL;
|
||||
}
|
||||
|
||||
/* uverbs manipulates usecnt with proper locking, while the kabi
|
||||
* requires the caller to guarantee we can't race here.
|
||||
*/
|
||||
WARN_ON(atomic_read(&pd->usecnt));
|
||||
|
||||
ret = pd->device->ops.dealloc_pd(pd, udata);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -2153,6 +2145,7 @@ struct ib_mr *ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
|
||||
return mr;
|
||||
|
||||
mr->device = pd->device;
|
||||
mr->type = IB_MR_TYPE_USER;
|
||||
mr->pd = pd;
|
||||
mr->dm = NULL;
|
||||
atomic_inc(&pd->usecnt);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <linux/topology.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/numa.h>
|
||||
|
||||
@@ -667,7 +666,7 @@ int hfi1_dev_affinity_init(struct hfi1_devdata *dd)
|
||||
* engines, use the same CPU cores as general/control
|
||||
* context.
|
||||
*/
|
||||
if (cpumask_weight(&entry->def_intr.mask) == 0)
|
||||
if (cpumask_empty(&entry->def_intr.mask))
|
||||
cpumask_copy(&entry->def_intr.mask,
|
||||
&entry->general_intr_mask);
|
||||
}
|
||||
@@ -687,7 +686,7 @@ int hfi1_dev_affinity_init(struct hfi1_devdata *dd)
|
||||
* vectors, use the same CPU core as the general/control
|
||||
* context.
|
||||
*/
|
||||
if (cpumask_weight(&entry->comp_vect_mask) == 0)
|
||||
if (cpumask_empty(&entry->comp_vect_mask))
|
||||
cpumask_copy(&entry->comp_vect_mask,
|
||||
&entry->general_intr_mask);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/ratelimit.h>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/fs.h>
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/bitmap.h>
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/crc32.h>
|
||||
|
||||
|
||||
@@ -1397,8 +1397,7 @@ static int query_port(struct rvt_dev_info *rdi, u32 port_num,
|
||||
4096 : hfi1_max_mtu), IB_MTU_4096);
|
||||
props->active_mtu = !valid_ib_mtu(ppd->ibmtu) ? props->max_mtu :
|
||||
mtu_to_enum(ppd->ibmtu, IB_MTU_4096);
|
||||
props->phys_mtu = HFI1_CAP_IS_KSET(AIP) ? hfi1_max_mtu :
|
||||
ib_mtu_enum_to_int(props->max_mtu);
|
||||
props->phys_mtu = hfi1_max_mtu;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -38,45 +38,36 @@
|
||||
#define CMD_POLL_TOKEN 0xffff
|
||||
#define CMD_MAX_NUM 32
|
||||
|
||||
static int hns_roce_cmd_mbox_post_hw(struct hns_roce_dev *hr_dev, u64 in_param,
|
||||
u64 out_param, u32 in_modifier,
|
||||
u8 op_modifier, u16 op, u16 token,
|
||||
int event)
|
||||
static int hns_roce_cmd_mbox_post_hw(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_mbox_msg *mbox_msg)
|
||||
{
|
||||
return hr_dev->hw->post_mbox(hr_dev, in_param, out_param, in_modifier,
|
||||
op_modifier, op, token, event);
|
||||
return hr_dev->hw->post_mbox(hr_dev, mbox_msg);
|
||||
}
|
||||
|
||||
/* this should be called with "poll_sem" */
|
||||
static int __hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, u64 in_param,
|
||||
u64 out_param, unsigned long in_modifier,
|
||||
u8 op_modifier, u16 op,
|
||||
unsigned int timeout)
|
||||
static int __hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_mbox_msg *mbox_msg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = hns_roce_cmd_mbox_post_hw(hr_dev, in_param, out_param,
|
||||
in_modifier, op_modifier, op,
|
||||
CMD_POLL_TOKEN, 0);
|
||||
ret = hns_roce_cmd_mbox_post_hw(hr_dev, mbox_msg);
|
||||
if (ret) {
|
||||
dev_err_ratelimited(hr_dev->dev,
|
||||
"failed to post mailbox 0x%x in poll mode, ret = %d.\n",
|
||||
op, ret);
|
||||
mbox_msg->cmd, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return hr_dev->hw->poll_mbox_done(hr_dev, timeout);
|
||||
return hr_dev->hw->poll_mbox_done(hr_dev);
|
||||
}
|
||||
|
||||
static int hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, u64 in_param,
|
||||
u64 out_param, unsigned long in_modifier,
|
||||
u8 op_modifier, u16 op, unsigned int timeout)
|
||||
static int hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_mbox_msg *mbox_msg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
down(&hr_dev->cmd.poll_sem);
|
||||
ret = __hns_roce_cmd_mbox_poll(hr_dev, in_param, out_param, in_modifier,
|
||||
op_modifier, op, timeout);
|
||||
ret = __hns_roce_cmd_mbox_poll(hr_dev, mbox_msg);
|
||||
up(&hr_dev->cmd.poll_sem);
|
||||
|
||||
return ret;
|
||||
@@ -100,10 +91,8 @@ void hns_roce_cmd_event(struct hns_roce_dev *hr_dev, u16 token, u8 status,
|
||||
complete(&context->done);
|
||||
}
|
||||
|
||||
static int __hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 in_param,
|
||||
u64 out_param, unsigned long in_modifier,
|
||||
u8 op_modifier, u16 op,
|
||||
unsigned int timeout)
|
||||
static int __hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_mbox_msg *mbox_msg)
|
||||
{
|
||||
struct hns_roce_cmdq *cmd = &hr_dev->cmd;
|
||||
struct hns_roce_cmd_context *context;
|
||||
@@ -124,20 +113,19 @@ static int __hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 in_param,
|
||||
|
||||
reinit_completion(&context->done);
|
||||
|
||||
ret = hns_roce_cmd_mbox_post_hw(hr_dev, in_param, out_param,
|
||||
in_modifier, op_modifier, op,
|
||||
context->token, 1);
|
||||
mbox_msg->token = context->token;
|
||||
ret = hns_roce_cmd_mbox_post_hw(hr_dev, mbox_msg);
|
||||
if (ret) {
|
||||
dev_err_ratelimited(dev,
|
||||
"failed to post mailbox 0x%x in event mode, ret = %d.\n",
|
||||
op, ret);
|
||||
mbox_msg->cmd, ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!wait_for_completion_timeout(&context->done,
|
||||
msecs_to_jiffies(timeout))) {
|
||||
msecs_to_jiffies(HNS_ROCE_CMD_TIMEOUT_MSECS))) {
|
||||
dev_err_ratelimited(dev, "[cmd] token 0x%x mailbox 0x%x timeout.\n",
|
||||
context->token, op);
|
||||
context->token, mbox_msg->cmd);
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
@@ -145,45 +133,50 @@ static int __hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 in_param,
|
||||
ret = context->result;
|
||||
if (ret)
|
||||
dev_err_ratelimited(dev, "[cmd] token 0x%x mailbox 0x%x error %d.\n",
|
||||
context->token, op, ret);
|
||||
context->token, mbox_msg->cmd, ret);
|
||||
|
||||
out:
|
||||
context->busy = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 in_param,
|
||||
u64 out_param, unsigned long in_modifier,
|
||||
u8 op_modifier, u16 op, unsigned int timeout)
|
||||
static int hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_mbox_msg *mbox_msg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
down(&hr_dev->cmd.event_sem);
|
||||
ret = __hns_roce_cmd_mbox_wait(hr_dev, in_param, out_param, in_modifier,
|
||||
op_modifier, op, timeout);
|
||||
ret = __hns_roce_cmd_mbox_wait(hr_dev, mbox_msg);
|
||||
up(&hr_dev->cmd.event_sem);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int hns_roce_cmd_mbox(struct hns_roce_dev *hr_dev, u64 in_param, u64 out_param,
|
||||
unsigned long in_modifier, u8 op_modifier, u16 op,
|
||||
unsigned int timeout)
|
||||
u8 cmd, unsigned long tag)
|
||||
{
|
||||
struct hns_roce_mbox_msg mbox_msg = {};
|
||||
bool is_busy;
|
||||
|
||||
if (hr_dev->hw->chk_mbox_avail)
|
||||
if (!hr_dev->hw->chk_mbox_avail(hr_dev, &is_busy))
|
||||
return is_busy ? -EBUSY : 0;
|
||||
|
||||
if (hr_dev->cmd.use_events)
|
||||
return hns_roce_cmd_mbox_wait(hr_dev, in_param, out_param,
|
||||
in_modifier, op_modifier, op,
|
||||
timeout);
|
||||
else
|
||||
return hns_roce_cmd_mbox_poll(hr_dev, in_param, out_param,
|
||||
in_modifier, op_modifier, op,
|
||||
timeout);
|
||||
mbox_msg.in_param = in_param;
|
||||
mbox_msg.out_param = out_param;
|
||||
mbox_msg.cmd = cmd;
|
||||
mbox_msg.tag = tag;
|
||||
|
||||
if (hr_dev->cmd.use_events) {
|
||||
mbox_msg.event_en = 1;
|
||||
|
||||
return hns_roce_cmd_mbox_wait(hr_dev, &mbox_msg);
|
||||
} else {
|
||||
mbox_msg.event_en = 0;
|
||||
mbox_msg.token = CMD_POLL_TOKEN;
|
||||
|
||||
return hns_roce_cmd_mbox_poll(hr_dev, &mbox_msg);
|
||||
}
|
||||
}
|
||||
|
||||
int hns_roce_cmd_init(struct hns_roce_dev *hr_dev)
|
||||
@@ -269,3 +262,15 @@ void hns_roce_free_cmd_mailbox(struct hns_roce_dev *hr_dev,
|
||||
dma_pool_free(hr_dev->cmd.pool, mailbox->buf, mailbox->dma);
|
||||
kfree(mailbox);
|
||||
}
|
||||
|
||||
int hns_roce_create_hw_ctx(struct hns_roce_dev *dev,
|
||||
struct hns_roce_cmd_mailbox *mailbox,
|
||||
u8 cmd, unsigned long idx)
|
||||
{
|
||||
return hns_roce_cmd_mbox(dev, mailbox->dma, 0, cmd, idx);
|
||||
}
|
||||
|
||||
int hns_roce_destroy_hw_ctx(struct hns_roce_dev *dev, u8 cmd, unsigned long idx)
|
||||
{
|
||||
return hns_roce_cmd_mbox(dev, 0, 0, cmd, idx);
|
||||
}
|
||||
|
||||
@@ -140,12 +140,16 @@ enum {
|
||||
};
|
||||
|
||||
int hns_roce_cmd_mbox(struct hns_roce_dev *hr_dev, u64 in_param, u64 out_param,
|
||||
unsigned long in_modifier, u8 op_modifier, u16 op,
|
||||
unsigned int timeout);
|
||||
u8 cmd, unsigned long tag);
|
||||
|
||||
struct hns_roce_cmd_mailbox *
|
||||
hns_roce_alloc_cmd_mailbox(struct hns_roce_dev *hr_dev);
|
||||
void hns_roce_free_cmd_mailbox(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_cmd_mailbox *mailbox);
|
||||
int hns_roce_create_hw_ctx(struct hns_roce_dev *dev,
|
||||
struct hns_roce_cmd_mailbox *mailbox,
|
||||
u8 cmd, unsigned long idx);
|
||||
int hns_roce_destroy_hw_ctx(struct hns_roce_dev *dev, u8 cmd,
|
||||
unsigned long idx);
|
||||
|
||||
#endif /* _HNS_ROCE_CMD_H */
|
||||
|
||||
@@ -100,12 +100,39 @@ static void free_cqn(struct hns_roce_dev *hr_dev, unsigned long cqn)
|
||||
mutex_unlock(&cq_table->bank_mutex);
|
||||
}
|
||||
|
||||
static int hns_roce_create_cqc(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_cq *hr_cq,
|
||||
u64 *mtts, dma_addr_t dma_handle)
|
||||
{
|
||||
struct ib_device *ibdev = &hr_dev->ib_dev;
|
||||
struct hns_roce_cmd_mailbox *mailbox;
|
||||
int ret;
|
||||
|
||||
mailbox = hns_roce_alloc_cmd_mailbox(hr_dev);
|
||||
if (IS_ERR(mailbox)) {
|
||||
ibdev_err(ibdev, "failed to alloc mailbox for CQC.\n");
|
||||
return PTR_ERR(mailbox);
|
||||
}
|
||||
|
||||
hr_dev->hw->write_cqc(hr_dev, hr_cq, mailbox->buf, mtts, dma_handle);
|
||||
|
||||
ret = hns_roce_create_hw_ctx(hr_dev, mailbox, HNS_ROCE_CMD_CREATE_CQC,
|
||||
hr_cq->cqn);
|
||||
if (ret)
|
||||
ibdev_err(ibdev,
|
||||
"failed to send create cmd for CQ(0x%lx), ret = %d.\n",
|
||||
hr_cq->cqn, ret);
|
||||
|
||||
hns_roce_free_cmd_mailbox(hr_dev, mailbox);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)
|
||||
{
|
||||
struct hns_roce_cq_table *cq_table = &hr_dev->cq_table;
|
||||
struct ib_device *ibdev = &hr_dev->ib_dev;
|
||||
struct hns_roce_cmd_mailbox *mailbox;
|
||||
u64 mtts[MTT_MIN_COUNT] = { 0 };
|
||||
u64 mtts[MTT_MIN_COUNT] = {};
|
||||
dma_addr_t dma_handle;
|
||||
int ret;
|
||||
|
||||
@@ -121,7 +148,7 @@ static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)
|
||||
if (ret) {
|
||||
ibdev_err(ibdev, "failed to get CQ(0x%lx) context, ret = %d.\n",
|
||||
hr_cq->cqn, ret);
|
||||
goto err_out;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = xa_err(xa_store(&cq_table->array, hr_cq->cqn, hr_cq, GFP_KERNEL));
|
||||
@@ -130,41 +157,17 @@ static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)
|
||||
goto err_put;
|
||||
}
|
||||
|
||||
/* Allocate mailbox memory */
|
||||
mailbox = hns_roce_alloc_cmd_mailbox(hr_dev);
|
||||
if (IS_ERR(mailbox)) {
|
||||
ret = PTR_ERR(mailbox);
|
||||
ret = hns_roce_create_cqc(hr_dev, hr_cq, mtts, dma_handle);
|
||||
if (ret)
|
||||
goto err_xa;
|
||||
}
|
||||
|
||||
hr_dev->hw->write_cqc(hr_dev, hr_cq, mailbox->buf, mtts, dma_handle);
|
||||
|
||||
/* Send mailbox to hw */
|
||||
ret = hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, hr_cq->cqn, 0,
|
||||
HNS_ROCE_CMD_CREATE_CQC, HNS_ROCE_CMD_TIMEOUT_MSECS);
|
||||
hns_roce_free_cmd_mailbox(hr_dev, mailbox);
|
||||
if (ret) {
|
||||
ibdev_err(ibdev,
|
||||
"failed to send create cmd for CQ(0x%lx), ret = %d.\n",
|
||||
hr_cq->cqn, ret);
|
||||
goto err_xa;
|
||||
}
|
||||
|
||||
hr_cq->cons_index = 0;
|
||||
hr_cq->arm_sn = 1;
|
||||
|
||||
refcount_set(&hr_cq->refcount, 1);
|
||||
init_completion(&hr_cq->free);
|
||||
|
||||
return 0;
|
||||
|
||||
err_xa:
|
||||
xa_erase(&cq_table->array, hr_cq->cqn);
|
||||
|
||||
err_put:
|
||||
hns_roce_table_put(hr_dev, &cq_table->table, hr_cq->cqn);
|
||||
|
||||
err_out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -174,9 +177,8 @@ static void free_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)
|
||||
struct device *dev = hr_dev->dev;
|
||||
int ret;
|
||||
|
||||
ret = hns_roce_cmd_mbox(hr_dev, 0, 0, hr_cq->cqn, 1,
|
||||
HNS_ROCE_CMD_DESTROY_CQC,
|
||||
HNS_ROCE_CMD_TIMEOUT_MSECS);
|
||||
ret = hns_roce_destroy_hw_ctx(hr_dev, HNS_ROCE_CMD_DESTROY_CQC,
|
||||
hr_cq->cqn);
|
||||
if (ret)
|
||||
dev_err(dev, "DESTROY_CQ failed (%d) for CQN %06lx\n", ret,
|
||||
hr_cq->cqn);
|
||||
@@ -413,6 +415,11 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr,
|
||||
goto err_cqc;
|
||||
}
|
||||
|
||||
hr_cq->cons_index = 0;
|
||||
hr_cq->arm_sn = 1;
|
||||
refcount_set(&hr_cq->refcount, 1);
|
||||
init_completion(&hr_cq->free);
|
||||
|
||||
return 0;
|
||||
|
||||
err_cqc:
|
||||
|
||||
@@ -561,6 +561,15 @@ struct hns_roce_cmd_mailbox {
|
||||
dma_addr_t dma;
|
||||
};
|
||||
|
||||
struct hns_roce_mbox_msg {
|
||||
u64 in_param;
|
||||
u64 out_param;
|
||||
u8 cmd;
|
||||
u32 tag;
|
||||
u16 token;
|
||||
u8 event_en;
|
||||
};
|
||||
|
||||
struct hns_roce_dev;
|
||||
|
||||
struct hns_roce_rinl_sge {
|
||||
@@ -624,6 +633,7 @@ struct hns_roce_qp {
|
||||
u32 next_sge;
|
||||
enum ib_mtu path_mtu;
|
||||
u32 max_inline_data;
|
||||
u8 free_mr_en;
|
||||
|
||||
/* 0: flush needed, 1: unneeded */
|
||||
unsigned long flush_flag;
|
||||
@@ -851,11 +861,9 @@ struct hns_roce_hw {
|
||||
int (*hw_profile)(struct hns_roce_dev *hr_dev);
|
||||
int (*hw_init)(struct hns_roce_dev *hr_dev);
|
||||
void (*hw_exit)(struct hns_roce_dev *hr_dev);
|
||||
int (*post_mbox)(struct hns_roce_dev *hr_dev, u64 in_param,
|
||||
u64 out_param, u32 in_modifier, u8 op_modifier, u16 op,
|
||||
u16 token, int event);
|
||||
int (*poll_mbox_done)(struct hns_roce_dev *hr_dev,
|
||||
unsigned int timeout);
|
||||
int (*post_mbox)(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_mbox_msg *mbox_msg);
|
||||
int (*poll_mbox_done)(struct hns_roce_dev *hr_dev);
|
||||
bool (*chk_mbox_avail)(struct hns_roce_dev *hr_dev, bool *is_busy);
|
||||
int (*set_gid)(struct hns_roce_dev *hr_dev, int gid_index,
|
||||
const union ib_gid *gid, const struct ib_gid_attr *attr);
|
||||
@@ -873,15 +881,16 @@ struct hns_roce_hw {
|
||||
struct hns_roce_cq *hr_cq, void *mb_buf, u64 *mtts,
|
||||
dma_addr_t dma_handle);
|
||||
int (*set_hem)(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_hem_table *table, int obj, int step_idx);
|
||||
struct hns_roce_hem_table *table, int obj, u32 step_idx);
|
||||
int (*clear_hem)(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_hem_table *table, int obj,
|
||||
int step_idx);
|
||||
u32 step_idx);
|
||||
int (*modify_qp)(struct ib_qp *ibqp, const struct ib_qp_attr *attr,
|
||||
int attr_mask, enum ib_qp_state cur_state,
|
||||
enum ib_qp_state new_state);
|
||||
int (*qp_flow_control_init)(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_qp *hr_qp);
|
||||
void (*dereg_mr)(struct hns_roce_dev *hr_dev);
|
||||
int (*init_eq)(struct hns_roce_dev *hr_dev);
|
||||
void (*cleanup_eq)(struct hns_roce_dev *hr_dev);
|
||||
int (*write_srqc)(struct hns_roce_srq *srq, void *mb_buf);
|
||||
@@ -1145,9 +1154,6 @@ struct ib_mr *hns_roce_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
|
||||
int hns_roce_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents,
|
||||
unsigned int *sg_offset);
|
||||
int hns_roce_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata);
|
||||
int hns_roce_hw_destroy_mpt(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_cmd_mailbox *mailbox,
|
||||
unsigned long mpt_index);
|
||||
unsigned long key_to_hw_index(u32 key);
|
||||
|
||||
int hns_roce_alloc_mw(struct ib_mw *mw, struct ib_udata *udata);
|
||||
|
||||
@@ -488,7 +488,7 @@ static int set_mhop_hem(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_hem_index *index)
|
||||
{
|
||||
struct ib_device *ibdev = &hr_dev->ib_dev;
|
||||
int step_idx;
|
||||
u32 step_idx;
|
||||
int ret = 0;
|
||||
|
||||
if (index->inited & HEM_INDEX_L0) {
|
||||
@@ -618,7 +618,7 @@ static void clear_mhop_hem(struct hns_roce_dev *hr_dev,
|
||||
struct ib_device *ibdev = &hr_dev->ib_dev;
|
||||
u32 hop_num = mhop->hop_num;
|
||||
u32 chunk_ba_num;
|
||||
int step_idx;
|
||||
u32 step_idx;
|
||||
|
||||
index->inited = HEM_INDEX_BUF;
|
||||
chunk_ba_num = mhop->bt_chunk_size / BA_BYTE_LEN;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user