aboutsummaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2011-08-30 18:17:27 -0700
committerEthan Jackson <ethan@nicira.com>2011-09-08 17:23:26 -0700
commit5f87736966c0a2ef4d5d4a3c5c541d771d45bcb3 (patch)
tree6ed1df6afad1faa9631088d7b3e75cc88e2d2e49 /ofproto
parent7588b571759fe4aff24e76096640eb073fc90a05 (diff)
lacp: Clean up LACP module interface.
There's no particular reason to force users of the LACP module to be aware of the lacp_pdu structure. This patch hides that information in the LACP module implementation. This results in slightly cleaner code which is more consistent with the CFM module.
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/ofproto-dpif.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index f09c230d..478768f0 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -1111,7 +1111,7 @@ bundle_remove(struct ofport *port_)
}
static void
-send_pdu_cb(void *port_, const struct lacp_pdu *pdu)
+send_pdu_cb(void *port_, const void *pdu, size_t pdu_size)
{
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 10);
struct ofport_dpif *port = port_;
@@ -1120,13 +1120,14 @@ send_pdu_cb(void *port_, const struct lacp_pdu *pdu)
error = netdev_get_etheraddr(port->up.netdev, ea);
if (!error) {
- struct lacp_pdu *packet_pdu;
struct ofpbuf packet;
+ void *packet_pdu;
ofpbuf_init(&packet, 0);
packet_pdu = eth_compose(&packet, eth_addr_lacp, ea, ETH_TYPE_LACP,
- sizeof *packet_pdu);
- *packet_pdu = *pdu;
+ pdu_size);
+ memcpy(packet_pdu, pdu, pdu_size);
+
error = netdev_send(port->up.netdev, &packet);
if (error) {
VLOG_WARN_RL(&rl, "port %s: sending LACP PDU on iface %s failed "
@@ -1622,10 +1623,7 @@ process_special(struct ofproto_dpif *ofproto, const struct flow *flow,
} else if (flow->dl_type == htons(ETH_TYPE_LACP)) {
struct ofport_dpif *port = get_ofp_port(ofproto, flow->in_port);
if (packet && port && port->bundle && port->bundle->lacp) {
- const struct lacp_pdu *pdu = parse_lacp_packet(packet);
- if (pdu) {
- lacp_process_pdu(port->bundle->lacp, port, pdu);
- }
+ lacp_process_packet(port->bundle->lacp, port, packet);
}
return true;
}