From: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
To: ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
Cc: roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
eli-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org,
moshel-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH for/net-next 1/8] net/mlx5: Mellanox Connect-IB, core driver part 1/3
Date: Fri, 28 Jun 2013 21:03:29 -0700 (PDT) [thread overview]
Message-ID: <20130628.210329.240918119199058100.davem@davemloft.net> (raw)
In-Reply-To: <1372256537-21328-2-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
From: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Date: Wed, 26 Jun 2013 17:22:10 +0300
> + buf->direct.buf = dma_alloc_coherent(&dev->pdev->dev,
> + size, &t, GFP_KERNEL);
...
> + memset(buf->direct.buf, 0, size);
This sequence is "dma_zalloc_coherent()", please use it.
> + i = find_first_bit(pgdir->bitmap, MLX5_DB_PER_PAGE);
> + if (i >= MLX5_DB_PER_PAGE)
> + return -ENOMEM;
> +
> + clear_bit(i, pgdir->bitmap);
You have other synchronizations protecting this bitmap, so you don't
need to use the atomic clear_bit(), please use __clear_bit() instead.
> +
> + set_bit(db->index, db->u.pgdir->bitmap);
Likewise, use __set_bit().
> + u8 own;
> + unsigned long poll_end = jiffies + msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC + 1000);
I know it sounds silly, but order local variable declarations from longest
to shortest line, it looks a lot nicer.
> +static int verify_signature(struct mlx5_cmd_work_ent *ent)
> +{
> + int err;
> + u8 sig;
> + struct mlx5_cmd_mailbox *next = ent->out->next;
Likewise.
> +static void dump_buf(void *buf, int size, int data_only, int offset)
> +{
> + int i;
> + __be32 *p = buf;
Likewise. Please go over all of this new driver and take care of this,
thanks.
> +static const char *status_to_str(u8 status)
> +{
> + switch (status) {
> + case 0:
> + return "no errors";
Please add defines for these status codes rather than using magic
constants.
> + for (i = 0; i < n; ++i) {
"i++", rather than "++i" is canonical in this situations, please.
> + for (i = 0; i < (1 << cmd->log_sz); ++i) {
Likewise. Please fix this up in all of this driver's code.
> + /*
> + * for cached lists, we must explicitly state what is
> + * the real size
> + */
Comments in the networking are to be formatted:
/* Like
* this.
*/
and not:
/*
* Like
* this.
*/
Please take care of this in the entire driver, thanks.
> +ex_err:
> + list_for_each_entry_safe(msg, n, &cmd->cache.large.head, list) {
> + list_del(&msg->list);
> + mlx5_free_cmd_msg(dev, msg);
> + }
> +
> + list_for_each_entry_safe(msg, n, &cmd->cache.med.head, list) {
> + list_del(&msg->list);
> + mlx5_free_cmd_msg(dev, msg);
> + }
> +
> + return err;
This cleanup code is duplicated...
> +static void destroy_msg_cache(struct mlx5_core_dev *dev)
Here.
Simply declare destroy_msg_cache() earlier and call it, instead
of duplicating all of it's code.
> +static const char *cmd_status_str(u8 status)
> +{
> + switch (status) {
> + case 0x0: return "OK";
Again, make readable defines for these status values, rather than using magic
constants.
> + switch (hdr->status) {
> + case 0x0: return 0;
> + case 0x1: return -EIO;
Likewise.
I also question how useful all of these debugfs facilities are after initial
development. They take up memory even if they are never used.
--
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:[~2013-06-29 4:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-26 14:22 [PATCH for/net-next 0/8] Add Mellanox mlx5 driver for Connect-IB devices Or Gerlitz
2013-06-26 14:22 ` [PATCH for/net-next 1/8] net/mlx5: Mellanox Connect-IB, core driver part 1/3 Or Gerlitz
[not found] ` <1372256537-21328-2-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-06-29 4:03 ` David Miller [this message]
2013-06-26 14:22 ` [PATCH for/net-next 4/8] IB/mlx5: Mellanox Connect-IB, IB driver part 1/5 Or Gerlitz
2013-06-26 14:22 ` [PATCH for/net-next 5/8] IB/mlx5: Mellanox Connect-IB, IB driver part 2/5 Or Gerlitz
2013-06-26 14:22 ` [PATCH for/net-next 6/8] IB/mlx5: Mellanox Connect-IB, IB driver part 3/5 Or Gerlitz
[not found] ` <1372256537-21328-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-06-26 14:22 ` [PATCH for/net-next 2/8] net/mlx5: Mellanox Connect-IB, core driver part 2/3 Or Gerlitz
[not found] ` <1372256537-21328-3-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-06-29 4:08 ` David Miller
2013-06-26 14:22 ` [PATCH for/net-next 3/8] net/mlx5: Mellanox Connect-IB, core driver part 3/3 Or Gerlitz
2013-06-29 4:10 ` David Miller
[not found] ` <20130628.211041.256072234719301298.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2013-07-01 11:44 ` Jack Morgenstein
[not found] ` <201307011444.55361.jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2013-07-01 19:17 ` David Miller
2013-07-01 19:18 ` David Miller
2013-07-02 8:06 ` Jack Morgenstein
2013-06-26 14:22 ` [PATCH for/net-next 7/8] IB/mlx5: Mellanox Connect-IB, IB driver part 4/5 Or Gerlitz
2013-06-26 14:22 ` [PATCH for/net-next 8/8] IB/mlx5: Mellanox Connect-IB, IB driver part 5/5 Or Gerlitz
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=20130628.210329.240918119199058100.davem@davemloft.net \
--to=davem-ft/pcqaiutieiz0/mpfg9q@public.gmane.org \
--cc=eli-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
--cc=eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=moshel-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=roland-DgEjT+Ai2ygdnm+yROfE0A@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 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).