svn commit: r250661 - in head: share/man/man4 sys/conf sys/dev/qlxgbe sys/modules sys/modules/qlxgbe

David C Somayajulu davidcs at FreeBSD.org
Wed May 15 17:03:12 UTC 2013


Author: davidcs
Date: Wed May 15 17:03:09 2013
New Revision: 250661
URL: http://svnweb.freebsd.org/changeset/base/250661

Log:
  Add Qlogic 10Gigabit Ethernet & CNA Adapter Driver Version 3.10.10 for
  QLogic 8300 Series Adapters
  
  Submitted by: David C Somayajulu (davidcs at freebsd.org) QLogic Corporation
  Approved by: George Neville-Neil (gnn at freebsd.org)

Added:
  head/share/man/man4/qlxgbe.4   (contents, props changed)
  head/sys/dev/qlxgbe/
  head/sys/dev/qlxgbe/README.txt   (contents, props changed)
  head/sys/dev/qlxgbe/ql_dbg.c   (contents, props changed)
  head/sys/dev/qlxgbe/ql_dbg.h   (contents, props changed)
  head/sys/dev/qlxgbe/ql_def.h   (contents, props changed)
  head/sys/dev/qlxgbe/ql_glbl.h   (contents, props changed)
  head/sys/dev/qlxgbe/ql_hw.c   (contents, props changed)
  head/sys/dev/qlxgbe/ql_hw.h   (contents, props changed)
  head/sys/dev/qlxgbe/ql_inline.h   (contents, props changed)
  head/sys/dev/qlxgbe/ql_ioctl.c   (contents, props changed)
  head/sys/dev/qlxgbe/ql_ioctl.h   (contents, props changed)
  head/sys/dev/qlxgbe/ql_isr.c   (contents, props changed)
  head/sys/dev/qlxgbe/ql_misc.c   (contents, props changed)
  head/sys/dev/qlxgbe/ql_os.c   (contents, props changed)
  head/sys/dev/qlxgbe/ql_os.h   (contents, props changed)
  head/sys/dev/qlxgbe/ql_reset.c   (contents, props changed)
  head/sys/dev/qlxgbe/ql_tmplt.h   (contents, props changed)
  head/sys/dev/qlxgbe/ql_ver.h   (contents, props changed)
  head/sys/modules/qlxgbe/
  head/sys/modules/qlxgbe/Makefile   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/sys/conf/files.amd64
  head/sys/modules/Makefile

Modified: head/share/man/man4/Makefile
==============================================================================
--- head/share/man/man4/Makefile	Wed May 15 14:35:02 2013	(r250660)
+++ head/share/man/man4/Makefile	Wed May 15 17:03:09 2013	(r250661)
@@ -371,6 +371,7 @@ MAN=	aac.4 \
 	pty.4 \
 	puc.4 \
 	${_qlxgb.4} \
+	${_qlxgbe.4} \
 	ral.4 \
 	random.4 \
 	rc.4 \
@@ -791,9 +792,11 @@ _if_ntb.4=	if_ntb.4
 _ntb.4=		ntb.4
 _ntb_hw.4=	ntb_hw.4
 _qlxgb.4=	qlxgb.4
+_qlxgbe.4=	qlxgbe.4
 _sfxge.4=	sfxge.4
 
 MLINKS+=qlxgb.4 if_qlxgb.4
+MLINKS+=qlxgbe.4 if_qlxgbe.4
 MLINKS+=sfxge.4 if_sfxge.4
 .endif
 

