All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jamal Hadi Salim <jhs@mojatatu.com>
To: Hadar Hen Zion <hadarh@mellanox.com>,
	"David S. Miller" <davem@davemloft.net>
Cc: 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>,
	Eric Dumazet <edumazet@google.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Amir Vadai <amirva@mellanox.com>,
	Or Gerlitz <ogerlitz@mellanox.com>, Amir Vadai <amir@vadai.me>
Subject: Re: [PATCH net-next V5 4/4] net/sched: Introduce act_tunnel_key
Date: Tue, 6 Sep 2016 06:49:46 -0400	[thread overview]
Message-ID: <b6d6b736-bc45-3216-6109-0b67a54fb704@mojatatu.com> (raw)
In-Reply-To: <1472986555-14949-5-git-send-email-hadarh@mellanox.com>

On 16-09-04 06:55 AM, Hadar Hen Zion wrote:
> From: Amir Vadai <amir@vadai.me>
>
> This action could be used before redirecting packets to a shared tunnel
> device, or when redirecting packets arriving from a such a device.
>
> The action will release the metadata created by the tunnel device
> (decap), or set the metadata with the specified values for encap
> operation.
>
> For example, the following flower filter will forward all ICMP packets
> destined to 11.11.11.2 through the shared vxlan device 'vxlan0'. Before
> redirecting, a metadata for the vxlan tunnel is created using the
> tunnel_key action and it's arguments:
>
> $ filter add dev net0 protocol ip parent ffff: \
>     flower \
>       ip_proto 1 \
>       dst_ip 11.11.11.2 \
>     action tunnel_key set \
>       src_ip 11.11.0.1 \
>       dst_ip 11.11.0.2 \
>       id 11 \
>     action mirred egress redirect dev vxlan0
>


Syntax error above. Regardless:
Please verify by running a test and send a packet or two
and verify that stats are incremented (I know it may sound silly to
ask but it is important).

> +static int tunnel_key_act(struct sk_buff *skb, const struct tc_action *a,
> +			  struct tcf_result *res)
> +{
> +	struct tcf_tunnel_key *t = to_tunnel_key(a);
> +	struct tcf_tunnel_key_params *params;
> +	int action;
> +
> +	rcu_read_lock();
> +
> +	params = rcu_dereference(t->params);
> +
> +	tcf_lastuse_update(&t->tcf_tm);
> +	bstats_cpu_update(this_cpu_ptr(t->common.cpu_bstats), skb);
> +	action = params->action;
> +
> +	switch (params->tcft_action) {
> +	case TCA_TUNNEL_KEY_ACT_RELEASE:
> +		skb_dst_drop(skb);
> +		break;
> +	case TCA_TUNNEL_KEY_ACT_SET:
> +		skb_dst_drop(skb);
> +		skb_dst_set(skb, dst_clone(&params->tcft_enc_metadata->dst));
> +		break;
> +	default:
> +		WARN_ONCE(1, "Bad tunnel_key action.\n");
> +		break;


slow path (_init()) is already checking for a bad tcft_act so it seems
unnecessary to have the default.
If you have to keep default would be useful to print the value as well.

Other than that looks good.
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

  parent reply	other threads:[~2016-09-06 10:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-04 10:55 [PATCH net-next V5 0/4] net/sched: ip tunnel metadata set/release/classify by using TC Hadar Hen Zion
2016-09-04 10:55 ` [PATCH net-next V5 1/4] net/ip_tunnels: Introduce tunnel_id_to_key32() and key32_to_tunnel_id() Hadar Hen Zion
2016-09-04 10:55 ` [PATCH net-next V5 2/4] net/dst: Utility functions to build dst_metadata without supplying an skb Hadar Hen Zion
2016-09-04 11:14   ` Sergei Shtylyov
2016-09-04 12:27     ` Hadar Hen Zion
2016-09-04 10:55 ` [PATCH net-next V5 3/4] net/sched: cls_flower: Classify packet in ip tunnels Hadar Hen Zion
2016-09-04 10:55 ` [PATCH net-next V5 4/4] net/sched: Introduce act_tunnel_key Hadar Hen Zion
2016-09-04 11:21   ` Shmulik Ladkani
2016-09-04 12:50   ` kbuild test robot
2016-09-04 18:19   ` Rosen, Rami
2016-09-05  6:45     ` Hadar Hen Zion
2016-09-06 10:49   ` Jamal Hadi Salim [this message]
2016-09-06 11:03     ` Hadar Hen Zion
2016-09-06 12:44       ` Jamal Hadi Salim
2016-09-06 14:11   ` Eric Dumazet
2016-09-06 14:25     ` Hadar Hen Zion

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=b6d6b736-bc45-3216-6109-0b67a54fb704@mojatatu.com \
    --to=jhs@mojatatu.com \
    --cc=amir@vadai.me \
    --cc=amirva@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hadarh@mellanox.com \
    --cc=jbenc@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.