Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 Mar 2001 23:34:55 -0500
From:      Mike Tancsa <mike@sentex.net>
To:        stable@FreeBSD.ORG
Cc:        dg@root.com
Subject:   VLANs and STABLE fxp patch
Message-ID:  <4.2.2.20010306233020.01dc00e0@marble.sentex.net>

next in thread | raw e-mail | index | archive | help

Is there any chance of getting 
http://www.euitt.upm.es/~pjlobo/fbsdvlan.html committed to FreeBSD in the 
future ? I have been using it with great results.

ie.


*** sys/pci/if_fxp.c.orig	Tue Oct 24 23:47:36 2000
--- sys/pci/if_fxp.c	Tue Dec  5 12:40:37 2000
***************
*** 34,39 ****
--- 34,42 ----
    * Intel EtherExpress Pro/100B PCI Fast Ethernet driver
    */

+ #if !defined(KLD_MODULE)
+ #include "vlan.h"
+ #endif
   #include <sys/param.h>
   #include <sys/systm.h>
   #include <sys/mbuf.h>
***************
*** 87,92 ****
--- 90,96 ----

   #include <net/ethernet.h>
   #include <net/if_arp.h>
+ #include <net/if_vlan_var.h>

   #include <vm/vm.h>		/* for vtophys */
   #include <vm/pmap.h>		/* for vtophys */
***************
*** 547,552 ****
--- 551,563 ----

   	callout_handle_init(&sc->stat_ch);

+ 	/*
+ 	 * According to the 82558 datasheet, the minimum RevID is 5, but
+ 	 * the OpenBSD code recognizes RevID 4 also as 82558. RevID 3 or
+ 	 * lower is guaranteed to be an 82557. 82559 starts at RevID 8.
+ 	 */
+ 	sc->not_82557 = pci_get_revid(dev) >= 4 ? 1 : 0;
+
   	s = splimp();

   	/*
***************
*** 600,606 ****
   		goto fail;
   	}

! 	device_printf(dev, "Ethernet address %6D%s\n",
   	    sc->arpcom.ac_enaddr, ":", sc->phy_10Mbps_only ? ", 10Mbps" : "");

   	ifp = &sc->arpcom.ac_if;
--- 611,618 ----
   		goto fail;
   	}

! 	device_printf(dev, "RevID 0x%02x, Ethernet address %6D%s\n",
! 	    pci_get_revid(dev),
   	    sc->arpcom.ac_enaddr, ":", sc->phy_10Mbps_only ? ", 10Mbps" : "");

   	ifp = &sc->arpcom.ac_if;
***************
*** 620,625 ****
--- 632,648 ----
   	 */
   	ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
   	/*
+ 	 * Tell the upper layer(s) wether we support long frames (mainly
+ 	 * for VLANs).
+ 	 */
+ #if NVLAN > 0
+ 	ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
+ #else
+ 	if (sc->not_82557) {
+ 		ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
+ 	}
+ #endif
+ 	/*
   	 * Let the system queue as many packets as we have available
   	 * TX descriptors.
   	 */
***************
*** 1278,1283 ****
--- 1301,1320 ----
   						m_freem(m);
   						goto rcvloop;
   					}
+ 					/*
+ 					 * Drop the packet if it has CRC
+ 					 * errors.
+ 					 *
+ 					 * This test is only needed when using
+ 					 * 802.1Q VLANs in 82557 cards, but we
+ 					 * would spend the same time testing
+ 					 * wether we must perform the test
+ 					 * as doing the test itself.
+ 					 */
+ 					if (rfa->rfa_status & FXP_RFA_STATUS_CRC) {
+ 						m_freem(m);
+ 						goto rcvloop;
+ 					}
   					m->m_pkthdr.rcvif = ifp;
   					m->m_pkthdr.len = m->m_len = total_len;
   					eh = mtod(m, struct ether_header *);
***************
*** 1558,1564 ****
--- 1595,1605 ----
   	cbp->late_scb =		0;	/* (don't) defer SCB update */
   	cbp->tno_int =		0;	/* (disable) tx not okay interrupt */
   	cbp->ci_int =		1;	/* interrupt on CU idle */
+ #if NVLAN > 0
+ 	cbp->save_bf =          sc->not_82557 ? prm : 1; /* save bad frames */
+ #else /* NVLAN > 0 */
   	cbp->save_bf =		prm;	/* save bad frames */
+ #endif /* NVLAN > 0 */
   	cbp->disc_short_rx =	!prm;	/* discard short packets */
   	cbp->underrun_retry =	1;	/* retry mode (1) on DMA underrun */
   	cbp->mediatype =	!sc->phy_10Mbps_only; /* interface mode */
***************
*** 1574,1579 ****
--- 1615,1621 ----
   	cbp->stripping =	!prm;	/* truncate rx packet to byte count */
   	cbp->padding =		1;	/* (do) pad short tx packets */
   	cbp->rcv_crc_xfer =	0;	/* (don't) xfer CRC to host */
+ 	cbp->long_rx =		sc->not_82557;	/* (enable) long packets */
   	cbp->force_fdx =	0;	/* (don't) force full duplex */
   	cbp->fdx_pin_en =	1;	/* (enable) FDX# pin */
   	cbp->multi_ia =		0;	/* (don't) accept multiple IAs */
*** sys/pci/if_fxpvar.h.orig	Tue Nov 21 11:10:53 2000
--- sys/pci/if_fxpvar.h	Tue Nov 21 12:05:55 2000
***************
*** 68,73 ****
--- 68,74 ----
   	int phy_primary_device;		/* device type of primary PHY */
   	int phy_10Mbps_only;		/* PHY is 10Mbps-only device */
   	int eeprom_size;		/* size of serial EEPROM */
+ 	int not_82557;			/* yes if we are 82558/82559 */
   	int suspended;			/* 0 = normal  1 = suspended (APM) */
   	u_int32_t saved_maps[5];	/* pci data */
   	u_int32_t saved_biosaddr;
*** sys/pci/if_fxpreg.h.orig	Thu Oct  5 11:55:04 2000
--- sys/pci/if_fxpreg.h	Tue Nov 21 12:09:22 2000
***************
*** 162,168 ****
   	volatile u_int		stripping:1,
   				padding:1,
   				rcv_crc_xfer:1,
! 				:5;
   	volatile u_int		:6,
   				force_fdx:1,
   				fdx_pin_en:1;
--- 162,169 ----
   	volatile u_int		stripping:1,
   				padding:1,
   				rcv_crc_xfer:1,
! 				long_rx:1,		/* 82558/82559 */
! 				:4;
   	volatile u_int		:6,
   				force_fdx:1,
   				fdx_pin_en:1;


--------------------------------------------------------------------
Mike Tancsa,                          	          tel +1 519 651 3400
Network Administration,     			  mike@sentex.net
Sentex Communications                 		  www.sentex.net
Cambridge, Ontario Canada			  www.sentex.net/mike


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4.2.2.20010306233020.01dc00e0>