[PATCH v3 10/11] net: sched: atomically check-allocate action

2018-05-27 Thread Vlad Buslov
that removes temporary error pointer from idr. (in case of error between idr allocation and insertion of newly created action to specified index) Refactor all action init functions to insert new action to idr using this API. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- Changes from V1

[PATCH v3 08/11] net: sched: don't release reference on action overwrite

2018-05-27 Thread Vlad Buslov
before returning successfully, in order to protect from concurrent deletion. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- Changes from V1 to V2: - Resplit action lookup/release code to prevent memory leaks in individual patches. - Change convoluted commit message. net/sched/act

[PATCH v3 06/11] net: sched: add 'delete' function to action ops

2018-05-27 Thread Vlad Buslov
in action idr. This implementation prevents concurrent threads from deleting same action twice. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- Changes from V1 to V2: - Merge action ops delete definition and implementation. include/net/act_api.h | 1 + net/sched/act_bpf.c

[PATCH v3 09/11] net: sched: use reference counting action init

2018-05-27 Thread Vlad Buslov
user must always hold reference to it. Implement helper put list function to atomically release list of actions after action API init code is done using them. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- Changes from V1 to V2: - Resplit action lookup/release code to prevent memory

[PATCH v3 11/11] net: sched: change action API to use array of pointers to actions

2018-05-27 Thread Vlad Buslov
of actions, so it can be safely refactored into plain pointer array. Refactor action API to use array of pointers to tc_actions instead of linked list. Change argument 'actions' type of exported action init, destroy and dump functions. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- inclu

[PATCH v3 02/11] net: sched: change type of reference and bind counters

2018-05-27 Thread Vlad Buslov
Change type of action reference counter to refcount_t. Change type of action bind counter to atomic_t. This type is used to allow decrementing bind counter without testing for 0 result. Signed-off-by: Vlad Buslov <vla...@mellanox.com> Signed-off-by: Jiri Pirko <j...@mellanox.com>

[PATCH v3 04/11] net: sched: always take reference to action

2018-05-27 Thread Vlad Buslov
to userspace using existing tca_get_fill function arguments. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- Changes from V1 to V2: - Make __tcf_idr_check function static - Merge changes that take reference to action when performing lookup and changes that account for this additional referenc

[PATCH v3 00/11] Modify action API for implementing lockless actions

2018-05-27 Thread Vlad Buslov
ntrusive linked list. - Expand cover letter. Vlad Buslov (11): net: sched: use rcu for action cookie update net: sched: change type of reference and bind counters net: sched: implement unlocked action init API net: sched: always take reference to action net: sched: implement action API that del

[PATCH v3 05/11] net: sched: implement action API that deletes action by index

2018-05-27 Thread Vlad Buslov
Implement new action API function that atomically finds and deletes action from idr by index. Intended to be used by lockless actions that do not rely on rtnl lock. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- Changes from V1 to V2: - Rename tcf_idr_find_delete to tcf_idr_delete

[PATCH v3 01/11] net: sched: use rcu for action cookie update

2018-05-27 Thread Vlad Buslov
Implement functions to atomically update and free action cookie using rcu mechanism. Signed-off-by: Vlad Buslov <vla...@mellanox.com> Signed-off-by: Jiri Pirko <j...@mellanox.com> --- include/net/act_api.h | 2 +- include/net/pkt_cls.h | 1 + net/sched/act_

[PATCH v3 03/11] net: sched: implement unlocked action init API

2018-05-27 Thread Vlad Buslov
Add additional 'rtnl_held' argument to act API init functions. It is required to implement actions that need to release rtnl lock before loading kernel module and reacquire if afterwards. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- Changes from V1 to V2: - Rename "unlocked&quo

[PATCH] net: sched: split tc_ctl_tfilter into three handlers

2018-05-27 Thread Vlad Buslov
tcf_block_find function that is used by all three new handlers. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/cls_api.c | 438 +++- 1 file changed, 293 insertions(+), 145 deletions(-) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c

