[ovs-dev] [PATCH 2/3] lacp: Remove LACP_[FAST|SLOW]_TIME_RX macros.

Ethan Jackson ethan at nicira.com
Mon Apr 18 21:32:45 UTC 2011


The receive rate for a LACP packets is simply 3 times the
transmission rate.  It doesn't make sense to maintain separate
macros for these values especially since future patches will allow
arbitrary transmission rates.
---
 lib/lacp.c |    7 +++----
 lib/lacp.h |    3 +--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/lacp.c b/lib/lacp.c
index 7d9275c..82d07c1 100644
--- a/lib/lacp.c
+++ b/lib/lacp.c
@@ -201,9 +201,8 @@ lacp_process_pdu(struct lacp *lacp, const void *slave_,
     struct slave *slave = slave_lookup(lacp, slave_);
 
     slave->status = LACP_CURRENT;
-    timer_set_duration(&slave->rx, (lacp->fast
-                                    ? LACP_FAST_TIME_RX
-                                    : LACP_SLOW_TIME_RX));
+    timer_set_duration(&slave->rx, LACP_RX_MULTIPLIER *
+                       (lacp->fast ? LACP_FAST_TIME_TX : LACP_SLOW_TIME_TX));
 
     slave->ntt_actor = pdu->partner;
 
@@ -478,7 +477,7 @@ slave_set_expired(struct slave *slave)
     slave->status = LACP_EXPIRED;
     slave->partner.state |= LACP_STATE_TIME;
     slave->partner.state &= ~LACP_STATE_SYNC;
-    timer_set_duration(&slave->rx, LACP_FAST_TIME_RX);
+    timer_set_duration(&slave->rx, LACP_RX_MULTIPLIER * LACP_FAST_TIME_TX);
 }
 
 static void
diff --git a/lib/lacp.h b/lib/lacp.h
index ec215ea..f2c9469 100644
--- a/lib/lacp.h
+++ b/lib/lacp.h
@@ -33,8 +33,7 @@
 
 #define LACP_FAST_TIME_TX 1000  /* Fast transmission rate. */
 #define LACP_SLOW_TIME_TX 30000 /* Slow transmission rate. */
-#define LACP_FAST_TIME_RX (LACP_FAST_TIME_TX * 3) /* Fast receive rate. */
-#define LACP_SLOW_TIME_RX (LACP_SLOW_TIME_TX * 3) /* Slow receive rate. */
+#define LACP_RX_MULTIPLIER 3    /* Multiply by TX rate to get RX rate. */
 
 #define LACP_INFO_LEN 15
 struct lacp_info {
-- 
1.7.4.2




More information about the dev mailing list