Commit b08d296b authored by David S. Miller's avatar David S. Miller

Merge davem@nuts.ninka.net:/home/davem/src/BK/net-2.5

into kernel.bkbits.net:/home/davem/net-2.5
parents 5057c65e 65a1432b
......@@ -27,6 +27,7 @@ struct uPD98402_priv {
struct k_sonet_stats sonet_stats;/* link diagnostics */
unsigned char framing; /* SONET/SDH framing */
int loop_mode; /* loopback mode */
spinlock_t lock;
};
......@@ -71,14 +72,13 @@ static int set_framing(struct atm_dev *dev,unsigned char framing)
default:
return -EINVAL;
}
save_flags(flags);
cli();
spin_lock_irqsave(&PRIV(dev)->lock, flags);
PUT(set[0],C11T);
PUT(set[1],C12T);
PUT(set[2],C13T);
PUT((GET(MDR) & ~uPD98402_MDR_SS_MASK) | (set[3] <<
uPD98402_MDR_SS_SHIFT),MDR);
restore_flags(flags);
spin_unlock_irqrestore(&PRIV(dev)->lock, flags);
return 0;
}
......@@ -88,12 +88,11 @@ static int get_sense(struct atm_dev *dev,u8 *arg)
unsigned long flags;
unsigned char s[3];
save_flags(flags);
cli();
spin_lock_irqsave(&PRIV(dev)->lock, flags);
s[0] = GET(C11R);
s[1] = GET(C12R);
s[2] = GET(C13R);
restore_flags(flags);
spin_unlock_irqrestore(&PRIV(dev)->lock, flags);
return (put_user(s[0], arg) || put_user(s[1], arg+1) ||
put_user(s[2], arg+2) || put_user(0xff, arg+3) ||
put_user(0xff, arg+4) || put_user(0xff, arg+5)) ? -EFAULT : 0;
......@@ -214,6 +213,7 @@ static int uPD98402_start(struct atm_dev *dev)
DPRINTK("phy_start\n");
if (!(PRIV(dev) = kmalloc(sizeof(struct uPD98402_priv),GFP_KERNEL)))
return -ENOMEM;
spin_lock_init(&PRIV(dev)->lock);
memset(&PRIV(dev)->sonet_stats,0,sizeof(struct k_sonet_stats));
(void) GET(PCR); /* clear performance events */
PUT(uPD98402_PFM_FJ,PCMR); /* ignore frequency adj */
......
......@@ -195,11 +195,10 @@ static void refill_pool(struct atm_dev *dev,int pool)
sizeof(struct rx_buffer_head);
}
size += align;
save_flags(flags);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
free = zpeekl(zatm_dev,zatm_dev->pool_base+2*pool) &
uPD98401_RXFP_REMAIN;
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
if (free >= zatm_dev->pool_info[pool].low_water) return;
EVENT("starting ... POOL: 0x%x, 0x%x\n",
zpeekl(zatm_dev,zatm_dev->pool_base+2*pool),
......@@ -228,22 +227,22 @@ static void refill_pool(struct atm_dev *dev,int pool)
head->skb = skb;
EVENT("enq skb 0x%08lx/0x%08lx\n",(unsigned long) skb,
(unsigned long) head);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
if (zatm_dev->last_free[pool])
((struct rx_buffer_head *) (zatm_dev->last_free[pool]->
data))[-1].link = virt_to_bus(head);
zatm_dev->last_free[pool] = skb;
skb_queue_tail(&zatm_dev->pool[pool],skb);
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
free++;
}
if (first) {
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
zwait;
zout(virt_to_bus(first),CER);
zout(uPD98401_ADD_BAT | (pool << uPD98401_POOL_SHIFT) | count,
CMR);
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
EVENT ("POOL: 0x%x, 0x%x\n",
zpeekl(zatm_dev,zatm_dev->pool_base+2*pool),
zpeekl(zatm_dev,zatm_dev->pool_base+2*pool+1));
......@@ -286,8 +285,7 @@ static void use_pool(struct atm_dev *dev,int pool)
size = pool-ZATM_AAL5_POOL_BASE;
if (size < 0) size = 0; /* 64B... */
else if (size > 10) size = 10; /* ... 64kB */
save_flags(flags);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
zpokel(zatm_dev,((zatm_dev->pool_info[pool].low_water/4) <<
uPD98401_RXFP_ALERT_SHIFT) |
(1 << uPD98401_RXFP_BTSZ_SHIFT) |
......@@ -295,7 +293,7 @@ static void use_pool(struct atm_dev *dev,int pool)
zatm_dev->pool_base+pool*2);
zpokel(zatm_dev,(unsigned long) dummy,zatm_dev->pool_base+
pool*2+1);
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
zatm_dev->last_free[pool] = NULL;
refill_pool(dev,pool);
}
......@@ -315,29 +313,29 @@ static void zatm_feedback(struct atm_vcc *vcc,struct sk_buff *skb,
{
struct zatm_pool_info *pool;
unsigned long offset,flags;
struct zatm_dev *zatm_dev = ZATM_DEV(vcc->dev);
DPRINTK("start 0x%08lx dest 0x%08lx len %d\n",start,dest,len);
if (len < PAGE_SIZE) return;
pool = &ZATM_DEV(vcc->dev)->pool_info[ZATM_VCC(vcc)->pool];
pool = &zatm_dev->pool_info[ZATM_VCC(vcc)->pool];
offset = (dest-start) & (PAGE_SIZE-1);
save_flags(flags);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
if (!offset || pool->offset == offset) {
pool->next_cnt = 0;
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
return;
}
if (offset != pool->next_off) {
pool->next_off = offset;
pool->next_cnt = 0;
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
return;
}
if (++pool->next_cnt >= pool->next_thres) {
pool->offset = pool->next_off;
pool->next_cnt = 0;
}
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
}
/*----------------------------------- RX ------------------------------------*/
......@@ -535,20 +533,19 @@ static int open_rx_first(struct atm_vcc *vcc)
zatm_vcc->pool = ZATM_AAL0_POOL;
}
if (zatm_vcc->pool < 0) return -EMSGSIZE;
save_flags(flags);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
zwait;
zout(uPD98401_OPEN_CHAN,CMR);
zwait;
DPRINTK("0x%x 0x%x\n",zin(CMR),zin(CER));
chan = (zin(CMR) & uPD98401_CHAN_ADDR) >> uPD98401_CHAN_ADDR_SHIFT;
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
DPRINTK("chan is %d\n",chan);
if (!chan) return -EAGAIN;
use_pool(vcc->dev,zatm_vcc->pool);
DPRINTK("pool %d\n",zatm_vcc->pool);
/* set up VC descriptor */
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
zpokel(zatm_dev,zatm_vcc->pool << uPD98401_RXVC_POOL_SHIFT,
chan*VC_SIZE/4);
zpokel(zatm_dev,uPD98401_RXVC_OD | (vcc->qos.aal == ATM_AAL5 ?
......@@ -556,7 +553,7 @@ static int open_rx_first(struct atm_vcc *vcc)
zpokel(zatm_dev,0,chan*VC_SIZE/4+2);
zatm_vcc->rx_chan = chan;
zatm_dev->rx_map[chan] = vcc;
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
return 0;
}
......@@ -572,14 +569,13 @@ static int open_rx_second(struct atm_vcc *vcc)
zatm_dev = ZATM_DEV(vcc->dev);
zatm_vcc = ZATM_VCC(vcc);
if (!zatm_vcc->rx_chan) return 0;
save_flags(flags);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
/* should also handle VPI @@@ */
pos = vcc->vci >> 1;
shift = (1-(vcc->vci & 1)) << 4;
zpokel(zatm_dev,(zpeekl(zatm_dev,pos) & ~(0xffff << shift)) |
((zatm_vcc->rx_chan | uPD98401_RXLT_ENBL) << shift),pos);
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
return 0;
}
......@@ -596,9 +592,8 @@ static void close_rx(struct atm_vcc *vcc)
if (!zatm_vcc->rx_chan) return;
DPRINTK("close_rx\n");
/* disable receiver */
save_flags(flags);
if (vcc->vpi != ATM_VPI_UNSPEC && vcc->vci != ATM_VCI_UNSPEC) {
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
pos = vcc->vci >> 1;
shift = (1-(vcc->vci & 1)) << 4;
zpokel(zatm_dev,zpeekl(zatm_dev,pos) & ~(0xffff << shift),pos);
......@@ -606,9 +601,9 @@ static void close_rx(struct atm_vcc *vcc)
zout(uPD98401_NOP,CMR);
zwait;
zout(uPD98401_NOP,CMR);
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
}
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
zwait;
zout(uPD98401_DEACT_CHAN | uPD98401_CHAN_RT | (zatm_vcc->rx_chan <<
uPD98401_CHAN_ADDR_SHIFT),CMR);
......@@ -620,7 +615,7 @@ static void close_rx(struct atm_vcc *vcc)
if (!(zin(CMR) & uPD98401_CHAN_ADDR))
printk(KERN_CRIT DEV_LABEL "(itf %d): can't close RX channel "
"%d\n",vcc->dev->number,zatm_vcc->rx_chan);
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
zatm_dev->rx_map[zatm_vcc->rx_chan] = NULL;
zatm_vcc->rx_chan = 0;
unuse_pool(vcc->dev,zatm_vcc->pool);
......@@ -673,11 +668,10 @@ static int do_tx(struct sk_buff *skb)
zatm_dev = ZATM_DEV(vcc->dev);
zatm_vcc = ZATM_VCC(vcc);
EVENT("iovcnt=%d\n",skb_shinfo(skb)->nr_frags,0);
save_flags(flags);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
if (!skb_shinfo(skb)->nr_frags) {
if (zatm_vcc->txing == RING_ENTRIES-1) {
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
return RING_BUSY;
}
zatm_vcc->txing++;
......@@ -732,7 +726,7 @@ printk("NONONONOO!!!!\n");
zwait;
zout(uPD98401_TX_READY | (zatm_vcc->tx_chan <<
uPD98401_CHAN_ADDR_SHIFT),CMR);
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
EVENT("done\n",0,0);
return 0;
}
......@@ -866,15 +860,14 @@ static int alloc_shaper(struct atm_dev *dev,int *pcr,int min,int max,int ubr)
if (zatm_dev->tx_bw < *pcr) return -EAGAIN;
zatm_dev->tx_bw -= *pcr;
}
save_flags(flags);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
DPRINTK("i = %d, m = %d, PCR = %d\n",i,m,*pcr);
zpokel(zatm_dev,(i << uPD98401_IM_I_SHIFT) | m,uPD98401_IM(shaper));
zpokel(zatm_dev,c << uPD98401_PC_C_SHIFT,uPD98401_PC(shaper));
zpokel(zatm_dev,0,uPD98401_X(shaper));
zpokel(zatm_dev,0,uPD98401_Y(shaper));
zpokel(zatm_dev,uPD98401_PS_E,uPD98401_PS(shaper));
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
return shaper;
}
......@@ -889,11 +882,10 @@ static void dealloc_shaper(struct atm_dev *dev,int shaper)
if (--zatm_dev->ubr_ref_cnt) return;
zatm_dev->ubr = -1;
}
save_flags(flags);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
zpokel(zatm_dev,zpeekl(zatm_dev,uPD98401_PS(shaper)) & ~uPD98401_PS_E,
uPD98401_PS(shaper));
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
zatm_dev->free_shapers |= 1 << shaper;
}
......@@ -912,8 +904,6 @@ int once = 1;
chan = zatm_vcc->tx_chan;
if (!chan) return;
DPRINTK("close_tx\n");
save_flags(flags);
cli();
while (skb_peek(&zatm_vcc->backlog)) {
if (once) {
printk("waiting for backlog to drain ...\n");
......@@ -932,6 +922,7 @@ once = 0;
DPRINTK("waiting for TX queue to drain ... %p\n",skb);
sleep_on(&zatm_vcc->tx_wait);
}
spin_lock_irqsave(&zatm_dev->lock, flags);
#if 0
zwait;
zout(uPD98401_DEACT_CHAN | (chan << uPD98401_CHAN_ADDR_SHIFT),CMR);
......@@ -942,7 +933,7 @@ once = 0;
if (!(zin(CMR) & uPD98401_CHAN_ADDR))
printk(KERN_CRIT DEV_LABEL "(itf %d): can't close TX channel "
"%d\n",vcc->dev->number,chan);
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
zatm_vcc->tx_chan = 0;
zatm_dev->tx_map[chan] = NULL;
if (zatm_vcc->shaper != zatm_dev->ubr) {
......@@ -967,14 +958,13 @@ static int open_tx_first(struct atm_vcc *vcc)
zatm_vcc = ZATM_VCC(vcc);
zatm_vcc->tx_chan = 0;
if (vcc->qos.txtp.traffic_class == ATM_NONE) return 0;
save_flags(flags);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
zwait;
zout(uPD98401_OPEN_CHAN,CMR);
zwait;
DPRINTK("0x%x 0x%x\n",zin(CMR),zin(CER));
chan = (zin(CMR) & uPD98401_CHAN_ADDR) >> uPD98401_CHAN_ADDR_SHIFT;
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
DPRINTK("chan is %d\n",chan);
if (!chan) return -EAGAIN;
unlimited = vcc->qos.txtp.traffic_class == ATM_UBR &&
......@@ -1022,15 +1012,14 @@ static int open_tx_second(struct atm_vcc *vcc)
zatm_dev = ZATM_DEV(vcc->dev);
zatm_vcc = ZATM_VCC(vcc);
if (!zatm_vcc->tx_chan) return 0;
save_flags(flags);
/* set up VC descriptor */
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
zpokel(zatm_dev,0,zatm_vcc->tx_chan*VC_SIZE/4);
zpokel(zatm_dev,uPD98401_TXVC_L | (zatm_vcc->shaper <<
uPD98401_TXVC_SHP_SHIFT) | (vcc->vpi << uPD98401_TXVC_VPI_SHIFT) |
vcc->vci,zatm_vcc->tx_chan*VC_SIZE/4+1);
zpokel(zatm_dev,0,zatm_vcc->tx_chan*VC_SIZE/4+2);
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
zatm_dev->tx_map[zatm_vcc->tx_chan] = vcc;
return 0;
}
......@@ -1236,6 +1225,7 @@ static int __init zatm_init(struct atm_dev *dev)
DPRINTK(">zatm_init\n");
zatm_dev = ZATM_DEV(dev);
spin_lock_init(&zatm_dev->lock);
pci_dev = zatm_dev->pci_dev;
zatm_dev->base = pci_resource_start(pci_dev, 0);
zatm_dev->irq = pci_dev->irq;
......@@ -1285,14 +1275,13 @@ static int __init zatm_init(struct atm_dev *dev)
do {
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
t0 = zpeekl(zatm_dev,uPD98401_TSR);
udelay(10);
t1 = zpeekl(zatm_dev,uPD98401_TSR);
udelay(1010);
t2 = zpeekl(zatm_dev,uPD98401_TSR);
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
}
while (t0 > t1 || t1 > t2); /* loop if wrapping ... */
zatm_dev->khz = t2-2*t1+t0;
......@@ -1492,14 +1481,13 @@ static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg)
return -EFAULT;
if (pool < 0 || pool > ZATM_LAST_POOL)
return -EINVAL;
save_flags(flags);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
info = zatm_dev->pool_info[pool];
if (cmd == ZATM_GETPOOLZ) {
zatm_dev->pool_info[pool].rqa_count = 0;
zatm_dev->pool_info[pool].rqu_count = 0;
}
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
return copy_to_user(
&((struct zatm_pool_req *) arg)->info,
&info,sizeof(info)) ? -EFAULT : 0;
......@@ -1530,15 +1518,14 @@ static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg)
if (info.low_water >= info.high_water ||
info.low_water < 0)
return -EINVAL;
save_flags(flags);
cli();
spin_lock_irqsave(&zatm_dev->lock, flags);
zatm_dev->pool_info[pool].low_water =
info.low_water;
zatm_dev->pool_info[pool].high_water =
info.high_water;
zatm_dev->pool_info[pool].next_thres =
info.next_thres;
restore_flags(flags);
spin_unlock_irqrestore(&zatm_dev->lock, flags);
return 0;
}
default:
......
......@@ -85,6 +85,7 @@ struct zatm_dev {
unsigned char irq; /* IRQ */
unsigned int base; /* IO base address */
struct pci_dev *pci_dev; /* PCI stuff */
spinlock_t lock;
};
......
......@@ -2101,17 +2101,14 @@ static int gem_open(struct net_device *dev)
gp->hw_running = 1;
}
spin_lock_irq(&gp->lock);
/* We can now request the interrupt as we know it's masked
* on the controller
*/
if (request_irq(gp->pdev->irq, gem_interrupt,
SA_SHIRQ, dev->name, (void *)dev)) {
spin_unlock_irq(&gp->lock);
printk(KERN_ERR "%s: failed to request irq !\n", gp->dev->name);
spin_lock_irq(&gp->lock);
#ifdef CONFIG_PPC_PMAC
if (!hw_was_up && gp->pdev->vendor == PCI_VENDOR_ID_APPLE)
gem_apple_powerdown(gp);
......@@ -2120,10 +2117,13 @@ static int gem_open(struct net_device *dev)
gp->pm_timer.expires = jiffies + 10*HZ;
add_timer(&gp->pm_timer);
up(&gp->pm_sem);
spin_unlock_irq(&gp->lock);
return -EAGAIN;
}
spin_lock_irq(&gp->lock);
/* Allocate & setup ring buffers */
gem_init_rings(gp);
......
......@@ -48,6 +48,7 @@ static const char *version =
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h>
#include <asm/system.h>
#include <asm/bitops.h>
......@@ -442,6 +443,7 @@ struct tc35815_local {
unsigned char fbl_curid;
dma_addr_t data_buf_dma_handle[RX_BUF_PAGES];
void * data_buf[RX_BUF_PAGES]; /* packing */
spinlock_t lock;
};
/* Index to functions, as function prototypes. */
......@@ -577,6 +579,8 @@ static int __init tc35815_probe1(struct pci_dev *pdev, unsigned int base_addr, u
lp->next_module = root_tc35815_dev;
root_tc35815_dev = dev;
spin_lock_init(&lp->lock);
if (dev->mem_start > 0) {
lp->option = dev->mem_start;
if ((lp->option & TC35815_OPT_10M) &&
......@@ -895,7 +899,7 @@ static void tc35815_tx_timeout(struct net_device *dev)
struct tc35815_regs *tr = (struct tc35815_regs *)dev->base_addr;
int flags;
save_and_cli(flags);
spin_lock_irqsave(&lp->lock, flags);
printk(KERN_WARNING "%s: transmit timed out, status %#x\n",
dev->name, tc_readl(&tr->Tx_Stat));
/* Try to restart the adaptor. */
......@@ -903,7 +907,7 @@ static void tc35815_tx_timeout(struct net_device *dev)
tc35815_clear_queues(dev);
tc35815_chip_init(dev);
lp->tbusy=0;
restore_flags(flags);
spin_unlock_irqrestore(&lp->lock, flags);
dev->trans_start = jiffies;
netif_wake_queue(dev);
}
......@@ -951,7 +955,7 @@ static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev)
dma_cache_wback_inv((unsigned long)buf, length);
#endif
save_and_cli(flags);
spin_lock_irqsave(&lp->lock, flags);
/* failsafe... */
if (lp->tfd_start != lp->tfd_end)
......@@ -999,7 +1003,7 @@ static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev)
if (tc35815_debug > 1)
printk(KERN_WARNING "%s: TxFD Exhausted.\n", dev->name);
}
restore_flags(flags);
spin_unlock_irqrestore(&lp->lock, flags);
}
return 0;
......@@ -1403,10 +1407,10 @@ static struct net_device_stats *tc35815_get_stats(struct net_device *dev)
unsigned long flags;
if (netif_running(dev)) {
save_and_cli(flags);
spin_lock_irqsave(&lp->lock, flags);
/* Update the statistics from the device registers. */
lp->stats.rx_missed_errors = tc_readl(&tr->Miss_Cnt);
restore_flags(flags);
spin_unlock_irqrestore(&lp->lock, flags);
}
return &lp->stats;
......@@ -1507,28 +1511,34 @@ tc35815_set_multicast_list(struct net_device *dev)
}
}
static unsigned long tc_phy_read(struct tc35815_regs *tr, int phy, int phy_reg)
static unsigned long tc_phy_read(struct net_device *dev, struct tc35815_regs *tr, int phy, int phy_reg)
{
struct tc35815_local *lp = (struct tc35815_local *)dev->priv;
unsigned long data;
int flags;
save_and_cli(flags);
spin_lock_irqsave(&lp->lock, flags);
tc_writel(MD_CA_Busy | (phy << 5) | phy_reg, &tr->MD_CA);
while (tc_readl(&tr->MD_CA) & MD_CA_Busy)
;
data = tc_readl(&tr->MD_Data);
restore_flags(flags);
spin_unlock_irqrestore(&lp->lock, flags);
return data;
}
static void tc_phy_write(unsigned long d, struct tc35815_regs *tr, int phy, int phy_reg)
static void tc_phy_write(struct net_device *dev, unsigned long d, struct tc35815_regs *tr, int phy, int phy_reg)
{
struct tc35815_local *lp = (struct tc35815_local *)dev->priv;
int flags;
save_and_cli(flags);
spin_lock_irqsave(&lp->lock, flags);
tc_writel(d, &tr->MD_Data);
tc_writel(MD_CA_Busy | MD_CA_Wr | (phy << 5) | phy_reg, &tr->MD_CA);
while (tc_readl(&tr->MD_CA) & MD_CA_Busy)
;
restore_flags(flags);
spin_unlock_irqrestore(&lp->lock, flags);
}
static void tc35815_phy_chip_init(struct net_device *dev)
......@@ -1544,18 +1554,18 @@ static void tc35815_phy_chip_init(struct net_device *dev)
first = 0;
/* first data written to the PHY will be an ID number */
tc_phy_write(0, tr, 0, MII_CONTROL); /* ID:0 */
tc_phy_write(dev, 0, tr, 0, MII_CONTROL); /* ID:0 */
#if 0
tc_phy_write(MIICNTL_RESET, tr, 0, MII_CONTROL);
tc_phy_write(dev, MIICNTL_RESET, tr, 0, MII_CONTROL);
printk(KERN_INFO "%s: Resetting PHY...", dev->name);
while (tc_phy_read(tr, 0, MII_CONTROL) & MIICNTL_RESET)
while (tc_phy_read(dev, tr, 0, MII_CONTROL) & MIICNTL_RESET)
;
printk("\n");
tc_phy_write(MIICNTL_AUTO|MIICNTL_SPEED|MIICNTL_FDX, tr, 0,
tc_phy_write(dev, MIICNTL_AUTO|MIICNTL_SPEED|MIICNTL_FDX, tr, 0,
MII_CONTROL);
#endif
id0 = tc_phy_read(tr, 0, MII_PHY_ID0);
id1 = tc_phy_read(tr, 0, MII_PHY_ID1);
id0 = tc_phy_read(dev, tr, 0, MII_PHY_ID0);
id1 = tc_phy_read(dev, tr, 0, MII_PHY_ID1);
printk(KERN_DEBUG "%s: PHY ID %04x %04x\n", dev->name,
id0, id1);
if (lp->option & TC35815_OPT_10M) {
......@@ -1567,10 +1577,10 @@ static void tc35815_phy_chip_init(struct net_device *dev)
} else {
/* auto negotiation */
unsigned long neg_result;
tc_phy_write(MIICNTL_AUTO | MIICNTL_RST_AUTO, tr, 0, MII_CONTROL);
tc_phy_write(dev, MIICNTL_AUTO | MIICNTL_RST_AUTO, tr, 0, MII_CONTROL);
printk(KERN_INFO "%s: Auto Negotiation...", dev->name);
count = 0;
while (!(tc_phy_read(tr, 0, MII_STATUS) & MIISTAT_AUTO_DONE)) {
while (!(tc_phy_read(dev, tr, 0, MII_STATUS) & MIISTAT_AUTO_DONE)) {
if (count++ > 5000) {
printk(" failed. Assume 10Mbps\n");
lp->linkspeed = 10;
......@@ -1582,7 +1592,7 @@ static void tc35815_phy_chip_init(struct net_device *dev)
mdelay(1);
}
printk(" done.\n");
neg_result = tc_phy_read(tr, 0, MII_ANLPAR);
neg_result = tc_phy_read(dev, tr, 0, MII_ANLPAR);
if (neg_result & (MII_AN_TX_FDX | MII_AN_TX_HDX))
lp->linkspeed = 100;
else
......@@ -1601,7 +1611,7 @@ static void tc35815_phy_chip_init(struct net_device *dev)
ctl |= MIICNTL_SPEED;
if (lp->fullduplex)
ctl |= MIICNTL_FDX;
tc_phy_write(ctl, tr, 0, MII_CONTROL);
tc_phy_write(dev, ctl, tr, 0, MII_CONTROL);
if (lp->fullduplex) {
tc_writel(tc_readl(&tr->MAC_Ctl) | MAC_FullDup, &tr->MAC_Ctl);
......@@ -1652,7 +1662,7 @@ static void tc35815_chip_init(struct net_device *dev)
tc_writel(CAM_Ena_Bit(CAM_ENTRY_SOURCE), &tr->CAM_Ena);
tc_writel(CAM_CompEn | CAM_BroadAcc, &tr->CAM_Ctl);
save_and_cli(flags);
spin_lock_irqsave(&lp->lock, flags);
tc_writel(DMA_BURST_SIZE, &tr->DMA_Ctl);
......@@ -1683,7 +1693,7 @@ static void tc35815_chip_init(struct net_device *dev)
#if 0 /* No need to polling */
tc_writel(virt_to_bus(lp->tfd_base), &tr->TxFrmPtr); /* start DMA transmitter */
#endif
restore_flags(flags);
spin_unlock_irqrestore(&lp->lock, flags);
}
static int tc35815_proc_info(char *buffer, char **start, off_t offset, int length, int *eof, void *data)
......
......@@ -189,6 +189,7 @@ struct ipv6_pinfo {
struct ipv6_txoptions *opt;
struct rt6_info *rt;
struct flowi *fl;
int hop_limit;
} cork;
};
......
......@@ -904,9 +904,9 @@ static inline unsigned char *pskb_pull(struct sk_buff *skb, unsigned int len)
static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
{
if (len <= skb_headlen(skb))
if (likely(len <= skb_headlen(skb)))
return 1;
if (len > skb->len)
if (unlikely(len > skb->len))
return 0;
return __pskb_pull_tail(skb, len-skb_headlen(skb)) != NULL;
}
......
......@@ -216,12 +216,16 @@ extern psched_time_t psched_time_base;
#if PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES
#if HZ == 100
#if HZ < 96
#define PSCHED_JSCALE 14
#elif HZ >= 96 && HZ < 192
#define PSCHED_JSCALE 13
#elif HZ == 1024
#elif HZ >= 192 && HZ < 384
#define PSCHED_JSCALE 12
#elif HZ >= 384 && HZ < 768
#define PSCHED_JSCALE 11
#elif HZ >= 768
#define PSCHED_JSCALE 10
#else
#define PSCHED_JSCALE 0
#endif
#define PSCHED_EXPORTLIST_2
......
......@@ -58,66 +58,6 @@ config NETLINK_DEV
the real netlink socket.
This is a backward compatibility option, choose Y for now.
config NETFILTER
bool "Network packet filtering (replaces ipchains)"
---help---
Netfilter is a framework for filtering and mangling network packets
that pass through your Linux box.
The most common use of packet filtering is to run your Linux box as
a firewall protecting a local network from the Internet. The type of
firewall provided by this kernel support is called a "packet
filter", which means that it can reject individual network packets
based on type, source, destination etc. The other kind of firewall,
a "proxy-based" one, is more secure but more intrusive and more
bothersome to set up; it inspects the network traffic much more
closely, modifies it and has knowledge about the higher level
protocols, which a packet filter lacks. Moreover, proxy-based
firewalls often require changes to the programs running on the local
clients. Proxy-based firewalls don't need support by the kernel, but
they are often combined with a packet filter, which only works if
you say Y here.
You should also say Y here if you intend to use your Linux box as
the gateway to the Internet for a local network of machines without
globally valid IP addresses. This is called "masquerading": if one
of the computers on your local network wants to send something to
the outside, your box can "masquerade" as that computer, i.e. it
forwards the traffic to the intended outside destination, but
modifies the packets to make it look like they came from the
firewall box itself. It works both ways: if the outside host
replies, the Linux box will silently forward the traffic to the
correct local computer. This way, the computers on your local net
are completely invisible to the outside world, even though they can
reach the outside and can receive replies. It is even possible to
run globally visible servers from within a masqueraded local network
using a mechanism called portforwarding. Masquerading is also often
called NAT (Network Address Translation).
Another use of Netfilter is in transparent proxying: if a machine on
the local network tries to connect to an outside host, your Linux
box can transparently forward the traffic to a local server,
typically a caching proxy server.
Various modules exist for netfilter which replace the previous
masquerading (ipmasqadm), packet filtering (ipchains), transparent
proxying, and portforwarding mechanisms. Please see
<file:Documentation/Changes> under "iptables" for the location of
these packages.
Make sure to say N to "Fast switching" below if you intend to say Y
here, as Fast switching currently bypasses netfilter.
Chances are that you should say Y here if you compile a kernel which
will run as a router and N for regular hosts. If unsure, say N.
config NETFILTER_DEBUG
bool "Network packet filtering debugging"
depends on NETFILTER
help
You can say Y here if you want to get additional messages useful in
debugging the netfilter code.
config UNIX
tristate "Unix domain sockets"
---help---
......@@ -208,6 +148,129 @@ config IPV6
source "net/ipv6/Kconfig"
config DECNET
tristate "DECnet Support"
---help---
The DECnet networking protocol was used in many products made by
Digital (now Compaq). It provides reliable stream and sequenced
packet communications over which run a variety of services similar
to those which run over TCP/IP.
To find some tools to use with the kernel layer support, please
look at Patrick Caulfield's web site:
<http://linux.dreamtime.org/decnet/>.
More detailed documentation is available in
<file:Documentation/networking/decnet.txt>.
Be sure to say Y to "/proc file system support" and "Sysctl support"
below when using DECnet, since you will need sysctl support to aid
in configuration at run time.
The DECnet code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module is called decnet.
source "net/decnet/Kconfig"
config BRIDGE
tristate "802.1d Ethernet Bridging"
depends on INET
---help---
If you say Y here, then your Linux box will be able to act as an
Ethernet bridge, which means that the different Ethernet segments it
is connected to will appear as one Ethernet to the participants.
Several such bridges can work together to create even larger
networks of Ethernets using the IEEE 802.1 spanning tree algorithm.
As this is a standard, Linux bridges will cooperate properly with
other third party bridge products.
In order to use the Ethernet bridge, you'll need the bridge
configuration tools; see <file:Documentation/networking/bridge.txt>
for location. Please read the Bridge mini-HOWTO for more
information.
If you enable iptables support along with the bridge support then you
turn your bridge into a bridging firewall.
iptables will then see the IP packets being bridged, so you need to
take this into account when setting up your firewall rules.
If you want to compile this code as a module ( = code which can be
inserted in and removed from the running kernel whenever you want),
say M here and read <file:Documentation/modules.txt>. The module
will be called bridge.
If unsure, say N.
menuconfig NETFILTER
bool "Network packet filtering (replaces ipchains)"
---help---
Netfilter is a framework for filtering and mangling network packets
that pass through your Linux box.
The most common use of packet filtering is to run your Linux box as
a firewall protecting a local network from the Internet. The type of
firewall provided by this kernel support is called a "packet
filter", which means that it can reject individual network packets
based on type, source, destination etc. The other kind of firewall,
a "proxy-based" one, is more secure but more intrusive and more
bothersome to set up; it inspects the network traffic much more
closely, modifies it and has knowledge about the higher level
protocols, which a packet filter lacks. Moreover, proxy-based
firewalls often require changes to the programs running on the local
clients. Proxy-based firewalls don't need support by the kernel, but
they are often combined with a packet filter, which only works if
you say Y here.
You should also say Y here if you intend to use your Linux box as
the gateway to the Internet for a local network of machines without
globally valid IP addresses. This is called "masquerading": if one
of the computers on your local network wants to send something to
the outside, your box can "masquerade" as that computer, i.e. it
forwards the traffic to the intended outside destination, but
modifies the packets to make it look like they came from the
firewall box itself. It works both ways: if the outside host
replies, the Linux box will silently forward the traffic to the
correct local computer. This way, the computers on your local net
are completely invisible to the outside world, even though they can
reach the outside and can receive replies. It is even possible to
run globally visible servers from within a masqueraded local network
using a mechanism called portforwarding. Masquerading is also often
called NAT (Network Address Translation).
Another use of Netfilter is in transparent proxying: if a machine on
the local network tries to connect to an outside host, your Linux
box can transparently forward the traffic to a local server,
typically a caching proxy server.
Various modules exist for netfilter which replace the previous
masquerading (ipmasqadm), packet filtering (ipchains), transparent
proxying, and portforwarding mechanisms. Please see
<file:Documentation/Changes> under "iptables" for the location of
these packages.
Make sure to say N to "Fast switching" below if you intend to say Y
here, as Fast switching currently bypasses netfilter.
Chances are that you should say Y here if you compile a kernel which
will run as a router and N for regular hosts. If unsure, say N.
if NETFILTER
config NETFILTER_DEBUG
bool "Network packet filtering debugging"
depends on NETFILTER
help
You can say Y here if you want to get additional messages useful in
debugging the netfilter code.
source "net/ipv4/netfilter/Kconfig"
source "net/ipv6/netfilter/Kconfig"
source "net/decnet/netfilter/Kconfig"
source "net/bridge/netfilter/Kconfig"
endif
source "net/xfrm/Kconfig"
source "net/sctp/Kconfig"
......@@ -370,62 +433,6 @@ config ATALK
source "drivers/net/appletalk/Kconfig"
config DECNET
tristate "DECnet Support"
---help---
The DECnet networking protocol was used in many products made by
Digital (now Compaq). It provides reliable stream and sequenced
packet communications over which run a variety of services similar
to those which run over TCP/IP.
To find some tools to use with the kernel layer support, please
look at Patrick Caulfield's web site:
<http://linux.dreamtime.org/decnet/>.
More detailed documentation is available in
<file:Documentation/networking/decnet.txt>.
Be sure to say Y to "/proc file system support" and "Sysctl support"
below when using DECnet, since you will need sysctl support to aid
in configuration at run time.
The DECnet code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module is called decnet.
source "net/decnet/Kconfig"
config BRIDGE
tristate "802.1d Ethernet Bridging"
depends on INET
---help---
If you say Y here, then your Linux box will be able to act as an
Ethernet bridge, which means that the different Ethernet segments it
is connected to will appear as one Ethernet to the participants.
Several such bridges can work together to create even larger
networks of Ethernets using the IEEE 802.1 spanning tree algorithm.
As this is a standard, Linux bridges will cooperate properly with
other third party bridge products.
In order to use the Ethernet bridge, you'll need the bridge
configuration tools; see <file:Documentation/networking/bridge.txt>
for location. Please read the Bridge mini-HOWTO for more
information.
If you enable iptables support along with the bridge support then you
turn your bridge into a bridging firewall.
iptables will then see the IP packets being bridged, so you need to
take this into account when setting up your firewall rules.
If you want to compile this code as a module ( = code which can be
inserted in and removed from the running kernel whenever you want),
say M here and read <file:Documentation/modules.txt>. The module
will be called bridge.
If unsure, say N.
source "net/bridge/netfilter/Kconfig"
config X25
tristate "CCITT X.25 Packet Layer (EXPERIMENTAL)"
depends on EXPERIMENTAL
......
......@@ -10,7 +10,7 @@ obj-$(CONFIG_ATM_CLIP) += clip.o
atm-$(subst m,y,$(CONFIG_ATM_CLIP)) += ipcommon.o
obj-$(CONFIG_ATM_BR2684) += br2684.o
atm-$(subst m,y,$(CONFIG_ATM_BR2684)) += ipcommon.o
atm-$(subst m,y,$CONFIG_NET_SCH_ATM)) += ipcommon.o
atm-$(subst m,y,$(CONFIG_NET_SCH_ATM)) += ipcommon.o
atm-$(CONFIG_PROC_FS) += proc.o
obj-$(CONFIG_ATM_LANE) += lec.o
......
......@@ -71,8 +71,8 @@ static int check_ci(struct atm_vcc *vcc,short vpi,int vci)
int atm_find_ci(struct atm_vcc *vcc,short *vpi,int *vci)
{
static short p = 0; /* poor man's per-device cache */
static int c = 0;
static short p; /* poor man's per-device cache */
static int c;
short old_p;
int old_c;
int err;
......
......@@ -1379,8 +1379,8 @@ static void mpc_timer_refresh()
static void mpc_cache_check( unsigned long checking_time )
{
struct mpoa_client *mpc = mpcs;
static unsigned long previous_resolving_check_time = 0;
static unsigned long previous_refresh_time = 0;
static unsigned long previous_resolving_check_time;
static unsigned long previous_refresh_time;
while( mpc != NULL ){
mpc->in_ops->clear_count(mpc);
......
......@@ -39,7 +39,7 @@ static DECLARE_WAIT_QUEUE_HEAD(sigd_sleep);
static void sigd_put_skb(struct sk_buff *skb)
{
#ifdef WAIT_FOR_DEMON
static unsigned long silence = 0;
static unsigned long silence;
DECLARE_WAITQUEUE(wait,current);
add_wait_queue(&sigd_sleep,&wait);
......
......@@ -1779,7 +1779,7 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
/* old structure? */
if (cmd == SIOCAX25GETINFOOLD) {
static int warned = 0;
static int warned;
if (!warned) {
printk(KERN_INFO "%s uses old SIOCAX25GETINFO\n",
current->comm);
......
......@@ -12,20 +12,20 @@
#include <linux/spinlock.h>
#include <net/ax25.h>
static int min_ipdefmode[] = {0}, max_ipdefmode[] = {1};
static int min_axdefmode[] = {0}, max_axdefmode[] = {1};
static int min_backoff[] = {0}, max_backoff[] = {2};
static int min_conmode[] = {0}, max_conmode[] = {2};
static int min_ipdefmode[1], max_ipdefmode[] = {1};
static int min_axdefmode[1], max_axdefmode[] = {1};
static int min_backoff[1], max_backoff[] = {2};
static int min_conmode[1], max_conmode[] = {2};
static int min_window[] = {1}, max_window[] = {7};
static int min_ewindow[] = {1}, max_ewindow[] = {63};
static int min_t1[] = {1}, max_t1[] = {30 * HZ};
static int min_t2[] = {1}, max_t2[] = {20 * HZ};
static int min_t3[] = {0}, max_t3[] = {3600 * HZ};
static int min_idle[] = {0}, max_idle[] = {65535 * HZ};
static int min_t3[1], max_t3[] = {3600 * HZ};
static int min_idle[1], max_idle[] = {65535 * HZ};
static int min_n2[] = {1}, max_n2[] = {31};
static int min_paclen[] = {1}, max_paclen[] = {512};
static int min_proto[] = {0}, max_proto[] = {3};
static int min_ds_timeout[] = {0}, max_ds_timeout[] = {65535 * HZ};
static int min_proto[1], max_proto[] = {3};
static int min_ds_timeout[1], max_ds_timeout[] = {65535 * HZ};
static struct ctl_table_header *ax25_table_header;
......
......@@ -70,7 +70,7 @@ static struct rtable __fake_rtable = {
/* PF_BRIDGE/PRE_ROUTING *********************************************/
static void __br_dnat_complain(void)
{
static unsigned long last_complaint = 0;
static unsigned long last_complaint;
if (jiffies - last_complaint >= 5 * HZ) {
printk(KERN_WARNING "Performing cross-bridge DNAT requires IP "
......
......@@ -43,14 +43,17 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
{
case NETDEV_CHANGEADDR:
br_fdb_changeaddr(p, dev->dev_addr);
if (br->dev->flags & IFF_UP)
br_stp_recalculate_bridge_id(br);
break;
case NETDEV_DOWN:
if (br->dev->flags & IFF_UP)
br_stp_disable_port(p);
break;
case NETDEV_UP:
if (br->dev->flags & IFF_UP)
br_stp_enable_port(p);
break;
......
......@@ -138,7 +138,7 @@ static void br_stp_change_bridge_id(struct net_bridge *br, unsigned char *addr)
br_become_root_bridge(br);
}
static unsigned char br_mac_zero[6] = {0,0,0,0,0,0};
static unsigned char br_mac_zero[6];
/* called under bridge lock */
void br_stp_recalculate_bridge_id(struct net_bridge *br)
......
......@@ -557,6 +557,18 @@ void nf_reinject(struct sk_buff *skb, struct nf_info *info,
rcu_read_lock();
/* Release those devices we held, or Alexey will kill me. */
if (info->indev) dev_put(info->indev);
if (info->outdev) dev_put(info->outdev);
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
if (skb->nf_bridge) {
if (skb->nf_bridge->physindev)
dev_put(skb->nf_bridge->physindev);
if (skb->nf_bridge->physoutdev)
dev_put(skb->nf_bridge->physoutdev);
}
#endif
/* Drop reference to owner of hook which queued us. */
module_put(info->elem->owner);
......@@ -599,19 +611,6 @@ void nf_reinject(struct sk_buff *skb, struct nf_info *info,
}
rcu_read_unlock();
/* Release those devices we held, or Alexey will kill me. */
if (info->indev) dev_put(info->indev);
if (info->outdev) dev_put(info->outdev);
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
if (skb->nf_bridge) {
if (skb->nf_bridge->physindev)
dev_put(skb->nf_bridge->physindev);
if (skb->nf_bridge->physoutdev)
dev_put(skb->nf_bridge->physoutdev);
}
#endif
if (verdict == NF_DROP)
kfree_skb(skb);
......
......@@ -35,5 +35,3 @@ config DECNET_ROUTE_FWMARK
packets with different FWMARK ("firewalling mark") values
(see ipchains(8), "-m" argument).
source "net/decnet/netfilter/Kconfig"
......@@ -1472,7 +1472,7 @@ static struct rtnetlink_link dnet_rtnetlink_table[RTM_MAX-RTM_BASE+1] =
};
#ifdef MODULE
static int addr[2] = {0, 0};
static int addr[2];
MODULE_PARM(addr, "2i");
MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node");
......
......@@ -374,6 +374,5 @@ config INET_IPCOMP
If unsure, say Y.
source "net/ipv4/netfilter/Kconfig"
source "net/ipv4/ipvs/Kconfig"
......@@ -1100,6 +1100,7 @@ static void ip_encap(struct sk_buff *skb, u32 saddr, u32 daddr)
skb->h.ipiph = skb->nh.iph;
skb->nh.iph = iph;
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
#ifdef CONFIG_NETFILTER
nf_conntrack_put(skb->nfct);
skb->nfct = NULL;
......@@ -1108,12 +1109,14 @@ static void ip_encap(struct sk_buff *skb, u32 saddr, u32 daddr)
static inline int ipmr_forward_finish(struct sk_buff *skb)
{
struct dst_entry *dst = skb->dst;
struct ip_options * opt = &(IPCB(skb)->opt);
IP_INC_STATS_BH(IpForwDatagrams);
if (unlikely(opt->optlen))
ip_forward_options(skb);
if (skb->len <= dst_pmtu(dst))
return dst_output(skb);
else
return ip_fragment(skb, dst_output);
}
/*
......
......@@ -246,7 +246,7 @@ unsigned int arpt_do_table(struct sk_buff **pskb,
struct arpt_table *table,
void *userdata)
{
static const char nulldevname[IFNAMSIZ] = { 0 };
static const char nulldevname[IFNAMSIZ];
unsigned int verdict = NF_DROP;
struct arphdr *arp;
int hotdrop = 0;
......
......@@ -60,7 +60,7 @@ LIST_HEAD(ip_conntrack_expect_list);
LIST_HEAD(protocol_list);
static LIST_HEAD(helpers);
unsigned int ip_conntrack_htable_size = 0;
static int ip_conntrack_max = 0;
static int ip_conntrack_max;
static atomic_t ip_conntrack_count = ATOMIC_INIT(0);
struct list_head *ip_conntrack_hash;
static kmem_cache_t *ip_conntrack_cachep;
......@@ -618,7 +618,7 @@ init_conntrack(const struct ip_conntrack_tuple *tuple,
size_t hash;
struct ip_conntrack_expect *expected;
int i;
static unsigned int drop_next = 0;
static unsigned int drop_next;
if (!ip_conntrack_hash_rnd_initted) {
get_random_bytes(&ip_conntrack_hash_rnd, 4);
......@@ -1393,7 +1393,7 @@ void ip_conntrack_cleanup(void)
nf_unregister_sockopt(&so_getorigdst);
}
static int hashsize = 0;
static int hashsize;
MODULE_PARM(hashsize, "i");
int __init ip_conntrack_init(void)
......
......@@ -19,12 +19,12 @@ struct module *ip_conntrack_ftp = THIS_MODULE;
#define MAX_PORTS 8
static int ports[MAX_PORTS];
static int ports_c = 0;
static int ports_c;
#ifdef MODULE_PARM
MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i");
#endif
static int loose = 0;
static int loose;
MODULE_PARM(loose, "i");
#if 0
......
......@@ -35,7 +35,7 @@
#define MAX_PORTS 8
static int ports[MAX_PORTS];
static int ports_c = 0;
static int ports_c;
static int max_dcc_channels = 8;
static unsigned int dcc_timeout = 300;
/* This is slow, but it's simple. --RR */
......
......@@ -22,7 +22,7 @@ MODULE_LICENSE("GPL");
#define MAX_PORTS 8
static int ports[MAX_PORTS];
static int ports_c = 0;
static int ports_c;
#ifdef MODULE_PARM
MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i");
MODULE_PARM_DESC(ports, "port numbers of tftp servers");
......
......@@ -278,7 +278,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple,
struct ip_conntrack_tuple tuple;
} best = { NULL, 0xFFFFFFFF };
u_int32_t *var_ipp, *other_ipp, saved_ip, orig_dstip;
static unsigned int randomness = 0;
static unsigned int randomness;
if (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) {
var_ipp = &tuple->src.ip;
......
......@@ -18,7 +18,7 @@
#define MAX_PORTS 8
static int ports[MAX_PORTS];
static int ports_c = 0;
static int ports_c;
#ifdef MODULE_PARM
MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i");
......
......@@ -36,7 +36,7 @@
#define MAX_PORTS 8
static int ports[MAX_PORTS];
static int ports_c = 0;
static int ports_c;
MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
MODULE_DESCRIPTION("IRC (DCC) network address translation module");
......
......@@ -26,7 +26,7 @@ icmp_unique_tuple(struct ip_conntrack_tuple *tuple,
enum ip_nat_manip_type maniptype,
const struct ip_conntrack *conntrack)
{
static u_int16_t id = 0;
static u_int16_t id;
unsigned int range_size
= (unsigned int)range->max.icmp.id - range->min.icmp.id + 1;
unsigned int i;
......
......@@ -32,7 +32,7 @@ tcp_unique_tuple(struct ip_conntrack_tuple *tuple,
enum ip_nat_manip_type maniptype,
const struct ip_conntrack *conntrack)
{
static u_int16_t port = 0, *portptr;
static u_int16_t port, *portptr;
unsigned int range_size, min, i;
if (maniptype == IP_NAT_MANIP_SRC)
......
......@@ -33,7 +33,7 @@ udp_unique_tuple(struct ip_conntrack_tuple *tuple,
enum ip_nat_manip_type maniptype,
const struct ip_conntrack *conntrack)
{
static u_int16_t port = 0, *portptr;
static u_int16_t port, *portptr;
unsigned int range_size, min, i;
if (maniptype == IP_NAT_MANIP_SRC)
......
......@@ -62,7 +62,7 @@
#define SNMP_TRAP_PORT 162
#define NOCT1(n) (u_int8_t )((n) & 0xff)
static int debug = 0;
static int debug;
static spinlock_t snmp_lock = SPIN_LOCK_UNLOCKED;
/*
......
......@@ -256,7 +256,7 @@ ipt_do_table(struct sk_buff **pskb,
struct ipt_table *table,
void *userdata)
{
static const char nulldevname[IFNAMSIZ] = { 0 };
static const char nulldevname[IFNAMSIZ];
u_int16_t offset;
struct iphdr *ip;
u_int16_t datalen;
......
......@@ -2,16 +2,15 @@
* This is a module which is used for logging packets.
*/
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/spinlock.h>
#include <net/icmp.h>
#include <net/udp.h>
#include <net/tcp.h>
#include <linux/netfilter_ipv4/ip_tables.h>
struct in_device;
#include <net/route.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netfilter_ipv4/ipt_LOG.h>
#if 0
......@@ -20,10 +19,6 @@ struct in_device;
#define DEBUGP(format, args...)
#endif
struct esphdr {
__u32 spi;
}; /* FIXME evil kludge */
/* Use lock to serialize, so printks don't overlap */
static spinlock_t log_lock = SPIN_LOCK_UNLOCKED;
......@@ -256,13 +251,31 @@ static void dump_packet(const struct ipt_log_info *info,
break;
}
/* Max Length */
case IPPROTO_AH:
case IPPROTO_AH: {
struct ip_auth_hdr ah;
if (ntohs(iph.frag_off) & IP_OFFSET)
break;
/* Max length: 9 "PROTO=AH " */
printk("PROTO=AH ");
/* Max length: 25 "INCOMPLETE [65535 bytes] " */
if (skb_copy_bits(skb, iphoff+iph.ihl*4, &ah, sizeof(ah)) < 0) {
printk("INCOMPLETE [%u bytes] ",
skb->len - iphoff - iph.ihl*4);
break;
}
/* Length: 15 "SPI=0xF1234567 " */
printk("SPI=0x%x ", ntohl(ah.spi));
break;
}
case IPPROTO_ESP: {
struct esphdr esph;
int esp = (iph.protocol==IPPROTO_ESP);
struct ip_esp_hdr esph;
/* Max length: 10 "PROTO=ESP " */
printk("PROTO=%s ",esp? "ESP" : "AH");
printk("PROTO=ESP ");
if (ntohs(iph.frag_off) & IP_OFFSET)
break;
......
/* Kernel module to match AH parameters. */
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/netfilter_ipv4/ipt_ah.h>
#include <linux/netfilter_ipv4/ip_tables.h>
......@@ -13,10 +14,6 @@ MODULE_LICENSE("GPL");
#define duprintf(format, args...)
#endif
struct ahhdr {
__u32 spi;
};
/* Returns 1 if the spi is matched by the range, 0 otherwise */
static inline int
spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert)
......@@ -37,7 +34,7 @@ match(const struct sk_buff *skb,
int offset,
int *hotdrop)
{
struct ahhdr ah;
struct ip_auth_hdr ah;
const struct ipt_ah *ahinfo = matchinfo;
/* Must not be a fragment. */
......
/* Kernel module to match ESP parameters. */
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/netfilter_ipv4/ipt_esp.h>
#include <linux/netfilter_ipv4/ip_tables.h>
......@@ -13,10 +14,6 @@ MODULE_LICENSE("GPL");
#define duprintf(format, args...)
#endif
struct esphdr {
__u32 spi;
};
/* Returns 1 if the spi is matched by the range, 0 otherwise */
static inline int
spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert)
......@@ -37,7 +34,7 @@ match(const struct sk_buff *skb,
int offset,
int *hotdrop)
{
struct esphdr esp;
struct ip_esp_hdr esp;
const struct ipt_esp *espinfo = matchinfo;
/* Must not be a fragment. */
......
......@@ -17,7 +17,7 @@ match(const struct sk_buff *skb,
int *hotdrop)
{
int i;
static const char nulldevname[IFNAMSIZ] = { 0 };
static const char nulldevname[IFNAMSIZ];
const struct ipt_physdev_info *info = matchinfo;
unsigned long ret;
const char *indev, *outdev;
......
......@@ -63,4 +63,3 @@ config IPV6_TUNNEL
If unsure, say N.
source "net/ipv6/netfilter/Kconfig"
......@@ -65,7 +65,7 @@
#include <asm/system.h>
#if 0 /*def MODULE*/
static int unloadable = 0; /* XX: Turn to one when all is ok within the
static int unloadable; /* XX: Turn to one when all is ok within the
module for allowing unload */
MODULE_PARM(unloadable, "i");
#endif
......
......@@ -203,18 +203,24 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b
int hdr_len = skb->h.raw - skb->nh.raw;
int nfrags;
u8 ret_nexthdr = 0;
unsigned char *tmp_hdr = NULL;
int ret = 0;
if (!pskb_may_pull(skb, sizeof(struct ipv6_esp_hdr)))
goto out;
if (!pskb_may_pull(skb, sizeof(struct ipv6_esp_hdr))) {
ret = -EINVAL;
goto out_nofree;
}
if (elen <= 0 || (elen & (blksize-1)))
goto out;
if (elen <= 0 || (elen & (blksize-1))) {
ret = -EINVAL;
goto out_nofree;
}
tmp_hdr = kmalloc(hdr_len, GFP_ATOMIC);
if (!tmp_hdr)
goto out;
if (!tmp_hdr) {
ret = -ENOMEM;
goto out_nofree;
}
memcpy(tmp_hdr, skb->nh.raw, hdr_len);
/* If integrity check is required, do this. */
......@@ -229,12 +235,15 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b
if (unlikely(memcmp(sum, sum1, alen))) {
x->stats.integrity_failed++;
ret = -EINVAL;
goto out;
}
}
if ((nfrags = skb_cow_data(skb, 0, &trailer)) < 0)
if ((nfrags = skb_cow_data(skb, 0, &trailer)) < 0) {
ret = -EINVAL;
goto out;
}
skb->ip_summed = CHECKSUM_NONE;
......@@ -254,9 +263,11 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b
if (unlikely(nfrags > MAX_SG_ONSTACK)) {
sg = kmalloc(sizeof(struct scatterlist)*nfrags, GFP_ATOMIC);
if (!sg)
if (!sg) {
ret = -ENOMEM;
goto out;
}
}
skb_to_sgvec(skb, sg, sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen, elen);
crypto_cipher_decrypt(esp->conf.tfm, sg, sg, elen);
if (unlikely(sg != sgbuf))
......@@ -270,6 +281,7 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b
if (net_ratelimit()) {
printk(KERN_WARNING "ipsec esp packet is garbage padlen=%d, elen=%d\n", padlen+2, elen);
}
ret = -EINVAL;
goto out;
}
/* ... check padding bits here. Silly. :-) */
......@@ -280,13 +292,13 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b
memcpy(skb->nh.raw, tmp_hdr, hdr_len);
skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
ip6_find_1stfragopt(skb, &prevhdr);
ret_nexthdr = *prevhdr = nexthdr[1];
ret = *prevhdr = nexthdr[1];
}
kfree(tmp_hdr);
return ret_nexthdr;
out:
return -EINVAL;
kfree(tmp_hdr);
out_nofree:
return ret;
}
static u32 esp6_get_max_size(struct xfrm_state *x, int mtu)
......
......@@ -1243,6 +1243,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
dst_hold(&rt->u.dst);
np->cork.rt = rt;
np->cork.fl = fl;
np->cork.hop_limit = hlimit;
inet->cork.fragsize = mtu = dst_pmtu(&rt->u.dst);
inet->cork.length = 0;
inet->sndmsg_page = NULL;
......@@ -1465,7 +1466,7 @@ int ip6_push_pending_frames(struct sock *sk)
hdr->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
else
hdr->payload_len = 0;
hdr->hop_limit = np->hop_limit;
hdr->hop_limit = np->cork.hop_limit;
hdr->nexthdr = proto;
ipv6_addr_copy(&hdr->saddr, &fl->fl6_src);
ipv6_addr_copy(&hdr->daddr, final_dst);
......
......@@ -329,7 +329,7 @@ ip6t_do_table(struct sk_buff **pskb,
struct ip6t_table *table,
void *userdata)
{
static const char nulldevname[IFNAMSIZ] = { 0 };
static const char nulldevname[IFNAMSIZ];
u_int16_t offset = 0;
struct ipv6hdr *ipv6;
void *protohdr;
......
......@@ -68,7 +68,7 @@ static void *ckey;
static void *skey;
/* Module parameters */
static int eth = 0; /* Use "eth" or "irlan" name for devices */
static int eth; /* Use "eth" or "irlan" name for devices */
static int access = ACCESS_PEER; /* PEER, DIRECT or HOSTED */
#ifdef CONFIG_PROC_FS
......
......@@ -67,7 +67,7 @@ static int min_slot_timeout = 20;
static int max_max_baud_rate = 16000000; /* See qos.c - IrLAP spec */
static int min_max_baud_rate = 2400;
static int max_min_tx_turn_time = 10000; /* See qos.c - IrLAP spec */
static int min_min_tx_turn_time = 0;
static int min_min_tx_turn_time;
static int max_max_tx_data_size = 2048; /* See qos.c - IrLAP spec */
static int min_max_tx_data_size = 64;
static int max_max_tx_window = 7; /* See qos.c - IrLAP spec */
......
......@@ -15,9 +15,9 @@
/*
* Values taken from NET/ROM documentation.
*/
static int min_quality[] = {0}, max_quality[] = {255};
static int min_obs[] = {0}, max_obs[] = {255};
static int min_ttl[] = {0}, max_ttl[] = {255};
static int min_quality[1], max_quality[] = {255};
static int min_obs[1], max_obs[] = {255};
static int min_ttl[1], max_ttl[] = {255};
static int min_t1[] = {5 * HZ};
static int max_t1[] = {600 * HZ};
static int min_n2[] = {2}, max_n2[] = {127};
......@@ -28,7 +28,7 @@ static int max_t4[] = {1000 * HZ};
static int min_window[] = {1}, max_window[] = {127};
static int min_idle[] = {0 * HZ};
static int max_idle[] = {65535 * HZ};
static int min_route[] = {0}, max_route[] = {1};
static int min_route[1], max_route[] = {1};
static int min_fails[] = {1}, max_fails[] = {10};
static struct ctl_table_header *nr_table_header;
......
......@@ -514,20 +514,11 @@ EXPORT_SYMBOL(netlink_post);
#endif
EXPORT_SYMBOL(rtattr_parse);
EXPORT_SYMBOL(rtnetlink_links);
EXPORT_SYMBOL(__rta_fill);
EXPORT_SYMBOL(rtnetlink_dump_ifinfo);
EXPORT_SYMBOL(rtnetlink_put_metrics);
EXPORT_SYMBOL(rtnl);
EXPORT_SYMBOL(neigh_delete);
EXPORT_SYMBOL(neigh_add);
EXPORT_SYMBOL(neigh_dump_info);
EXPORT_SYMBOL(dev_set_allmulti);
EXPORT_SYMBOL(dev_set_promiscuity);
EXPORT_SYMBOL(rtnl_sem);
EXPORT_SYMBOL(rtnl_lock);
EXPORT_SYMBOL(rtnl_unlock);
/* ABI emulation layers need this */
EXPORT_SYMBOL(move_addr_to_kernel);
......@@ -535,7 +526,6 @@ EXPORT_SYMBOL(move_addr_to_user);
/* Used by at least ipip.c. */
EXPORT_SYMBOL(ipv4_config);
EXPORT_SYMBOL(dev_open);
/* Used by other modules */
EXPORT_SYMBOL(xrlim_allow);
......@@ -611,12 +601,23 @@ EXPORT_SYMBOL(netdev_fc_xoff);
#endif
EXPORT_SYMBOL(dev_base);
EXPORT_SYMBOL(dev_base_lock);
EXPORT_SYMBOL(dev_open);
EXPORT_SYMBOL(dev_close);
EXPORT_SYMBOL(dev_mc_add);
EXPORT_SYMBOL(dev_mc_delete);
EXPORT_SYMBOL(dev_mc_upload);
EXPORT_SYMBOL(dev_set_allmulti);
EXPORT_SYMBOL(dev_set_promiscuity);
EXPORT_SYMBOL(__kill_fasync);
EXPORT_SYMBOL(rtnl);
EXPORT_SYMBOL(rtnetlink_links);
EXPORT_SYMBOL(rtnetlink_dump_ifinfo);
EXPORT_SYMBOL(rtnetlink_put_metrics);
EXPORT_SYMBOL(rtnl_sem);
EXPORT_SYMBOL(rtnl_lock);
EXPORT_SYMBOL(rtnl_unlock);
#ifdef CONFIG_HIPPI
EXPORT_SYMBOL(hippi_type_trans);
#endif
......
......@@ -16,7 +16,7 @@ static int min_timer[] = {1 * HZ};
static int max_timer[] = {300 * HZ};
static int min_idle[] = {0 * HZ};
static int max_idle[] = {65535 * HZ};
static int min_route[] = {0}, max_route[] = {1};
static int min_route[1], max_route[] = {1};
static int min_ftimer[] = {60 * HZ};
static int max_ftimer[] = {600 * HZ};
static int min_maxvcs[] = {1}, max_maxvcs[] = {254};
......
......@@ -645,7 +645,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
if (flow->excess)
RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(u32),&flow->classid);
else {
static u32 zero = 0;
static u32 zero;
RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(zero),&zero);
}
......
......@@ -45,7 +45,7 @@ struct des_cred {
* Make sure we don't place more than one call to the key server at
* a time.
*/
static int in_keycall = 0;
static int in_keycall;
#define FAIL(err) \
{ if (data) put_cred(data); \
......@@ -202,7 +202,7 @@ svcauth_des(struct svc_rqst *rqstp, u32 *statp, u32 *authp)
static struct des_cred *
get_cred_byname(struct svc_rqst *rqstp, u32 *authp, char *fullname, u32 *cryptkey)
{
static int in_keycall = 0;
static int in_keycall;
struct des_cred *cred;
if (in_keycall) {
......
......@@ -579,8 +579,8 @@ xprt_complete_rqst(struct rpc_xprt *xprt, struct rpc_rqst *req, int copied)
#ifdef RPC_PROFILE
/* Profile only reads for now */
if (copied > 1024) {
static unsigned long nextstat = 0;
static unsigned long pkt_rtt = 0, pkt_len = 0, pkt_cnt = 0;
static unsigned long nextstat;
static unsigned long pkt_rtt, pkt_len, pkt_cnt;
pkt_cnt++;
pkt_len += req->rq_slen + copied;
......
......@@ -485,6 +485,7 @@ int xfrm_state_update(struct xfrm_state *x)
err = -EINVAL;
spin_lock_bh(&x1->lock);
if (likely(x1->km.state == XFRM_STATE_VALID)) {
if (x->encap && x1->encap)
memcpy(x1->encap, x->encap, sizeof(*x1->encap));
memcpy(&x1->lft, &x->lft, sizeof(x1->lft));
x1->km.dying = 0;
......
......@@ -459,8 +459,8 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, void **
if (err)
goto out_noput;
x = xfrm_find_acq(p->info.mode, p->info.reqid, p->info.id.proto,
&p->info.sel.daddr,
&p->info.sel.saddr, 1,
&p->info.id.daddr,
&p->info.saddr, 1,
p->info.family);
err = -ENOENT;
if (x == NULL)
......@@ -937,7 +937,7 @@ static int xfrm_user_rcv_skb(struct sk_buff *skb)
rlen = NLMSG_ALIGN(nlh->nlmsg_len);
if (rlen > skb->len)
rlen = skb->len;
if (xfrm_user_rcv_msg(skb, nlh, &err)) {
if (xfrm_user_rcv_msg(skb, nlh, &err) < 0) {
if (err == 0)
return -1;
netlink_ack(skb, nlh, err);
......
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