[PATCH v2 01/11] net: sched: use rcu for action cookie update

2018-05-27 Thread Vlad Buslov
Implement functions to atomically update and free action cookie using rcu mechanism. Signed-off-by: Vlad Buslov <vla...@mellanox.com> Signed-off-by: Jiri Pirko <j...@mellanox.com> --- include/net/act_api.h | 2 +- include/net/pkt_cls.h | 1 + net/sched/act_

[PATCH v2 02/11] net: sched: change type of reference and bind counters

2018-05-27 Thread Vlad Buslov
Change type of action reference counter to refcount_t. Change type of action bind counter to atomic_t. This type is used to allow decrementing bind counter without testing for 0 result. Signed-off-by: Vlad Buslov <vla...@mellanox.com> Signed-off-by: Jiri Pirko <j...@mellanox.com>

[PATCH v2 03/11] net: sched: implement unlocked action init API

2018-05-27 Thread Vlad Buslov
Add additional 'rtnl_held' argument to act API init functions. It is required to implement actions that need to release rtnl lock before loading kernel module and reacquire if afterwards. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- include/net/act_api.h | 6 -- net

[PATCH v2 06/11] net: sched: add 'delete' function to action ops

2018-05-27 Thread Vlad Buslov
in action idr. This implementation prevents concurrent threads from deleting same action twice. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- include/net/act_api.h | 1 + net/sched/act_bpf.c| 8 net/sched/act_connmark.c | 8 net/sched/act_csum.c

[PATCH v2 07/11] net: sched: implement reference counted action release

2018-05-27 Thread Vlad Buslov
to action and frees it, if necessary. Refactor action deletion code to use new put function and not to rely on rtnl lock. Remove rtnl lock assertions that are no longer needed. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_api.

[PATCH v2 08/11] net: sched: don't release reference on action overwrite

2018-05-27 Thread Vlad Buslov
before returning successfully, in order to protect from concurrent deletion. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_api.c| 2 -- net/sched/act_bpf.c| 8 net/sched/act_connmark.c | 5 +++-- net/sched/act_csum.c | 8 net

[PATCH v2 11/11] net: sched: change action API to use array of pointers to actions

2018-05-27 Thread Vlad Buslov
of actions, so it can be safely refactored into plain pointer array. Refactor action API to use array of pointers to tc_actions instead of linked list. Change argument 'actions' type of exported action init, destroy and dump functions. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- inclu

[PATCH v2 05/11] net: sched: implement action API that deletes action by index

2018-05-27 Thread Vlad Buslov
Implement new action API function that atomically finds and deletes action from idr by index. Intended to be used by lockless actions that do not rely on rtnl lock. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- include/net/act_api.h | 1 + net/sched/act_api.c

[PATCH v2 10/11] net: sched: atomically check-allocate action

2018-05-27 Thread Vlad Buslov
that removes temporary error pointer from idr. (in case of error between idr allocation and insertion of newly created action to specified index) Refactor all action init functions to insert new action to idr using this API. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- include/net/act

[PATCH v2 09/11] net: sched: use reference counting action init

2018-05-27 Thread Vlad Buslov
user must always hold reference to it. Implement helper put list function to atomically release list of actions after action API init code is done using them. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_api.c | 35 +-- 1 file chang

[PATCH v2 04/11] net: sched: always take reference to action

2018-05-27 Thread Vlad Buslov
to userspace using existing tca_get_fill function arguments. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_api.c | 46 -- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c

[PATCH v2 00/11] Modify action API for implementing lockless actions

2018-05-27 Thread Vlad Buslov
ntrusive linked list. - Expand cover letter. Vlad Buslov (11): net: sched: use rcu for action cookie update net: sched: change type of reference and bind counters net: sched: implement unlocked action init API net: sched: always take reference to action net: sched: implement action API that del

Re: [PATCH 00/14] Modify action API for implementing lockless actions

