From: David Miller <davem@davemloft.net>
To: shemminger@vyatta.com
Cc: dm@chelsio.com, netdev@vger.kernel.org
Subject: Re: [PATCH 4/7] cxgb4: Add packet queues and packet DMA code
Date: Sat, 27 Feb 2010 01:46:18 -0800 (PST) [thread overview]
Message-ID: <20100227.014618.193735140.davem@davemloft.net> (raw)
In-Reply-To: <20100226155756.09c0485c@nehalam>
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Fri, 26 Feb 2010 15:57:56 -0800
> On Fri, 26 Feb 2010 15:35:36 -0800
> Dimitris Michailidis <dm@chelsio.com> wrote:
>
>> +
>> +/**
>> + * need_skb_unmap - does the platform need unmapping of sk_buffs?
>> + *
>> + * Returns true if the platfrom needs sk_buff unmapping. The compiler
>> + * optimizes away unecessary code if this returns true.
>> + */
>> +static inline int need_skb_unmap(void)
>> +{
>> + /*
>> + * This structure is used to tell if the platfrom needs buffer
>> + * unmapping by checking if DECLARE_PCI_UNMAP_ADDR defines anything.
>> + */
>> + struct dummy {
>> + DECLARE_PCI_UNMAP_ADDR(addr);
>> + };
>> +
>> + return sizeof(struct dummy) != 0;
>> +}
>> +
>
> I would prefer one code path and let the compiler decide if unmap
> should be nop; rather than this kind of trick code.
Agreed, this is rediculious. And there is currently no platform that
matters where this will trigger.
With IOMMUs and even the swiommu layer, even bog standard x86 systems
need the unmap addresses.
Therefore optimizing this is totally unreasonable. Just use the provided
APIs and let the compiler and the platform defines do the work.
I'm amazed at how people do stuff like this. If it's a reasonable
opimization, maybe, JUST MAYBE, it's better to optimize it generically
so that every driver gets the benefit NOT JUST YOUR individual driver.
next prev parent reply other threads:[~2010-02-27 9:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-26 23:35 [PATCH 0/7] cxgb4: driver submission V3 Dimitris Michailidis
2010-02-26 23:35 ` [PATCH 1/7] cxgb4: Add register and message definitions Dimitris Michailidis
2010-02-26 23:35 ` [PATCH 2/7] cxgb4: Add FW API definitions Dimitris Michailidis
2010-02-26 23:35 ` [PATCH 3/7] cxgb4: Add HW and FW support code Dimitris Michailidis
2010-02-26 23:35 ` [PATCH 4/7] cxgb4: Add packet queues and packet DMA code Dimitris Michailidis
2010-02-26 23:35 ` [PATCH 5/7] cxgb4: Add remaining driver headers and L2T management Dimitris Michailidis
2010-02-26 23:35 ` [PATCH 6/7] cxgb4: Add main driver file and driver Makefile Dimitris Michailidis
2010-02-26 23:35 ` [PATCH 7/7] net: Hook up cxgb4 to Kconfig and Makefile Dimitris Michailidis
2010-02-26 23:57 ` [PATCH 4/7] cxgb4: Add packet queues and packet DMA code Stephen Hemminger
2010-02-27 9:46 ` David Miller [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-02-27 0:10 Dimitrios Michailidis
2010-02-27 0:16 ` Stephen Hemminger
2010-02-27 9:48 ` David Miller
2010-02-27 22:41 ` Dimitris Michailidis
2010-02-27 0:52 Dimitrios Michailidis
2010-02-27 1:31 ` Stephen Hemminger
2010-02-27 1:42 Dimitrios Michailidis
2010-02-28 16:09 [PATCH 0/7] cxgb4: driver submission V4 Dimitris Michailidis
2010-02-28 16:09 ` [PATCH 1/7] cxgb4: Add register and message definitions Dimitris Michailidis
2010-02-28 16:09 ` [PATCH 2/7] cxgb4: Add FW API definitions Dimitris Michailidis
2010-02-28 16:09 ` [PATCH 3/7] cxgb4: Add HW and FW support code Dimitris Michailidis
2010-02-28 16:09 ` [PATCH 4/7] cxgb4: Add packet queues and packet DMA code Dimitris Michailidis
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=20100227.014618.193735140.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=dm@chelsio.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.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).