<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/ipv6/udp.c, branch linux-2.6.36.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.36.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.36.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2010-09-09T04:45:01Z</updated>
<entry>
<title>udp: add rehash on connect()</title>
<updated>2010-09-09T04:45:01Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-09-08T05:08:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=719f835853a92f6090258114a72ffe41f09155cd'/>
<id>urn:sha1:719f835853a92f6090258114a72ffe41f09155cd</id>
<content type='text'>
commit 30fff923 introduced in linux-2.6.33 (udp: bind() optimisation)
added a secondary hash on UDP, hashed on (local addr, local port).

Problem is that following sequence :

fd = socket(...)
connect(fd, &amp;remote, ...)

not only selects remote end point (address and port), but also sets
local address, while UDP stack stored in secondary hash table the socket
while its local address was INADDR_ANY (or ipv6 equivalent)

Sequence is :
 - autobind() : choose a random local port, insert socket in hash tables
              [while local address is INADDR_ANY]
 - connect() : set remote address and port, change local address to IP
              given by a route lookup.

When an incoming UDP frame comes, if more than 10 sockets are found in
primary hash table, we switch to secondary table, and fail to find
socket because its local address changed.

One solution to this problem is to rehash datagram socket if needed.

We add a new rehash(struct socket *) method in "struct proto", and
implement this method for UDP v4 &amp; v6, using a common helper.

This rehashing only takes care of secondary hash table, since primary
hash (based on local port only) is not changed.

Reported-by: Krzysztof Piotr Oledzki &lt;ole@ans.pl&gt;
Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Tested-by: Krzysztof Piotr Oledzki &lt;ole@ans.pl&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6</title>
<updated>2010-06-07T00:42:02Z</updated>
<author>
<name>David S. Miller</name>
</author>
<published>2010-06-07T00:42:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eedc765ca4b19a41cf0b921a492ac08d640060d1'/>
<id>urn:sha1:eedc765ca4b19a41cf0b921a492ac08d640060d1</id>
<content type='text'>
Conflicts:
	drivers/net/sfc/net_driver.h
	drivers/net/sfc/siena.c
</content>
</entry>
<entry>
<title>ipv6: Refactor update of IPv6 flowi destination address for srcrt (RH) option</title>
<updated>2010-06-02T14:08:31Z</updated>
<author>
<name>Arnaud Ebalard</name>
</author>
<published>2010-06-01T21:35:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=20c59de2e6b6bc74bbf714dcd4e720afe8d516cf'/>
<id>urn:sha1:20c59de2e6b6bc74bbf714dcd4e720afe8d516cf</id>
<content type='text'>
There are more than a dozen occurrences of following code in the
IPv6 stack:

    if (opt &amp;&amp; opt-&gt;srcrt) {
            struct rt0_hdr *rt0 = (struct rt0_hdr *) opt-&gt;srcrt;
            ipv6_addr_copy(&amp;final, &amp;fl.fl6_dst);
            ipv6_addr_copy(&amp;fl.fl6_dst, rt0-&gt;addr);
            final_p = &amp;final;
    }

Replace those with a helper. Note that the helper overrides final_p
in all cases. This is ok as final_p was previously initialized to
NULL when declared.

Signed-off-by: Arnaud Ebalard &lt;arno@natisbad.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: sock_queue_err_skb() dont mess with sk_forward_alloc</title>
<updated>2010-06-01T06:44:05Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-06-01T06:44:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b1faf5666438090a4dc4fceac8502edc7788b7e3'/>
<id>urn:sha1:b1faf5666438090a4dc4fceac8502edc7788b7e3</id>
<content type='text'>
Correct sk_forward_alloc handling for error_queue would need to use a
backlog of frames that softirq handler could not deliver because socket
is owned by user thread. Or extend backlog processing to be able to
process normal and error packets.

Another possibility is to not use mem charge for error queue, this is
what I implemented in this patch.

Note: this reverts commit 29030374
(net: fix sk_forward_alloc corruptions), since we dont need to lock
socket anymore.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: fix sk_forward_alloc corruptions</title>
<updated>2010-05-29T07:20:48Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-05-29T07:20:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2903037400a26e7c0cc93ab75a7d62abfacdf485'/>
<id>urn:sha1:2903037400a26e7c0cc93ab75a7d62abfacdf485</id>
<content type='text'>
As David found out, sock_queue_err_skb() should be called with socket
lock hold, or we risk sk_forward_alloc corruption, since we use non
atomic operations to update this field.

This patch adds bh_lock_sock()/bh_unlock_sock() pair to three spots.
(BH already disabled)

