From 413d3347503bc39e17577eaf16451fd492a68558 Mon Sep 17 00:00:00 2001 From: Mark Zhang Date: Tue, 2 Jul 2019 13:02:34 +0300 Subject: RDMA/counter: Add set/clear per-port auto mode support Add an API to support set/clear per-port auto mode. Signed-off-by: Mark Zhang Reviewed-by: Majd Dibbiny Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe --- include/rdma/ib_verbs.h | 2 ++ include/rdma/rdma_counter.h | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'include/rdma') diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 26e9c2594913..3d19c056fbc0 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -2119,6 +2120,7 @@ struct ib_port_data { spinlock_t netdev_lock; struct net_device __rcu *netdev; struct hlist_node ndev_hash_link; + struct rdma_port_counter port_counter; }; /* rdma netdev type - specifies protocol type */ diff --git a/include/rdma/rdma_counter.h b/include/rdma/rdma_counter.h index 283ac1a0cdb7..8dd2619c015d 100644 --- a/include/rdma/rdma_counter.h +++ b/include/rdma/rdma_counter.h @@ -6,8 +6,26 @@ #ifndef _RDMA_COUNTER_H_ #define _RDMA_COUNTER_H_ +#include + #include #include +#include + +struct auto_mode_param { + int qp_type; +}; + +struct rdma_counter_mode { + enum rdma_nl_counter_mode mode; + enum rdma_nl_counter_mask mask; + struct auto_mode_param param; +}; + +struct rdma_port_counter { + struct rdma_counter_mode mode; + struct mutex lock; +}; struct rdma_counter { struct rdma_restrack_entry res; @@ -15,4 +33,10 @@ struct rdma_counter { uint32_t id; u8 port; }; + +void rdma_counter_init(struct ib_device *dev); +void rdma_counter_release(struct ib_device *dev); +int rdma_counter_set_auto_mode(struct ib_device *dev, u8 port, + bool on, enum rdma_nl_counter_mask mask); + #endif /* _RDMA_COUNTER_H_ */ -- cgit v1.2.3-55-g7522