Subject: kern/24200: the "new" ppbus/lpt unnecessary limits DMA to just a few bytes.
To: None <gnats-bugs@gnats.NetBSD.org>
From: Paul Shupak <paul@svcs.plectere.com>
List: netbsd-bugs
Date: 01/22/2004 18:41:25
>Number:         24200
>Category:       kern
>Synopsis:       the "new" ppbus/lpt unnecessary limits DMA to just a few bytes.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 23 02:42:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Paul Shupak
>Release:        NetBSD 1.6ZH
>Organization:
	
>Environment:
	
	
System: NetBSD svcs 1.6ZH NetBSD 1.6ZH (SVCS) #12: Thu Jan 22 09:57:42 PST 2004 root@svcs:/sys/arch/i386/compile/SVCS i386
Architecture: i386
Machine: i386
>Description:
	The code in sys/dev/ic/atppc.c limits the size of a DMA transfer
	to no more than the size of the FIFO ( which it has emptied ).
	This make the DMA's DRQ/DAck unused wasting the prupose of using
	DMA to begin with and greatly slows the driver.
>How-To-Repeat:
	Use the new "lptctl" to enable DMA/ECP transfer on a bit mapped
	printer ( I'm using an HP PhotoSmart P1100 through hpijs-1.5 and
	a LaserJet 6MP directly ).
	NOTE: This change plus raising the buffer size in
	sys/dev/ppbus/lptvar.h from PAGESIZE to MAXBSIZE will give me
	almost 75% if HP's rated performance for the P1100 vs. less than
	4% with the "old" lpt driver and 13% with the "ppbus" but limited
	DMA size.  Also, I believe that the FIFO being emptied between
	interrupts is also unnecessary and causes serveral "extra" service
	interrupts ( which are ignored ) and spends unneeded time at a
	raised spl level.
>Fix:
Index: atppc.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/atppc.c,v
retrieving revision 1.6
diff -c -r1.6 atppc.c
*** atppc.c	2004/01/22 14:28:57	1.6
--- atppc.c	2004/01/23 02:17:36
***************
*** 2198,2208 ****
  		atppc_w_ecr(atppc, ecr);
  		atppc_barrier_w(atppc);
  		
- 		/* Limit transfer to minimum of space in FIFO and buffer */
- 		worklen = min(len, atppc->sc_fifo);
- 
  		/* Limit transfer to maximum DMA size and start it */
! 		worklen = min(worklen, atppc->sc_dma_maxsize);
  		atppc->sc_dmastat = ATPPC_DMA_INIT;
  		atppc->sc_dma_start(atppc, atppc->sc_outbstart,
  			worklen, ATPPC_DMA_MODE_WRITE);
--- 2198,2205 ----
  		atppc_w_ecr(atppc, ecr);
  		atppc_barrier_w(atppc);
  		
  		/* Limit transfer to maximum DMA size and start it */
! 		worklen = min(len, atppc->sc_dma_maxsize);
  		atppc->sc_dmastat = ATPPC_DMA_INIT;
  		atppc->sc_dma_start(atppc, atppc->sc_outbstart,
  			worklen, ATPPC_DMA_MODE_WRITE);
	
>Release-Note:
>Audit-Trail:
>Unformatted: