netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Eran Ben Elisha <eranbe@mellanox.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Jiri Pirko <jiri@mellanox.com>,
	"David S. Miller" <davem@davemloft.net>,
	Ariel Almog <ariela@mellanox.com>, Aya Levin <ayal@mellanox.com>,
	Moshe Shemesh <moshe@mellanox.com>
Subject: Re: [PATCH net-next v2 01/11] devlink: Add health buffer support
Date: Sun, 20 Jan 2019 12:08:50 +0100	[thread overview]
Message-ID: <20190120110850.GD2730@nanopsycho> (raw)
In-Reply-To: <8c2185c4-ebb4-8fb2-a8ca-e523cd267f7b@mellanox.com>

Sun, Jan 20, 2019 at 12:06:18PM CET, eranbe@mellanox.com wrote:
>
>
>On 1/20/2019 12:03 PM, Jiri Pirko wrote:
>> Thu, Jan 17, 2019 at 10:59:10PM CET, eranbe@mellanox.com wrote:
>> 
>> [...]
>> 
>>> +static void
>>> +devlink_health_buffers_destroy(struct devlink_health_buffer **buffers_list,
>>> +			       u64 size);
>> 
>> Avoid fwd declarations.
>> 
>> 
>>> +
>>> +static struct devlink_health_buffer **
>>> +devlink_health_buffers_create(u64 size)
>>> +{
>>> +	struct devlink_health_buffer **buffers_list;
>>> +	u64 num_of_buffers = DEVLINK_HEALTH_SIZE_TO_BUFFERS(size);
>>> +	u64 i;
>>> +
>>> +	buffers_list = kcalloc(num_of_buffers,
>>> +			       sizeof(struct devlink_health_buffer *),
>>> +			       GFP_KERNEL);
>>> +	if (!buffers_list)
>>> +		return NULL;
>>> +
>>> +	for (i = 0; i < num_of_buffers; i++) {
>>> +		struct devlink_health_buffer *buffer;
>>> +		void *data;
>>> +
>>> +		buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
>>> +		data = kzalloc(DEVLINK_HEALTH_BUFFER_SIZE, GFP_KERNEL);
>>> +		if (!buffer || !data) {
>>> +			kfree(buffer);
>>> +			kfree(data);
>>> +			goto buffers_cleanup;
>>> +		}
>>> +		buffers_list[i] = buffer;
>>> +		buffer->data = data;
>>> +	}
>>> +	devlink_health_buffers_reset(buffers_list, num_of_buffers);
>>> +
>>> +	return buffers_list;
>>> +
>>> +buffers_cleanup:
>>> +	devlink_health_buffers_destroy(buffers_list, --i);
>> 
>> Just do for-kfree here.
>> 
>> 
>>> +	kfree(buffers_list);
>>> +	return NULL;
>>> +}
>>> +
>>> +static void
>>> +devlink_health_buffers_destroy(struct devlink_health_buffer **buffers_list,
>>> +			       u64 num_of_buffers)
>>> +{
>>> +	u64 i;
>>> +
>>> +	for (i = 0; i < num_of_buffers; i++) {
>>> +		kfree(buffers_list[i]->data);
>>> +		kfree(buffers_list[i]);
>>> +	}
>>> +}
>>> +
>> 
>> [...]
>> 
>
>Hi Jiri,
>The series is merged. I can take the relevant comments as send as fix 
>with the rest of the series if you wish to.

I haven't have time to review this due to travel. I think it was mistake
to merge this as the buffer api is wrong in my opinion. I would vote for
revert if possible.

  reply	other threads:[~2019-01-20 11:17 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 21:59 [PATCH net-next v2 00/11] Devlink health reporting and recovery system Eran Ben Elisha
2019-01-17 21:59 ` [PATCH net-next v2 01/11] devlink: Add health buffer support Eran Ben Elisha
2019-01-20 10:03   ` Jiri Pirko
2019-01-20 11:06     ` Eran Ben Elisha
2019-01-20 11:08       ` Jiri Pirko [this message]
2019-01-20 18:45         ` David Miller
2019-01-21 11:07           ` Eran Ben Elisha
2019-01-21 12:08             ` Jiri Pirko
2019-01-20 11:20   ` Jiri Pirko
2019-01-17 21:59 ` [PATCH net-next v2 02/11] devlink: Add health reporter create/destroy functionality Eran Ben Elisha
2019-01-20 11:49   ` Jiri Pirko
2019-01-17 21:59 ` [PATCH net-next v2 03/11] devlink: Add health report functionality Eran Ben Elisha
2019-01-20 11:27   ` Jiri Pirko
2019-01-21 11:12     ` Eran Ben Elisha
2019-01-17 21:59 ` [PATCH net-next v2 04/11] devlink: Add health get command Eran Ben Elisha
2019-01-20 11:31   ` Jiri Pirko
2019-01-17 21:59 ` [PATCH net-next v2 05/11] devlink: Add health set command Eran Ben Elisha
2019-01-20 11:32   ` Jiri Pirko
2019-01-17 21:59 ` [PATCH net-next v2 06/11] devlink: Add health recover command Eran Ben Elisha
2019-01-20 11:33   ` Jiri Pirko
2019-01-17 21:59 ` [PATCH net-next v2 07/11] devlink: Add health diagnose command Eran Ben Elisha
2019-01-20 11:38   ` Jiri Pirko
2019-01-17 21:59 ` [PATCH net-next v2 08/11] devlink: Add health dump {get,clear} commands Eran Ben Elisha
2019-01-17 21:59 ` [PATCH net-next v2 09/11] net/mlx5e: Add TX reporter support Eran Ben Elisha
2019-01-20 11:06   ` Jiri Pirko
2019-01-21 11:32     ` Eran Ben Elisha
2019-01-21 12:11       ` Jiri Pirko
2019-01-21 13:06         ` Eran Ben Elisha
2019-01-21 13:45           ` Jiri Pirko
2019-01-17 21:59 ` [PATCH net-next v2 10/11] net/mlx5e: Add TX timeout support for mlx5e TX reporter Eran Ben Elisha
2019-01-17 21:59 ` [PATCH net-next v2 11/11] devlink: Add Documentation/networking/devlink-health.txt Eran Ben Elisha
2019-01-18 22:59 ` [PATCH net-next v2 00/11] Devlink health reporting and recovery system David Miller
2019-01-20  9:27 ` [PATCH iproute2-next v2] devlink: Add health command support Aya Levin
2019-01-23  3:37   ` David Ahern
2019-01-23 11:27     ` Aya Levin
2019-01-24  0:27       ` David Ahern

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=20190120110850.GD2730@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=ariela@mellanox.com \
    --cc=ayal@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=eranbe@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=moshe@mellanox.com \
    --cc=netdev@vger.kernel.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 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).