2018-05-25 Thread Vlad Buslov
On Thu 24 May 2018 at 23:34, Cong Wang <xiyou.wangc...@gmail.com> wrote: > On Mon, May 14, 2018 at 7:27 AM, Vlad Buslov <vla...@mellanox.com> wrote: >> Currently, all netlink protocol handlers for updating rules, actions and >> qdiscs are protected with single global

Re: [PATCH net-next v3] net: sched: don't disable bh when accessing action idr

2018-05-24 Thread Vlad Buslov
On Wed 23 May 2018 at 23:14, Cong Wang <xiyou.wangc...@gmail.com> wrote: > On Wed, May 23, 2018 at 1:52 AM, Vlad Buslov <vla...@mellanox.com> wrote: >> Initial net_device implementation used ingress_lock spinlock to synchronize >> ingress path of device. This lock was

[PATCH net-next v3] net: sched: don't disable bh when accessing action idr

2018-05-23 Thread Vlad Buslov
eplace all action idr spinlock usage with regular calls that do not disable bh. Acked-by: Jiri Pirko <j...@mellanox.com> Acked-by: Jamal Hadi Salim <j...@mojatatu.com> Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- Changes from V2 to V3: - Expanded commit message. Changes

Re: [PATCH net-next v2] net: sched: don't disable bh when accessing action idr

2018-05-23 Thread Vlad Buslov
On Wed 23 May 2018 at 01:10, Cong Wang <xiyou.wangc...@gmail.com> wrote: > On Mon, May 21, 2018 at 1:03 PM, Vlad Buslov <vla...@mellanox.com> wrote: >> Initial net_device implementation used ingress_lock spinlock to synchronize >> ingress path of device. This lock was

[PATCH net-next v2] net: sched: don't disable bh when accessing action idr

2018-05-21 Thread Vlad Buslov
ls that do not disable bh. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_api.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 72251241665a..3f4cf930f809 100644 --- a/net/sched/act

Re: [PATCH 09/14] net: sched: don't release reference on action overwrite

2018-05-20 Thread Vlad Buslov
On Sat 19 May 2018 at 21:52, Marcelo Ricardo Leitner <marcelo.leit...@gmail.com> wrote: > On Mon, May 14, 2018 at 05:27:10PM +0300, Vlad Buslov wrote: >> Return from action init function with reference to action taken, >> even when overwriting existing action. > >

Re: [PATCH 06/14] net: sched: implement reference counted action release

2018-05-20 Thread Vlad Buslov
On Sun 20 May 2018 at 06:22, Jiri Pirko <j...@resnulli.us> wrote: > Sat, May 19, 2018 at 11:43:27PM CEST, marcelo.leit...@gmail.com wrote: >>On Mon, May 14, 2018 at 05:27:07PM +0300, Vlad Buslov wrote: >>... >>> @@ -1052,6 +1088,36 @@ static int tca_action

Re: [PATCH 02/14] net: sched: change type of reference and bind counters

2018-05-20 Thread Vlad Buslov
On Sat 19 May 2018 at 21:04, Marcelo Ricardo Leitner <marcelo.leit...@gmail.com> wrote: > On Mon, May 14, 2018 at 05:27:03PM +0300, Vlad Buslov wrote: >> Change type of action reference counter to refcount_t. >> >> Change type of action bind counter to atomic_t. &g

Re: [PATCH] net: sched: don't disable bh when accessing action idr

2018-05-19 Thread Vlad Buslov
On Sat 19 May 2018 at 02:59, Cong Wang <xiyou.wangc...@gmail.com> wrote: > On Fri, May 18, 2018 at 8:45 AM, Vlad Buslov <vla...@mellanox.com> wrote: >> Underlying implementation of action map has changed and doesn't require >> disabling bh anymore. Replace al

Re: [PATCH 00/14] Modify action API for implementing lockless actions

2018-05-18 Thread Vlad Buslov
On Fri 18 May 2018 at 12:33, Jamal Hadi Salim <j...@mojatatu.com> wrote: > On 17/05/18 09:35 AM, Vlad Buslov wrote: >> >> On Wed 16 May 2018 at 21:51, Jiri Pirko <j...@resnulli.us> wrote: >>> Wed, May 16, 2018 at 11:23:41PM CEST, vla...@mellanox.com wrote: &g

