<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/net/veth.c, branch v3.12.48</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>veth: Fix vlan_features so as to be able to use stacked vlan interfaces</title>
<updated>2014-03-13T22:19:38+00:00</updated>
<author>
<name>Toshiaki Makita</name>
<email>makita.toshiaki@lab.ntt.co.jp</email>
</author>
<published>2014-02-18T12:20:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=cc9f71b2cc82f1fb66dc5d1ff3fc4eefe8b06f91'/>
<id>cc9f71b2cc82f1fb66dc5d1ff3fc4eefe8b06f91</id>
<content type='text'>
[ Upstream commit 8d0d21f4053c07714802cbe8b1fe26913ec296cc ]

Even if we create a stacked vlan interface such as veth0.10.20, it sends
single tagged frames (tagged with only vid 10).
Because vlan_features of a veth interface has the
NETIF_F_HW_VLAN_[CTAG/STAG]_TX bits, veth0.10 also has that feature, so
dev_hard_start_xmit(veth0.10) doesn't call __vlan_put_tag() and
vlan_dev_hard_start_xmit(veth0.10) overwrites vlan_tci.
This prevents us from using a combination of 802.1ad and 802.1Q
in containers, etc.

Signed-off-by: Toshiaki Makita &lt;makita.toshiaki@lab.ntt.co.jp&gt;
Acked-by: Flavio Leitner &lt;fbl@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 8d0d21f4053c07714802cbe8b1fe26913ec296cc ]

Even if we create a stacked vlan interface such as veth0.10.20, it sends
single tagged frames (tagged with only vid 10).
Because vlan_features of a veth interface has the
NETIF_F_HW_VLAN_[CTAG/STAG]_TX bits, veth0.10 also has that feature, so
dev_hard_start_xmit(veth0.10) doesn't call __vlan_put_tag() and
vlan_dev_hard_start_xmit(veth0.10) overwrites vlan_tci.
This prevents us from using a combination of 802.1ad and 802.1Q
in containers, etc.

Signed-off-by: Toshiaki Makita &lt;makita.toshiaki@lab.ntt.co.jp&gt;
Acked-by: Flavio Leitner &lt;fbl@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>veth: add vlan features</title>
<updated>2013-07-20T00:36:03+00:00</updated>
<author>
<name>Flavio Leitner</name>
<email>fbl@redhat.com</email>
</author>
<published>2013-07-18T19:15:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b69bbddfa136dc53ac319d58bc38b41f8aefffea'/>
<id>b69bbddfa136dc53ac319d58bc38b41f8aefffea</id>
<content type='text'>
The veth device doesn't provide the vlan features,
so TSO for example is disabled and that causes
performance issues when using tagged traffic.

The test topology looks like this:

    br0                     br1
  /   \                  /     \
vnet  veth0.10 ----- veth1.10   vnet
VM                               VM

The netperf results with current veth driver:
MIGRATED TCP STREAM TEST from 192.168.1.1 ()
port 0 AF_INET to 192.168.1.2 () port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380  16384  16384    10.01    2210.22

Now after applying the proposed patch:
MIGRATED TCP STREAM TEST from 192.168.1.1 ()
port 0 AF_INET to 192.168.1.2 () port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380  16384  16384    10.00    13067.47

Signed-off-by: Flavio Leitner &lt;fbl@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The veth device doesn't provide the vlan features,
so TSO for example is disabled and that causes
performance issues when using tagged traffic.

The test topology looks like this:

    br0                     br1
  /   \                  /     \
vnet  veth0.10 ----- veth1.10   vnet
VM                               VM

The netperf results with current veth driver:
MIGRATED TCP STREAM TEST from 192.168.1.1 ()
port 0 AF_INET to 192.168.1.2 () port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380  16384  16384    10.01    2210.22

Now after applying the proposed patch:
MIGRATED TCP STREAM TEST from 192.168.1.1 ()
port 0 AF_INET to 192.168.1.2 () port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380  16384  16384    10.00    13067.47

Signed-off-by: Flavio Leitner &lt;fbl@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>veth: remove redundant call of dev_alloc_name</title>
<updated>2013-06-12T08:21:20+00:00</updated>
<author>
<name>Hong zhi guo</name>
<email>honkiko@gmail.com</email>
</author>
<published>2013-06-09T12:15:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3f8b96379a820318db37f7b6e81e6e459ad56efe'/>
<id>3f8b96379a820318db37f7b6e81e6e459ad56efe</id>
<content type='text'>
it's called in the following register_netdevice. No need to call it
here.
Tested with "ip link add type veth" and "ip link add xxx%d type veth".

Signed-off-by: Hong Zhiguo &lt;honkiko@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
it's called in the following register_netdevice. No need to call it
here.
Tested with "ip link add type veth" and "ip link add xxx%d type veth".

