2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00
Commit Graph

13 Commits

Author SHA1 Message Date
Jason Wessel
d34a1cc025 Python3 compatibility: Convert print statements
This patch fixes up all the print statements to work with python3 or
python2.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-07-06 14:06:08 -07:00
Ben Pfaff
b2342f7a4b types: New struct eth_addr64 for EUI-64 identifiers.
This will see its first real user in the following commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
2017-04-07 15:50:31 -07:00
Ben Pfaff
a27a0ef0ae check-structs: struct eth_addr has alignment 2, not 1.
It consists of ovs_be16 elements, so it has 16-bit alignment.

(This doesn't make a difference for any actual OpenFlow protocol elements.)

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
2017-04-06 16:50:48 -07:00
Jarno Rajahalme
74ff3298c8 userspace: Define and use struct eth_addr.
Define struct eth_addr and use it instead of a uint8_t array for all
ethernet addresses in OVS userspace.  The struct is always the right
size, and it can be assigned without an explicit memcpy, which makes
code more readable.

"struct eth_addr" is a good type name for this as many utility
functions are already named accordingly.

struct eth_addr can be accessed as bytes as well as ovs_be16's, which
makes the struct 16-bit aligned.  All use seems to be 16-bit aligned,
so some algorithms on the ethernet addresses can be made a bit more
efficient making use of this fact.

As the struct fits into a register (in 64-bit systems) we pass it by
value when possible.

This patch also changes the few uses of Linux specific ETH_ALEN to
OVS's own ETH_ADDR_LEN, and removes the OFP_ETH_ALEN, as it is no
longer needed.

This work stemmed from a desire to make all struct flow members
assignable for unrelated exploration purposes.  However, I think this
might be a nice code readability improvement by itself.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
2015-08-28 14:55:11 -07:00
Thomas Graf
1825f2ec0d include: Use #include <.*> in public headers.
Required to make the headers installable.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-11-12 10:15:35 -08:00
Jarno Rajahalme
31a9e63f0f include/openflow: Moved remaining common definitions from openflow-1.0.h
Moved remaining common definitions from openflow-1.0.h to
 openflow-common.h and renamed 1.0 specific definitions with
 the "10" infix. Added hstamp rules for new headers, fixed
 non-ASCII characters in openflow-1.3.h, Commented out
 trailing zero-length data members.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-12-03 13:03:06 -08:00
Ben Pfaff
cd03c7c859 check-structs: Disallow uint<N>_t because ovs_be<N> should always be used.
The header files that check-structs checks should only contain big-endian
data, never native-endian data, so disallow uint<N>_t entirely.  (We had
a couple of mistakes in this area until recently.)

uint8_t is an obvious exception.

Reported-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-04-02 09:06:11 -07:00
Ben Pfaff
539315543c Move content of openflow.h into openflow-1.0.h.
This prepares for a gradual introduction of definitions from OpenFlow
1.1 and later, by making it clearer that the current definitions are
specific to OpenFlow 1.0.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-03-07 13:59:02 -08:00
Ben Pfaff
f937ccc232 check-structs: Add check that OFP_ASSERT is checking the right structures.
This avoids a fairly common issue in which a developer cuts and pastes a
structure definition and forgets to update the structure name inside the
OFP_ASSERT, so that the new structure's size doesn't really get checked at
all.
2011-10-04 09:26:14 -07:00
Ben Pfaff
c4617b3c28 openflow: Use types and accessors for half-aligned 64-bit fields.
Without this commit, many of the unit tests for ofp-print.c fail with bus
errors on RISC architectures (tested on sparc) and presumably so would any
other code that uses these same struct members.
2011-02-05 13:14:49 -08:00
Ben Pfaff
a44d74d752 python: Use os.path.basename instead of open-coding it.
Reported-by: Justin Pettit <jpettit@nicira.com>
2011-01-12 13:51:42 -08:00
Ben Pfaff
fba473391b Make the ovs_be<N> types generally available.
Using these types for data in network byte order makes code clearer, and
allows the "sparse" checker to give warnings for misuse.
2010-10-29 09:48:47 -07:00
Ben Pfaff
05b3c97be6 Add build checks for portable OpenFlow structure padding and alignment.
This causes the build to fail with an error message if openflow.h contains
a structure whose members are not aligned in a portable way.
2010-01-25 10:49:31 -08:00