Added: head/share/man/man4/qlxgbe.4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man4/qlxgbe.4	Wed May 15 17:03:09 2013	(r250661)
@@ -0,0 +1,91 @@
+.\"-
+.\" Copyright (c) 2013 Qlogic Corportaion 
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 1, 2013
+.Dt QLXGBE 4
+.Os
+.Sh NAME
+.Nm qlxgbe
+.Nd "QLogic 10 Gigabit Ethernet & CNA Adapter Driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device qlxgbe"
+.Ed
+.Pp
+To load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_qlxgbe_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports IPv4 checksum offload,
+TCP and UDP checksum offload for both IPv4 and IPv6,
+Large Segment Offload for both IPv4 and IPv6,
+Jumbo frames, VLAN Tag, and
+Receive Side scaling.
+For further hardware information, see
+.Pa http://www.qlogic.com/ .
+.Sh HARDWARE
+The
+.Nm
+driver supports 10 Gigabit Ethernet & CNA Adapter based on the following
+chipsets:
+.Pp
+.Bl -bullet -compact
+.It
+QLogic 8300 series
+.El
+.Sh SUPPORT
+For support questions please contact your QLogic approved reseller or
+QLogic Technical Support at
+.Pa http://support.qlogic.com ,
+or by E-mail at
+.Aq support at qlogic.com .
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An David C Somayajulu
+at QLogic Corporation.

Modified: head/sys/conf/files.amd64
==============================================================================
--- head/sys/conf/files.amd64	Wed May 15 14:35:02 2013	(r250660)
+++ head/sys/conf/files.amd64	Wed May 15 17:03:09 2013	(r250661)
@@ -232,6 +232,13 @@ dev/qlxgb/qla_ioctl.c		optional	qlxgb pc
 dev/qlxgb/qla_isr.c		optional	qlxgb pci
 dev/qlxgb/qla_misc.c		optional	qlxgb pci
 dev/qlxgb/qla_os.c		optional	qlxgb pci
+dev/qlxgbe/ql_dbg.c		optional	qlxgbe pci
+dev/qlxgbe/ql_hw.c		optional	qlxgbe pci
+dev/qlxgbe/ql_ioctl.c		optional	qlxgbe pci
+dev/qlxgbe/ql_isr.c		optional	qlxgbe pci
+dev/qlxgbe/ql_misc.c		optional	qlxgbe pci
+dev/qlxgbe/ql_os.c		optional	qlxgbe pci
+dev/qlxgbe/ql_reset.c		optional	qlxgbe pci
 dev/sfxge/common/efx_bootcfg.c	optional sfxge inet pci
 dev/sfxge/common/efx_ev.c	optional sfxge inet pci
 dev/sfxge/common/efx_filter.c	optional sfxge inet pci

