From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: David Miller <davem@davemloft.net>
Cc: jwi@linux.vnet.ibm.com, netdev@vger.kernel.org,
linux-s390@vger.kernel.org, heiko.carstens@de.ibm.com,
raspl@linux.vnet.ibm.com, ubraun@linux.vnet.ibm.com
Subject: Re: [PATCH net-next 3/4] s390/diag: add diag26c support
Date: Mon, 19 Jun 2017 17:34:25 +0200 [thread overview]
Message-ID: <20170619173425.4d537667@mschwideX1> (raw)
In-Reply-To: <20170619.104726.1778743929564587843.davem@davemloft.net>
Hi Dave,
On Mon, 19 Jun 2017 10:47:26 -0400 (EDT)
David Miller <davem@davemloft.net> wrote:
> From: Julian Wiedmann <jwi@linux.vnet.ibm.com>
> Date: Mon, 19 Jun 2017 13:22:24 +0200
>
> > +#define DIAG26C_GET_MAC 0x0000
> > +struct diag26c_mac_req {
> > + u32 resp_buf_len;
> > + u32 resp_version;
> > + u16 op_code;
> > + u16 devno;
> > + u8 res[4];
> > +} __packed;
>
> The packed attribute is not necessary here, the structure will be
> perfectly packed together because of the types used and the order of
> the members.
We (as in the s390 guys) tend to add __packed to hardware and hypervisor
structures even if the attribute is not strictly necessary. Most of the
diagnose related structures look that way. Dunno if it is worth to change
them.
I agree that __packed should be avoided for software defined structures.
> __packed is to be used only in the last possible resort for
> correctness and every effort whatsoever should be used to avoid using
> it.
>
> > +
> > +struct diag26c_mac_resp {
> > + u32 version;
> > + u8 mac[ETH_ALEN];
> > + u16 res;
> > +} __packed __aligned(8);
>
> Using packed with an 8 byte alignment is even more unnecessary.
>
> Again, it is not needed, so please don't use it.
The diag26c struct needs to be aligned on a doubleword boundary, the
__aligned(8) is necessary. The __packed attribute is again superfluous but
follows along the lines of the other diag structures.
I do not mind the extra __packed attributes, but if you care about them
we could remove them from the structures in diag.h.
> > + */
> > +static inline int __diag26c(void *req, void *resp, enum diag26c_sc subcode)
>
> Do not mark functions inline in *.c files, let the compiler decide.
>
Here I disagree. Basically all of our functions with assembly code are
static inline, it is a common pattern even in C files. Sometimes the compiler
*is* stupid and won't inline a function. And on s390 function calls do not
come for free.
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
next prev parent reply other threads:[~2017-06-19 15:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-19 11:22 [PATCH net-next 0/4] s390/net updates, part 2 Julian Wiedmann
2017-06-19 11:22 ` [PATCH net-next 1/4] s390/qeth: add ipa return codes for bridgeport Julian Wiedmann
2017-06-19 11:22 ` [PATCH net-next 2/4] s390/qeth: fix packing buffer statistics Julian Wiedmann
2017-06-19 11:22 ` [PATCH net-next 3/4] s390/diag: add diag26c support Julian Wiedmann
2017-06-19 14:47 ` David Miller
2017-06-19 15:34 ` Martin Schwidefsky [this message]
2017-06-19 17:37 ` David Miller
2017-06-21 15:30 ` Martin Schwidefsky
2017-06-19 11:22 ` [PATCH net-next 4/4] s390/qeth: use diag26c to get MAC address on L2 Julian Wiedmann
2017-06-19 14:48 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2017-06-20 14:00 [PATCH net-next 0/4] s390/net updates, part 2 (v2) Julian Wiedmann
2017-06-20 14:00 ` [PATCH net-next 3/4] s390/diag: add diag26c support Julian Wiedmann
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=20170619173425.4d537667@mschwideX1 \
--to=schwidefsky@de.ibm.com \
--cc=davem@davemloft.net \
--cc=heiko.carstens@de.ibm.com \
--cc=jwi@linux.vnet.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=raspl@linux.vnet.ibm.com \
--cc=ubraun@linux.vnet.ibm.com \
/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).