]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Implement interface link header precomputation API.
authormelifaro <melifaro@FreeBSD.org>
Thu, 31 Dec 2015 05:03:27 +0000 (05:03 +0000)
committermelifaro <melifaro@FreeBSD.org>
Thu, 31 Dec 2015 05:03:27 +0000 (05:03 +0000)
commit93152c67c93acd0eca913cc1939a3393129c2c4d
tree9cb032aa446942e3fe424ebb7a6a14b666cec20d
parent8da8855e8f1a66d82a9a08a2ac82c9d802bfd2f3
Implement interface link header precomputation API.

Add if_requestencap() interface method which is capable of calculating
  various link headers for given interface. Right now there is support
  for INET/INET6/ARP llheader calculation (IFENCAP_LL type request).
  Other types are planned to support more complex calculation
  (L2 multipath lagg nexthops, tunnel encap nexthops, etc..).

Reshape 'struct route' to be able to pass additional data (with is length)
  to prepend to mbuf.

These two changes permits routing code to pass pre-calculated nexthop data
  (like L2 header for route w/gateway) down to the stack eliminating the
  need for other lookups. It also brings us closer to more complex scenarios
  like transparently handling MPLS nexthops and tunnel interfaces.
  Last, but not least, it removes layering violation introduced by flowtable
  code (ro_lle) and simplifies handling of existing if_output consumers.

ARP/ND changes:
Make arp/ndp stack pre-calculate link header upon installing/updating lle
  record. Interface link address change are handled by re-calculating
  headers for all lles based on if_lladdr event. After these changes,
  arpresolve()/nd6_resolve() returns full pre-calculated header for
  supported interfaces thus simplifying if_output().
Move these lookups to separate ether_resolve_addr() function which ether
  returs error or fully-prepared link header. Add <arp|nd6_>resolve_addr()
  compat versions to return link addresses instead of pre-calculated data.

BPF changes:
Raw bpf writes occupied _two_ cases: AF_UNSPEC and pseudo_AF_HDRCMPLT.
Despite the naming, both of there have ther header "complete". The only
  difference is that interface source mac has to be filled by OS for
  AF_UNSPEC (controlled via BIOCGHDRCMPLT). This logic has to stay inside
  BPF and not pollute if_output() routines. Convert BPF to pass prepend data
  via new 'struct route' mechanism. Note that it does not change
  non-optimized if_output(): ro_prepend handling is purely optional.
Side note: hackish pseudo_AF_HDRCMPLT is supported for ethernet and FDDI.
  It is not needed for ethernet anymore. The only remaining FDDI user is
  dev/pdq mostly untouched since 2007. FDDI support was eliminated from
  OpenBSD in 2013 (sys/net/if_fddisubr.c rev 1.65).

Flowtable changes:
  Flowtable violates layering by saving (and not correctly managing)
  rtes/lles. Instead of passing lle pointer, pass pointer to pre-calculated
  header data from that lle.

Differential Revision: https://reviews.freebsd.org/D4102
22 files changed:
sys/dev/cxgb/ulp/tom/cxgb_l2t.c
sys/dev/cxgbe/tom/t4_tom_l2t.c
sys/net/bpf.c
sys/net/flowtable.c
sys/net/if.c
sys/net/if_ethersubr.c
sys/net/if_llatbl.c
sys/net/if_llatbl.h
sys/net/if_var.h
sys/net/route.h
sys/netinet/if_ether.c
sys/netinet/if_ether.h
sys/netinet/in.c
sys/netinet/ip_output.c
sys/netinet/toecore.c
sys/netinet6/icmp6.c
sys/netinet6/in6.c
sys/netinet6/in6.h
sys/netinet6/nd6.c
sys/netinet6/nd6.h
sys/netinet6/nd6_nbr.c
sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c