Added: head/sys/dev/qlxgbe/README.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/qlxgbe/README.txt	Wed May 15 17:03:09 2013	(r250661)
@@ -0,0 +1,102 @@
+# $FreeBSD$
+
+			README File
+		QLogic 8300 series Dual Port
+10 Gigabit Ethernet & CNA Adapter Driver for FreeBSD 9.x/10.x
+
+		QLogic Corporation.
+		All rights reserved. 
+
+
+Table of Contents
+1. Package Contents 
+2. OS Support
+3. Supported Features
+4. Using the Driver
+   4.1 Installing the driver
+   4.2 Removing the driver
+5. Driver Parameters
+6. Additional Notes
+7. Contacting Support
+
+1. Package Contents 
+ * Documentation 
+   - README (this document) version:1.0
+   - Release Notes Version:1.0
+ * Driver (if_qlxgbe.ko)
+	- FreeBSD 9.x/10.x
+ * Firmware: pre-flashed on QLogic adapter;
+
+2. OS Support
+
+The Qlogic 83xx 10Gigabit Ethernet/CNA driver is compatible with the 
+following OS platforms:
+ * FreeBSD 9.x/10.x (64-bit) [Intel EM64T, AMD64]
+
+3. Supported Features
+10Gigabit Ethernet NIC/CNA driver supports following features
+
+* Large Segment Offload over TCP IPV4
+* Large Segment Offload over TCP IPV6
+* Receive Side scaling
+* TCP over IPv4 checksum offload
+* UDP over IPv4 checksum offload
+* IPV4 checksum offload
+* TCP over IPv6 checksum offload
+* UDP over IPv6 checksum offload
+* Jumbo frames
+* VLAN Tag
+
+
+4. Using the driver
+
+ 4.1 Installing the driver
+
+   - copy the driver file (if_qlxgbe.ko) into some directory (say qla_driver)
+   - cd <to qla_driver>
+   - kldload -v ./if_qlxgbe.ko
+
+ 4.2 Removing the driver
+ 
+  - kldunload if_qlxgbe
+
+5. Parameters to set prior to installing the driver
+
+   - Add the following lines to /etc/sysctl.conf and reboot the machine prior
+     to installing the driver
+   
+	kern.ipc.nmbjumbo9=262144
+	net.inet.tcp.recvbuf_max=262144
+	net.inet.tcp.recvbuf_inc=16384
+	kern.ipc.nmbclusters=1000000
+	kern.ipc.maxsockbuf=2097152
+	net.inet.tcp.recvspace=131072
+	net.inet.tcp.sendbuf_max=262144
+	net.inet.tcp.sendspace=65536
+ 
+   - If you do not want to reboot the system please run the following commands
+
+	login or su to root
+
+	sysctl kern.ipc.nmbjumbo9=262144
+	sysctl net.inet.tcp.recvbuf_max=262144
+	sysctl net.inet.tcp.recvbuf_inc=16384
+	sysctl kern.ipc.nmbclusters=1000000
+	sysctl kern.ipc.maxsockbuf=2097152
+	sysctl net.inet.tcp.recvspace=131072
+	sysctl net.inet.tcp.sendbuf_max=262144
+	sysctl net.inet.tcp.sendspace=65536
+
+6. Compile options Makefile if building driver from sources
+	None
+
+7. Contacting Support 
+Please feel free to contact your QLogic approved reseller or QLogic 
+Technical Support at any phase of integration for assistance. QLogic
+Technical Support can be reached by the following methods: 
+Web:    http://support.qlogic.com
+E-mail: support at qlogic.com
+(c) Copyright 2013-14. All rights reserved worldwide. QLogic, the QLogic 
+logo, and the Powered by QLogic logo are registered trademarks of
+QLogic Corporation. All other brand and product names are trademarks 
+or registered trademarks of their respective owners. 

