Skip to contentSkip to conversation

mwifiex: replace struct eth_II_hdr with ethhdr

PATCH New Bing Zhao 1 participant 2 messages Dec 7, 2010 Networking drivers (wireless)

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/2 mwifiex: replace struct eth_II_hdr with ethhdr

"struct ethhdr" is defined in include/linux/if_ether.h

---
 drivers/net/wireless/mwifiex/fw.h     |    3 +++
 drivers/net/wireless/mwifiex/sta_rx.c |   22 ++++++----------------
 2 files changed, 9 insertions(+), 16 deletions(-)
drivers/net/wireless/mwifiex/fw.h +3 -0
index ed691ac..86e8a96 100644
@@ -20,6 +20,9 @@
 #ifndef _MWIFIEX_FW_H_
 #define _MWIFIEX_FW_H_
 
+#include <linux/if_ether.h>
+
+
 #define INTF_HEADER_LEN     4
 
 struct eth_803_hdr {
drivers/net/wireless/mwifiex/sta_rx.c +6 -16
index 504c377..022ae4b 100644
@@ -26,16 +26,6 @@
 #include "11n_aggr.h"
 #include "11n_rxreorder.h"
 
-/** Ethernet II header */
-struct eth_II_hdr {
-	/** Ethernet II header destination address */
-	u8 dest_addr[MWIFIEX_MAC_ADDR_LENGTH];
-	/** Ethernet II header source address */
-	u8 src_addr[MWIFIEX_MAC_ADDR_LENGTH];
-	/** Ethernet II header length */
-	u16 ethertype;
-};
-
 /*
  * This function processes the received packet and forwards it
  * to kernel/upper layer.
@@ -58,7 +48,7 @@ mwifiex_process_rx_packet(struct mwifiex_adapter *adapter,
 	struct rx_packet_hdr *rx_pkt_hdr;
 	struct rxpd *local_rx_pd;
 	int hdr_chop;
-	struct eth_II_hdr *eth_hdr;
+	struct ethhdr *eth_hdr;
 	u8 rfc1042_eth_hdr[MWIFIEX_MAC_ADDR_LENGTH] = { 0xaa, 0xaa, 0x03,
 							0x00, 0x00, 0x00 };
 
@@ -114,7 +104,7 @@ mwifiex_process_rx_packet(struct mwifiex_adapter *adapter,
 		 *  To create the Ethernet II, just move the src, dst address
 		 *    right before the snap_type.
 		 */
-		eth_hdr = (struct eth_II_hdr *)
+		eth_hdr = (struct ethhdr *)
 			((u8 *) &rx_pkt_hdr->eth803_hdr
 			 + sizeof(rx_pkt_hdr->eth803_hdr) +
 			 sizeof(rx_pkt_hdr->rfc1042_hdr)
@@ -122,10 +112,10 @@ mwifiex_process_rx_packet(struct mwifiex_adapter *adapter,
 			 - sizeof(rx_pkt_hdr->eth803_hdr.src_addr)
 			 - sizeof(rx_pkt_hdr->rfc1042_hdr.snap_type));
 
-		memcpy(eth_hdr->src_addr, rx_pkt_hdr->eth803_hdr.src_addr,
-		       sizeof(eth_hdr->src_addr));
-		memcpy(eth_hdr->dest_addr, rx_pkt_hdr->eth803_hdr.dest_addr,
-		       sizeof(eth_hdr->dest_addr));
+		memcpy(eth_hdr->h_source, rx_pkt_hdr->eth803_hdr.src_addr,
+		       sizeof(eth_hdr->h_source));
+		memcpy(eth_hdr->h_dest, rx_pkt_hdr->eth803_hdr.dest_addr,
+		       sizeof(eth_hdr->h_dest));
 
 		/* Chop off the rxpd + the excess memory from the 802.2/llc/snap
 		   header that was removed. */
Signature · 1 line
1.7.0.2
author
#1 lore raw

PATCH 2/2 mwifiex: replace struct eth_803_hdr with ethhdr

"struct ethhdr" is defined in include/linux/if_ether.h

---
 drivers/net/wireless/mwifiex/11n_aggr.c |   24 +++++++++---------------
 drivers/net/wireless/mwifiex/fw.h       |   10 +---------
 drivers/net/wireless/mwifiex/sta_rx.c   |   20 ++++++++++----------
 3 files changed, 20 insertions(+), 34 deletions(-)
drivers/net/wireless/mwifiex/11n_aggr.c +9 -15
index a9a28ed..e100ffc 100644
@@ -169,16 +169,10 @@ mwifiex_11n_get_num_aggr_pkts(u8 *data, int total_pkt_len)
 					(data
 					 +
 					 (2 * MWIFIEX_MAC_ADDR_LENGTH))));
-		pad = (((pkt_len + sizeof(struct eth_803_hdr)) & 3)) ? (4 -
-				((pkt_len
-				  +
-				  sizeof
-				  (struct
-				   eth_803_hdr))
-				 & 3)) :
-			0;
-		data += pkt_len + pad + sizeof(struct eth_803_hdr);
-		total_pkt_len -= pkt_len + pad + sizeof(struct eth_803_hdr);
+		pad = (((pkt_len + sizeof(struct ethhdr)) & 3)) ?
+			(4 - ((pkt_len + sizeof(struct ethhdr)) & 3)) : 0;
+		data += pkt_len + pad + sizeof(struct ethhdr);
+		total_pkt_len -= pkt_len + pad + sizeof(struct ethhdr);
 		++pkt_count;
 	}
 
@@ -237,21 +231,21 @@ mwifiex_11n_deaggregate_pkt(struct mwifiex_private *priv,
 			break;
 		}
 
-		pad = (((pkt_len + sizeof(struct eth_803_hdr)) & 3)) ?
-			(4 - ((pkt_len + sizeof(struct eth_803_hdr)) & 3)) : 0;
+		pad = (((pkt_len + sizeof(struct ethhdr)) & 3)) ?
+			(4 - ((pkt_len + sizeof(struct ethhdr)) & 3)) : 0;
 
-		total_pkt_len -= pkt_len + pad + sizeof(struct eth_803_hdr);
+		total_pkt_len -= pkt_len + pad + sizeof(struct ethhdr);
 
 		if (memcmp(&rx_pkt_hdr->rfc1042_hdr,
 			   rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr)) == 0) {
 			memmove(data + LLC_SNAP_LEN, data,
 				(2 * MWIFIEX_MAC_ADDR_LENGTH));
 			data += LLC_SNAP_LEN;
-			pkt_len += sizeof(struct eth_803_hdr) - LLC_SNAP_LEN;
+			pkt_len += sizeof(struct ethhdr) - LLC_SNAP_LEN;
 		} else {
 			*(u16 *) (data + (2 * MWIFIEX_MAC_ADDR_LENGTH))
 				= (u16) 0;
-			pkt_len += sizeof(struct eth_803_hdr);
+			pkt_len += sizeof(struct ethhdr);
 		}
 
 		mbuf_daggr = mwifiex_alloc_buffer(pkt_len);
drivers/net/wireless/mwifiex/fw.h +1 -9
index 86e8a96..95b3d2f 100644
@@ -25,25 +25,17 @@
 
 #define INTF_HEADER_LEN     4
 
-struct eth_803_hdr {
-	u8 dest_addr[MWIFIEX_MAC_ADDR_LENGTH];
-	u8 src_addr[MWIFIEX_MAC_ADDR_LENGTH];
-	u16 h803_len;
-};
-
 struct rfc_1042_hdr {
 	u8 llc_dsap;
 	u8 llc_ssap;
 	u8 llc_ctrl;
 	u8 snap_oui[3];
 	u16 snap_type;
-
 };
 
 struct rx_packet_hdr {
-	struct eth_803_hdr eth803_hdr;
+	struct ethhdr eth803_hdr;
 	struct rfc_1042_hdr rfc1042_hdr;
-
 };
 
 #define B_SUPPORTED_RATES               5
