Commit 9ac3524a authored by Nils Carlson's avatar Nils Carlson Committed by David S. Miller

bonding 802.3ad: Rename rx_machine_lock to state_machine_lock

Rename the rx_machine_lock to state_machine_lock as this makes more
sense in light of it now protecting all the state machines against
concurrency.
Signed-off-by: default avatarNils Carlson <nils.carlson@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 16d79d7d
...@@ -281,23 +281,23 @@ static inline int __check_agg_selection_timer(struct port *port) ...@@ -281,23 +281,23 @@ static inline int __check_agg_selection_timer(struct port *port)
} }
/** /**
* __get_rx_machine_lock - lock the port's RX machine * __get_state_machine_lock - lock the port's state machines
* @port: the port we're looking at * @port: the port we're looking at
* *
*/ */
static inline void __get_rx_machine_lock(struct port *port) static inline void __get_state_machine_lock(struct port *port)
{ {
spin_lock_bh(&(SLAVE_AD_INFO(port->slave).rx_machine_lock)); spin_lock_bh(&(SLAVE_AD_INFO(port->slave).state_machine_lock));
} }
/** /**
* __release_rx_machine_lock - unlock the port's RX machine * __release_state_machine_lock - unlock the port's state machines
* @port: the port we're looking at * @port: the port we're looking at
* *
*/ */
static inline void __release_rx_machine_lock(struct port *port) static inline void __release_state_machine_lock(struct port *port)
{ {
spin_unlock_bh(&(SLAVE_AD_INFO(port->slave).rx_machine_lock)); spin_unlock_bh(&(SLAVE_AD_INFO(port->slave).state_machine_lock));
} }
/** /**
...@@ -388,14 +388,14 @@ static u8 __get_duplex(struct port *port) ...@@ -388,14 +388,14 @@ static u8 __get_duplex(struct port *port)
} }
/** /**
* __initialize_port_locks - initialize a port's RX machine spinlock * __initialize_port_locks - initialize a port's STATE machine spinlock
* @port: the port we're looking at * @port: the port we're looking at
* *
*/ */
static inline void __initialize_port_locks(struct port *port) static inline void __initialize_port_locks(struct port *port)
{ {
// make sure it isn't called twice // make sure it isn't called twice
spin_lock_init(&(SLAVE_AD_INFO(port->slave).rx_machine_lock)); spin_lock_init(&(SLAVE_AD_INFO(port->slave).state_machine_lock));
} }
//conversions //conversions
...@@ -2154,7 +2154,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work) ...@@ -2154,7 +2154,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
* by all (e.g., port->sm_vars). ad_rx_machine may run * by all (e.g., port->sm_vars). ad_rx_machine may run
* concurrently due to incoming LACPDU. * concurrently due to incoming LACPDU.
*/ */
__get_rx_machine_lock(port); __get_state_machine_lock(port);
ad_rx_machine(NULL, port); ad_rx_machine(NULL, port);
ad_periodic_machine(port); ad_periodic_machine(port);
...@@ -2166,7 +2166,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work) ...@@ -2166,7 +2166,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
if (port->sm_vars & AD_PORT_BEGIN) if (port->sm_vars & AD_PORT_BEGIN)
port->sm_vars &= ~AD_PORT_BEGIN; port->sm_vars &= ~AD_PORT_BEGIN;
__release_rx_machine_lock(port); __release_state_machine_lock(port);
} }
re_arm: re_arm:
...@@ -2204,9 +2204,9 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u ...@@ -2204,9 +2204,9 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u
pr_debug("Received LACPDU on port %d\n", pr_debug("Received LACPDU on port %d\n",
port->actor_port_number); port->actor_port_number);
/* Protect against concurrent state machines */ /* Protect against concurrent state machines */
__get_rx_machine_lock(port); __get_state_machine_lock(port);
ad_rx_machine(lacpdu, port); ad_rx_machine(lacpdu, port);
__release_rx_machine_lock(port); __release_state_machine_lock(port);
break; break;
case AD_TYPE_MARKER: case AD_TYPE_MARKER:
......
...@@ -264,7 +264,8 @@ struct ad_bond_info { ...@@ -264,7 +264,8 @@ struct ad_bond_info {
struct ad_slave_info { struct ad_slave_info {
struct aggregator aggregator; // 802.3ad aggregator structure struct aggregator aggregator; // 802.3ad aggregator structure
struct port port; // 802.3ad port structure struct port port; // 802.3ad port structure
spinlock_t rx_machine_lock; // To avoid race condition between callback and receive interrupt spinlock_t state_machine_lock; /* mutex state machines vs.
incoming LACPDU */
u16 id; u16 id;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment