Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

802.3ad: use standard ethhdr instead of ad_header

802.3ad has its own ethhdr-like structure in the form of an ad_header,
which is at the start of both the LACPDU and marker PDU. Both are
the same from the struct values, both are packed as well.

It's therefore perfectly fine to replace the ad_header by the ethhdr
and to remove its definition.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Holger Eitzenberger and committed by
David S. Miller
e727149e e4ac4320

+8 -18
+6 -10
drivers/net/bonding/bond_3ad.c
··· 840 840 841 841 lacpdu_header = (struct lacpdu_header *)skb_put(skb, length); 842 842 843 - memcpy(lacpdu_header->ad_header.destination_address.mac_addr_value, 844 - lacpdu_mcast_addr, ETH_ALEN); 843 + memcpy(lacpdu_header->hdr.h_dest, lacpdu_mcast_addr, ETH_ALEN); 845 844 /* Note: source addres is set to be the member's PERMANENT address, 846 845 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); 849 - lacpdu_header->ad_header.length_type = PKT_TYPE_LACPDU; 846 + memcpy(lacpdu_header->hdr.h_source, slave->perm_hwaddr, ETH_ALEN); 847 + lacpdu_header->hdr.h_proto = PKT_TYPE_LACPDU; 850 848 851 849 lacpdu_header->lacpdu = port->lacpdu; // struct copy 852 850 ··· 882 884 883 885 marker_header = (struct bond_marker_header *)skb_put(skb, length); 884 886 885 - memcpy(marker_header->ad_header.destination_address.mac_addr_value, 886 - lacpdu_mcast_addr, ETH_ALEN); 887 + memcpy(marker_header->hdr.h_dest, lacpdu_mcast_addr, ETH_ALEN); 887 888 /* Note: source addres is set to be the member's PERMANENT address, 888 889 because we use it to identify loopback MARKERs in receive. */ 889 - memcpy(marker_header->ad_header.source_address.mac_addr_value, 890 - slave->perm_hwaddr, ETH_ALEN); 891 - marker_header->ad_header.length_type = PKT_TYPE_LACPDU; 890 + memcpy(marker_header->hdr.h_source, slave->perm_hwaddr, ETH_ALEN); 891 + marker_header->hdr.h_proto = PKT_TYPE_LACPDU; 892 892 893 893 marker_header->marker = *marker; // struct copy 894 894
+2 -8
drivers/net/bonding/bond_3ad.h
··· 105 105 106 106 #pragma pack(1) 107 107 108 - typedef struct ad_header { 109 - struct mac_addr destination_address; 110 - struct mac_addr source_address; 111 - __be16 length_type; 112 - } ad_header_t; 113 - 114 108 // Link Aggregation Control Protocol(LACP) data unit structure(43.4.2.2 in the 802.3ad standard) 115 109 typedef struct lacpdu { 116 110 u8 subtype; // = LACP(= 0x01) ··· 137 143 } lacpdu_t; 138 144 139 145 typedef struct lacpdu_header { 140 - struct ad_header ad_header; 146 + struct ethhdr hdr; 141 147 struct lacpdu lacpdu; 142 148 } lacpdu_header_t; 143 149 ··· 158 164 } bond_marker_t; 159 165 160 166 typedef struct bond_marker_header { 161 - struct ad_header ad_header; 167 + struct ethhdr hdr; 162 168 struct bond_marker marker; 163 169 } bond_marker_header_t; 164 170