Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 May 2001 17:48:30 +0200 (CEST)
From:      reinier.kleipool@band-x.nl
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        joop.feenstra@band-x.nl
Subject:   kern/27742: Patch for if_xl.c to fix vlan packets dropping
Message-ID:  <200105291548.f4TFmUu01311@r4-ams-xl0.band-x.nl>

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

>Number:         27742
>Category:       kern
>Synopsis:       if_xl.c drops 802.1q vlan packets
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 29 08:50:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Reinier Kleipool
>Release:        FreeBSD 4.3-RELEASE i386
>Organization:
Band-X Benelux
>Environment:
System: FreeBSD r4-ams.band-x.nl 4.3-RELEASE FreeBSD 4.3-RELEASE #4: Tue May 29 11:44:27 CEST 2001 root@r4-ams.band-x.nl:/usr/src/sys/compile/ASUS i386

>Description:
The 3C905X driver (/sys/pci/if_xl.c) does not allow reception of ethernet frames larger than 1518 bytes.
When the xl interface is used as a 802.1q trunk line it looses packets.
This patch configures the NIC to receive XL_PACKETS_SIZE (defined in /sys/pci/if_reg.h). Defaults to 1540.
>How-To-Repeat:
Connect a xl0 interface of FreeBSD to a Cisco Catalyst.
Configure the Catalyst port to trunking mode.
Configure a FreeBSD kernel with "pseudo-device vlan 4".
Configure a vlan interface with a parent i/f of xl0.
Try pinging something on the Catalyst VLAN with a packet size of 1500.
Both the Cat and FreeBSD will add 802.1q ethernetheader fields to the frames.
The incoming frames will be dropped by the driver. 
>Fix:
Patch if_xl.c to write the value of XL_PACKET_SIZE to the MaxPktSize register so
the NIC will accept frames up to that size.
Patch if_xlreg.h to change to XL_PACKETS_SIZE to 1540 and
add a #define for the MaxPktSize register of the nic.
See following two diffs:

r4-ams> diff -crN /sys/pci/if_xl.c /sys/pci/if_xl.c.orig
*** /sys/pci/if_xl.c	Tue May 29 11:15:36 2001
--- /sys/pci/if_xl.c.orig	Tue May 29 10:39:39 2001
***************
*** 2593,2601 ****
  	else
  		CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_COAX_STOP);
  
- 	/* increase packet size to allow reception of 802.1q or ISL packets */
- 	 if (sc->xl_type == XL_TYPE_905B) 
- 		CSR_WRITE_2(sc, XL_W3_MAXPKTSIZE, XL_PACKET_SIZE);
  	/* Clear out the stats counters. */
  	CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_STATS_DISABLE);
  	sc->xl_stats_no_timeout = 1;
--- 2593,2598 ----


r4-ams> diff -crN /sys/pci/if_xlreg.h /sys/pci/if_xlreg.h.orig

*** /sys/pci/if_xlreg.h	Tue May 29 11:44:02 2001
--- /sys/pci/if_xlreg.h.orig	Tue May 29 10:39:54 2001
***************
*** 80,86 ****
  #define XL_CAPS_100MBPS		0x1000
  #define XL_CAPS_PWRMGMT		0x2000
  
! #define XL_PACKET_SIZE 1540
  	
  /*
   * Register layouts.
--- 80,86 ----
  #define XL_CAPS_100MBPS		0x1000
  #define XL_CAPS_PWRMGMT		0x2000
  
! #define XL_PACKET_SIZE 1536
  	
  /*
   * Register layouts.
***************
*** 252,258 ****
   * Window 3 (fifo management)
   */
  #define XL_W3_INTERNAL_CFG	0x00
- #define XL_W3_MAXPKTSIZE	0x04    /* 3c905B only */
  #define XL_W3_RESET_OPT		0x08
  #define XL_W3_FREE_TX		0x0C
  #define XL_W3_FREE_RX		0x0A
--- 252,257 ----
>Release-Note:
>Audit-Trail:
>Unformatted:

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




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