Added: head/sys/dev/qlxgbe/ql_dbg.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/qlxgbe/ql_dbg.c	Wed May 15 17:03:09 2013	(r250661)
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2013-2014 Qlogic Corporation
+ * All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * File : ql_dbg.c
+ * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "ql_os.h"
+#include "ql_hw.h"
+#include "ql_def.h"
+#include "ql_inline.h"
+#include "ql_ver.h"
+#include "ql_glbl.h"
+#include "ql_dbg.h"
+
+/*
+ * Name: ql_dump_buf32
+ * Function: dumps a buffer as 32 bit words
+ */
+void ql_dump_buf32(qla_host_t *ha, const char *msg, void *dbuf32, uint32_t len32)
+{
+        device_t dev;
+	uint32_t i = 0;
+	uint32_t *buf;
+
+        dev = ha->pci_dev;
+	buf = dbuf32;
+
+	device_printf(dev, "%s: %s dump start\n", __func__, msg);
+
+	while (len32 >= 4) {
+		device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
+			i, buf[0], buf[1], buf[2], buf[3]);
+		i += 4 * 4;
+		len32 -= 4;
+		buf += 4;
+	}
+	switch (len32) {
+	case 1:
+		device_printf(dev,"0x%08x: 0x%08x\n", i, buf[0]);
+		break;
+	case 2:
+		device_printf(dev,"0x%08x: 0x%08x 0x%08x\n", i, buf[0], buf[1]);
+		break;
+	case 3:
+		device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x\n",
+			i, buf[0], buf[1], buf[2]);
+		break;
+	default:
+		break;
+	}
+	device_printf(dev, "%s: %s dump end\n", __func__, msg);
+}
+
+/*
+ * Name: ql_dump_buf16
+ * Function: dumps a buffer as 16 bit words
+ */
+void ql_dump_buf16(qla_host_t *ha, const char *msg, void *dbuf16, uint32_t len16)
+{
+        device_t dev;
+	uint32_t i = 0;
+	uint16_t *buf;
+
+        dev = ha->pci_dev;
+	buf = dbuf16;
+
+	device_printf(dev, "%s: %s dump start\n", __func__, msg);
+
+	while (len16 >= 8) {
+		device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x"
+			" 0x%04x 0x%04x 0x%04x 0x%04x\n", i, buf[0],
+			buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
+		i += 16;
+		len16 -= 8;
+		buf += 8;
+	}
+	switch (len16) {
+	case 1:
+		device_printf(dev,"0x%08x: 0x%04x\n", i, buf[0]);
+		break;
+	case 2:
+		device_printf(dev,"0x%08x: 0x%04x 0x%04x\n", i, buf[0], buf[1]);
+		break;
+	case 3:
+		device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x\n",
+			i, buf[0], buf[1], buf[2]);
+		break;
+	case 4:
+		device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
+			buf[0], buf[1], buf[2], buf[3]);
+		break;
+	case 5:
+		device_printf(dev,"0x%08x:"
+			" 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4]);
+		break;
+	case 6:
+		device_printf(dev,"0x%08x:"
+			" 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
+		break;
+	case 7:
+		device_printf(dev,"0x%04x: 0x%04x 0x%04x 0x%04x 0x%04x"
+			" 0x%04x 0x%04x 0x%04x\n", i, buf[0], buf[1],
+			buf[2], buf[3], buf[4], buf[5], buf[6]);
+		break;
+	default:
+		break;
+	}
+	device_printf(dev, "%s: %s dump end\n", __func__, msg);
+}
+
+/*
+ * Name: ql_dump_buf8
+ * Function: dumps a buffer as bytes
+ */
+void ql_dump_buf8(qla_host_t *ha, const char *msg, void *dbuf, uint32_t len)
+{
+        device_t dev;
+	uint32_t i = 0;
+	uint8_t *buf;
+
+        dev = ha->pci_dev;
+	buf = dbuf;
+
+	device_printf(dev, "%s: %s 0x%x dump start\n", __func__, msg, len);
+	
+	while (len >= 16) {
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3],
+			buf[4], buf[5], buf[6], buf[7],
+			buf[8], buf[9], buf[10], buf[11],
+			buf[12], buf[13], buf[14], buf[15]);
+		i += 16;
+		len -= 16;
+		buf += 16;
+	}
+	switch (len) {
+	case 1:
+		device_printf(dev,"0x%08x: %02x\n", i, buf[0]);
+		break;
+	case 2:
+		device_printf(dev,"0x%08x: %02x %02x\n", i, buf[0], buf[1]);
+		break;
+	case 3:
+		device_printf(dev,"0x%08x: %02x %02x %02x\n",
+			i, buf[0], buf[1], buf[2]);
+		break;
+	case 4:
+		device_printf(dev,"0x%08x: %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3]);
+		break;
+	case 5:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4]);
+		break;
+	case 6:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
+		break;
+	case 7:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
+		break;
+	case 8:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7]);
+		break;
+	case 9:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8]);
+		break;
+	case 10:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8], buf[9]);
+		break;
+	case 11:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8], buf[9], buf[10]);
+		break;
+	case 12:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8], buf[9], buf[10], buf[11]);
+		break;
+	case 13:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8], buf[9], buf[10], buf[11], buf[12]);
+		break;
+	case 14:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
+			buf[13]);
+		break;
+	case 15:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
+			buf[13], buf[14]);
+		break;
+	default:
+		break;
+	}
+	
+	device_printf(dev, "%s: %s dump end\n", __func__, msg);
+}
+