1) skb_tstamp_tx() 
2) Before calling ip_icmp_error(), in __udp4_lib_err() 
3) Before calling ipv6_icmp_error(), in __udp6_lib_err()

Reported-by: Anton Blanchard &lt;anton@samba.org&gt;
Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: fix lock_sock_bh/unlock_sock_bh</title>
<updated>2010-05-27T07:30:53Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-05-26T19:20:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8a74ad60a546b13bd1096b2a61a7a5c6fd9ae17c'/>
<id>urn:sha1:8a74ad60a546b13bd1096b2a61a7a5c6fd9ae17c</id>
<content type='text'>
This new sock lock primitive was introduced to speedup some user context
socket manipulation. But it is unsafe to protect two threads, one using
regular lock_sock/release_sock, one using lock_sock_bh/unlock_sock_bh

This patch changes lock_sock_bh to be careful against 'owned' state.
If owned is found to be set, we must take the slow path.
lock_sock_bh() now returns a boolean to say if the slow path was taken,
and this boolean is used at unlock_sock_bh time to call the appropriate
unlock function.

After this change, BH are either disabled or enabled during the
lock_sock_bh/unlock_sock_bh protected section. This might be misleading,
so we rename these functions to lock_sock_fast()/unlock_sock_fast().

Reported-by: Anton Blanchard &lt;anton@samba.org&gt;
Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Tested-by: Anton Blanchard &lt;anton@samba.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv6: udp: make short packet logging consistent with ipv4</title>
<updated>2010-05-07T04:50:17Z</updated>
<author>
<name>Bjørn Mork</name>
</author>
<published>2010-05-06T03:44:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d6bc0149d8f2300bffa03ea6fea3ca39744277a6'/>
<id>urn:sha1:d6bc0149d8f2300bffa03ea6fea3ca39744277a6</id>
<content type='text'>
Adding addresses and ports to the short packet log message,
like ipv4/udp.c does it, makes these messages a lot more useful:

[  822.182450] UDPv6: short packet: From [2001:db8:ffb4:3::1]:47839 23715/178 to [2001:db8:ffb4:3:5054:ff:feff:200]:1234

This requires us to drop logging in case pskb_may_pull() fails,
which also is consistent with ipv4/udp.c

Signed-off-by: Bjørn Mork &lt;bjorn@mork.no&gt;
Acked-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: ip_queue_rcv_skb() helper</title>
<updated>2010-04-28T22:31:51Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-04-28T22:31:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f84af32cbca70a3c6d30463dc08c7984af11c277'/>
<id>urn:sha1:f84af32cbca70a3c6d30463dc08c7984af11c277</id>
<content type='text'>
When queueing a skb to socket, we can immediately release its dst if
target socket do not use IP_CMSG_PKTINFO.

tcp_data_queue() can drop dst too.

This to benefit from a hot cache line and avoid the receiver, possibly
on another cpu, to dirty this cache line himself.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: speedup udp receive path</title>
<updated>2010-04-28T21:35:48Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-04-28T21:35:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4b0b72f7dd617b13abd1b04c947e15873e011a24'/>
<id>urn:sha1:4b0b72f7dd617b13abd1b04c947e15873e011a24</id>
<content type='text'>
Since commit 95766fff ([UDP]: Add memory accounting.), 
each received packet needs one extra sock_lock()/sock_release() pair.

This added latency because of possible backlog handling. Then later,
ticket spinlocks added yet another latency source in case of DDOS.

This patch introduces lock_sock_bh() and unlock_sock_bh()
synchronization primitives, avoiding one atomic operation and backlog
processing.

skb_free_datagram_locked() uses them instead of full blown
lock_sock()/release_sock(). skb is orphaned inside locked section for
proper socket memory reclaim, and finally freed outside of it.

UDP receive path now take the socket spinlock only once.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: sk_add_backlog() take rmem_alloc into account</title>
<updated>2010-04-27T22:13:20Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-04-27T22:13:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c377411f2494a931ff7facdbb3a6839b1266bcf6'/>
<id>urn:sha1:c377411f2494a931ff7facdbb3a6839b1266bcf6</id>
<content type='text'>
Current socket backlog limit is not enough to really stop DDOS attacks,
because user thread spend many time to process a full backlog each
round, and user might crazy spin on socket lock.

We should add backlog size and receive_queue size (aka rmem_alloc) to
pace writers, and let user run without being slow down too much.

Introduce a sk_rcvqueues_full() helper, to avoid taking socket lock in
stress situations.

Under huge stress from a multiqueue/RPS enabled NIC, a single flow udp
receiver can now process ~200.000 pps (instead of ~100 pps before the
patch) on a 8 core machine.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