Signed-off-by: Hong Zhiguo &lt;honkiko@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: vlan: announce STAG offload capability in some drivers</title>
<updated>2013-04-19T18:46:06+00:00</updated>
<author>
<name>Patrick McHardy</name>
<email>kaber@trash.net</email>
</author>
<published>2013-04-19T02:04:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=28d2b136ca6c7bf7173a43a90f747ecda5b0520d'/>
<id>28d2b136ca6c7bf7173a43a90f747ecda5b0520d</id>
<content type='text'>
- macvlan: propagate STAG filtering capabilities from underlying device
- ifb: announce STAG tagging support in addition to CTAG tagging support
- veth: announce STAG tagging/stripping support in addition to CTAG support

Signed-off-by: Patrick McHardy &lt;kaber@trash.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- macvlan: propagate STAG filtering capabilities from underlying device
- ifb: announce STAG tagging support in addition to CTAG tagging support
- veth: announce STAG tagging/stripping support in addition to CTAG support

Signed-off-by: Patrick McHardy &lt;kaber@trash.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: vlan: rename NETIF_F_HW_VLAN_* feature flags to NETIF_F_HW_VLAN_CTAG_*</title>
<updated>2013-04-19T18:45:26+00:00</updated>
<author>
<name>Patrick McHardy</name>
<email>kaber@trash.net</email>
</author>
<published>2013-04-19T02:04:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f646968f8f7c624587de729115d802372b9063dd'/>
<id>f646968f8f7c624587de729115d802372b9063dd</id>
<content type='text'>
Rename the hardware VLAN acceleration features to include "CTAG" to indicate
that they only support CTAGs. Follow up patches will introduce 802.1ad
server provider tagging (STAGs) and require the distinction for hardware not
supporting acclerating both.

Signed-off-by: Patrick McHardy &lt;kaber@trash.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rename the hardware VLAN acceleration features to include "CTAG" to indicate
that they only support CTAGs. Follow up patches will introduce 802.1ad
server provider tagging (STAGs) and require the distinction for hardware not
supporting acclerating both.

Signed-off-by: Patrick McHardy &lt;kaber@trash.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>veth: fix NULL dereference in veth_dellink()</title>
<updated>2013-02-11T01:41:43+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2013-02-08T20:10:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f45a5c267da35174e22cec955093a7513dc1623d'/>
<id>f45a5c267da35174e22cec955093a7513dc1623d</id>
<content type='text'>
commit d0e2c55e7c940 (veth: avoid a NULL deref in veth_stats_one)
added another NULL deref in veth_dellink().

# ip link add name veth1 type veth peer name veth0
# rmmod veth

We crash because veth_dellink() is called twice, so we must
take care of NULL peer.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit d0e2c55e7c940 (veth: avoid a NULL deref in veth_stats_one)
added another NULL deref in veth_dellink().

# ip link add name veth1 type veth peer name veth0
# rmmod veth

We crash because veth_dellink() is called twice, so we must
take care of NULL peer.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>veth: fix a NULL deref in netif_carrier_off</title>
<updated>2013-01-10T22:11:46+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2013-01-10T08:32:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2efd32ee1b60b0b31404ca47c1ce70e5a5d24ebc'/>
<id>2efd32ee1b60b0b31404ca47c1ce70e5a5d24ebc</id>
<content type='text'>
In commit d0e2c55e7c94 (veth: avoid a NULL deref in veth_stats_one)
we now clear the peer pointers in veth_dellink()

veth_close() must therefore make sure the peer pointer is set.

Reported-by: Tom Parkin &lt;tom.parkin@gmail.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In commit d0e2c55e7c94 (veth: avoid a NULL deref in veth_stats_one)
we now clear the peer pointers in veth_dellink()

veth_close() must therefore make sure the peer pointer is set.

Reported-by: Tom Parkin &lt;tom.parkin@gmail.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>veth: avoid a NULL deref in veth_stats_one</title>
<updated>2013-01-08T03:42:50+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2013-01-04T15:42:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d0e2c55e7c940a3ee91e9e23a2683b593690f1e9'/>
<id>d0e2c55e7c940a3ee91e9e23a2683b593690f1e9</id>
<content type='text'>
commit 2681128f0ced8a (veth: extend device features) added a NULL deref
in veth_stats_one(), as veth_get_stats64() was not testing if the peer
device was setup or not.

At init time, we call dev_get_stats() before veth pair is fully setup.

[  178.854758]  [&lt;ffffffffa00f5677&gt;] veth_get_stats64+0x47/0x70 [veth]
[  178.861013]  [&lt;ffffffff814f0a2d&gt;] dev_get_stats+0x6d/0x130
[  178.866486]  [&lt;ffffffff81504efc&gt;] rtnl_fill_ifinfo+0x47c/0x930
[  178.872299]  [&lt;ffffffff81505b93&gt;] rtmsg_ifinfo+0x83/0x100
[  178.877678]  [&lt;ffffffff81505cc6&gt;] rtnl_configure_link+0x76/0xa0
[  178.883580]  [&lt;ffffffffa00f52fa&gt;] veth_newlink+0x16a/0x350 [veth]
[  178.889654]  [&lt;ffffffff815061cc&gt;] rtnl_newlink+0x4dc/0x5e0
[  178.895128]  [&lt;ffffffff81505e1e&gt;] ? rtnl_newlink+0x12e/0x5e0
[  178.900769]  [&lt;ffffffff8150587d&gt;] rtnetlink_rcv_msg+0x11d/0x310
[  178.906669]  [&lt;ffffffff81505760&gt;] ? __rtnl_unlock+0x20/0x20
[  178.912225]  [&lt;ffffffff81521f89&gt;] netlink_rcv_skb+0xa9/0xd0
[  178.917779]  [&lt;ffffffff81502d55&gt;] rtnetlink_rcv+0x25/0x40
[  178.923159]  [&lt;ffffffff815218d1&gt;] netlink_unicast+0x1b1/0x230
[  178.928887]  [&lt;ffffffff81521c4e&gt;] netlink_sendmsg+0x2fe/0x3b0
[  178.934615]  [&lt;ffffffff814dbe22&gt;] sock_sendmsg+0xd2/0xf0

