Added support for 82545EM and 82546EB based adapters.

Added Vlan support.

MFC after:	1 week
This commit is contained in:
Prafulla Deuskar 2002-06-03 22:30:51 +00:00
parent 5c97ca54e5
commit a7fabc2b60
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97785
9 changed files with 6985 additions and 1541 deletions

View File

@ -106,8 +106,7 @@ dev/cm/if_cm_isa.c optional cm isa
dev/ed/if_ed_isa.c optional ed isa
dev/eisa/eisaconf.c optional eisa
dev/em/if_em.c optional em
dev/em/if_em_fxhw.c optional em
dev/em/if_em_phy.c optional em
dev/em/if_em_hw.c optional em
dev/fb/fb.c optional fb
dev/fb/fb.c optional vga
dev/fb/splash.c optional splash

View File

@ -104,8 +104,7 @@ dev/ct/ct.c optional ct
dev/ct/ct_isa.c optional ct isa
dev/ed/if_ed_cbus.c optional ed isa
dev/em/if_em.c optional em
dev/em/if_em_fxhw.c optional em
dev/em/if_em_phy.c optional em
dev/em/if_em_hw.c optional em
dev/fb/fb.c optional fb
dev/fb/fb.c optional gdc
dev/fb/splash.c optional splash

281
sys/dev/em/README Normal file
View File

