* [PATCH rdma-rc] RDMA/counter: Prevent QP counter binding if counters unsupported
@ 2019-08-07 10:18 Leon Romanovsky
2019-08-07 20:45 ` Doug Ledford
0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2019-08-07 10:18 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Mark Zhang, RDMA mailing list, Parav Pandit, Leon Romanovsky
From: Mark Zhang <markz@mellanox.com>
In case of rdma_counter_init() fails, counter allocation and QP bind
should not be allowed.
Fixes: 413d3347503b ("RDMA/counter: Add set/clear per-port auto mode support")
Fixes: 1bd8e0a9d0fd ("RDMA/counter: Allow manual mode configuration support")
Signed-off-by: Mark Zhang <markz@mellanox.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/core/counters.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/infiniband/core/counters.c b/drivers/infiniband/core/counters.c
index 45d5164e9574..b79890739a2c 100644
--- a/drivers/infiniband/core/counters.c
+++ b/drivers/infiniband/core/counters.c
@@ -38,6 +38,9 @@ int rdma_counter_set_auto_mode(struct ib_device *dev, u8 port,
int ret;
port_counter = &dev->port_data[port].port_counter;
+ if (!port_counter->hstats)
+ return -EOPNOTSUPP;
+
mutex_lock(&port_counter->lock);
if (on) {
ret = __counter_set_mode(&port_counter->mode,
@@ -509,6 +512,9 @@ int rdma_counter_bind_qpn_alloc(struct ib_device *dev, u8 port,
if (!rdma_is_port_valid(dev, port))
return -EINVAL;
+ if (!dev->port_data[port].port_counter.hstats)
+ return -EOPNOTSUPP;
+
qp = rdma_counter_get_qp(dev, qp_num);
if (!qp)
return -ENOENT;
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH rdma-rc] RDMA/counter: Prevent QP counter binding if counters unsupported
2019-08-07 10:18 [PATCH rdma-rc] RDMA/counter: Prevent QP counter binding if counters unsupported Leon Romanovsky
@ 2019-08-07 20:45 ` Doug Ledford
0 siblings, 0 replies; 2+ messages in thread
From: Doug Ledford @ 2019-08-07 20:45 UTC (permalink / raw)
To: Leon Romanovsky, Jason Gunthorpe
Cc: Mark Zhang, RDMA mailing list, Parav Pandit, Leon Romanovsky
[-- Attachment #1: Type: text/plain, Size: 719 bytes --]
On Wed, 2019-08-07 at 13:18 +0300, Leon Romanovsky wrote:
> From: Mark Zhang <markz@mellanox.com>
>
> In case of rdma_counter_init() fails, counter allocation and QP bind
> should not be allowed.
>
> Fixes: 413d3347503b ("RDMA/counter: Add set/clear per-port auto mode
> support")
> Fixes: 1bd8e0a9d0fd ("RDMA/counter: Allow manual mode configuration
> support")
> Signed-off-by: Mark Zhang <markz@mellanox.com>
> Reviewed-by: Parav Pandit <parav@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Looks good, applied to for-rc, thanks.
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: B826A3330E572FDD
Fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-07 20:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07 10:18 [PATCH rdma-rc] RDMA/counter: Prevent QP counter binding if counters unsupported Leon Romanovsky
2019-08-07 20:45 ` Doug Ledford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).