netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Vadai <amir@vadai.me>
To: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Hadar Hen Zion <hadarh@mellanox.com>,
	"David S. Miller" <davem@davemloft.net>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	Jiri Pirko <jiri@mellanox.com>, Jiri Benc <jbenc@redhat.com>,
	Shmulik Ladkani <shmulik.ladkani@gmail.com>,
	Tom Herbert <tom@herbertland.com>,
	Or Gerlitz <ogerlitz@mellanox.com>,
	Amir Vadai <amirva@mellanox.com>
Subject: Re: [PATCH net-next V3 4/4] net/sched: Introduce act_tunnel_key
Date: Tue, 30 Aug 2016 16:17:54 +0300	[thread overview]
Message-ID: <20160830131754.GA11446@office.localdomain> (raw)
In-Reply-To: <bd4cb7ee-1f7e-eefe-760e-0fa53257390e@mojatatu.com>

On Tue, Aug 30, 2016 at 08:05:03AM -0400, Jamal Hadi Salim wrote:
> On 16-08-30 07:03 AM, Amir Vadai wrote:
> > On Sun, Aug 28, 2016 at 10:04:21PM -0700, Cong Wang wrote:
> > > On Fri, Aug 26, 2016 at 12:16 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > > > On Fri, 2016-08-26 at 11:26 -0700, Cong Wang wrote:
> 
> 
> > Regarding the specific action in this patchset, correct me if I'm wrong,
> > but I think that the lock could be removed safely.
> > 
> 
> From what Eric suggested (refer to my posting on skbmod),
> this becomes:
> 
> +struct tcf_tunnel_key_p {
> +	int			tcft_action;
> +	struct metadata_dst     *tcft_enc_metadata;
> +};
> 
> /* rcu protected */
> +struct tcf_tunnel_key {
> +	struct tc_action	common;
> +       struct tcf_tunnel_key_p *p;
> +};
> 
> At init() - always alloc struct tcf_tunnel_key_p, new
> 
> old = rtnl_dereference(mykey->p);
> if (ovr)
>     spin_lock_bh(&mykey->tcf_lock);
Thanks for the detailed example :)

what are we protecting with this spin lock here? isn't concurrent init()
calls are protected by the rtnl lock?


> ... update all params here ..
> rcu_assign_pointer(mykey->p, new);
> if (ovr) {
>      spin_unlock_bh(&mykey->tcf_lock);
>      synchronize_rcu();
> }
> 
> kfree(old);
> 
> at act():
> 
> rcu_read_lock();
> struct tcf_tunnel_key_p *p = rcu_dereference(mykey->p);
> ... use p here ...
> rcu_read_unlock();
> 
> Cong was looking to do something more generic for all actions.
> 
> cheers,
> jamal

  reply	other threads:[~2016-08-30 13:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25 16:13 [PATCH net-next V3 0/4] net/sched: ip tunnel metadata set/release/classify by using TC Hadar Hen Zion
2016-08-25 16:13 ` [PATCH net-next V3 1/4] net/ip_tunnels: Introduce tunnel_id_to_key32() and key32_to_tunnel_id() Hadar Hen Zion
2016-08-26 10:26   ` Jiri Benc
2016-08-25 16:13 ` [PATCH net-next V3 2/4] net/dst: Utility functions to build dst_metadata without supplying an skb Hadar Hen Zion
2016-08-25 16:40   ` Shmulik Ladkani
2016-08-26  6:14     ` Or Gerlitz
2016-08-26 10:31     ` Jiri Benc
2016-08-25 16:13 ` [PATCH net-next V3 3/4] net/sched: cls_flower: Classify packet in ip tunnels Hadar Hen Zion
2016-08-26 10:46   ` Jiri Benc
2016-08-25 16:13 ` [PATCH net-next V3 4/4] net/sched: Introduce act_tunnel_key Hadar Hen Zion
2016-08-25 16:52   ` Shmulik Ladkani
2016-08-25 17:48   ` Eric Dumazet
2016-08-26  6:16     ` Or Gerlitz
2016-08-26 18:26     ` Cong Wang
2016-08-26 19:16       ` Eric Dumazet
2016-08-29  5:04         ` Cong Wang
2016-08-30 11:03           ` Amir Vadai
2016-08-30 11:39             ` Amir Vadai
2016-08-30 12:27               ` Eric Dumazet
2016-08-30 12:05             ` Jamal Hadi Salim
2016-08-30 13:17               ` Amir Vadai [this message]
2016-08-30 14:27                 ` Eric Dumazet
2016-08-26 11:13   ` Jiri Benc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160830131754.GA11446@office.localdomain \
    --to=amir@vadai.me \
    --cc=amirva@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=hadarh@mellanox.com \
    --cc=jbenc@redhat.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=shmulik.ladkani@gmail.com \
    --cc=tom@herbertland.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).