netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 net-next 00/11] net: Increase inputs to flow_keys hashing
@ 2015-05-22  0:11 Tom Herbert
  2015-05-22  0:11 ` [PATCH v4 net-next 01/11] net: Simplify GRE case in flow_dissector Tom Herbert
                   ` (10 more replies)
  0 siblings, 11 replies; 27+ messages in thread
From: Tom Herbert @ 2015-05-22  0:11 UTC (permalink / raw)
  To: davem, jiri, netdev

This patch set adds new fields to the flow_keys structure and hashes
over these fields to get a better flow hash. In particular, these
patches now include hashing over the full IPv6 addresses in order
to defend against address spoofing that always results in the
same hash. The new input also includes the Ethertype, L4 protocol,
VLAN, flow label, GRE keyid, and MPLS entropy label.

In order to increase hash inputs, we switch to using jhash2
which operates an an array of u32's. jhash2 operates on multiples of
three words. The data in the hash is constructed for that, and there
are are two variants for IPv4 and Ipv6 addressing. For IPv4 addresses,
jhash is performed over six u32's and for IPv6 it is done over twelve.

flow_keys can store either IPv4 or IPv6 addresses (addr_proto field
is a selector). ipv6_addr_hash is no longer used to convert addresses
for setting in flow table. For legacy uses of flow keys outside of
flow_dissector the flow_get_u32_src and flow_get_u32_dst functions
have been added to get u32 representation representations of addresses
in flow_keys.

For flow labels we also eliminate the short circuit in flow_dissector
for non-zero flow label. The flow label is now considered additional
input to ports.

Testing: Ran netperf TCP_RR for 200 flows using IPv4 and IPv6 comparing
before the patches and with the patches. Did not detect any performance
degradation.

v2:
  - Took out MPLS entropy label. Will add this later.
v3:
  - Ensure hash start offset is a four byte boundary. Add BUG_BUILD_ON
    to check for this.
  - Fixes sparse error in GRE to get entropy from keyid.
v4:
  - Rebase to Jiri changes to generalize flow dissection
  - Support TIPC as its own address
  - Bring back MPLS entropy label dissection
  - Remove FLOW_DISSECTOR_KEY_IPV6_HASH_ADDRS


Tom Herbert (11):
  net: Simplify GRE case in flow_dissector
  mpls: Add definition for IPPROTO_MPLS
  net: Remove superfluous setting of key_basic
  net: Get skb hash over flow_keys structure
  net: Add full IPv6 addresses to flow_keys
  net: Add keys for TIPC address
  net: Get rid of IPv6 hash addresses flow keys
  net: Add VLAN ID to flow_keys
  net: Add IPv6 flow label to flow_keys
  net: Add GRE keyid in flow_keys
  mpls: Add MPLS entropy label in flow_keys

 drivers/net/bonding/bond_main.c                |   9 +-
 drivers/net/ethernet/cisco/enic/enic_clsf.c    |   8 +-
 drivers/net/ethernet/cisco/enic/enic_ethtool.c |   4 +-
 include/linux/skbuff.h                         |   2 +-
 include/net/flow_dissector.h                   |  97 +++++--
 include/net/ip.h                               |  21 +-
 include/net/ipv6.h                             |  23 +-
 include/uapi/linux/in.h                        |   2 +
 net/core/flow_dissector.c                      | 336 ++++++++++++++++++-------
 net/ethernet/eth.c                             |   2 +-
 net/sched/cls_flow.c                           |  14 +-
 net/sched/cls_flower.c                         |  13 +-
 12 files changed, 392 insertions(+), 139 deletions(-)

-- 
1.8.1

