2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-11 13:57:52 +00:00
Commit Graph

31 Commits

Author SHA1 Message Date
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
Dennis Flynn
86b68e90b3 auto-attach: Cleanup i-sid/vlan mappings associated with lldp-enabled port.
This commit fixes a bug where the i-sid/vlan mapping structures associated with
an lldp-enabled port were not being freed during general port cleanup.

Signed-off-by: Dennis Flynn <drflynn@avaya.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-06-17 07:25:58 -07:00
Jarno Rajahalme
5f03c98321 lib/list: Add LIST_FOR_EACH_POP.
Makes popping each member of the list a bit easier.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-04-06 14:02:28 -07:00
Dennis Flynn
14691214d1 auto-attach: Support latest version of auto-attach LLDP TLVs
The following enhancements to the auto-attach feature are provided

- Support recent modifications to the AA element discovery TLV
- Support recent Avaya Organizationally Unique ID (OUI) change.
  (This will change to IEEE assigned OUI once AA standard has been ratified)
- Remove some Avaya specific #defines

The primary purpose of this commit is to catch up with the latest changes made
to the auto attach TLVs as the Auto Attach feature progresses through the
802.1Q IEEE standards committee. Most notably this includes some minor rework
of the AA element discovery TLV and a recent change to the Avaya OUI value.

Signed-off-by: Dennis Flynn <drflynn@avaya.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-23 13:28:53 -07:00
Pravin B Shelar
09c28fa321 lldp: Fix DPDK build.
Fixes following dp-packet access. Removes netinet/if_ether.h
include due to duplicate definition of ether_addr.

------
In file included from /usr/include/netinet/if_ether.h:60:0,
                 from lib/lldp/lldpd.h:23,
                 from lib/ovs-lldp.h:26,
                 from lib/ovs-lldp.c:30:
/usr/include/net/ethernet.h: At top level:
/usr/include/net/ethernet.h:32:8: error: redefinition of 'struct
ether_addr'
 struct ether_addr
        ^
In file included from
../dpdk/dpdk/x86_64-native-linuxapp-gcc/include/rte_ethdev.h:179:0,
                 from lib/netdev-dpdk.h:18,
                 from lib/dp-packet.h:25,
                 from lib/ovs-lldp.h:23,
                 from lib/ovs-lldp.c:30:
../dpdk/dpdk/x86_64-native-linuxapp-gcc/include/rte_ether.h:83:8: note:
originally defined here
 struct ether_addr {
        ^
lib/ovs-lldp.c: In function 'lldp_process_packet':
lib/ovs-lldp.c:676:30: error: 'const struct dp_packet' has no member
named 'data_'
                    (char *) p->data_, p->size_);
                              ^
lib/ovs-lldp.c:676:40: error: 'const struct dp_packet' has no member
named 'size_'
                    (char *) p->data_, p->size_);
------

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-03-04 09:59:44 -08:00
Ben Pfaff
ac211bdd76 lldp: Fully parenthesize some macro definitions.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:34 -08:00
Ben Pfaff
88f07b5892 lldp: Remove unused definitions from headers.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:34 -08:00
Ben Pfaff
2cbb2d9011 lldpd: Fix use of list of struct lldpd_hardware.
A list of some type should have type "struct ovs_list", not some other
type that encapsulates it.

