mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-20 18:54:09 +08:00
Merge branch 'for-rc' into rdma.git for-next
From git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git This is required to resolve dependencies of the next series of RDMA patches. The code motion conflicts in drivers/infiniband/core/cache.c were resolved. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
commit
59bfc59a68
@ -335,55 +335,6 @@ static int add_roce_gid(struct ib_gid_table_entry *entry)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* add_modify_gid - Add or modify GID table entry
|
||||
*
|
||||
* @table: GID table in which GID to be added or modified
|
||||
* @attr: Attributes of the GID
|
||||
*
|
||||
* Returns 0 on success or appropriate error code. It accepts zero
|
||||
* GID addition for non RoCE ports for HCA's who report them as valid
|
||||
* GID. However such zero GIDs are not added to the cache.
|
||||
*/
|
||||
static int add_modify_gid(struct ib_gid_table *table,
|
||||
const struct ib_gid_attr *attr)
|
||||
{
|
||||
struct ib_gid_table_entry *entry;
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* Invalidate any old entry in the table to make it safe to write to
|
||||
* this index.
|
||||
*/
|
||||
if (is_gid_entry_valid(table->data_vec[attr->index]))
|
||||
put_gid_entry(table->data_vec[attr->index]);
|
||||
|
||||
/*
|
||||
* Some HCA's report multiple GID entries with only one valid GID, and
|
||||
* leave other unused entries as the zero GID. Convert zero GIDs to
|
||||
* empty table entries instead of storing them.
|
||||
*/
|
||||
if (rdma_is_zero_gid(&attr->gid))
|
||||
return 0;
|
||||
|
||||
entry = alloc_gid_entry(attr);
|
||||
if (!entry)
|
||||
return -ENOMEM;
|
||||
|
||||
if (rdma_protocol_roce(attr->device, attr->port_num)) {
|
||||
ret = add_roce_gid(entry);
|
||||
if (ret)
|
||||
goto done;
|
||||
}
|
||||
|
||||
store_gid_entry(table, entry);
|
||||
return 0;
|
||||
|
||||
done:
|
||||
put_gid_entry(entry);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* del_gid - Delete GID table entry
|
||||
*
|
||||
@ -416,6 +367,55 @@ static void del_gid(struct ib_device *ib_dev, u8 port,
|
||||
put_gid_entry_locked(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* add_modify_gid - Add or modify GID table entry
|
||||
*
|
||||
* @table: GID table in which GID to be added or modified
|
||||
* @attr: Attributes of the GID
|
||||
*
|
||||
* Returns 0 on success or appropriate error code. It accepts zero
|
||||
* GID addition for non RoCE ports for HCA's who report them as valid
|
||||
* GID. However such zero GIDs are not added to the cache.
|
||||
*/
|
||||
static int add_modify_gid(struct ib_gid_table *table,
|
||||
const struct ib_gid_attr *attr)
|
||||
{
|
||||
struct ib_gid_table_entry *entry;
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* Invalidate any old entry in the table to make it safe to write to
|
||||
* this index.
|
||||
*/
|
||||
if (is_gid_entry_valid(table->data_vec[attr->index]))
|
||||
del_gid(attr->device, attr->port_num, table, attr->index);
|
||||
|
||||
/*
|
||||
* Some HCA's report multiple GID entries with only one valid GID, and
|
||||
* leave other unused entries as the zero GID. Convert zero GIDs to
|
||||
* empty table entries instead of storing them.
|
||||
*/
|
||||
if (rdma_is_zero_gid(&attr->gid))
|
||||
return 0;
|
||||
|
||||
entry = alloc_gid_entry(attr);
|
||||
if (!entry)
|
||||
return -ENOMEM;
|
||||
|
||||
if (rdma_protocol_roce(attr->device, attr->port_num)) {
|
||||
ret = add_roce_gid(entry);
|
||||
if (ret)
|
||||
goto done;
|
||||
}
|
||||
|
||||
store_gid_entry(table, entry);
|
||||
return 0;
|
||||
|
||||
done:
|
||||
put_gid_entry(entry);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* rwlock should be read locked, or lock should be held */
|
||||
static int find_gid(struct ib_gid_table *table, const union ib_gid *gid,
|
||||
const struct ib_gid_attr *val, bool default_gid,
|
||||
|
@ -816,6 +816,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
|
||||
dgid = (union ib_gid *) &addr->sib_addr;
|
||||
pkey = ntohs(addr->sib_pkey);
|
||||
|
||||
mutex_lock(&lock);
|
||||
list_for_each_entry(cur_dev, &dev_list, list) {
|
||||
for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
|
||||
if (!rdma_cap_af_ib(cur_dev->device, p))
|
||||
@ -842,18 +843,19 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
|
||||
cma_dev = cur_dev;
|
||||
sgid = gid;
|
||||
id_priv->id.port_num = p;
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!cma_dev)
|
||||
return -ENODEV;
|
||||
mutex_unlock(&lock);
|
||||
return -ENODEV;
|
||||
|
||||
found:
|
||||
cma_attach_to_dev(id_priv, cma_dev);
|
||||
addr = (struct sockaddr_ib *) cma_src_addr(id_priv);
|
||||
memcpy(&addr->sib_addr, &sgid, sizeof sgid);
|
||||
mutex_unlock(&lock);
|
||||
addr = (struct sockaddr_ib *)cma_src_addr(id_priv);
|
||||
memcpy(&addr->sib_addr, &sgid, sizeof(sgid));
|
||||
cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1759,6 +1759,8 @@ static int ucma_close(struct inode *inode, struct file *filp)
|
||||
mutex_lock(&mut);
|
||||
if (!ctx->closing) {
|
||||
mutex_unlock(&mut);
|
||||
ucma_put_ctx(ctx);
|
||||
wait_for_completion(&ctx->comp);
|
||||
/* rdma_destroy_id ensures that no event handlers are
|
||||
* inflight for that id before releasing it.
|
||||
*/
|
||||
|
@ -2020,33 +2020,55 @@ static int modify_qp(struct ib_uverbs_file *file,
|
||||
|
||||
if ((cmd->base.attr_mask & IB_QP_CUR_STATE &&
|
||||
cmd->base.cur_qp_state > IB_QPS_ERR) ||
|
||||
cmd->base.qp_state > IB_QPS_ERR) {
|
||||
(cmd->base.attr_mask & IB_QP_STATE &&
|
||||
cmd->base.qp_state > IB_QPS_ERR)) {
|
||||
ret = -EINVAL;
|
||||
goto release_qp;
|
||||
}
|
||||
|
||||
attr->qp_state = cmd->base.qp_state;
|
||||
attr->cur_qp_state = cmd->base.cur_qp_state;
|
||||
attr->path_mtu = cmd->base.path_mtu;
|
||||
attr->path_mig_state = cmd->base.path_mig_state;
|
||||
attr->qkey = cmd->base.qkey;
|
||||
attr->rq_psn = cmd->base.rq_psn;
|
||||
attr->sq_psn = cmd->base.sq_psn;
|
||||
attr->dest_qp_num = cmd->base.dest_qp_num;
|
||||
attr->qp_access_flags = cmd->base.qp_access_flags;
|
||||
attr->pkey_index = cmd->base.pkey_index;
|
||||
attr->alt_pkey_index = cmd->base.alt_pkey_index;
|
||||
attr->en_sqd_async_notify = cmd->base.en_sqd_async_notify;
|
||||
attr->max_rd_atomic = cmd->base.max_rd_atomic;
|
||||
attr->max_dest_rd_atomic = cmd->base.max_dest_rd_atomic;
|
||||
attr->min_rnr_timer = cmd->base.min_rnr_timer;
|
||||
attr->port_num = cmd->base.port_num;
|
||||
attr->timeout = cmd->base.timeout;
|
||||
attr->retry_cnt = cmd->base.retry_cnt;
|
||||
attr->rnr_retry = cmd->base.rnr_retry;
|
||||
attr->alt_port_num = cmd->base.alt_port_num;
|
||||
attr->alt_timeout = cmd->base.alt_timeout;
|
||||
attr->rate_limit = cmd->rate_limit;
|
||||
if (cmd->base.attr_mask & IB_QP_STATE)
|
||||
attr->qp_state = cmd->base.qp_state;
|
||||
if (cmd->base.attr_mask & IB_QP_CUR_STATE)
|
||||
attr->cur_qp_state = cmd->base.cur_qp_state;
|
||||
if (cmd->base.attr_mask & IB_QP_PATH_MTU)
|
||||
attr->path_mtu = cmd->base.path_mtu;
|
||||
if (cmd->base.attr_mask & IB_QP_PATH_MIG_STATE)
|
||||
attr->path_mig_state = cmd->base.path_mig_state;
|
||||
if (cmd->base.attr_mask & IB_QP_QKEY)
|
||||
attr->qkey = cmd->base.qkey;
|
||||
if (cmd->base.attr_mask & IB_QP_RQ_PSN)
|
||||
attr->rq_psn = cmd->base.rq_psn;
|
||||
if (cmd->base.attr_mask & IB_QP_SQ_PSN)
|
||||
attr->sq_psn = cmd->base.sq_psn;
|
||||
if (cmd->base.attr_mask & IB_QP_DEST_QPN)
|
||||
attr->dest_qp_num = cmd->base.dest_qp_num;
|
||||
if (cmd->base.attr_mask & IB_QP_ACCESS_FLAGS)
|
||||
attr->qp_access_flags = cmd->base.qp_access_flags;
|
||||
if (cmd->base.attr_mask & IB_QP_PKEY_INDEX)
|
||||
attr->pkey_index = cmd->base.pkey_index;
|
||||
if (cmd->base.attr_mask & IB_QP_EN_SQD_ASYNC_NOTIFY)
|
||||
attr->en_sqd_async_notify = cmd->base.en_sqd_async_notify;
|
||||
if (cmd->base.attr_mask & IB_QP_MAX_QP_RD_ATOMIC)
|
||||
attr->max_rd_atomic = cmd->base.max_rd_atomic;
|
||||
if (cmd->base.attr_mask & IB_QP_MAX_DEST_RD_ATOMIC)
|
||||
attr->max_dest_rd_atomic = cmd->base.max_dest_rd_atomic;
|
||||
if (cmd->base.attr_mask & IB_QP_MIN_RNR_TIMER)
|
||||
attr->min_rnr_timer = cmd->base.min_rnr_timer;
|
||||
if (cmd->base.attr_mask & IB_QP_PORT)
|
||||
attr->port_num = cmd->base.port_num;
|
||||
if (cmd->base.attr_mask & IB_QP_TIMEOUT)
|
||||
attr->timeout = cmd->base.timeout;
|
||||
if (cmd->base.attr_mask & IB_QP_RETRY_CNT)
|
||||
attr->retry_cnt = cmd->base.retry_cnt;
|
||||
if (cmd->base.attr_mask & IB_QP_RNR_RETRY)
|
||||
attr->rnr_retry = cmd->base.rnr_retry;
|
||||
if (cmd->base.attr_mask & IB_QP_ALT_PATH) {
|
||||
attr->alt_port_num = cmd->base.alt_port_num;
|
||||
attr->alt_timeout = cmd->base.alt_timeout;
|
||||
attr->alt_pkey_index = cmd->base.alt_pkey_index;
|
||||
}
|
||||
if (cmd->base.attr_mask & IB_QP_RATE_LIMIT)
|
||||
attr->rate_limit = cmd->rate_limit;
|
||||
|
||||
if (cmd->base.attr_mask & IB_QP_AV)
|
||||
copy_ah_attr_from_uverbs(qp->device, &attr->ah_attr,
|
||||
|
@ -437,6 +437,7 @@ static int ib_uverbs_comp_event_close(struct inode *inode, struct file *filp)
|
||||
list_del(&entry->obj_list);
|
||||
kfree(entry);
|
||||
}
|
||||
file->ev_queue.is_closed = 1;
|
||||
spin_unlock_irq(&file->ev_queue.lock);
|
||||
|
||||
uverbs_close_fd(filp);
|
||||
|
@ -260,6 +260,7 @@ void uverbs_destroy_api(struct uverbs_api *uapi)
|
||||
kfree(rcu_dereference_protected(*slot, true));
|
||||
radix_tree_iter_delete(&uapi->radix, &iter, slot);
|
||||
}
|
||||
kfree(uapi);
|
||||
}
|
||||
|
||||
struct uverbs_api *uverbs_alloc_api(
|
||||
|
@ -78,7 +78,7 @@ static struct list_head bnxt_re_dev_list = LIST_HEAD_INIT(bnxt_re_dev_list);
|
||||
/* Mutex to protect the list of bnxt_re devices added */
|
||||
static DEFINE_MUTEX(bnxt_re_dev_lock);
|
||||
static struct workqueue_struct *bnxt_re_wq;
|
||||
static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait);
|
||||
static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev);
|
||||
|
||||
/* SR-IOV helper functions */
|
||||
|
||||
@ -182,7 +182,7 @@ static void bnxt_re_shutdown(void *p)
|
||||
if (!rdev)
|
||||
return;
|
||||
|
||||
bnxt_re_ib_unreg(rdev, false);
|
||||
bnxt_re_ib_unreg(rdev);
|
||||
}
|
||||
|
||||
static void bnxt_re_stop_irq(void *handle)
|
||||
@ -251,7 +251,7 @@ static struct bnxt_ulp_ops bnxt_re_ulp_ops = {
|
||||
/* Driver registration routines used to let the networking driver (bnxt_en)
|
||||
* to know that the RoCE driver is now installed
|
||||
*/
|
||||
static int bnxt_re_unregister_netdev(struct bnxt_re_dev *rdev, bool lock_wait)
|
||||
static int bnxt_re_unregister_netdev(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
struct bnxt_en_dev *en_dev;
|
||||
int rc;
|
||||
@ -260,14 +260,9 @@ static int bnxt_re_unregister_netdev(struct bnxt_re_dev *rdev, bool lock_wait)
|
||||
return -EINVAL;
|
||||
|
||||
en_dev = rdev->en_dev;
|
||||
/* Acquire rtnl lock if it is not invokded from netdev event */
|
||||
if (lock_wait)
|
||||
rtnl_lock();
|
||||
|
||||
rc = en_dev->en_ops->bnxt_unregister_device(rdev->en_dev,
|
||||
BNXT_ROCE_ULP);
|
||||
if (lock_wait)
|
||||
rtnl_unlock();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -281,14 +276,12 @@ static int bnxt_re_register_netdev(struct bnxt_re_dev *rdev)
|
||||
|
||||
en_dev = rdev->en_dev;
|
||||
|
||||
rtnl_lock();
|
||||
rc = en_dev->en_ops->bnxt_register_device(en_dev, BNXT_ROCE_ULP,
|
||||
&bnxt_re_ulp_ops, rdev);
|
||||
rtnl_unlock();
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int bnxt_re_free_msix(struct bnxt_re_dev *rdev, bool lock_wait)
|
||||
static int bnxt_re_free_msix(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
struct bnxt_en_dev *en_dev;
|
||||
int rc;
|
||||
@ -298,13 +291,9 @@ static int bnxt_re_free_msix(struct bnxt_re_dev *rdev, bool lock_wait)
|
||||
|
||||
en_dev = rdev->en_dev;
|
||||
|
||||
if (lock_wait)
|
||||
rtnl_lock();
|
||||
|
||||
rc = en_dev->en_ops->bnxt_free_msix(rdev->en_dev, BNXT_ROCE_ULP);
|
||||
|
||||
if (lock_wait)
|
||||
rtnl_unlock();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -320,7 +309,6 @@ static int bnxt_re_request_msix(struct bnxt_re_dev *rdev)
|
||||
|
||||
num_msix_want = min_t(u32, BNXT_RE_MAX_MSIX, num_online_cpus());
|
||||
|
||||
rtnl_lock();
|
||||
num_msix_got = en_dev->en_ops->bnxt_request_msix(en_dev, BNXT_ROCE_ULP,
|
||||
rdev->msix_entries,
|
||||
num_msix_want);
|
||||
@ -335,7 +323,6 @@ static int bnxt_re_request_msix(struct bnxt_re_dev *rdev)
|
||||
}
|
||||
rdev->num_msix = num_msix_got;
|
||||
done:
|
||||
rtnl_unlock();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -358,24 +345,18 @@ static void bnxt_re_fill_fw_msg(struct bnxt_fw_msg *fw_msg, void *msg,
|
||||
fw_msg->timeout = timeout;
|
||||
}
|
||||
|
||||
static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev, u16 fw_ring_id,
|
||||
bool lock_wait)
|
||||
static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev, u16 fw_ring_id)
|
||||
{
|
||||
struct bnxt_en_dev *en_dev = rdev->en_dev;
|
||||
struct hwrm_ring_free_input req = {0};
|
||||
struct hwrm_ring_free_output resp;
|
||||
struct bnxt_fw_msg fw_msg;
|
||||
bool do_unlock = false;
|
||||
int rc = -EINVAL;
|
||||
|
||||
if (!en_dev)
|
||||
return rc;
|
||||
|
||||
memset(&fw_msg, 0, sizeof(fw_msg));
|
||||
if (lock_wait) {
|
||||
rtnl_lock();
|
||||
do_unlock = true;
|
||||
}
|
||||
|
||||
bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_RING_FREE, -1, -1);
|
||||
req.ring_type = RING_ALLOC_REQ_RING_TYPE_L2_CMPL;
|
||||
@ -386,8 +367,6 @@ static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev, u16 fw_ring_id,
|
||||
if (rc)
|
||||
dev_err(rdev_to_dev(rdev),
|
||||
"Failed to free HW ring:%d :%#x", req.ring_id, rc);
|
||||
if (do_unlock)
|
||||
rtnl_unlock();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -405,7 +384,6 @@ static int bnxt_re_net_ring_alloc(struct bnxt_re_dev *rdev, dma_addr_t *dma_arr,
|
||||
return rc;
|
||||
|
||||
memset(&fw_msg, 0, sizeof(fw_msg));
|
||||
rtnl_lock();
|
||||
bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_RING_ALLOC, -1, -1);
|
||||
req.enables = 0;
|
||||
req.page_tbl_addr = cpu_to_le64(dma_arr[0]);
|
||||
@ -426,27 +404,21 @@ static int bnxt_re_net_ring_alloc(struct bnxt_re_dev *rdev, dma_addr_t *dma_arr,
|
||||
if (!rc)
|
||||
*fw_ring_id = le16_to_cpu(resp.ring_id);
|
||||
|
||||
rtnl_unlock();
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev,
|
||||
u32 fw_stats_ctx_id, bool lock_wait)
|
||||
u32 fw_stats_ctx_id)
|
||||
{
|
||||
struct bnxt_en_dev *en_dev = rdev->en_dev;
|
||||
struct hwrm_stat_ctx_free_input req = {0};
|
||||
struct bnxt_fw_msg fw_msg;
|
||||
bool do_unlock = false;
|
||||
int rc = -EINVAL;
|
||||
|
||||
if (!en_dev)
|
||||
return rc;
|
||||
|
||||
memset(&fw_msg, 0, sizeof(fw_msg));
|
||||
if (lock_wait) {
|
||||
rtnl_lock();
|
||||
do_unlock = true;
|
||||
}
|
||||
|
||||
bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_FREE, -1, -1);
|
||||
req.stat_ctx_id = cpu_to_le32(fw_stats_ctx_id);
|
||||
@ -457,8 +429,6 @@ static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev,
|
||||
dev_err(rdev_to_dev(rdev),
|
||||
"Failed to free HW stats context %#x", rc);
|
||||
|
||||
if (do_unlock)
|
||||
rtnl_unlock();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -478,7 +448,6 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev,
|
||||
return rc;
|
||||
|
||||
memset(&fw_msg, 0, sizeof(fw_msg));
|
||||
rtnl_lock();
|
||||
|
||||
bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_ALLOC, -1, -1);
|
||||
req.update_period_ms = cpu_to_le32(1000);
|
||||
@ -490,7 +459,6 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev,
|
||||
if (!rc)
|
||||
*fw_stats_ctx_id = le32_to_cpu(resp.stat_ctx_id);
|
||||
|
||||
rtnl_unlock();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -928,19 +896,19 @@ fail:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void bnxt_re_free_nq_res(struct bnxt_re_dev *rdev, bool lock_wait)
|
||||
static void bnxt_re_free_nq_res(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < rdev->num_msix - 1; i++) {
|
||||
bnxt_re_net_ring_free(rdev, rdev->nq[i].ring_id, lock_wait);
|
||||
bnxt_re_net_ring_free(rdev, rdev->nq[i].ring_id);
|
||||
bnxt_qplib_free_nq(&rdev->nq[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void bnxt_re_free_res(struct bnxt_re_dev *rdev, bool lock_wait)
|
||||
static void bnxt_re_free_res(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
bnxt_re_free_nq_res(rdev, lock_wait);
|
||||
bnxt_re_free_nq_res(rdev);
|
||||
|
||||
if (rdev->qplib_res.dpi_tbl.max) {
|
||||
bnxt_qplib_dealloc_dpi(&rdev->qplib_res,
|
||||
@ -1218,7 +1186,7 @@ static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait)
|
||||
static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
int i, rc;
|
||||
|
||||
@ -1233,28 +1201,27 @@ static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait)
|
||||
cancel_delayed_work(&rdev->worker);
|
||||
|
||||
bnxt_re_cleanup_res(rdev);
|
||||
bnxt_re_free_res(rdev, lock_wait);
|
||||
bnxt_re_free_res(rdev);
|
||||
|
||||
if (test_and_clear_bit(BNXT_RE_FLAG_RCFW_CHANNEL_EN, &rdev->flags)) {
|
||||
rc = bnxt_qplib_deinit_rcfw(&rdev->rcfw);
|
||||
if (rc)
|
||||
dev_warn(rdev_to_dev(rdev),
|
||||
"Failed to deinitialize RCFW: %#x", rc);
|
||||
bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id,
|
||||
lock_wait);
|
||||
bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id);
|
||||
bnxt_qplib_free_ctx(rdev->en_dev->pdev, &rdev->qplib_ctx);
|
||||
bnxt_qplib_disable_rcfw_channel(&rdev->rcfw);
|
||||
bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id, lock_wait);
|
||||
bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id);
|
||||
bnxt_qplib_free_rcfw_channel(&rdev->rcfw);
|
||||
}
|
||||
if (test_and_clear_bit(BNXT_RE_FLAG_GOT_MSIX, &rdev->flags)) {
|
||||
rc = bnxt_re_free_msix(rdev, lock_wait);
|
||||
rc = bnxt_re_free_msix(rdev);
|
||||
if (rc)
|
||||
dev_warn(rdev_to_dev(rdev),
|
||||
"Failed to free MSI-X vectors: %#x", rc);
|
||||
}
|
||||
if (test_and_clear_bit(BNXT_RE_FLAG_NETDEV_REGISTERED, &rdev->flags)) {
|
||||
rc = bnxt_re_unregister_netdev(rdev, lock_wait);
|
||||
rc = bnxt_re_unregister_netdev(rdev);
|
||||
if (rc)
|
||||
dev_warn(rdev_to_dev(rdev),
|
||||
"Failed to unregister with netdev: %#x", rc);
|
||||
@ -1275,6 +1242,12 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
int i, j, rc;
|
||||
|
||||
bool locked;
|
||||
|
||||
/* Acquire rtnl lock through out this function */
|
||||
rtnl_lock();
|
||||
locked = true;
|
||||
|
||||
/* Registered a new RoCE device instance to netdev */
|
||||
rc = bnxt_re_register_netdev(rdev);
|
||||
if (rc) {
|
||||
@ -1373,12 +1346,16 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)
|
||||
schedule_delayed_work(&rdev->worker, msecs_to_jiffies(30000));
|
||||
}
|
||||
|
||||
rtnl_unlock();
|
||||
locked = false;
|
||||
|
||||
/* Register ib dev */
|
||||
rc = bnxt_re_register_ib(rdev);
|
||||
if (rc) {
|
||||
pr_err("Failed to register with IB: %#x\n", rc);
|
||||
goto fail;
|
||||
}
|
||||
set_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags);
|
||||
dev_info(rdev_to_dev(rdev), "Device registered successfully");
|
||||
for (i = 0; i < ARRAY_SIZE(bnxt_re_attributes); i++) {
|
||||
rc = device_create_file(&rdev->ibdev.dev,
|
||||
@ -1394,7 +1371,6 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
set_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags);
|
||||
ib_get_eth_speed(&rdev->ibdev, 1, &rdev->active_speed,
|
||||
&rdev->active_width);
|
||||
set_bit(BNXT_RE_FLAG_ISSUE_ROCE_STATS, &rdev->flags);
|
||||
@ -1403,17 +1379,21 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)
|
||||
|
||||
return 0;
|
||||
free_sctx:
|
||||
bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id, true);
|
||||
bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id);
|
||||
free_ctx:
|
||||
bnxt_qplib_free_ctx(rdev->en_dev->pdev, &rdev->qplib_ctx);
|
||||
disable_rcfw:
|
||||
bnxt_qplib_disable_rcfw_channel(&rdev->rcfw);
|
||||
free_ring:
|
||||
bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id, true);
|
||||
bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id);
|
||||
free_rcfw:
|
||||
bnxt_qplib_free_rcfw_channel(&rdev->rcfw);
|
||||
fail:
|
||||
bnxt_re_ib_unreg(rdev, true);
|
||||
if (!locked)
|
||||
rtnl_lock();
|
||||
bnxt_re_ib_unreg(rdev);
|
||||
rtnl_unlock();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -1566,7 +1546,7 @@ static int bnxt_re_netdev_event(struct notifier_block *notifier,
|
||||
*/
|
||||
if (atomic_read(&rdev->sched_count) > 0)
|
||||
goto exit;
|
||||
bnxt_re_ib_unreg(rdev, false);
|
||||
bnxt_re_ib_unreg(rdev);
|
||||
bnxt_re_remove_one(rdev);
|
||||
bnxt_re_dev_unreg(rdev);
|
||||
break;
|
||||
@ -1645,7 +1625,10 @@ static void __exit bnxt_re_mod_exit(void)
|
||||
*/
|
||||
flush_workqueue(bnxt_re_wq);
|
||||
bnxt_re_dev_stop(rdev);
|
||||
bnxt_re_ib_unreg(rdev, true);
|
||||
/* Acquire the rtnl_lock as the L2 resources are freed here */
|
||||
rtnl_lock();
|
||||
bnxt_re_ib_unreg(rdev);
|
||||
rtnl_unlock();
|
||||
bnxt_re_remove_one(rdev);
|
||||
bnxt_re_dev_unreg(rdev);
|
||||
}
|
||||
|
@ -6731,6 +6731,7 @@ void start_freeze_handling(struct hfi1_pportdata *ppd, int flags)
|
||||
struct hfi1_devdata *dd = ppd->dd;
|
||||
struct send_context *sc;
|
||||
int i;
|
||||
int sc_flags;
|
||||
|
||||
if (flags & FREEZE_SELF)
|
||||
write_csr(dd, CCE_CTRL, CCE_CTRL_SPC_FREEZE_SMASK);
|
||||
@ -6741,11 +6742,13 @@ void start_freeze_handling(struct hfi1_pportdata *ppd, int flags)
|
||||
/* notify all SDMA engines that they are going into a freeze */
|
||||
sdma_freeze_notify(dd, !!(flags & FREEZE_LINK_DOWN));
|
||||
|
||||
sc_flags = SCF_FROZEN | SCF_HALTED | (flags & FREEZE_LINK_DOWN ?
|
||||
SCF_LINK_DOWN : 0);
|
||||
/* do halt pre-handling on all enabled send contexts */
|
||||
for (i = 0; i < dd->num_send_contexts; i++) {
|
||||
sc = dd->send_contexts[i].sc;
|
||||
if (sc && (sc->flags & SCF_ENABLED))
|
||||
sc_stop(sc, SCF_FROZEN | SCF_HALTED);
|
||||
sc_stop(sc, sc_flags);
|
||||
}
|
||||
|
||||
/* Send context are frozen. Notify user space */
|
||||
@ -10675,6 +10678,7 @@ int set_link_state(struct hfi1_pportdata *ppd, u32 state)
|
||||
add_rcvctrl(dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
|
||||
|
||||
handle_linkup_change(dd, 1);
|
||||
pio_kernel_linkup(dd);
|
||||
|
||||
/*
|
||||
* After link up, a new link width will have been set.
|
||||
|
@ -78,6 +78,7 @@ void pio_send_control(struct hfi1_devdata *dd, int op)
|
||||
unsigned long flags;
|
||||
int write = 1; /* write sendctrl back */
|
||||
int flush = 0; /* re-read sendctrl to make sure it is flushed */
|
||||
int i;
|
||||
|
||||
spin_lock_irqsave(&dd->sendctrl_lock, flags);
|
||||
|
||||
@ -87,9 +88,13 @@ void pio_send_control(struct hfi1_devdata *dd, int op)
|
||||
reg |= SEND_CTRL_SEND_ENABLE_SMASK;
|
||||
/* Fall through */
|
||||
case PSC_DATA_VL_ENABLE:
|
||||
mask = 0;
|
||||
for (i = 0; i < ARRAY_SIZE(dd->vld); i++)
|
||||
if (!dd->vld[i].mtu)
|
||||
mask |= BIT_ULL(i);
|
||||
/* Disallow sending on VLs not enabled */
|
||||
mask = (((~0ull) << num_vls) & SEND_CTRL_UNSUPPORTED_VL_MASK) <<
|
||||
SEND_CTRL_UNSUPPORTED_VL_SHIFT;
|
||||
mask = (mask & SEND_CTRL_UNSUPPORTED_VL_MASK) <<
|
||||
SEND_CTRL_UNSUPPORTED_VL_SHIFT;
|
||||
reg = (reg & ~SEND_CTRL_UNSUPPORTED_VL_SMASK) | mask;
|
||||
break;
|
||||
case PSC_GLOBAL_DISABLE:
|
||||
@ -913,20 +918,18 @@ void sc_free(struct send_context *sc)
|
||||
void sc_disable(struct send_context *sc)
|
||||
{
|
||||
u64 reg;
|
||||
unsigned long flags;
|
||||
struct pio_buf *pbuf;
|
||||
|
||||
if (!sc)
|
||||
return;
|
||||
|
||||
/* do all steps, even if already disabled */
|
||||
spin_lock_irqsave(&sc->alloc_lock, flags);
|
||||
spin_lock_irq(&sc->alloc_lock);
|
||||
reg = read_kctxt_csr(sc->dd, sc->hw_context, SC(CTRL));
|
||||
reg &= ~SC(CTRL_CTXT_ENABLE_SMASK);
|
||||
sc->flags &= ~SCF_ENABLED;
|
||||
sc_wait_for_packet_egress(sc, 1);
|
||||
write_kctxt_csr(sc->dd, sc->hw_context, SC(CTRL), reg);
|
||||
spin_unlock_irqrestore(&sc->alloc_lock, flags);
|
||||
|
||||
/*
|
||||
* Flush any waiters. Once the context is disabled,
|
||||
@ -936,7 +939,7 @@ void sc_disable(struct send_context *sc)
|
||||
* proceed with the flush.
|
||||
*/
|
||||
udelay(1);
|
||||
spin_lock_irqsave(&sc->release_lock, flags);
|
||||
spin_lock(&sc->release_lock);
|
||||
if (sc->sr) { /* this context has a shadow ring */
|
||||
while (sc->sr_tail != sc->sr_head) {
|
||||
pbuf = &sc->sr[sc->sr_tail].pbuf;
|
||||
@ -947,7 +950,8 @@ void sc_disable(struct send_context *sc)
|
||||
sc->sr_tail = 0;
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&sc->release_lock, flags);
|
||||
spin_unlock(&sc->release_lock);
|
||||
spin_unlock_irq(&sc->alloc_lock);
|
||||
}
|
||||
|
||||
/* return SendEgressCtxtStatus.PacketOccupancy */
|
||||
@ -1170,11 +1174,39 @@ void pio_kernel_unfreeze(struct hfi1_devdata *dd)
|
||||
sc = dd->send_contexts[i].sc;
|
||||
if (!sc || !(sc->flags & SCF_FROZEN) || sc->type == SC_USER)
|
||||
continue;
|
||||
if (sc->flags & SCF_LINK_DOWN)
|
||||
continue;
|
||||
|
||||
sc_enable(sc); /* will clear the sc frozen flag */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* pio_kernel_linkup() - Re-enable send contexts after linkup event
|
||||
* @dd: valid devive data
|
||||
*
|
||||
* When the link goes down, the freeze path is taken. However, a link down
|
||||
* event is different from a freeze because if the send context is re-enabled
|
||||
* whowever is sending data will start sending data again, which will hang
|
||||
* any QP that is sending data.
|
||||
*
|
||||
* The freeze path now looks at the type of event that occurs and takes this
|
||||
* path for link down event.
|
||||
*/
|
||||
void pio_kernel_linkup(struct hfi1_devdata *dd)
|
||||
{
|
||||
struct send_context *sc;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < dd->num_send_contexts; i++) {
|
||||
sc = dd->send_contexts[i].sc;
|
||||
if (!sc || !(sc->flags & SCF_LINK_DOWN) || sc->type == SC_USER)
|
||||
continue;
|
||||
|
||||
sc_enable(sc); /* will clear the sc link down flag */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for the SendPioInitCtxt.PioInitInProgress bit to clear.
|
||||
* Returns:
|
||||
@ -1374,11 +1406,10 @@ void sc_stop(struct send_context *sc, int flag)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
/* mark the context */
|
||||
sc->flags |= flag;
|
||||
|
||||
/* stop buffer allocations */
|
||||
spin_lock_irqsave(&sc->alloc_lock, flags);
|
||||
/* mark the context */
|
||||
sc->flags |= flag;
|
||||
sc->flags &= ~SCF_ENABLED;
|
||||
spin_unlock_irqrestore(&sc->alloc_lock, flags);
|
||||
wake_up(&sc->halt_wait);
|
||||
|
@ -139,6 +139,7 @@ struct send_context {
|
||||
#define SCF_IN_FREE 0x02
|
||||
#define SCF_HALTED 0x04
|
||||
#define SCF_FROZEN 0x08
|
||||
#define SCF_LINK_DOWN 0x10
|
||||
|
||||
struct send_context_info {
|
||||
struct send_context *sc; /* allocated working context */
|
||||
@ -306,6 +307,7 @@ void set_pio_integrity(struct send_context *sc);
|
||||
void pio_reset_all(struct hfi1_devdata *dd);
|
||||
void pio_freeze(struct hfi1_devdata *dd);
|
||||
void pio_kernel_unfreeze(struct hfi1_devdata *dd);
|
||||
void pio_kernel_linkup(struct hfi1_devdata *dd);
|
||||
|
||||
/* global PIO send control operations */
|
||||
#define PSC_GLOBAL_ENABLE 0
|
||||
|
@ -824,7 +824,7 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, u16 maxpkts)
|
||||
if (READ_ONCE(iovec->offset) == iovec->iov.iov_len) {
|
||||
if (++req->iov_idx == req->data_iovs) {
|
||||
ret = -EFAULT;
|
||||
goto free_txreq;
|
||||
goto free_tx;
|
||||
}
|
||||
iovec = &req->iovs[req->iov_idx];
|
||||
WARN_ON(iovec->offset);
|
||||
|
@ -1360,6 +1360,7 @@ static int hfi1_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr)
|
||||
struct hfi1_pportdata *ppd;
|
||||
struct hfi1_devdata *dd;
|
||||
u8 sc5;
|
||||
u8 sl;
|
||||
|
||||
if (hfi1_check_mcast(rdma_ah_get_dlid(ah_attr)) &&
|
||||
!(rdma_ah_get_ah_flags(ah_attr) & IB_AH_GRH))
|
||||
@ -1368,8 +1369,13 @@ static int hfi1_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr)
|
||||
/* test the mapping for validity */
|
||||
ibp = to_iport(ibdev, rdma_ah_get_port_num(ah_attr));
|
||||
ppd = ppd_from_ibp(ibp);
|
||||
sc5 = ibp->sl_to_sc[rdma_ah_get_sl(ah_attr)];
|
||||
dd = dd_from_ppd(ppd);
|
||||
|
||||
sl = rdma_ah_get_sl(ah_attr);
|
||||
if (sl >= ARRAY_SIZE(ibp->sl_to_sc))
|
||||
return -EINVAL;
|
||||
|
||||
sc5 = ibp->sl_to_sc[sl];
|
||||
if (sc_to_vlt(dd, sc5) > num_vls && sc_to_vlt(dd, sc5) != 0xf)
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
|
@ -517,9 +517,11 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
|
||||
props->page_size_cap = dev->dev->caps.page_size_cap;
|
||||
props->max_qp = dev->dev->quotas.qp;
|
||||
props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE;
|
||||
props->max_send_sge = dev->dev->caps.max_sq_sg;
|
||||
props->max_recv_sge = dev->dev->caps.max_rq_sg;
|
||||
props->max_sge_rd = MLX4_MAX_SGE_RD;
|
||||
props->max_send_sge =
|
||||
min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg);
|
||||
props->max_recv_sge =
|
||||
min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg);
|
||||
props->max_sge_rd = MLX4_MAX_SGE_RD;
|
||||
props->max_cq = dev->dev->quotas.cq;
|
||||
props->max_cqe = dev->dev->caps.max_cqes;
|
||||
props->max_mr = dev->dev->quotas.mpt;
|
||||
|
@ -850,6 +850,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
|
||||
attrs, MLX5_IB_ATTR_DEVX_OBJ_CREATE_HANDLE);
|
||||
struct mlx5_ib_ucontext *c = to_mucontext(uobj->context);
|
||||
struct mlx5_ib_dev *dev = to_mdev(c->ibucontext.device);
|
||||
u32 out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)];
|
||||
struct devx_obj *obj;
|
||||
int err;
|
||||
int uid;
|
||||
@ -885,10 +886,12 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
|
||||
|
||||
err = uverbs_copy_to(attrs, MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_OUT, cmd_out, cmd_out_len);
|
||||
if (err)
|
||||
goto obj_free;
|
||||
goto obj_destroy;
|
||||
|
||||
return 0;
|
||||
|
||||
obj_destroy:
|
||||
mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out, sizeof(out));
|
||||
obj_free:
|
||||
kfree(obj);
|
||||
return err;
|
||||
|
@ -544,6 +544,9 @@ void mlx5_mr_cache_free(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr)
|
||||
int shrink = 0;
|
||||
int c;
|
||||
|
||||
if (!mr->allocated_from_cache)
|
||||
return;
|
||||
|
||||
c = order2idx(dev, mr->order);
|
||||
if (c < 0 || c >= MAX_MR_CACHE_ENTRIES) {
|
||||
mlx5_ib_warn(dev, "order %d, cache index %d\n", mr->order, c);
|
||||
@ -1649,18 +1652,19 @@ static void dereg_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr)
|
||||
umem = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
clean_mr(dev, mr);
|
||||
|
||||
/*
|
||||
* We should unregister the DMA address from the HCA before
|
||||
* remove the DMA mapping.
|
||||
*/
|
||||
mlx5_mr_cache_free(dev, mr);
|
||||
if (umem) {
|
||||
ib_umem_release(umem);
|
||||
atomic_sub(npages, &dev->mdev->priv.reg_pages);
|
||||
}
|
||||
|
||||
if (!mr->allocated_from_cache)
|
||||
kfree(mr);
|
||||
else
|
||||
mlx5_mr_cache_free(dev, mr);
|
||||
}
|
||||
|
||||
int mlx5_ib_dereg_mr(struct ib_mr *ibmr)
|
||||
|
@ -2951,7 +2951,7 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
|
||||
{
|
||||
struct srp_target_port *target = host_to_target(scmnd->device->host);
|
||||
struct srp_rdma_ch *ch;
|
||||
int i;
|
||||
int i, j;
|
||||
u8 status;
|
||||
|
||||
shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n");
|
||||
@ -2965,8 +2965,8 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
|
||||
|
||||
for (i = 0; i < target->ch_count; i++) {
|
||||
ch = &target->ch[i];
|
||||
for (i = 0; i < target->req_ring_size; ++i) {
|
||||
struct srp_request *req = &ch->req_ring[i];
|
||||
for (j = 0; j < target->req_ring_size; ++j) {
|
||||
struct srp_request *req = &ch->req_ring[j];
|
||||
|
||||
srp_finish_req(ch, req, scmnd->device, DID_RESET << 16);
|
||||
}
|
||||
|
@ -753,7 +753,6 @@ struct cpl_abort_req_rss {
|
||||
};
|
||||
|
||||
struct cpl_abort_req_rss6 {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be32 srqidx_status;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user