From 2f0a5e695bcdbc4088cbc0b561345bd23193f3ce Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 24 Aug 2021 14:36:21 +0200 Subject: [PATCH] remove ethernet.h header file There are only two definitions from ethernet.h used in the driver. Namely: Both are only used in the file core/rtw_recv.c. Replace the usage of ETHERNET_HEADER_SIZE with ETH_HLEN, move the definition of LLC_HEADER_SIZE into rtw_recv.h and remove the now unused ethernet.h header file. Link: https://lore.kernel.org/r/20210824123621.10801-4-straube.linux@gmail.com --- core/rtw_recv.c | 8 ++++---- include/drv_types.h | 1 - include/ethernet.h | 36 ------------------------------------ include/rtw_recv.h | 2 ++ 4 files changed, 6 insertions(+), 41 deletions(-) delete mode 100644 include/ethernet.h diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 8c75586..344968e 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -2917,11 +2917,11 @@ static int rtw_recv_indicatepkt_check(union recv_frame *rframe, u8 *ehdr_pos, u3 if (ntohs(ehdr->h_proto) == ETH_P_ARP) { if(check_fwstate(pmlmepriv, WIFI_ASOC_STATE) == _TRUE){ - if(ehdr_pos[ETHERNET_HEADER_SIZE+LEN_ARP_OP_HDR] == 2) { + if(ehdr_pos[ETH_HLEN+LEN_ARP_OP_HDR] == 2) { RTW_INFO("%s,[DBG_ARP] Rx ARP RSP Packet with Dst= "MAC_FMT" ;SeqNum = %d !\n", __FUNCTION__, MAC_ARG(pattrib->dst), pattrib->seq_num); - for(i=0;i<(pkt_len -ETHERNET_HEADER_SIZE);i++) - RTW_INFO("0x%x ",ehdr_pos[i+ETHERNET_HEADER_SIZE]); + for(i=0;i<(pkt_len -ETH_HLEN);i++) + RTW_INFO("0x%x ",ehdr_pos[i+ETH_HLEN]); RTW_INFO("\n"); } } @@ -3053,7 +3053,7 @@ int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe) while (a_len > ETH_HLEN) { /* Offset 12 denote 2 mac address */ nSubframe_Length = RTW_GET_BE16(pdata + 12); - if (a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) { + if (a_len < (ETH_HLEN + nSubframe_Length)) { RTW_INFO("nRemain_Length is %d and nSubframe_Length is : %d\n", a_len, nSubframe_Length); break; } diff --git a/include/drv_types.h b/include/drv_types.h index 1c3e62a..cb9e696 100644 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -129,7 +129,6 @@ typedef struct _ADAPTER _adapter, ADAPTER, *PADAPTER; #include #endif /* CONFIG_IOL */ -#include #include #include diff --git a/include/ethernet.h b/include/ethernet.h deleted file mode 100644 index 2bafa4d..0000000 --- a/include/ethernet.h +++ /dev/null @@ -1,36 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2017 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - *****************************************************************************/ -/*! \file */ -#ifndef __INC_ETHERNET_H -#define __INC_ETHERNET_H - -#define ETHERNET_ADDRESS_LENGTH 6 /* !< Ethernet Address Length */ -#define ETHERNET_HEADER_SIZE 14 /* !< Ethernet Header Length */ -#define LLC_HEADER_SIZE 6 /* !< LLC Header Length */ -#define TYPE_LENGTH_FIELD_SIZE 2 /* !< Type/Length Size */ -#define MINIMUM_ETHERNET_PACKET_SIZE 60 /* !< Minimum Ethernet Packet Size */ -#define MAXIMUM_ETHERNET_PACKET_SIZE 1514 /* !< Maximum Ethernet Packet Size */ - -#define RT_ETH_IS_MULTICAST(_pAddr) ((((UCHAR *)(_pAddr))[0]&0x01) != 0) /* !< Is Multicast Address? */ -#define RT_ETH_IS_BROADCAST(_pAddr) (\ - ((UCHAR *)(_pAddr))[0] == 0xff && \ - ((UCHAR *)(_pAddr))[1] == 0xff && \ - ((UCHAR *)(_pAddr))[2] == 0xff && \ - ((UCHAR *)(_pAddr))[3] == 0xff && \ - ((UCHAR *)(_pAddr))[4] == 0xff && \ - ((UCHAR *)(_pAddr))[5] == 0xff) /* !< Is Broadcast Address? */ - - -#endif /* #ifndef __INC_ETHERNET_H */ diff --git a/include/rtw_recv.h b/include/rtw_recv.h index 3236dd1..a7bd75c 100644 --- a/include/rtw_recv.h +++ b/include/rtw_recv.h @@ -89,6 +89,8 @@ extern u8 rtw_bridge_tunnel_header[]; extern u8 rtw_rfc1042_header[]; +#define LLC_HEADER_SIZE 6 + /* for Rx reordering buffer control */ struct recv_reorder_ctrl { _adapter *padapter;