Subject: kern/30487: Hifn 7955 causes MAC errors with ssh.
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <gillham@vaultron.com>
List: netbsd-bugs
Date: 06/09/2005 23:03:00
>Number:         30487
>Category:       kern
>Synopsis:       Hifn 7955 causes MAC errors with ssh.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 09 23:03:00 +0000 2005
>Originator:     Andrew Gillham
>Release:        NetBSD 3.0_BETA -- June 8, 2005
>Organization:
>Environment:
	
	
System: NetBSD soekris 3.0_BETA NetBSD 3.0_BETA (SOEKRIS) #0: Wed Jun  8 18:55:36 PDT 2005  root@soekris:/sys/arch/i386/compile/SOEKRIS i386
Architecture: i386
Machine: i386
>Description:
	The Hifn 7955 (Soekris VPN1411) driver has issues which result in
	ssh failing with a "MAC corrupted" style message.  Note that this is
	not the PCI "noise" issue of the Soekris net4501, since I am using
	a net4801 and Soekris Engineering has confirmed the noise problem
	is not occurring on the net4801.
	OpenBSD applied a fix that appears to work for me, a diff against
	3.0_BETA is below.
>How-To-Repeat:
	I am able to repeat it on my Soekris 4801 by simply using ssh on
	the net4801.  With only a small amount of activity the connection
	will be broken.  From searching google, others have reproduced this
	with scp, cvs over ssh, etc.
	I believe you have to have a Hifn 7955 to see this issue.
From my dmesg:
hifn0 at pci0 dev 14 function 0: Hifn 7955, rev. 0
hifn0: 3DES/AES, 32KB dram, interrupting at irq 11

>Fix:
	Disabling the hifn in the kernel config resolves the ssh issue
	of course, but the following patch to sys/dev/pci/hifn7751.c
	was applied to the OpenBSD repository and appears to work for
	me on NetBSD/i386 3.0_BETA with the hifn driver enabled.

The OpenBSD diff is here:
http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/pci/hifn7751.c.diff?r1=1.148&r2=1.149&only_with_tag=OPENBSD_3_6

Index: hifn7751.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/hifn7751.c,v
retrieving revision 1.22
diff -u -r1.22 hifn7751.c
--- hifn7751.c	27 Feb 2005 00:27:32 -0000	1.22
+++ hifn7751.c	9 Jun 2005 22:49:14 -0000
@@ -1708,10 +1708,8 @@
 	 * interrupt salvages us from), unless there is more than one command
 	 * in the queue.
 	 */
-	if (dma->cmdu > 1) {
-		sc->sc_dmaier |= HIFN_DMAIER_C_WAIT;
-		WRITE_REG_1(sc, HIFN_1_DMA_IER, sc->sc_dmaier);
-	}
+	sc->sc_dmaier |= HIFN_DMAIER_C_WAIT;
+	WRITE_REG_1(sc, HIFN_1_DMA_IER, sc->sc_dmaier);
 
 	hifnstats.hst_ipackets++;
 	hifnstats.hst_ibytes += cmd->src_map->dm_mapsize;
@@ -2732,10 +2730,8 @@
 	 * interrupt salvages us from), unless there is more than one command
 	 * in the queue.
 	 */
-	if (dma->cmdu > 1) {
-		sc->sc_dmaier |= HIFN_DMAIER_C_WAIT;
-		WRITE_REG_1(sc, HIFN_1_DMA_IER, sc->sc_dmaier);
-	}
+	sc->sc_dmaier |= HIFN_DMAIER_C_WAIT;
+	WRITE_REG_1(sc, HIFN_1_DMA_IER, sc->sc_dmaier);
 
 	hifnstats.hst_ipackets++;
 	hifnstats.hst_ibytes += cmd->src_map->dm_mapsize;