net.h: Include linux/if_ether.h to avoid duplication
authorBin Meng <bmeng.cn@gmail.com>
Tue, 31 Jul 2018 09:55:22 +0000 (02:55 -0700)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 10 Oct 2018 17:28:52 +0000 (12:28 -0500)
There are plenty of existing drivers that have macros like ETH_ALEN
defined in their own source files. Now that we imported the kernel's
if_ether.h to U-Boot we can reduce some duplication.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
13 files changed:
board/Synology/ds414/cmd_syno.c
drivers/net/dc2114x.c
drivers/net/eepro100.c
drivers/net/mvpp2.c
drivers/net/natsemi.c
drivers/net/ns8382x.c
drivers/net/rtl8139.c
drivers/net/rtl8169.c
drivers/usb/eth/lan7x.h
drivers/usb/gadget/ether.c
drivers/usb/gadget/rndis.c
include/net.h
include/usb_ether.h

index 34643ff538a84c7a9c16dce665c69c75395fde4b..59e6fe03102e564f4f7154a96037db45c5eeb271 100644 (file)
@@ -14,7 +14,6 @@
 #include <asm/io.h>
 #include "../drivers/ddr/marvell/axp/ddr3_init.h"
 
-#define ETH_ALEN               6
 #define ETHADDR_MAX            4
 #define SYNO_SN_TAG            "SN="
 #define SYNO_CHKSUM_TAG                "CHK="
index 8d7c271038c69986bf1b4a80db02734877c06ff9..e3c403c13fc46ec8e922a75e4b6a7c650f97e039 100644 (file)
 #define TOUT_LOOP   1000000
 
 #define SETUP_FRAME_LEN 192
