Commit 3d021715 authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller

bonding: adjust style of bond_3ad_rx_indication

No functional changes, adjust the style of bond_3ad_rx_indication to
prepare it for the stats changes:
 - reduce indentation by returning early on wrong length
 - remove extra new lines between switch cases
 - add marker local variable and use it to reduce line length
 - rearrange local variables in reverse xmas tree
 - separate final return
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1435d997
...@@ -2357,57 +2357,54 @@ void bond_3ad_state_machine_handler(struct work_struct *work) ...@@ -2357,57 +2357,54 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave,
u16 length) u16 length)
{ {
struct port *port;
int ret = RX_HANDLER_ANOTHER; int ret = RX_HANDLER_ANOTHER;
struct bond_marker *marker;
struct port *port;
if (length >= sizeof(struct lacpdu)) { if (length < sizeof(struct lacpdu))
return ret;
port = &(SLAVE_AD_INFO(slave)->port);
if (!port->slave) { port = &(SLAVE_AD_INFO(slave)->port);
net_warn_ratelimited("%s: Warning: port of slave %s is uninitialized\n", if (!port->slave) {
slave->dev->name, slave->bond->dev->name); net_warn_ratelimited("%s: Warning: port of slave %s is uninitialized\n",
return ret; slave->dev->name, slave->bond->dev->name);
} return ret;
}
switch (lacpdu->subtype) { switch (lacpdu->subtype) {
case AD_TYPE_LACPDU: case AD_TYPE_LACPDU:
ret = RX_HANDLER_CONSUMED; ret = RX_HANDLER_CONSUMED;
netdev_dbg(slave->bond->dev, netdev_dbg(slave->bond->dev,
"Received LACPDU on port %d slave %s\n", "Received LACPDU on port %d slave %s\n",
port->actor_port_number, port->actor_port_number, slave->dev->name);
slave->dev->name); /* Protect against concurrent state machines */
/* Protect against concurrent state machines */ spin_lock(&slave->bond->mode_lock);
spin_lock(&slave->bond->mode_lock); ad_rx_machine(lacpdu, port);
ad_rx_machine(lacpdu, port); spin_unlock(&slave->bond->mode_lock);
spin_unlock(&slave->bond->mode_lock); break;
case AD_TYPE_MARKER:
ret = RX_HANDLER_CONSUMED;
/* No need to convert fields to Little Endian since we
* don't use the marker's fields.
*/
marker = (struct bond_marker *)lacpdu;
switch (marker->tlv_type) {
case AD_MARKER_INFORMATION_SUBTYPE:
netdev_dbg(slave->bond->dev, "Received Marker Information on port %d\n",
port->actor_port_number);
ad_marker_info_received(marker, port);
break; break;
case AD_MARKER_RESPONSE_SUBTYPE:
case AD_TYPE_MARKER: netdev_dbg(slave->bond->dev, "Received Marker Response on port %d\n",
ret = RX_HANDLER_CONSUMED; port->actor_port_number);
/* No need to convert fields to Little Endian since we ad_marker_response_received(marker, port);
* don't use the marker's fields. break;
*/ default:
netdev_dbg(slave->bond->dev, "Received an unknown Marker subtype on slot %d\n",
switch (((struct bond_marker *)lacpdu)->tlv_type) { port->actor_port_number);
case AD_MARKER_INFORMATION_SUBTYPE:
netdev_dbg(slave->bond->dev, "Received Marker Information on port %d\n",
port->actor_port_number);
ad_marker_info_received((struct bond_marker *)lacpdu, port);
break;
case AD_MARKER_RESPONSE_SUBTYPE:
netdev_dbg(slave->bond->dev, "Received Marker Response on port %d\n",
port->actor_port_number);
ad_marker_response_received((struct bond_marker *)lacpdu, port);
break;
default:
netdev_dbg(slave->bond->dev, "Received an unknown Marker subtype on slot %d\n",
port->actor_port_number);
}
} }
} }
return ret; return ret;
} }
......
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