Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1320743
| From | Eric Dumazet <eric.dumazet@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH net 0/4] net: add rx_unhandled stat counter |
| Date | 2016-01-28 15:50 +0100 |
| Message-ID | <qVW3v-4OQ-9@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <qVFvI-1dk-27@gated-at.bofh.it> <qVNWh-7D7-11@gated-at.bofh.it> <qVO5X-7IF-1@gated-at.bofh.it> <qVUuK-3R3-17@gated-at.bofh.it> <qVVTR-4Lm-47@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 2016-01-28 at 09:38 -0500, Jarod Wilson wrote:
> Something like this then:
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 82334c6..2ca3eab 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -7262,15 +7262,16 @@ void netdev_run_todo(void)
> void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
> const struct net_device_stats *netdev_stats)
> {
> + memset(stats64, 0, sizeof(*stats64));
> #if BITS_PER_LONG == 64
> - BUILD_BUG_ON(sizeof(*stats64) != sizeof(*netdev_stats));
> + BUILD_BUG_ON(sizeof(*stats64) < sizeof(*netdev_stats));
> memcpy(stats64, netdev_stats, sizeof(*stats64));
> #else
> size_t i, n = sizeof(*stats64) / sizeof(u64);
> const unsigned long *src = (const unsigned long *)netdev_stats;
> u64 *dst = (u64 *)stats64;
>
> - BUILD_BUG_ON(sizeof(*netdev_stats) / sizeof(unsigned long) !=
> + BUILD_BUG_ON(sizeof(*netdev_stats) / sizeof(unsigned long) >
> sizeof(*stats64) / sizeof(u64));
> for (i = 0; i < n; i++)
> dst[i] = src[i];
>
> Compiles locally w/o that net_device_stats addition, seems sane to me.
>
Sure, you also can set stats64->rx_unhandled to 0 here, just to be 100%
safe.
Thanks.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH net 0/4] net: add rx_unhandled stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-28 07:10 +0100
Re: [PATCH net 0/4] net: add rx_unhandled stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-28 07:20 +0100
Re: [PATCH net 0/4] net: add rx_unhandled stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-28 14:10 +0100
Re: [PATCH net 0/4] net: add rx_unhandled stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-28 15:40 +0100
Re: [PATCH net 0/4] net: add rx_unhandled stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-28 15:50 +0100
Re: [PATCH net 0/4] net: add rx_unhandled stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-28 15:50 +0100
Re: [PATCH net 0/4] net: add rx_unhandled stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-28 16:20 +0100
Re: [PATCH net 0/4] net: add rx_unhandled stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-28 15:50 +0100
Re: [PATCH net 0/4] net: add rx_unhandled stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-28 07:20 +0100
Re: [PATCH net 0/4] net: add rx_unhandled stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-28 14:10 +0100
csiph-web