1 /* eth.h */ 2 /* 3 Copyright (C) 1992 Ross Biro 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2, or (at your option) 8 any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 19 The Author may be reached as bir7@leland.stanford.edu or 20 C/O Department of Mathematics; Stanford University; Stanford, CA 94305 21 */ 22 /* $Id: eth.h,v 0.8.4.1 1992/11/10 00:17:18 bir7 Exp $ */ 23 /* $Log: eth.h,v $ 24 * Revision 0.8.4.1 1992/11/10 00:17:18 bir7 25 * version change only. 26 * 27 * Revision 0.8.3.2 1992/11/10 00:14:47 bir7 28 * Changed malloc to kmalloc and added $iId$ and $Log: eth.h,v $ 29 * Revision 0.8.4.1 1992/11/10 00:17:18 bir7 30 * version change only. 31 *. 32 * */ 33 34 #ifndef _TCP_ETH_H 35 #define _TCP_ETH_H 36 37 #define ETHER_MIN_LEN 64 38 #define ETHER_ADDR_LEN 6 39 40 #define ETHERTYPE_ARP 0x806 41 #define ETHERTYPE_IP 0x800 42 #define ETHER_TYPE 1 43 44 /* Reciever modes */ 45 #define ETH_MODE_MONITOR 1 /* Monitor mode - no receive */ 46 #define ETH_MODE_PHYSICAL 2 /* Physical address receive only */ 47 #define ETH_MODE_BROADCAST 3 /* Broadcast receive + mode 2 */ 48 #define ETH_MODE_MULTICAST 4 /* Multicast receive + mode 3 */ 49 #define ETH_MODE_PROMISCUOUS 5 /* Promiscuous mode - receive all */ 50 51 #define WD_RX_SAVE_ERRORS 1 /* save error packets */ 52 #define WD_RX_RUNT 2 /* accept runt packets */ 53 #define WD_RX_BROAD 4 /* accept broadcast packets */ 54 #define WD_RX_MULTI 8 /* accept multicast packets */ 55 #define WD_RX_PROM 0x10 /* accept all packets */ 56 #define WD_RX_MON 0x20 /* monitor mode (just count packets) */ 57 58 #define NET16(x) (((x&0xff)<<8)|((x>>8)&0xff)) 59 60 struct enet_header 61 { 62 unsigned char daddr[ETHER_ADDR_LEN]; 63 unsigned char saddr[ETHER_ADDR_LEN]; 64 unsigned short type; 65 }; 66 67 #define ETHER_HEADER sizeof(struct enet_header) 68 69 struct enet_statistics{ 70 int rx_packets; /* total packets received */ 71 int tx_packets; /* total packets transmitted */ 72 int rx_errors; /* bad packets received */ 73 int tx_errors; /* packet transmit problems */ 74 int rx_dropped; /* no space in linux buffers */ 75 int tx_dropped; /* no space available in linux */ 76 int collisions; /* total number of collisions */ 77 int multicast; /* multicast packets received */ 78 /* detailed rx_errors: */ 79 int rx_length_errors; 80 int rx_over_errors; /* receiver overwrote ring buffer in card */ 81 int rx_crc_errors; /* received packet with crc error */ 82 int rx_frame_errors; /* received frame alignment error */ 83 int rx_fifo_errors; /* receiver fifo overrun */ 84 int rx_missed_errors; /* receiver missed packet */ 85 /* detailed tx_errors */ 86 int tx_aborted_errors; 87 int tx_carrier_errors; 88 int tx_fifo_errors; 89 int tx_heartbeat_errors; 90 int tx_window_errors; 91 }; 92 93 void print_eth(struct enet_header *eth); 94 int eth_hard_header (unsigned char *buff, struct device *dev, 95 unsigned short type, unsigned long daddr, 96 unsigned long saddr, unsigned len); 97 98 int eth_rebuild_header(void *eth, struct device *dev); 99 void eth_add_arp (unsigned long addr, struct sk_buff *skb, 100 struct device *dev); 101 unsigned short eth_type_trans (struct sk_buff *skb, struct device *dev); 102 103 #endif