Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Dec 2000 11:55:15 -0800 (PST)
From:      rh <rh@ts7.matriplex.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/23620: Fore PCA200E ATM driver problems with FreeBSD 4.1
Message-ID:  <200012181955.LAA00400@ts7.matriplex.com>
Resent-Message-ID: <200012182000.eBIK03E27483@freefall.freebsd.org>

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

>Number:         23620
>Category:       kern
>Synopsis:       Fore PCA200E ATM driver problems with FreeBSD 4.1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 18 12:00:03 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     rh@matriplex.com
>Release:        FreeBSD 4.1-RELEASE i386
>Organization:
Matriplex, inc.
>Environment:

FreeBSD 4.1 or later with the Fore PCA200E driver compiled in.
HARP options are assumed. 

>Description:

When using HARP and the Fore PCA200E driver (hfa), severe packet
loss occurs.  This will result in very low performance.

>How-To-Repeat:

Compile kernel with the following ATM options:
  device          hfa
  options         ATM_CORE                #core ATM protocol family
  options         ATM_IP                  #IP over ATM support
  options         ATM_SIGPVC              #SIGPVC signalling manager
  options         ATM_UNI                 #UNI signalling manager

Initialize ATM normally:
  /sbin/fore_dnld
  /sbin/atm set netif hfa0 atm 1
  /sbin/atm attach hfa0 uni31
  /sbin/ilmid
  /sbin/atm set arpserver atm0 <arpserver address>

Now ping another host on the ATM network.  Example:
  --- 192.168.100.18 ping statistics ---
  11 packets transmitted, 8 packets received, 27% packet loss
  round-trip min/avg/max/stddev = 0.617/0.870/1.161/0.146 ms                      
>Fix:

There are two problems in the Fore driver code.  The first is an offset
that became negative with the new 4.1 mbuf size, and an expedient fix
was suggested by Joseph Thomas on 09/01/2000.  This is the first part
of the patch.

The other problem is that the Fore driver uses the m_pkthdr field in
the mbuf chain for its own private data, but does not clear it before
handing the mbuf chain to the HARP layer.  With the pre-4.1 mbufs, this
did not (apparently) cause any harm, but the new mbuf structure adds
new fields, which now contain corrupted data.  The solution is to
clear these fields before the Fore driver passes the mbuf chain up
to the HARP layer.

A better solution might be to clear the entire mbuf m_pkthdr structure
so that future changes to the mbuf structure will not expose any new
problems with the driver's private data.  Such a change might look
like this:  bzero(mhead->m_pkthdr, sizeof(struct pkthdr));
The best solution is probably to rewrite the driver so that it does
not use the m_pkthdr field for its private data.  From the way the
#defines are written, it seems that this may have been the intention
of the author.

A working patch for the driver follows:

diff -U5 sys/dev/hfa/fore.h sys.new/dev/hfa/fore.h
--- sys/dev/hfa/fore.h	Fri Aug 27 17:41:48 1999
+++ sys.new/dev/hfa/fore.h	Mon Dec 18 10:26:49 2000
@@ -115,11 +115,11 @@
  *			BUF_DATA_ALIGN) - BUF1_SM_HDR)
  *	#define	BUF1_SM_SIZE	MAX(BUF1_SM_LEN - BUF1_SM_DOFF, 64)
  *
  */
 #if ((BSD >= 199103) && defined(FORE_PCI))
-#define	BUF1_SM_DOFF	((BUF1_SM_HOFF + SIZEOF_Buf_handle) - BUF1_SM_HDR)
+#define	BUF1_SM_DOFF	(SIZEOF_Buf_handle)
 #define	BUF1_SM_SIZE	(BUF1_SM_LEN - BUF1_SM_DOFF)
 #endif
 #if ((BSD < 199103) && defined(FORE_SBUS) && defined(sun4c))
 #define	BUF1_SM_DOFF	(BUF_DATA_ALIGN - BUF1_SM_HDR)
 #define	BUF1_SM_SIZE	(BUF1_SM_LEN - BUF1_SM_DOFF)
diff -U5 sys/dev/hfa/fore_receive.c sys.new/dev/hfa/fore_receive.c
--- sys/dev/hfa/fore_receive.c	Fri Aug 27 17:41:51 1999
+++ sys.new/dev/hfa/fore_receive.c	Mon Dec 18 10:29:16 2000
@@ -417,10 +417,13 @@
 		}
 
 		/*
 		 * It looks like we've got a valid PDU - count it quick!!
 		 */
+		mhead->m_pkthdr.rcvif = NULL;
+		mhead->m_pkthdr.csum_flags = 0;
+		mhead->m_pkthdr.aux   = NULL;
 		KB_PLENSET(mhead, pdulen);
 		fup->fu_pif.pif_ipdus++;
 		fup->fu_pif.pif_ibytes += pdulen;
 		vcp = fvp->fv_connvc->cvc_vcc;
 		vcp->vc_ipdus++;


>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?200012181955.LAA00400>