-#define ETH_ALEN       6
 
 struct de4x5_desc {
        volatile s32 status;
index ae65b649bf95d1250ed05aca265e4c2f53cb88d9..2fe0ba6e20faa6dfcc2f45f616cbfb31988c0b91 100644 (file)
@@ -193,8 +193,6 @@ struct descriptor {                 /* A generic descriptor. */
 
 #define TOUT_LOOP              1000000
 
-#define ETH_ALEN               6
-
 static struct RxFD rx_ring[NUM_RX_DESC];       /* RX descriptor ring         */
 static struct TxFD tx_ring[NUM_TX_DESC];       /* TX descriptor ring         */
 static int rx_next;                    /* RX descriptor ring pointer */
index 5c1f5fcd5694bf960b07a2f3cb76b2c7d811b034..f34245ba77dea387d0997f77ee9d944b0b1c6659 100644 (file)
@@ -35,8 +35,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define ETH_ALEN       6               /* Octets in one ethernet addr  */
-
 #define __verify_pcpu_ptr(ptr)                                         \
 do {                                                                   \
        const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
@@ -58,7 +56,6 @@ do {                                                                  \
 #define NET_SKB_PAD    max(32, MVPP2_CPU_D_CACHE_LINE_SIZE)
 
 #define CONFIG_NR_CPUS         1
-#define ETH_HLEN               ETHER_HDR_SIZE  /* Total octets in header */
 
 /* 2(HW hdr) 14(MAC hdr) 4(CRC) 32(extra for cache prefetch) */
 #define WRAP                   (2 + ETH_HLEN + 4 + 32)
index 0ed9bb5765cb0ce82fa379884ebaea31c4b2aeb2..86f689802e37193c5e99a6811e92ed0cdbf87e57 100644 (file)
@@ -61,7 +61,6 @@
 #define EEPROM_SIZE 0xb /*12 16-bit chunks, or 24 bytes*/
 
 #define DSIZE          0x00000FFF
-#define ETH_ALEN       6
 #define CRC_SIZE       4
 #define TOUT_LOOP      500000
 #define TX_BUF_SIZE    1536
index f941c15b2704f8c843e600959e2c7c2cf9517350..ea7ece54b6bb0bba003323df3fe266dc98b7c8b7 100644 (file)
@@ -59,7 +59,6 @@
 
 /* defines */
 #define DSIZE     0x00000FFF
-#define ETH_ALEN               6
 #define CRC_SIZE  4
 #define TOUT_LOOP   500000
 #define TX_BUF_SIZE    1536
index ea523435f0759ec24252ad509986dcdeb2a47ce8..590f8ce154264a01ee8a3ee68e15a1beab6aaab2 100644 (file)
 
 #define RTL_TIMEOUT    100000
 
-#define ETH_FRAME_LEN          1514
-#define ETH_ALEN               6
-#define ETH_ZLEN               60
-
 /* PCI Tuning Parameters
    Threshold is bytes transferred to chip before transmission starts. */
 #define TX_FIFO_THRESH 256     /* In bytes, rounded down to 32 byte units. */
index e0e3a6d570b26b21fff8ac83fa50d0e685e82df5..a78f3d233f1af0b28b52b17b7ad0b755583a3885 100644 (file)
@@ -102,10 +102,6 @@ static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
 #define RTL_R16(reg)           readw(ioaddr + (reg))
 #define RTL_R32(reg)           readl(ioaddr + (reg))
 
-#define ETH_FRAME_LEN  MAX_ETH_FRAME_SIZE
-#define ETH_ALEN       MAC_ADDR_LEN
-#define ETH_ZLEN       60
-
 #define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)(unsigned long)dev->priv, \
        (pci_addr_t)(unsigned long)a)
 #define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)(unsigned long)dev->priv, \
index d1b1047935907dc33498c103a27eb791388181ed..7af610be37029f454ad2096b2c4d7206089907bd 100644 (file)
@@ -94,7 +94,7 @@
 #define LAN7X_MAC_RX_MAX_SIZE(mtu) \
        ((mtu) << 16)                   /* Max frame size */
 #define LAN7X_MAC_RX_MAX_SIZE_DEFAULT \
-       LAN7X_MAC_RX_MAX_SIZE(ETH_FRAME_LEN + 4 /* VLAN */ + 4 /* CRC */)
+       LAN7X_MAC_RX_MAX_SIZE(PKTSIZE_ALIGN + 4 /* VLAN */ + 4 /* CRC */)
 
 /* Timeouts */
 #define USB_CTRL_SET_TIMEOUT_MS                5000
index 8ab9b9fe56aa675d1f8971b8ce1c6edd10494928..90ef1f055f76bdd128d2d5f2a296c8829a11224d 100644 (file)
@@ -71,11 +71,6 @@ unsigned packet_received, packet_sent;
  * RNDIS specs are ambiguous and appear to be incomplete, and are also
  * needlessly complex.  They borrow more from CDC ACM than CDC ECM.
  */
-#define ETH_ALEN       6               /* Octets in one ethernet addr   */
-#define ETH_HLEN       14              /* Total octets in header.       */
-#define ETH_ZLEN       60              /* Min. octets in frame sans FCS */
-#define ETH_DATA_LEN   1500            /* Max. octets in payload        */
-#define ETH_FRAME_LEN  PKTSIZE_ALIGN   /* Max. octets in frame sans FCS */
 
 #define DRIVER_DESC            "Ethernet Gadget"
 /* Based on linux 2.6.27 version */
@@ -529,7 +524,7 @@ static const struct usb_cdc_ether_desc ether_desc = {
        /* this descriptor actually adds value, surprise! */
        .iMACAddress =          STRING_ETHADDR,
        .bmEthernetStatistics = __constant_cpu_to_le32(0), /* no statistics */
-       .wMaxSegmentSize =      __constant_cpu_to_le16(ETH_FRAME_LEN),
+       .wMaxSegmentSize =      __constant_cpu_to_le16(PKTSIZE_ALIGN),
        .wNumberMCFilters =     __constant_cpu_to_le16(0),
        .bNumberPowerFilters =  0,
 };
@@ -1575,7 +1570,7 @@ static void rx_complete(struct usb_ep *ep, struct usb_request *req)
                        req->length -= length;
                        req->actual -= length;
                }
-               if (req->actual < ETH_HLEN || ETH_FRAME_LEN < req->actual) {
+               if (req->actual < ETH_HLEN || PKTSIZE_ALIGN < req->actual) {
 length_err:
                        dev->stats.rx_errors++;
                        dev->stats.rx_length_errors++;
index d47e29e447d17c78fcc3c557d79f2c9ae9ec6b81..eec639f8c07fa1b28bbf4335fa14922937b6127b 100644 (file)
 
 #include "rndis.h"
 
-#define ETH_ALEN       6               /* Octets in one ethernet addr   */
-#define ETH_HLEN       14              /* Total octets in header.       */
-#define ETH_ZLEN       60              /* Min. octets in frame sans FCS */
-#define ETH_DATA_LEN   1500            /* Max. octets in payload        */
-#define ETH_FRAME_LEN  PKTSIZE_ALIGN   /* Max. octets in frame sans FCS */
-
 /*
  * The driver for your USB chip needs to support ep0 OUT to work with
  * RNDIS, plus all three CDC Ethernet endpoints (interrupt not optional).
index 2b2deb5aaefceba34de25496203f90a65781f9f6..156bdc1da4d4afe83a4190406af2379d68dba26a 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <asm/cache.h>
 #include <asm/byteorder.h>     /* for nton* / ntoh* stuff */
+#include <linux/if_ether.h>
 
 #define DEBUG_LL_STATE 0       /* Link local state machine changes */
 #define DEBUG_DEV_PKT 0                /* Packets or info directed to the device */
index 49f47d372ab57804ae4da3aae11fcd38d6a60678..e85acadb7f5fb91c6ba1a1f1de4495c2c5a698a3 100644 (file)
@@ -8,16 +8,6 @@
 
 #include <net.h>
 
-/*
- *     IEEE 802.3 Ethernet magic constants.  The frame sizes omit the preamble
- *     and FCS/CRC (frame check sequence).
- */
-#define ETH_ALEN       6               /* Octets in one ethernet addr   */
-#define ETH_HLEN       14              /* Total octets in header.       */
-#define ETH_ZLEN       60              /* Min. octets in frame sans FCS */
-#define ETH_DATA_LEN   1500            /* Max. octets in payload        */
-#define ETH_FRAME_LEN  PKTSIZE_ALIGN   /* Max. octets in frame sans FCS */
-
 /* TODO(sjg@chromium.org): Remove @pusb_dev when all boards use CONFIG_DM_ETH */
 struct ueth_data {
        /* eth info */