diff options
author | Holger Eitzenberger <holger@eitzenberger.org> | 2008-12-26 16:40:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-26 16:40:48 -0500 |
commit | e4ac43200fd6b8b8de3b487e74e74d3742f70d79 (patch) | |
tree | 31dbd043da17995eea122e4504cc8bc26b11751e /drivers/net/bonding | |
parent | 7addeef6b15c9b7cffaaf40ec5b5b0940145ec16 (diff) |
802.3ad: generalize out mac address initializer
Generalize out mac address initializer for the LACPDU multicast
address and use in two places. Remove the now unused
AD_MULTICAST_LACPDU_ADDR.
Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_3ad.c | 24 | ||||
-rw-r--r-- | drivers/net/bonding/bond_3ad.h | 1 |
2 files changed, 14 insertions, 11 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index ef46a968004e..fb32b29751e1 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -95,6 +95,8 @@ static struct mac_addr null_mac_addr = {{0, 0, 0, 0, 0, 0}}; | |||
95 | static u16 ad_ticks_per_sec; | 95 | static u16 ad_ticks_per_sec; |
96 | static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000; | 96 | static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000; |
97 | 97 | ||
98 | static const u8 lacpdu_mcast_addr[ETH_ALEN] = MULTICAST_LACPDU_ADDR; | ||
99 | |||
98 | // ================= main 802.3ad protocol functions ================== | 100 | // ================= main 802.3ad protocol functions ================== |
99 | static int ad_lacpdu_send(struct port *port); | 101 | static int ad_lacpdu_send(struct port *port); |
100 | static int ad_marker_send(struct port *port, struct bond_marker *marker); | 102 | static int ad_marker_send(struct port *port, struct bond_marker *marker); |
@@ -824,7 +826,6 @@ static int ad_lacpdu_send(struct port *port) | |||
824 | struct sk_buff *skb; | 826 | struct sk_buff *skb; |
825 | struct lacpdu_header *lacpdu_header; | 827 | struct lacpdu_header *lacpdu_header; |
826 | int length = sizeof(struct lacpdu_header); | 828 | int length = sizeof(struct lacpdu_header); |
827 | struct mac_addr lacpdu_multicast_address = AD_MULTICAST_LACPDU_ADDR; | ||
828 | 829 | ||
829 | skb = dev_alloc_skb(length); | 830 | skb = dev_alloc_skb(length); |
830 | if (!skb) { | 831 | if (!skb) { |
@@ -839,10 +840,12 @@ static int ad_lacpdu_send(struct port *port) | |||
839 | 840 | ||
840 | lacpdu_header = (struct lacpdu_header *)skb_put(skb, length); | 841 | lacpdu_header = (struct lacpdu_header *)skb_put(skb, length); |
841 | 842 | ||
842 | lacpdu_header->ad_header.destination_address = lacpdu_multicast_address; | 843 | memcpy(lacpdu_header->ad_header.destination_address.mac_addr_value, |
843 | /* Note: source addres is set to be the member's PERMANENT address, because we use it | 844 | lacpdu_mcast_addr, ETH_ALEN); |
844 | to identify loopback lacpdus in receive. */ | 845 | /* Note: source addres is set to be the member's PERMANENT address, |
845 | lacpdu_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr)); | 846 | because we use it to identify loopback lacpdus in receive. */ |
847 | memcpy(lacpdu_header->ad_header.source_address.mac_addr_value, | ||
848 | slave->perm_hwaddr, ETH_ALEN); | ||
846 | lacpdu_header->ad_header.length_type = PKT_TYPE_LACPDU; | 849 | lacpdu_header->ad_header.length_type = PKT_TYPE_LACPDU; |
847 | 850 | ||
848 | lacpdu_header->lacpdu = port->lacpdu; // struct copy | 851 | lacpdu_header->lacpdu = port->lacpdu; // struct copy |
@@ -866,7 +869,6 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker) | |||
866 | struct sk_buff *skb; | 869 | struct sk_buff *skb; |
867 | struct bond_marker_header *marker_header; | 870 | struct bond_marker_header *marker_header; |
868 | int length = sizeof(struct bond_marker_header); | 871 | int length = sizeof(struct bond_marker_header); |
869 | struct mac_addr lacpdu_multicast_address = AD_MULTICAST_LACPDU_ADDR; | ||
870 | 872 | ||
871 | skb = dev_alloc_skb(length + 16); | 873 | skb = dev_alloc_skb(length + 16); |
872 | if (!skb) { | 874 | if (!skb) { |
@@ -882,10 +884,12 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker) | |||
882 | 884 | ||
883 | marker_header = (struct bond_marker_header *)skb_put(skb, length); | 885 | marker_header = (struct bond_marker_header *)skb_put(skb, length); |
884 | 886 | ||
885 | marker_header->ad_header.destination_address = lacpdu_multicast_address; | 887 | memcpy(marker_header->ad_header.destination_address.mac_addr_value, |
886 | /* Note: source addres is set to be the member's PERMANENT address, because we use it | 888 | lacpdu_mcast_addr, ETH_ALEN); |
887 | to identify loopback MARKERs in receive. */ | 889 | /* Note: source addres is set to be the member's PERMANENT address, |
888 | marker_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr)); | 890 | because we use it to identify loopback MARKERs in receive. */ |
891 | memcpy(marker_header->ad_header.source_address.mac_addr_value, | ||
892 | slave->perm_hwaddr, ETH_ALEN); | ||
889 | marker_header->ad_header.length_type = PKT_TYPE_LACPDU; | 893 | marker_header->ad_header.length_type = PKT_TYPE_LACPDU; |
890 | 894 | ||
891 | marker_header->marker = *marker; // struct copy | 895 | marker_header->marker = *marker; // struct copy |
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h index 68b1c51ef3bd..3aab1c2b3f00 100644 --- a/drivers/net/bonding/bond_3ad.h +++ b/drivers/net/bonding/bond_3ad.h | |||
@@ -33,7 +33,6 @@ | |||
33 | #define AD_TIMER_INTERVAL 100 /*msec*/ | 33 | #define AD_TIMER_INTERVAL 100 /*msec*/ |
34 | 34 | ||
35 | #define MULTICAST_LACPDU_ADDR {0x01, 0x80, 0xC2, 0x00, 0x00, 0x02} | 35 | #define MULTICAST_LACPDU_ADDR {0x01, 0x80, 0xC2, 0x00, 0x00, 0x02} |
36 | #define AD_MULTICAST_LACPDU_ADDR {MULTICAST_LACPDU_ADDR} | ||
37 | 36 | ||
38 | #define AD_LACP_SLOW 0 | 37 | #define AD_LACP_SLOW 0 |
39 | #define AD_LACP_FAST 1 | 38 | #define AD_LACP_FAST 1 |