OSDN Git Service

ipv4: use dst hint for ipv4 list receive
authorPaolo Abeni <pabeni@redhat.com>
Wed, 20 Nov 2019 12:47:37 +0000 (13:47 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Nov 2019 22:45:55 +0000 (14:45 -0800)
commit02b24941619fcce3d280311ac73b1e461552e9c8
treee034d97436dfa8b32deff124f3ab172648aef9e4
parentc43c3d76c021d8d654ff5cfaad381f14f6beaf1a
ipv4: use dst hint for ipv4 list receive

This is alike the previous change, with some additional ipv4 specific
quirk. Even when using the route hint we still have to do perform
additional per packet checks about source address validity: a new
helper is added to wrap them.

Hints are explicitly disabled if the destination is a local broadcast,
that keeps the code simple and local broadcast are a slower path anyway.

UDP flood performances vs recvmmsg() receiver:

vanilla patched delta
Kpps Kpps %
1683 1871 +11

In the worst case scenario - each packet has a different
destination address - the performance delta is within noise
range.

v3 -> v4:
 - re-enable hints for forward

v2 -> v3:
 - really fix build (sic) and hint usage check
 - use fib4_has_custom_rules() helpers (David A.)
 - add ip_extract_route_hint() helper (Edward C.)
 - use prev skb as hint instead of copying data (Willem)

v1 -> v2:
 - fix build issue with !CONFIG_IP_MULTIPLE_TABLES

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/route.h
net/ipv4/ip_input.c
net/ipv4/route.c