drivers/net/wireless/mwifiex/sta_rx.c +10 -10
index 022ae4b..47e20ad 100644
@@ -88,10 +88,10 @@ mwifiex_process_rx_packet(struct mwifiex_adapter *adapter,
 	       mbuf->data_len, local_rx_pd->rx_pkt_offset,
 	       mbuf->data_len - local_rx_pd->rx_pkt_offset);
 
-	HEXDUMP("RX Data: Dest", rx_pkt_hdr->eth803_hdr.dest_addr,
-		sizeof(rx_pkt_hdr->eth803_hdr.dest_addr));
-	HEXDUMP("RX Data: Src", rx_pkt_hdr->eth803_hdr.src_addr,
-		sizeof(rx_pkt_hdr->eth803_hdr.src_addr));
+	HEXDUMP("RX Data: Dest", rx_pkt_hdr->eth803_hdr.h_dest,
+		sizeof(rx_pkt_hdr->eth803_hdr.h_dest));
+	HEXDUMP("RX Data: Src", rx_pkt_hdr->eth803_hdr.h_source,
+		sizeof(rx_pkt_hdr->eth803_hdr.h_source));
 
 	if (!memcmp(&rx_pkt_hdr->rfc1042_hdr,
 		    rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) {
@@ -108,13 +108,13 @@ mwifiex_process_rx_packet(struct mwifiex_adapter *adapter,
 			((u8 *) &rx_pkt_hdr->eth803_hdr
 			 + sizeof(rx_pkt_hdr->eth803_hdr) +
 			 sizeof(rx_pkt_hdr->rfc1042_hdr)
-			 - sizeof(rx_pkt_hdr->eth803_hdr.dest_addr)
-			 - sizeof(rx_pkt_hdr->eth803_hdr.src_addr)
+			 - sizeof(rx_pkt_hdr->eth803_hdr.h_dest)
+			 - sizeof(rx_pkt_hdr->eth803_hdr.h_source)
 			 - sizeof(rx_pkt_hdr->rfc1042_hdr.snap_type));
 
-		memcpy(eth_hdr->h_source, rx_pkt_hdr->eth803_hdr.src_addr,
+		memcpy(eth_hdr->h_source, rx_pkt_hdr->eth803_hdr.h_source,
 		       sizeof(eth_hdr->h_source));
-		memcpy(eth_hdr->h_dest, rx_pkt_hdr->eth803_hdr.dest_addr,
+		memcpy(eth_hdr->h_dest, rx_pkt_hdr->eth803_hdr.h_dest,
 		       sizeof(eth_hdr->h_dest));
 
 		/* Chop off the rxpd + the excess memory from the 802.2/llc/snap
@@ -217,14 +217,14 @@ mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter,
 	 * directly to os. Don't pass thru rx reordering
 	 */
 	if (!IS_11N_ENABLED(priv) ||
-	    memcmp(priv->curr_addr, rx_pkt_hdr->eth803_hdr.dest_addr,
+	    memcmp(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest,
 		   MWIFIEX_MAC_ADDR_LENGTH)) {
 		mwifiex_process_rx_packet(adapter, mbuf);
 		goto done;
 	}
 
 	if (mwifiex_queuing_ra_based(priv)) {
-		memcpy(ta, rx_pkt_hdr->eth803_hdr.src_addr,
+		memcpy(ta, rx_pkt_hdr->eth803_hdr.h_source,
 		       MWIFIEX_MAC_ADDR_LENGTH);
 	} else {
 		if (rx_pkt_type != PKT_TYPE_BAR)
Signature · 1 line
1.7.0.2