xref: /openbmc/linux/drivers/message/fusion/mptlan.h (revision ead5d1f4d877e92c051e1a1ade623d0d30e71619)
1748b77b1SMoore, Eric Dean  /*
2748b77b1SMoore, Eric Dean   *  linux/drivers/message/fusion/mptlan.h
3748b77b1SMoore, Eric Dean   *      IP Over Fibre Channel device driver.
4f36789e2SPrakash, Sathya  *      For use with LSI Fibre Channel PCI chip/adapters
5f36789e2SPrakash, Sathya  *      running LSI Fusion MPT (Message Passing Technology) firmware.
6748b77b1SMoore, Eric Dean   *
7cddc0ab7SPrakash, Sathya  *  Copyright (c) 2000-2008 LSI Corporation
816d20101SEric Moore  *  (mailto:DL-MPTFusionLinux@lsi.com)
9748b77b1SMoore, Eric Dean   *
10748b77b1SMoore, Eric Dean   */
11748b77b1SMoore, Eric Dean  /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
12748b77b1SMoore, Eric Dean  /*
13748b77b1SMoore, Eric Dean      This program is free software; you can redistribute it and/or modify
14748b77b1SMoore, Eric Dean      it under the terms of the GNU General Public License as published by
15748b77b1SMoore, Eric Dean      the Free Software Foundation; version 2 of the License.
16748b77b1SMoore, Eric Dean  
17748b77b1SMoore, Eric Dean      This program is distributed in the hope that it will be useful,
18748b77b1SMoore, Eric Dean      but WITHOUT ANY WARRANTY; without even the implied warranty of
19748b77b1SMoore, Eric Dean      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20748b77b1SMoore, Eric Dean      GNU General Public License for more details.
21748b77b1SMoore, Eric Dean  
22748b77b1SMoore, Eric Dean      NO WARRANTY
23748b77b1SMoore, Eric Dean      THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
24748b77b1SMoore, Eric Dean      CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
25748b77b1SMoore, Eric Dean      LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
26748b77b1SMoore, Eric Dean      MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
27748b77b1SMoore, Eric Dean      solely responsible for determining the appropriateness of using and
28748b77b1SMoore, Eric Dean      distributing the Program and assumes all risks associated with its
29748b77b1SMoore, Eric Dean      exercise of rights under this Agreement, including but not limited to
30748b77b1SMoore, Eric Dean      the risks and costs of program errors, damage to or loss of data,
31748b77b1SMoore, Eric Dean      programs or equipment, and unavailability or interruption of operations.
32748b77b1SMoore, Eric Dean  
33748b77b1SMoore, Eric Dean      DISCLAIMER OF LIABILITY
34748b77b1SMoore, Eric Dean      NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
35748b77b1SMoore, Eric Dean      DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36748b77b1SMoore, Eric Dean      DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
37748b77b1SMoore, Eric Dean      ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
38748b77b1SMoore, Eric Dean      TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
39748b77b1SMoore, Eric Dean      USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
40748b77b1SMoore, Eric Dean      HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
41748b77b1SMoore, Eric Dean  
42748b77b1SMoore, Eric Dean      You should have received a copy of the GNU General Public License
43748b77b1SMoore, Eric Dean      along with this program; if not, write to the Free Software
44748b77b1SMoore, Eric Dean      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
45748b77b1SMoore, Eric Dean  */
46748b77b1SMoore, Eric Dean  /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
47748b77b1SMoore, Eric Dean  
481da177e4SLinus Torvalds /* mptlan.h */
491da177e4SLinus Torvalds 
501da177e4SLinus Torvalds #ifndef LINUX_MPTLAN_H_INCLUDED
511da177e4SLinus Torvalds #define LINUX_MPTLAN_H_INCLUDED
521da177e4SLinus Torvalds /*****************************************************************************/
531da177e4SLinus Torvalds 
541da177e4SLinus Torvalds #if !defined(__GENKSYMS__)
551da177e4SLinus Torvalds #include <linux/module.h>
561da177e4SLinus Torvalds #endif
571da177e4SLinus Torvalds 
581da177e4SLinus Torvalds #include <linux/netdevice.h>
591da177e4SLinus Torvalds #include <linux/errno.h>
601da177e4SLinus Torvalds // #include <linux/etherdevice.h>
611da177e4SLinus Torvalds #include <linux/fcdevice.h>
621da177e4SLinus Torvalds // #include <linux/fddidevice.h>
631da177e4SLinus Torvalds #include <linux/skbuff.h>
641da177e4SLinus Torvalds #include <linux/if_arp.h>
651da177e4SLinus Torvalds #include <linux/init.h>
661da177e4SLinus Torvalds #include <linux/kernel.h>
67*5848fe96SRandy Dunlap #include <linux/printk.h>
681da177e4SLinus Torvalds #include <linux/slab.h>
691da177e4SLinus Torvalds #include <linux/spinlock.h>
701da177e4SLinus Torvalds #include <linux/workqueue.h>
711da177e4SLinus Torvalds #include <linux/delay.h>
721da177e4SLinus Torvalds 
737c0f6ba6SLinus Torvalds #include <linux/uaccess.h>
741da177e4SLinus Torvalds #include <asm/io.h>
751da177e4SLinus Torvalds 
761da177e4SLinus Torvalds     /* Override mptbase.h by pre-defining these! */
77f36789e2SPrakash, Sathya #define MODULEAUTHOR	"LSI Corporation"
781da177e4SLinus Torvalds 
791da177e4SLinus Torvalds #include "mptbase.h"
801da177e4SLinus Torvalds 
811da177e4SLinus Torvalds /*****************************************************************************/
821da177e4SLinus Torvalds #define LANAME		"Fusion MPT LAN driver"
831da177e4SLinus Torvalds #define LANVER		MPT_LINUX_VERSION_COMMON
841da177e4SLinus Torvalds 
851da177e4SLinus Torvalds #ifdef MODULE
861da177e4SLinus Torvalds MODULE_AUTHOR(MODULEAUTHOR);
871da177e4SLinus Torvalds MODULE_DESCRIPTION(LANAME);
881da177e4SLinus Torvalds #endif
891da177e4SLinus Torvalds /*****************************************************************************/
901da177e4SLinus Torvalds 
911da177e4SLinus Torvalds #define MPT_LAN_MAX_BUCKETS_OUT 256
921da177e4SLinus Torvalds #define MPT_LAN_BUCKET_THRESH	18 /* 9 buckets in one message */
931da177e4SLinus Torvalds #define MPT_LAN_BUCKETS_REMAIN_MISMATCH_THRESH 10
941da177e4SLinus Torvalds #define MPT_LAN_RX_COPYBREAK	200
951da177e4SLinus Torvalds #define MPT_LAN_TX_TIMEOUT	(1*HZ)
961da177e4SLinus Torvalds #define MPT_TX_MAX_OUT_LIM      127
971da177e4SLinus Torvalds 
981da177e4SLinus Torvalds #define MPT_LAN_MIN_MTU		96		/* RFC2625 */
991da177e4SLinus Torvalds #define MPT_LAN_MAX_MTU		65280		/* RFC2625 */
1001da177e4SLinus Torvalds #define MPT_LAN_MTU             13312		/* Max perf range + lower mem
1011da177e4SLinus Torvalds 						   usage than 16128 */
1021da177e4SLinus Torvalds 
1031da177e4SLinus Torvalds #define MPT_LAN_NAA_RFC2625     0x1
1041da177e4SLinus Torvalds #define MPT_LAN_NAA_QLOGIC      0x2
1051da177e4SLinus Torvalds 
1061da177e4SLinus Torvalds /* MPT LAN Reset and Suspend Resource Flags Defines */
1071da177e4SLinus Torvalds 
1081da177e4SLinus Torvalds #define MPT_LAN_RESOURCE_FLAG_RETURN_POSTED_BUCKETS    0x01
1091da177e4SLinus Torvalds #define MPT_LAN_RESOURCE_FLAG_RETURN_PEND_TRANSMITS    0x02
1101da177e4SLinus Torvalds 
1111da177e4SLinus Torvalds /*****************************************************************************/
1121da177e4SLinus Torvalds #ifdef MPT_LAN_IO_DEBUG
1131da177e4SLinus Torvalds #define dioprintk(x)  printk x
1141da177e4SLinus Torvalds #else
115*5848fe96SRandy Dunlap #define dioprintk(x)  no_printk x
1161da177e4SLinus Torvalds #endif
1171da177e4SLinus Torvalds 
1181da177e4SLinus Torvalds #ifdef MPT_LAN_DEBUG
1191da177e4SLinus Torvalds #define dlprintk(x)  printk x
1201da177e4SLinus Torvalds #else
121*5848fe96SRandy Dunlap #define dlprintk(x)  no_printk x
1221da177e4SLinus Torvalds #endif
1231da177e4SLinus Torvalds 
12497341249SWang Chen #define NETDEV_TO_LANPRIV_PTR(d)	((struct mpt_lan_priv *)netdev_priv(d))
1251da177e4SLinus Torvalds #define NETDEV_PTR_TO_IOC_NAME_s(d)	(NETDEV_TO_LANPRIV_PTR(d)->mpt_dev->name)
1261da177e4SLinus Torvalds #define IOC_AND_NETDEV_NAMES_s_s(d)	NETDEV_PTR_TO_IOC_NAME_s(d), (d)->name
1271da177e4SLinus Torvalds 
1281da177e4SLinus Torvalds /*****************************************************************************/
1291da177e4SLinus Torvalds #endif
1301da177e4SLinus Torvalds 
131