Skip to content

Commit 34db8ec

Browse files
hgao656rleon
authored andcommitted
RDMA/bnxt_re: Fix to export port num to ib_query_qp
Current driver implementation doesn't populate the port_num field in query_qp. Adding the code to convert internal firmware port id to ibv defined port number and export it. Reviewed-by: Saravanan Vajravel <[email protected]> Reviewed-by: Kalesh AP <[email protected]> Signed-off-by: Hongguang Gao <[email protected]> Signed-off-by: Selvin Xavier <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent da2132e commit 34db8ec

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

drivers/infiniband/hw/bnxt_re/ib_verbs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,6 +2325,7 @@ int bnxt_re_query_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
23252325
qp_attr->retry_cnt = qplib_qp->retry_cnt;
23262326
qp_attr->rnr_retry = qplib_qp->rnr_retry;
23272327
qp_attr->min_rnr_timer = qplib_qp->min_rnr_timer;
2328+
qp_attr->port_num = __to_ib_port_num(qplib_qp->port_id);
23282329
qp_attr->rq_psn = qplib_qp->rq.psn;
23292330
qp_attr->max_rd_atomic = qplib_qp->max_rd_atomic;
23302331
qp_attr->sq_psn = qplib_qp->sq.psn;

drivers/infiniband/hw/bnxt_re/ib_verbs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ void bnxt_re_dealloc_ucontext(struct ib_ucontext *context);
268268
int bnxt_re_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
269269
void bnxt_re_mmap_free(struct rdma_user_mmap_entry *rdma_entry);
270270

271+
static inline u32 __to_ib_port_num(u16 port_id)
272+
{
273+
return (u32)port_id + 1;
274+
}
271275

272276
unsigned long bnxt_re_lock_cqs(struct bnxt_re_qp *qp);
273277
void bnxt_re_unlock_cqs(struct bnxt_re_qp *qp, unsigned long flags);

drivers/infiniband/hw/bnxt_re/qplib_fp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,6 +1532,7 @@ int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
15321532
qp->dest_qpn = le32_to_cpu(sb->dest_qp_id);
15331533
memcpy(qp->smac, sb->src_mac, 6);
15341534
qp->vlan_id = le16_to_cpu(sb->vlan_pcp_vlan_dei_vlan_id);
1535+
qp->port_id = le16_to_cpu(sb->port_id);
15351536
bail:
15361537
dma_free_coherent(&rcfw->pdev->dev, sbuf.size,
15371538
sbuf.sb, sbuf.dma_addr);

drivers/infiniband/hw/bnxt_re/qplib_fp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ struct bnxt_qplib_qp {
298298
u32 dest_qpn;
299299
u8 smac[6];
300300
u16 vlan_id;
301+
u16 port_id;
301302
u8 nw_type;
302303
struct bnxt_qplib_ah ah;
303304

0 commit comments

Comments
 (0)