From nobody@FreeBSD.org  Mon Feb 23 10:40:12 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4CCB31065670
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 23 Feb 2009 10:40:12 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 3B8B08FC18
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 23 Feb 2009 10:40:12 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n1NAeBAF089340
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 23 Feb 2009 10:40:11 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n1NAeBce089339;
	Mon, 23 Feb 2009 10:40:11 GMT
	(envelope-from nobody)
Message-Id: <200902231040.n1NAeBce089339@www.freebsd.org>
Date: Mon, 23 Feb 2009 10:40:11 GMT
From: Oleg <agile@sunbay.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] ixgb update
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         132001
>Category:       kern
>Synopsis:       [patch] [ixgb] driver update
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 23 10:50:00 UTC 2009
>Closed-Date:    
>Last-Modified:  Sat Feb 28 12:39:43 UTC 2009
>Originator:     Oleg
>Release:        FreeBSD 7.1 RELEASE
>Organization:
Sunbay
>Environment:
>Description:
First of all, need to update driver stored into src/sys/dev/ixgb/ with
fresh sources from Intel (ixgb-6.1.0.tar.gz):

http://downloadcenter.intel.com/Detail_Desc.aspx?ProductID=2245&DwnldID=10958&lang=eng

Next, apply this patch to make Intel driver compiled successfully into FreeBSD 7 environment.
>How-To-Repeat:
ixgb driver located in the trunk doesnt support cx4 adapter
>Fix:


Patch attached with submission follows:

diff -u -r ixgb-6.1.0/src/if_ixgb.c ixgb-6.1.0-patched/src/if_ixgb.c
--- ixgb-6.1.0/src/if_ixgb.c	2006-07-15 01:35:01.000000000 +0300
+++ ixgb-6.1.0-patched/src/if_ixgb.c	2009-01-16 17:06:41.000000000 +0200
@@ -665,8 +665,13 @@
 	ixgb_stop(adapter);
 
 	/* Get the latest mac address, User can use a LAA */
+#ifdef IFP2ENADDR
 	bcopy(IFP2ENADDR(adapter->ifp), adapter->hw.curr_mac_addr,
 	      IXGB_ETH_LENGTH_OF_ADDRESS);
