From: Holger Eitzenberger <holger@eitzenberger.org>
To: David Miller <davem@davemloft.net>
Cc: Jay Vosburgh <fubar@us.ibm.com>, netdev@vger.kernel.org
Subject: [patch 09/10] 802.3ad: remove public bond_marker_header
Date: Tue, 23 Dec 2008 23:01:10 +0100 [thread overview]
Message-ID: <20081223220601.771614232@jonathan.eitzenberger.org> (raw)
In-Reply-To: 20081223220101.747816175@jonathan.eitzenberger.org
[-- Attachment #1: bonding-3ad-remove-bond_marker_header.diff --]
[-- Type: text/plain, Size: 3319 bytes --]
It's strictly not necessary to define bond_marker_header in an include
file because it's only used in ad_lacpdu_send(). Remove that definition
and use an unnamed structure instead just for our purpose. Which also
gives a chance to use shorter names which are still descriptive.
As the port and marker are left unmodified I've made them const.
As that function is defined before used I've left out the forward
declaration.
Also cleanup that function a bit by removing useless braces around
one-liners and turn C++ style comments into C comments.
Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
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
@@ -152,11 +152,6 @@ typedef struct bond_marker {
u8 reserved_90[90]; // = 0
} bond_marker_t;
-typedef struct bond_marker_header {
- struct ethhdr hdr;
- struct bond_marker marker;
-} bond_marker_header_t;
-
#pragma pack()
struct slave;
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
@@ -98,7 +98,6 @@ static const int ad_delta_in_ticks = (AD
static const u8 lacpdu_mcast_addr[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
// ================= main 802.3ad protocol functions ==================
-static int ad_marker_send(struct port *port, struct bond_marker *marker);
static void ad_mux_machine(struct port *port);
static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port);
static void ad_tx_machine(struct port *port);
@@ -862,17 +861,20 @@ static int ad_lacpdu_send(const struct p
* Returns: 0 on success
* < 0 on error
*/
-static int ad_marker_send(struct port *port, struct bond_marker *marker)
+static int ad_marker_send(const struct port *port,
+ const struct bond_marker *marker)
{
struct slave *slave = port->slave;
struct sk_buff *skb;
- struct bond_marker_header *marker_header;
- int length = sizeof(struct bond_marker_header);
+ struct {
+ struct ethhdr hdr;
+ struct bond_marker marker;
+ } __packed *pdu;
+ int len = sizeof(*pdu);
- skb = dev_alloc_skb(length + 16);
- if (!skb) {
+ skb = dev_alloc_skb(len + 16);
+ if (skb == NULL)
return -ENOMEM;
- }
skb_reserve(skb, 16);
@@ -881,15 +883,15 @@ static int ad_marker_send(struct port *p
skb->network_header = skb->mac_header + ETH_HLEN;
skb->protocol = PKT_TYPE_LACPDU;
- marker_header = (struct bond_marker_header *)skb_put(skb, length);
+ pdu = (void *)skb_put(skb, len);
- memcpy(marker_header->hdr.h_dest, lacpdu_mcast_addr, ETH_ALEN);
+ memcpy(pdu->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->hdr.h_source, slave->perm_hwaddr, ETH_ALEN);
- marker_header->hdr.h_proto = PKT_TYPE_LACPDU;
+ memcpy(pdu->hdr.h_source, slave->perm_hwaddr, ETH_ALEN);
+ pdu->hdr.h_proto = PKT_TYPE_LACPDU;
- marker_header->marker = *marker; // struct copy
+ memcpy(&pdu->marker, marker, sizeof(pdu->marker));
dev_queue_xmit(skb);
--
next prev parent reply other threads:[~2008-12-23 22:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-23 22:01 [patch 00/10] bonding updates for net-next-2.6 Holger Eitzenberger
2008-12-23 22:01 ` [patch 01/10] 802.3ad: make ntt bool Holger Eitzenberger
2008-12-26 19:18 ` David Miller
2008-12-23 22:01 ` [patch 02/10] 802.3ad: turn ports is_enabled into a bool Holger Eitzenberger
2008-12-26 21:27 ` David Miller
2008-12-23 22:01 ` [patch 03/10] 802.3ad: turn ports is_individual " Holger Eitzenberger
2008-12-26 21:27 ` David Miller
2008-12-23 22:01 ` [patch 04/10] 802.3ad: remove typedef around ad_system Holger Eitzenberger
2008-12-26 21:28 ` David Miller
2008-12-23 22:01 ` [patch 05/10] 802.3ad: initialize ports LACPDU from const initializer Holger Eitzenberger
2008-12-26 21:28 ` David Miller
2008-12-23 22:01 ` [patch 06/10] 802.3ad: generalize out mac address initializer Holger Eitzenberger
2008-12-26 21:40 ` David Miller
2008-12-23 22:01 ` [patch 07/10] 802.3ad: use standard ethhdr instead of ad_header Holger Eitzenberger
2008-12-26 21:41 ` David Miller
2008-12-23 22:01 ` [patch 08/10] 802.3ad: remove public lacpdu_header Holger Eitzenberger
2008-12-26 21:43 ` David Miller
2008-12-26 21:45 ` David Miller
2008-12-29 16:15 ` Holger Eitzenberger
2008-12-23 22:01 ` Holger Eitzenberger [this message]
2008-12-23 22:01 ` [patch 10/10] 802.3ad: cleanup around lacpdu and bond_marker Holger Eitzenberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081223220601.771614232@jonathan.eitzenberger.org \
--to=holger@eitzenberger.org \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).