Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1503868

[PATCH 30/37] staging:r8188eu: remove eth_type member of rx_pkt_attrib structure

From Ivan Safonov <insafonov@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 30/37] staging:r8188eu: remove eth_type member of rx_pkt_attrib structure
Date 2016-10-19 17:20 +0200
Message-ID <su0OS-308-35@gated-at.bofh.it> (permalink)
References <su0Fb-2Wq-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Prepare to replacing wlanhdr_to_ethhdr by ieee80211_data_to_8023.
Calculate it locally.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_recv.c    | 26 ++++++++++++++++++++------
 drivers/staging/rtl8188eu/include/rtw_recv.h |  2 --
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 630d9eb..2de4289 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -1267,7 +1267,7 @@ static int validate_recv_frame(struct adapter *adapter,
 static int wlanhdr_to_ethhdr(struct recv_frame *precvframe)
 {
 	int	rmv_len;
-	u16	eth_type, len;
+	u16 len;
 	__be16 be_tmp;
 	u8	bsnaphdr;
 	u8	*psnap_type;
@@ -1296,10 +1296,6 @@ static int wlanhdr_to_ethhdr(struct recv_frame *precvframe)
 	RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
 		 ("\n===pattrib->hdrlen: %x===\n\n", pattrib->hdrlen));
 
-	memcpy(&be_tmp, ptr+rmv_len, 2);
-	eth_type = ntohs(be_tmp); /* pattrib->ether_type */
-	pattrib->eth_type = eth_type;
-
 	ptr = skb_pull(precvframe->pkt, (rmv_len-sizeof(struct ethhdr) + (bsnaphdr ? 2 : 0)));
 
 	memcpy(ptr, pattrib->dst, ETH_ALEN);
@@ -1745,14 +1741,32 @@ static int recv_indicatepkt_reorder(struct adapter *padapter,
 	struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
 
 	if (!pattrib->amsdu) {
+		u16 eth_type;
+		u8 *ptr = prframe->pkt->data;
+		u8 *psnap_type;
+		int eth_type_offset;
+		struct ieee80211_snap_hdr *psnap;
+
 		/* s1. */
 		strip_iv_icv(prframe->pkt, prframe->attrib.hdrlen,
 			     prframe->attrib.iv_len,
 			     prframe->attrib.encrypt ? prframe->attrib.icv_len : 0);
 
+		psnap = (struct ieee80211_snap_hdr *)(ptr + pattrib->hdrlen);
+		psnap_type = ptr + pattrib->hdrlen + SNAP_SIZE;
+		eth_type_offset = pattrib->hdrlen;
+
+		if ((!memcmp(psnap, rtw_rfc1042_header, SNAP_SIZE) &&
+		     (!memcmp(psnap_type, SNAP_ETH_TYPE_IPX, 2) == false) &&
+		     (!memcmp(psnap_type, SNAP_ETH_TYPE_APPLETALK_AARP, 2) == false)) ||
+		     !memcmp(psnap, rtw_bridge_tunnel_header, SNAP_SIZE))
+			eth_type_offset += SNAP_SIZE;
+
+		eth_type = ntohs(*(__be16 *)(ptr + eth_type_offset));
+
 		wlanhdr_to_ethhdr(prframe);
 
-		if ((pattrib->qos != 1) || (pattrib->eth_type == 0x0806) ||
+		if ((pattrib->qos != 1) || eth_type == 0x0806 ||
 		    (pattrib->ack_policy != 0)) {
 			if ((!padapter->bDriverStopped) &&
 			    (!padapter->bSurpriseRemoved)) {
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h b/drivers/staging/rtl8188eu/include/rtw_recv.h
index 748c014e..b86ec85 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -112,8 +112,6 @@ struct rx_pkt_attrib {
 	u8	crc_err;
 	u8	icv_err;
 
-	u16 eth_type;
-
 	u8	dst[ETH_ALEN];
 	u8	src[ETH_ALEN];
 	u8	ta[ETH_ALEN];
-- 
2.7.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 01/37] staging:r8188eu: remove get_rxmem function Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:10 +0200
  [PATCH 25/37] staging:r8188eu: remove len member of recv_frame structure Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:10 +0200
  [PATCH 32/37] staging:r8188eu: remove SET_EARLYMODE_* definitions Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:10 +0200
  [PATCH 24/37] staging:r8188eu: remove rx_tail member of recv_frame structure Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:10 +0200
  [PATCH 13/37] staging:r8188eu: remove debug messages after memory allocation failed Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
    Re: [PATCH 13/37] staging:r8188eu: remove debug messages after  memory allocation failed Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-25 11:20 +0200
  [PATCH 21/37] staging:r8188eu: change recvframe_pull_tail last argument type Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
  [PATCH 02/37] staging:r8188eu: remove device assignment after netdev_alloc_skb call Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
    Re: [PATCH 02/37] staging:r8188eu: remove device assignment after  netdev_alloc_skb call Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-10-19 19:00 +0200
      Re: [PATCH 02/37] staging:r8188eu: remove device assignment after  netdev_alloc_skb call Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-10-19 19:10 +0200
        Re: [PATCH 02/37] staging:r8188eu: remove device assignment after  netdev_alloc_skb call Ivan Safonov <insafonov@gmail.com> - 2016-10-20 14:20 +0200
          Re: [PATCH 02/37] staging:r8188eu: remove device assignment after  netdev_alloc_skb call Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-25 11:00 +0200
    Re: [PATCH 02/37] staging:r8188eu: remove device assignment after  netdev_alloc_skb call Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-20 10:50 +0200
  [PATCH 37/37] staging:r8188eu: remove P2P_* enumerations. Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
  [PATCH 19/37] staging:r8188eu: remove rx_end member of recv_frame structure Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
  [PATCH 04/37] staging:r8188eu: remove WIFI_MP_* definitions and all corresponding code Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
  [PATCH 30/37] staging:r8188eu: remove eth_type member of rx_pkt_attrib structure Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
  [PATCH 16/37] staging:r8188eu: change recvframe_pull last argument type Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
  [PATCH 36/37] staging:r8188eu: remove unused structures from include/rtw_mlme.h Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
  [PATCH 03/37] staging:r8188eu: remove skb cloning after netdev_alloc_skb fail Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
    Re: [PATCH 03/37] staging:r8188eu: remove skb cloning after  netdev_alloc_skb fail Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-20 10:50 +0200
  [PATCH 27/37] staging:r8188eu: remove recvframe_put function Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
  [PATCH 07/37] staging:r8188eu: remove is2t argument if the phy_iq_calibrate function Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
  [PATCH 11/37] staging:r8188eu: remove is_(multicast|broadcast)_mac_addr Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
  [PATCH 10/37] staging:r8188eu: remove type cast for first argument of memset Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:20 +0200
  [PATCH 14/37] staging:r8188eu: remove ieee80211_is_empty_essid function Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 15/37] staging:r8188eu: remove rx_head member of recv_frame structure Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 34/37] staging:r8188eu: remove update_bcn member of mlme_priv structure Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 23/37] staging:r8188eu: update rx_tail and pkt->tail synchronously Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 20/37] staging:r8188eu: change recvframe_put last argument type Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 22/37] staging:r8188eu: change recvframe_pull_tail type to void Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 31/37] staging:r8188eu: remove pscanned member of mlme_priv structure Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 35/37] staging:r8188eu: remove clr_fwstate* functions Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 29/37] staging:r8188eu: take out stripping of iv and icv space from wlanhdr_to_ethhdr function Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
    Re: [PATCH 29/37] staging:r8188eu: take out stripping of iv and icv  space from wlanhdr_to_ethhdr function Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-20 11:20 +0200
  [PATCH 12/37] staging:r8188eu: remove ieee80211_get_hdrlen function Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 26/37] staging:r8188eu: remove recvframe_pull function Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 09/37] staging:r8188eu: remove is2t argument of phy_lc_calibrate function Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 28/37] staging:r8188eu: remove recvframe_pull_tail function Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 18/37] staging:r8188eu: remove rx_data member of recv_frame structure Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  [PATCH 08/37] staging:r8188eu: refactor path_adda_on function Ivan Safonov <insafonov@gmail.com> - 2016-10-19 17:30 +0200
  Re: [PATCH 01/37] staging:r8188eu: remove get_rxmem function Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-20 11:20 +0200
    Re: [PATCH 01/37] staging:r8188eu: remove get_rxmem function Ivan Safonov <insafonov@gmail.com> - 2016-10-20 16:00 +0200

csiph-web