From: Amir Vadai <hidden> Date: 2016-08-14 14:07:09
From: Amir Vadai <redacted>>
Hi,
I would like to make it possible to manage VXLAN encap/decap using the flower
classifier, mirred action and vxlan device.
In order to make the solution scaleable, I'm using a shared vxlan device, with
encapsulation information packed in the metadata - by the mirred action in the
encap flow, and used in the decap flow, by the flower classifier.
For example for virt use case:
# [uplink NIC] --{cls_flower & mirred}--> [vxlan dev] --{udp/ip stack}--> [tap]
# [tap dev] --{udp/ip stack}--> [vxlan dev] --{cls_flower & mirred}--> [uplink NIC]
# In the example, vxlan tunnel ip's are 11.11.11.* and the real devices ip's
# are: 11.11.0.*
ip link add $VXLAN type vxlan dstport 4789 external
ifconfig $VXLAN up
tc qdisc add dev $ETH ingress
# ENCAP rule for ARP
tc filter add dev $ETH protocol 0x806 parent ffff: prio 11 \
flower \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
# ENCAP rule for ICMP
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
tc qdisc add dev $VXLAN ingress
# DECAP rule for ARP
tc filter add dev $VXLAN protocol 0x806 parent ffff: prio 11 \
flower enc_src_ip 11.11.0.2 enc_dst_ip 11.11.0.1 enc_key_id 11 \
action mirred egress redirect dev $ETH
# DECAP rule for ICMP
tc filter add dev $VXLAN protocol ip parent ffff: prio 10 \
flower enc_src_ip 11.11.0.2 enc_dst_ip 11.11.0.1 enc_key_id 11 \
action mirred egress redirect dev $ETH
Next step will be to enable offloading of those rules.
Following two patches to cls_flower and act_mirred were used to validate and
test this approach, and supplied to make things clearer, they will be modified
before the actual submission.
Thanks,
Amir
Amir Vadai (2):
net/sched: cls_flower: Introduce classify by vxlan outer headers
net/sched: act_mirred: Introduce vxlan support
include/net/tc_act/tc_mirred.h | 5 +++
include/uapi/linux/pkt_cls.h | 11 +++++
include/uapi/linux/tc_act/tc_mirred.h | 7 ++++
net/sched/act_mirred.c | 79 +++++++++++++++++++++++++++++++++++
net/sched/cls_flower.c | 53 +++++++++++++++++++++++
5 files changed, 155 insertions(+)
--
2.9.0
@@ -373,6 +401,20 @@ static int fl_set_key(struct net *net, struct nlattr **tb,sizeof(key->tp.dst));}+if(tb[TCA_FLOWER_KEY_ENC_IPV4_SRC]||+tb[TCA_FLOWER_KEY_ENC_IPV4_DST]||+tb[TCA_FLOWER_KEY_ENC_KEY_ID]){+fl_set_key_val(tb,&key->enc_ipv4.src,TCA_FLOWER_KEY_ENC_IPV4_SRC,+&mask->enc_ipv4.src,TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK,+sizeof(key->enc_ipv4.src));+fl_set_key_val(tb,&key->enc_ipv4.dst,TCA_FLOWER_KEY_ENC_IPV4_DST,+&mask->enc_ipv4.dst,TCA_FLOWER_KEY_ENC_IPV4_DST_MASK,+sizeof(key->enc_ipv4.dst));+fl_set_key_val(tb,&key->enc_key_id,TCA_FLOWER_KEY_ENC_KEY_ID,+&mask->enc_key_id,TCA_FLOWER_KEY_ENC_KEY_ID,+sizeof(key->enc_key_id));+}+return0;}
@@ -753,6 +795,17 @@ static int fl_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,sizeof(key->tp.dst))))gotonla_put_failure;+if(fl_dump_key_val(skb,&key->enc_ipv4.src,TCA_FLOWER_KEY_ENC_IPV4_SRC,+&mask->enc_ipv4.src,TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK,+sizeof(key->enc_ipv4.src))||+fl_dump_key_val(skb,&key->enc_ipv4.dst,TCA_FLOWER_KEY_ENC_IPV4_DST,+&mask->enc_ipv4.dst,TCA_FLOWER_KEY_ENC_IPV4_DST_MASK,+sizeof(key->enc_ipv4.dst))||+fl_dump_key_val(skb,&key->enc_key_id,TCA_FLOWER_KEY_ENC_KEY_ID,+&mask->enc_key_id,TCA_FLOWER_KEY_ENC_KEY_ID,+sizeof(key->enc_key_id)))+gotonla_put_failure;+nla_put_u32(skb,TCA_FLOWER_FLAGS,f->flags);if(tcf_exts_dump(skb,&f->exts))
@@ -38,6 +41,11 @@ static void tcf_mirred_release(struct tc_action *a, int bind)structtcf_mirred*m=to_mirred(a);structnet_device*dev;+if(m->tun_dst){+printk("%s:%d - releasing dst: %p\n",__func__,__LINE__,m->tun_dst);+dst_release((structdst_entry*)m->tun_dst);+}+/* We could be called either in a RCU callback or with RTNL lock held. */spin_lock_bh(&mirred_list_lock);list_del(&m->tcfm_list);
@@ -139,6 +203,13 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,m->tcfm_ok_push=ok_push;}+/* Should not use ret here !!! */+if(tunnel_alloc(m,tb)){+printk("%s:%d - error allocating tunnel info\n",+__func__,__LINE__);+}++if(ret==ACT_P_CREATED){spin_lock_bh(&mirred_list_lock);list_add(&m->tcfm_list,&mirred_list);
From: Cong Wang <hidden> Date: 2016-08-14 17:53:54
On Sun, Aug 14, 2016 at 7:06 AM, Amir Vadai [off-list ref] wrote:
tc qdisc add dev $ETH ingress
# ENCAP rule for ARP
tc filter add dev $ETH protocol 0x806 parent ffff: prio 11 \
flower \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
# ENCAP rule for ICMP
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
I don't like this. This makes mirred action unnecessarily
complex, it should really just mirror or redirect packets as
it is, why it should be aware of tunnel information?
I think you probably need to introduce a new tc action
for these tunnel information and pipe it to mirred.
From: John Fastabend <john.fastabend@gmail.com> Date: 2016-08-15 05:05:47
On 16-08-14 10:53 AM, Cong Wang wrote:
On Sun, Aug 14, 2016 at 7:06 AM, Amir Vadai [off-list ref] wrote:
quoted
tc qdisc add dev $ETH ingress
# ENCAP rule for ARP
tc filter add dev $ETH protocol 0x806 parent ffff: prio 11 \
flower \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
# ENCAP rule for ICMP
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
I don't like this. This makes mirred action unnecessarily
complex, it should really just mirror or redirect packets as
it is, why it should be aware of tunnel information?
I think you probably need to introduce a new tc action
for these tunnel information and pipe it to mirred.
I agree how about a set_tunnel_key() action it could be very
similar to the bpf helper routine. Then you can string it
together with other actions easily.
.John
Sun, Aug 14, 2016 at 07:53:30PM CEST, xiyou.wangcong@gmail.com wrote:
On Sun, Aug 14, 2016 at 7:06 AM, Amir Vadai [off-list ref] wrote:
quoted
tc qdisc add dev $ETH ingress
# ENCAP rule for ARP
tc filter add dev $ETH protocol 0x806 parent ffff: prio 11 \
flower \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
# ENCAP rule for ICMP
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
I don't like this. This makes mirred action unnecessarily
complex, it should really just mirror or redirect packets as
it is, why it should be aware of tunnel information?
I think you probably need to introduce a new tc action
for these tunnel information and pipe it to mirred.
that is the first thing that I thinked of when I saw the patch. I think
you can introduce act_vxlan similar to act_vlan.
From: Amir Vadai <hidden> Date: 2016-08-15 08:17:44
On Mon, Aug 15, 2016 at 09:11:22AM +0200, Jiri Pirko wrote:
Sun, Aug 14, 2016 at 07:53:30PM CEST, xiyou.wangcong@gmail.com wrote:
quoted
On Sun, Aug 14, 2016 at 7:06 AM, Amir Vadai [off-list ref] wrote:
quoted
tc qdisc add dev $ETH ingress
# ENCAP rule for ARP
tc filter add dev $ETH protocol 0x806 parent ffff: prio 11 \
flower \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
# ENCAP rule for ICMP
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
I don't like this. This makes mirred action unnecessarily
complex, it should really just mirror or redirect packets as
it is, why it should be aware of tunnel information?
I think you probably need to introduce a new tc action
for these tunnel information and pipe it to mirred.
that is the first thing that I thinked of when I saw the patch. I think
you can introduce act_vxlan similar to act_vlan.
introducing a new action was the first thing I thought of, but it felt
problematic because the actual encap is done by the redirection to the
vxlan device. This action is only responsible to supply the metadata and
work tightly with the mirred. It is not exactly like vlan that the
push/pop actions can live without mirroring/redirecting.
But still as all of you said, it makes mirred complex with stuff that
shouldn't be there. And between the two options it is better to
introduce a new action.
I will go in this direction.
Thanks,
Amir
From: Amir Vadai <hidden> Date: 2016-08-15 09:08:07
On Mon, Aug 15, 2016 at 11:17:40AM +0300, Amir Vadai wrote:
On Mon, Aug 15, 2016 at 09:11:22AM +0200, Jiri Pirko wrote:
quoted
Sun, Aug 14, 2016 at 07:53:30PM CEST, xiyou.wangcong@gmail.com wrote:
quoted
On Sun, Aug 14, 2016 at 7:06 AM, Amir Vadai [off-list ref] wrote:
quoted
tc qdisc add dev $ETH ingress
# ENCAP rule for ARP
tc filter add dev $ETH protocol 0x806 parent ffff: prio 11 \
flower \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
# ENCAP rule for ICMP
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
I don't like this. This makes mirred action unnecessarily
complex, it should really just mirror or redirect packets as
it is, why it should be aware of tunnel information?
I think you probably need to introduce a new tc action
for these tunnel information and pipe it to mirred.
that is the first thing that I thinked of when I saw the patch. I think
you can introduce act_vxlan similar to act_vlan.
introducing a new action was the first thing I thought of, but it felt
problematic because the actual encap is done by the redirection to the
vxlan device. This action is only responsible to supply the metadata and
work tightly with the mirred. It is not exactly like vlan that the
push/pop actions can live without mirroring/redirecting.
But still as all of you said, it makes mirred complex with stuff that
shouldn't be there. And between the two options it is better to
introduce a new action.
I will go in this direction.
Thanks,
Amir
Any objection to the following?
# ENCAP rule
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action set_tunnel_key src_ip 11.11.0.1 dst_ip 11.11.0.2 key_id 11 dst_port 4789 \
action mirred egress redirect dev $VXLAN
# DECAP rule
tc filter add dev $VXLAN protocol ip parent ffff: prio 10 \
flower \
enc_src_ip 11.11.0.2 enc_dst_ip 11.11.0.1 enc_key_id 11 \
ip_proto 1 \
action mirred egress redirect dev $ETH
Mon, Aug 15, 2016 at 11:08:04AM CEST, amir@vadai.me wrote:
On Mon, Aug 15, 2016 at 11:17:40AM +0300, Amir Vadai wrote:
quoted
On Mon, Aug 15, 2016 at 09:11:22AM +0200, Jiri Pirko wrote:
quoted
Sun, Aug 14, 2016 at 07:53:30PM CEST, xiyou.wangcong@gmail.com wrote:
quoted
On Sun, Aug 14, 2016 at 7:06 AM, Amir Vadai [off-list ref] wrote:
quoted
tc qdisc add dev $ETH ingress
# ENCAP rule for ARP
tc filter add dev $ETH protocol 0x806 parent ffff: prio 11 \
flower \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
# ENCAP rule for ICMP
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action mirred egress redirect dev $VXLAN enc_src_ip 11.11.0.1 enc_dst_ip 11.11.0.2 enc_key_id 11 enc_dst_port 4789
I don't like this. This makes mirred action unnecessarily
complex, it should really just mirror or redirect packets as
it is, why it should be aware of tunnel information?
I think you probably need to introduce a new tc action
for these tunnel information and pipe it to mirred.
that is the first thing that I thinked of when I saw the patch. I think
you can introduce act_vxlan similar to act_vlan.
introducing a new action was the first thing I thought of, but it felt
problematic because the actual encap is done by the redirection to the
vxlan device. This action is only responsible to supply the metadata and
work tightly with the mirred. It is not exactly like vlan that the
push/pop actions can live without mirroring/redirecting.
But still as all of you said, it makes mirred complex with stuff that
shouldn't be there. And between the two options it is better to
introduce a new action.
I will go in this direction.
Thanks,
Amir
Any objection to the following?
# ENCAP rule
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action set_tunnel_key src_ip 11.11.0.1 dst_ip 11.11.0.2 key_id 11 dst_port 4789 \
Looks fine to me.
action mirred egress redirect dev $VXLAN
# DECAP rule
tc filter add dev $VXLAN protocol ip parent ffff: prio 10 \
flower \
enc_src_ip 11.11.0.2 enc_dst_ip 11.11.0.1 enc_key_id 11 \
ip_proto 1 \
action mirred egress redirect dev $ETH
You might want to match the tunnel's udp port as well, for symmetry.
actually, now that you raise it, the udp port is already an attribute of
the vxlan device. So I think it should be ommitted in both encap and
decap. Selecting the udp port will be done when creating the vxlan
device.
Thanks,
Amir
From: Jamal Hadi Salim <jhs@mojatatu.com> Date: 2016-08-15 10:08:17
On 16-08-15 05:08 AM, Amir Vadai wrote:
On Mon, Aug 15, 2016 at 11:17:40AM +0300, Amir Vadai wrote:
quoted
On Mon, Aug 15, 2016 at 09:11:22AM +0200, Jiri Pirko wrote:
quoted
Sun, Aug 14, 2016 at 07:53:30PM CEST, xiyou.wangcong@gmail.com wrote:
quoted
Thanks,
Amir
Any objection to the following?
# ENCAP rule
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action set_tunnel_key src_ip 11.11.0.1 dst_ip 11.11.0.2 key_id 11 dst_port 4789 \
action mirred egress redirect dev $VXLAN
Assuming $VXLAN is actually not a linux netdev of type vxlan?
then the action does vxlan encap redirect sends it to the $VXLAN
dev with encapsulation in place.
Sounds to me like a name like "vxlan" would be more usable. Example:
tc filter add dev $ETH protocol ip parent ffff: prio 10 ..
action vxlan encap src_ip 11.11.0.1 dst_ip 11.11.0.2 key_id 11 ....
action mirred egress redirect dev eth0
And a decap would be of the form:
tc filter add dev $ETH protocol ip parent ffff: prio 10 ..
action vxlan decap
i.e there is no redirect needed here, no?
cheers,
jamal
Assuming $VXLAN is actually not a linux netdev of type vxlan?
then the action does vxlan encap redirect sends it to the $VXLAN
dev with encapsulation in place.
I assume Amir refers to vxlan netdev in VXLAN_F_COLLECT_METADATA mode,
using the tun_info metadata found in skb_metadata_dst.
The action is supposed to assign the tun metadata.
From: Jamal Hadi Salim <jhs@mojatatu.com> Date: 2016-08-15 10:41:24
On 16-08-15 06:24 AM, Shmulik Ladkani wrote:
On Mon, 15 Aug 2016 06:08:10 -0400, jhs@mojatatu.com wrote:
quoted
Assuming $VXLAN is actually not a linux netdev of type vxlan?
then the action does vxlan encap redirect sends it to the $VXLAN
dev with encapsulation in place.
I assume Amir refers to vxlan netdev in VXLAN_F_COLLECT_METADATA mode,
using the tun_info metadata found in skb_metadata_dst.
The action is supposed to assign the tun metadata.
I see - so you let the vxlan netdev do the encap?
Would it still scale to a _very large_ number of tunnels?
How many netdevs are you going to use? I am assuming you will hit
a nasty lock somewhere(qdisc?) if you use only one.
cheers,
jamal
You might want to match the tunnel's udp port as well, for symmetry.
actually, now that you raise it, the udp port is already an attribute of
the vxlan device. So I think it should be ommitted in both encap and
decap. Selecting the udp port will be done when creating the vxlan
device.
Sounds better. Manual port override can be added if needed.
From: Amir Vadai <hidden> Date: 2016-08-15 11:36:56
On Mon, Aug 15, 2016 at 06:41:14AM -0400, Jamal Hadi Salim wrote:
On 16-08-15 06:24 AM, Shmulik Ladkani wrote:
quoted
On Mon, 15 Aug 2016 06:08:10 -0400, jhs@mojatatu.com wrote:
quoted
quoted
Assuming $VXLAN is actually not a linux netdev of type vxlan?
then the action does vxlan encap redirect sends it to the $VXLAN
dev with encapsulation in place.
I assume Amir refers to vxlan netdev in VXLAN_F_COLLECT_METADATA mode,
using the tun_info metadata found in skb_metadata_dst.
The action is supposed to assign the tun metadata.
I see - so you let the vxlan netdev do the encap?
Would it still scale to a _very large_ number of tunnels?
How many netdevs are you going to use? I am assuming you will hit
a nasty lock somewhere(qdisc?) if you use only one.
Having a netdev per tunnel is problematic in its memory use [1].
User can take each of the approaches. Can have a shared netdev, but will
have some contention on the qdisc lock, or create a vxlan dev per VNI
and increase memory use.
When offloading will be added, shared netdev will enjoy all worlds - low
memory use and no lock contention.
[1] - http://www.netdevconf.org/1.1/proceedings/slides/ahern-aleksandrov-prabhu-scaling-network-cumulus.pdf
Mon, Aug 15, 2016 at 12:08:10PM CEST, jhs@mojatatu.com wrote:
On 16-08-15 05:08 AM, Amir Vadai wrote:
quoted
On Mon, Aug 15, 2016 at 11:17:40AM +0300, Amir Vadai wrote:
quoted
On Mon, Aug 15, 2016 at 09:11:22AM +0200, Jiri Pirko wrote:
quoted
Sun, Aug 14, 2016 at 07:53:30PM CEST, xiyou.wangcong@gmail.com wrote:
quoted
quoted
Thanks,
Amir
Any objection to the following?
# ENCAP rule
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action set_tunnel_key src_ip 11.11.0.1 dst_ip 11.11.0.2 key_id 11 dst_port 4789 \
action mirred egress redirect dev $VXLAN
Assuming $VXLAN is actually not a linux netdev of type vxlan?
then the action does vxlan encap redirect sends it to the $VXLAN
dev with encapsulation in place.
Sounds to me like a name like "vxlan" would be more usable. Example:
I believe those are generic tunelling data
tc filter add dev $ETH protocol ip parent ffff: prio 10 ..
action vxlan encap src_ip 11.11.0.1 dst_ip 11.11.0.2 key_id 11 ....
action mirred egress redirect dev eth0
From: Amir Vadai <hidden> Date: 2016-08-15 12:59:11
On Mon, Aug 15, 2016 at 02:34:00PM +0200, Jiri Pirko wrote:
Mon, Aug 15, 2016 at 12:08:10PM CEST, jhs@mojatatu.com wrote:
quoted
On 16-08-15 05:08 AM, Amir Vadai wrote:
quoted
On Mon, Aug 15, 2016 at 11:17:40AM +0300, Amir Vadai wrote:
quoted
On Mon, Aug 15, 2016 at 09:11:22AM +0200, Jiri Pirko wrote:
quoted
Sun, Aug 14, 2016 at 07:53:30PM CEST, xiyou.wangcong@gmail.com wrote:
quoted
quoted
Thanks,
Amir
Any objection to the following?
# ENCAP rule
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action set_tunnel_key src_ip 11.11.0.1 dst_ip 11.11.0.2 key_id 11 dst_port 4789 \
action mirred egress redirect dev $VXLAN
Assuming $VXLAN is actually not a linux netdev of type vxlan?
then the action does vxlan encap redirect sends it to the $VXLAN
dev with encapsulation in place.
Sounds to me like a name like "vxlan" would be more usable. Example:
I believe those are generic tunelling data
quoted
tc filter add dev $ETH protocol ip parent ffff: prio 10 ..
action vxlan encap src_ip 11.11.0.1 dst_ip 11.11.0.2 key_id 11 ....
action mirred egress redirect dev eth0
From: John Fastabend <john.fastabend@gmail.com> Date: 2016-08-15 16:36:26
On 16-08-15 04:36 AM, Amir Vadai wrote:
On Mon, Aug 15, 2016 at 06:41:14AM -0400, Jamal Hadi Salim wrote:
quoted
On 16-08-15 06:24 AM, Shmulik Ladkani wrote:
quoted
On Mon, 15 Aug 2016 06:08:10 -0400, jhs@mojatatu.com wrote:
quoted
quoted
Assuming $VXLAN is actually not a linux netdev of type vxlan?
then the action does vxlan encap redirect sends it to the $VXLAN
dev with encapsulation in place.
I assume Amir refers to vxlan netdev in VXLAN_F_COLLECT_METADATA mode,
using the tun_info metadata found in skb_metadata_dst.
The action is supposed to assign the tun metadata.
I see - so you let the vxlan netdev do the encap?
Would it still scale to a _very large_ number of tunnels?
How many netdevs are you going to use? I am assuming you will hit
a nasty lock somewhere(qdisc?) if you use only one.
Having a netdev per tunnel is problematic in its memory use [1].
User can take each of the approaches. Can have a shared netdev, but will
have some contention on the qdisc lock, or create a vxlan dev per VNI
and increase memory use.
When offloading will be added, shared netdev will enjoy all worlds - low
memory use and no lock contention.
vxlan devices are lockless if your worried about many netdevs using
shared netdev with metadata is a good approach.
static void vxlan_setup(struct net_device *dev)
{
struct vxlan_dev *vxlan = netdev_priv(dev);
unsigned int h;
eth_hw_addr_random(dev);
ether_setup(dev);
dev->destructor = free_netdev;
SET_NETDEV_DEVTYPE(dev, &vxlan_type);
dev->features |= NETIF_F_LLTX; <--- ;) here
dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM;
dev->features |= NETIF_F_RXCSUM;
dev->features |= NETIF_F_GSO_SOFTWARE;
From: John Fastabend <john.fastabend@gmail.com> Date: 2016-08-15 16:38:08
On 16-08-15 05:59 AM, Amir Vadai wrote:
On Mon, Aug 15, 2016 at 02:34:00PM +0200, Jiri Pirko wrote:
quoted
Mon, Aug 15, 2016 at 12:08:10PM CEST, jhs@mojatatu.com wrote:
quoted
On 16-08-15 05:08 AM, Amir Vadai wrote:
quoted
On Mon, Aug 15, 2016 at 11:17:40AM +0300, Amir Vadai wrote:
quoted
On Mon, Aug 15, 2016 at 09:11:22AM +0200, Jiri Pirko wrote:
quoted
Sun, Aug 14, 2016 at 07:53:30PM CEST, xiyou.wangcong@gmail.com wrote:
quoted
quoted
Thanks,
Amir
Any objection to the following?
# ENCAP rule
tc filter add dev $ETH protocol ip parent ffff: prio 10 \
flower ip_proto 1 \
action set_tunnel_key src_ip 11.11.0.1 dst_ip 11.11.0.2 key_id 11 dst_port 4789 \
action mirred egress redirect dev $VXLAN
Assuming $VXLAN is actually not a linux netdev of type vxlan?
then the action does vxlan encap redirect sends it to the $VXLAN
dev with encapsulation in place.
Sounds to me like a name like "vxlan" would be more usable. Example:
I believe those are generic tunelling data
quoted
tc filter add dev $ETH protocol ip parent ffff: prio 10 ..
action vxlan encap src_ip 11.11.0.1 dst_ip 11.11.0.2 key_id 11 ....
action mirred egress redirect dev eth0