* ocrdma merged to my next branch
@ 2012-04-24 23:49 Roland Dreier
[not found] ` <1335311385-11381-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Roland Dreier @ 2012-04-24 23:49 UTC (permalink / raw)
To: Parav Pandit, linux-rdma-u79uwXL29TY76Z2rM5mHXA
From: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
So I pulled in the Emulex ocrdma driver with the intention of merging
for 3.5. I took the chance to add a few simple patches that fix minor
problems with the driver; please let me know if you see any problems
with any of the changes I made.
By the way, the way that the driver endian swaps structures in place
makes it nearly impossible to use sparse for endian checking; it would
probably be better to use leXX_to_cpu / cpu_to_leXX accessors
explicitly and then have a chance of the driver working on big-endian.
Roland Dreier (4):
RDMA/ocrdma: Fix warnings about uninitialized variables
RDMA/ocrdma: Make needlessly global functions/structs static
RDMA/ocrdma: Set event's device member in ocrdma_dispatch_ibevent()
RDMA/ocrdma: Remove write-only variables
drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 24 ++++++++++++------------
drivers/infiniband/hw/ocrdma/ocrdma_main.c | 6 +++---
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 11 +++--------
3 files changed, 18 insertions(+), 23 deletions(-)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] RDMA/ocrdma: Fix warnings about uninitialized variables
[not found] ` <1335311385-11381-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2012-04-24 23:49 ` Roland Dreier
2012-04-24 23:49 ` [PATCH 2/4] RDMA/ocrdma: Make needlessly global functions/structs static Roland Dreier
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Roland Dreier @ 2012-04-24 23:49 UTC (permalink / raw)
To: Parav Pandit, linux-rdma-u79uwXL29TY76Z2rM5mHXA
From: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
First, fix
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c: In function 'ocrdma_alloc_pd':
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:371:17: warning: 'dpp_page_addr' may be used uninitialized in this function [-Wuninitialized]
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:337:6: note: 'dpp_page_addr' was declared here
which seems that it may border on a bug (the call to ocrdma_del_mmap()
might conceivably do bad things if pd->dpp_enabled is not set and
dpp_page_addr ends up with just the wrong value).
Also take care of:
drivers/infiniband/hw/ocrdma/ocrdma_hw.c: In function 'ocrdma_init_hw':
drivers/infiniband/hw/ocrdma/ocrdma_hw.c:2587:5: warning: 'status' may be used uninitialized in this function [-Wuninitialized]
drivers/infiniband/hw/ocrdma/ocrdma_hw.c:2549:17: note: 'status' was declared here
which is only real if num_eq == 0, which should be impossible.
Signed-off-by: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
---
drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 2 +-
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index c53545f..025c4a9 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -2546,7 +2546,7 @@ static int ocrdma_create_mq_eq(struct ocrdma_dev *dev)
static int ocrdma_create_qp_eqs(struct ocrdma_dev *dev)
{
- int num_eq, i, status;
+ int num_eq, i, status = 0;
int irq;
unsigned long flags = 0;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 51fc9c7..e955f1f 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -334,7 +334,7 @@ static int ocrdma_copy_pd_uresp(struct ocrdma_pd *pd,
{
int status;
u64 db_page_addr;
- u64 dpp_page_addr;
+ u64 dpp_page_addr = 0;
u32 db_page_size;
struct ocrdma_alloc_pd_uresp rsp;
struct ocrdma_ucontext *uctx = get_ocrdma_ucontext(ib_ctx);
@@ -368,7 +368,8 @@ static int ocrdma_copy_pd_uresp(struct ocrdma_pd *pd,
return 0;
ucopy_err:
- ocrdma_del_mmap(pd->uctx, dpp_page_addr, OCRDMA_DPP_PAGE_SIZE);
+ if (pd->dpp_enabled)
+ ocrdma_del_mmap(pd->uctx, dpp_page_addr, OCRDMA_DPP_PAGE_SIZE);
dpp_map_err:
ocrdma_del_mmap(pd->uctx, db_page_addr, db_page_size);
return status;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] RDMA/ocrdma: Make needlessly global functions/structs static
[not found] ` <1335311385-11381-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2012-04-24 23:49 ` [PATCH 1/4] RDMA/ocrdma: Fix warnings about uninitialized variables Roland Dreier
@ 2012-04-24 23:49 ` Roland Dreier
2012-04-24 23:49 ` [PATCH 3/4] RDMA/ocrdma: Set event's device member in ocrdma_dispatch_ibevent() Roland Dreier
2012-04-24 23:49 ` [PATCH 4/4] RDMA/ocrdma: Remove write-only variables Roland Dreier
3 siblings, 0 replies; 5+ messages in thread
From: Roland Dreier @ 2012-04-24 23:49 UTC (permalink / raw)
To: Parav Pandit, linux-rdma-u79uwXL29TY76Z2rM5mHXA
From: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
Signed-off-by: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
---
drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 12 ++++++------
drivers/infiniband/hw/ocrdma/ocrdma_main.c | 6 +++---
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 025c4a9..00a460e 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -159,7 +159,7 @@ enum ib_qp_state get_ibqp_state(enum ocrdma_qp_state qps)
return IB_QPS_ERR;
}
-enum ocrdma_qp_state get_ocrdma_qp_state(enum ib_qp_state qps)
+static enum ocrdma_qp_state get_ocrdma_qp_state(enum ib_qp_state qps)
{
switch (qps) {
case IB_QPS_RESET:
@@ -384,8 +384,8 @@ static void ocrdma_free_eq_vect_gen2(struct ocrdma_dev *dev)
dev->nic_info.msix.start_vector -= 1;
}
-int ocrdma_mbx_delete_q(struct ocrdma_dev *dev, struct ocrdma_queue_info *q,
- int queue_type)
+static int ocrdma_mbx_delete_q(struct ocrdma_dev *dev, struct ocrdma_queue_info *q,
+ int queue_type)
{
u8 opcode = 0;
int status;
@@ -516,9 +516,9 @@ static void ocrdma_destroy_qp_eqs(struct ocrdma_dev *dev)
ocrdma_destroy_eq(dev, &dev->qp_eq_tbl[i]);
}
-int ocrdma_mbx_mq_cq_create(struct ocrdma_dev *dev,
- struct ocrdma_queue_info *cq,
- struct ocrdma_queue_info *eq)
+static int ocrdma_mbx_mq_cq_create(struct ocrdma_dev *dev,
+ struct ocrdma_queue_info *cq,
+ struct ocrdma_queue_info *eq)
{
struct ocrdma_create_cq_cmd *cmd = dev->mbx_cmd;
struct ocrdma_create_cq_cmd_rsp *rsp = dev->mbx_cmd;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index 8aa3416..cee201e 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -58,7 +58,7 @@ static struct notifier_block ocrdma_inet6addr_notifier = {
.notifier_call = ocrdma_inet6addr_event
};
-int ocrdma_get_instance(void)
+static int ocrdma_get_instance(void)
{
int instance = 0;
@@ -265,7 +265,7 @@ static enum rdma_link_layer ocrdma_link_layer(struct ib_device *device,
return IB_LINK_LAYER_ETHERNET;
}
-int ocrdma_register_device(struct ocrdma_dev *dev)
+static int ocrdma_register_device(struct ocrdma_dev *dev)
{
strlcpy(dev->ibdev.name, "ocrdma%d", IB_DEVICE_NAME_MAX);
ocrdma_get_guid(dev, (u8 *)&dev->ibdev.node_guid);
@@ -528,7 +528,7 @@ static void ocrdma_event_handler(struct ocrdma_dev *dev, u32 event)
};
}
-struct ocrdma_driver ocrdma_drv = {
+static struct ocrdma_driver ocrdma_drv = {
.name = "ocrdma_driver",
.add = ocrdma_add,
.remove = ocrdma_remove,
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] RDMA/ocrdma: Set event's device member in ocrdma_dispatch_ibevent()
[not found] ` <1335311385-11381-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2012-04-24 23:49 ` [PATCH 1/4] RDMA/ocrdma: Fix warnings about uninitialized variables Roland Dreier
2012-04-24 23:49 ` [PATCH 2/4] RDMA/ocrdma: Make needlessly global functions/structs static Roland Dreier
@ 2012-04-24 23:49 ` Roland Dreier
2012-04-24 23:49 ` [PATCH 4/4] RDMA/ocrdma: Remove write-only variables Roland Dreier
3 siblings, 0 replies; 5+ messages in thread
From: Roland Dreier @ 2012-04-24 23:49 UTC (permalink / raw)
To: Parav Pandit, linux-rdma-u79uwXL29TY76Z2rM5mHXA
From: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
We need to set ib_evt.device, or else ib_dispatch_event() will crash
when we call it for unaffiliated events (and consumers may get
confused in their QP/CQ/SRQ event handler for affiliated events).
Also fix sparse warning:
drivers/infiniband/hw/ocrdma/ocrdma_hw.c:678:36: warning: Using plain integer as NULL pointer
There's no need to clear ib_evt, since every member is initialized.
Signed-off-by: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
---
drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 00a460e..5af30f1 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -675,7 +675,7 @@ static void ocrdma_dispatch_ibevent(struct ocrdma_dev *dev,
{
struct ocrdma_qp *qp = NULL;
struct ocrdma_cq *cq = NULL;
- struct ib_event ib_evt = { 0 };
+ struct ib_event ib_evt;
int cq_event = 0;
int qp_event = 1;
int srq_event = 0;
@@ -688,6 +688,8 @@ static void ocrdma_dispatch_ibevent(struct ocrdma_dev *dev,
if (cqe->cqvalid_cqid & OCRDMA_AE_MCQE_CQVALID)
cq = dev->cq_tbl[cqe->cqvalid_cqid & OCRDMA_AE_MCQE_CQID_MASK];
+ ib_evt.device = &dev->ibdev;
+
switch (type) {
case OCRDMA_CQ_ERROR:
ib_evt.element.cq = &cq->ibcq;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] RDMA/ocrdma: Remove write-only variables
[not found] ` <1335311385-11381-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
` (2 preceding siblings ...)
2012-04-24 23:49 ` [PATCH 3/4] RDMA/ocrdma: Set event's device member in ocrdma_dispatch_ibevent() Roland Dreier
@ 2012-04-24 23:49 ` Roland Dreier
3 siblings, 0 replies; 5+ messages in thread
From: Roland Dreier @ 2012-04-24 23:49 UTC (permalink / raw)
To: Parav Pandit, linux-rdma-u79uwXL29TY76Z2rM5mHXA
From: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
Signed-off-by: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
---
drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 6 ++----
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ------
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 5af30f1..9b204b1 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -2293,7 +2293,6 @@ int ocrdma_mbx_modify_qp(struct ocrdma_dev *dev, struct ocrdma_qp *qp,
{
int status = -ENOMEM;
struct ocrdma_modify_qp *cmd;
- struct ocrdma_modify_qp_rsp *rsp;
cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_MODIFY_QP, sizeof(*cmd));
if (!cmd)
@@ -2317,7 +2316,7 @@ int ocrdma_mbx_modify_qp(struct ocrdma_dev *dev, struct ocrdma_qp *qp,
status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd);
if (status)
goto mbx_err;
- rsp = (struct ocrdma_modify_qp_rsp *)cmd;
+
mbx_err:
kfree(cmd);
return status;
@@ -2327,7 +2326,6 @@ int ocrdma_mbx_destroy_qp(struct ocrdma_dev *dev, struct ocrdma_qp *qp)
{
int status = -ENOMEM;
struct ocrdma_destroy_qp *cmd;
- struct ocrdma_destroy_qp_rsp *rsp;
struct pci_dev *pdev = dev->nic_info.pdev;
cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_DELETE_QP, sizeof(*cmd));
@@ -2337,7 +2335,7 @@ int ocrdma_mbx_destroy_qp(struct ocrdma_dev *dev, struct ocrdma_qp *qp)
status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd);
if (status)
goto mbx_err;
- rsp = (struct ocrdma_destroy_qp_rsp *)cmd;
+
mbx_err:
kfree(cmd);
if (qp->sq.va)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index e955f1f..eb55c80 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -625,12 +625,10 @@ struct ib_mr *ocrdma_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 len,
struct ocrdma_dev *dev;
struct ocrdma_mr *mr;
struct ocrdma_pd *pd;
- struct pci_dev *pdev;
u32 num_pbes;
pd = get_ocrdma_pd(ibpd);
dev = pd->dev;
- pdev = dev->nic_info.pdev;
if (acc & IB_ACCESS_REMOTE_WRITE && !(acc & IB_ACCESS_LOCAL_WRITE))
return ERR_PTR(-EINVAL);
@@ -1596,10 +1594,8 @@ int ocrdma_modify_srq(struct ib_srq *ibsrq,
{
int status = 0;
struct ocrdma_srq *srq;
- struct ocrdma_dev *dev;
srq = get_ocrdma_srq(ibsrq);
- dev = srq->dev;
if (srq_attr_mask & IB_SRQ_MAX_WR)
status = -EINVAL;
else
@@ -1611,10 +1607,8 @@ int ocrdma_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr)
{
int status;
struct ocrdma_srq *srq;
- struct ocrdma_dev *dev;
srq = get_ocrdma_srq(ibsrq);
- dev = srq->dev;
status = ocrdma_mbx_query_srq(srq, srq_attr);
return status;
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-04-24 23:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-24 23:49 ocrdma merged to my next branch Roland Dreier
[not found] ` <1335311385-11381-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2012-04-24 23:49 ` [PATCH 1/4] RDMA/ocrdma: Fix warnings about uninitialized variables Roland Dreier
2012-04-24 23:49 ` [PATCH 2/4] RDMA/ocrdma: Make needlessly global functions/structs static Roland Dreier
2012-04-24 23:49 ` [PATCH 3/4] RDMA/ocrdma: Set event's device member in ocrdma_dispatch_ibevent() Roland Dreier
2012-04-24 23:49 ` [PATCH 4/4] RDMA/ocrdma: Remove write-only variables Roland Dreier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox