From patchwork Tue Dec 23 22:01:08 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: holger@eitzenberger.org X-Patchwork-Id: 15483 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 642E3DDF44 for ; Wed, 24 Dec 2008 09:06:29 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752189AbYLWWGP (ORCPT ); Tue, 23 Dec 2008 17:06:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751659AbYLWWGL (ORCPT ); Tue, 23 Dec 2008 17:06:11 -0500 Received: from moutng.kundenserver.de ([212.227.126.186]:55899 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751723AbYLWWGE (ORCPT ); Tue, 23 Dec 2008 17:06:04 -0500 Received: from kruemel.eitzenberger.org (p54AD34A1.dip0.t-ipconnect.de [84.173.52.161]) by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis) id 0ML29c-1LFFO52fgU-00022A; Tue, 23 Dec 2008 23:06:01 +0100 Received: from [192.168.11.10] (helo=jonathan.eitzenberger.org ident=holger) by kruemel.eitzenberger.org with smtp (Exim 4.50) id 1LFFO3-0005S3-Un; Tue, 23 Dec 2008 23:06:01 +0100 Received: by jonathan.eitzenberger.org (sSMTP sendmail emulation); Tue, 23 Dec 2008 23:05:59 +0100 Message-Id: <20081223220559.192000322@jonathan.eitzenberger.org> References: <20081223220101.747816175@jonathan.eitzenberger.org> User-Agent: quilt/0.46-1 Date: Tue, 23 Dec 2008 23:01:08 +0100 From: Holger Eitzenberger To: David Miller Cc: Jay Vosburgh , netdev@vger.kernel.org Subject: [patch 07/10] 802.3ad: use standard ethhdr instead of ad_header Content-Disposition: inline; filename=bonding-3ad-ad_header-is-ethhdr.diff X-Provags-ID: V01U2FsdGVkX1+0BKIBu/8kEkKrA1BLDwwKtESLXmuuurmwCgU zlnwZBznv7TBf/Ff9vVHjYdyeEF6t6JrqXZLdAYHizl7Inmvrb 3UirN5NVinqGp3k2kDUafgcVMqtbSNEPXzTY8bFdyE= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Index: bonding-2.6/drivers/net/bonding/bond_3ad.h =================================================================== --- bonding-2.6.orig/drivers/net/bonding/bond_3ad.h +++ bonding-2.6/drivers/net/bonding/bond_3ad.h @@ -105,12 +105,6 @@ typedef enum { #pragma pack(1) -typedef struct ad_header { - struct mac_addr destination_address; - struct mac_addr source_address; - __be16 length_type; -} ad_header_t; - // Link Aggregation Control Protocol(LACP) data unit structure(43.4.2.2 in the 802.3ad standard) typedef struct lacpdu { u8 subtype; // = LACP(= 0x01) @@ -143,7 +137,7 @@ typedef struct lacpdu { } lacpdu_t; typedef struct lacpdu_header { - struct ad_header ad_header; + struct ethhdr hdr; struct lacpdu lacpdu; } lacpdu_header_t; @@ -164,7 +158,7 @@ typedef struct bond_marker { } bond_marker_t; typedef struct bond_marker_header { - struct ad_header ad_header; + struct ethhdr hdr; struct bond_marker marker; } bond_marker_header_t; Index: bonding-2.6/drivers/net/bonding/bond_3ad.c =================================================================== --- bonding-2.6.orig/drivers/net/bonding/bond_3ad.c +++ bonding-2.6/drivers/net/bonding/bond_3ad.c @@ -840,13 +840,11 @@ static int ad_lacpdu_send(struct port *p lacpdu_header = (struct lacpdu_header *)skb_put(skb, length); - memcpy(lacpdu_header->ad_header.destination_address.mac_addr_value, - lacpdu_mcast_addr, ETH_ALEN); + memcpy(lacpdu_header->hdr.h_dest, lacpdu_mcast_addr, ETH_ALEN); /* Note: source addres is set to be the member's PERMANENT address, because we use it to identify loopback lacpdus in receive. */ - memcpy(lacpdu_header->ad_header.source_address.mac_addr_value, - slave->perm_hwaddr, ETH_ALEN); - lacpdu_header->ad_header.length_type = PKT_TYPE_LACPDU; + memcpy(lacpdu_header->hdr.h_source, slave->perm_hwaddr, ETH_ALEN); + lacpdu_header->hdr.h_proto = PKT_TYPE_LACPDU; lacpdu_header->lacpdu = port->lacpdu; // struct copy @@ -884,13 +882,11 @@ static int ad_marker_send(struct port *p marker_header = (struct bond_marker_header *)skb_put(skb, length); - memcpy(marker_header->ad_header.destination_address.mac_addr_value, - lacpdu_mcast_addr, ETH_ALEN); + memcpy(marker_header->hdr.h_dest, lacpdu_mcast_addr, ETH_ALEN); /* Note: source addres is set to be the member's PERMANENT address, because we use it to identify loopback MARKERs in receive. */ - memcpy(marker_header->ad_header.source_address.mac_addr_value, - slave->perm_hwaddr, ETH_ALEN); - marker_header->ad_header.length_type = PKT_TYPE_LACPDU; + memcpy(marker_header->hdr.h_source, slave->perm_hwaddr, ETH_ALEN); + marker_header->hdr.h_proto = PKT_TYPE_LACPDU; marker_header->marker = *marker; // struct copy