All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: "Elior, Ariel" <Ariel.Elior-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
Cc: "dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
	<dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"Kalderon,
	Michal" <Michal.Kalderon-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>,
	"Mintz,
	Yuval" <Yuval.Mintz-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>,
	"Borundia,
	Rajesh" <Rajesh.Borundia-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Amrani,
	Ram" <Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH qedr 04/10] qedr: Add support for PD,PKEY and CQ verbs
Date: Fri, 7 Oct 2016 17:24:54 +0300	[thread overview]
Message-ID: <20161007142454.GU9282@leon.nu> (raw)
In-Reply-To: <CY1PR0701MB1337AC7B933E917765C3EBC990C60-UpKza+2NMNLi6bjPjkn3FE5OhdzP3rhOnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2577 bytes --]

On Fri, Oct 07, 2016 at 10:47:18AM +0000, Elior, Ariel wrote:
> > > @@ -66,6 +85,12 @@ struct rdma_cqe_common {
> > >     struct regpair qp_handle;
> > >     __le16 reserved1[7];
> > >     u8 flags;
> > > +#define RDMA_CQE_COMMON_TOGGLE_BIT_MASK  0x1
> > > +#define RDMA_CQE_COMMON_TOGGLE_BIT_SHIFT 0
> > > +#define RDMA_CQE_COMMON_TYPE_MASK        0x3
> > > +#define RDMA_CQE_COMMON_TYPE_SHIFT       1
> > > +#define RDMA_CQE_COMMON_RESERVED2_MASK   0x1F
> > > +#define RDMA_CQE_COMMON_RESERVED2_SHIFT  3
> > >     u8 status;
> >
> > It is VERY uncommon to mix defines and structs together.
> > Please don't do it, it confuses a lot and doesn't help to
> > readability/debug.
>
> Hi Leon,
> Firstly, thanks for investing your time in reviewing our driver.
> As for mixed defines and structures, far from being very uncommon, they are
> actually ubiquitous throughout the kernel and are used by the foremost
> developers (Dave Miller, Linus, Jeff Kirsher).

Net subsystem is very different from other kernel community.
For example, this article from LWN [1] - "Coding-style exceptionalism"
talks about it.

>
> In infiniband tree alone, at least three drivers employ this:
> drivers/infiniband/hw/ocrdma/ocrdma_sli.h line 1900
> drivers/infiniband/hw/mthca/mthca_user.h line 68
> drivers/infiniband/hw/cxgb3/cxio_hal.h line 116

All of them are copy-paste from pre-historic era.

>
> In the net subsystem, it is even more widely used (~14k places), including
> mellanox and intel drivers, as well as our bnx2x and qed* drivers and many
> others. A few examples can be seen under:
> drivers/net/ethernet/mellanox/mlx4/en_port.h line 94
> drivers/net/ethernet/mellanox/mlx4/mlx4_en.h line 345
> drivers/net/ethernet/mellanox/mlx4/fw.c line 2759

Thanks for pointing it.
We will fix it.

> drivers/net/ethernet/intel/ixgbe/ixgbe.h line 623 (Jeff Kirsher)
> drivers/net/ethernet/broadcom/tg3.h line 2540 (Dave Miller)
> ixgbe.h uses this exactly like we do in the code you cited.
>
> In other kernel cornerstones:
> fs/ext4/ext4.h line 1287 (Linus)

1. From git blame, this define was added in 2010 !!!!
2. It has totally different meaning from your code - to mark the
position in the structure.

> include/net/sock.h line 312 (Dave)

Net is a bad example.

>
> I don't think there are grounds for objecting to this style. We'll take care
> of the rest of your comments.

As you wish, at the end it will be Doug's decision, if he wants to see
driver submitted in 2016 in different coding style from rest of the subsystem.

[1] https://lwn.net/Articles/694755/

>
> Thanks,
> Ariel

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-10-07 14:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-05 15:47 [PATCH qedr 00/10] QLogic RDMA Driver (qedr) Ram Amrani
     [not found] ` <1475682483-9878-1-git-send-email-Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2016-10-05 15:47   ` [PATCH qedr 01/10] qedr: Add RoCE driver framework Ram Amrani
2016-10-05 15:47   ` [PATCH qedr 02/10] qedr: Add support for RoCE HW init Ram Amrani
2016-10-05 15:47   ` [PATCH qedr 03/10] qedr: Add support for user context verbs Ram Amrani
2016-10-05 15:47   ` [PATCH qedr 04/10] qedr: Add support for PD,PKEY and CQ verbs Ram Amrani
     [not found]     ` <1475682483-9878-5-git-send-email-Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2016-10-06 13:33       ` Leon Romanovsky
     [not found]         ` <20161006133357.GP9282-2ukJVAZIZ/Y@public.gmane.org>
2016-10-06 18:34           ` Amrani, Ram
2016-10-07 10:47           ` Elior, Ariel
     [not found]             ` <CY1PR0701MB1337AC7B933E917765C3EBC990C60-UpKza+2NMNLi6bjPjkn3FE5OhdzP3rhOnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2016-10-07 14:24               ` Leon Romanovsky [this message]
     [not found]                 ` <20161007142454.GU9282-2ukJVAZIZ/Y@public.gmane.org>
2016-10-08 13:35                   ` Doug Ledford
     [not found]                     ` <a146f562-1970-e939-1bd5-074af868f7d6-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-10-08 15:39                       ` Leon Romanovsky
     [not found]                         ` <20161008153942.GY9282-2ukJVAZIZ/Y@public.gmane.org>
2016-10-08 23:20                           ` Elior, Ariel
2016-10-10  6:34           ` Amrani, Ram
     [not found]             ` <SN1PR07MB22070099EE40A67B81D14C75F8DB0-mikhvbZlbf8TSoR2DauN2+FPX92sqiQdvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-10-10  7:24               ` Leon Romanovsky
2016-10-05 15:47   ` [PATCH qedr 05/10] qedr: Add support for QP verbs Ram Amrani
     [not found]     ` <1475682483-9878-6-git-send-email-Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2016-10-09  6:27       ` Leon Romanovsky
2016-10-05 15:47   ` [PATCH qedr 06/10] qedr: Add support for memory registeration verbs Ram Amrani
2016-10-05 15:48   ` [PATCH qedr 07/10] qedr: Add support for data path Ram Amrani
2016-10-05 15:48   ` [PATCH qedr 08/10] qedr: Add LL2 RoCE interface Ram Amrani
2016-10-05 15:48   ` [PATCH qedr 09/10] qedr: Add GSI support Ram Amrani
2016-10-05 15:48   ` [PATCH qedr 10/10] qedr: Add events support and register IB device Ram Amrani

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=20161007142454.GU9282@leon.nu \
    --to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=Ariel.Elior-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
    --cc=Michal.Kalderon-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
    --cc=Rajesh.Borundia-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
    --cc=Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
    --cc=Yuval.Mintz-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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.