[PATCH] net: sched: don't disable bh when accessing action idr

2018-05-18 Thread Vlad Buslov
Underlying implementation of action map has changed and doesn't require disabling bh anymore. Replace all action idr spinlock usage with regular calls that do not disable bh. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_api.c | 20 ++-- 1 file chang

Re: [PATCH 00/14] Modify action API for implementing lockless actions

2018-05-17 Thread Vlad Buslov
On Wed 16 May 2018 at 21:51, Jiri Pirko <j...@resnulli.us> wrote: > Wed, May 16, 2018 at 11:23:41PM CEST, vla...@mellanox.com wrote: >> >>On Wed 16 May 2018 at 17:36, Roman Mashak <m...@mojatatu.com> wrote: >>> Vlad Buslov <vla...@mellanox.com> writes: &

Re: [PATCH 00/14] Modify action API for implementing lockless actions

2018-05-16 Thread Vlad Buslov
On Wed 16 May 2018 at 18:10, Davide Caratti <dcara...@redhat.com> wrote: > On Wed, 2018-05-16 at 13:36 -0400, Roman Mashak wrote: >> Vlad Buslov <vla...@mellanox.com> writes: >> >> > On Wed 16 May 2018 at 14:38, Roman Mashak <m...@mojatatu.com> wrote: &g

Re: [PATCH 00/14] Modify action API for implementing lockless actions

2018-05-16 Thread Vlad Buslov
On Wed 16 May 2018 at 17:36, Roman Mashak <m...@mojatatu.com> wrote: > Vlad Buslov <vla...@mellanox.com> writes: > >> On Wed 16 May 2018 at 14:38, Roman Mashak <m...@mojatatu.com> wrote: >>> On Wed, May 16, 2018 at 2:43 AM, Vlad Buslov <vla...@mellanox.

Re: [PATCH 00/14] Modify action API for implementing lockless actions

2018-05-16 Thread Vlad Buslov
On Wed 16 May 2018 at 15:02, Jamal Hadi Salim wrote: > On 16/05/18 10:38 AM, Roman Mashak wrote: > You may actually have broken something with your patches in this case. >>> >>> Results is for net-next without my patches. >> >> Do you have skbmod compiled in kernel

Re: [PATCH 00/14] Modify action API for implementing lockless actions

2018-05-16 Thread Vlad Buslov
On Wed 16 May 2018 at 14:38, Roman Mashak <m...@mojatatu.com> wrote: > On Wed, May 16, 2018 at 2:43 AM, Vlad Buslov <vla...@mellanox.com> wrote: >>>>>> I'm trying to run tdc, but keep getting following error even on clean >>>>>> branch without m

Re: [PATCH 12/14] net: sched: retry action check-insert on concurrent modification

2018-05-16 Thread Vlad Buslov
@resnulli.us> wrote: >>>>>>> Mon, May 14, 2018 at 04:27:13PM CEST, vla...@mellanox.com wrote: >>>>>>>>Retry check-insert sequence in action init functions if action with same >>>>>>>>index was inserted concurrently. &g

Re: [PATCH 12/14] net: sched: retry action check-insert on concurrent modification

2018-05-16 Thread Vlad Buslov
ox.com wrote: >>>> >>>>On Wed 16 May 2018 at 09:59, Jiri Pirko <j...@resnulli.us> wrote: >>>>> Mon, May 14, 2018 at 04:27:13PM CEST, vla...@mellanox.com wrote: >>>>>>Retry check-insert sequence in action init functions if action with same

Re: [PATCH 12/14] net: sched: retry action check-insert on concurrent modification

2018-05-16 Thread Vlad Buslov
ox.com wrote: >>>>Retry check-insert sequence in action init functions if action with same >>>>index was inserted concurrently. >>>> >>>>Signed-off-by: Vlad Buslov <vla...@mellanox.com> >>>>--- >>>> net/sched/act_bpf.c

