Netdev List
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] net_sched: add 64bit rate estimators
Date: Wed, 5 Jun 2013 19:55:31 +0100	[thread overview]
Message-ID: <1370458531.1918.3.camel@bwh-desktop.uk.level5networks.com> (raw)
In-Reply-To: <1370408447.24311.241.camel@edumazet-glaptop>

On Tue, 2013-06-04 at 22:00 -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> struct gnet_stats_rate_est contains u32 fields, so the byte per second
> field can wrap at 34360Mbit.
> 
> Add a new gnet_stats_rate_est64 structure to get 64bit bps field, and
> switch the kernel to use this structure natively.
[...] 
>  /**
> + * struct gnet_stats_rate_est64 - rate estimator
> + * @bps: current byte rate
> + * @pps: current packet rate
> + */
> +struct gnet_stats_rate_est64 {
> +	__u64	bps;
> +	__u32	pps;
> +} __attribute__ ((packed));
[...]

Using attribute packed (which should be written as __packed) forces the
alignment of each member and the structure as a whole to be 1.  For an
architecture where unaligned access is expensive, gcc will make all
reads and writes use byte operations.

I think you have to add a dummy __u32 member instead.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

  reply	other threads:[~2013-06-05 18:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05  5:00 [PATCH net-next] net_sched: add 64bit rate estimators Eric Dumazet
2013-06-05 18:55 ` Ben Hutchings [this message]
2013-06-05 19:37   ` Eric Dumazet
2013-06-05 20:06     ` Ben Hutchings
2013-06-05 23:07       ` Eric Dumazet
2013-06-06  8:39   ` David Laight
2013-06-06 15:43 ` [PATCH v2 " Eric Dumazet
2013-06-11  9:51   ` David Miller

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=1370458531.1918.3.camel@bwh-desktop.uk.level5networks.com \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.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