From b49b7df441d6609f9a1e20720b491c75507d8fba Mon Sep 17 00:00:00 2001
From: Ethan Jackson <ethan@nicira.com>
Date: Wed, 13 Apr 2011 14:55:19 -0700
Subject: [PATCH] lacp: New function lacp_slave_get_port_id().

Will be used in future commits.
---
 lib/lacp.c | 8 ++++++++
 lib/lacp.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/lib/lacp.c b/lib/lacp.c
index 27cc2964..87514e30 100644
--- a/lib/lacp.c
+++ b/lib/lacp.c
@@ -272,6 +272,14 @@ lacp_slave_may_enable(const struct lacp *lacp, const void *slave_)
     }
 }
 
+/* Returns the port ID used for 'slave_' in LACP communications. */
+uint16_t
+lacp_slave_get_port_id(const struct lacp *lacp, const void *slave_)
+{
+    struct slave *slave = slave_lookup(lacp, slave_);
+    return slave->port_id;
+}
+
 /* This function should be called periodically to update 'lacp'. */
 void
 lacp_run(struct lacp *lacp, lacp_send_pdu *send_pdu)
diff --git a/lib/lacp.h b/lib/lacp.h
index 29383dcd..a4865423 100644
--- a/lib/lacp.h
+++ b/lib/lacp.h
@@ -52,6 +52,7 @@ void lacp_slave_unregister(struct lacp *, const void *slave);
 void lacp_slave_enable(struct lacp *lacp, void *slave_, bool enabled);
 void lacp_slave_carrier_changed(const struct lacp *, const void *slave);
 bool lacp_slave_may_enable(const struct lacp *, const void *slave);
+uint16_t lacp_slave_get_port_id(const struct lacp *, const void *slave);
 
 /* Callback function for lacp_run() for sending a LACP PDU. */
 typedef void lacp_send_pdu(void *slave, const struct lacp_pdu *);
-- 
2.30.2