Re: [PATCH 12/14] net: sched: retry action check-insert on concurrent modification

2018-05-16 Thread Vlad Buslov
On Wed 16 May 2018 at 09:59, Jiri Pirko <j...@resnulli.us> wrote: > Mon, May 14, 2018 at 04:27:13PM CEST, vla...@mellanox.com wrote: >>Retry check-insert sequence in action init functions if action with same >>index was inserted concurrently. >> >>Signed-off-by:

Re: [PATCH 11/14] net: core: add new/replace rate estimator lock parameter

2018-05-16 Thread Vlad Buslov
ter from >>concurrent modification. >> >>Signed-off-by: Vlad Buslov <vla...@mellanox.com> > > [...] > > >> /** >> * gen_new_estimator - create a new rate estimator >> * @bstats: basic statistics >> * @cpu_bstats: bstats per cpu >> * @rate_e

Re: [PATCH 14/14] net: sched: implement delete for all actions

2018-05-16 Thread Vlad Buslov
deletes action >>only if it is still in action idr. This implementation prevents concurrent >>threads from deleting same action twice. >> >>Signed-off-by: Vlad Buslov <vla...@mellanox.com> >>--- >> net/sched/act_bpf.c| 8 >> net/sc

Re: [PATCH 13/14] net: sched: use unique idr insert function in unlocked actions

2018-05-16 Thread Vlad Buslov
On Wed 16 May 2018 at 09:50, Jiri Pirko <j...@resnulli.us> wrote: > Mon, May 14, 2018 at 04:27:14PM CEST, vla...@mellanox.com wrote: >>Substitute calls to action insert function with calls to action insert >>unique function that warns if insertion overwrites index in idr. >

Re: [PATCH 10/14] net: sched: extend act API for lockless actions

2018-05-16 Thread Vlad Buslov
.com wrote: >>>>Implement new action API function to atomically delete action with >>>>specified index and to atomically insert unique action. These functions are >>>>required to implement init and delete functions for specific actions that >>>&g

Re: [PATCH 10/14] net: sched: extend act API for lockless actions

2018-05-16 Thread Vlad Buslov
ctions are >>required to implement init and delete functions for specific actions that >>do not rely on rtnl lock. >> >>Signed-off-by: Vlad Buslov <vla...@mellanox.com> >>--- >> include/net/act_api.h | 2 ++ >> net/sched/act_api.c | 45 ++

Re: [PATCH 09/14] net: sched: don't release reference on action overwrite

2018-05-16 Thread Vlad Buslov
ehavior to always take reference to action before returning >>successfully. > > Where's the balance? Who does the release instead? I'm probably missing > something. I've resplit these patches for V2 to always do take/release in same patch. > >> >>Signed-off-by: V

Re: [PATCH 00/14] Modify action API for implementing lockless actions

2018-05-16 Thread Vlad Buslov
On Tue 15 May 2018 at 22:07, Lucas Bates wrote: > On Tue, May 15, 2018 at 6:03 PM, Lucas Bates wrote: >> On Tue, May 15, 2018 at 5:49 PM, Jamal Hadi Salim wrote: Test 7d50: Add skbmod action to set destination mac exit: 255

Re: [PATCH 00/14] Modify action API for implementing lockless actions

2018-05-16 Thread Vlad Buslov
On Tue 15 May 2018 at 21:49, Jamal Hadi Salim <j...@mojatatu.com> wrote: > On 15/05/18 05:21 PM, Vlad Buslov wrote: >> >> On Tue 15 May 2018 at 18:25, Jamal Hadi Salim <j...@mojatatu.com> wrote: >>> On 14/05/18 04:46 PM, Vlad Buslov wrote: >>>> &g

Re: [PATCH 00/14] Modify action API for implementing lockless actions

2018-05-15 Thread Vlad Buslov
On Tue 15 May 2018 at 18:25, Jamal Hadi Salim <j...@mojatatu.com> wrote: > On 14/05/18 04:46 PM, Vlad Buslov wrote: >> >> On Mon 14 May 2018 at 18:03, Jamal Hadi Salim <j...@mojatatu.com> wrote: >>> On 14/05/18 10:27 AM, Vlad Buslov wrote: > > &g

Re: [PATCH 07/14] net: sched: use reference counting action init

2018-05-15 Thread Vlad Buslov
gt;>modifications so user must always hold reference to it. >>>>>> >>>>>>Implement helper put list function to atomically release list of actions >>>>>>after action API init code is done using them. >>>>>> >>>

Re: [PATCH 05/14] net: sched: always take reference to action

2018-05-15 Thread Vlad Buslov
>>>>idr check function that atomically looks up action in idr and increments >>>>its reference and bind counters. >>>> >>>>Implement both action search and check using new safe function. >>>> >>>>Signed-off-by: Vlad B

Re: [PATCH 07/14] net: sched: use reference counting action init

2018-05-15 Thread Vlad Buslov
ne. At this point action becomes accessible for concurrent >>>>modifications so user must always hold reference to it. >>>> >>>>Implement helper put list function to atomically release list of actions >>>>after acti

Re: [PATCH 07/14] net: sched: use reference counting action init

2018-05-15 Thread Vlad Buslov
ist of actions >>after action API init code is done using them. >> >>Signed-off-by: Vlad Buslov <vla...@mellanox.com> >>--- >> net/sched/act_api.c | 38 +- >> 1 file changed, 17 insertions(+), 21 deletions(-) >> > >

Re: [PATCH 06/14] net: sched: implement reference counted action release

2018-05-15 Thread Vlad Buslov
On Tue 15 May 2018 at 09:03, Jiri Pirko wrote: > Mon, May 14, 2018 at 09:07:06PM CEST, vla...@mellanox.com wrote: >> >>On Mon 14 May 2018 at 16:47, Jiri Pirko wrote: >>> Mon, May 14, 2018 at 04:27:07PM CEST, vla...@mellanox.com wrote: >>> >>> [...] >>> >>>

Re: [PATCH 00/14] Modify action API for implementing lockless actions

2018-05-14 Thread Vlad Buslov
On Mon 14 May 2018 at 18:03, Jamal Hadi Salim <j...@mojatatu.com> wrote: > On 14/05/18 10:27 AM, Vlad Buslov wrote: >> Currently, all netlink protocol handlers for updating rules, actions and >> qdiscs are protected with single global rtnl lock which removes any >>

Re: [PATCH 06/14] net: sched: implement reference counted action release

2018-05-14 Thread Vlad Buslov
On Mon 14 May 2018 at 16:47, Jiri Pirko wrote: > Mon, May 14, 2018 at 04:27:07PM CEST, vla...@mellanox.com wrote: > > [...] > > >>+static int tcf_action_del_1(struct net *net, char *kind, u32 index, >>+ struct netlink_ext_ack *extack) >>+{ >>+ const

Re: [PATCH 05/14] net: sched: always take reference to action

2018-05-14 Thread Vlad Buslov
urrently) >> >>Remove unsafe action idr lookup function. Instead of it, implement safe tcf >>idr check function that atomically looks up action in idr and increments >>its reference and bind counters. >> >>Implement both action search and check using new safe funct

[PATCH 00/14] Modify action API for implementing lockless actions

2018-05-14 Thread Vlad Buslov
with 'delete' function and 'unlocked' flag. - Change action API to work with actions in lockless manner based on primitives implemented in previous patches. - Extend action API with new functions necessary to implement unlocked actions. Vlad Buslov (14): net: sched: use rcu for action cookie update

[PATCH 05/14] net: sched: always take reference to action

2018-05-14 Thread Vlad Buslov
its reference and bind counters. Implement both action search and check using new safe function. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_api.c | 38 -- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/net/sched/act

[PATCH 02/14] net: sched: change type of reference and bind counters

2018-05-14 Thread Vlad Buslov
Change type of action reference counter to refcount_t. Change type of action bind counter to atomic_t. This type is used to allow decrementing bind counter without testing for 0 result. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- include/net/act_api.h | 5 +++-- net

[PATCH 01/14] net: sched: use rcu for action cookie update

2018-05-14 Thread Vlad Buslov
Implement functions to atomically update and free action cookie using rcu mechanism. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- include/net/act_api.h | 2 +- include/net/pkt_cls.h | 1 + net/sched/act_api.c | 44 ++-- 3 files chang

[PATCH 04/14] net: sched: implement unlocked action init API

2018-05-14 Thread Vlad Buslov
Add additional 'unlocked' argument to act API init functions. Argument is true when rtnl lock is not taken and false otherwise. It is required to implement actions that need to release rtnl lock before loading kernel module and reacquire if afterwards. Signed-off-by: Vlad Buslov <

[PATCH 03/14] net: sched: add 'delete' function to action ops

2018-05-14 Thread Vlad Buslov
Extend action ops with 'delete' function. Each action type to implement its own delete function that doesn't depend on rtnl lock. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- include/net/act_api.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/net/act_api.h b/inclu

[PATCH 08/14] net: sched: account for temporary action reference

2018-05-14 Thread Vlad Buslov
it to userspace. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 3f02cd1..2772276e 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@

[PATCH 07/14] net: sched: use reference counting action init

2018-05-14 Thread Vlad Buslov
user must always hold reference to it. Implement helper put list function to atomically release list of actions after action API init code is done using them. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_api.c | 38 +- 1 file chang

[PATCH 13/14] net: sched: use unique idr insert function in unlocked actions

2018-05-14 Thread Vlad Buslov
Substitute calls to action insert function with calls to action insert unique function that warns if insertion overwrites index in idr. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_bpf.c| 2 +- net/sched/act_connmark.c | 2 +- net/sched/act_csum.c

[PATCH 11/14] net: core: add new/replace rate estimator lock parameter

2018-05-14 Thread Vlad Buslov
Extend rate estimator new and replace APIs with additional spinlock parameter used by lockless actions to protect rate_est pointer from concurrent modification. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- include/net/gen_stats.h| 2 ++ net/core/gen_estimator.c

[PATCH 10/14] net: sched: extend act API for lockless actions

2018-05-14 Thread Vlad Buslov
Implement new action API function to atomically delete action with specified index and to atomically insert unique action. These functions are required to implement init and delete functions for specific actions that do not rely on rtnl lock. Signed-off-by: Vlad Buslov <vla...@mellanox.

[PATCH 09/14] net: sched: don't release reference on action overwrite

2018-05-14 Thread Vlad Buslov
to always take reference to action before returning successfully. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_bpf.c| 8 net/sched/act_connmark.c | 5 +++-- net/sched/act_csum.c | 8 net/sched/act_gact.c | 5 +++-- net/sched/act

[PATCH 14/14] net: sched: implement delete for all actions

2018-05-14 Thread Vlad Buslov
Implement delete function that is required to delete actions without holding rtnl lock. Use action API function that atomically deletes action only if it is still in action idr. This implementation prevents concurrent threads from deleting same action twice. Signed-off-by: Vlad Buslov <

[PATCH 12/14] net: sched: retry action check-insert on concurrent modification

2018-05-14 Thread Vlad Buslov
Retry check-insert sequence in action init functions if action with same index was inserted concurrently. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_bpf.c| 8 +++- net/sched/act_connmark.c | 8 +++- net/sched/act_csum.c | 8 +++- net

[PATCH 06/14] net: sched: implement reference counted action release

2018-05-14 Thread Vlad Buslov
on rtnl lock. Remove rtnl lock assertions that are no longer needed. Signed-off-by: Vlad Buslov <vla...@mellanox.com> --- net/sched/act_api.c | 98 - net/sched/cls_api.c | 1 - 2 files changed, 82 insertions(+), 17 deletions(-) diff --git

<    1   2   3