Skip to content

Commit 9854518

Browse files
NicolasDichteldavem330
authored andcommitted
sched: align nlattr properly when needed
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b676338 commit 9854518

33 files changed

Lines changed: 72 additions & 37 deletions

‎Documentation/networking/gen_stats.txt‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ my_dumping_routine(struct sk_buff *skb, ...)
3333
{
3434
struct gnet_dump dump;
3535

36-
if (gnet_stats_start_copy(skb, TCA_STATS2, &mystruct->lock, &dump) < 0)
36+
if (gnet_stats_start_copy(skb, TCA_STATS2, &mystruct->lock, &dump,
37+
TCA_PAD) < 0)
3738
goto rtattr_failure;
3839

3940
if (gnet_stats_copy_basic(&dump, &mystruct->bstats) < 0 ||
@@ -56,7 +57,8 @@ existing TLV types.
5657
my_dumping_routine(struct sk_buff *skb, ...)
5758
{
5859
if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS,
59-
TCA_XSTATS, &mystruct->lock, &dump) < 0)
60+
TCA_XSTATS, &mystruct->lock, &dump,
61+
TCA_PAD) < 0)
6062
goto rtattr_failure;
6163
...
6264
}

‎include/net/gen_stats.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ struct gnet_dump {
1919
/* Backward compatibility */
2020
int compat_tc_stats;
2121
int compat_xstats;
22+
int padattr;
2223
void * xstats;
2324
int xstats_len;
2425
struct tc_stats tc_stats;
2526
};
2627

2728
int gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock,
28-
struct gnet_dump *d);
29+
struct gnet_dump *d, int padattr);
2930

3031
int gnet_stats_start_copy_compat(struct sk_buff *skb, int type,
3132
int tc_stats_type, int xstats_type,
32-
spinlock_t *lock, struct gnet_dump *d);
33+
spinlock_t *lock, struct gnet_dump *d,
34+
int padattr);
3335

3436
int gnet_stats_copy_basic(struct gnet_dump *d,
3537
struct gnet_stats_basic_cpu __percpu *cpu,

‎include/uapi/linux/gen_stats.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ enum {
1010
TCA_STATS_QUEUE,
1111
TCA_STATS_APP,
1212
TCA_STATS_RATE_EST64,
13+
TCA_STATS_PAD,
1314
__TCA_STATS_MAX,
1415
};
1516
#define TCA_STATS_MAX (__TCA_STATS_MAX - 1)

‎include/uapi/linux/pkt_cls.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ enum {
6666
TCA_ACT_OPTIONS,
6767
TCA_ACT_INDEX,
6868
TCA_ACT_STATS,
69+
TCA_ACT_PAD,
6970
__TCA_ACT_MAX
7071
};
7172

@@ -173,6 +174,7 @@ enum {
173174
TCA_U32_PCNT,
174175
TCA_U32_MARK,
175176
TCA_U32_FLAGS,
177+
TCA_U32_PAD,
176178
__TCA_U32_MAX
177179
};
178180

‎include/uapi/linux/rtnetlink.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ enum {
542542
TCA_FCNT,
543543
TCA_STATS2,
544544
TCA_STAB,
545+
TCA_PAD,
545546
__TCA_MAX
546547
};
547548

‎include/uapi/linux/tc_act/tc_bpf.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ enum {
2626
TCA_ACT_BPF_OPS,
2727
TCA_ACT_BPF_FD,
2828
TCA_ACT_BPF_NAME,
29+
TCA_ACT_BPF_PAD,
2930
__TCA_ACT_BPF_MAX,
3031
};
3132
#define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1)

‎include/uapi/linux/tc_act/tc_connmark.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ enum {
1515
TCA_CONNMARK_UNSPEC,
1616
TCA_CONNMARK_PARMS,
1717
TCA_CONNMARK_TM,
18+
TCA_CONNMARK_PAD,
1819
__TCA_CONNMARK_MAX
1920
};
2021
#define TCA_CONNMARK_MAX (__TCA_CONNMARK_MAX - 1)

‎include/uapi/linux/tc_act/tc_csum.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ enum {
1010
TCA_CSUM_UNSPEC,
1111
TCA_CSUM_PARMS,
1212
TCA_CSUM_TM,
13+
TCA_CSUM_PAD,
1314
__TCA_CSUM_MAX
1415
};
1516
#define TCA_CSUM_MAX (__TCA_CSUM_MAX - 1)

‎include/uapi/linux/tc_act/tc_defact.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ enum {
1212
TCA_DEF_TM,
1313
TCA_DEF_PARMS,
1414
TCA_DEF_DATA,
15+
TCA_DEF_PAD,
1516
__TCA_DEF_MAX
1617
};
1718
#define TCA_DEF_MAX (__TCA_DEF_MAX - 1)

‎include/uapi/linux/tc_act/tc_gact.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ enum {
2525
TCA_GACT_TM,
2626
TCA_GACT_PARMS,
2727
TCA_GACT_PROB,
28+
TCA_GACT_PAD,
2829
__TCA_GACT_MAX
2930
};
3031
#define TCA_GACT_MAX (__TCA_GACT_MAX - 1)

0 commit comments

Comments
 (0)