This ovs_list is a bit puzzling in itself, because it appears to always
have exactly one element.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:34 -08:00
Ben Pfaff
e87a8e67fa lldpd: Fix use of list of struct lldpd_chassis.
A list of some type should have type "struct ovs_list", not some other
type that encapsulates it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:33 -08:00
Ben Pfaff
3622191996 lldpd-structs: Declare Boolean member as one bit, not two.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:33 -08:00
Ben Pfaff
806cc1ebe5 lldpd: Remove unused members from struct lldpd.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:33 -08:00
Ben Pfaff
6db3f8b065 lldp: Use ETH_ADDR_FMT.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:32 -08:00
Ben Pfaff
f94d6e7804 lldp: Remove excessive parentheses.
The OVS style is to usually avoid parentheses in cases like these where
they just make expressions harder to read.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:32 -08:00
Ben Pfaff
a268e134b6 lldpd: Fix return value convention for "send" function.
errno values are positive values, so it's not reasonable to use E2BIG as
an error return with positive values also indicating packet lengths.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:32 -08:00
Ben Pfaff
809fd54df3 lldpd: Remove unused ALIGNED_CAST macro.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:32 -08:00
Ben Pfaff
937f71bf6c lldpd: Use CONTAINER_OF instead of cast, for safety.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:31 -08:00
Ben Pfaff
24738b7e99 lldpd: Remove obsolete comment.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:30 -08:00
Ben Pfaff
f856318e14 lldp: Miscellaneous coding style fixes.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:13 -08:00
Ben Pfaff
1acaf4ac8f lldpd-structs: Fix type of c_id member.
This member is typically an Ethernet address so the appropriate type is
uint8_t, not char.  This eliminates a couple of casts.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:12 -08:00
Ben Pfaff
135706b393 lldp-structs: Fix use of list of struct lldpd_port.
A list of some type should have type "struct ovs_list", not some other
type that encapsulates it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:22:09 -08:00
Ben Pfaff
32590179d4 lldp-structs: Fix use of list of struct lldpd_mgmt.
A list of some type should have type "struct ovs_list", not some other
type that encapsulates it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:19:29 -08:00
Ben Pfaff
854560f8dc lldp-structs: Fix use of list of lldpd_aa_isid_vlan_maps_tlv.
A list of some type should have type "struct ovs_list", not some other
type that encapsulates it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:19:29 -08:00
Ben Pfaff
02c842eb74 lldp: Change representation of ISID to uint32_t.
It's a lot more straightforward to deal with integer values as integers
instead of arrays of bytes.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:19:29 -08:00
Ben Pfaff
e8fa10d754 lldpd-structs: Fix spelling error in message.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:19:28 -08:00
Ben Pfaff
8a42c2d675 lldp: Declare "bool" variables as type "bool".
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:19:28 -08:00
Ben Pfaff
02d593b194 lldp: Use "bool" for boolean variables.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:19:28 -08:00
Ben Pfaff
d9f3b69e7c lldp: Use OVS time functions.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:19:27 -08:00
Ben Pfaff
cc84196628 lldp: Use x*alloc() functions instead of writing them out in-place.
Also use flexible array member instead of array of length 1 in
struct lldpd_frame.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:19:27 -08:00
Ben Pfaff
22736f59c1 lldp: Get rid of POKE macros in favor of inline functions.
The POKE macros previously used here don't match the style usually used in
OVS and they require the user to know exactly how many bytes to reserve.
This commit replaces them by easier-to-use inline functions that take
advantage of the ofpbuf interface.

Also removes a few PEEK macros that weren't used anywhere.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:19:27 -08:00
Dennis Flynn
0477baa93b auto-attach: Add auto-attach support to ofproto layer
Signed-off-by: Ludovic Beliveau <ludovic.beliveau@windriver.com>
Signed-off-by: Dennis Flynn <drflynn@avaya.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:19:26 -08:00
Dennis Flynn
be53a5c447 auto-attach: Initial support for Auto-Attach standard
This commit provides the initial delivery of support for the Auto-Attach
standard to Open vSwitch. This standard describes a compact method of using
IEEE 802.1AB Link Layer Discovery Protocol (LLDP) with a IEEE 802.1aq Shortest
Path Bridging (SPB) network to automatically attach network devices not
supporting IEEE 802.1ah to individual services in a SPB network. Specifically
this commit adds base LLDP support to OVS along with the LLDP extension
required to support Auto-Attach.

The base LLDP code within this commit is adapted from the open source LLDPD
project headed by Vincent Bernat. This base code is augmented with OVS specific
logic which integrates LLDP into OVS and which extends LLDP to support
Auto-Attach. The required build system changes are provided to include this new
Auto-Attach feature.

This is the first of a series of commits. Subsequent commits will be provided
to complete the task of adding Auto-Attach to OVS.

Signed-off-by: Ludovic Beliveau <ludovic.beliveau@windriver.com>
Signed-off-by: Dennis Flynn <drflynn@avaya.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-03-03 16:19:26 -08:00