So we must check if peer was setup in veth_get_stats64()

As pointed out by Ben Hutchings, priv-&gt;peer is missing proper
synchronization. Adding RCU protection is a safe and well documented
way to make sure we don't access about to be freed or already
freed data.

Reported-by: Tom Parkin &lt;tparkin@katalix.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
CC: Ben Hutchings &lt;bhutchings@solarflare.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 2681128f0ced8a (veth: extend device features) added a NULL deref
in veth_stats_one(), as veth_get_stats64() was not testing if the peer
device was setup or not.

At init time, we call dev_get_stats() before veth pair is fully setup.

[  178.854758]  [&lt;ffffffffa00f5677&gt;] veth_get_stats64+0x47/0x70 [veth]
[  178.861013]  [&lt;ffffffff814f0a2d&gt;] dev_get_stats+0x6d/0x130
[  178.866486]  [&lt;ffffffff81504efc&gt;] rtnl_fill_ifinfo+0x47c/0x930
[  178.872299]  [&lt;ffffffff81505b93&gt;] rtmsg_ifinfo+0x83/0x100
[  178.877678]  [&lt;ffffffff81505cc6&gt;] rtnl_configure_link+0x76/0xa0
[  178.883580]  [&lt;ffffffffa00f52fa&gt;] veth_newlink+0x16a/0x350 [veth]
[  178.889654]  [&lt;ffffffff815061cc&gt;] rtnl_newlink+0x4dc/0x5e0
[  178.895128]  [&lt;ffffffff81505e1e&gt;] ? rtnl_newlink+0x12e/0x5e0
[  178.900769]  [&lt;ffffffff8150587d&gt;] rtnetlink_rcv_msg+0x11d/0x310
[  178.906669]  [&lt;ffffffff81505760&gt;] ? __rtnl_unlock+0x20/0x20
[  178.912225]  [&lt;ffffffff81521f89&gt;] netlink_rcv_skb+0xa9/0xd0
[  178.917779]  [&lt;ffffffff81502d55&gt;] rtnetlink_rcv+0x25/0x40
[  178.923159]  [&lt;ffffffff815218d1&gt;] netlink_unicast+0x1b1/0x230
[  178.928887]  [&lt;ffffffff81521c4e&gt;] netlink_sendmsg+0x2fe/0x3b0
[  178.934615]  [&lt;ffffffff814dbe22&gt;] sock_sendmsg+0xd2/0xf0

So we must check if peer was setup in veth_get_stats64()

As pointed out by Ben Hutchings, priv-&gt;peer is missing proper
synchronization. Adding RCU protection is a safe and well documented
way to make sure we don't access about to be freed or already
freed data.

Reported-by: Tom Parkin &lt;tparkin@katalix.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
CC: Ben Hutchings &lt;bhutchings@solarflare.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>veth: extend device features</title>
<updated>2012-12-30T10:31:59+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2012-12-29T16:26:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8093315a91340bca52549044975d8c7f673b28a1'/>
<id>8093315a91340bca52549044975d8c7f673b28a1</id>
<content type='text'>
veth is lacking most modern facilities, like SG, checksums, TSO.

It makes sense to extend dev-&gt;features to get them, or GRO aggregation
is defeated by a forced segmentation.

Reported-by: Andrew Vagin &lt;avagin@parallels.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Michał Mirosław &lt;mirq-linux@rere.qmqm.pl&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
veth is lacking most modern facilities, like SG, checksums, TSO.

It makes sense to extend dev-&gt;features to get them, or GRO aggregation
is defeated by a forced segmentation.

Reported-by: Andrew Vagin &lt;avagin@parallels.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Michał Mirosław &lt;mirq-linux@rere.qmqm.pl&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>veth: reduce stat overhead</title>
<updated>2012-12-30T10:31:58+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2012-12-29T16:02:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2681128f0ced8aa4e66f221197e183cc16d244fe'/>
<id>2681128f0ced8aa4e66f221197e183cc16d244fe</id>
<content type='text'>
veth stats are a bit bloated. There is no need to account transmit
and receive stats, since they are absolutely symmetric.

Also use a per device atomic64_t for the dropped counter, as it
should never be used in fast path.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
veth stats are a bit bloated. There is no need to account transmit
and receive stats, since they are absolutely symmetric.

Also use a per device atomic64_t for the dropped counter, as it
should never be used in fast path.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
</feed>
