From boris@e-port.ru  Sat Oct  6 13:35:10 2007
Return-Path: <boris@e-port.ru>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 48C2116A41B
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  6 Oct 2007 13:35:10 +0000 (UTC)
	(envelope-from boris@e-port.ru)
Received: from apollo.e-port.ru (apollo.e-port.ru [195.128.68.230])
	by mx1.freebsd.org (Postfix) with ESMTP id C829C13C48E
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  6 Oct 2007 13:35:09 +0000 (UTC)
	(envelope-from boris@e-port.ru)
Received: (from localhost user: 'boris' uid#1014 fake: STDIN (boris@apollo.lan))
	by apollo.e-port.ru id S2498521AbXJFNWP for
	<FreeBSD-gnats-submit@freebsd.org>; Sat, 6 Oct 2007 17:22:15 +0400
Message-Id: <S2498521AbXJFNWP/20071006132218Z+58609@apollo.e-port.ru>
Date: Sat, 6 Oct 2007 17:22:15 +0400
From: Boris Lytochkin <boris.lytochkin@e-port.ru>
Sender: Boris Lytochkin <boris@e-port.ru>
Reply-To: Boris Lytochkin <boris.lytochkin@e-port.ru>
To: FreeBSD-gnats-submit@freebsd.org
Subject: make buildkernel fails on dev/em/em_if.c (1.65.2.24) when DEVICE_POLLING is set
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         116975
>Category:       kern
>Synopsis:       make buildkernel fails on dev/em/em_if.c (1.65.2.24) when DEVICE_POLLING is set
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 06 13:40:02 GMT 2007
>Closed-Date:    Sat Oct 06 19:51:29 GMT 2007
>Last-Modified:  Sat Oct 06 19:51:29 GMT 2007
>Originator:     Boris Lytochkin
>Release:        FreeBSD 6.2-STABLE-200708 i386
>Organization:
>Environment:
System: FreeBSD host 6.2-STABLE-200708 FreeBSD 6.2-STABLE-200708 #0: Fri Aug 17 09:31:11 UTC 2007     root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386


>Description:
	make buildkernel fails on dev/em/em_if.c (1.65.2.24) when DEVICE_POLLING is set in kernel config
/usr/src>make buildkernel
...
cc -c -O2 -pipe -fno-strict-aliasing  -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline
-Wcast-qual  -fformat-extensions -std=c99  -nostdinc -I-  -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -I/usr/src/sys/contrib/ipfilter
-I/usr/src/sys/contrib/pf -I/usr/src/sys/dev/ath -I/usr/src/sys/contrib/ngatm -I/usr/src/sys/dev/twa -I/usr/src/sys/dev/em -I/usr/src/sys/dev/em -D_KERNEL
-DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 
-mno-align-long-strings -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Werror  /usr/src/sys/dev/em/if_em.c
-I/usr/src/sys/dev/em
/usr/src/sys/dev/em/if_em.c: In function `em_allocate_intr':
/usr/src/sys/dev/em/if_em.c:2647: warning: passing arg 6 of `bus_setup_intr' from incompatible pointer type
/usr/src/sys/dev/em/if_em.c:2647: error: too many arguments to function `bus_setup_intr'
/usr/src/sys/dev/em/if_em.c: At top level:
/usr/src/sys/dev/em/if_em.c:3888: warning: 'em_tx_purge' defined but not used
*** Error code 1

Stop in /usr/obj/usr/src/sys/SMP6.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.

>How-To-Repeat:
	add "option DEVICE_POLLING" to kernel config file
	then try to compile kernel with new version of if_em driver:
	make -C /usr/src buildkernel
>Fix:
This patch eliminates errors while compile, but is totally untested
--- /usr/src/sys/dev/em/if_em.c.orig	2007-10-06 16:57:08.000000000 +0400
+++ /usr/src/sys/dev/em/if_em.c	2007-10-06 16:58:37.000000000 +0400
@@ -244,7 +244,9 @@
 static void	em_free_receive_structures(struct adapter *);
 static void	em_update_stats_counters(struct adapter *);
 static void	em_txeof(struct adapter *);
+#ifndef DEVICE_POLLING
 static void	em_tx_purge(struct adapter *);
+#endif
 static int	em_allocate_receive_structures(struct adapter *);
 static int	em_allocate_transmit_structures(struct adapter *);
 static int	em_rxeof(struct adapter *, int);
@@ -2643,7 +2645,7 @@
 	/* We do Legacy setup */
 	if (adapter->int_handler_tag == NULL &&
 	    (error = bus_setup_intr(dev, adapter->res_interrupt,
-	    INTR_TYPE_NET | INTR_MPSAFE, NULL, em_intr, adapter,
+	    INTR_TYPE_NET | INTR_MPSAFE, em_intr, adapter,
 	    &adapter->int_handler_tag)) != 0) {
 		device_printf(dev, "Failed to register interrupt handler");
 		return (error);
@@ -3883,6 +3885,7 @@
  *  seens mostly with fiber adapters.
  *
  **********************************************************************/
+#ifndef DEVICE_POLLING
 static void
 em_tx_purge(struct adapter *adapter)
 {
@@ -3894,7 +3897,7 @@
 		}
 	}
 }
-
+#endif
 /*********************************************************************
  *
  *  Get a buffer from system mbuf buffer pool.


>Release-Note:
>Audit-Trail:

From: Remko Lodder <remko@FreeBSD.org>
To: Boris Lytochkin <boris.lytochkin@e-port.ru>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: kern/116975: make buildkernel fails on dev/em/em_if.c (1.65.2.24)
 when DEVICE_POLLING is set
Date: Sat, 06 Oct 2007 15:55:21 +0200

 Boris Lytochkin wrote:
 >> Number:         116975
 >> Category:       kern
 >> Synopsis:       make buildkernel fails on dev/em/em_if.c (1.65.2.24) when DEVICE_POLLING is set
 >> Confidential:   no
 >> Severity:       serious
 >> Priority:       high
 >> Responsible:    freebsd-bugs
 >> State:          open
 >> Quarter:        
 >> Keywords:       
 >> Date-Required:
 >> Class:          sw-bug
 >> Submitter-Id:   current-users
 >> Arrival-Date:   Sat Oct 06 13:40:02 GMT 2007
 >> Closed-Date:
 >> Last-Modified:
 >> Originator:     Boris Lytochkin
 >> Release:        FreeBSD 6.2-STABLE-200708 i386
 >> Organization:
 >> Environment:
 > System: FreeBSD host 6.2-STABLE-200708 FreeBSD 6.2-STABLE-200708 #0: Fri Aug 17 09:31:11 UTC 2007     root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
 > 
 > 
 >> Description:
 > 	make buildkernel fails on dev/em/em_if.c (1.65.2.24) when DEVICE_POLLING is set in kernel config
 > /usr/src>make buildkernel
 
 Hello,
 
 From what I know DEVICE_POLLING is deprecated, so do you specifically
 need this? if_em does not need this at all actually. So personally
 i guess this is more a " do not do this, it's deprecated ".
 
 cheers
 remko
 
 -- 
 Kind regards,
 
      Remko Lodder               ** remko@elvandar.org
      FreeBSD                    ** remko@FreeBSD.org
 
      /* Quis custodiet ipsos custodes */
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Sat Oct 6 19:51:27 UTC 2007 
State-Changed-Why:  
This just had been fixed by Jack (jfv) within if_em. I still think one 
should not use DEVICE_POLLING. Thanks for reporting this though! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=116975 
>Unformatted:
