[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211004181115.GF2515663@nvidia.com>
Date: Mon, 4 Oct 2021 15:11:15 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Leon Romanovsky <leon@...nel.org>
Cc: Doug Ledford <dledford@...hat.com>,
Leon Romanovsky <leonro@...dia.com>,
Aharon Landau <aharonl@...dia.com>,
Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
Gal Pressman <galpress@...zon.com>,
Jakub Kicinski <kuba@...nel.org>, linux-rdma@...r.kernel.org,
Maor Gottlieb <maorg@...dia.com>,
Mark Zhang <markzhang@...dia.com>,
Mike Marciniszyn <mike.marciniszyn@...nelisnetworks.com>,
Mustafa Ismail <mustafa.ismail@...el.com>,
Naresh Kumar PBS <nareshkumar.pbs@...adcom.com>,
Neta Ostrovsky <netao@...dia.com>, netdev@...r.kernel.org,
Potnuri Bharat Teja <bharat@...lsio.com>,
Saeed Mahameed <saeedm@...dia.com>,
Selvin Xavier <selvin.xavier@...adcom.com>,
Shiraz Saleem <shiraz.saleem@...el.com>,
Yishai Hadas <yishaih@...dia.com>,
Zhu Yanjun <zyjzyj2000@...il.com>
Subject: Re: [PATCH rdma-next v2 00/13] Optional counter statistics support
On Thu, Sep 30, 2021 at 11:02:16AM +0300, Leon Romanovsky wrote:
> v2:
> * Add rdma_free_hw_stats_struct() helper API (with a new patch)
> * In sysfs add a WARN_ON to check if optional stats are always at the end
> * Add a new nldev command to get the counter status
> * Improve nldev_stat_set_counter_dynamic_doit() by creating a
> target state bitmap
Other than still having different get behavior it looks mostly Ok
Please mind some of the wonky formatting clang-format-diff will give a
clue where to look, I got this list:
diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index adbddb07b08ed9..a7f9fe234a9e93 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -1910,13 +1910,13 @@ static int nldev_stat_set_counter_dynamic_doit(struct nlattr *tb[],
if (!stats)
return -EINVAL;
- target = kcalloc(BITS_TO_LONGS(stats->num_counters),
- sizeof(long), GFP_KERNEL);
+ target = kcalloc(BITS_TO_LONGS(stats->num_counters), sizeof(long),
+ GFP_KERNEL);
if (!target)
return -ENOMEM;
- nla_for_each_nested(entry_attr,
- tb[RDMA_NLDEV_ATTR_STAT_HWCOUNTERS], rem) {
+ nla_for_each_nested (entry_attr, tb[RDMA_NLDEV_ATTR_STAT_HWCOUNTERS],
+ rem) {
index = nla_get_u32(entry_attr);
if ((index >= stats->num_counters) ||
!(stats->descs[index].flags & IB_STAT_FLAG_OPTIONAL)) {
@@ -1959,10 +1959,9 @@ static int nldev_stat_set_mode_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
if (!msg)
return -ENOMEM;
- nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
- RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
- RDMA_NLDEV_CMD_STAT_SET),
- 0, 0);
+ nlh = nlmsg_put(
+ msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
+ RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_STAT_SET), 0, 0);
mode = nla_get_u32(tb[RDMA_NLDEV_ATTR_STAT_MODE]);
if (mode == RDMA_COUNTER_MODE_AUTO) {
@@ -2052,8 +2051,8 @@ static int nldev_stat_del_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
u32 index, port, qpn, cntn;
int ret;
- ret = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1,
- nldev_policy, extack);
+ ret = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, nldev_policy,
+ extack);
if (ret || !tb[RDMA_NLDEV_ATTR_STAT_RES] ||
!tb[RDMA_NLDEV_ATTR_DEV_INDEX] || !tb[RDMA_NLDEV_ATTR_PORT_INDEX] ||
!tb[RDMA_NLDEV_ATTR_STAT_COUNTER_ID] ||
@@ -2079,10 +2078,9 @@ static int nldev_stat_del_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
ret = -ENOMEM;
goto err;
}
- nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
- RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
- RDMA_NLDEV_CMD_STAT_SET),
- 0, 0);
+ nlh = nlmsg_put(
+ msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
+ RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_STAT_SET), 0, 0);
cntn = nla_get_u32(tb[RDMA_NLDEV_ATTR_STAT_COUNTER_ID]);
qpn = nla_get_u32(tb[RDMA_NLDEV_ATTR_RES_LQPN]);
@@ -2109,8 +2107,7 @@ static int nldev_stat_del_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
return ret;
}
-static int stat_get_doit_stats_list(struct sk_buff *skb,
- struct nlmsghdr *nlh,
+static int stat_get_doit_stats_list(struct sk_buff *skb, struct nlmsghdr *nlh,
struct netlink_ext_ack *extack,
struct nlattr *tb[],
struct ib_device *device, u32 port,
diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
index 35d818b38e7780..e5919bd9a25106 100644
--- a/drivers/infiniband/hw/efa/efa_verbs.c
+++ b/drivers/infiniband/hw/efa/efa_verbs.c
@@ -60,8 +60,7 @@ struct efa_user_mmap_entry {
op(EFA_RDMA_READ_RESP_BYTES, "rdma_read_resp_bytes") \
#define EFA_STATS_ENUM(ename, name) ename,
-#define EFA_STATS_STR(ename, nam) \
- [ename].name = nam,
+#define EFA_STATS_STR(ename, nam) [ename].name = nam,
enum efa_hw_device_stats {
EFA_DEFINE_DEVICE_STATS(EFA_STATS_ENUM)
diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c
index 09354f1257a947..ed9fa0d84e9ed3 100644
--- a/drivers/infiniband/hw/hfi1/verbs.c
+++ b/drivers/infiniband/hw/hfi1/verbs.c
@@ -1614,10 +1614,8 @@ static int cntr_names_initialized;
* strings. Optionally some entries can be reserved in the array to hold extra
* external strings.
*/
-static int init_cntr_names(const char *names_in,
- const size_t names_len,
- int num_extra_names,
- int *num_cntrs,
+static int init_cntr_names(const char *names_in, const size_t names_len,
+ int num_extra_names, int *num_cntrs,
struct rdma_stat_desc **cntr_descs)
{
struct rdma_stat_desc *q;
diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index fd4dfb43006b54..38742e233915f9 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2152,9 +2152,7 @@ static int mlx4_ib_get_hw_stats(struct ib_device *ibdev,
static int __mlx4_ib_alloc_diag_counters(struct mlx4_ib_dev *ibdev,
struct rdma_stat_desc **pdescs,
- u32 **offset,
- u32 *num,
- bool port)
+ u32 **offset, u32 *num, bool port)
{
u32 num_counters;
@@ -2186,8 +2184,7 @@ static int __mlx4_ib_alloc_diag_counters(struct mlx4_ib_dev *ibdev,
static void mlx4_ib_fill_diag_counters(struct mlx4_ib_dev *ibdev,
struct rdma_stat_desc *descs,
- u32 *offset,
- bool port)
+ u32 *offset, bool port)
{
int i;
int j;
diff --git a/drivers/infiniband/hw/mlx5/counters.c b/drivers/infiniband/hw/mlx5/counters.c
index 206c190d0ce4f9..f72dffd2f42c03 100644
--- a/drivers/infiniband/hw/mlx5/counters.c
+++ b/drivers/infiniband/hw/mlx5/counters.c
@@ -478,10 +478,8 @@ static int mlx5_ib_counter_unbind_qp(struct ib_qp *qp)
return mlx5_ib_qp_set_counter(qp, NULL);
}
-
static void mlx5_ib_fill_counters(struct mlx5_ib_dev *dev,
- struct rdma_stat_desc *descs,
- size_t *offsets)
+ struct rdma_stat_desc *descs, size_t *offsets)
{
int i;
int j = 0;
@@ -34,7 +34,7 @@ int rxe_ib_get_hw_stats(struct ib_device *ibdev,
if (!port || !stats)
return -EINVAL;
- for (cnt = 0; cnt < ARRAY_SIZE(rxe_counter_descs); cnt++)
+ for (cnt = 0; cnt < ARRAY_SIZE(rxe_counter_descs); cnt++)
stats->value[cnt] = atomic64_read(&dev->stats_counters[cnt]);
return ARRAY_SIZE(rxe_counter_descs);
Powered by blists - more mailing lists