Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Feb 2009 10:40:11 GMT
From:      Oleg <agile@sunbay.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/132001: [patch] ixgb update
Message-ID:  <200902231040.n1NAeBce089339@www.freebsd.org>
Resent-Message-ID: <200902231050.n1NAo19b040760@freefall.freebsd.org>

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

>Number:         132001
>Category:       kern
>Synopsis:       [patch] ixgb 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:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902231040.n1NAeBce089339>