net: introduce nla_put_bitfield32() helper and use it
Introduce a helper to pass value and selector to. The helper packs them into struct and puts them into netlink message. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
acc086bfb9
commit
8953b0770f
@@ -349,10 +349,6 @@ static int red_dump_offload_stats(struct Qdisc *sch)
|
||||
static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
|
||||
{
|
||||
struct red_sched_data *q = qdisc_priv(sch);
|
||||
struct nla_bitfield32 flags_bf = {
|
||||
.selector = red_supported_flags,
|
||||
.value = q->flags,
|
||||
};
|
||||
struct nlattr *opts = NULL;
|
||||
struct tc_red_qopt opt = {
|
||||
.limit = q->limit,
|
||||
@@ -375,7 +371,8 @@ static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
|
||||
goto nla_put_failure;
|
||||
if (nla_put(skb, TCA_RED_PARMS, sizeof(opt), &opt) ||
|
||||
nla_put_u32(skb, TCA_RED_MAX_P, q->parms.max_P) ||
|
||||
nla_put(skb, TCA_RED_FLAGS, sizeof(flags_bf), &flags_bf))
|
||||
nla_put_bitfield32(skb, TCA_RED_FLAGS,
|
||||
q->flags, red_supported_flags))
|
||||
goto nla_put_failure;
|
||||
return nla_nest_end(skb, opts);
|
||||
|
||||
|
Reference in New Issue
Block a user