aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/gen_stats.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-08-16 05:36:49 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-18 00:33:49 -0400
commitc1a8f1f1c8e01eab5862c8db39b49ace814e6c66 (patch)
tree0679f709f70d9a91850888636a28adb79940c402 /net/core/gen_stats.c
parentc6ba973b8fa97422aab4204f7d79f1d413cde925 (diff)
net: restore gnet_stats_basic to previous definition
In 5e140dfc1fe87eae27846f193086724806b33c7d "net: reorder struct Qdisc for better SMP performance" the definition of struct gnet_stats_basic changed incompatibly, as copies of this struct are shipped to userland via netlink. Restoring old behavior is not welcome, for performance reason. Fix is to use a private structure for kernel, and teach gnet_stats_copy_basic() to convert from kernel to user land, using legacy structure (struct gnet_stats_basic) Based on a report and initial patch from Michael Spang. Reported-by: Michael Spang <mspang@csclub.uwaterloo.ca> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/gen_stats.c')
-rw-r--r--net/core/gen_stats.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index c3d0ffeac243..8569310268ab 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -106,16 +106,21 @@ gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock,
106 * if the room in the socket buffer was not sufficient. 106 * if the room in the socket buffer was not sufficient.
107 */ 107 */
108int 108int
109gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic *b) 109gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic_packed *b)
110{ 110{
111 if (d->compat_tc_stats) { 111 if (d->compat_tc_stats) {
112 d->tc_stats.bytes = b->bytes; 112 d->tc_stats.bytes = b->bytes;
113 d->tc_stats.packets = b->packets; 113 d->tc_stats.packets = b->packets;
114 } 114 }
115 115
116 if (d->tail) 116 if (d->tail) {
117 return gnet_stats_copy(d, TCA_STATS_BASIC, b, sizeof(*b)); 117 struct gnet_stats_basic sb;
118 118
119 memset(&sb, 0, sizeof(sb));
120 sb.bytes = b->bytes;
121 sb.packets = b->packets;
122 return gnet_stats_copy(d, TCA_STATS_BASIC, &sb, sizeof(sb));
123 }
119 return 0; 124 return 0;
120} 125}
121 126