mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma updates from Jason Gunthorpe:
"Usual wide collection of unrelated items in drivers:
- Driver bug fixes and treewide cleanups in hfi1, siw, qib, mlx5,
rxe, usnic, usnic, bnxt_re, ocrdma, iser:
- remove unnecessary NULL checks
- kmap obsolescence
- pci_enable_pcie_error_reporting() obsolescence
- unused variables and macros
- trace event related warnings
- casting warnings
- Code cleanups for irdm and erdma
- EFA reporting of 128 byte PCIe TLP support
- mlx5 more agressively uses the out of order HW feature
- Big rework of how state machines and tasks work in rxe
- Fix a syzkaller found crash netdev refcount leak in siw
- bnxt_re revises their HW description header
- Congestion control for bnxt_re
- Use mmu_notifiers more safely in hfi1
- mlx5 gets better support for PCIe relaxed ordering inside VMs"
* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (81 commits)
RDMA/efa: Add rdma write capability to device caps
RDMA/mlx5: Use correct device num_ports when modify DC
RDMA/irdma: Drop spurious WQ_UNBOUND from alloc_ordered_workqueue() call
RDMA/rxe: Fix spinlock recursion deadlock on requester
RDMA/mlx5: Fix flow counter query via DEVX
RDMA/rxe: Protect QP state with qp->state_lock
RDMA/rxe: Move code to check if drained to subroutine
RDMA/rxe: Remove qp->req.state
RDMA/rxe: Remove qp->comp.state
RDMA/rxe: Remove qp->resp.state
RDMA/mlx5: Allow relaxed ordering read in VFs and VMs
net/mlx5: Update relaxed ordering read HCA capabilities
RDMA/mlx5: Check pcie_relaxed_ordering_enabled() in UMR
RDMA/mlx5: Remove pcie_relaxed_ordering_enabled() check for RO write
RDMA: Add ib_virt_dma_to_page()
RDMA/rxe: Fix the error "trying to register non-static key in rxe_cleanup_task"
RDMA/irdma: Slightly optimize irdma_form_ah_cm_frame()
RDMA/rxe: Fix incorrect TASKLET_STATE_SCHED check in rxe_task.c
IB/hfi1: Place struct mmu_rb_handler on cache line start
IB/hfi1: Fix bugs with non-PAGE_SIZE-end multi-iovec user SDMA requests
...
This commit is contained in:
@@ -2912,6 +2912,8 @@ static int cm_send_rej_locked(struct cm_id_private *cm_id_priv,
|
||||
(ari && ari_length > IB_CM_REJ_ARI_LENGTH))
|
||||
return -EINVAL;
|
||||
|
||||
trace_icm_send_rej(&cm_id_priv->id, reason);
|
||||
|
||||
switch (state) {
|
||||
case IB_CM_REQ_SENT:
|
||||
case IB_CM_MRA_REQ_RCVD:
|
||||
@@ -2942,7 +2944,6 @@ static int cm_send_rej_locked(struct cm_id_private *cm_id_priv,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
trace_icm_send_rej(&cm_id_priv->id, reason);
|
||||
ret = ib_post_send_mad(msg, NULL);
|
||||
if (ret) {
|
||||
cm_free_msg(msg);
|
||||
|
||||
@@ -709,8 +709,7 @@ cma_validate_port(struct ib_device *device, u32 port,
|
||||
}
|
||||
|
||||
sgid_attr = rdma_find_gid_by_port(device, gid, gid_type, port, ndev);
|
||||
if (ndev)
|
||||
dev_put(ndev);
|
||||
dev_put(ndev);
|
||||
return sgid_attr;
|
||||
}
|
||||
|
||||
@@ -2429,8 +2428,7 @@ err_unlock:
|
||||
mutex_unlock(&listen_id->handler_mutex);
|
||||
|
||||
net_dev_put:
|
||||
if (net_dev)
|
||||
dev_put(net_dev);
|
||||
dev_put(net_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -131,6 +131,11 @@ struct ib_umad_packet {
|
||||
struct ib_user_mad mad;
|
||||
};
|
||||
|
||||
struct ib_rmpp_mad_hdr {
|
||||
struct ib_mad_hdr mad_hdr;
|
||||
struct ib_rmpp_hdr rmpp_hdr;
|
||||
} __packed;
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/ib_umad.h>
|
||||
|
||||
@@ -494,11 +499,11 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
struct ib_umad_file *file = filp->private_data;
|
||||
struct ib_rmpp_mad_hdr *rmpp_mad_hdr;
|
||||
struct ib_umad_packet *packet;
|
||||
struct ib_mad_agent *agent;
|
||||
struct rdma_ah_attr ah_attr;
|
||||
struct ib_ah *ah;
|
||||
struct ib_rmpp_mad *rmpp_mad;
|
||||
__be64 *tid;
|
||||
int ret, data_len, hdr_len, copy_offset, rmpp_active;
|
||||
u8 base_version;
|
||||
@@ -506,7 +511,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
|
||||
if (count < hdr_size(file) + IB_MGMT_RMPP_HDR)
|
||||
return -EINVAL;
|
||||
|
||||
packet = kzalloc(sizeof *packet + IB_MGMT_RMPP_HDR, GFP_KERNEL);
|
||||
packet = kzalloc(sizeof(*packet) + IB_MGMT_RMPP_HDR, GFP_KERNEL);
|
||||
if (!packet)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -560,13 +565,13 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
|
||||
goto err_up;
|
||||
}
|
||||
|
||||
rmpp_mad = (struct ib_rmpp_mad *) packet->mad.data;
|
||||
hdr_len = ib_get_mad_data_offset(rmpp_mad->mad_hdr.mgmt_class);
|
||||
rmpp_mad_hdr = (struct ib_rmpp_mad_hdr *)packet->mad.data;
|
||||
hdr_len = ib_get_mad_data_offset(rmpp_mad_hdr->mad_hdr.mgmt_class);
|
||||
|
||||
if (ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class)
|
||||
if (ib_is_mad_class_rmpp(rmpp_mad_hdr->mad_hdr.mgmt_class)
|
||||
&& ib_mad_kernel_rmpp_agent(agent)) {
|
||||
copy_offset = IB_MGMT_RMPP_HDR;
|
||||
rmpp_active = ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) &
|
||||
rmpp_active = ib_get_rmpp_flags(&rmpp_mad_hdr->rmpp_hdr) &
|
||||
IB_MGMT_RMPP_FLAG_ACTIVE;
|
||||
} else {
|
||||
copy_offset = IB_MGMT_MAD_HDR;
|
||||
@@ -615,12 +620,12 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
|
||||
tid = &((struct ib_mad_hdr *) packet->msg->mad)->tid;
|
||||
*tid = cpu_to_be64(((u64) agent->hi_tid) << 32 |
|
||||
(be64_to_cpup(tid) & 0xffffffff));
|
||||
rmpp_mad->mad_hdr.tid = *tid;
|
||||
rmpp_mad_hdr->mad_hdr.tid = *tid;
|
||||
}
|
||||
|
||||
if (!ib_mad_kernel_rmpp_agent(agent)
|
||||
&& ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class)
|
||||
&& (ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) & IB_MGMT_RMPP_FLAG_ACTIVE)) {
|
||||
&& ib_is_mad_class_rmpp(rmpp_mad_hdr->mad_hdr.mgmt_class)
|
||||
&& (ib_get_rmpp_flags(&rmpp_mad_hdr->rmpp_hdr) & IB_MGMT_RMPP_FLAG_ACTIVE)) {
|
||||
spin_lock_irq(&file->send_lock);
|
||||
list_add_tail(&packet->list, &file->send_list);
|
||||
spin_unlock_irq(&file->send_lock);
|
||||
|
||||
@@ -2912,6 +2912,106 @@ fail:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void bnxt_re_resize_cq_complete(struct bnxt_re_cq *cq)
|
||||
{
|
||||
struct bnxt_re_dev *rdev = cq->rdev;
|
||||
|
||||
bnxt_qplib_resize_cq_complete(&rdev->qplib_res, &cq->qplib_cq);
|
||||
|
||||
cq->qplib_cq.max_wqe = cq->resize_cqe;
|
||||
if (cq->resize_umem) {
|
||||
ib_umem_release(cq->umem);
|
||||
cq->umem = cq->resize_umem;
|
||||
cq->resize_umem = NULL;
|
||||
cq->resize_cqe = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int bnxt_re_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)
|
||||
{
|
||||
struct bnxt_qplib_sg_info sg_info = {};
|
||||
struct bnxt_qplib_dpi *orig_dpi = NULL;
|
||||
struct bnxt_qplib_dev_attr *dev_attr;
|
||||
struct bnxt_re_ucontext *uctx = NULL;
|
||||
struct bnxt_re_resize_cq_req req;
|
||||
struct bnxt_re_dev *rdev;
|
||||
struct bnxt_re_cq *cq;
|
||||
int rc, entries;
|
||||
|
||||
cq = container_of(ibcq, struct bnxt_re_cq, ib_cq);
|
||||
rdev = cq->rdev;
|
||||
dev_attr = &rdev->dev_attr;
|
||||
if (!ibcq->uobject) {
|
||||
ibdev_err(&rdev->ibdev, "Kernel CQ Resize not supported");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (cq->resize_umem) {
|
||||
ibdev_err(&rdev->ibdev, "Resize CQ %#x failed - Busy",
|
||||
cq->qplib_cq.id);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
/* Check the requested cq depth out of supported depth */
|
||||
if (cqe < 1 || cqe > dev_attr->max_cq_wqes) {
|
||||
ibdev_err(&rdev->ibdev, "Resize CQ %#x failed - out of range cqe %d",
|
||||
cq->qplib_cq.id, cqe);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
entries = roundup_pow_of_two(cqe + 1);
|
||||
if (entries > dev_attr->max_cq_wqes + 1)
|
||||
entries = dev_attr->max_cq_wqes + 1;
|
||||
|
||||
uctx = rdma_udata_to_drv_context(udata, struct bnxt_re_ucontext,
|
||||
ib_uctx);
|
||||
/* uverbs consumer */
|
||||
if (ib_copy_from_udata(&req, udata, sizeof(req))) {
|
||||
rc = -EFAULT;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
cq->resize_umem = ib_umem_get(&rdev->ibdev, req.cq_va,
|
||||
entries * sizeof(struct cq_base),
|
||||
IB_ACCESS_LOCAL_WRITE);
|
||||
if (IS_ERR(cq->resize_umem)) {
|
||||
rc = PTR_ERR(cq->resize_umem);
|
||||
cq->resize_umem = NULL;
|
||||
ibdev_err(&rdev->ibdev, "%s: ib_umem_get failed! rc = %d\n",
|
||||
__func__, rc);
|
||||
goto fail;
|
||||
}
|
||||
cq->resize_cqe = entries;
|
||||
memcpy(&sg_info, &cq->qplib_cq.sg_info, sizeof(sg_info));
|
||||
orig_dpi = cq->qplib_cq.dpi;
|
||||
|
||||
cq->qplib_cq.sg_info.umem = cq->resize_umem;
|
||||
cq->qplib_cq.sg_info.pgsize = PAGE_SIZE;
|
||||
cq->qplib_cq.sg_info.pgshft = PAGE_SHIFT;
|
||||
cq->qplib_cq.dpi = &uctx->dpi;
|
||||
|
||||
rc = bnxt_qplib_resize_cq(&rdev->qplib_res, &cq->qplib_cq, entries);
|
||||
if (rc) {
|
||||
ibdev_err(&rdev->ibdev, "Resize HW CQ %#x failed!",
|
||||
cq->qplib_cq.id);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
cq->ib_cq.cqe = cq->resize_cqe;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
if (cq->resize_umem) {
|
||||
ib_umem_release(cq->resize_umem);
|
||||
cq->resize_umem = NULL;
|
||||
cq->resize_cqe = 0;
|
||||
memcpy(&cq->qplib_cq.sg_info, &sg_info, sizeof(sg_info));
|
||||
cq->qplib_cq.dpi = orig_dpi;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static u8 __req_to_ib_wc_status(u8 qstatus)
|
||||
{
|
||||
switch (qstatus) {
|
||||
@@ -3425,6 +3525,15 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc)
|
||||
struct bnxt_re_sqp_entries *sqp_entry = NULL;
|
||||
unsigned long flags;
|
||||
|
||||
/* User CQ; the only processing we do is to
|
||||
* complete any pending CQ resize operation.
|
||||
*/
|
||||
if (cq->umem) {
|
||||
if (cq->resize_umem)
|
||||
bnxt_re_resize_cq_complete(cq);
|
||||
return 0;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&cq->cq_lock, flags);
|
||||
budget = min_t(u32, num_entries, cq->max_cql);
|
||||
num_entries = budget;
|
||||
|
||||
@@ -104,6 +104,8 @@ struct bnxt_re_cq {
|
||||
#define MAX_CQL_PER_POLL 1024
|
||||
u32 max_cql;
|
||||
struct ib_umem *umem;
|
||||
struct ib_umem *resize_umem;
|
||||
int resize_cqe;
|
||||
};
|
||||
|
||||
struct bnxt_re_mr {
|
||||
@@ -191,6 +193,7 @@ int bnxt_re_post_recv(struct ib_qp *qp, const struct ib_recv_wr *recv_wr,
|
||||
const struct ib_recv_wr **bad_recv_wr);
|
||||
int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
|
||||
struct ib_udata *udata);
|
||||
int bnxt_re_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata);
|
||||
int bnxt_re_destroy_cq(struct ib_cq *cq, struct ib_udata *udata);
|
||||
int bnxt_re_poll_cq(struct ib_cq *cq, int num_entries, struct ib_wc *wc);
|
||||
int bnxt_re_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags flags);
|
||||
|
||||
@@ -553,6 +553,7 @@ static const struct ib_device_ops bnxt_re_dev_ops = {
|
||||
.query_srq = bnxt_re_query_srq,
|
||||
.reg_user_mr = bnxt_re_reg_user_mr,
|
||||
.req_notify_cq = bnxt_re_req_notify_cq,
|
||||
.resize_cq = bnxt_re_resize_cq,
|
||||
INIT_RDMA_OBJ_SIZE(ib_ah, bnxt_re_ah, ib_ah),
|
||||
INIT_RDMA_OBJ_SIZE(ib_cq, bnxt_re_cq, ib_cq),
|
||||
INIT_RDMA_OBJ_SIZE(ib_pd, bnxt_re_pd, ib_pd),
|
||||
@@ -584,6 +585,7 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
|
||||
return ret;
|
||||
|
||||
dma_set_max_seg_size(&rdev->en_dev->pdev->dev, UINT_MAX);
|
||||
ibdev->uverbs_cmd_mask |= BIT_ULL(IB_USER_VERBS_CMD_POLL_CQ);
|
||||
return ib_register_device(ibdev, "bnxt_re%d", &rdev->en_dev->pdev->dev);
|
||||
}
|
||||
|
||||
@@ -919,49 +921,6 @@ static void bnxt_re_dispatch_event(struct ib_device *ibdev, struct ib_qp *qp,
|
||||
}
|
||||
}
|
||||
|
||||
#define HWRM_QUEUE_PRI2COS_QCFG_INPUT_FLAGS_IVLAN 0x02
|
||||
static int bnxt_re_query_hwrm_pri2cos(struct bnxt_re_dev *rdev, u8 dir,
|
||||
u64 *cid_map)
|
||||
{
|
||||
struct hwrm_queue_pri2cos_qcfg_input req = {0};
|
||||
struct hwrm_queue_pri2cos_qcfg_output resp;
|
||||
struct bnxt_en_dev *en_dev = rdev->en_dev;
|
||||
struct bnxt_fw_msg fw_msg;
|
||||
u32 flags = 0;
|
||||
u8 *qcfgmap, *tmp_map;
|
||||
int rc = 0, i;
|
||||
|
||||
if (!cid_map)
|
||||
return -EINVAL;
|
||||
|
||||
memset(&fw_msg, 0, sizeof(fw_msg));
|
||||
bnxt_re_init_hwrm_hdr(rdev, (void *)&req,
|
||||
HWRM_QUEUE_PRI2COS_QCFG, -1, -1);
|
||||
flags |= (dir & 0x01);
|
||||
flags |= HWRM_QUEUE_PRI2COS_QCFG_INPUT_FLAGS_IVLAN;
|
||||
req.flags = cpu_to_le32(flags);
|
||||
req.port_id = en_dev->pf_port_id;
|
||||
|
||||
bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
|
||||
sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
|
||||
rc = bnxt_send_msg(en_dev, &fw_msg);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (resp.queue_cfg_info) {
|
||||
ibdev_warn(&rdev->ibdev,
|
||||
"Asymmetric cos queue configuration detected");
|
||||
ibdev_warn(&rdev->ibdev,
|
||||
" on device, QoS may not be fully functional\n");
|
||||
}
|
||||
qcfgmap = &resp.pri0_cos_queue_id;
|
||||
tmp_map = (u8 *)cid_map;
|
||||
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
|
||||
tmp_map[i] = qcfgmap[i];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static bool bnxt_re_is_qp1_or_shadow_qp(struct bnxt_re_dev *rdev,
|
||||
struct bnxt_re_qp *qp)
|
||||
{
|
||||
@@ -1054,26 +1013,9 @@ static u32 bnxt_re_get_priority_mask(struct bnxt_re_dev *rdev)
|
||||
return prio_map;
|
||||
}
|
||||
|
||||
static void bnxt_re_parse_cid_map(u8 prio_map, u8 *cid_map, u16 *cosq)
|
||||
{
|
||||
u16 prio;
|
||||
u8 id;
|
||||
|
||||
for (prio = 0, id = 0; prio < 8; prio++) {
|
||||
if (prio_map & (1 << prio)) {
|
||||
cosq[id] = cid_map[prio];
|
||||
id++;
|
||||
if (id == 2) /* Max 2 tcs supported */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev)
|
||||
{
|
||||
u8 prio_map = 0;
|
||||
u64 cid_map;
|
||||
int rc;
|
||||
|
||||
/* Get priority for roce */
|
||||
prio_map = bnxt_re_get_priority_mask(rdev);
|
||||
@@ -1081,23 +1023,6 @@ static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev)
|
||||
if (prio_map == rdev->cur_prio_map)
|
||||
return 0;
|
||||
rdev->cur_prio_map = prio_map;
|
||||
/* Get cosq id for this priority */
|
||||
rc = bnxt_re_query_hwrm_pri2cos(rdev, 0, &cid_map);
|
||||
if (rc) {
|
||||
ibdev_warn(&rdev->ibdev, "no cos for p_mask %x\n", prio_map);
|
||||
return rc;
|
||||
}
|
||||
/* Parse CoS IDs for app priority */
|
||||
bnxt_re_parse_cid_map(prio_map, (u8 *)&cid_map, rdev->cosq);
|
||||
|
||||
/* Config BONO. */
|
||||
rc = bnxt_qplib_map_tc2cos(&rdev->qplib_res, rdev->cosq);
|
||||
if (rc) {
|
||||
ibdev_warn(&rdev->ibdev, "no tc for cos{%x, %x}\n",
|
||||
rdev->cosq[0], rdev->cosq[1]);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Actual priorities are not programmed as they are already
|
||||
* done by L2 driver; just enable or disable priority vlan tagging
|
||||
*/
|
||||
@@ -1407,6 +1332,27 @@ exit:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void bnxt_re_setup_cc(struct bnxt_re_dev *rdev, bool enable)
|
||||
{
|
||||
struct bnxt_qplib_cc_param cc_param = {};
|
||||
|
||||
/* Currently enabling only for GenP5 adapters */
|
||||
if (!bnxt_qplib_is_chip_gen_p5(rdev->chip_ctx))
|
||||
return;
|
||||
|
||||
if (enable) {
|
||||
cc_param.enable = 1;
|
||||
cc_param.cc_mode = CMDQ_MODIFY_ROCE_CC_CC_MODE_PROBABILISTIC_CC_MODE;
|
||||
}
|
||||
|
||||
cc_param.mask = (CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_CC_MODE |
|
||||
CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_ENABLE_CC |
|
||||
CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_TOS_ECN);
|
||||
|
||||
if (bnxt_qplib_modify_cc(&rdev->qplib_res, &cc_param))
|
||||
ibdev_err(&rdev->ibdev, "Failed to setup CC enable = %d\n", enable);
|
||||
}
|
||||
|
||||
/*
|
||||
* "Notifier chain callback can be invoked for the same chain from
|
||||
* different CPUs at the same time".
|
||||
@@ -1475,7 +1421,7 @@ static void bnxt_re_remove(struct auxiliary_device *adev)
|
||||
*/
|
||||
goto skip_remove;
|
||||
}
|
||||
|
||||
bnxt_re_setup_cc(rdev, false);
|
||||
ib_unregister_device(&rdev->ibdev);
|
||||
ib_dealloc_device(&rdev->ibdev);
|
||||
bnxt_re_dev_uninit(rdev);
|
||||
@@ -1507,6 +1453,7 @@ static int bnxt_re_probe(struct auxiliary_device *adev,
|
||||
goto err;
|
||||
}
|
||||
|
||||
bnxt_re_setup_cc(rdev, true);
|
||||
mutex_unlock(&bnxt_re_mutex);
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -300,8 +300,6 @@ static void bnxt_qplib_service_nq(struct tasklet_struct *t)
|
||||
{
|
||||
struct bnxt_qplib_nq *nq = from_tasklet(nq, t, nq_tasklet);
|
||||
struct bnxt_qplib_hwq *hwq = &nq->hwq;
|
||||
int num_srqne_processed = 0;
|
||||
int num_cqne_processed = 0;
|
||||
struct bnxt_qplib_cq *cq;
|
||||
int budget = nq->budget;
|
||||
u32 sw_cons, raw_cons;
|
||||
@@ -340,9 +338,7 @@ static void bnxt_qplib_service_nq(struct tasklet_struct *t)
|
||||
DBC_DBC_TYPE_CQ_ARMENA);
|
||||
spin_lock_bh(&cq->compl_lock);
|
||||
atomic_set(&cq->arm_state, 0);
|
||||
if (!nq->cqn_handler(nq, (cq)))
|
||||
num_cqne_processed++;
|
||||
else
|
||||
if (nq->cqn_handler(nq, (cq)))
|
||||
dev_warn(&nq->pdev->dev,
|
||||
"cqn - type 0x%x not handled\n", type);
|
||||
cq->cnq_events++;
|
||||
@@ -361,11 +357,9 @@ static void bnxt_qplib_service_nq(struct tasklet_struct *t)
|
||||
srq = (struct bnxt_qplib_srq *)q_handle;
|
||||
bnxt_qplib_armen_db(&srq->dbinfo,
|
||||
DBC_DBC_TYPE_SRQ_ARMENA);
|
||||
if (!nq->srqn_handler(nq,
|
||||
(struct bnxt_qplib_srq *)q_handle,
|
||||
nqsrqe->event))
|
||||
num_srqne_processed++;
|
||||
else
|
||||
if (nq->srqn_handler(nq,
|
||||
(struct bnxt_qplib_srq *)q_handle,
|
||||
nqsrqe->event))
|
||||
dev_warn(&nq->pdev->dev,
|
||||
"SRQ event 0x%x not handled\n",
|
||||
nqsrqe->event);
|
||||
@@ -581,18 +575,20 @@ void bnxt_qplib_destroy_srq(struct bnxt_qplib_res *res,
|
||||
struct bnxt_qplib_srq *srq)
|
||||
{
|
||||
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
|
||||
struct cmdq_destroy_srq req;
|
||||
struct creq_destroy_srq_resp resp;
|
||||
u16 cmd_flags = 0;
|
||||
struct creq_destroy_srq_resp resp = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
struct cmdq_destroy_srq req = {};
|
||||
int rc;
|
||||
|
||||
RCFW_CMD_PREP(req, DESTROY_SRQ, cmd_flags);
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_DESTROY_SRQ,
|
||||
sizeof(req));
|
||||
|
||||
/* Configure the request */
|
||||
req.srq_cid = cpu_to_le32(srq->id);
|
||||
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, (struct cmdq_base *)&req,
|
||||
(struct creq_base *)&resp, NULL, 0);
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
kfree(srq->swq);
|
||||
if (rc)
|
||||
return;
|
||||
@@ -604,10 +600,10 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,
|
||||
{
|
||||
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
|
||||
struct bnxt_qplib_hwq_attr hwq_attr = {};
|
||||
struct creq_create_srq_resp resp;
|
||||
struct cmdq_create_srq req;
|
||||
struct creq_create_srq_resp resp = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
struct cmdq_create_srq req = {};
|
||||
struct bnxt_qplib_pbl *pbl;
|
||||
u16 cmd_flags = 0;
|
||||
u16 pg_sz_lvl;
|
||||
int rc, idx;
|
||||
|
||||
@@ -627,7 +623,9 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
RCFW_CMD_PREP(req, CREATE_SRQ, cmd_flags);
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_CREATE_SRQ,
|
||||
sizeof(req));
|
||||
|
||||
/* Configure the request */
|
||||
req.dpi = cpu_to_le32(srq->dpi->dpi);
|
||||
@@ -644,8 +642,8 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,
|
||||
req.pd_id = cpu_to_le32(srq->pd->id);
|
||||
req.eventq_id = cpu_to_le16(srq->eventq_hw_ring_id);
|
||||
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
|
||||
(void *)&resp, NULL, 0);
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
if (rc)
|
||||
goto fail;
|
||||
|
||||
@@ -700,14 +698,16 @@ int bnxt_qplib_query_srq(struct bnxt_qplib_res *res,
|
||||
struct bnxt_qplib_srq *srq)
|
||||
{
|
||||
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
|
||||
struct cmdq_query_srq req;
|
||||
struct creq_query_srq_resp resp;
|
||||
struct creq_query_srq_resp resp = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
struct bnxt_qplib_rcfw_sbuf *sbuf;
|
||||
struct creq_query_srq_resp_sb *sb;
|
||||
u16 cmd_flags = 0;
|
||||
struct cmdq_query_srq req = {};
|
||||
int rc = 0;
|
||||
|
||||
RCFW_CMD_PREP(req, QUERY_SRQ, cmd_flags);
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_QUERY_SRQ,
|
||||
sizeof(req));
|
||||
|
||||
/* Configure the request */
|
||||
sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb));
|
||||
@@ -716,8 +716,9 @@ int bnxt_qplib_query_srq(struct bnxt_qplib_res *res,
|
||||
req.resp_size = sizeof(*sb) / BNXT_QPLIB_CMDQE_UNITS;
|
||||
req.srq_cid = cpu_to_le32(srq->id);
|
||||
sb = sbuf->sb;
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
|
||||
(void *)sbuf, 0);
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, sbuf, sizeof(req),
|
||||
sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
srq->threshold = le16_to_cpu(sb->srq_limit);
|
||||
bnxt_qplib_rcfw_free_sbuf(rcfw, sbuf);
|
||||
|
||||
@@ -811,19 +812,20 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
|
||||
{
|
||||
struct bnxt_qplib_hwq_attr hwq_attr = {};
|
||||
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
|
||||
struct creq_create_qp1_resp resp = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
struct bnxt_qplib_q *sq = &qp->sq;
|
||||
struct bnxt_qplib_q *rq = &qp->rq;
|
||||
struct creq_create_qp1_resp resp;
|
||||
struct cmdq_create_qp1 req;
|
||||
struct cmdq_create_qp1 req = {};
|
||||
struct bnxt_qplib_pbl *pbl;
|
||||
u16 cmd_flags = 0;
|
||||
u32 qp_flags = 0;
|
||||
u8 pg_sz_lvl;
|
||||
u32 tbl_indx;
|
||||
int rc;
|
||||
|
||||
RCFW_CMD_PREP(req, CREATE_QP1, cmd_flags);
|
||||
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_CREATE_QP1,
|
||||
sizeof(req));
|
||||
/* General */
|
||||
req.type = qp->type;
|
||||
req.dpi = cpu_to_le32(qp->dpi->dpi);
|
||||
@@ -891,8 +893,8 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
|
||||
req.qp_flags = cpu_to_le32(qp_flags);
|
||||
req.pd_id = cpu_to_le32(qp->pd->id);
|
||||
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
|
||||
(void *)&resp, NULL, 0);
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
if (rc)
|
||||
goto fail;
|
||||
|
||||
@@ -952,20 +954,22 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
|
||||
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
|
||||
struct bnxt_qplib_hwq_attr hwq_attr = {};
|
||||
struct bnxt_qplib_sg_info sginfo = {};
|
||||
struct creq_create_qp_resp resp = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
struct bnxt_qplib_q *sq = &qp->sq;
|
||||
struct bnxt_qplib_q *rq = &qp->rq;
|
||||
struct creq_create_qp_resp resp;
|
||||
struct cmdq_create_qp req = {};
|
||||
int rc, req_size, psn_sz = 0;
|
||||
struct bnxt_qplib_hwq *xrrq;
|
||||
struct bnxt_qplib_pbl *pbl;
|
||||
struct cmdq_create_qp req;
|
||||
u16 cmd_flags = 0;
|
||||
u32 qp_flags = 0;
|
||||
u8 pg_sz_lvl;
|
||||
u32 tbl_indx;
|
||||
u16 nsge;
|
||||
|
||||
RCFW_CMD_PREP(req, CREATE_QP, cmd_flags);
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_CREATE_QP,
|
||||
sizeof(req));
|
||||
|
||||
/* General */
|
||||
req.type = qp->type;
|
||||
@@ -1098,8 +1102,9 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
|
||||
}
|
||||
req.pd_id = cpu_to_le32(qp->pd->id);
|
||||
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
|
||||
(void *)&resp, NULL, 0);
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req),
|
||||
sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
if (rc)
|
||||
goto fail;
|
||||
|
||||
@@ -1231,14 +1236,16 @@ static void __filter_modify_flags(struct bnxt_qplib_qp *qp)
|
||||
int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
|
||||
{
|
||||
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
|
||||
struct cmdq_modify_qp req;
|
||||
struct creq_modify_qp_resp resp;
|
||||
u16 cmd_flags = 0;
|
||||
struct creq_modify_qp_resp resp = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
struct cmdq_modify_qp req = {};
|
||||
u32 temp32[4];
|
||||
u32 bmask;
|
||||
int rc;
|
||||
|
||||
RCFW_CMD_PREP(req, MODIFY_QP, cmd_flags);
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_MODIFY_QP,
|
||||
sizeof(req));
|
||||
|
||||
/* Filter out the qp_attr_mask based on the state->new transition */
|
||||
__filter_modify_flags(qp);
|
||||
@@ -1286,7 +1293,7 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
|
||||
memcpy(req.dest_mac, qp->ah.dmac, 6);
|
||||
|
||||
if (bmask & CMDQ_MODIFY_QP_MODIFY_MASK_PATH_MTU)
|
||||
req.path_mtu = qp->path_mtu;
|
||||
req.path_mtu_pingpong_push_enable |= qp->path_mtu;
|
||||
|
||||
if (bmask & CMDQ_MODIFY_QP_MODIFY_MASK_TIMEOUT)
|
||||
req.timeout = qp->timeout;
|
||||
@@ -1324,8 +1331,8 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
|
||||
|
||||
req.vlan_pcp_vlan_dei_vlan_id = cpu_to_le16(qp->vlan_id);
|
||||
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
|
||||
(void *)&resp, NULL, 0);
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
if (rc)
|
||||
return rc;
|
||||
qp->cur_qp_state = qp->state;
|
||||
@@ -1335,15 +1342,17 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
|
||||
int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
|
||||
{
|
||||
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
|
||||
struct cmdq_query_qp req;
|
||||
struct creq_query_qp_resp resp;
|
||||
struct creq_query_qp_resp resp = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
struct bnxt_qplib_rcfw_sbuf *sbuf;
|
||||
struct creq_query_qp_resp_sb *sb;
|
||||
u16 cmd_flags = 0;
|
||||
struct cmdq_query_qp req = {};
|
||||
u32 temp32[4];
|
||||
int i, rc = 0;
|
||||
|
||||
RCFW_CMD_PREP(req, QUERY_QP, cmd_flags);
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_QUERY_QP,
|
||||
sizeof(req));
|
||||
|
||||
sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb));
|
||||
if (!sbuf)
|
||||
@@ -1352,8 +1361,9 @@ int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
|
||||
|
||||
req.qp_cid = cpu_to_le32(qp->id);
|
||||
req.resp_size = sizeof(*sb) / BNXT_QPLIB_CMDQE_UNITS;
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
|
||||
(void *)sbuf, 0);
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, sbuf, sizeof(req),
|
||||
sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
if (rc)
|
||||
goto bail;
|
||||
/* Extract the context from the side buffer */
|
||||
@@ -1460,9 +1470,9 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res,
|
||||
struct bnxt_qplib_qp *qp)
|
||||
{
|
||||
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
|
||||
struct cmdq_destroy_qp req;
|
||||
struct creq_destroy_qp_resp resp;
|
||||
u16 cmd_flags = 0;
|
||||
struct creq_destroy_qp_resp resp = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
struct cmdq_destroy_qp req = {};
|
||||
u32 tbl_indx;
|
||||
int rc;
|
||||
|
||||
@@ -1470,11 +1480,14 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res,
|
||||
rcfw->qp_tbl[tbl_indx].qp_id = BNXT_QPLIB_QP_ID_INVALID;
|
||||
rcfw->qp_tbl[tbl_indx].qp_handle = NULL;
|
||||
|
||||
RCFW_CMD_PREP(req, DESTROY_QP, cmd_flags);
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_DESTROY_QP,
|
||||
sizeof(req));
|
||||
|
||||
req.qp_cid = cpu_to_le32(qp->id);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
|
||||
(void *)&resp, NULL, 0);
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req),
|
||||
sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
if (rc) {
|
||||
rcfw->qp_tbl[tbl_indx].qp_id = qp->id;
|
||||
rcfw->qp_tbl[tbl_indx].qp_handle = qp;
|
||||
@@ -2036,10 +2049,10 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)
|
||||
{
|
||||
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
|
||||
struct bnxt_qplib_hwq_attr hwq_attr = {};
|
||||
struct creq_create_cq_resp resp;
|
||||
struct creq_create_cq_resp resp = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
struct cmdq_create_cq req = {};
|
||||
struct bnxt_qplib_pbl *pbl;
|
||||
struct cmdq_create_cq req;
|
||||
u16 cmd_flags = 0;
|
||||
u32 pg_sz_lvl;
|
||||
int rc;
|
||||
|
||||
@@ -2052,7 +2065,9 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)
|
||||
if (rc)
|
||||
goto exit;
|
||||
|
||||
RCFW_CMD_PREP(req, CREATE_CQ, cmd_flags);
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_CREATE_CQ,
|
||||
sizeof(req));
|
||||
|
||||
if (!cq->dpi) {
|
||||
dev_err(&rcfw->pdev->dev,
|
||||
@@ -2071,9 +2086,9 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)
|
||||
req.cq_fco_cnq_id = cpu_to_le32(
|
||||
(cq->cnq_hw_ring_id & CMDQ_CREATE_CQ_CNQ_ID_MASK) <<
|
||||
CMDQ_CREATE_CQ_CNQ_ID_SFT);
|
||||
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
|
||||
(void *)&resp, NULL, 0);
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req),
|
||||
sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
if (rc)
|
||||
goto fail;
|
||||
|
||||
@@ -2100,20 +2115,70 @@ exit:
|
||||
return rc;
|
||||
}
|
||||
|
||||
void bnxt_qplib_resize_cq_complete(struct bnxt_qplib_res *res,
|
||||
struct bnxt_qplib_cq *cq)
|
||||
{
|
||||
bnxt_qplib_free_hwq(res, &cq->hwq);
|
||||
memcpy(&cq->hwq, &cq->resize_hwq, sizeof(cq->hwq));
|
||||
}
|
||||
|
||||
int bnxt_qplib_resize_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq,
|
||||
int new_cqes)
|
||||
{
|
||||
struct bnxt_qplib_hwq_attr hwq_attr = {};
|
||||
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
|
||||
struct creq_resize_cq_resp resp = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
struct cmdq_resize_cq req = {};
|
||||
struct bnxt_qplib_pbl *pbl;
|
||||
u32 pg_sz, lvl, new_sz;
|
||||
int rc;
|
||||
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_RESIZE_CQ,
|
||||
sizeof(req));
|
||||
hwq_attr.sginfo = &cq->sg_info;
|
||||
hwq_attr.res = res;
|
||||
hwq_attr.depth = new_cqes;
|
||||
hwq_attr.stride = sizeof(struct cq_base);
|
||||
hwq_attr.type = HWQ_TYPE_QUEUE;
|
||||
rc = bnxt_qplib_alloc_init_hwq(&cq->resize_hwq, &hwq_attr);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
req.cq_cid = cpu_to_le32(cq->id);
|
||||
pbl = &cq->resize_hwq.pbl[PBL_LVL_0];
|
||||
pg_sz = bnxt_qplib_base_pg_size(&cq->resize_hwq);
|
||||
lvl = (cq->resize_hwq.level << CMDQ_RESIZE_CQ_LVL_SFT) &
|
||||
CMDQ_RESIZE_CQ_LVL_MASK;
|
||||
new_sz = (new_cqes << CMDQ_RESIZE_CQ_NEW_CQ_SIZE_SFT) &
|
||||
CMDQ_RESIZE_CQ_NEW_CQ_SIZE_MASK;
|
||||
req.new_cq_size_pg_size_lvl = cpu_to_le32(new_sz | pg_sz | lvl);
|
||||
req.new_pbl = cpu_to_le64(pbl->pg_map_arr[0]);
|
||||
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req),
|
||||
sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)
|
||||
{
|
||||
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
|
||||
struct cmdq_destroy_cq req;
|
||||
struct creq_destroy_cq_resp resp;
|
||||
struct creq_destroy_cq_resp resp = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
struct cmdq_destroy_cq req = {};
|
||||
u16 total_cnq_events;
|
||||
u16 cmd_flags = 0;
|
||||
int rc;
|
||||
|
||||
RCFW_CMD_PREP(req, DESTROY_CQ, cmd_flags);
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_DESTROY_CQ,
|
||||
sizeof(req));
|
||||
|
||||
req.cq_cid = cpu_to_le32(cq->id);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
|
||||
(void *)&resp, NULL, 0);
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req),
|
||||
sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
if (rc)
|
||||
return rc;
|
||||
total_cnq_events = le16_to_cpu(resp.total_cnq_events);
|
||||
|
||||
@@ -400,6 +400,7 @@ struct bnxt_qplib_cq {
|
||||
u16 count;
|
||||
u16 period;
|
||||
struct bnxt_qplib_hwq hwq;
|
||||
struct bnxt_qplib_hwq resize_hwq;
|
||||
u32 cnq_hw_ring_id;
|
||||
struct bnxt_qplib_nq *nq;
|
||||
bool resize_in_progress;
|
||||
@@ -532,6 +533,10 @@ void bnxt_qplib_post_recv_db(struct bnxt_qplib_qp *qp);
|
||||
int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp,
|
||||
struct bnxt_qplib_swqe *wqe);
|
||||
int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq);
|
||||
int bnxt_qplib_resize_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq,
|
||||
int new_cqes);
|
||||
void bnxt_qplib_resize_cq_complete(struct bnxt_qplib_res *res,
|
||||
struct bnxt_qplib_cq *cq);
|
||||
int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq);
|
||||
int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe,
|
||||
int num, struct bnxt_qplib_qp **qp);
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "qplib_rcfw.h"
|
||||
#include "qplib_sp.h"
|
||||
#include "qplib_fp.h"
|
||||
#include "qplib_tlv.h"
|
||||
|
||||
static void bnxt_qplib_service_creq(struct tasklet_struct *t);
|
||||
|
||||
@@ -85,8 +86,8 @@ done:
|
||||
return count ? 0 : -ETIMEDOUT;
|
||||
};
|
||||
|
||||
static int __send_message(struct bnxt_qplib_rcfw *rcfw, struct cmdq_base *req,
|
||||
struct creq_base *resp, void *sb, u8 is_block)
|
||||
static int __send_message(struct bnxt_qplib_rcfw *rcfw,
|
||||
struct bnxt_qplib_cmdqmsg *msg)
|
||||
{
|
||||
struct bnxt_qplib_cmdq_ctx *cmdq = &rcfw->cmdq;
|
||||
struct bnxt_qplib_hwq *hwq = &cmdq->hwq;
|
||||
@@ -95,13 +96,13 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, struct cmdq_base *req,
|
||||
u32 sw_prod, cmdq_prod;
|
||||
struct pci_dev *pdev;
|
||||
unsigned long flags;
|
||||
u32 size, opcode;
|
||||
u32 bsize, opcode;
|
||||
u16 cookie, cbit;
|
||||
u8 *preq;
|
||||
|
||||
pdev = rcfw->pdev;
|
||||
|
||||
opcode = req->opcode;
|
||||
opcode = __get_cmdq_base_opcode(msg->req, msg->req_sz);
|
||||
if (!test_bit(FIRMWARE_INITIALIZED_FLAG, &cmdq->flags) &&
|
||||
(opcode != CMDQ_BASE_OPCODE_QUERY_FUNC &&
|
||||
opcode != CMDQ_BASE_OPCODE_INITIALIZE_FW &&
|
||||
@@ -124,7 +125,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, struct cmdq_base *req,
|
||||
* cmdqe
|
||||
*/
|
||||
spin_lock_irqsave(&hwq->lock, flags);
|
||||
if (req->cmd_size >= HWQ_FREE_SLOTS(hwq)) {
|
||||
if (msg->req->cmd_size >= HWQ_FREE_SLOTS(hwq)) {
|
||||
dev_err(&pdev->dev, "RCFW: CMDQ is full!\n");
|
||||
spin_unlock_irqrestore(&hwq->lock, flags);
|
||||
return -EAGAIN;
|
||||
@@ -133,36 +134,34 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, struct cmdq_base *req,
|
||||
|
||||
cookie = cmdq->seq_num & RCFW_MAX_COOKIE_VALUE;
|
||||
cbit = cookie % rcfw->cmdq_depth;
|
||||
if (is_block)
|
||||
if (msg->block)
|
||||
cookie |= RCFW_CMD_IS_BLOCKING;
|
||||
|
||||
set_bit(cbit, cmdq->cmdq_bitmap);
|
||||
req->cookie = cpu_to_le16(cookie);
|
||||
__set_cmdq_base_cookie(msg->req, msg->req_sz, cpu_to_le16(cookie));
|
||||
crsqe = &rcfw->crsqe_tbl[cbit];
|
||||
if (crsqe->resp) {
|
||||
spin_unlock_irqrestore(&hwq->lock, flags);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
size = req->cmd_size;
|
||||
/* change the cmd_size to the number of 16byte cmdq unit.
|
||||
* req->cmd_size is modified here
|
||||
*/
|
||||
bnxt_qplib_set_cmd_slots(req);
|
||||
bsize = bnxt_qplib_set_cmd_slots(msg->req);
|
||||
|
||||
memset(resp, 0, sizeof(*resp));
|
||||
crsqe->resp = (struct creq_qp_event *)resp;
|
||||
crsqe->resp->cookie = req->cookie;
|
||||
crsqe->req_size = req->cmd_size;
|
||||
if (req->resp_size && sb) {
|
||||
struct bnxt_qplib_rcfw_sbuf *sbuf = sb;
|
||||
|
||||
req->resp_addr = cpu_to_le64(sbuf->dma_addr);
|
||||
req->resp_size = (sbuf->size + BNXT_QPLIB_CMDQE_UNITS - 1) /
|
||||
BNXT_QPLIB_CMDQE_UNITS;
|
||||
memset(msg->resp, 0, sizeof(*msg->resp));
|
||||
crsqe->resp = (struct creq_qp_event *)msg->resp;
|
||||
crsqe->resp->cookie = cpu_to_le16(cookie);
|
||||
crsqe->req_size = __get_cmdq_base_cmd_size(msg->req, msg->req_sz);
|
||||
if (__get_cmdq_base_resp_size(msg->req, msg->req_sz) && msg->sb) {
|
||||
struct bnxt_qplib_rcfw_sbuf *sbuf = msg->sb;
|
||||
__set_cmdq_base_resp_addr(msg->req, msg->req_sz, cpu_to_le64(sbuf->dma_addr));
|
||||
__set_cmdq_base_resp_size(msg->req, msg->req_sz,
|
||||
ALIGN(sbuf->size, BNXT_QPLIB_CMDQE_UNITS));
|
||||
}
|
||||
|
||||
preq = (u8 *)req;
|
||||
preq = (u8 *)msg->req;
|
||||
do {
|
||||
/* Locate the next cmdq slot */
|
||||
sw_prod = HWQ_CMP(hwq->prod, hwq);
|
||||
@@ -174,11 +173,11 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, struct cmdq_base *req,
|
||||
}
|
||||
/* Copy a segment of the req cmd to the cmdq */
|
||||
memset(cmdqe, 0, sizeof(*cmdqe));
|
||||
memcpy(cmdqe, preq, min_t(u32, size, sizeof(*cmdqe)));
|
||||
preq += min_t(u32, size, sizeof(*cmdqe));
|
||||
size -= min_t(u32, size, sizeof(*cmdqe));
|
||||
memcpy(cmdqe, preq, min_t(u32, bsize, sizeof(*cmdqe)));
|
||||
preq += min_t(u32, bsize, sizeof(*cmdqe));
|
||||
bsize -= min_t(u32, bsize, sizeof(*cmdqe));
|
||||
hwq->prod++;
|
||||
} while (size > 0);
|
||||
} while (bsize > 0);
|
||||
cmdq->seq_num++;
|
||||
|
||||
cmdq_prod = hwq->prod;
|
||||
@@ -191,7 +190,6 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, struct cmdq_base *req,
|
||||
cmdq_prod |= BIT(FIRMWARE_FIRST_FLAG);
|
||||
clear_bit(FIRMWARE_FIRST_FLAG, &cmdq->flags);
|
||||
}
|
||||
|
||||
/* ring CMDQ DB */
|
||||
wmb();
|
||||
writel(cmdq_prod, cmdq->cmdq_mbox.prod);
|
||||
@@ -203,11 +201,9 @@ done:
|
||||
}
|
||||
|
||||
int bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
|
||||
struct cmdq_base *req,
|
||||
struct creq_base *resp,
|
||||
void *sb, u8 is_block)
|
||||
struct bnxt_qplib_cmdqmsg *msg)
|
||||
{
|
||||
struct creq_qp_event *evnt = (struct creq_qp_event *)resp;
|
||||
struct creq_qp_event *evnt = (struct creq_qp_event *)msg->resp;
|
||||
u16 cookie;
|
||||
u8 opcode, retry_cnt = 0xFF;
|
||||
int rc = 0;
|
||||
@@ -217,23 +213,23 @@ int bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
|
||||
return 0;
|
||||
|
||||
do {
|
||||
opcode = req->opcode;
|
||||
rc = __send_message(rcfw, req, resp, sb, is_block);
|
||||
cookie = le16_to_cpu(req->cookie) & RCFW_MAX_COOKIE_VALUE;
|
||||
opcode = __get_cmdq_base_opcode(msg->req, msg->req_sz);
|
||||
rc = __send_message(rcfw, msg);
|
||||
cookie = le16_to_cpu(__get_cmdq_base_cookie(msg->req, msg->req_sz)) &
|
||||
RCFW_MAX_COOKIE_VALUE;
|
||||
if (!rc)
|
||||
break;
|
||||
|
||||
if (!retry_cnt || (rc != -EAGAIN && rc != -EBUSY)) {
|
||||
/* send failed */
|
||||
dev_err(&rcfw->pdev->dev, "cmdq[%#x]=%#x send failed\n",
|
||||
cookie, opcode);
|
||||
return rc;
|
||||
}
|
||||
is_block ? mdelay(1) : usleep_range(500, 1000);
|
||||
msg->block ? mdelay(1) : usleep_range(500, 1000);
|
||||
|
||||
} while (retry_cnt--);
|
||||
|
||||
if (is_block)
|
||||
if (msg->block)
|
||||
rc = __block_for_resp(rcfw, cookie);
|
||||
else
|
||||
rc = __wait_for_resp(rcfw, cookie);
|
||||
@@ -452,14 +448,17 @@ static irqreturn_t bnxt_qplib_creq_irq(int irq, void *dev_instance)
|
||||
/* RCFW */
|
||||
int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw)
|
||||
{
|
||||
struct cmdq_deinitialize_fw req;
|
||||
struct creq_deinitialize_fw_resp resp;
|
||||
u16 cmd_flags = 0;
|
||||
struct creq_deinitialize_fw_resp resp = {};
|
||||
struct cmdq_deinitialize_fw req = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
int rc;
|
||||
|
||||
RCFW_CMD_PREP(req, DEINITIALIZE_FW, cmd_flags);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
|
||||
NULL, 0);
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_DEINITIALIZE_FW,
|
||||
sizeof(req));
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL,
|
||||
sizeof(req), sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
@@ -470,13 +469,15 @@ int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw)
|
||||
int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
|
||||
struct bnxt_qplib_ctx *ctx, int is_virtfn)
|
||||
{
|
||||
struct creq_initialize_fw_resp resp;
|
||||
struct cmdq_initialize_fw req;
|
||||
u16 cmd_flags = 0;
|
||||
struct creq_initialize_fw_resp resp = {};
|
||||
struct cmdq_initialize_fw req = {};
|
||||
struct bnxt_qplib_cmdqmsg msg = {};
|
||||
u8 pgsz, lvl;
|
||||
int rc;
|
||||
|
||||
RCFW_CMD_PREP(req, INITIALIZE_FW, cmd_flags);
|
||||
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
|
||||
CMDQ_BASE_OPCODE_INITIALIZE_FW,
|
||||
sizeof(req));
|
||||
/* Supply (log-base-2-of-host-page-size - base-page-shift)
|
||||
* to bono to adjust the doorbell page sizes.
|
||||
*/
|
||||
@@ -545,8 +546,8 @@ config_vf_res:
|
||||
|
||||
skip_ctx_setup:
|
||||
req.stat_ctx_id = cpu_to_le32(ctx->stats.fw_id);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
|
||||
NULL, 0);
|
||||
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), sizeof(resp), 0);
|
||||
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
|
||||
if (rc)
|
||||
return rc;
|
||||
set_bit(FIRMWARE_INITIALIZED_FLAG, &rcfw->cmdq.flags);
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#ifndef __BNXT_QPLIB_RCFW_H__
|
||||
#define __BNXT_QPLIB_RCFW_H__
|
||||
|
||||
#include "qplib_tlv.h"
|
||||
|
||||
#define RCFW_CMDQ_TRIG_VAL 1
|
||||
#define RCFW_COMM_PCI_BAR_REGION 0
|
||||
#define RCFW_COMM_CONS_PCI_BAR_REGION 2
|
||||
@@ -51,25 +53,25 @@
|
||||
#define RCFW_DBR_PCI_BAR_REGION 2
|
||||
#define RCFW_DBR_BASE_PAGE_SHIFT 12
|
||||
|
||||
#define RCFW_CMD_PREP(req, CMD, cmd_flags) \
|
||||
do { \
|
||||
memset(&(req), 0, sizeof((req))); \
|
||||
(req).opcode = CMDQ_BASE_OPCODE_##CMD; \
|
||||
(req).cmd_size = sizeof((req)); \
|
||||
(req).flags = cpu_to_le16(cmd_flags); \
|
||||
} while (0)
|
||||
|
||||
#define RCFW_CMD_WAIT_TIME_MS 20000 /* 20 Seconds timeout */
|
||||
|
||||
/* Cmdq contains a fix number of a 16-Byte slots */
|
||||
struct bnxt_qplib_cmdqe {
|
||||
u8 data[16];
|
||||
};
|
||||
|
||||
#define BNXT_QPLIB_CMDQE_UNITS sizeof(struct bnxt_qplib_cmdqe)
|
||||
|
||||
static inline void bnxt_qplib_rcfw_cmd_prep(struct cmdq_base *req,
|
||||
u8 opcode, u8 cmd_size)
|
||||
{
|
||||
req->opcode = opcode;
|
||||
req->cmd_size = cmd_size;
|
||||
}
|
||||
|
||||
#define RCFW_CMD_WAIT_TIME_MS 20000 /* 20 Seconds timeout */
|
||||
|
||||
/* CMDQ elements */
|
||||
#define BNXT_QPLIB_CMDQE_MAX_CNT_256 256
|
||||
#define BNXT_QPLIB_CMDQE_MAX_CNT_8192 8192
|
||||
#define BNXT_QPLIB_CMDQE_UNITS sizeof(struct bnxt_qplib_cmdqe)
|
||||
#define BNXT_QPLIB_CMDQE_BYTES(depth) ((depth) * BNXT_QPLIB_CMDQE_UNITS)
|
||||
|
||||
static inline u32 bnxt_qplib_cmdqe_npages(u32 depth)
|
||||
@@ -87,11 +89,21 @@ static inline u32 bnxt_qplib_cmdqe_page_size(u32 depth)
|
||||
return (bnxt_qplib_cmdqe_npages(depth) * PAGE_SIZE);
|
||||
}
|
||||
|
||||
/* Set the cmd_size to a factor of CMDQE unit */
|
||||
static inline void bnxt_qplib_set_cmd_slots(struct cmdq_base *req)
|
||||
static inline u32 bnxt_qplib_set_cmd_slots(struct cmdq_base *req)
|
||||
{
|
||||
req->cmd_size = (req->cmd_size + BNXT_QPLIB_CMDQE_UNITS - 1) /
|
||||
BNXT_QPLIB_CMDQE_UNITS;
|
||||
u32 cmd_byte = 0;
|
||||
|
||||
if (HAS_TLV_HEADER(req)) {
|
||||
struct roce_tlv *tlv_req = (struct roce_tlv *)req;
|
||||
|
||||
cmd_byte = tlv_req->total_size * BNXT_QPLIB_CMDQE_UNITS;
|
||||
} else {
|
||||
cmd_byte = req->cmd_size;
|
||||
req->cmd_size = (req->cmd_size + BNXT_QPLIB_CMDQE_UNITS - 1) /
|
||||
BNXT_QPLIB_CMDQE_UNITS;
|
||||
}
|
||||
|
||||
return cmd_byte;
|
||||
}
|
||||
|
||||
#define RCFW_MAX_COOKIE_VALUE 0x7FFF
|
||||
@@ -190,6 +202,27 @@ struct bnxt_qplib_rcfw {
|
||||
u32 cmdq_depth;
|
||||
};
|
||||
|
||||
struct bnxt_qplib_cmdqmsg {
|
||||
struct cmdq_base *req;
|
||||
struct creq_base *resp;
|
||||
void *sb;
|
||||
u32 req_sz;
|
||||
u32 res_sz;
|
||||
u8 block;
|
||||
};
|
||||
|
||||
static inline void bnxt_qplib_fill_cmdqmsg(struct bnxt_qplib_cmdqmsg *msg,
|
||||
void *req, void *resp, void *sb,
|
||||
u32 req_sz, u32 res_sz, u8 block)
|
||||
{
|
||||
msg->req = req;
|
||||
msg->resp = resp;
|
||||
msg->sb = sb;
|
||||
msg->req_sz = req_sz;
|
||||
msg->res_sz = res_sz;
|
||||
msg->block = block;
|
||||
}
|
||||
|
||||
void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw);
|
||||
int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,
|
||||
struct bnxt_qplib_rcfw *rcfw,
|
||||
@@ -210,8 +243,7 @@ struct bnxt_qplib_rcfw_sbuf *bnxt_qplib_rcfw_alloc_sbuf(
|
||||
void bnxt_qplib_rcfw_free_sbuf(struct bnxt_qplib_rcfw *rcfw,
|
||||
struct bnxt_qplib_rcfw_sbuf *sbuf);
|
||||
int bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
|
||||
struct cmdq_base *req, struct creq_base *resp,
|
||||
void *sbuf, u8 is_block);
|
||||
struct bnxt_qplib_cmdqmsg *msg);
|
||||
|
||||
int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw);
|
||||
int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -244,6 +244,71 @@ struct bnxt_qplib_ext_stat {
|
||||
u64 rx_ecn_marked;
|
||||
};
|
||||
|
||||
struct bnxt_qplib_cc_param_ext {
|
||||
u64 ext_mask;
|
||||
u16 inact_th_hi;
|
||||
u16 min_delta_cnp;
|
||||
u16 init_cp;
|
||||
u8 tr_update_mode;
|
||||
u8 tr_update_cyls;
|
||||
u8 fr_rtt;
|
||||
u8 ai_rate_incr;
|
||||
u16 rr_rtt_th;
|
||||
u16 ar_cr_th;
|
||||
u16 cr_min_th;
|
||||
u8 bw_avg_weight;
|
||||
u8 cr_factor;
|
||||
u16 cr_th_max_cp;
|
||||
u8 cp_bias_en;
|
||||
u8 cp_bias;
|
||||
u8 cnp_ecn;
|
||||
u8 rtt_jitter_en;
|
||||
u16 bytes_per_usec;
|
||||
u16 cc_cr_reset_th;
|
||||
u8 cr_width;
|
||||
u8 min_quota;
|
||||
u8 max_quota;
|
||||
u8 abs_max_quota;
|
||||
u16 tr_lb;
|
||||
u8 cr_prob_fac;
|
||||
u8 tr_prob_fac;
|
||||
u16 fair_cr_th;
|
||||
u8 red_div;
|
||||
u8 cnp_ratio_th;
|
||||
u16 ai_ext_rtt;
|
||||
u8 exp_crcp_ratio;
|
||||
u8 low_rate_en;
|
||||
u16 cpcr_update_th;
|
||||
u16 ai_rtt_th1;
|
||||
u16 ai_rtt_th2;
|
||||
u16 cf_rtt_th;
|
||||
u16 sc_cr_th1; /* severe congestion cr threshold 1 */
|
||||
u16 sc_cr_th2; /* severe congestion cr threshold 2 */
|
||||
u32 l64B_per_rtt;
|
||||
u8 cc_ack_bytes;
|
||||
u16 reduce_cf_rtt_th;
|
||||
};
|
||||
|
||||
struct bnxt_qplib_cc_param {
|
||||
u8 alt_vlan_pcp;
|
||||
u16 alt_tos_dscp;
|
||||
u8 cc_mode;
|
||||
u8 enable;
|
||||
u16 inact_th;
|
||||
u16 init_cr;
|
||||
u16 init_tr;
|
||||
u16 rtt;
|
||||
u8 g;
|
||||
u8 nph_per_state;
|
||||
u8 time_pph;
|
||||
u8 pkts_pph;
|
||||
u8 tos_ecn;
|
||||
u8 tos_dscp;
|
||||
u16 tcp_cp;
|
||||
struct bnxt_qplib_cc_param_ext cc_ext;
|
||||
u32 mask;
|
||||
};
|
||||
|
||||
int bnxt_qplib_get_sgid(struct bnxt_qplib_res *res,
|
||||
struct bnxt_qplib_sgid_tbl *sgid_tbl, int index,
|
||||
struct bnxt_qplib_gid *gid);
|
||||
@@ -277,10 +342,11 @@ int bnxt_qplib_alloc_fast_reg_page_list(struct bnxt_qplib_res *res,
|
||||
struct bnxt_qplib_frpl *frpl, int max);
|
||||
int bnxt_qplib_free_fast_reg_page_list(struct bnxt_qplib_res *res,
|
||||
struct bnxt_qplib_frpl *frpl);
|
||||
int bnxt_qplib_map_tc2cos(struct bnxt_qplib_res *res, u16 *cids);
|
||||
int bnxt_qplib_get_roce_stats(struct bnxt_qplib_rcfw *rcfw,
|
||||
struct bnxt_qplib_roce_stats *stats);
|
||||
int bnxt_qplib_qext_stat(struct bnxt_qplib_rcfw *rcfw, u32 fid,
|
||||
struct bnxt_qplib_ext_stat *estat);
|
||||
int bnxt_qplib_modify_cc(struct bnxt_qplib_res *res,
|
||||
struct bnxt_qplib_cc_param *cc_param);
|
||||
|
||||
#endif /* __BNXT_QPLIB_SP_H__*/
|
||||
|
||||
162
drivers/infiniband/hw/bnxt_re/qplib_tlv.h
Normal file
162
drivers/infiniband/hw/bnxt_re/qplib_tlv.h
Normal file
@@ -0,0 +1,162 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
|
||||
|
||||
#ifndef __QPLIB_TLV_H__
|
||||
#define __QPLIB_TLV_H__
|
||||
|
||||
struct roce_tlv {
|
||||
struct tlv tlv;
|
||||
u8 total_size; // in units of 16 byte chunks
|
||||
u8 unused[7]; // for 16 byte alignment
|
||||
};
|
||||
|
||||
#define CHUNK_SIZE 16
|
||||
#define CHUNKS(x) (((x) + CHUNK_SIZE - 1) / CHUNK_SIZE)
|
||||
|
||||
static inline void __roce_1st_tlv_prep(struct roce_tlv *rtlv, u8 tot_chunks,
|
||||
u16 content_bytes, u8 flags)
|
||||
{
|
||||
rtlv->tlv.cmd_discr = cpu_to_le16(CMD_DISCR_TLV_ENCAP);
|
||||
rtlv->tlv.tlv_type = cpu_to_le16(TLV_TYPE_ROCE_SP_COMMAND);
|
||||
rtlv->tlv.length = cpu_to_le16(content_bytes);
|
||||
rtlv->tlv.flags = TLV_FLAGS_REQUIRED;
|
||||
rtlv->tlv.flags |= flags ? TLV_FLAGS_MORE : 0;
|
||||
rtlv->total_size = (tot_chunks);
|
||||
}
|
||||
|
||||
static inline void __roce_ext_tlv_prep(struct roce_tlv *rtlv, u16 tlv_type,
|
||||
u16 content_bytes, u8 more, u8 flags)
|
||||
{
|
||||
rtlv->tlv.cmd_discr = cpu_to_le16(CMD_DISCR_TLV_ENCAP);
|
||||
rtlv->tlv.tlv_type = cpu_to_le16(tlv_type);
|
||||
rtlv->tlv.length = cpu_to_le16(content_bytes);
|
||||
rtlv->tlv.flags |= more ? TLV_FLAGS_MORE : 0;
|
||||
rtlv->tlv.flags |= flags ? TLV_FLAGS_REQUIRED : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* TLV size in units of 16 byte chunks
|
||||
*/
|
||||
#define TLV_SIZE ((sizeof(struct roce_tlv) + 15) / 16)
|
||||
/*
|
||||
* TLV length in bytes
|
||||
*/
|
||||
#define TLV_BYTES (TLV_SIZE * 16)
|
||||
|
||||
#define HAS_TLV_HEADER(msg) (le16_to_cpu(((struct tlv *)(msg))->cmd_discr) == CMD_DISCR_TLV_ENCAP)
|
||||
#define GET_TLV_DATA(tlv) ((void *)&((uint8_t *)(tlv))[TLV_BYTES])
|
||||
|
||||
static inline u8 __get_cmdq_base_opcode(struct cmdq_base *req, u32 size)
|
||||
{
|
||||
if (HAS_TLV_HEADER(req) && size > TLV_BYTES)
|
||||
return ((struct cmdq_base *)GET_TLV_DATA(req))->opcode;
|
||||
else
|
||||
return req->opcode;
|
||||
}
|
||||
|
||||
static inline void __set_cmdq_base_opcode(struct cmdq_base *req,
|
||||
u32 size, u8 val)
|
||||
{
|
||||
if (HAS_TLV_HEADER(req) && size > TLV_BYTES)
|
||||
((struct cmdq_base *)GET_TLV_DATA(req))->opcode = val;
|
||||
else
|
||||
req->opcode = val;
|
||||
}
|
||||
|
||||
static inline __le16 __get_cmdq_base_cookie(struct cmdq_base *req, u32 size)
|
||||
{
|
||||
if (HAS_TLV_HEADER(req) && size > TLV_BYTES)
|
||||
return ((struct cmdq_base *)GET_TLV_DATA(req))->cookie;
|
||||
else
|
||||
return req->cookie;
|
||||
}
|
||||
|
||||
static inline void __set_cmdq_base_cookie(struct cmdq_base *req,
|
||||
u32 size, __le16 val)
|
||||
{
|
||||
if (HAS_TLV_HEADER(req) && size > TLV_BYTES)
|
||||
((struct cmdq_base *)GET_TLV_DATA(req))->cookie = val;
|
||||
else
|
||||
req->cookie = val;
|
||||
}
|
||||
|
||||
static inline __le64 __get_cmdq_base_resp_addr(struct cmdq_base *req, u32 size)
|
||||
{
|
||||
if (HAS_TLV_HEADER(req) && size > TLV_BYTES)
|
||||
return ((struct cmdq_base *)GET_TLV_DATA(req))->resp_addr;
|
||||
else
|
||||
return req->resp_addr;
|
||||
}
|
||||
|
||||
static inline void __set_cmdq_base_resp_addr(struct cmdq_base *req,
|
||||
u32 size, __le64 val)
|
||||
{
|
||||
if (HAS_TLV_HEADER(req) && size > TLV_BYTES)
|
||||
((struct cmdq_base *)GET_TLV_DATA(req))->resp_addr = val;
|
||||
else
|
||||
req->resp_addr = val;
|
||||
}
|
||||
|
||||
static inline u8 __get_cmdq_base_resp_size(struct cmdq_base *req, u32 size)
|
||||
{
|
||||
if (HAS_TLV_HEADER(req) && size > TLV_BYTES)
|
||||
return ((struct cmdq_base *)GET_TLV_DATA(req))->resp_size;
|
||||
else
|
||||
return req->resp_size;
|
||||
}
|
||||
|
||||
static inline void __set_cmdq_base_resp_size(struct cmdq_base *req,
|
||||
u32 size, u8 val)
|
||||
{
|
||||
if (HAS_TLV_HEADER(req) && size > TLV_BYTES)
|
||||
((struct cmdq_base *)GET_TLV_DATA(req))->resp_size = val;
|
||||
else
|
||||
req->resp_size = val;
|
||||
}
|
||||
|
||||
static inline u8 __get_cmdq_base_cmd_size(struct cmdq_base *req, u32 size)
|
||||
{
|
||||
if (HAS_TLV_HEADER(req) && size > TLV_BYTES)
|
||||
return ((struct roce_tlv *)(req))->total_size;
|
||||
else
|
||||
return req->cmd_size;
|
||||
}
|
||||
|
||||
static inline void __set_cmdq_base_cmd_size(struct cmdq_base *req,
|
||||
u32 size, u8 val)
|
||||
{
|
||||
if (HAS_TLV_HEADER(req) && size > TLV_BYTES)
|
||||
((struct cmdq_base *)GET_TLV_DATA(req))->cmd_size = val;
|
||||
else
|
||||
req->cmd_size = val;
|
||||
}
|
||||
|
||||
static inline __le16 __get_cmdq_base_flags(struct cmdq_base *req, u32 size)
|
||||
{
|
||||
if (HAS_TLV_HEADER(req) && size > TLV_BYTES)
|
||||
return ((struct cmdq_base *)GET_TLV_DATA(req))->flags;
|
||||
else
|
||||
return req->flags;
|
||||
}
|
||||
|
||||
static inline void __set_cmdq_base_flags(struct cmdq_base *req,
|
||||
u32 size, __le16 val)
|
||||
{
|
||||
if (HAS_TLV_HEADER(req) && size > TLV_BYTES)
|
||||
((struct cmdq_base *)GET_TLV_DATA(req))->flags = val;
|
||||
else
|
||||
req->flags = val;
|
||||
}
|
||||
|
||||
struct bnxt_qplib_tlv_modify_cc_req {
|
||||
struct roce_tlv tlv_hdr;
|
||||
struct cmdq_modify_roce_cc base_req;
|
||||
__le64 tlvpad;
|
||||
struct cmdq_modify_roce_cc_gen1_tlv ext_req;
|
||||
};
|
||||
|
||||
struct bnxt_qplib_tlv_query_rcc_sb {
|
||||
struct roce_tlv tlv_hdr;
|
||||
struct creq_query_roce_cc_resp_sb base_sb;
|
||||
struct creq_query_roce_cc_gen1_resp_sb_tlv gen1_sb;
|
||||
};
|
||||
#endif /* __QPLIB_TLV_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
|
||||
/*
|
||||
* Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
|
||||
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _EFA_ADMIN_CMDS_H_
|
||||
@@ -376,7 +376,9 @@ struct efa_admin_reg_mr_cmd {
|
||||
* 0 : local_write_enable - Local write permissions:
|
||||
* must be set for RQ buffers and buffers posted for
|
||||
* RDMA Read requests
|
||||
* 1 : reserved1 - MBZ
|
||||
* 1 : remote_write_enable - Remote write
|
||||
* permissions: must be set to enable RDMA write to
|
||||
* the region
|
||||
* 2 : remote_read_enable - Remote read permissions:
|
||||
* must be set to enable RDMA read from the region
|
||||
* 7:3 : reserved2 - MBZ
|
||||
@@ -618,7 +620,11 @@ struct efa_admin_feature_device_attr_desc {
|
||||
* TX queues
|
||||
* 1 : rnr_retry - If set, RNR retry is supported on
|
||||
* modify QP command
|
||||
* 31:2 : reserved - MBZ
|
||||
* 2 : data_polling_128 - If set, 128 bytes data
|
||||
* polling is supported
|
||||
* 3 : rdma_write - If set, RDMA Write is supported
|
||||
* on TX queues
|
||||
* 31:4 : reserved - MBZ
|
||||
*/
|
||||
u32 device_caps;
|
||||
|
||||
@@ -672,7 +678,7 @@ struct efa_admin_feature_queue_attr_desc {
|
||||
/* The maximum size of LLQ in bytes */
|
||||
u32 max_llq_size;
|
||||
|
||||
/* Maximum number of SGEs for a single RDMA read WQE */
|
||||
/* Maximum number of SGEs for a single RDMA read/write WQE */
|
||||
u16 max_wr_rdma_sges;
|
||||
|
||||
/*
|
||||
@@ -977,6 +983,7 @@ struct efa_admin_host_info {
|
||||
#define EFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT_MASK GENMASK(4, 0)
|
||||
#define EFA_ADMIN_REG_MR_CMD_MEM_ADDR_PHY_MODE_EN_MASK BIT(7)
|
||||
#define EFA_ADMIN_REG_MR_CMD_LOCAL_WRITE_ENABLE_MASK BIT(0)
|
||||
#define EFA_ADMIN_REG_MR_CMD_REMOTE_WRITE_ENABLE_MASK BIT(1)
|
||||
#define EFA_ADMIN_REG_MR_CMD_REMOTE_READ_ENABLE_MASK BIT(2)
|
||||
|
||||
/* create_cq_cmd */
|
||||
@@ -991,6 +998,8 @@ struct efa_admin_host_info {
|
||||
/* feature_device_attr_desc */
|
||||
#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RDMA_READ_MASK BIT(0)
|
||||
#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RNR_RETRY_MASK BIT(1)
|
||||
#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_DATA_POLLING_128_MASK BIT(2)
|
||||
#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RDMA_WRITE_MASK BIT(3)
|
||||
|
||||
/* create_eq_cmd */
|
||||
#define EFA_ADMIN_CREATE_EQ_CMD_ENTRY_SIZE_WORDS_MASK GENMASK(4, 0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
|
||||
/*
|
||||
* Copyright 2018-2022 Amazon.com, Inc. or its affiliates. All rights reserved.
|
||||
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _EFA_IO_H_
|
||||
@@ -23,6 +23,8 @@ enum efa_io_send_op_type {
|
||||
EFA_IO_SEND = 0,
|
||||
/* RDMA read */
|
||||
EFA_IO_RDMA_READ = 1,
|
||||
/* RDMA write */
|
||||
EFA_IO_RDMA_WRITE = 2,
|
||||
};
|
||||
|
||||
enum efa_io_comp_status {
|
||||
@@ -62,8 +64,7 @@ struct efa_io_tx_meta_desc {
|
||||
|
||||
/*
|
||||
* control flags
|
||||
* 3:0 : op_type - operation type: send/rdma/fast mem
|
||||
* ops/etc
|
||||
* 3:0 : op_type - enum efa_io_send_op_type
|
||||
* 4 : has_imm - immediate_data field carries valid
|
||||
* data.
|
||||
* 5 : inline_msg - inline mode - inline message data
|
||||
@@ -219,21 +220,22 @@ struct efa_io_cdesc_common {
|
||||
* 2:1 : q_type - enum efa_io_queue_type: send/recv
|
||||
* 3 : has_imm - indicates that immediate data is
|
||||
* present - for RX completions only
|
||||
* 7:4 : reserved28 - MBZ
|
||||
* 6:4 : op_type - enum efa_io_send_op_type
|
||||
* 7 : reserved31 - MBZ
|
||||
*/
|
||||
u8 flags;
|
||||
|
||||
/* local QP number */
|
||||
u16 qp_num;
|
||||
|
||||
/* Transferred length */
|
||||
u16 length;
|
||||
};
|
||||
|
||||
/* Tx completion descriptor */
|
||||
struct efa_io_tx_cdesc {
|
||||
/* Common completion info */
|
||||
struct efa_io_cdesc_common common;
|
||||
|
||||
/* MBZ */
|
||||
u16 reserved16;
|
||||
};
|
||||
|
||||
/* Rx Completion Descriptor */
|
||||
@@ -241,6 +243,9 @@ struct efa_io_rx_cdesc {
|
||||
/* Common completion info */
|
||||
struct efa_io_cdesc_common common;
|
||||
|
||||
/* Transferred length bits[15:0] */
|
||||
u16 length;
|
||||
|
||||
/* Remote Address Handle FW index, 0xFFFF indicates invalid ah */
|
||||
u16 ah;
|
||||
|
||||
@@ -250,16 +255,26 @@ struct efa_io_rx_cdesc {
|
||||
u32 imm;
|
||||
};
|
||||
|
||||
/* Rx Completion Descriptor RDMA write info */
|
||||
struct efa_io_rx_cdesc_rdma_write {
|
||||
/* Transferred length bits[31:16] */
|
||||
u16 length_hi;
|
||||
};
|
||||
|
||||
/* Extended Rx Completion Descriptor */
|
||||
struct efa_io_rx_cdesc_ex {
|
||||
/* Base RX completion info */
|
||||
struct efa_io_rx_cdesc rx_cdesc_base;
|
||||
struct efa_io_rx_cdesc base;
|
||||
|
||||
/*
|
||||
* Valid only in case of unknown AH (0xFFFF) and CQ set_src_addr is
|
||||
* enabled.
|
||||
*/
|
||||
u8 src_addr[16];
|
||||
union {
|
||||
struct efa_io_rx_cdesc_rdma_write rdma_write;
|
||||
|
||||
/*
|
||||
* Valid only in case of unknown AH (0xFFFF) and CQ
|
||||
* set_src_addr is enabled.
|
||||
*/
|
||||
u8 src_addr[16];
|
||||
} u;
|
||||
};
|
||||
|
||||
/* tx_meta_desc */
|
||||
@@ -285,5 +300,6 @@ struct efa_io_rx_cdesc_ex {
|
||||
#define EFA_IO_CDESC_COMMON_PHASE_MASK BIT(0)
|
||||
#define EFA_IO_CDESC_COMMON_Q_TYPE_MASK GENMASK(2, 1)
|
||||
#define EFA_IO_CDESC_COMMON_HAS_IMM_MASK BIT(3)
|
||||
#define EFA_IO_CDESC_COMMON_OP_TYPE_MASK GENMASK(6, 4)
|
||||
|
||||
#endif /* _EFA_IO_H_ */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
|
||||
/*
|
||||
* Copyright 2018-2022 Amazon.com, Inc. or its affiliates. All rights reserved.
|
||||
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/dma-buf.h>
|
||||
@@ -250,6 +250,12 @@ int efa_query_device(struct ib_device *ibdev,
|
||||
if (EFA_DEV_CAP(dev, RNR_RETRY))
|
||||
resp.device_caps |= EFA_QUERY_DEVICE_CAPS_RNR_RETRY;
|
||||
|
||||
if (EFA_DEV_CAP(dev, DATA_POLLING_128))
|
||||
resp.device_caps |= EFA_QUERY_DEVICE_CAPS_DATA_POLLING_128;
|
||||
|
||||
if (EFA_DEV_CAP(dev, RDMA_WRITE))
|
||||
resp.device_caps |= EFA_QUERY_DEVICE_CAPS_RDMA_WRITE;
|
||||
|
||||
if (dev->neqs)
|
||||
resp.device_caps |= EFA_QUERY_DEVICE_CAPS_CQ_NOTIFICATIONS;
|
||||
|
||||
@@ -1569,7 +1575,8 @@ static struct efa_mr *efa_alloc_mr(struct ib_pd *ibpd, int access_flags,
|
||||
|
||||
supp_access_flags =
|
||||
IB_ACCESS_LOCAL_WRITE |
|
||||
(EFA_DEV_CAP(dev, RDMA_READ) ? IB_ACCESS_REMOTE_READ : 0);
|
||||
(EFA_DEV_CAP(dev, RDMA_READ) ? IB_ACCESS_REMOTE_READ : 0) |
|
||||
(EFA_DEV_CAP(dev, RDMA_WRITE) ? IB_ACCESS_REMOTE_WRITE : 0);
|
||||
|
||||
access_flags &= ~IB_ACCESS_OPTIONAL;
|
||||
if (access_flags & ~supp_access_flags) {
|
||||
|
||||
@@ -32,7 +32,7 @@ struct erdma_eq {
|
||||
atomic64_t event_num;
|
||||
atomic64_t notify_num;
|
||||
|
||||
u64 __iomem *db_addr;
|
||||
void __iomem *db;
|
||||
u64 *db_record;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ struct mpa_rr_params {
|
||||
* MPA request/response Hdr bits & fields
|
||||
*/
|
||||
enum {
|
||||
MPA_RR_FLAG_MARKERS = __cpu_to_be16(0x8000),
|
||||
MPA_RR_FLAG_CRC = __cpu_to_be16(0x4000),
|
||||
MPA_RR_FLAG_REJECT = __cpu_to_be16(0x2000),
|
||||
MPA_RR_RESERVED = __cpu_to_be16(0x1f00),
|
||||
MPA_RR_MASK_REVISION = __cpu_to_be16(0x00ff)
|
||||
MPA_RR_FLAG_MARKERS = cpu_to_be16(0x8000),
|
||||
MPA_RR_FLAG_CRC = cpu_to_be16(0x4000),
|
||||
MPA_RR_FLAG_REJECT = cpu_to_be16(0x2000),
|
||||
MPA_RR_RESERVED = cpu_to_be16(0x1f00),
|
||||
MPA_RR_MASK_REVISION = cpu_to_be16(0x00ff)
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -166,8 +166,7 @@ static int erdma_cmdq_eq_init(struct erdma_dev *dev)
|
||||
spin_lock_init(&eq->lock);
|
||||
atomic64_set(&eq->event_num, 0);
|
||||
|
||||
eq->db_addr =
|
||||
(u64 __iomem *)(dev->func_bar + ERDMA_REGS_CEQ_DB_BASE_REG);
|
||||
eq->db = dev->func_bar + ERDMA_REGS_CEQ_DB_BASE_REG;
|
||||
eq->db_record = (u64 *)(eq->qbuf + buf_size);
|
||||
|
||||
erdma_reg_write32(dev, ERDMA_REGS_CMDQ_EQ_ADDR_H_REG,
|
||||
@@ -183,9 +182,8 @@ static int erdma_cmdq_eq_init(struct erdma_dev *dev)
|
||||
|
||||
int erdma_cmdq_init(struct erdma_dev *dev)
|
||||
{
|
||||
int err, i;
|
||||
struct erdma_cmdq *cmdq = &dev->cmdq;
|
||||
u32 sts, ctrl;
|
||||
int err;
|
||||
|
||||
cmdq->max_outstandings = ERDMA_CMDQ_MAX_OUTSTANDING;
|
||||
cmdq->use_event = false;
|
||||
@@ -208,34 +206,10 @@ int erdma_cmdq_init(struct erdma_dev *dev)
|
||||
if (err)
|
||||
goto err_destroy_cq;
|
||||
|
||||
ctrl = FIELD_PREP(ERDMA_REG_DEV_CTRL_INIT_MASK, 1);
|
||||
erdma_reg_write32(dev, ERDMA_REGS_DEV_CTRL_REG, ctrl);
|
||||
|
||||
for (i = 0; i < ERDMA_WAIT_DEV_DONE_CNT; i++) {
|
||||
sts = erdma_reg_read32_filed(dev, ERDMA_REGS_DEV_ST_REG,
|
||||
ERDMA_REG_DEV_ST_INIT_DONE_MASK);
|
||||
if (sts)
|
||||
break;
|
||||
|
||||
msleep(ERDMA_REG_ACCESS_WAIT_MS);
|
||||
}
|
||||
|
||||
if (i == ERDMA_WAIT_DEV_DONE_CNT) {
|
||||
dev_err(&dev->pdev->dev, "wait init done failed.\n");
|
||||
err = -ETIMEDOUT;
|
||||
goto err_destroy_eq;
|
||||
}
|
||||
|
||||
set_bit(ERDMA_CMDQ_STATE_OK_BIT, &cmdq->state);
|
||||
|
||||
return 0;
|
||||
|
||||
err_destroy_eq:
|
||||
dma_free_coherent(&dev->pdev->dev,
|
||||
(cmdq->eq.depth << EQE_SHIFT) +
|
||||
ERDMA_EXTRA_BUFFER_SIZE,
|
||||
cmdq->eq.qbuf, cmdq->eq.qbuf_dma_addr);
|
||||
|
||||
err_destroy_cq:
|
||||
dma_free_coherent(&dev->pdev->dev,
|
||||
(cmdq->cq.depth << CQE_SHIFT) +
|
||||
@@ -283,7 +257,7 @@ static void *get_next_valid_cmdq_cqe(struct erdma_cmdq *cmdq)
|
||||
__be32 *cqe = get_queue_entry(cmdq->cq.qbuf, cmdq->cq.ci,
|
||||
cmdq->cq.depth, CQE_SHIFT);
|
||||
u32 owner = FIELD_GET(ERDMA_CQE_HDR_OWNER_MASK,
|
||||
__be32_to_cpu(READ_ONCE(*cqe)));
|
||||
be32_to_cpu(READ_ONCE(*cqe)));
|
||||
|
||||
return owner ^ !!(cmdq->cq.ci & cmdq->cq.depth) ? cqe : NULL;
|
||||
}
|
||||
@@ -319,7 +293,6 @@ static int erdma_poll_single_cmd_completion(struct erdma_cmdq *cmdq)
|
||||
__be32 *cqe;
|
||||
u16 ctx_id;
|
||||
u64 *sqe;
|
||||
int i;
|
||||
|
||||
cqe = get_next_valid_cmdq_cqe(cmdq);
|
||||
if (!cqe)
|
||||
@@ -328,8 +301,8 @@ static int erdma_poll_single_cmd_completion(struct erdma_cmdq *cmdq)
|
||||
cmdq->cq.ci++;
|
||||
|
||||
dma_rmb();
|
||||
hdr0 = __be32_to_cpu(*cqe);
|
||||
sqe_idx = __be32_to_cpu(*(cqe + 1));
|
||||
hdr0 = be32_to_cpu(*cqe);
|
||||
sqe_idx = be32_to_cpu(*(cqe + 1));
|
||||
|
||||
sqe = get_queue_entry(cmdq->sq.qbuf, sqe_idx, cmdq->sq.depth,
|
||||
SQEBB_SHIFT);
|
||||
@@ -341,9 +314,8 @@ static int erdma_poll_single_cmd_completion(struct erdma_cmdq *cmdq)
|
||||
comp_wait->cmd_status = ERDMA_CMD_STATUS_FINISHED;
|
||||
comp_wait->comp_status = FIELD_GET(ERDMA_CQE_HDR_SYNDROME_MASK, hdr0);
|
||||
cmdq->sq.ci += cmdq->sq.wqebb_cnt;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
comp_wait->comp_data[i] = __be32_to_cpu(*(cqe + 2 + i));
|
||||
/* Copy 16B comp data after cqe hdr to outer */
|
||||
be32_to_cpu_array(comp_wait->comp_data, cqe + 2, 4);
|
||||
|
||||
if (cmdq->use_event)
|
||||
complete(&comp_wait->wait_event);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user