+#elif __FreeBSD_version >= 700000
+	bcopy(IF_LLADDR(adapter->ifp), adapter->hw.curr_mac_addr,
+	     IXGB_ETH_LENGTH_OF_ADDRESS);	
+#endif
 
 	/* Initialize the hardware */
 	if (ixgb_hardware_init(adapter)) {
@@ -928,7 +933,9 @@
 	u_int8_t        txd_popts;
 	int             i, j, error, nsegs;
 
+#if __FreeBSD_version <= 700022
 	struct m_tag   *mtag;
+#endif
 	bus_dma_segment_t segs[IXGB_MAX_SCATTER];
 	bus_dmamap_t	map;
 	struct ixgb_buffer *tx_buffer = NULL;
@@ -976,7 +983,10 @@
 		txd_popts = 0;
 
 	/* Find out if we are in vlan mode */
+#if __FreeBSD_version <= 700022
 	mtag = VLAN_OUTPUT_TAG(ifp, m_head);
+#endif
+
 	i = adapter->next_avail_tx_desc;
 	for (j = 0; j < nsegs; j++) {
 		tx_buffer = &adapter->tx_buffer_area[i];
@@ -993,7 +1003,13 @@
 
 	adapter->num_tx_desc_avail -= nsegs;
 	adapter->next_avail_tx_desc = i;
-
+#if __FreeBSD_version > 700022
+	if (m_head->m_flags & M_VLANTAG) {
+		current_tx_desc->cmd_type_len |= IXGB_TX_DESC_CMD_VLE;
+		current_tx_desc->vlan = m_head->m_pkthdr.ether_vtag;
+	} else
+		current_tx_desc->vlan = 0;
+#else
 	if (mtag != NULL) {
 		/* Set the vlan id */
 		current_tx_desc->vlan = VLAN_TAG_VALUE(mtag);
@@ -1001,6 +1017,7 @@
 		/* Tell hardware to add tag */
 		current_tx_desc->cmd_type_len |= IXGB_TX_DESC_CMD_VLE;
 	}
+#endif
 	tx_buffer->m_head = m_head;
 	tx_buffer->map = map;
 	bus_dmamap_sync(adapter->txtag, map, BUS_DMASYNC_PREWRITE);
@@ -1254,7 +1271,7 @@
 	}
 	if (bus_setup_intr(dev, adapter->res_interrupt,
 			   INTR_TYPE_NET | INTR_MPSAFE,
-			   (void (*) (void *))ixgb_intr, adapter,
+			   NULL, (void (*) (void *))ixgb_intr, adapter,
 			   &adapter->int_handler_tag)) {
 		printf("ixgb%d: Error registering interrupt handler!\n",
 		       adapter->unit);
@@ -2119,18 +2136,34 @@
 				ixgb_receive_checksum(adapter, current_desc,
 						      adapter->fmp);
 
-				if (current_desc->status & IXGB_RX_DESC_STATUS_VP)
+#if __FreeBSD_version < 700000
+				if (current_desc->status & IXGB_RX_DESC_STATUS_VP) 
 					VLAN_INPUT_TAG(eh, adapter->fmp,
 						     current_desc->special);
+#else
+				if (current_desc->status & IXGB_RX_DESC_STATUS_VP) {
+					adapter->fmp->m_pkthdr.ether_vtag =
+					    current_desc->special;
+					adapter->fmp->m_flags |= M_VLANTAG;
+				}
+#endif
 				else
 					ether_input(ifp, eh, adapter->fmp);
 #else
 				ixgb_receive_checksum(adapter, current_desc,
 						      adapter->fmp);
+#if __FreeBSD_version < 700000
 				if (current_desc->status & IXGB_RX_DESC_STATUS_VP)
 					VLAN_INPUT_TAG(ifp, adapter->fmp,
 						       current_desc->special,
 						       adapter->fmp = NULL);
+#else
+				if (current_desc->status & IXGB_RX_DESC_STATUS_VP) {
+					adapter->fmp->m_pkthdr.ether_vtag =
+						current_desc->special;
+					adapter->fmp->m_flags |= M_VLANTAG;
+				}
+#endif
 
 				if (adapter->fmp != NULL) {
 					IXGB_UNLOCK(adapter);


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: gavin 
State-Changed-When: Mon Feb 23 14:20:19 UTC 2009 
State-Changed-Why:  
To submitter: Can you confirm that your network card isn't already 
supported by the ixgbe driver?  Can you also please five the output 
of "pciconf -l" for the network card in question? 


Responsible-Changed-From-To: freebsd-bugs->gavin 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Mon Feb 23 14:20:19 UTC 2009 
Responsible-Changed-Why:  
Track 

http://www.freebsd.org/cgi/query-pr.cgi?pr=132001 

From: Gavin Atkinson <gavin@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/132001: [patch] ixgb update
Date: Tue, 24 Feb 2009 10:55:25 +0000

 -------- Forwarded Message --------
 From: agile@sunbay.com
 Date: Mon, 23 Feb 2009 21:42:58 +0200 (EET)
 
 em0@pci0:4:0:0: class=0x020000 card=0x53808086 chip=0x10968086 rev=0x01 hdr=0x00
 em1@pci0:4:0:1: class=0x020000 card=0x53808086 chip=0x10968086 rev=0x01 hdr=0x00
 none2@pci0:5:1:0: class=0x020000 card=0xa00c8086 chip=0x109e8086 rev=0x02 hdr=0x00
 
 
 Regards,
   Oleg.
 
State-Changed-From-To: feedback->open 
State-Changed-By: gavin 
State-Changed-When: Sat Feb 28 12:39:06 UTC 2009 
State-Changed-Why:  
Feedback received 


Responsible-Changed-From-To: gavin->freebsd-bugs 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Sat Feb 28 12:39:06 UTC 2009 
Responsible-Changed-Why:  
Back into the pool 

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