@ -0,0 +1,281 @@
$FreeBSD$
FreeBSD* Driver for the Intel(R) PRO/1000 Family of Adapters
============================================================
April 3, 2002
Contents
========
- In This Release
- Supported Adapters
- Building and Installation
- Speed and Duplex Configuration
- Additional Configurations
- Known Limitations
- Support
- License
In This Release
===============
This file describes the FreeBSD* driver, version 1.3.x, for the Intel(R)
PRO/1000 Family of Adapters. This driver has been developed for use with
FreeBSD, version 4.5.
The driver supports Transmit/Receive Checksum Offload and Jumbo Frames on
all but the 82542-based adapters. For specific adapters, refer to the
Supported Adapters section below.
Support for VLANs has been added as a new feature in this driver version.
For questions related to hardware requirements, refer to the documentation
supplied with your Intel PRO/1000 adapter. All hardware requirements listed
apply to use with FreeBSD.
Supported Adapters
==================
The following Intel network adapters are compatible with the drivers in this
release:
Controller Adapter Name Board IDs
---------- ------------ ---------
82542 PRO/1000 Gigabit Server Adapter 700262-xxx, 717037-xxx
82543 PRO/1000 F Server Adapter 738640-xxx, A38888-xxx,
A06512-xxx
82543 PRO/1000 T Server Adapter A19845-xxx, A33948-xxx
82544 PRO/1000 XT Server Adapter A51580-xxx
82544 PRO/1000 XF Server Adapter A50484-xxx
82544 PRO/1000 T Desktop Adapter A62947-xxx
82540 PRO/1000 MT Desktop Adapter A78708-xxx
82545 PRO/1000 MT Server Adapter A92165-xxx
82545 PRO/1000 MF Server Adapter A91622-xxx
82545 PRO/1000 MF Server Adapter(LX) A91624-xxx
82546 PRO/1000 MT Dual Port Server Adapter A92111-xxx
82546 PRO/1000 MF Dual Port Server Adapter A91620-xxx
To verify your Intel adapter is supported, find the board ID number on the
adapter. Look for a label that has a barcode and a number in the format of
123456-001 (six digits hyphen three digits). Match this to the list of
numbers above.
For more information on how to identify your adapter, go to the Adapter &
Driver ID Guide at:
http://support.intel.com/support/network/adapter/pro100/21397.htm
For the latest Intel network drivers for FreeBSD, see:
http://appsr.intel.com/scripts-df/support_intel.asp
Building and Installation
=========================
NOTE: You must have kernel sources installed in order to compile the driver
module.
In the instructions below, x.x.x is the driver version as indicated in
the name of the driver tar.
1. Move the base driver tar file to the directory of your choice. For
example, use /home/username/em or /usr/local/src/em.
2. Untar/unzip the archive:
tar xfz em-x.x.x.tar.gz
3. To load the driver onto a running system:
cd em-x.x.x/modules
kldload ./if_em.ko
4. To assign an IP address to the interface, enter the following:
ifconfig em<interface_num> <IP_address>
5. Verify that the interface works. Enter the following, where <IP_address>
is the IP address for another machine on the same subnet as the interface
that is being tested:
ping <IP_address>
6. If you want the driver to load automatically when the system is booted:
cd em-x.x.x/modules
cp if_em.ko /modules
Edit /boot/loader.conf, and add the following line:
if_em_load="YES"
OR
compile the driver into the kernel (see item 7).
Edit /etc/rc.conf, and create the appropriate ifconfig_em<interface_num>
entry:
ifconfig_em<interface_num>="<ifconfig_settings>"
Example usage:
ifconfig_em0="inet 192.168.10.1 netmask 255.255.255.0"
NOTE: For assistance, see the ifconfig man page.
7. If you want to compile the driver into the kernel, enter:
mkdir /usr/src/sys/dev/em
cd em-x.x.x/src
cp if_em* /usr/src/sys/dev/em
mkdir /usr/src/sys/modules/em
cp Makefile /usr/src/sys/modules/em
Edit Makefile at /usr/src/sys/modules to add the em subdirectory.
Edit your config file and add the following line, if it is not already
in the file:
device em
Edit your config file, and remove the 'device wx' line from the file.
Edit the /usr/src/sys/conf/files.i386 file, and add the following lines:
dev/em/if_em.c optional em
dev/em/if_em_hw.c optional em
Remove the following files from the /usr/src/sys/conf/files.i386 file, if
they exist:
/dev/em/if_em_fxhw.c
/dev/em/if_em_phy.c
Compile and install the kernel.
Speed and Duplex Configuration
==============================
By default, the adapter auto-negotiates the speed and duplex of the
connection. If there is a specific need, the ifconfig utility can be used to
configure the speed and duplex settings on the adapter. Example usage:
ifconfig em<interface_num> <IP_address> media 100baseTX mediaopt
full-duplex
NOTE: Only use mediaopt to set the driver to full-duplex. If mediaopt is
not specified and you are not running at gigabit speed, the driver
defaults to half-duplex.
This driver supports the following media type options:
autoselect - Enables auto-negotiation for speed and duplex.
10baseT/UTP - Sets speed to 10 Mbps. Use the ifconfig mediaopt
option to select full-duplex mode.
100baseTX - Sets speed to 100 Mbps. Use the ifconfig mediaopt
option to select full-duplex mode.
1000baseTX - Sets speed to 1000 Mbps. In this case, the driver
supports only full-duplex mode.
1000baseSX - Sets speed to 1000 Mbps. In this case, the driver
supports only full-duplex mode.
For more information on the ifconfig utility, see the ifconfig man page.
Additional Configurations
=========================
Jumbo Frames
------------
To enable Jumbo Frames, use the ifconfig utility to increase the MTU
beyond 1500 bytes.
NOTE: Only enable Jumbo Frames if your network infrastructure supports
them.
The MTU range for Jumbo Frames is 1500 to 16114. For example, enter the
following:
ifconfig em<interface_num> mtu 9000
VLANs
-----
To enable VLANs in the kernel, modify the config file as follows:
pseudo-device vlan <num_VLANs>
Then, recompile the kernel and reboot.
To see the VLAN device entries, use ifconfig.
To attach a VLAN to the driver enter the following:
ifconfig vlan0 inet 10.0.0.1 netmask 255.255.255.0 vlan 1 vlandev
em0 mtu 1500 up
Also, bring the driver up by entering:
ifconfig em0 up
Known Limitations
=================
There are known performance problems with this driver when running UDP
traffic with Jumbo Frames. Intel recommends not using Jumbo Frames for UDP
traffic.
Support
=======
For general information and support, go to the Intel support website at:
http://support.intel.com
If an issue is identified with the released source code on the supported
kernel with a supported adapter, email the specific information related to
the issue to freebsdnic@mailbox.intel.com.
License
=======
This software program is released under the terms of a license agreement
between you ('Licensee') and Intel. Do not use or load this software or any
associated materials (collectively, the 'Software') until you have carefully
read the full terms and conditions of the LICENSE located in this software
package. By loading or using the Software, you agree to the terms of this
Agreement. If you do not agree with the terms of this Agreement, do not
install or use the Software.
* Other names and brands may be claimed as the property of others.

File diff suppressed because it is too large Load Diff

View File

@ -46,14 +46,17 @@ SUCH DAMAGE.
#include <sys/socket.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/sockio.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/ethernet.h>
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/bpf.h>
#include <net/ethernet.h>
#include <net/if_arp.h>
#include <sys/sockio.h>
#include <net/if_types.h>
#include <net/if_vlan_var.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
@ -72,8 +75,7 @@ SUCH DAMAGE.
#include <pci/pcireg.h>
#include "opt_bdg.h"
#include <dev/em/if_em_fxhw.h>
#include <dev/em/if_em_phy.h>
#include <dev/em/if_em_hw.h>
/* Tunables */
#define MAX_TXD 256
@ -103,6 +105,7 @@ SUCH DAMAGE.
#define MAX_NUM_MULTICAST_ADDRESSES 128
#define PCI_ANY_ID (~0U)
#define ETHER_ALIGN 2
#define QTAG_TYPE 0x8100
/* Defines for printing debug information */
#define DEBUG_INIT 0
@ -127,8 +130,8 @@ SUCH DAMAGE.
#define EM_RXBUFFER_16384 16384
#ifdef __alpha__
#undef vtophys
#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)(va))
#undef vtophys
#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)(va))
#endif /* __alpha__ */
/* ******************************************************************************
@ -140,18 +143,18 @@ SUCH DAMAGE.
* ******************************************************************************/
typedef struct _em_vendor_info_t
{
unsigned int vendor_id;
unsigned int device_id;
unsigned int subvendor_id;
unsigned int subdevice_id;
unsigned int index;
unsigned int vendor_id;
unsigned int device_id;
unsigned int subvendor_id;
unsigned int subdevice_id;
unsigned int index;
} em_vendor_info_t;
struct em_tx_buffer {
STAILQ_ENTRY(em_tx_buffer) em_tx_entry;
struct mbuf *m_head;
u_int32_t num_tx_desc_used;
STAILQ_ENTRY(em_tx_buffer) em_tx_entry;
struct mbuf *m_head;
u_int32_t num_tx_desc_used;
};
@ -160,88 +163,88 @@ struct em_tx_buffer {
* into which the E1000 DMA's frames.
* ******************************************************************************/
struct em_rx_buffer {
STAILQ_ENTRY(em_rx_buffer) em_rx_entry;
struct mbuf *m_head;
u_int64_t buffer_addr;
STAILQ_ENTRY(em_rx_buffer) em_rx_entry;
struct mbuf *m_head;
u_int64_t buffer_addr;
};
typedef enum _XSUM_CONTEXT_T {
OFFLOAD_NONE,
OFFLOAD_TCP_IP,
OFFLOAD_UDP_IP
OFFLOAD_NONE,
OFFLOAD_TCP_IP,
OFFLOAD_UDP_IP
} XSUM_CONTEXT_T;
/* Our adapter structure */
struct adapter {
struct arpcom interface_data;
struct adapter *next;
struct adapter *prev;
struct em_shared_adapter shared;
struct arpcom interface_data;
struct adapter *next;
struct adapter *prev;
struct em_hw hw;
/* FreeBSD operating-system-specific structures */
struct em_osdep osdep;
struct device *dev;
struct resource *res_memory;
struct resource *res_interrupt;
void *int_handler_tag;
struct ifmedia media;
struct callout_handle timer_handle;
u_int8_t unit;
/* FreeBSD operating-system-specific structures */
struct em_osdep osdep;
struct device *dev;
struct resource *res_memory;
struct resource *res_interrupt;
void *int_handler_tag;
struct ifmedia media;
struct callout_handle timer_handle;
u_int8_t unit;
/* Info about the board itself */
u_int32_t part_num;
u_int8_t link_active;
u_int16_t link_speed;
u_int16_t link_duplex;
u_int32_t tx_int_delay;
u_int32_t rx_int_delay;
/* Info about the board itself */
u_int32_t part_num;
u_int8_t link_active;
u_int16_t link_speed;
u_int16_t link_duplex;
u_int32_t tx_int_delay;
u_int32_t rx_int_delay;
u_int8_t rx_checksum;
XSUM_CONTEXT_T active_checksum_context;
u_int8_t rx_checksum;
XSUM_CONTEXT_T active_checksum_context;
/* Transmit definitions */
struct em_tx_desc *first_tx_desc;
struct em_tx_desc *last_tx_desc;
struct em_tx_desc *next_avail_tx_desc;
struct em_tx_desc *oldest_used_tx_desc;
struct em_tx_desc *tx_desc_base;
volatile u_int16_t num_tx_desc_avail;
u_int16_t num_tx_desc;
u_int32_t txd_cmd;
struct em_tx_buffer *tx_buffer_area;
STAILQ_HEAD(__em_tx_buffer_free, em_tx_buffer) free_tx_buffer_list;
STAILQ_HEAD(__em_tx_buffer_used, em_tx_buffer) used_tx_buffer_list;
/* Transmit definitions */
struct em_tx_desc *first_tx_desc;
struct em_tx_desc *last_tx_desc;
struct em_tx_desc *next_avail_tx_desc;
struct em_tx_desc *oldest_used_tx_desc;
struct em_tx_desc *tx_desc_base;
volatile u_int16_t num_tx_desc_avail;
u_int16_t num_tx_desc;
u_int32_t txd_cmd;
struct em_tx_buffer *tx_buffer_area;
STAILQ_HEAD(__em_tx_buffer_free, em_tx_buffer) free_tx_buffer_list;
STAILQ_HEAD(__em_tx_buffer_used, em_tx_buffer) used_tx_buffer_list;
/* Receive definitions */
struct em_rx_desc *first_rx_desc;
struct em_rx_desc *last_rx_desc;
struct em_rx_desc *next_rx_desc_to_check;
struct em_rx_desc *rx_desc_base;
u_int16_t num_rx_desc;
u_int32_t rx_buffer_len;
struct em_rx_buffer *rx_buffer_area;
STAILQ_HEAD(__em_rx_buffer, em_rx_buffer) rx_buffer_list;
/* Receive definitions */
struct em_rx_desc *first_rx_desc;
struct em_rx_desc *last_rx_desc;
struct em_rx_desc *next_rx_desc_to_check;
struct em_rx_desc *rx_desc_base;
u_int16_t num_rx_desc;
u_int32_t rx_buffer_len;
struct em_rx_buffer *rx_buffer_area;
STAILQ_HEAD(__em_rx_buffer, em_rx_buffer) rx_buffer_list;
/* Jumbo frame */
struct mbuf *fmp;
struct mbuf *lmp;
/* Jumbo frame */
struct mbuf *fmp;
struct mbuf *lmp;
/* Misc stats maintained by the driver */
unsigned long dropped_pkts;
unsigned long mbuf_alloc_failed;
unsigned long mbuf_cluster_failed;
unsigned long xmit_pullup;
unsigned long no_tx_desc_avail;
unsigned long no_tx_buffer_avail1;
unsigned long no_tx_buffer_avail2;
#ifdef DBG_STATS
unsigned long no_pkts_avail;
unsigned long clean_tx_interrupts;
/* Misc stats maintained by the driver */
unsigned long dropped_pkts;
unsigned long mbuf_alloc_failed;
unsigned long mbuf_cluster_failed;
unsigned long xmit_pullup;
unsigned long no_tx_desc_avail;
unsigned long no_tx_buffer_avail1;
unsigned long no_tx_buffer_avail2;
#ifdef DBG_STATS
unsigned long no_pkts_avail;
unsigned long clean_tx_interrupts;
#endif
struct em_shared_stats stats;
struct em_hw_stats stats;
};
#endif /* _EM_H_DEFINED_ */

3281
sys/dev/em/if_em_hw.c Normal file

File diff suppressed because it is too large Load Diff

1756
sys/dev/em/if_em_hw.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -66,17 +66,17 @@ SUCH DAMAGE.
#define MSGOUT(S, A, B) printf(S "\n", A, B)
#define DEBUGFUNC(F) DEBUGOUT(F);
#if DBG
#define DEBUGOUT(S) printf(S "\n")
#define DEBUGOUT1(S,A) printf(S "\n",A)
#define DEBUGOUT2(S,A,B) printf(S "\n",A,B)
#define DEBUGOUT3(S,A,B,C) printf(S "\n",A,B,C)
#define DEBUGOUT7(S,A,B,C,D,E,F,G) printf(S "\n",A,B,C,D,E,F,G)
#define DEBUGOUT(S) printf(S "\n")
#define DEBUGOUT1(S,A) printf(S "\n",A)
#define DEBUGOUT2(S,A,B) printf(S "\n",A,B)
#define DEBUGOUT3(S,A,B,C) printf(S "\n",A,B,C)
#define DEBUGOUT7(S,A,B,C,D,E,F,G) printf(S "\n",A,B,C,D,E,F,G)
#else
#define DEBUGOUT(S)
#define DEBUGOUT1(S,A)
#define DEBUGOUT2(S,A,B)
#define DEBUGOUT3(S,A,B,C)
#define DEBUGOUT7(S,A,B,C,D,E,F,G)
#define DEBUGOUT(S)
#define DEBUGOUT1(S,A)
#define DEBUGOUT2(S,A,B)
#define DEBUGOUT3(S,A,B,C)
#define DEBUGOUT7(S,A,B,C,D,E,F,G)
#endif
#define FALSE 0
@ -86,9 +86,9 @@ SUCH DAMAGE.
struct em_osdep
{
bus_space_tag_t bus_space_tag;
bus_space_handle_t bus_space_handle;
struct device *dev;
bus_space_tag_t bus_space_tag;
bus_space_handle_t bus_space_handle;
struct device *dev;
};
#define E1000_READ_REG(a, reg) (\

View File

@ -1,9 +1,8 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../dev/em
KMOD = if_em
SRCS = device_if.h bus_if.h pci_if.h opt_bdg.h
SRCS += if_em.c if_em_fxhw.c if_em_phy.c
#$FreeBSD$
.PATH: ${.CURDIR}/../../dev/em
KMOD = if_em
SRCS = device_if.h bus_if.h pci_if.h opt_bdg.h
SRCS += if_em.c if_em_hw.c
clean:
rm -f opt_bdg.h device_if.h bus_if.h pci_if.h setdef*