Commit 52683c56 authored by Linus Torvalds's avatar Linus Torvalds

v2.4.7.5 -> v2.4.7.6

  - me: better dirty balancing
  - David Miller: sparc and network updates
parent a931b32f
...@@ -486,7 +486,7 @@ ETHERNET BRIDGE ...@@ -486,7 +486,7 @@ ETHERNET BRIDGE
P: Lennert Buytenhek P: Lennert Buytenhek
M: buytenh@gnu.org M: buytenh@gnu.org
L: bridge@math.leidenuniv.nl L: bridge@math.leidenuniv.nl
W: http://www.math.leidenuniv.nl/~buytenh/bridge W: http://bridge.sourceforge.net/
S: Maintained S: Maintained
ETHERTEAM 16I DRIVER 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. * ebus.c: PCI to EBus bridge device.
* *
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
...@@ -27,6 +27,7 @@ struct linux_ebus *ebus_chain = 0; ...@@ -27,6 +27,7 @@ struct linux_ebus *ebus_chain = 0;
#ifdef CONFIG_SUN_AUXIO #ifdef CONFIG_SUN_AUXIO
extern void auxio_probe(void); extern void auxio_probe(void);
#endif #endif
extern void rs_init(void);
/* We are together with pcic.c under CONFIG_PCI. */ /* We are together with pcic.c under CONFIG_PCI. */
extern unsigned int pcic_pin_to_irq(unsigned int, char *name); extern unsigned int pcic_pin_to_irq(unsigned int, char *name);
...@@ -358,6 +359,7 @@ void __init ebus_init(void) ...@@ -358,6 +359,7 @@ void __init ebus_init(void)
++num_ebus; ++num_ebus;
} }
rs_init();
#ifdef CONFIG_SUN_AUXIO #ifdef CONFIG_SUN_AUXIO
auxio_probe(); auxio_probe();
#endif #endif
......
...@@ -46,24 +46,27 @@ search_one_table(const struct exception_table_entry *start, ...@@ -46,24 +46,27 @@ search_one_table(const struct exception_table_entry *start,
unsigned long unsigned long
search_exception_table(unsigned long addr, unsigned long *g2) search_exception_table(unsigned long addr, unsigned long *g2)
{ {
unsigned long ret; unsigned long ret = 0, flags;
#ifndef CONFIG_MODULES #ifndef CONFIG_MODULES
/* There is only the kernel to search. */ /* There is only the kernel to search. */
ret = search_one_table(__start___ex_table, ret = search_one_table(__start___ex_table,
__stop___ex_table-1, addr, g2); __stop___ex_table-1, addr, g2);
if (ret) return ret; return ret;
#else #else
/* The kernel is the last "module" -- no need to treat it special. */ /* The kernel is the last "module" -- no need to treat it special. */
struct module *mp; struct module *mp;
spin_lock_irqsave(&modlist_lock, flags);
for (mp = module_list; mp != NULL; mp = mp->next) { 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; continue;
ret = search_one_table(mp->ex_table_start, ret = search_one_table(mp->ex_table_start,
mp->ex_table_end-1, addr, g2); mp->ex_table_end-1, addr, g2);
if (ret) return ret; if (ret)
break;
} }
spin_unlock_irqrestore(&modlist_lock, flags);
return ret;
#endif #endif
return 0;
} }
...@@ -101,6 +101,8 @@ CONFIG_FB_PM2_PCI=y ...@@ -101,6 +101,8 @@ CONFIG_FB_PM2_PCI=y
# CONFIG_FB_E1355 is not set # CONFIG_FB_E1355 is not set
# CONFIG_FB_MATROX is not set # CONFIG_FB_MATROX is not set
CONFIG_FB_ATY=y CONFIG_FB_ATY=y
# CONFIG_FB_ATY_GX is not set
CONFIG_FB_ATY_CT=y
# CONFIG_FB_ATY128 is not set # CONFIG_FB_ATY128 is not set
# CONFIG_FB_3DFX is not set # CONFIG_FB_3DFX is not set
# CONFIG_FB_SIS is not set # CONFIG_FB_SIS is not set
...@@ -112,6 +114,7 @@ CONFIG_FB_CGSIX=y ...@@ -112,6 +114,7 @@ CONFIG_FB_CGSIX=y
# CONFIG_FB_LEO is not set # CONFIG_FB_LEO is not set
CONFIG_FB_PCI=y CONFIG_FB_PCI=y
CONFIG_FB_ATY=y CONFIG_FB_ATY=y
CONFIG_FB_ATY_CT=y
# CONFIG_FB_VIRTUAL is not set # CONFIG_FB_VIRTUAL is not set
# CONFIG_FBCON_ADVANCED is not set # CONFIG_FBCON_ADVANCED is not set
CONFIG_FBCON_CFB8=y CONFIG_FBCON_CFB8=y
...@@ -407,6 +410,7 @@ CONFIG_TUN=m ...@@ -407,6 +410,7 @@ CONFIG_TUN=m
# Ethernet (10 or 100Mbit) # Ethernet (10 or 100Mbit)
# #
CONFIG_NET_ETHERNET=y CONFIG_NET_ETHERNET=y
# CONFIG_ARM_AM79C961A is not set
CONFIG_SUNLANCE=y CONFIG_SUNLANCE=y
CONFIG_HAPPYMEAL=y CONFIG_HAPPYMEAL=y
CONFIG_SUNBMAC=m 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. * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
* *
* Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com) * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com)
...@@ -51,9 +51,6 @@ ...@@ -51,9 +51,6 @@
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/pci.h> #include <linux/pci.h>
#if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE) #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> #include <linux/lvm.h>
#endif /* LVM */ #endif /* LVM */
...@@ -73,6 +70,7 @@ ...@@ -73,6 +70,7 @@
#include <asm/envctrl.h> #include <asm/envctrl.h>
#include <asm/audioio.h> #include <asm/audioio.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/mii.h>
#include <asm/display7seg.h> #include <asm/display7seg.h>
#include <asm/watchdog.h> #include <asm/watchdog.h>
#include <asm/module.h> #include <asm/module.h>
...@@ -544,7 +542,7 @@ static inline int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long ar ...@@ -544,7 +542,7 @@ static inline int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long ar
return err; 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; struct ifreq ifr;
mm_segment_t old_fs; mm_segment_t old_fs;
...@@ -593,6 +591,44 @@ static inline int ethtool_ioctl(unsigned int fd, unsigned int cmd, unsigned long ...@@ -593,6 +591,44 @@ static inline int ethtool_ioctl(unsigned int fd, unsigned int cmd, unsigned long
return err; 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) static inline int dev_ifsioc(unsigned int fd, unsigned int cmd, unsigned long arg)
{ {
struct ifreq ifr; struct ifreq ifr;
...@@ -4250,6 +4286,9 @@ HANDLE_IOCTL(SIOCGPPPVER, dev_ifsioc) ...@@ -4250,6 +4286,9 @@ HANDLE_IOCTL(SIOCGPPPVER, dev_ifsioc)
HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc) HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc)
HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc) HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc)
HANDLE_IOCTL(SIOCETHTOOL, ethtool_ioctl) 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(SIOCADDRT, routing_ioctl)
HANDLE_IOCTL(SIOCDELRT, 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. */ /* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
......
...@@ -604,9 +604,6 @@ void smp_flush_tlb_all(void) ...@@ -604,9 +604,6 @@ void smp_flush_tlb_all(void)
* are flush_tlb_*() routines, and these run after flush_cache_*() * are flush_tlb_*() routines, and these run after flush_cache_*()
* which performs the flushw. * 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: * The SMP TLB coherency scheme we use works as follows:
* *
* 1) mm->cpu_vm_mask is a bit mask of which cpus an address * 1) mm->cpu_vm_mask is a bit mask of which cpus an address
...@@ -642,10 +639,20 @@ void smp_flush_tlb_all(void) ...@@ -642,10 +639,20 @@ void smp_flush_tlb_all(void)
* call won't even show up on the performance radar. But in any case we do get * 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 * rid of the cross-call when the task has a dead context or the task has only
* ever run on the local cpu. * 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) 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); u32 ctx = CTX_HWBITS(mm->context);
int cpu = smp_processor_id(); int cpu = smp_processor_id();
...@@ -665,7 +672,10 @@ void smp_flush_tlb_mm(struct mm_struct *mm) ...@@ -665,7 +672,10 @@ void smp_flush_tlb_mm(struct mm_struct *mm)
void smp_flush_tlb_range(struct mm_struct *mm, unsigned long start, void smp_flush_tlb_range(struct mm_struct *mm, unsigned long start,
unsigned long end) unsigned long end)
{ {
if (CTX_VALID(mm->context)) { if (CTX_NEVER_WAS_VALID(mm->context))
return;
{
u32 ctx = CTX_HWBITS(mm->context); u32 ctx = CTX_HWBITS(mm->context);
int cpu = smp_processor_id(); int cpu = smp_processor_id();
...@@ -686,7 +696,10 @@ void smp_flush_tlb_range(struct mm_struct *mm, unsigned long start, ...@@ -686,7 +696,10 @@ void smp_flush_tlb_range(struct mm_struct *mm, unsigned long start,
void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page) 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); u32 ctx = CTX_HWBITS(mm->context);
int cpu = smp_processor_id(); int cpu = smp_processor_id();
......
...@@ -43,27 +43,32 @@ search_one_table(const struct exception_table_entry *start, ...@@ -43,27 +43,32 @@ search_one_table(const struct exception_table_entry *start,
return 0; return 0;
} }
extern spinlock_t modlist_lock;
unsigned long unsigned long
search_exception_table(unsigned long addr, unsigned long *g2) search_exception_table(unsigned long addr, unsigned long *g2)
{ {
unsigned long ret; unsigned long ret = 0, flags;
#ifndef CONFIG_MODULES #ifndef CONFIG_MODULES
/* There is only the kernel to search. */ /* There is only the kernel to search. */
ret = search_one_table(__start___ex_table, ret = search_one_table(__start___ex_table,
__stop___ex_table-1, addr, g2); __stop___ex_table-1, addr, g2);
if (ret) return ret; return ret;
#else #else
/* The kernel is the last "module" -- no need to treat it special. */ /* The kernel is the last "module" -- no need to treat it special. */
struct module *mp; struct module *mp;
spin_lock_irqsave(&modlist_lock, flags);
for (mp = module_list; mp != NULL; mp = mp->next) { 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; continue;
ret = search_one_table(mp->ex_table_start, ret = search_one_table(mp->ex_table_start,
mp->ex_table_end-1, addr, g2); mp->ex_table_end-1, addr, g2);
if (ret) return ret; if (ret)
break;
} }
spin_unlock_irqrestore(&modlist_lock, flags);
return ret;
#endif #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 * arch/sparc64/mm/init.c
* *
* Copyright (C) 1996-1999 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1996-1999 David S. Miller (davem@caip.rutgers.edu)
...@@ -833,6 +833,7 @@ void __flush_tlb_all(void) ...@@ -833,6 +833,7 @@ void __flush_tlb_all(void)
} }
/* Caller does TLB context flushing on local CPU if necessary. /* 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 * We must be careful about boundary cases so that we never
* let the user have CTX 0 (nucleus) or we ever use a CTX * let the user have CTX 0 (nucleus) or we ever use a CTX
...@@ -845,12 +846,6 @@ void get_new_mmu_context(struct mm_struct *mm) ...@@ -845,12 +846,6 @@ void get_new_mmu_context(struct mm_struct *mm)
spin_lock(&ctx_alloc_lock); spin_lock(&ctx_alloc_lock);
ctx = CTX_HWBITS(tlb_context_cache + 1); 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); new_ctx = find_next_zero_bit(mmu_context_bmap, 1UL << CTX_VERSION_SHIFT, ctx);
if (new_ctx >= (1UL << CTX_VERSION_SHIFT)) { if (new_ctx >= (1UL << CTX_VERSION_SHIFT)) {
new_ctx = find_next_zero_bit(mmu_context_bmap, ctx, 1); new_ctx = find_next_zero_bit(mmu_context_bmap, ctx, 1);
......
...@@ -94,6 +94,7 @@ IVc. Errata ...@@ -94,6 +94,7 @@ IVc. Errata
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ethtool.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <asm/io.h> #include <asm/io.h>
......
...@@ -368,7 +368,7 @@ static void DumpLong(char*, int); ...@@ -368,7 +368,7 @@ static void DumpLong(char*, int);
/* global variables *********************************************************/ /* global variables *********************************************************/
static const char *BootString = BOOT_STRING; 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; static int probed __initdata = 0;
struct inode_operations SkInodeOps; struct inode_operations SkInodeOps;
//static struct file_operations SkFileOps; /* with open/relase */ //static struct file_operations SkFileOps; /* with open/relase */
...@@ -685,7 +685,7 @@ static int options[SK_MAX_CARD_PARAM] = {0, }; /* not used */ ...@@ -685,7 +685,7 @@ static int options[SK_MAX_CARD_PARAM] = {0, }; /* not used */
static int __init skge_init_module(void) static int __init skge_init_module(void)
{ {
int cards; int cards;
root_dev = NULL; sk98lin_root_dev = NULL;
/* just to avoid warnings ... */ /* just to avoid warnings ... */
debug = 0; debug = 0;
...@@ -717,12 +717,12 @@ struct net_device *next; ...@@ -717,12 +717,12 @@ struct net_device *next;
unsigned long Flags; unsigned long Flags;
SK_EVPARA EvPara; SK_EVPARA EvPara;
while (root_dev) { while (sk98lin_root_dev) {
pNet = (DEV_NET*) root_dev->priv; pNet = (DEV_NET*) sk98lin_root_dev->priv;
pAC = pNet->pAC; pAC = pNet->pAC;
next = pAC->Next; next = pAC->Next;
netif_stop_queue(root_dev); netif_stop_queue(sk98lin_root_dev);
SkGeYellowLED(pAC, pAC->IoBase, 0); SkGeYellowLED(pAC, pAC->IoBase, 0);
if(pAC->BoardLevel == 2) { if(pAC->BoardLevel == 2) {
...@@ -754,17 +754,17 @@ SK_EVPARA EvPara; ...@@ -754,17 +754,17 @@ SK_EVPARA EvPara;
kfree(pAC->dev[1]); 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 * otherwise unregister_netdev calls get_stats with
* invalid IO ... :-( * invalid IO ... :-(
*/ */
unregister_netdev(root_dev); unregister_netdev(sk98lin_root_dev);
kfree(root_dev); kfree(sk98lin_root_dev);
kfree(pAC); kfree(pAC);
root_dev = next; sk98lin_root_dev = next;
} }
/* clear proc-dir */ /* clear proc-dir */
...@@ -911,8 +911,8 @@ int Ret; /* return code of request_irq */ ...@@ -911,8 +911,8 @@ int Ret; /* return code of request_irq */
/* /*
* Register the device here * Register the device here
*/ */
pAC->Next = root_dev; pAC->Next = sk98lin_root_dev;
root_dev = dev; sk98lin_root_dev = dev;
return (0); return (0);
} /* SkGeBoardInit */ } /* SkGeBoardInit */
......
...@@ -65,7 +65,7 @@ int proc_read(char *buffer, ...@@ -65,7 +65,7 @@ int proc_read(char *buffer,
void *data); void *data);
static const char SK_Root_Dir_entry[] = "sk98lin"; 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 = { struct proc_dir_entry pSkRootDir = {
...@@ -106,7 +106,7 @@ void *data) ...@@ -106,7 +106,7 @@ void *data)
unsigned long Flags; unsigned long Flags;
unsigned int Size; unsigned int Size;
struct net_device *next; struct net_device *next;
struct net_device *SkgeProcDev = root_dev; struct net_device *SkgeProcDev = sk98lin_root_dev;
SK_PNMI_STRUCT_DATA *pPnmiStruct; SK_PNMI_STRUCT_DATA *pPnmiStruct;
SK_PNMI_STAT *pPnmiStat; 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. * sungem.c: Sun GEM ethernet driver.
* *
* Copyright (C) 2000, 2001 David S. Miller (davem@redhat.com) * Copyright (C) 2000, 2001 David S. Miller (davem@redhat.com)
...@@ -1576,8 +1576,10 @@ static int __devinit gem_check_invariants(struct gem *gp) ...@@ -1576,8 +1576,10 @@ static int __devinit gem_check_invariants(struct gem *gp)
static int __devinit gem_get_device_address(struct gem *gp) static int __devinit gem_get_device_address(struct gem *gp)
{ {
#if defined(__sparc__) || defined(__powerpc__)
struct net_device *dev = gp->dev; struct net_device *dev = gp->dev;
struct pci_dev *pdev = gp->pdev; struct pci_dev *pdev = gp->pdev;
#endif
#ifdef __sparc__ #ifdef __sparc__
struct pcidev_cookie *pcp = pdev->sysdata; 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. * sunhme.h: Definitions for Sparc HME/BigMac 10/100baseT ethernet driver.
* Also known as the "Happy Meal". * Also known as the "Happy Meal".
* *
...@@ -276,92 +276,10 @@ ...@@ -276,92 +276,10 @@
* Debugging eeprom burnt code is more fun than programming this chip! * Debugging eeprom burnt code is more fun than programming this chip!
*/ */
/* First, the DP83840 register numbers. */ /* Generic MII registers defined in linux/mii.h, these below
#define DP83840_BMCR 0x00 /* Basic mode control register */ * are DP83840 specific.
#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 */
#define DP83840_CSCONFIG 0x17 /* CS configuration */ #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. */ /* The Carrier Sense config register. */
#define CSCONFIG_RESV1 0x0001 /* Unused... */ #define CSCONFIG_RESV1 0x0001 /* Unused... */
...@@ -379,41 +297,6 @@ ...@@ -379,41 +297,6 @@
#define CSCONFIG_RESV4 0x4000 /* Unused... */ #define CSCONFIG_RESV4 0x4000 /* Unused... */
#define CSCONFIG_NDISABLE 0x8000 /* Disable NRZI */ #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. /* Happy Meal descriptor rings and such.
* All descriptor rings must be aligned on a 2K boundry. * All descriptor rings must be aligned on a 2K boundry.
* All receive buffers must be 64 byte aligned. * All receive buffers must be 64 byte aligned.
......
...@@ -1420,6 +1420,10 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, ...@@ -1420,6 +1420,10 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
if (chip_idx == LC82C168) if (chip_idx == LC82C168)
csr0 &= ~0xfff10000; /* zero reserved bits 31:20, 16 */ 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 * And back to business
*/ */
...@@ -1762,9 +1766,9 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, ...@@ -1762,9 +1766,9 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
kfree (tp->mtable); kfree (tp->mtable);
#ifndef USE_IO_OPS #ifndef USE_IO_OPS
iounmap((void *)ioaddr); iounmap((void *)ioaddr);
#endif
err_out_free_res: err_out_free_res:
#endif
pci_release_regions (pdev); pci_release_regions (pdev);
err_out_free_netdev: err_out_free_netdev:
......
...@@ -218,7 +218,7 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, const char *buf, ...@@ -218,7 +218,7 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, const char *buf,
if (tun->flags & TUN_NOCHECKSUM) if (tun->flags & TUN_NOCHECKSUM)
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
netif_rx(skb); netif_rx_ni(skb);
tun->stats.rx_packets++; tun->stats.rx_packets++;
tun->stats.rx_bytes += len; tun->stats.rx_bytes += len;
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/vt_kern.h> #include <linux/vt_kern.h>
#include <linux/kd.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
...@@ -219,9 +219,9 @@ static int write_some_buffers(kdev_t dev) ...@@ -219,9 +219,9 @@ static int write_some_buffers(kdev_t dev)
continue; continue;
if (test_and_set_bit(BH_Lock, &bh->b_state)) if (test_and_set_bit(BH_Lock, &bh->b_state))
continue; continue;
get_bh(bh);
if (atomic_set_buffer_clean(bh)) { if (atomic_set_buffer_clean(bh)) {
__refile_buffer(bh); __refile_buffer(bh);
get_bh(bh);
array[count++] = bh; array[count++] = bh;
if (count < NRSYNC) if (count < NRSYNC)
continue; continue;
...@@ -231,7 +231,6 @@ static int write_some_buffers(kdev_t dev) ...@@ -231,7 +231,6 @@ static int write_some_buffers(kdev_t dev)
return -EAGAIN; return -EAGAIN;
} }
unlock_buffer(bh); unlock_buffer(bh);
put_bh(bh);
} }
spin_unlock(&lru_list_lock); spin_unlock(&lru_list_lock);
...@@ -251,13 +250,17 @@ static void write_unlocked_buffers(kdev_t dev) ...@@ -251,13 +250,17 @@ static void write_unlocked_buffers(kdev_t dev)
run_task_queue(&tq_disk); 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; struct buffer_head * next;
int nr; int nr;
repeat:
spin_lock(&lru_list_lock);
next = lru_list[index]; next = lru_list[index];
nr = nr_buffers_type[index] * 2; nr = nr_buffers_type[index] * 2;
while (next && --nr >= 0) { while (next && --nr >= 0) {
...@@ -276,12 +279,26 @@ static int wait_for_locked_buffers(kdev_t dev, int index, int refile) ...@@ -276,12 +279,26 @@ static int wait_for_locked_buffers(kdev_t dev, int index, int refile)
spin_unlock(&lru_list_lock); spin_unlock(&lru_list_lock);
wait_on_buffer (bh); wait_on_buffer (bh);
put_bh(bh); put_bh(bh);
goto repeat; return -EAGAIN;
} }
spin_unlock(&lru_list_lock); spin_unlock(&lru_list_lock);
return 0; 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 /* Call sync_buffers with wait!=0 to ensure that the call does not
* return until all buffer writes have completed. Sync() may return * return until all buffer writes have completed. Sync() may return
* before the writes have finished; fsync() may not. * before the writes have finished; fsync() may not.
...@@ -775,15 +792,16 @@ void set_blocksize(kdev_t dev, int size) ...@@ -775,15 +792,16 @@ void set_blocksize(kdev_t dev, int size)
/* /*
* We used to try various strange things. Let's not. * We used to try various strange things. Let's not.
* We'll just try to balance dirty buffers, and possibly * 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) static void refill_freelist(int size)
{ {
if (!grow_buffers(size)) {
balance_dirty(NODEV); balance_dirty(NODEV);
if (free_shortage())
page_launder(GFP_NOFS, 0); page_launder(GFP_NOFS, 0);
if (!grow_buffers(size)) {
wakeup_bdflush(); wakeup_bdflush();
wakeup_kswapd();
current->policy |= SCHED_YIELD; current->policy |= SCHED_YIELD;
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
schedule(); schedule();
...@@ -1094,19 +1112,19 @@ void balance_dirty(kdev_t dev) ...@@ -1094,19 +1112,19 @@ void balance_dirty(kdev_t dev)
if (state < 0) if (state < 0)
return; return;
/* If we're getting into imbalance, start write-out */
spin_lock(&lru_list_lock);
write_some_buffers(dev);
wakeup_bdflush(); wakeup_bdflush();
/* /*
* If we're getting a lot out of balance, start some IO ourselves. * And if we're _really_ out of balance, wait for
* * some of the dirty/locked buffers ourselves.
* This only queues it, and does not actually start it - we'll let * This will throttle heavy writers.
* bdflush do that, or let it happen as a result of a lot of calls
* to balance_dirty() filling up the request queues.
*/ */
if (state > 0) { if (state > 0)
spin_lock(&lru_list_lock); wait_for_some_buffers(dev);
write_some_buffers(dev);
}
} }
static __inline__ void __mark_dirty(struct buffer_head *bh) static __inline__ void __mark_dirty(struct buffer_head *bh)
...@@ -2581,7 +2599,7 @@ static int sync_old_buffers(void) ...@@ -2581,7 +2599,7 @@ static int sync_old_buffers(void)
spin_lock(&lru_list_lock); spin_lock(&lru_list_lock);
bh = lru_list[BUF_DIRTY]; bh = lru_list[BUF_DIRTY];
if (!time_before(jiffies, bh->b_flushtime)) if (bh && !time_before(jiffies, bh->b_flushtime))
continue; continue;
spin_unlock(&lru_list_lock); spin_unlock(&lru_list_lock);
} }
...@@ -2682,7 +2700,7 @@ int bdflush(void *startup) ...@@ -2682,7 +2700,7 @@ int bdflush(void *startup)
spin_lock(&lru_list_lock); spin_lock(&lru_list_lock);
if (!write_some_buffers(NODEV) || balance_dirty_state(NODEV) < 0) { 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); interruptible_sleep_on(&bdflush_wait);
} }
} }
...@@ -2713,6 +2731,8 @@ int kupdate(void *startup) ...@@ -2713,6 +2731,8 @@ int kupdate(void *startup)
complete((struct completion *)startup); complete((struct completion *)startup);
for (;;) { for (;;) {
wait_for_some_buffers(NODEV);
/* update interval */ /* update interval */
interval = bdf_prm.b_un.interval; interval = bdf_prm.b_un.interval;
if (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 #ifndef _SPARC_PGTABLE_H
#define _SPARC_PGTABLE_H #define _SPARC_PGTABLE_H
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern void load_mmu(void); extern void load_mmu(void);
extern unsigned long calc_highpages(void);
BTFIXUPDEF_CALL(void, quick_kernel_fault, unsigned long) 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 #ifndef __SPARC64_MMU_CONTEXT_H
#define __SPARC64_MMU_CONTEXT_H #define __SPARC64_MMU_CONTEXT_H
...@@ -23,6 +23,7 @@ extern unsigned long mmu_context_bmap[]; ...@@ -23,6 +23,7 @@ extern unsigned long mmu_context_bmap[];
#define CTX_FIRST_VERSION ((1UL << CTX_VERSION_SHIFT) + 1UL) #define CTX_FIRST_VERSION ((1UL << CTX_VERSION_SHIFT) + 1UL)
#define CTX_VALID(__ctx) \ #define CTX_VALID(__ctx) \
(!(((__ctx) ^ tlb_context_cache) & CTX_VERSION_MASK)) (!(((__ctx) ^ tlb_context_cache) & CTX_VERSION_MASK))
#define CTX_NEVER_WAS_VALID(__ctx) ((__ctx) == 0UL)
#define CTX_HWBITS(__ctx) ((__ctx) & ~CTX_VERSION_MASK) #define CTX_HWBITS(__ctx) ((__ctx) & ~CTX_VERSION_MASK)
extern void get_new_mmu_context(struct mm_struct *mm); extern void get_new_mmu_context(struct mm_struct *mm);
......
...@@ -562,6 +562,17 @@ extern void dev_init(void); ...@@ -562,6 +562,17 @@ extern void dev_init(void);
extern int netdev_nit; 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) static inline void dev_init_buffers(struct net_device *dev)
{ {
/* WILL BE REMOVED IN 2.5.0 */ /* WILL BE REMOVED IN 2.5.0 */
......
...@@ -88,6 +88,10 @@ extern int ipv6_chk_mcast_addr(struct net_device *dev, ...@@ -88,6 +88,10 @@ extern int ipv6_chk_mcast_addr(struct net_device *dev,
extern void addrconf_prefix_rcv(struct net_device *dev, extern void addrconf_prefix_rcv(struct net_device *dev,
u8 *opt, int len); 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 * static inline struct inet6_dev *
__in6_dev_get(struct net_device *dev) __in6_dev_get(struct net_device *dev)
{ {
......
...@@ -537,6 +537,30 @@ struct inode *shmem_get_inode(struct super_block *sb, int mode, int dev) ...@@ -537,6 +537,30 @@ struct inode *shmem_get_inode(struct super_block *sb, int mode, int dev)
return inode; 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 #ifdef CONFIG_TMPFS
static ssize_t static ssize_t
shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos) shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
...@@ -1003,30 +1027,6 @@ static int shmem_parse_options(char *options, int *mode, unsigned long * blocks, ...@@ -1003,30 +1027,6 @@ static int shmem_parse_options(char *options, int *mode, unsigned long * blocks,
return 0; 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) static int shmem_remount_fs (struct super_block *sb, int *flags, char *data)
{ {
struct shmem_sb_info *info = &sb->u.shmem_sb; struct shmem_sb_info *info = &sb->u.shmem_sb;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Authors: Alan Cox <iiitac@pyr.swan.ac.uk> * Authors: Alan Cox <iiitac@pyr.swan.ac.uk>
* Florian La Roche <rzsfl@rz.uni-sb.de> * 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: * Fixes:
* Alan Cox : Fixed the worst of the load balancer bugs. * Alan Cox : Fixed the worst of the load balancer bugs.
...@@ -180,7 +180,7 @@ struct sk_buff *alloc_skb(unsigned int size,int gfp_mask) ...@@ -180,7 +180,7 @@ struct sk_buff *alloc_skb(unsigned int size,int gfp_mask)
/* Get the HEAD */ /* Get the HEAD */
skb = skb_head_from_pool(); skb = skb_head_from_pool();
if (skb == NULL) { 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) if (skb == NULL)
goto nohead; goto nohead;
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* PF_INET protocol family socket handler. * 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> * Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
...@@ -117,8 +117,6 @@ ...@@ -117,8 +117,6 @@
#include <linux/wireless.h> /* Note : will define WIRELESS_EXT */ #include <linux/wireless.h> /* Note : will define WIRELESS_EXT */
#endif /* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */ #endif /* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */
#define min(a,b) ((a)<(b)?(a):(b))
struct linux_mib net_statistics[NR_CPUS*2]; struct linux_mib net_statistics[NR_CPUS*2];
#ifdef INET_REFCNT_DEBUG #ifdef INET_REFCNT_DEBUG
...@@ -882,14 +880,15 @@ static int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -882,14 +880,15 @@ static int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
if (br_ioctl_hook != NULL) if (br_ioctl_hook != NULL)
return br_ioctl_hook(arg); return br_ioctl_hook(arg);
#endif #endif
return -ENOPKG;
case SIOCGIFDIVERT: case SIOCGIFDIVERT:
case SIOCSIFDIVERT: case SIOCSIFDIVERT:
#ifdef CONFIG_NET_DIVERT #ifdef CONFIG_NET_DIVERT
return(divert_ioctl(cmd, (struct divert_cf *) arg)); return divert_ioctl(cmd, (struct divert_cf *) arg);
#else #else
return -ENOPKG; return -ENOPKG;
#endif /* CONFIG_NET_DIVERT */ #endif /* CONFIG_NET_DIVERT */
return -ENOPKG;
case SIOCADDDLCI: case SIOCADDDLCI:
case SIOCDELDLCI: case SIOCDELDLCI:
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Alan Cox, <alan@redhat.com> * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -88,8 +88,6 @@ ...@@ -88,8 +88,6 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <net/checksum.h> #include <net/checksum.h>
#define min(a,b) ((a)<(b)?(a):(b))
/* /*
* Build xmit assembly blocks * Build xmit assembly blocks
*/ */
...@@ -240,12 +238,15 @@ static __inline__ void icmp_xmit_unlock(void) ...@@ -240,12 +238,15 @@ static __inline__ void icmp_xmit_unlock(void)
int xrlim_allow(struct dst_entry *dst, int timeout) int xrlim_allow(struct dst_entry *dst, int timeout)
{ {
unsigned long now; unsigned long now;
static int burst = HZ;
now = jiffies; now = jiffies;
dst->rate_tokens += now - dst->rate_last; dst->rate_tokens += now - dst->rate_last;
dst->rate_last = now; dst->rate_last = now;
if (dst->rate_tokens > XRLIM_BURST_FACTOR*timeout) if (burst < XRLIM_BURST_FACTOR*timeout)
dst->rate_tokens = XRLIM_BURST_FACTOR*timeout; burst = XRLIM_BURST_FACTOR*timeout;
if (dst->rate_tokens > burst)
dst->rate_tokens = burst;
if (dst->rate_tokens >= timeout) { if (dst->rate_tokens >= timeout) {
dst->rate_tokens -= timeout; dst->rate_tokens -= timeout;
return 1; return 1;
...@@ -635,8 +636,8 @@ static void icmp_unreach(struct sk_buff *skb) ...@@ -635,8 +636,8 @@ static void icmp_unreach(struct sk_buff *skb)
read_lock(&raw_v4_lock); read_lock(&raw_v4_lock);
if ((raw_sk = raw_v4_htable[hash]) != NULL) if ((raw_sk = raw_v4_htable[hash]) != NULL)
{ {
while ((raw_sk = __raw_v4_lookup(raw_sk, protocol, iph->saddr, while ((raw_sk = __raw_v4_lookup(raw_sk, protocol, iph->daddr,
iph->daddr, skb->dev->ifindex)) != NULL) { iph->saddr, skb->dev->ifindex)) != NULL) {
raw_err(raw_sk, skb, info); raw_err(raw_sk, skb, info);
raw_sk = raw_sk->next; raw_sk = raw_sk->next;
iph = (struct iphdr *)skb->data; iph = (struct iphdr *)skb->data;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* The Internet Protocol (IP) output module. * 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> * Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
...@@ -211,7 +211,8 @@ int ip_mc_output(struct sk_buff *skb) ...@@ -211,7 +211,8 @@ int ip_mc_output(struct sk_buff *skb)
* Multicasts are looped back for other local users * 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 #ifdef CONFIG_IP_MROUTE
/* Small optimization: do not loopback not local frames, /* Small optimization: do not loopback not local frames,
which returned after forwarding; they will be dropped which returned after forwarding; they will be dropped
...@@ -221,9 +222,9 @@ int ip_mc_output(struct sk_buff *skb) ...@@ -221,9 +222,9 @@ int ip_mc_output(struct sk_buff *skb)
This check is duplicated in ip_mr_input at the moment. 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 #endif
{ ) {
struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
if (newskb) if (newskb)
NF_HOOK(PF_INET, NF_IP_POST_ROUTING, newskb, NULL, NF_HOOK(PF_INET, NF_IP_POST_ROUTING, newskb, NULL,
...@@ -342,6 +343,13 @@ int ip_queue_xmit(struct sk_buff *skb) ...@@ -342,6 +343,13 @@ int ip_queue_xmit(struct sk_buff *skb)
struct rtable *rt; struct rtable *rt;
struct iphdr *iph; 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. */ /* Make sure we can route this packet. */
rt = (struct rtable *)__sk_dst_check(sk, 0); rt = (struct rtable *)__sk_dst_check(sk, 0);
if (rt == NULL) { if (rt == NULL) {
...@@ -365,6 +373,7 @@ int ip_queue_xmit(struct sk_buff *skb) ...@@ -365,6 +373,7 @@ int ip_queue_xmit(struct sk_buff *skb)
} }
skb->dst = dst_clone(&rt->u.dst); skb->dst = dst_clone(&rt->u.dst);
packet_routed:
if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway)
goto no_route; goto no_route;
......
...@@ -356,7 +356,7 @@ icmp_error_track(struct sk_buff *skb, ...@@ -356,7 +356,7 @@ icmp_error_track(struct sk_buff *skb,
inner = (struct iphdr *)(hdr + 1); inner = (struct iphdr *)(hdr + 1);
datalen = skb->len - iph->ihl*4 - sizeof(*hdr); 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"); DEBUGP("icmp_error_track: too short\n");
return NULL; return NULL;
} }
......
...@@ -92,10 +92,17 @@ tcp_manip_pkt(struct iphdr *iph, size_t len, ...@@ -92,10 +92,17 @@ tcp_manip_pkt(struct iphdr *iph, size_t len,
oldip = iph->daddr; oldip = iph->daddr;
portptr = &hdr->dest; portptr = &hdr->dest;
} }
/* 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, hdr->check = ip_nat_cheat_check(~oldip, manip->ip,
ip_nat_cheat_check(*portptr ^ 0xFFFF, ip_nat_cheat_check(*portptr ^ 0xFFFF,
manip->u.tcp.port, manip->u.tcp.port,
hdr->check)); hdr->check));
}
*portptr = manip->u.tcp.port; *portptr = manip->u.tcp.port;
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Implementation of the Transmission Control Protocol(TCP). * 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> * Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
...@@ -371,7 +371,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo) ...@@ -371,7 +371,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
tw->family = sk->family; tw->family = sk->family;
tw->reuse = sk->reuse; tw->reuse = sk->reuse;
tw->rcv_wscale = tp->rcv_wscale; tw->rcv_wscale = tp->rcv_wscale;
atomic_set(&tw->refcnt, 0); atomic_set(&tw->refcnt, 1);
tw->hashent = sk->hashent; tw->hashent = sk->hashent;
tw->rcv_nxt = tp->rcv_nxt; tw->rcv_nxt = tp->rcv_nxt;
...@@ -407,6 +407,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo) ...@@ -407,6 +407,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
} }
tcp_tw_schedule(tw, timeo); tcp_tw_schedule(tw, timeo);
tcp_tw_put(tw);
} else { } else {
/* Sorry, if we're out of memory, just CLOSE this /* Sorry, if we're out of memory, just CLOSE this
* socket up. We've got bigger problems than * socket up. We've got bigger problems than
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Pedro Roque <roque@di.fc.ul.pt> * Pedro Roque <roque@di.fc.ul.pt>
* Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <linux/sysctl.h> #include <linux/sysctl.h>
#endif #endif
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/notifier.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <net/sock.h> #include <net/sock.h>
...@@ -99,6 +100,8 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp); ...@@ -99,6 +100,8 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp);
static void addrconf_rs_timer(unsigned long data); static void addrconf_rs_timer(unsigned long data);
static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
static struct notifier_block *inet6addr_chain;
struct ipv6_devconf ipv6_devconf = struct ipv6_devconf ipv6_devconf =
{ {
0, /* forwarding */ 0, /* forwarding */
...@@ -392,6 +395,8 @@ ipv6_add_addr(struct inet6_dev *idev, struct in6_addr *addr, int pfxlen, ...@@ -392,6 +395,8 @@ ipv6_add_addr(struct inet6_dev *idev, struct in6_addr *addr, int pfxlen,
write_unlock_bh(&idev->lock); write_unlock_bh(&idev->lock);
read_unlock(&addrconf_lock); read_unlock(&addrconf_lock);
notifier_call_chain(&inet6addr_chain,NETDEV_UP,ifa);
return ifa; return ifa;
} }
...@@ -433,6 +438,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) ...@@ -433,6 +438,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
ipv6_ifa_notify(RTM_DELADDR, ifp); ipv6_ifa_notify(RTM_DELADDR, ifp);
notifier_call_chain(&inet6addr_chain,NETDEV_DOWN,ifp);
addrconf_del_timer(ifp); addrconf_del_timer(ifp);
...@@ -1959,6 +1965,20 @@ static void addrconf_sysctl_unregister(struct ipv6_devconf *p) ...@@ -1959,6 +1965,20 @@ static void addrconf_sysctl_unregister(struct ipv6_devconf *p)
#endif #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 * Init / cleanup code
*/ */
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
O_TARGET := netfilter.o O_TARGET := netfilter.o
export-objs := export-objs := ip6_tables.o
# Link order matters here. # Link order matters here.
obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o
......
...@@ -1791,5 +1791,13 @@ static void __exit fini(void) ...@@ -1791,5 +1791,13 @@ static void __exit fini(void)
#endif #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_init(init);
module_exit(fini); module_exit(fini);
...@@ -61,6 +61,7 @@ extern struct net_proto_family inet_family_ops; ...@@ -61,6 +61,7 @@ extern struct net_proto_family inet_family_ops;
#include <net/ipv6.h> #include <net/ipv6.h>
#include <net/ndisc.h> #include <net/ndisc.h>
#include <net/transp_v6.h> #include <net/transp_v6.h>
#include <net/addrconf.h>
extern int sysctl_local_port_range[2]; extern int sysctl_local_port_range[2];
extern int tcp_port_rover; extern int tcp_port_rover;
...@@ -280,6 +281,9 @@ EXPORT_SYMBOL(dlci_ioctl_hook); ...@@ -280,6 +281,9 @@ EXPORT_SYMBOL(dlci_ioctl_hook);
#ifdef CONFIG_IPV6 #ifdef CONFIG_IPV6
EXPORT_SYMBOL(ipv6_addr_type); EXPORT_SYMBOL(ipv6_addr_type);
EXPORT_SYMBOL(icmpv6_send); EXPORT_SYMBOL(icmpv6_send);
EXPORT_SYMBOL(ndisc_mc_map);
EXPORT_SYMBOL(register_inet6addr_notifier);
EXPORT_SYMBOL(unregister_inet6addr_notifier);
#endif #endif
#if defined (CONFIG_IPV6_MODULE) || defined (CONFIG_KHTTPD) || defined (CONFIG_KHTTPD_MODULE) #if defined (CONFIG_IPV6_MODULE) || defined (CONFIG_KHTTPD) || defined (CONFIG_KHTTPD_MODULE)
/* inet functions common to v4 and v6 */ /* inet functions common to v4 and v6 */
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* PACKET - implements raw packet sockets. * 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> * Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
...@@ -1488,14 +1488,15 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd, ...@@ -1488,14 +1488,15 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
return br_ioctl_hook(arg); return br_ioctl_hook(arg);
#endif #endif
#endif #endif
return -ENOPKG;
case SIOCGIFDIVERT: case SIOCGIFDIVERT:
case SIOCSIFDIVERT: case SIOCSIFDIVERT:
#ifdef CONFIG_NET_DIVERT #ifdef CONFIG_NET_DIVERT
return(divert_ioctl(cmd, (struct divert_cf *) arg)); return divert_ioctl(cmd, (struct divert_cf *) arg);
#endif /* CONFIG_NET_DIVERT */ #else
return -ENOPKG; return -ENOPKG;
#endif /* CONFIG_NET_DIVERT */
#ifdef CONFIG_INET #ifdef CONFIG_INET
case SIOCADDRT: case SIOCADDRT:
......
...@@ -316,13 +316,14 @@ static int route4_delete(struct tcf_proto *tp, unsigned long arg) ...@@ -316,13 +316,14 @@ static int route4_delete(struct tcf_proto *tp, unsigned long arg)
{ {
struct route4_head *head = (struct route4_head*)tp->root; struct route4_head *head = (struct route4_head*)tp->root;
struct route4_filter **fp, *f = (struct route4_filter*)arg; struct route4_filter **fp, *f = (struct route4_filter*)arg;
unsigned h = f->handle; unsigned h = 0;
struct route4_bucket *b; struct route4_bucket *b;
int i; int i;
if (!head || !f) if (!head || !f)
return -EINVAL; return -EINVAL;
h = f->handle;
b = f->bkt; b = f->bkt;
for (fp = &b->ht[from_hash(h>>16)]; *fp; fp = &(*fp)->next) { for (fp = &b->ht[from_hash(h>>16)]; *fp; fp = &(*fp)->next) {
......
...@@ -162,7 +162,7 @@ static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_re ...@@ -162,7 +162,7 @@ static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_re
if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT))) if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT)))
goto next_ht; 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; off2 = n->sel.off + 3;
if (n->sel.flags&TC_U32_VAROFFSET) if (n->sel.flags&TC_U32_VAROFFSET)
off2 += ntohs(n->sel.offmask & *(u16*)(ptr+n->sel.offoff)) >>n->sel.offshift; off2 += ntohs(n->sel.offmask & *(u16*)(ptr+n->sel.offoff)) >>n->sel.offshift;
......
...@@ -1245,8 +1245,10 @@ static int cbq_drop(struct Qdisc* sch) ...@@ -1245,8 +1245,10 @@ static int cbq_drop(struct Qdisc* sch)
cl = cl_head; cl = cl_head;
do { 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; return 1;
}
} while ((cl = cl->next_alive) != cl_head); } while ((cl = cl->next_alive) != cl_head);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment