diff options
author | Holger Eitzenberger <holger@eitzenberger.org> | 2008-12-26 16:28:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-26 16:28:33 -0500 |
commit | 7addeef6b15c9b7cffaaf40ec5b5b0940145ec16 (patch) | |
tree | 5f39d1e5d67d03b99dbee332448ab29767b6fddc /drivers/net | |
parent | 87f422f8618c541db0f96194cca9465817f76b89 (diff) |
802.3ad: initialize ports LACPDU from const initializer
Save some text by initializing ports LACPDU from const initializer,
then get rid of ad_initialize_lacpdu().
Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bonding/bond_3ad.c | 61 |
1 files changed, 12 insertions, 49 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 85cba316d1ea..ef46a968004e 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -107,7 +107,6 @@ static void ad_agg_selection_logic(struct aggregator *aggregator); | |||
107 | static void ad_clear_agg(struct aggregator *aggregator); | 107 | static void ad_clear_agg(struct aggregator *aggregator); |
108 | static void ad_initialize_agg(struct aggregator *aggregator); | 108 | static void ad_initialize_agg(struct aggregator *aggregator); |
109 | static void ad_initialize_port(struct port *port, int lacp_fast); | 109 | static void ad_initialize_port(struct port *port, int lacp_fast); |
110 | static void ad_initialize_lacpdu(struct lacpdu *Lacpdu); | ||
111 | static void ad_enable_collecting_distributing(struct port *port); | 110 | static void ad_enable_collecting_distributing(struct port *port); |
112 | static void ad_disable_collecting_distributing(struct port *port); | 111 | static void ad_disable_collecting_distributing(struct port *port); |
113 | static void ad_marker_info_received(struct bond_marker *marker_info, struct port *port); | 112 | static void ad_marker_info_received(struct bond_marker *marker_info, struct port *port); |
@@ -1659,6 +1658,17 @@ static void ad_initialize_port(struct port *port, int lacp_fast) | |||
1659 | .port_priority = 0xff, | 1658 | .port_priority = 0xff, |
1660 | .port_state = 1, | 1659 | .port_state = 1, |
1661 | }; | 1660 | }; |
1661 | static const struct lacpdu lacpdu = { | ||
1662 | .subtype = 0x01, | ||
1663 | .version_number = 0x01, | ||
1664 | .tlv_type_actor_info = 0x01, | ||
1665 | .actor_information_length = 0x14, | ||
1666 | .tlv_type_partner_info = 0x02, | ||
1667 | .partner_information_length = 0x14, | ||
1668 | .tlv_type_collector_info = 0x03, | ||
1669 | .collector_information_length = 0x10, | ||
1670 | .collector_max_delay = htons(AD_COLLECTOR_MAX_DELAY), | ||
1671 | }; | ||
1662 | 1672 | ||
1663 | if (port) { | 1673 | if (port) { |
1664 | port->actor_port_number = 1; | 1674 | port->actor_port_number = 1; |
@@ -1695,7 +1705,7 @@ static void ad_initialize_port(struct port *port, int lacp_fast) | |||
1695 | port->next_port_in_aggregator = NULL; | 1705 | port->next_port_in_aggregator = NULL; |
1696 | port->transaction_id = 0; | 1706 | port->transaction_id = 0; |
1697 | 1707 | ||
1698 | ad_initialize_lacpdu(&(port->lacpdu)); | 1708 | memcpy(&port->lacpdu, &lacpdu, sizeof(lacpdu)); |
1699 | } | 1709 | } |
1700 | } | 1710 | } |
1701 | 1711 | ||
@@ -1804,53 +1814,6 @@ static void ad_marker_response_received(struct bond_marker *marker, | |||
1804 | // DO NOTHING, SINCE WE DECIDED NOT TO IMPLEMENT THIS FEATURE FOR NOW | 1814 | // DO NOTHING, SINCE WE DECIDED NOT TO IMPLEMENT THIS FEATURE FOR NOW |
1805 | } | 1815 | } |
1806 | 1816 | ||
1807 | /** | ||
1808 | * ad_initialize_lacpdu - initialize a given lacpdu structure | ||
1809 | * @lacpdu: lacpdu structure to initialize | ||
1810 | * | ||
1811 | */ | ||
1812 | static void ad_initialize_lacpdu(struct lacpdu *lacpdu) | ||
1813 | { | ||
1814 | u16 index; | ||
1815 | |||
1816 | // initialize lacpdu data | ||
1817 | lacpdu->subtype = 0x01; | ||
1818 | lacpdu->version_number = 0x01; | ||
1819 | lacpdu->tlv_type_actor_info = 0x01; | ||
1820 | lacpdu->actor_information_length = 0x14; | ||
1821 | // lacpdu->actor_system_priority updated on send | ||
1822 | // lacpdu->actor_system updated on send | ||
1823 | // lacpdu->actor_key updated on send | ||
1824 | // lacpdu->actor_port_priority updated on send | ||
1825 | // lacpdu->actor_port updated on send | ||
1826 | // lacpdu->actor_state updated on send | ||
1827 | lacpdu->tlv_type_partner_info = 0x02; | ||
1828 | lacpdu->partner_information_length = 0x14; | ||
1829 | for (index=0; index<=2; index++) { | ||
1830 | lacpdu->reserved_3_1[index]=0; | ||
1831 | } | ||
1832 | // lacpdu->partner_system_priority updated on send | ||
1833 | // lacpdu->partner_system updated on send | ||
1834 | // lacpdu->partner_key updated on send | ||
1835 | // lacpdu->partner_port_priority updated on send | ||
1836 | // lacpdu->partner_port updated on send | ||
1837 | // lacpdu->partner_state updated on send | ||
1838 | for (index=0; index<=2; index++) { | ||
1839 | lacpdu->reserved_3_2[index]=0; | ||
1840 | } | ||
1841 | lacpdu->tlv_type_collector_info = 0x03; | ||
1842 | lacpdu->collector_information_length= 0x10; | ||
1843 | lacpdu->collector_max_delay = htons(AD_COLLECTOR_MAX_DELAY); | ||
1844 | for (index=0; index<=11; index++) { | ||
1845 | lacpdu->reserved_12[index]=0; | ||
1846 | } | ||
1847 | lacpdu->tlv_type_terminator = 0x00; | ||
1848 | lacpdu->terminator_length = 0; | ||
1849 | for (index=0; index<=49; index++) { | ||
1850 | lacpdu->reserved_50[index]=0; | ||
1851 | } | ||
1852 | } | ||
1853 | |||
1854 | ////////////////////////////////////////////////////////////////////////////////////// | 1817 | ////////////////////////////////////////////////////////////////////////////////////// |
1855 | // ================= AD exported functions to the main bonding code ================== | 1818 | // ================= AD exported functions to the main bonding code ================== |
1856 | ////////////////////////////////////////////////////////////////////////////////////// | 1819 | ////////////////////////////////////////////////////////////////////////////////////// |