Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9854518e authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller
Browse files

sched: align nlattr properly when needed

parent b676338f
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -33,7 +33,8 @@ my_dumping_routine(struct sk_buff *skb, ...)
{
{
	struct gnet_dump dump;
	struct gnet_dump dump;


	if (gnet_stats_start_copy(skb, TCA_STATS2, &mystruct->lock, &dump) < 0)
	if (gnet_stats_start_copy(skb, TCA_STATS2, &mystruct->lock, &dump,
				  TCA_PAD) < 0)
		goto rtattr_failure;
		goto rtattr_failure;


	if (gnet_stats_copy_basic(&dump, &mystruct->bstats) < 0 ||
	if (gnet_stats_copy_basic(&dump, &mystruct->bstats) < 0 ||
@@ -56,7 +57,8 @@ existing TLV types.
my_dumping_routine(struct sk_buff *skb, ...)
my_dumping_routine(struct sk_buff *skb, ...)
{
{
    if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS,
    if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS,
		TCA_XSTATS, &mystruct->lock, &dump) < 0)
				     TCA_XSTATS, &mystruct->lock, &dump,
				     TCA_PAD) < 0)
		goto rtattr_failure;
		goto rtattr_failure;
	...
	...
}
}
+4 −2
Original line number Original line Diff line number Diff line
@@ -19,17 +19,19 @@ struct gnet_dump {
	/* Backward compatibility */
	/* Backward compatibility */
	int               compat_tc_stats;
	int               compat_tc_stats;
	int               compat_xstats;
	int               compat_xstats;
	int               padattr;
	void *            xstats;
	void *            xstats;
	int               xstats_len;
	int               xstats_len;
	struct tc_stats   tc_stats;
	struct tc_stats   tc_stats;
};
};


int gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock,
int gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock,
			  struct gnet_dump *d);
			  struct gnet_dump *d, int padattr);


int gnet_stats_start_copy_compat(struct sk_buff *skb, int type,
int gnet_stats_start_copy_compat(struct sk_buff *skb, int type,
				 int tc_stats_type, int xstats_type,
				 int tc_stats_type, int xstats_type,
				 spinlock_t *lock, struct gnet_dump *d);
				 spinlock_t *lock, struct gnet_dump *d,
				 int padattr);


int gnet_stats_copy_basic(struct gnet_dump *d,
int gnet_stats_copy_basic(struct gnet_dump *d,
			  struct gnet_stats_basic_cpu __percpu *cpu,
			  struct gnet_stats_basic_cpu __percpu *cpu,
+1 −0
Original line number Original line Diff line number Diff line
@@ -10,6 +10,7 @@ enum {
	TCA_STATS_QUEUE,
	TCA_STATS_QUEUE,
	TCA_STATS_APP,
	TCA_STATS_APP,
	TCA_STATS_RATE_EST64,
	TCA_STATS_RATE_EST64,
	TCA_STATS_PAD,
	__TCA_STATS_MAX,
	__TCA_STATS_MAX,
};
};
#define TCA_STATS_MAX (__TCA_STATS_MAX - 1)
#define TCA_STATS_MAX (__TCA_STATS_MAX - 1)
+2 −0
Original line number Original line Diff line number Diff line
@@ -66,6 +66,7 @@ enum {
	TCA_ACT_OPTIONS,
	TCA_ACT_OPTIONS,
	TCA_ACT_INDEX,
	TCA_ACT_INDEX,
	TCA_ACT_STATS,
	TCA_ACT_STATS,
	TCA_ACT_PAD,
	__TCA_ACT_MAX
	__TCA_ACT_MAX
};
};


@@ -173,6 +174,7 @@ enum {
	TCA_U32_PCNT,
	TCA_U32_PCNT,
	TCA_U32_MARK,
	TCA_U32_MARK,
	TCA_U32_FLAGS,
	TCA_U32_FLAGS,
	TCA_U32_PAD,
	__TCA_U32_MAX
	__TCA_U32_MAX
};
};


+1 −0
Original line number Original line Diff line number Diff line
@@ -542,6 +542,7 @@ enum {
	TCA_FCNT,
	TCA_FCNT,
	TCA_STATS2,
	TCA_STATS2,
	TCA_STAB,
	TCA_STAB,
	TCA_PAD,
	__TCA_MAX
	__TCA_MAX
};
};


Loading