[ovs-git] Open vSwitch: packets, pktbuf: Align L3 headers on 32-bit boundary. (master)

dev at openvswitch.org dev at openvswitch.org
Wed Aug 28 05:10:31 UTC 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  bb622f82d709e7468a5bc9eb4f038ce9343f74f6 (commit)
       via  4528f34f93422dde4c8ae4c56869cc4e268159c7 (commit)
       via  7c457c334539957702a5f09f6fd893975bcef568 (commit)
       via  a69553be4250a8a40d603d8f3123ec532d5fb390 (commit)
      from  db0b6c2913dfda237f07881b059ba267f3388600 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bb622f82d709e7468a5bc9eb4f038ce9343f74f6
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=bb622f82d709e7468a5bc9eb4f038ce9343f74f6
Author: Ben Pfaff <blp at nicira.com>
		
packets, pktbuf: Align L3 headers on 32-bit boundary.
		
Memory access tends to be faster when data is properly aligned.

Signed-off-by: Ben Pfaff <blp at nicira.com>


commit 4528f34f93422dde4c8ae4c56869cc4e268159c7
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=4528f34f93422dde4c8ae4c56869cc4e268159c7
Author: Ben Pfaff <blp at nicira.com>
		
packets: Introduce IPv6 headers not aligned on a 32-bit boundary.
		
This fixes the same problem for IPv6 headers treated for other headers in
the previous commit.

Signed-off-by: Ben Pfaff <blp at nicira.com>


commit 7c457c334539957702a5f09f6fd893975bcef568
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=7c457c334539957702a5f09f6fd893975bcef568
Author: Ben Pfaff <blp at nicira.com>
		
packets: Do not assume that IPv4, TCP, or ARP headers are 32-bit aligned.
		
Ethernet headers are 14 bytes long, so when the beginning of such a header
is 32-bit aligned, the following data is misaligned.  The usual trick to
fix that is to start the Ethernet header on an odd-numbered 16-bit
boundary.  That trick works OK for Open vSwitch, but there are two
problems:

   - OVS doesn't use that trick everywhere.  Maybe it should, but it's
     difficult to make sure that it does consistently because the CPUs
     most commonly used with OVS don't care about misalignment, so we
     only find problems when porting.

   - Some protocols (GRE, VXLAN) don't use that trick, so in such a case
     one can properly align the inner or outer L3/L4/L7 but not both.  (OVS
     userspace doesn't directly deal with such protocols yet, so this is
     just future-proofing.)

   - OpenFlow uses the alignment trick in a few places but not all of them.

This commit starts the adoption of what I hope will be a more robust way
to avoid misalignment problems and the resulting bus errors on RISC
architectures.  Instead of trying to ensure that 32-bit quantities are
always aligned, we always read them as if they were misaligned.  To ensure
that they are read this way, we change their types from 32-bit types to
pairs of 16-bit types.  (I don't know of any protocols that offset the
next header by an odd number of bytes, so a 16-bit alignment assumption
seems OK.)

The same would be necessary for 64-bit types in protocol headers, but we
don't yet have any protocol definitions with 64-bit types.

IPv6 protocol headers need the same treatment, but for those we rely on
structs provided by system headers, so I'll leave them for an upcoming
patch.

Signed-off-by: Ben Pfaff <blp at nicira.com>


commit a69553be4250a8a40d603d8f3123ec532d5fb390
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=a69553be4250a8a40d603d8f3123ec532d5fb390
Author: Ben Pfaff <blp at nicira.com>
		
ofproto: Remove obsolete comment and assertion.
		
At one time, the ofproto-dpif implementation of the 'rule_execute' member
function required, indirectly, at least struct(ofp10_packet_in) bytes of
headroom in the packet passed into it.  (This allowed constructing an
OFPT_PACKET_IN without allocating and copying a new ofpbuf.)  This
restriction has long been lifted, but rule_execute() had not yet caught
up.  This commit updates it.

Signed-off-by: Ben Pfaff <blp at nicira.com>


-----------------------------------------------------------------------

Summary of changes:
 include/openvswitch/types.h |   32 +++++++++++++++++--
 lib/bfd.c                   |    6 ++--
 lib/csum.c                  |    7 +++--
 lib/csum.h                  |    2 +-
 lib/flow.c                  |   26 +++++++--------
 lib/packets.c               |   73 +++++++++++++++++++++++++------------------
 lib/packets.h               |   49 +++++++++++++++++++++++------
 lib/unaligned.h             |   41 ++++++++++++++++++++++++
 ofproto/ofproto-provider.h  |    1 +
 ofproto/ofproto.c           |    9 ++----
 ofproto/pktbuf.c            |    9 +++---
 11 files changed, 184 insertions(+), 71 deletions(-)


hooks/post-receive
-- 
Open vSwitch



More information about the git mailing list