diff mbox series

[net-next,2/5] net sched actions: add new tc_action_ops callback

Message ID 1520028103-14878-3-git-send-email-mrv@mojatatu.com
State Changes Requested, archived
Delegated to: David Miller
Headers show
Series Fix event generation for actions batch Add/Delete mode | expand

Commit Message

Roman Mashak March 2, 2018, 10:01 p.m. UTC
Add a new callback in tc_action_ops, it will be needed by the tc actions
to compute its size when a ADD/DELETE notification message is constructed.
This routine has to take into account optional/variable size TLVs specific
per action.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 include/net/act_api.h | 1 +
 net/sched/act_api.c   | 8 ++++++++
 2 files changed, 9 insertions(+)

Comments

David Miller March 5, 2018, 3 p.m. UTC | #1
From: Roman Mashak <mrv@mojatatu.com>
Date: Fri,  2 Mar 2018 17:01:40 -0500

> diff --git a/net/sched/act_api.c b/net/sched/act_api.c
> index acac92a..6f3307f 100644
> --- a/net/sched/act_api.c
> +++ b/net/sched/act_api.c
> @@ -136,6 +136,14 @@ static size_t tcf_action_full_attrs_size(size_t sz)
>  		+ sz;
>  }
>  
> +static size_t tcf_action_fill_size(const struct tc_action *act)
> +{
> +	if (act->ops->get_fill_size)
> +		return act->ops->get_fill_size(act) +
> +			tcf_action_shared_attrs_size(act);
> +	return 0;
> +}
> +

Again, a static functions with no users generates compiler warnings.
Roman Mashak March 5, 2018, 3:46 p.m. UTC | #2
David Miller <davem@davemloft.net> writes:

> From: Roman Mashak <mrv@mojatatu.com>
> Date: Fri,  2 Mar 2018 17:01:40 -0500
>
>> diff --git a/net/sched/act_api.c b/net/sched/act_api.c
>> index acac92a..6f3307f 100644
>> --- a/net/sched/act_api.c
>> +++ b/net/sched/act_api.c
>> @@ -136,6 +136,14 @@ static size_t tcf_action_full_attrs_size(size_t sz)
>>  		+ sz;
>>  }
>>  
>> +static size_t tcf_action_fill_size(const struct tc_action *act)
>> +{
>> +	if (act->ops->get_fill_size)
>> +		return act->ops->get_fill_size(act) +
>> +			tcf_action_shared_attrs_size(act);
>> +	return 0;
>> +}
>> +
>
> Again, a static functions with no users generates compiler warnings.

Thanks, will fix in v2.
diff mbox series

Patch

diff --git a/include/net/act_api.h b/include/net/act_api.h
index 9c2f226..0a56465 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -97,6 +97,7 @@  struct tc_action_ops {
 			const struct tc_action_ops *,
 			struct netlink_ext_ack *);
 	void	(*stats_update)(struct tc_action *, u64, u32, u64);
+	size_t  (*get_fill_size)(const struct tc_action *act);
 	struct net_device *(*get_dev)(const struct tc_action *a);
 };
 
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index acac92a..6f3307f 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -136,6 +136,14 @@  static size_t tcf_action_full_attrs_size(size_t sz)
 		+ sz;
 }
 
+static size_t tcf_action_fill_size(const struct tc_action *act)
+{
+	if (act->ops->get_fill_size)
+		return act->ops->get_fill_size(act) +
+			tcf_action_shared_attrs_size(act);
+	return 0;
+}
+
 static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
 			   struct netlink_callback *cb)
 {