/* File veth.c created by Kyle A. Lucke on Mon Aug 7 2000. */
/*
* IBM eServer iSeries Virtual Ethernet Device Driver
* Copyright (C) 2001 Kyle A. Lucke (klucke@us.ibm.com), IBM Corp.
* Substantially cleaned up by:
* Copyright (C) 2003 David Gibson <dwg@au1.ibm.com>, IBM Corporation.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*
* This module implements the virtual ethernet device for iSeries LPAR
* Linux. It uses hypervisor message passing to implement an
* ethernet-like network device communicating between partitions on
* the iSeries.
*
* The iSeries LPAR hypervisor currently allows for up to 16 different
* virtual ethernets. These are all dynamically configurable on
* OS/400 partitions, but dynamic configuration is not supported under
* Linux yet. An ethXX network device will be created for each
* virtual ethernet this partition is connected to.
*
* - This driver is responsible for routing packets to and from other
* partitions. The MAC addresses used by the virtual ethernets
* contains meaning and must not be modified.
*
* - Having 2 virtual ethernets to the same remote partition DOES NOT
* double the available bandwidth. The 2 devices will share the
* available hypervisor bandwidth.
*
* - If you send a packet to your own mac address, it will just be
* dropped, you won't get it on the receive side.
*
* - Multicast is implemented by sending the frame frame to every
* other partition. It is the responsibility of the receiving
* partition to filter the addresses desired.
*
* Tunable parameters:
*
* VETH_NUMBUFFERS: This compile time option defaults to 120. It
* controls how much memory Linux will allocate per remote partition
* it is communicating with. It can be thought of as the maximum
* number of packets outstanding to a remote partition at a time.
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/ethtool.h>
#include <asm/iSeries/mf.h>
#include <asm/iSeries/iSeries_pci.h>
#include <asm/uaccess.h>
#include <asm/iSeries/HvLpConfig.h>
#include <asm/iSeries/HvTypes.h>
#include <asm/iSeries/HvLpEvent.h>
#include <asm/iommu.h>
#include <asm/vio.h>
#include "iseries_veth.h"
MODULE_AUTHOR("Kyle Lucke <klucke@us.ibm.com>");
MODULE_DESCRIPTION("iSeries Virtual ethernet driver");
MODULE_LICENSE("GPL");
#define VETH_NUMBUFFERS (120)
#define VETH_ACKTIMEOUT (1000000) /* microseconds */
#define VETH_MAX_MCAST (12)
#define VETH_MAX_MTU (9000)
#if VET