^ permalink raw reply	[flat|nested] 27+ messages in thread
* [PATCH v4 net-next 00/11] net: Increase inputs to flow_keys hashing
@ 2015-05-28 18:18 Tom Herbert
  2015-05-28 18:18 ` [PATCH v4 net-next 02/11] mpls: Add definition for IPPROTO_MPLS Tom Herbert
  0 siblings, 1 reply; 27+ messages in thread
From: Tom Herbert @ 2015-05-28 18:18 UTC (permalink / raw)
  To: davem, netdev

This patch set adds new fields to the flow_keys structure and hashes
over these fields to get a better flow hash. In particular, these
patches now include hashing over the full IPv6 addresses in order
to defend against address spoofing that always results in the
same hash. The new input also includes the Ethertype, L4 protocol,
VLAN, flow label, GRE keyid, and MPLS entropy label.

In order to increase hash inputs, we switch to using jhash2
which operates an an array of u32's. jhash2 operates on multiples of
three words. The data in the hash is constructed for that, and there
are are two variants for IPv4 and Ipv6 addressing. For IPv4 addresses,
jhash is performed over six u32's and for IPv6 it is done over twelve.

flow_keys can store either IPv4 or IPv6 addresses (addr_proto field
is a selector). ipv6_addr_hash is no longer used to convert addresses
for setting in flow table. For legacy uses of flow keys outside of
flow_dissector the flow_get_u32_src and flow_get_u32_dst functions
have been added to get u32 representation representations of addresses
in flow_keys.

For flow lables we also eliminate the short circuit in flow_dissector
for non-zero flow label. The flow label is now considered additional
input to ports.

Testing: Ran netperf TCP_RR for 200 flows using IPv4 and IPv6 comparing
before the patches and with the patches. Did not detect any performance
degradation.

v2:
  - Took out MPLS entropy label. Will add this later.
v3:
  - Ensure hash start offset is a four byte boundary. Add BUG_BUILD_ON
    to check for this.
  - Fixes sparse error in GRE to get entropy from keyid.
v4:
  - Rebase to Jiri changes to generalize flow dissection
  - Support TIPC as its own address
  - Bring back MPLS entropy label dissection
  - Remove FLOW_DISSECTOR_KEY_IPV6_HASH_ADDRS

v5:
  - Minor fixes from feedback

Tom Herbert (11):
  net: Simplify GRE case in flow_dissector
  mpls: Add definition for IPPROTO_MPLS
  net: Remove superfluous setting of key_basic
  net: Get skb hash over flow_keys structure
  net: Add full IPv6 addresses to flow_keys
  net: Add keys for TIPC address
  net: Get rid of IPv6 hash addresses flow keys
  net: Add VLAN ID to flow_keys
  net: Add IPv6 flow label to flow_keys
  net: Add GRE keyid in flow_keys
  mpls: Add MPLS entropy label in flow_keys

 drivers/net/bonding/bond_main.c                |   9 +-
 drivers/net/ethernet/cisco/enic/enic_clsf.c    |   8 +-
 drivers/net/ethernet/cisco/enic/enic_ethtool.c |   4 +-
 include/linux/skbuff.h                         |   2 +-
 include/net/flow_dissector.h                   |  97 ++++++--
 include/net/ip.h                               |  21 +-
 include/net/ipv6.h                             |  23 +-
 include/uapi/linux/in.h                        |   2 +
 net/core/flow_dissector.c                      | 329 ++++++++++++++++++-------
 net/ethernet/eth.c                             |   2 +-
 net/sched/cls_flow.c                           |  14 +-
 net/sched/cls_flower.c                         |  13 +-
 12 files changed, 388 insertions(+), 136 deletions(-)

-- 
1.8.1

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2015-05-28 18:19 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-22  0:11 [PATCH v4 net-next 00/11] net: Increase inputs to flow_keys hashing Tom Herbert
2015-05-22  0:11 ` [PATCH v4 net-next 01/11] net: Simplify GRE case in flow_dissector Tom Herbert
2015-05-22  6:36   ` Jiri Pirko
2015-05-22  0:11 ` [PATCH v4 net-next 02/11] mpls: Add definition for IPPROTO_MPLS Tom Herbert
2015-05-22  6:37   ` Jiri Pirko
2015-05-22  0:11 ` [PATCH v4 net-next 03/11] net: Remove superfluous setting of key_basic Tom Herbert
2015-05-22  6:37   ` Jiri Pirko
2015-05-22  0:11 ` [PATCH v4 net-next 04/11] net: Get skb hash over flow_keys structure Tom Herbert
2015-05-22  6:52   ` Jiri Pirko
2015-05-22  0:11 ` [PATCH v4 net-next 05/11] net: Add full IPv6 addresses to flow_keys Tom Herbert
2015-05-22  4:16   ` Cong Wang
2015-05-22  7:57   ` Jiri Pirko
2015-05-22 15:08     ` Tom Herbert
2015-05-22  0:11 ` [PATCH v4 net-next 06/11] net: Add keys for TIPC address Tom Herbert
2015-05-22  8:05   ` Jiri Pirko
2015-05-22  0:11 ` [PATCH v4 net-next 07/11] net: Get rid of IPv6 hash addresses flow keys Tom Herbert
2015-05-22  8:08   ` Jiri Pirko
2015-05-22  0:11 ` [PATCH v4 net-next 08/11] net: Add VLAN ID to flow_keys Tom Herbert
2015-05-22  0:11 ` [PATCH v4 net-next 09/11] net: Add IPv6 flow label " Tom Herbert
2015-05-22  8:14   ` Jiri Pirko
2015-05-22 15:14     ` Tom Herbert
2015-05-22 15:22       ` Jiri Pirko
2015-05-22 20:12         ` Tom Herbert
2015-05-22  0:11 ` [PATCH v4 net-next 10/11] net: Add GRE keyid in flow_keys Tom Herbert
2015-05-22  0:11 ` [PATCH v4 net-next 11/11] mpls: Add MPLS entropy label " Tom Herbert
2015-05-22  8:19   ` Jiri Pirko
  -- strict thread matches above, loose matches on Subject: below --
2015-05-28 18:18 [PATCH v4 net-next 00/11] net: Increase inputs to flow_keys hashing Tom Herbert
2015-05-28 18:18 ` [PATCH v4 net-next 02/11] mpls: Add definition for IPPROTO_MPLS Tom Herbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).