Added: head/sys/dev/qlxgbe/ql_dbg.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/qlxgbe/ql_dbg.h	Wed May 15 17:03:09 2013	(r250661)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2013-2014 Qlogic Corporation
+ * All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * File : ql_dbg.h
+ * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
+ */
+
+#ifndef _QL_DBG_H_
+#define _QL_DBG_H_
+
+extern void ql_dump_buf8(qla_host_t *ha, const char *str, void *dbuf,
+		uint32_t len);
+extern void ql_dump_buf16(qla_host_t *ha, const char *str, void *dbuf,
+		uint32_t len16);
+extern void ql_dump_buf32(qla_host_t *ha, const char *str, void *dbuf,
+		uint32_t len32);
+
+#define INJCT_RX_RXB_INVAL		0x00001
+#define INJCT_RX_MP_NULL		0x00002
+#define INJCT_LRO_RXB_INVAL		0x00003
+#define INJCT_LRO_MP_NULL		0x00004
+#define INJCT_NUM_HNDLE_INVALID		0x00005
+#define INJCT_RDWR_INDREG_FAILURE	0x00006
+#define INJCT_RDWR_OFFCHIPMEM_FAILURE	0x00007
+#define INJCT_MBX_CMD_FAILURE		0x00008
+#define INJCT_HEARTBEAT_FAILURE		0x00009
+#define INJCT_TEMPERATURE_FAILURE	0x0000A
+
+#ifdef QL_DBG
+
+#define QL_DPRINT1(ha, x)	if (ha->dbg_level & 0x0001) device_printf x
+#define QL_DPRINT2(ha, x)	if (ha->dbg_level & 0x0002) device_printf x
+#define QL_DPRINT4(ha, x)	if (ha->dbg_level & 0x0004) device_printf x
+#define QL_DPRINT8(ha, x)	if (ha->dbg_level & 0x0008) device_printf x
+#define QL_DPRINT10(ha, x)	if (ha->dbg_level & 0x0010) device_printf x
+#define QL_DPRINT20(ha, x)	if (ha->dbg_level & 0x0020) device_printf x
+#define QL_DPRINT40(ha, x)	if (ha->dbg_level & 0x0040) device_printf x
+#define QL_DPRINT80(ha, x)	if (ha->dbg_level & 0x0080) device_printf x
+
+#define QL_DUMP_BUFFER8(h, s, b, n) if (h->dbg_level & 0x08000000)\
+					qla_dump_buf8(h, s, b, n)
+#define QL_DUMP_BUFFER16(h, s, b, n) if (h->dbg_level & 0x08000000)\
+					qla_dump_buf16(h, s, b, n)
+#define QL_DUMP_BUFFER32(h, s, b, n) if (h->dbg_level & 0x08000000)\
+					qla_dump_buf32(h, s, b, n)
+
+#define QL_ASSERT(ha, x, y)		if (!x && !ha->err_inject) panic y
+#define QL_ERR_INJECT(ha, val)		(ha->err_inject == val)
+
+#else
+
+#define QL_DPRINT1(ha, x)
+#define QL_DPRINT2(ha, x)
+#define QL_DPRINT4(ha, x)
+#define QL_DPRINT8(ha, x)
+#define QL_DPRINT10(ha, x)
+#define QL_DPRINT20(ha, x)
+#define QL_DPRINT40(ha, x)
+#define QL_DPRINT80(ha, x)
+
+#define QL_DUMP_BUFFER8(h, s, b, n)
+#define QL_DUMP_BUFFER16(h, s, b, n)
+#define QL_DUMP_BUFFER32(h, s, b, n)
+
+#define QL_ASSERT(ha, x, y)
+#define QL_ERR_INJECT(ha, val)		0
+
+#endif
+
+
+#endif /* #ifndef _QL_DBG_H_ */

