162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci *  linux/drivers/message/fusion/mptlan.h
362306a36Sopenharmony_ci *      IP Over Fibre Channel device driver.
462306a36Sopenharmony_ci *      For use with LSI Fibre Channel PCI chip/adapters
562306a36Sopenharmony_ci *      running LSI Fusion MPT (Message Passing Technology) firmware.
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci *  Copyright (c) 2000-2008 LSI Corporation
862306a36Sopenharmony_ci *  (mailto:DL-MPTFusionLinux@lsi.com)
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1262306a36Sopenharmony_ci/*
1362306a36Sopenharmony_ci    This program is free software; you can redistribute it and/or modify
1462306a36Sopenharmony_ci    it under the terms of the GNU General Public License as published by
1562306a36Sopenharmony_ci    the Free Software Foundation; version 2 of the License.
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci    This program is distributed in the hope that it will be useful,
1862306a36Sopenharmony_ci    but WITHOUT ANY WARRANTY; without even the implied warranty of
1962306a36Sopenharmony_ci    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2062306a36Sopenharmony_ci    GNU General Public License for more details.
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci    NO WARRANTY
2362306a36Sopenharmony_ci    THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
2462306a36Sopenharmony_ci    CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
2562306a36Sopenharmony_ci    LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
2662306a36Sopenharmony_ci    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
2762306a36Sopenharmony_ci    solely responsible for determining the appropriateness of using and
2862306a36Sopenharmony_ci    distributing the Program and assumes all risks associated with its
2962306a36Sopenharmony_ci    exercise of rights under this Agreement, including but not limited to
3062306a36Sopenharmony_ci    the risks and costs of program errors, damage to or loss of data,
3162306a36Sopenharmony_ci    programs or equipment, and unavailability or interruption of operations.
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci    DISCLAIMER OF LIABILITY
3462306a36Sopenharmony_ci    NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
3562306a36Sopenharmony_ci    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3662306a36Sopenharmony_ci    DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
3762306a36Sopenharmony_ci    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
3862306a36Sopenharmony_ci    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
3962306a36Sopenharmony_ci    USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
4062306a36Sopenharmony_ci    HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci    You should have received a copy of the GNU General Public License
4362306a36Sopenharmony_ci    along with this program; if not, write to the Free Software
4462306a36Sopenharmony_ci    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4562306a36Sopenharmony_ci*/
4662306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci/* mptlan.h */
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#ifndef LINUX_MPTLAN_H_INCLUDED
5162306a36Sopenharmony_ci#define LINUX_MPTLAN_H_INCLUDED
5262306a36Sopenharmony_ci/*****************************************************************************/
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#if !defined(__GENKSYMS__)
5562306a36Sopenharmony_ci#include <linux/module.h>
5662306a36Sopenharmony_ci#endif
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#include <linux/netdevice.h>
5962306a36Sopenharmony_ci#include <linux/errno.h>
6062306a36Sopenharmony_ci// #include <linux/etherdevice.h>
6162306a36Sopenharmony_ci#include <linux/fcdevice.h>
6262306a36Sopenharmony_ci// #include <linux/fddidevice.h>
6362306a36Sopenharmony_ci#include <linux/skbuff.h>
6462306a36Sopenharmony_ci#include <linux/if_arp.h>
6562306a36Sopenharmony_ci#include <linux/init.h>
6662306a36Sopenharmony_ci#include <linux/kernel.h>
6762306a36Sopenharmony_ci#include <linux/printk.h>
6862306a36Sopenharmony_ci#include <linux/slab.h>
6962306a36Sopenharmony_ci#include <linux/spinlock.h>
7062306a36Sopenharmony_ci#include <linux/workqueue.h>
7162306a36Sopenharmony_ci#include <linux/delay.h>
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci#include <linux/uaccess.h>
7462306a36Sopenharmony_ci#include <asm/io.h>
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci    /* Override mptbase.h by pre-defining these! */
7762306a36Sopenharmony_ci#define MODULEAUTHOR	"LSI Corporation"
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci#include "mptbase.h"
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci/*****************************************************************************/
8262306a36Sopenharmony_ci#define LANAME		"Fusion MPT LAN driver"
8362306a36Sopenharmony_ci#define LANVER		MPT_LINUX_VERSION_COMMON
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci#ifdef MODULE
8662306a36Sopenharmony_ciMODULE_AUTHOR(MODULEAUTHOR);
8762306a36Sopenharmony_ciMODULE_DESCRIPTION(LANAME);
8862306a36Sopenharmony_ci#endif
8962306a36Sopenharmony_ci/*****************************************************************************/
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci#define MPT_LAN_MAX_BUCKETS_OUT 256
9262306a36Sopenharmony_ci#define MPT_LAN_BUCKET_THRESH	18 /* 9 buckets in one message */
9362306a36Sopenharmony_ci#define MPT_LAN_BUCKETS_REMAIN_MISMATCH_THRESH 10
9462306a36Sopenharmony_ci#define MPT_LAN_RX_COPYBREAK	200
9562306a36Sopenharmony_ci#define MPT_LAN_TX_TIMEOUT	(1*HZ)
9662306a36Sopenharmony_ci#define MPT_TX_MAX_OUT_LIM      127
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci#define MPT_LAN_MIN_MTU		96		/* RFC2625 */
9962306a36Sopenharmony_ci#define MPT_LAN_MAX_MTU		65280		/* RFC2625 */
10062306a36Sopenharmony_ci#define MPT_LAN_MTU             13312		/* Max perf range + lower mem
10162306a36Sopenharmony_ci						   usage than 16128 */
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci#define MPT_LAN_NAA_RFC2625     0x1
10462306a36Sopenharmony_ci#define MPT_LAN_NAA_QLOGIC      0x2
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci/* MPT LAN Reset and Suspend Resource Flags Defines */
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci#define MPT_LAN_RESOURCE_FLAG_RETURN_POSTED_BUCKETS    0x01
10962306a36Sopenharmony_ci#define MPT_LAN_RESOURCE_FLAG_RETURN_PEND_TRANSMITS    0x02
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci/*****************************************************************************/
11262306a36Sopenharmony_ci#ifdef MPT_LAN_IO_DEBUG
11362306a36Sopenharmony_ci#define dioprintk(x)  printk x
11462306a36Sopenharmony_ci#else
11562306a36Sopenharmony_ci#define dioprintk(x)  no_printk x
11662306a36Sopenharmony_ci#endif
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci#ifdef MPT_LAN_DEBUG
11962306a36Sopenharmony_ci#define dlprintk(x)  printk x
12062306a36Sopenharmony_ci#else
12162306a36Sopenharmony_ci#define dlprintk(x)  no_printk x
12262306a36Sopenharmony_ci#endif
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci#define NETDEV_TO_LANPRIV_PTR(d)	((struct mpt_lan_priv *)netdev_priv(d))
12562306a36Sopenharmony_ci#define NETDEV_PTR_TO_IOC_NAME_s(d)	(NETDEV_TO_LANPRIV_PTR(d)->mpt_dev->name)
12662306a36Sopenharmony_ci#define IOC_AND_NETDEV_NAMES_s_s(d)	NETDEV_PTR_TO_IOC_NAME_s(d), (d)->name
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci/*****************************************************************************/
12962306a36Sopenharmony_ci#endif
13062306a36Sopenharmony_ci
131