From: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Christoph Lameter <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Mark Bloch <markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
Steve Wise <swise-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>,
Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
alonvi-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH 1/3] ib core: Make device counter infrastructure dynamic
Date: Wed, 16 Mar 2016 11:47:39 -0400 [thread overview]
Message-ID: <20160316154738.GA26530@phlsvsds.ph.intel.com> (raw)
In-Reply-To: <20160315155455.173645653-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
On Tue, Mar 15, 2016 at 10:54:42AM -0500, Christoph Lameter wrote:
>+static ssize_t show_protocol_stats(struct ib_device *dev, int index,
>+ u8 port, char *buf)
>+{
>+ struct rdma_protocol_stats stats = {0};
>+ ssize_t ret;
>+
>+ ret = dev->get_protocol_stats(dev, &stats, port);
>+ if (ret)
>+ return ret;
>+
>+ return sprintf(buf, "%llu\n", stats.value[index]);
>+}
This works fine when there are few counters, but if there are lots? What
about changing things to include the index in the get_protocol_stats() call
so that we just grab the single item we are looking for?
>+static struct attribute_group *create_protocol_stats(struct ib_device
>*device,
>+ struct kobject *kobj,
>+ u8 port) {
>+ struct attribute_group *ag;
>+ struct rdma_protocol_stats stats = {0};
>+ u32 counters;
>+ u32 i;
>+ int ret;
>+
>+ ret = device->get_protocol_stats(device, &stats, port);
>+
>+ if (ret || !stats.name)
>+ return NULL;
>+
>+ ag = kzalloc(sizeof(*ag), GFP_KERNEL);
>+ if (!ag)
>+ return NULL;
>+
>+ ag->name = stats.dirname;
>+
>+ for (counters = 0; stats.name[counters]; counters++)
>+ ;
>+
>+ BUG_ON(counters > MAX_NR_PROTOCOL_STATS);
Should we really be bringing the machine crashing down here?
-Denny
--
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
next prev parent reply other threads:[~2016-03-16 15:47 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-15 15:54 [PATCH 0/3] Dynamically extendable device counter support Christoph Lameter
2016-03-15 15:54 ` [PATCH 1/3] ib core: Make device counter infrastructure dynamic Christoph Lameter
[not found] ` <20160315155455.173645653-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
2016-03-16 15:47 ` Dennis Dalessandro [this message]
[not found] ` <20160316154738.GA26530-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2016-03-16 17:17 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1603161213560.15010-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-03-16 17:45 ` Dennis Dalessandro
2016-03-17 7:23 ` Leon Romanovsky
[not found] ` <20160317072354.GB25216-2ukJVAZIZ/Y@public.gmane.org>
2016-03-17 8:17 ` Leon Romanovsky
[not found] ` <20160317081716.GD25216-2ukJVAZIZ/Y@public.gmane.org>
2016-03-18 1:57 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1603172057030.18714-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-03-18 6:20 ` Leon Romanovsky
[not found] ` <20160318062009.GI25216-2ukJVAZIZ/Y@public.gmane.org>
2016-03-18 14:33 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1603180932310.25235-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-03-18 15:51 ` Leon Romanovsky
2016-03-18 1:56 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1603172054540.18714-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-03-18 6:16 ` Leon Romanovsky
[not found] ` <20160318061659.GH25216-2ukJVAZIZ/Y@public.gmane.org>
2016-03-18 14:34 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1603180933320.25235-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-03-18 15:42 ` Leon Romanovsky
2016-05-13 19:18 ` Doug Ledford
[not found] ` <057c8ac8-1d34-e7b9-c0ad-91d805c81139-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 13:52 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1605160851370.23895-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-05-16 15:43 ` Doug Ledford
[not found] ` <041c6da0-e022-2bd1-5f00-e569c077e154-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 17:04 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1605161203010.26453-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-05-16 17:27 ` Doug Ledford
[not found] ` <db1bf3dd-20b1-3f2f-eaa3-25e5e8aff35b-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 17:49 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1605161238560.10085-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-05-16 18:01 ` Doug Ledford
[not found] ` <102cd100-55f7-fa85-cd75-ba0db5b9fa34-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-17 14:19 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1605170918080.9956-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-05-17 16:00 ` Doug Ledford
[not found] ` <3e9a3e19-58cb-c25f-89a1-f0e51df562d8-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-17 16:06 ` Steve Wise
2016-05-17 17:00 ` Jason Gunthorpe
[not found] ` <20160517170027.GC19976-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-17 17:34 ` Doug Ledford
[not found] ` <bc83cc75-aa2e-6fc6-e1c6-a0190b972013-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 17:25 ` Jason Gunthorpe
[not found] ` <20160518172542.GA15516-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-18 18:11 ` Doug Ledford
[not found] ` <12e991bc-aa9b-a8b0-3cd4-b56d58a44d60-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 18:17 ` Steve Wise
2016-05-18 19:01 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1605181401030.29313-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-05-18 20:27 ` Steve Wise
2016-05-19 14:34 ` Christoph Lameter
2016-05-19 19:24 ` Doug Ledford
2016-05-18 21:11 ` Jason Gunthorpe
2016-05-16 18:06 ` Jason Gunthorpe
2016-05-16 18:27 ` Steve Wise
2016-03-15 15:54 ` [PATCH 2/3] mlx4: Add support for protocol statistics Christoph Lameter
2016-03-15 15:54 ` [PATCH 3/3] mlx5: Implement new counter infrastructure Christoph Lameter
[not found] ` <20160315155455.397561811-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
2016-05-13 19:18 ` Doug Ledford
[not found] ` <d01d42d9-08a8-968a-97f9-40188301170a-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 13:52 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1605160852260.23895-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-05-16 15:44 ` Doug Ledford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160316154738.GA26530@phlsvsds.ph.intel.com \
--to=dennis.dalessandro-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=alonvi-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=swise-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.