Added: head/sys/dev/qlxgbe/ql_def.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/qlxgbe/ql_def.h	Wed May 15 17:03:09 2013	(r250661)
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2013-2014 Qlogic Corporation
+ * All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * File: ql_def.h
+ * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
+ */
+
+#ifndef _QL_DEF_H_
+#define _QL_DEF_H_
+
+#define BIT_0                   (0x1 << 0)
+#define BIT_1                   (0x1 << 1)
+#define BIT_2                   (0x1 << 2)
+#define BIT_3                   (0x1 << 3)
+#define BIT_4                   (0x1 << 4)
+#define BIT_5                   (0x1 << 5)
+#define BIT_6                   (0x1 << 6)
+#define BIT_7                   (0x1 << 7)
+#define BIT_8                   (0x1 << 8)
+#define BIT_9                   (0x1 << 9)
+#define BIT_10                  (0x1 << 10)
+#define BIT_11                  (0x1 << 11)
+#define BIT_12                  (0x1 << 12)
+#define BIT_13                  (0x1 << 13)
+#define BIT_14                  (0x1 << 14)
+#define BIT_15                  (0x1 << 15)
+#define BIT_16                  (0x1 << 16)
+#define BIT_17                  (0x1 << 17)
+#define BIT_18                  (0x1 << 18)
+#define BIT_19                  (0x1 << 19)
+#define BIT_20                  (0x1 << 20)
+#define BIT_21                  (0x1 << 21)
+#define BIT_22                  (0x1 << 22)
+#define BIT_23                  (0x1 << 23)
+#define BIT_24                  (0x1 << 24)
+#define BIT_25                  (0x1 << 25)
+#define BIT_26                  (0x1 << 26)
+#define BIT_27                  (0x1 << 27)
+#define BIT_28                  (0x1 << 28)
+#define BIT_29                  (0x1 << 29)
+#define BIT_30                  (0x1 << 30)
+#define BIT_31                  (0x1 << 31)
+
+struct qla_rx_buf {
+	struct mbuf	*m_head;
+	bus_dmamap_t	map;
+	bus_addr_t      paddr;
+	uint32_t	handle;
+	void		*next;
+};
+typedef struct qla_rx_buf qla_rx_buf_t;
+
+struct qla_rx_ring {
+	qla_rx_buf_t	rx_buf[NUM_RX_DESCRIPTORS];
+};
+typedef struct qla_rx_ring qla_rx_ring_t;
+
+struct qla_tx_buf {
+	struct mbuf	*m_head;
+	bus_dmamap_t	map;
+};
+typedef struct qla_tx_buf qla_tx_buf_t;
+
+#define QLA_MAX_SEGMENTS	62	/* maximum # of segs in a sg list */
+#define QLA_MAX_MTU		9000
+#define QLA_STD_FRAME_SIZE	1514
+#define QLA_MAX_TSO_FRAME_SIZE	((64 * 1024 - 1) + 22)
+
+/* Number of MSIX/MSI Vectors required */
+
+struct qla_ivec {
+	uint32_t		sds_idx;
+	void			*ha;
+	struct resource		*irq;
+	void			*handle;
+	int			irq_rid;
+};
+
+typedef struct qla_ivec qla_ivec_t;
+
+#define QLA_WATCHDOG_CALLOUT_TICKS	1
+
+typedef struct _qla_tx_ring {
+	qla_tx_buf_t	tx_buf[NUM_TX_DESCRIPTORS];
+	uint64_t	count;
+} qla_tx_ring_t;
+
+/*
+ * Adapter structure contains the hardware independant information of the
+ * pci function.
+ */
+struct qla_host {
+        volatile struct {
+                volatile uint32_t
+			qla_callout_init	:1,
+			qla_watchdog_active	:1,
+			qla_watchdog_exit	:1,
+			qla_watchdog_pause	:1,
+			lro_init		:1,
+			stop_rcv		:1,
+			parent_tag		:1,
+			lock_init		:1;
+        } flags;
+
+	volatile uint32_t	qla_watchdog_exited;
+	volatile uint32_t	qla_watchdog_paused;
+	volatile uint32_t	qla_initiate_recovery;
+
+	device_t		pci_dev;
+
+	uint16_t		watchdog_ticks;
+	uint8_t			pci_func;
+	uint8_t			resvd;
+
+        /* ioctl related */
+        struct cdev             *ioctl_dev;
+
+	/* register mapping */
+	struct resource		*pci_reg;
+	int			reg_rid;
+	struct resource		*pci_reg1;
+	int			reg_rid1;
+
+	/* interrupts */
+	struct resource         *mbx_irq;
+	void			*mbx_handle;
+	int			mbx_irq_rid;
+
+	int			msix_count;
+
+	qla_ivec_t		irq_vec[MAX_SDS_RINGS];
+	
+	/* parent dma tag */
+	bus_dma_tag_t           parent_tag;
+
+	/* interface to o.s */
+	struct ifnet		*ifp;
+
+	struct ifmedia		media;
+	uint16_t		max_frame_size;
+	uint16_t		rsrvd0;
+	int			if_flags;
+
+	/* hardware access lock */
+
+	struct mtx		hw_lock;
+	volatile uint32_t	hw_lock_held;
+
+	/* transmit and receive buffers */
+	uint32_t		txr_idx; /* index of the current tx ring */
+	qla_tx_ring_t		tx_ring[NUM_TX_RINGS];
+						
+	bus_dma_tag_t		tx_tag;
+	struct task		tx_task;
+	struct taskqueue	*tx_tq;
+	struct callout		tx_callout;
+	struct mtx		tx_lock;
+
+	qla_rx_ring_t		rx_ring[MAX_RDS_RINGS];
+	bus_dma_tag_t		rx_tag;
+	uint32_t		std_replenish;
+
+	qla_rx_buf_t		*rxb_free;
+	uint32_t		rxb_free_count;
+	volatile uint32_t	posting;
+
+	/* stats */
+	uint32_t		err_m_getcl;
+	uint32_t		err_m_getjcl;
+	uint32_t		err_tx_dmamap_create;
+	uint32_t		err_tx_dmamap_load;
+	uint32_t		err_tx_defrag;
+
+	uint64_t		rx_frames;
+	uint64_t		rx_bytes;
+
+	uint64_t		lro_pkt_count;
+	uint64_t		lro_bytes;
+
+	uint64_t		ipv4_lro;
+	uint64_t		ipv6_lro;
+
+	uint64_t		tx_frames;
+	uint64_t		tx_bytes;
+	uint64_t		tx_tso_frames;
+	uint64_t		hw_vlan_tx_frames;
+
+        uint32_t                fw_ver_major;
+        uint32_t                fw_ver_minor;
+        uint32_t                fw_ver_sub;
+        uint32_t                fw_ver_build;
+
+	/* hardware specific */
+	qla_hw_t		hw;
+
+	/* debug stuff */
+	volatile const char 	*qla_lock;
+	volatile const char	*qla_unlock;
+	uint32_t		dbg_level;
+
+	uint8_t			fw_ver_str[32];
+
+	/* Error Injection Related */
+	uint32_t		err_inject;
+	struct task		err_task;
+	struct taskqueue	*err_tq;
+
+	/* Peer Device */
+	device_t		peer_dev;
+
+	volatile uint32_t	msg_from_peer;
+#define QL_PEER_MSG_RESET	0x01
+#define QL_PEER_MSG_ACK		0x02
+
+};
+typedef struct qla_host qla_host_t;
+
+/* note that align has to be a power of 2 */
+#define QL_ALIGN(size, align) (size + (align - 1)) & ~(align - 1);
+#define QL_MIN(x, y) ((x < y) ? x : y)
+
+#define QL_RUNNING(ifp) \
+		((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == \
+			IFF_DRV_RUNNING)
+
+/* Return 0, if identical, else 1 */
+#define QL_MAC_CMP(mac1, mac2)    \
+	((((*(uint32_t *) mac1) == (*(uint32_t *) mac2) && \
+	(*(uint16_t *)(mac1 + 4)) == (*(uint16_t *)(mac2 + 4)))) ? 0 : 1)
+
+#endif /* #ifndef _QL_DEF_H_ */

Added: head/sys/dev/qlxgbe/ql_glbl.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/qlxgbe/ql_glbl.h	Wed May 15 17:03:09 2013	(r250661)
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2013-2014 Qlogic Corporation
+ * All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+/*
+ * File: ql_glbl.h
+ * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
+ * Content: Contains prototypes of the exported functions from each file.
+ */
+#ifndef _QL_GLBL_H_
+#define _QL_GLBL_H_
+
+/*
+ * from ql_isr.c
+ */
+extern void ql_mbx_isr(void *arg);
+extern void ql_isr(void *arg);
+
+/*
+ * from ql_os.c
+ */
+extern int ql_alloc_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf);
+extern void ql_free_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf);
+extern int ql_get_mbuf(qla_host_t *ha, qla_rx_buf_t *rxb, struct mbuf *nmp);
+
+/*
+ * from ql_hw.c
+ */
+extern int ql_alloc_dma(qla_host_t *ha);
+extern void ql_free_dma(qla_host_t *ha);
+extern void ql_hw_add_sysctls(qla_host_t *ha);
+extern int ql_hw_send(qla_host_t *ha, bus_dma_segment_t *segs, int nsegs,
+		uint32_t tx_idx, struct mbuf *mp, uint32_t txr_idx);
+extern int ql_init_hw_if(qla_host_t *ha);
+extern int ql_hw_set_multi(qla_host_t *ha, uint8_t *mta, uint32_t mcnt,
+		uint32_t add_multi);
+extern void ql_del_hw_if(qla_host_t *ha);
+extern int ql_set_promisc(qla_host_t *ha);
+extern int ql_set_allmulti(qla_host_t *ha);
+extern void ql_update_link_state(qla_host_t *ha);
+extern void ql_hw_tx_done(qla_host_t *ha);
+extern int ql_set_max_mtu(qla_host_t *ha, uint32_t mtu, uint16_t cntxt_id);
+extern void ql_hw_stop_rcv(qla_host_t *ha);
+extern void ql_get_stats(qla_host_t *ha);
+extern void ql_hw_link_status(qla_host_t *ha);
+extern int ql_hw_check_health(qla_host_t *ha);
+extern void ql_minidump(qla_host_t *ha);
+
+/*
+ * from ql_misc.c
+ */
+extern int ql_init_hw(qla_host_t *ha);
+extern int ql_rdwr_indreg32(qla_host_t *ha, uint32_t addr, uint32_t *val,
+		uint32_t rd);
+extern int ql_rd_flash32(qla_host_t *ha, uint32_t addr, uint32_t *data);
+extern int ql_rdwr_offchip_mem(qla_host_t *ha, uint64_t addr,
+		q80_offchip_mem_val_t *val, uint32_t rd);
+extern void ql_read_mac_addr(qla_host_t *ha);
+extern int ql_erase_flash(qla_host_t *ha, uint32_t off, uint32_t size);
+extern int ql_wr_flash_buffer(qla_host_t *ha, uint32_t off, uint32_t size,
+		void *buf);
+extern int ql_stop_sequence(qla_host_t *ha);
+extern int ql_start_sequence(qla_host_t *ha, uint16_t index);
+
+/*
+ * from ql_ioctl.c
+ */
+extern int ql_make_cdev(qla_host_t *ha);
+extern void ql_del_cdev(qla_host_t *ha);
+
+#endif /* #ifndef_QL_GLBL_H_ */

Added: head/sys/dev/qlxgbe/ql_hw.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/qlxgbe/ql_hw.c	Wed May 15 17:03:09 2013	(r250661)
@@ -0,0 +1,2847 @@
+/*
+ * Copyright (c) 2013-2014 Qlogic Corporation
+ * All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * File: ql_hw.c
+ * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
+ * Content: Contains Hardware dependant functions
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "ql_os.h"

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list