18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci *  linux/drivers/message/fusion/mptlan.h
38c2ecf20Sopenharmony_ci *      IP Over Fibre Channel device driver.
48c2ecf20Sopenharmony_ci *      For use with LSI Fibre Channel PCI chip/adapters
58c2ecf20Sopenharmony_ci *      running LSI Fusion MPT (Message Passing Technology) firmware.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *  Copyright (c) 2000-2008 LSI Corporation
88c2ecf20Sopenharmony_ci *  (mailto:DL-MPTFusionLinux@lsi.com)
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
128c2ecf20Sopenharmony_ci/*
138c2ecf20Sopenharmony_ci    This program is free software; you can redistribute it and/or modify
148c2ecf20Sopenharmony_ci    it under the terms of the GNU General Public License as published by
158c2ecf20Sopenharmony_ci    the Free Software Foundation; version 2 of the License.
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci    This program is distributed in the hope that it will be useful,
188c2ecf20Sopenharmony_ci    but WITHOUT ANY WARRANTY; without even the implied warranty of
198c2ecf20Sopenharmony_ci    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
208c2ecf20Sopenharmony_ci    GNU General Public License for more details.
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci    NO WARRANTY
238c2ecf20Sopenharmony_ci    THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
248c2ecf20Sopenharmony_ci    CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
258c2ecf20Sopenharmony_ci    LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
268c2ecf20Sopenharmony_ci    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
278c2ecf20Sopenharmony_ci    solely responsible for determining the appropriateness of using and
288c2ecf20Sopenharmony_ci    distributing the Program and assumes all risks associated with its
298c2ecf20Sopenharmony_ci    exercise of rights under this Agreement, including but not limited to
308c2ecf20Sopenharmony_ci    the risks and costs of program errors, damage to or loss of data,
318c2ecf20Sopenharmony_ci    programs or equipment, and unavailability or interruption of operations.
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci    DISCLAIMER OF LIABILITY
348c2ecf20Sopenharmony_ci    NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
358c2ecf20Sopenharmony_ci    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
368c2ecf20Sopenharmony_ci    DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
378c2ecf20Sopenharmony_ci    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
388c2ecf20Sopenharmony_ci    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
398c2ecf20Sopenharmony_ci    USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
408c2ecf20Sopenharmony_ci    HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci    You should have received a copy of the GNU General Public License
438c2ecf20Sopenharmony_ci    along with this program; if not, write to the Free Software
448c2ecf20Sopenharmony_ci    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
458c2ecf20Sopenharmony_ci*/
468c2ecf20Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* mptlan.h */
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#ifndef LINUX_MPTLAN_H_INCLUDED
518c2ecf20Sopenharmony_ci#define LINUX_MPTLAN_H_INCLUDED
528c2ecf20Sopenharmony_ci/*****************************************************************************/
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#if !defined(__GENKSYMS__)
558c2ecf20Sopenharmony_ci#include <linux/module.h>
568c2ecf20Sopenharmony_ci#endif
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#include <linux/netdevice.h>
598c2ecf20Sopenharmony_ci#include <linux/errno.h>
608c2ecf20Sopenharmony_ci// #include <linux/etherdevice.h>
618c2ecf20Sopenharmony_ci#include <linux/fcdevice.h>
628c2ecf20Sopenharmony_ci// #include <linux/fddidevice.h>
638c2ecf20Sopenharmony_ci#include <linux/skbuff.h>
648c2ecf20Sopenharmony_ci#include <linux/if_arp.h>
658c2ecf20Sopenharmony_ci#include <linux/init.h>
668c2ecf20Sopenharmony_ci#include <linux/kernel.h>
678c2ecf20Sopenharmony_ci#include <linux/printk.h>
688c2ecf20Sopenharmony_ci#include <linux/slab.h>
698c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
708c2ecf20Sopenharmony_ci#include <linux/workqueue.h>
718c2ecf20Sopenharmony_ci#include <linux/delay.h>
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#include <linux/uaccess.h>
748c2ecf20Sopenharmony_ci#include <asm/io.h>
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci    /* Override mptbase.h by pre-defining these! */
778c2ecf20Sopenharmony_ci#define MODULEAUTHOR	"LSI Corporation"
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#include "mptbase.h"
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci/*****************************************************************************/
828c2ecf20Sopenharmony_ci#define LANAME		"Fusion MPT LAN driver"
838c2ecf20Sopenharmony_ci#define LANVER		MPT_LINUX_VERSION_COMMON
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci#ifdef MODULE
868c2ecf20Sopenharmony_ciMODULE_AUTHOR(MODULEAUTHOR);
878c2ecf20Sopenharmony_ciMODULE_DESCRIPTION(LANAME);
888c2ecf20Sopenharmony_ci#endif
898c2ecf20Sopenharmony_ci/*****************************************************************************/
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define MPT_LAN_MAX_BUCKETS_OUT 256
928c2ecf20Sopenharmony_ci#define MPT_LAN_BUCKET_THRESH	18 /* 9 buckets in one message */
938c2ecf20Sopenharmony_ci#define MPT_LAN_BUCKETS_REMAIN_MISMATCH_THRESH 10
948c2ecf20Sopenharmony_ci#define MPT_LAN_RX_COPYBREAK	200
958c2ecf20Sopenharmony_ci#define MPT_LAN_TX_TIMEOUT	(1*HZ)
968c2ecf20Sopenharmony_ci#define MPT_TX_MAX_OUT_LIM      127
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define MPT_LAN_MIN_MTU		96		/* RFC2625 */
998c2ecf20Sopenharmony_ci#define MPT_LAN_MAX_MTU		65280		/* RFC2625 */
1008c2ecf20Sopenharmony_ci#define MPT_LAN_MTU             13312		/* Max perf range + lower mem
1018c2ecf20Sopenharmony_ci						   usage than 16128 */
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#define MPT_LAN_NAA_RFC2625     0x1
1048c2ecf20Sopenharmony_ci#define MPT_LAN_NAA_QLOGIC      0x2
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* MPT LAN Reset and Suspend Resource Flags Defines */
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci#define MPT_LAN_RESOURCE_FLAG_RETURN_POSTED_BUCKETS    0x01
1098c2ecf20Sopenharmony_ci#define MPT_LAN_RESOURCE_FLAG_RETURN_PEND_TRANSMITS    0x02
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci/*****************************************************************************/
1128c2ecf20Sopenharmony_ci#ifdef MPT_LAN_IO_DEBUG
1138c2ecf20Sopenharmony_ci#define dioprintk(x)  printk x
1148c2ecf20Sopenharmony_ci#else
1158c2ecf20Sopenharmony_ci#define dioprintk(x)  no_printk x
1168c2ecf20Sopenharmony_ci#endif
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci#ifdef MPT_LAN_DEBUG
1198c2ecf20Sopenharmony_ci#define dlprintk(x)  printk x
1208c2ecf20Sopenharmony_ci#else
1218c2ecf20Sopenharmony_ci#define dlprintk(x)  no_printk x
1228c2ecf20Sopenharmony_ci#endif
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci#define NETDEV_TO_LANPRIV_PTR(d)	((struct mpt_lan_priv *)netdev_priv(d))
1258c2ecf20Sopenharmony_ci#define NETDEV_PTR_TO_IOC_NAME_s(d)	(NETDEV_TO_LANPRIV_PTR(d)->mpt_dev->name)
1268c2ecf20Sopenharmony_ci#define IOC_AND_NETDEV_NAMES_s_s(d)	NETDEV_PTR_TO_IOC_NAME_s(d), (d)->name
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci/*****************************************************************************/
1298c2ecf20Sopenharmony_ci#endif
1308c2ecf20Sopenharmony_ci
131