P: Lennert Buytenhek
M: buytenh@gnu.org
L: bridge@math.leidenuniv.nl
-W: http://www.math.leidenuniv.nl/~buytenh/bridge
+W: http://bridge.sourceforge.net/
S: Maintained
ETHERTEAM 16I DRIVER
-/* $Id: ebus.c,v 1.16 2001/02/13 01:16:43 davem Exp $
+/* $Id: ebus.c,v 1.17 2001/08/06 13:12:57 davem Exp $
* ebus.c: PCI to EBus bridge device.
*
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
#ifdef CONFIG_SUN_AUXIO
extern void auxio_probe(void);
#endif
+extern void rs_init(void);
/* We are together with pcic.c under CONFIG_PCI. */
extern unsigned int pcic_pin_to_irq(unsigned int, char *name);
++num_ebus;
}
+ rs_init();
#ifdef CONFIG_SUN_AUXIO
auxio_probe();
#endif
unsigned long
search_exception_table(unsigned long addr, unsigned long *g2)
{
- unsigned long ret;
+ unsigned long ret = 0, flags;
#ifndef CONFIG_MODULES
/* There is only the kernel to search. */
ret = search_one_table(__start___ex_table,
__stop___ex_table-1, addr, g2);
- if (ret) return ret;
+ return ret;
#else
/* The kernel is the last "module" -- no need to treat it special. */
struct module *mp;
+
+ spin_lock_irqsave(&modlist_lock, flags);
for (mp = module_list; mp != NULL; mp = mp->next) {
- if (mp->ex_table_start == NULL)
+ if (mp->ex_table_start == NULL || !(mp->flags & (MOD_RUNNING | MOD_INITIALIZING)))
continue;
ret = search_one_table(mp->ex_table_start,
mp->ex_table_end-1, addr, g2);
- if (ret) return ret;
+ if (ret)
+ break;
}
+ spin_unlock_irqrestore(&modlist_lock, flags);
+ return ret;
#endif
-
- return 0;
}
# CONFIG_FB_E1355 is not set
# CONFIG_FB_MATROX is not set
CONFIG_FB_ATY=y
+# CONFIG_FB_ATY_GX is not set
+CONFIG_FB_ATY_CT=y
# CONFIG_FB_ATY128 is not set
# CONFIG_FB_3DFX is not set
# CONFIG_FB_SIS is not set
# CONFIG_FB_LEO is not set
CONFIG_FB_PCI=y
CONFIG_FB_ATY=y
+CONFIG_FB_ATY_CT=y
# CONFIG_FB_VIRTUAL is not set
# CONFIG_FBCON_ADVANCED is not set
CONFIG_FBCON_CFB8=y
# Ethernet (10 or 100Mbit)
#
CONFIG_NET_ETHERNET=y
+# CONFIG_ARM_AM79C961A is not set
CONFIG_SUNLANCE=y
CONFIG_HAPPYMEAL=y
CONFIG_SUNBMAC=m
-/* $Id: ioctl32.c,v 1.119 2001/07/21 00:28:25 davem Exp $
+/* $Id: ioctl32.c,v 1.121 2001/08/03 14:27:21 davem Exp $
* ioctl32.c: Conversion between 32bit and 64bit native ioctls.
*
* Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com)
#include <linux/rtc.h>
#include <linux/pci.h>
#if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE)
-/* Ugh. This header really is not clean */
-#define min min
-#define max max
#include <linux/lvm.h>
#endif /* LVM */
#include <asm/envctrl.h>
#include <asm/audioio.h>
#include <linux/ethtool.h>
+#include <linux/mii.h>
#include <asm/display7seg.h>
#include <asm/watchdog.h>
#include <asm/module.h>
return err;
}
-static inline int ethtool_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
+static int ethtool_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
{
struct ifreq ifr;
mm_segment_t old_fs;
return err;
}
+static int mii_ioctl(unsigned long fd, unsigned int cmd, unsigned long arg)
+{
+ struct ifreq ifr;
+ mm_segment_t old_fs;
+ int err;
+ u32 data;
+
+ if (copy_from_user(&ifr, (struct ifreq32 *)arg, sizeof(struct ifreq32)))
+ return -EFAULT;
+ ifr.ifr_data = (__kernel_caddr_t) kmalloc(sizeof(struct mii_ioctl_data),
+ GFP_KERNEL);
+ if (!ifr.ifr_data)
+ return -EAGAIN;
+
+ __get_user(data, &(((struct ifreq32 *)arg)->ifr_ifru.ifru_data));
+ if (copy_from_user(ifr.ifr_data, (char *)A(data),
+ sizeof(struct mii_ioctl_data))) {
+ err = -EFAULT;
+ goto out;
+ }
+
+ old_fs = get_fs();
+ set_fs(KERNEL_DS);
+ err = sys_ioctl(fd, cmd, (unsigned long)&ifr);
+ set_fs(old_fs);
+
+ if (!err) {
+ if (copy_to_user((char *)A(data),
+ ifr.ifr_data,
+ sizeof(struct mii_ioctl_data)))
+ err = -EFAULT;
+ }
+
+out:
+ kfree(ifr.ifr_data);
+ return err;
+}
+
static inline int dev_ifsioc(unsigned int fd, unsigned int cmd, unsigned long arg)
{
struct ifreq ifr;
HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc)
HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc)
HANDLE_IOCTL(SIOCETHTOOL, ethtool_ioctl)
+HANDLE_IOCTL(SIOCGMIIPHY, mii_ioctl)
+HANDLE_IOCTL(SIOCGMIIREG, mii_ioctl)
+HANDLE_IOCTL(SIOCSMIIREG, mii_ioctl)
HANDLE_IOCTL(SIOCADDRT, routing_ioctl)
HANDLE_IOCTL(SIOCDELRT, routing_ioctl)
/* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
* are flush_tlb_*() routines, and these run after flush_cache_*()
* which performs the flushw.
*
- * XXX I diked out the fancy flush avoidance code for the
- * XXX swapping cases for now until the new MM code stabilizes. -DaveM
- *
* The SMP TLB coherency scheme we use works as follows:
*
* 1) mm->cpu_vm_mask is a bit mask of which cpus an address
* call won't even show up on the performance radar. But in any case we do get
* rid of the cross-call when the task has a dead context or the task has only
* ever run on the local cpu.
+ *
+ * 4) If the mm never had a valid context yet, there is nothing to
+ * flush. CTX_NEVER_WAS_VALID checks this.
+ *
+ * This check used to be done with CTX_VALID(), but Kanoj Sarcar has
+ * pointed out that this is an invalid optimization. It can cause
+ * stale translations to be left in the TLB.
*/
void smp_flush_tlb_mm(struct mm_struct *mm)
{
- if (CTX_VALID(mm->context)) {
+ if (CTX_NEVER_WAS_VALID(mm->context))
+ return;
+
+ {
u32 ctx = CTX_HWBITS(mm->context);
int cpu = smp_processor_id();
void smp_flush_tlb_range(struct mm_struct *mm, unsigned long start,
unsigned long end)
{
- if (CTX_VALID(mm->context)) {
+ if (CTX_NEVER_WAS_VALID(mm->context))
+ return;
+
+ {
u32 ctx = CTX_HWBITS(mm->context);
int cpu = smp_processor_id();
void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page)
{
- if (CTX_VALID(mm->context)) {
+ if (CTX_NEVER_WAS_VALID(mm->context))
+ return;
+
+ {
u32 ctx = CTX_HWBITS(mm->context);
int cpu = smp_processor_id();
return 0;
}
+extern spinlock_t modlist_lock;
+
unsigned long
search_exception_table(unsigned long addr, unsigned long *g2)
{
- unsigned long ret;
+ unsigned long ret = 0, flags;
#ifndef CONFIG_MODULES
/* There is only the kernel to search. */
ret = search_one_table(__start___ex_table,
__stop___ex_table-1, addr, g2);
- if (ret) return ret;
+ return ret;
#else
/* The kernel is the last "module" -- no need to treat it special. */
struct module *mp;
+
+ spin_lock_irqsave(&modlist_lock, flags);
for (mp = module_list; mp != NULL; mp = mp->next) {
- if (mp->ex_table_start == NULL)
+ if (mp->ex_table_start == NULL || !(mp->flags & (MOD_RUNNING | MOD_INITIALIZING)))
continue;
ret = search_one_table(mp->ex_table_start,
mp->ex_table_end-1, addr, g2);
- if (ret) return ret;
+ if (ret)
+ break;
}
+ spin_unlock_irqrestore(&modlist_lock, flags);
+ return ret;
#endif
-
- return 0;
}
-/* $Id: init.c,v 1.176 2001/05/16 15:07:11 davem Exp $
+/* $Id: init.c,v 1.178 2001/08/06 13:09:00 davem Exp $
* arch/sparc64/mm/init.c
*
* Copyright (C) 1996-1999 David S. Miller (davem@caip.rutgers.edu)
}
/* Caller does TLB context flushing on local CPU if necessary.
+ * The caller also ensures that CTX_VALID(mm->context) is false.
*
* We must be careful about boundary cases so that we never
* let the user have CTX 0 (nucleus) or we ever use a CTX
spin_lock(&ctx_alloc_lock);
ctx = CTX_HWBITS(tlb_context_cache + 1);
- if (ctx == 0)
- ctx = 1;
- if (CTX_VALID(mm->context)) {
- unsigned long nr = CTX_HWBITS(mm->context);
- mmu_context_bmap[nr>>6] &= ~(1UL << (nr & 63));
- }
new_ctx = find_next_zero_bit(mmu_context_bmap, 1UL << CTX_VERSION_SHIFT, ctx);
if (new_ctx >= (1UL << CTX_VERSION_SHIFT)) {
new_ctx = find_next_zero_bit(mmu_context_bmap, ctx, 1);
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/delay.h>
+#include <linux/ethtool.h>
#include <linux/mii.h>
#include <asm/io.h>
/* global variables *********************************************************/
static const char *BootString = BOOT_STRING;
-static struct net_device *root_dev = NULL;
+struct net_device *sk98lin_root_dev = NULL;
static int probed __initdata = 0;
struct inode_operations SkInodeOps;
//static struct file_operations SkFileOps; /* with open/relase */
static int __init skge_init_module(void)
{
int cards;
- root_dev = NULL;
+ sk98lin_root_dev = NULL;
/* just to avoid warnings ... */
debug = 0;
unsigned long Flags;
SK_EVPARA EvPara;
- while (root_dev) {
- pNet = (DEV_NET*) root_dev->priv;
+ while (sk98lin_root_dev) {
+ pNet = (DEV_NET*) sk98lin_root_dev->priv;
pAC = pNet->pAC;
next = pAC->Next;
- netif_stop_queue(root_dev);
+ netif_stop_queue(sk98lin_root_dev);
SkGeYellowLED(pAC, pAC->IoBase, 0);
if(pAC->BoardLevel == 2) {
kfree(pAC->dev[1]);
}
- FreeResources(root_dev);
+ FreeResources(sk98lin_root_dev);
- root_dev->get_stats = NULL;
+ sk98lin_root_dev->get_stats = NULL;
/*
* otherwise unregister_netdev calls get_stats with
* invalid IO ... :-(
*/
- unregister_netdev(root_dev);
- kfree(root_dev);
+ unregister_netdev(sk98lin_root_dev);
+ kfree(sk98lin_root_dev);
kfree(pAC);
- root_dev = next;
+ sk98lin_root_dev = next;
}
/* clear proc-dir */
/*
* Register the device here
*/
- pAC->Next = root_dev;
- root_dev = dev;
+ pAC->Next = sk98lin_root_dev;
+ sk98lin_root_dev = dev;
return (0);
} /* SkGeBoardInit */
void *data);
static const char SK_Root_Dir_entry[] = "sk98lin";
-extern struct net_device *root_dev;
+extern struct net_device *sk98lin_root_dev;
struct proc_dir_entry pSkRootDir = {
unsigned long Flags;
unsigned int Size;
struct net_device *next;
- struct net_device *SkgeProcDev = root_dev;
+ struct net_device *SkgeProcDev = sk98lin_root_dev;
SK_PNMI_STRUCT_DATA *pPnmiStruct;
SK_PNMI_STAT *pPnmiStat;
-/* $Id: sungem.c,v 1.17 2001/06/17 09:22:46 jgarzik Exp $
+/* $Id: sungem.c,v 1.18 2001/08/06 13:34:47 davem Exp $
* sungem.c: Sun GEM ethernet driver.
*
* Copyright (C) 2000, 2001 David S. Miller (davem@redhat.com)
static int __devinit gem_get_device_address(struct gem *gp)
{
+#if defined(__sparc__) || defined(__powerpc__)
struct net_device *dev = gp->dev;
struct pci_dev *pdev = gp->pdev;
+#endif
#ifdef __sparc__
struct pcidev_cookie *pcp = pdev->sysdata;
-/* $Id: sunhme.h,v 1.32 2000/12/13 18:31:47 davem Exp $
+/* $Id: sunhme.h,v 1.33 2001/08/03 06:23:04 davem Exp $
* sunhme.h: Definitions for Sparc HME/BigMac 10/100baseT ethernet driver.
* Also known as the "Happy Meal".
*
* Debugging eeprom burnt code is more fun than programming this chip!
*/
-/* First, the DP83840 register numbers. */
-#define DP83840_BMCR 0x00 /* Basic mode control register */
-#define DP83840_BMSR 0x01 /* Basic mode status register */
-#define DP83840_PHYSID1 0x02 /* PHYS ID 1 */
-#define DP83840_PHYSID2 0x03 /* PHYS ID 2 */
-#define DP83840_ADVERTISE 0x04 /* Advertisement control reg */
-#define DP83840_LPA 0x05 /* Link partner ability reg */
-#define DP83840_EXPANSION 0x06 /* Expansion register */
-#define DP83840_DCOUNTER 0x12 /* Disconnect counter */
-#define DP83840_FCSCOUNTER 0x13 /* False carrier counter */
-#define DP83840_NWAYTEST 0x14 /* N-way auto-neg test reg */
-#define DP83840_RERRCOUNTER 0x15 /* Receive error counter */
-#define DP83840_SREVISION 0x16 /* Silicon revision */
+/* Generic MII registers defined in linux/mii.h, these below
+ * are DP83840 specific.
+ */
#define DP83840_CSCONFIG 0x17 /* CS configuration */
-#define DP83840_LBRERROR 0x18 /* Lpback, rx, bypass error */
-#define DP83840_PHYADDR 0x19 /* PHY address */
-#define DP83840_RESERVED 0x1a /* Unused... */
-#define DP83840_TPISTATUS 0x1b /* TPI status for 10mbps */
-#define DP83840_NCONFIG 0x1c /* Network interface config */
-
-/* Basic mode control register. */
-#define BMCR_RESV 0x007f /* Unused... */
-#define BMCR_CTST 0x0080 /* Collision test */
-#define BMCR_FULLDPLX 0x0100 /* Full duplex */
-#define BMCR_ANRESTART 0x0200 /* Auto negotiation restart */
-#define BMCR_ISOLATE 0x0400 /* Disconnect DP83840 from MII */
-#define BMCR_PDOWN 0x0800 /* Powerdown the DP83840 */
-#define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */
-#define BMCR_SPEED100 0x2000 /* Select 100Mbps */
-#define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */
-#define BMCR_RESET 0x8000 /* Reset the DP83840 */
-
-/* Basic mode status register. */
-#define BMSR_ERCAP 0x0001 /* Ext-reg capability */
-#define BMSR_JCD 0x0002 /* Jabber detected */
-#define BMSR_LSTATUS 0x0004 /* Link status */
-#define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */
-#define BMSR_RFAULT 0x0010 /* Remote fault detected */
-#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */
-#define BMSR_RESV 0x07c0 /* Unused... */
-#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */
-#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */
-#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */
-#define BMSR_100FULL 0x4000 /* Can do 100mbps, full-duplex */
-#define BMSR_100BASE4 0x8000 /* Can do 100mbps, 4k packets */
-
-/* Advertisement control register. */
-#define ADVERTISE_SLCT 0x001f /* Selector bits */
-#define ADVERTISE_CSMA 0x0001 /* Only selector supported */
-#define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */
-#define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */
-#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */
-#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */
-#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */
-#define ADVERTISE_RESV 0x1c00 /* Unused... */
-#define ADVERTISE_RFAULT 0x2000 /* Say we can detect faults */
-#define ADVERTISE_LPACK 0x4000 /* Ack link partners response */
-#define ADVERTISE_NPAGE 0x8000 /* Next page bit */
-
-#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
- ADVERTISE_100HALF | ADVERTISE_100FULL)
-
-/* Link partner ability register. */
-#define LPA_SLCT 0x001f /* Same as advertise selector */
-#define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */
-#define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */
-#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */
-#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */
-#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */
-#define LPA_RESV 0x1c00 /* Unused... */
-#define LPA_RFAULT 0x2000 /* Link partner faulted */
-#define LPA_LPACK 0x4000 /* Link partner acked us */
-#define LPA_NPAGE 0x8000 /* Next page bit */
-
-/* Expansion register for auto-negotiation. */
-#define EXPANSION_NWAY 0x0001 /* Can do N-way auto-nego */
-#define EXPANSION_LCWP 0x0002 /* Got new RX page code word */
-#define EXPANSION_ENABLENPAGE 0x0004 /* This enables npage words */
-#define EXPANSION_NPCAPABLE 0x0008 /* Link partner supports npage */
-#define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */
-#define EXPANSION_RESV 0xffe0 /* Unused... */
-
-/* N-way test register. */
-#define NWAYTEST_RESV1 0x00ff /* Unused... */
-#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */
-#define NWAYTEST_RESV2 0xfe00 /* Unused... */
/* The Carrier Sense config register. */
#define CSCONFIG_RESV1 0x0001 /* Unused... */
#define CSCONFIG_RESV4 0x4000 /* Unused... */
#define CSCONFIG_NDISABLE 0x8000 /* Disable NRZI */
-/* Loopback, receive, bypass error register. */
-#define LBRERROR_EBUFFER 0x0001 /* Show elasticity buf errors */
-#define LBRERROR_PACKET 0x0002 /* Show packet errors */
-#define LBRERROR_LINK 0x0004 /* Show link errors */
-#define LBRERROR_END 0x0008 /* Show premature end errors */
-#define LBRERROR_CODE 0x0010 /* Show code errors */
-#define LBRERROR_RESV1 0x00e0 /* Unused... */
-#define LBRERROR_LBACK 0x0300 /* Remote and twister loopback */
-#define LBRERROR_10TX 0x0400 /* Transceiver loopback 10mbps */
-#define LBRERROR_ENDEC 0x0800 /* ENDEC loopback 10mbps */
-#define LBRERROR_ALIGN 0x1000 /* Bypass symbol alignment */
-#define LBRERROR_SCRAMBLER 0x2000 /* Bypass (de)scrambler */
-#define LBRERROR_ENCODER 0x4000 /* Bypass 4B5B/5B4B encoders */
-#define LBRERROR_BEBUF 0x8000 /* Bypass elasticity buffers */
-
-/* Physical address register. */
-#define PHYADDR_ADDRESS 0x001f /* The address itself */
-#define PHYADDR_DISCONNECT 0x0020 /* Disconnect status */
-#define PHYADDR_10MBPS 0x0040 /* 1=10mbps, 0=100mbps */
-#define PHYADDR_RESV 0xff80 /* Unused... */
-
-/* TPI status register for 10mbps. */
-#define TPISTATUS_RESV1 0x01ff /* Unused... */
-#define TPISTATUS_SERIAL 0x0200 /* Enable 10mbps serial mode */
-#define TPISTATUS_RESV2 0xfc00 /* Unused... */
-
-/* Network interface config register. */
-#define NCONFIG_JENABLE 0x0001 /* Jabber enable */
-#define NCONFIG_RESV1 0x0002 /* Unused... */
-#define NCONFIG_SQUELCH 0x0004 /* Use low squelch */
-#define NCONFIG_UTP 0x0008 /* 1=UTP, 0=STP */
-#define NCONFIG_HBEAT 0x0010 /* Heart-beat enable */
-#define NCONFIG_LDISABLE 0x0020 /* Disable the link */
-#define NCONFIG_RESV2 0xffc0 /* Unused... */
-
/* Happy Meal descriptor rings and such.
* All descriptor rings must be aligned on a 2K boundry.
* All receive buffers must be 64 byte aligned.
if (chip_idx == LC82C168)
csr0 &= ~0xfff10000; /* zero reserved bits 31:20, 16 */
+ /* DM9102A has troubles with MRM, clear bit 24 too. */
+ if (pdev->vendor == 0x1282 && pdev->device == 0x9102)
+ csr0 &= ~0x01200000;
+
/*
* And back to business
*/
kfree (tp->mtable);
#ifndef USE_IO_OPS
iounmap((void *)ioaddr);
-#endif
err_out_free_res:
+#endif
pci_release_regions (pdev);
err_out_free_netdev:
if (tun->flags & TUN_NOCHECKSUM)
skb->ip_summed = CHECKSUM_UNNECESSARY;
- netif_rx(skb);
+ netif_rx_ni(skb);
tun->stats.rx_packets++;
tun->stats.rx_bytes += len;
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/vt_kern.h>
+#include <linux/kd.h>
#include <asm/io.h>
#include <asm/uaccess.h>
continue;
if (test_and_set_bit(BH_Lock, &bh->b_state))
continue;
- get_bh(bh);
if (atomic_set_buffer_clean(bh)) {
__refile_buffer(bh);
+ get_bh(bh);
array[count++] = bh;
if (count < NRSYNC)
continue;
return -EAGAIN;
}
unlock_buffer(bh);
- put_bh(bh);
}
spin_unlock(&lru_list_lock);
run_task_queue(&tq_disk);
}
-static int wait_for_locked_buffers(kdev_t dev, int index, int refile)
+/*
+ * Wait for a buffer on the proper list.
+ *
+ * This must be called with the LRU lock held, and
+ * will return with it released.
+ */
+static int wait_for_buffers(kdev_t dev, int index, int refile)
{
struct buffer_head * next;
int nr;
-repeat:
- spin_lock(&lru_list_lock);
next = lru_list[index];
nr = nr_buffers_type[index] * 2;
while (next && --nr >= 0) {
spin_unlock(&lru_list_lock);
wait_on_buffer (bh);
put_bh(bh);
- goto repeat;
+ return -EAGAIN;
}
spin_unlock(&lru_list_lock);
return 0;
}
+static inline void wait_for_some_buffers(kdev_t dev)
+{
+ spin_lock(&lru_list_lock);
+ wait_for_buffers(dev, BUF_LOCKED, 1);
+}
+
+static int wait_for_locked_buffers(kdev_t dev, int index, int refile)
+{
+ do {
+ spin_lock(&lru_list_lock);
+ } while (wait_for_buffers(dev, index, refile));
+ return 0;
+}
+
/* Call sync_buffers with wait!=0 to ensure that the call does not
* return until all buffer writes have completed. Sync() may return
* before the writes have finished; fsync() may not.
/*
* We used to try various strange things. Let's not.
* We'll just try to balance dirty buffers, and possibly
- * launder some pages.
+ * launder some pages and do our best to make more memory
+ * available.
*/
static void refill_freelist(int size)
{
- balance_dirty(NODEV);
- if (free_shortage())
- page_launder(GFP_NOFS, 0);
if (!grow_buffers(size)) {
+ balance_dirty(NODEV);
+ page_launder(GFP_NOFS, 0);
wakeup_bdflush();
+ wakeup_kswapd();
current->policy |= SCHED_YIELD;
__set_current_state(TASK_RUNNING);
schedule();
if (state < 0)
return;
+
+ /* If we're getting into imbalance, start write-out */
+ spin_lock(&lru_list_lock);
+ write_some_buffers(dev);
wakeup_bdflush();
/*
- * If we're getting a lot out of balance, start some IO ourselves.
- *
- * This only queues it, and does not actually start it - we'll let
- * bdflush do that, or let it happen as a result of a lot of calls
- * to balance_dirty() filling up the request queues.
+ * And if we're _really_ out of balance, wait for
+ * some of the dirty/locked buffers ourselves.
+ * This will throttle heavy writers.
*/
- if (state > 0) {
- spin_lock(&lru_list_lock);
- write_some_buffers(dev);
- }
+ if (state > 0)
+ wait_for_some_buffers(dev);
}
static __inline__ void __mark_dirty(struct buffer_head *bh)
spin_lock(&lru_list_lock);
bh = lru_list[BUF_DIRTY];
- if (!time_before(jiffies, bh->b_flushtime))
+ if (bh && !time_before(jiffies, bh->b_flushtime))
continue;
spin_unlock(&lru_list_lock);
}
spin_lock(&lru_list_lock);
if (!write_some_buffers(NODEV) || balance_dirty_state(NODEV) < 0) {
- run_task_queue(&tq_disk);
+ wait_for_some_buffers(NODEV);
interruptible_sleep_on(&bdflush_wait);
}
}
complete((struct completion *)startup);
for (;;) {
+ wait_for_some_buffers(NODEV);
+
/* update interval */
interval = bdf_prm.b_un.interval;
if (interval) {
-/* $Id: pgtable.h,v 1.106 2000/11/08 04:49:24 davem Exp $ */
+/* $Id: pgtable.h,v 1.107 2001/08/06 13:16:37 davem Exp $ */
#ifndef _SPARC_PGTABLE_H
#define _SPARC_PGTABLE_H
#ifndef __ASSEMBLY__
extern void load_mmu(void);
+extern unsigned long calc_highpages(void);
BTFIXUPDEF_CALL(void, quick_kernel_fault, unsigned long)
-/* $Id: mmu_context.h,v 1.47 2001/03/22 07:26:04 davem Exp $ */
+/* $Id: mmu_context.h,v 1.48 2001/08/03 06:18:52 davem Exp $ */
#ifndef __SPARC64_MMU_CONTEXT_H
#define __SPARC64_MMU_CONTEXT_H
#define CTX_FIRST_VERSION ((1UL << CTX_VERSION_SHIFT) + 1UL)
#define CTX_VALID(__ctx) \
(!(((__ctx) ^ tlb_context_cache) & CTX_VERSION_MASK))
+#define CTX_NEVER_WAS_VALID(__ctx) ((__ctx) == 0UL)
#define CTX_HWBITS(__ctx) ((__ctx) & ~CTX_VERSION_MASK)
extern void get_new_mmu_context(struct mm_struct *mm);
extern int netdev_nit;
+/* Post buffer to the network code from _non interrupt_ context.
+ * see net/core/dev.c for netif_rx description.
+ */
+static inline int netif_rx_ni(struct sk_buff *skb)
+{
+ int err = netif_rx(skb);
+ if (softirq_pending(smp_processor_id()))
+ do_softirq();
+ return err;
+}
+
static inline void dev_init_buffers(struct net_device *dev)
{
/* WILL BE REMOVED IN 2.5.0 */
extern void addrconf_prefix_rcv(struct net_device *dev,
u8 *opt, int len);
+/* Device notifier */
+extern int register_inet6addr_notifier(struct notifier_block *nb);
+extern int unregister_inet6addr_notifier(struct notifier_block *nb);
+
static inline struct inet6_dev *
__in6_dev_get(struct net_device *dev)
{
return inode;
}
+static int shmem_set_size(struct shmem_sb_info *info,
+ unsigned long max_blocks, unsigned long max_inodes)
+{
+ int error;
+ unsigned long blocks, inodes;
+
+ spin_lock(&info->stat_lock);
+ blocks = info->max_blocks - info->free_blocks;
+ inodes = info->max_inodes - info->free_inodes;
+ error = -EINVAL;
+ if (max_blocks < blocks)
+ goto out;
+ if (max_inodes < inodes)
+ goto out;
+ error = 0;
+ info->max_blocks = max_blocks;
+ info->free_blocks = max_blocks - blocks;
+ info->max_inodes = max_inodes;
+ info->free_inodes = max_inodes - inodes;
+out:
+ spin_unlock(&info->stat_lock);
+ return error;
+}
+
#ifdef CONFIG_TMPFS
static ssize_t
shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
return 0;
}
-static int shmem_set_size(struct shmem_sb_info *info,
- unsigned long max_blocks, unsigned long max_inodes)
-{
- int error;
- unsigned long blocks, inodes;
-
- spin_lock(&info->stat_lock);
- blocks = info->max_blocks - info->free_blocks;
- inodes = info->max_inodes - info->free_inodes;
- error = -EINVAL;
- if (max_blocks < blocks)
- goto out;
- if (max_inodes < inodes)
- goto out;
- error = 0;
- info->max_blocks = max_blocks;
- info->free_blocks = max_blocks - blocks;
- info->max_inodes = max_inodes;
- info->free_inodes = max_inodes - inodes;
-out:
- spin_unlock(&info->stat_lock);
- return error;
-}
-
static int shmem_remount_fs (struct super_block *sb, int *flags, char *data)
{
struct shmem_sb_info *info = &sb->u.shmem_sb;
* Authors: Alan Cox <iiitac@pyr.swan.ac.uk>
* Florian La Roche <rzsfl@rz.uni-sb.de>
*
- * Version: $Id: skbuff.c,v 1.88 2001/07/09 23:19:14 davem Exp $
+ * Version: $Id: skbuff.c,v 1.89 2001/08/06 13:25:02 davem Exp $
*
* Fixes:
* Alan Cox : Fixed the worst of the load balancer bugs.
/* Get the HEAD */
skb = skb_head_from_pool();
if (skb == NULL) {
- skb = kmem_cache_alloc(skbuff_head_cache, gfp_mask);
+ skb = kmem_cache_alloc(skbuff_head_cache, gfp_mask & ~__GFP_DMA);
if (skb == NULL)
goto nohead;
}
*
* PF_INET protocol family socket handler.
*
- * Version: $Id: af_inet.c,v 1.131 2001/06/13 16:25:03 davem Exp $
+ * Version: $Id: af_inet.c,v 1.133 2001/08/06 13:21:16 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
#include <linux/wireless.h> /* Note : will define WIRELESS_EXT */
#endif /* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */
-#define min(a,b) ((a)<(b)?(a):(b))
-
struct linux_mib net_statistics[NR_CPUS*2];
#ifdef INET_REFCNT_DEBUG
if (br_ioctl_hook != NULL)
return br_ioctl_hook(arg);
#endif
+ return -ENOPKG;
+
case SIOCGIFDIVERT:
case SIOCSIFDIVERT:
#ifdef CONFIG_NET_DIVERT
- return(divert_ioctl(cmd, (struct divert_cf *) arg));
+ return divert_ioctl(cmd, (struct divert_cf *) arg);
#else
return -ENOPKG;
#endif /* CONFIG_NET_DIVERT */
- return -ENOPKG;
case SIOCADDDLCI:
case SIOCDELDLCI:
*
* Alan Cox, <alan@redhat.com>
*
- * Version: $Id: icmp.c,v 1.77 2001/06/14 13:40:46 davem Exp $
+ * Version: $Id: icmp.c,v 1.79 2001/08/03 22:20:39 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
#include <asm/uaccess.h>
#include <net/checksum.h>
-#define min(a,b) ((a)<(b)?(a):(b))
-
/*
* Build xmit assembly blocks
*/
int xrlim_allow(struct dst_entry *dst, int timeout)
{
unsigned long now;
+ static int burst = HZ;
now = jiffies;
dst->rate_tokens += now - dst->rate_last;
dst->rate_last = now;
- if (dst->rate_tokens > XRLIM_BURST_FACTOR*timeout)
- dst->rate_tokens = XRLIM_BURST_FACTOR*timeout;
+ if (burst < XRLIM_BURST_FACTOR*timeout)
+ burst = XRLIM_BURST_FACTOR*timeout;
+ if (dst->rate_tokens > burst)
+ dst->rate_tokens = burst;
if (dst->rate_tokens >= timeout) {
dst->rate_tokens -= timeout;
return 1;
read_lock(&raw_v4_lock);
if ((raw_sk = raw_v4_htable[hash]) != NULL)
{
- while ((raw_sk = __raw_v4_lookup(raw_sk, protocol, iph->saddr,
- iph->daddr, skb->dev->ifindex)) != NULL) {
+ while ((raw_sk = __raw_v4_lookup(raw_sk, protocol, iph->daddr,
+ iph->saddr, skb->dev->ifindex)) != NULL) {
raw_err(raw_sk, skb, info);
raw_sk = raw_sk->next;
iph = (struct iphdr *)skb->data;
*
* The Internet Protocol (IP) output module.
*
- * Version: $Id: ip_output.c,v 1.94 2001/07/10 00:40:13 davem Exp $
+ * Version: $Id: ip_output.c,v 1.96 2001/08/03 22:20:39 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
* Multicasts are looped back for other local users
*/
- if (rt->rt_flags&RTCF_MULTICAST && (!sk || sk->protinfo.af_inet.mc_loop)) {
+ if (rt->rt_flags&RTCF_MULTICAST) {
+ if ((!sk || sk->protinfo.af_inet.mc_loop)
#ifdef CONFIG_IP_MROUTE
/* Small optimization: do not loopback not local frames,
which returned after forwarding; they will be dropped
This check is duplicated in ip_mr_input at the moment.
*/
- if ((rt->rt_flags&RTCF_LOCAL) || !(IPCB(skb)->flags&IPSKB_FORWARDED))
+ && ((rt->rt_flags&RTCF_LOCAL) || !(IPCB(skb)->flags&IPSKB_FORWARDED))
#endif
- {
+ ) {
struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
if (newskb)
NF_HOOK(PF_INET, NF_IP_POST_ROUTING, newskb, NULL,
struct rtable *rt;
struct iphdr *iph;
+ /* Skip all of this if the packet is already routed,
+ * f.e. by something like SCTP.
+ */
+ rt = (struct rtable *) skb->dst;
+ if (rt != NULL)
+ goto packet_routed;
+
/* Make sure we can route this packet. */
rt = (struct rtable *)__sk_dst_check(sk, 0);
if (rt == NULL) {
}
skb->dst = dst_clone(&rt->u.dst);
+packet_routed:
if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway)
goto no_route;
inner = (struct iphdr *)(hdr + 1);
datalen = skb->len - iph->ihl*4 - sizeof(*hdr);
- if (skb->len < iph->ihl * 4 + sizeof(struct icmphdr)) {
+ if (skb->len < iph->ihl * 4 + sizeof(*hdr) + sizeof(*iph)) {
DEBUGP("icmp_error_track: too short\n");
return NULL;
}
oldip = iph->daddr;
portptr = &hdr->dest;
}
- hdr->check = ip_nat_cheat_check(~oldip, manip->ip,
+
+ /* this could be a inner header returned in icmp packet; in such
+ cases we cannot update the checksum field since it is outside of
+ the 8 bytes of transport layer headers we are guaranteed */
+ if(((void *)&hdr->check + sizeof(hdr->check) - (void *)iph) <= len) {
+ hdr->check = ip_nat_cheat_check(~oldip, manip->ip,
ip_nat_cheat_check(*portptr ^ 0xFFFF,
manip->u.tcp.port,
hdr->check));
+ }
+
*portptr = manip->u.tcp.port;
}
*
* Implementation of the Transmission Control Protocol(TCP).
*
- * Version: $Id: tcp_minisocks.c,v 1.9 2001/03/06 22:42:56 davem Exp $
+ * Version: $Id: tcp_minisocks.c,v 1.11 2001/08/03 14:27:25 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
tw->family = sk->family;
tw->reuse = sk->reuse;
tw->rcv_wscale = tp->rcv_wscale;
- atomic_set(&tw->refcnt, 0);
+ atomic_set(&tw->refcnt, 1);
tw->hashent = sk->hashent;
tw->rcv_nxt = tp->rcv_nxt;
}
tcp_tw_schedule(tw, timeo);
+ tcp_tw_put(tw);
} else {
/* Sorry, if we're out of memory, just CLOSE this
* socket up. We've got bigger problems than
* Pedro Roque <roque@di.fc.ul.pt>
* Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
*
- * $Id: addrconf.c,v 1.66 2001/06/11 00:39:29 davem Exp $
+ * $Id: addrconf.c,v 1.67 2001/08/03 09:32:17 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
#include <linux/sysctl.h>
#endif
#include <linux/delay.h>
+#include <linux/notifier.h>
#include <linux/proc_fs.h>
#include <net/sock.h>
static void addrconf_rs_timer(unsigned long data);
static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
+static struct notifier_block *inet6addr_chain;
+
struct ipv6_devconf ipv6_devconf =
{
0, /* forwarding */
write_unlock_bh(&idev->lock);
read_unlock(&addrconf_lock);
+ notifier_call_chain(&inet6addr_chain,NETDEV_UP,ifa);
+
return ifa;
}
ipv6_ifa_notify(RTM_DELADDR, ifp);
+ notifier_call_chain(&inet6addr_chain,NETDEV_DOWN,ifp);
addrconf_del_timer(ifp);
#endif
+/*
+ * Device notifier
+ */
+
+int register_inet6addr_notifier(struct notifier_block *nb)
+{
+ return notifier_chain_register(&inet6addr_chain, nb);
+}
+
+int unregister_inet6addr_notifier(struct notifier_block *nb)
+{
+ return notifier_chain_unregister(&inet6addr_chain,nb);
+}
+
/*
* Init / cleanup code
*/
O_TARGET := netfilter.o
-export-objs :=
+export-objs := ip6_tables.o
# Link order matters here.
obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o
#endif
}
+EXPORT_SYMBOL(ip6t_register_table);
+EXPORT_SYMBOL(ip6t_unregister_table);
+EXPORT_SYMBOL(ip6t_do_table);
+EXPORT_SYMBOL(ip6t_register_match);
+EXPORT_SYMBOL(ip6t_unregister_match);
+EXPORT_SYMBOL(ip6t_register_target);
+EXPORT_SYMBOL(ip6t_unregister_target);
+
module_init(init);
module_exit(fini);
#include <net/ipv6.h>
#include <net/ndisc.h>
#include <net/transp_v6.h>
+#include <net/addrconf.h>
extern int sysctl_local_port_range[2];
extern int tcp_port_rover;
#ifdef CONFIG_IPV6
EXPORT_SYMBOL(ipv6_addr_type);
EXPORT_SYMBOL(icmpv6_send);
+EXPORT_SYMBOL(ndisc_mc_map);
+EXPORT_SYMBOL(register_inet6addr_notifier);
+EXPORT_SYMBOL(unregister_inet6addr_notifier);
#endif
#if defined (CONFIG_IPV6_MODULE) || defined (CONFIG_KHTTPD) || defined (CONFIG_KHTTPD_MODULE)
/* inet functions common to v4 and v6 */
*
* PACKET - implements raw packet sockets.
*
- * Version: $Id: af_packet.c,v 1.55 2001/06/28 01:34:29 davem Exp $
+ * Version: $Id: af_packet.c,v 1.56 2001/08/06 13:21:16 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
return br_ioctl_hook(arg);
#endif
#endif
+ return -ENOPKG;
case SIOCGIFDIVERT:
case SIOCSIFDIVERT:
#ifdef CONFIG_NET_DIVERT
- return(divert_ioctl(cmd, (struct divert_cf *) arg));
-#endif /* CONFIG_NET_DIVERT */
-
+ return divert_ioctl(cmd, (struct divert_cf *) arg);
+#else
return -ENOPKG;
+#endif /* CONFIG_NET_DIVERT */
#ifdef CONFIG_INET
case SIOCADDRT:
{
struct route4_head *head = (struct route4_head*)tp->root;
struct route4_filter **fp, *f = (struct route4_filter*)arg;
- unsigned h = f->handle;
+ unsigned h = 0;
struct route4_bucket *b;
int i;
if (!head || !f)
return -EINVAL;
+ h = f->handle;
b = f->bkt;
for (fp = &b->ht[from_hash(h>>16)]; *fp; fp = &(*fp)->next) {
if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT)))
goto next_ht;
- if (n->sel.flags&(TC_U32_EAT|TC_U32_VAROFFSET)) {
+ if (n->sel.flags&(TC_U32_OFFSET|TC_U32_VAROFFSET)) {
off2 = n->sel.off + 3;
if (n->sel.flags&TC_U32_VAROFFSET)
off2 += ntohs(n->sel.offmask & *(u16*)(ptr+n->sel.offoff)) >>n->sel.offshift;
cl = cl_head;
do {
- if (cl->q->ops->drop && cl->q->ops->drop(cl->q))
+ if (cl->q->ops->drop && cl->q->ops->drop(cl->q)) {
+ sch->q.qlen--;
return 1;
+ }
} while ((cl = cl->next_alive) != cl_head);
}
return 0;