aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/networking/xfrm_sync.txt166
-rw-r--r--drivers/net/irda/irda-usb.c6
-rw-r--r--drivers/net/irda/smsc-ircc2.c316
-rw-r--r--include/net/arp.h2
-rw-r--r--include/net/xfrm.h8
-rw-r--r--net/atm/clip.c460
-rw-r--r--net/ipv4/arp.c4
-rw-r--r--net/ipv4/devinet.c1
-rw-r--r--net/ipv4/fib_frontend.c1
-rw-r--r--net/ipv4/inet_hashtables.c4
-rw-r--r--net/ipv4/ip_output.c2
-rw-r--r--net/ipv4/tcp_input.c1
-rw-r--r--net/ipv4/tcp_ipv4.c1
-rw-r--r--net/ipv4/tcp_output.c3
-rw-r--r--net/xfrm/xfrm_state.c25
15 files changed, 682 insertions, 318 deletions
diff --git a/Documentation/networking/xfrm_sync.txt b/Documentation/networking/xfrm_sync.txt
new file mode 100644
index 000000000000..8be626f7c0b8
--- /dev/null
+++ b/Documentation/networking/xfrm_sync.txt
@@ -0,0 +1,166 @@
1
2The sync patches work is based on initial patches from
3Krisztian <hidden@balabit.hu> and others and additional patches
4from Jamal <hadi@cyberus.ca>.
5
6The end goal for syncing is to be able to insert attributes + generate
7events so that the an SA can be safely moved from one machine to another
8for HA purposes.
9The idea is to synchronize the SA so that the takeover machine can do
10the processing of the SA as accurate as possible if it has access to it.
11
12We already have the ability to generate SA add/del/upd events.
13These patches add ability to sync and have accurate lifetime byte (to
14ensure proper decay of SAs) and replay counters to avoid replay attacks
15with as minimal loss at failover time.
16This way a backup stays as closely uptodate as an active member.
17
18Because the above items change for every packet the SA receives,
19it is possible for a lot of the events to be generated.
20For this reason, we also add a nagle-like algorithm to restrict
21the events. i.e we are going to set thresholds to say "let me
22know if the replay sequence threshold is reached or 10 secs have passed"
23These thresholds are set system-wide via sysctls or can be updated
24per SA.
25
26The identified items that need to be synchronized are:
27- the lifetime byte counter
28note that: lifetime time limit is not important if you assume the failover
29machine is known ahead of time since the decay of the time countdown
30is not driven by packet arrival.
31- the replay sequence for both inbound and outbound
32
331) Message Structure
34----------------------
35
36nlmsghdr:aevent_id:optional-TLVs.
37
38The netlink message types are:
39
40XFRM_MSG_NEWAE and XFRM_MSG_GETAE.
41
42A XFRM_MSG_GETAE does not have TLVs.
43A XFRM_MSG_NEWAE will have at least two TLVs (as is
44discussed further below).
45
46aevent_id structure looks like:
47
48 struct xfrm_aevent_id {
49 struct xfrm_usersa_id sa_id;
50 __u32 flags;
51 };
52
53xfrm_usersa_id in this message layout identifies the SA.
54
55flags are used to indicate different things. The possible
56flags are:
57 XFRM_AE_RTHR=1, /* replay threshold*/
58 XFRM_AE_RVAL=2, /* replay value */
59 XFRM_AE_LVAL=4, /* lifetime value */
60 XFRM_AE_ETHR=8, /* expiry timer threshold */
61 XFRM_AE_CR=16, /* Event cause is replay update */
62 XFRM_AE_CE=32, /* Event cause is timer expiry */
63 XFRM_AE_CU=64, /* Event cause is policy update */
64
65How these flags are used is dependent on the direction of the
66message (kernel<->user) as well the cause (config, query or event).
67This is described below in the different messages.
68
69The pid will be set appropriately in netlink to recognize direction
70(0 to the kernel and pid = processid that created the event
71when going from kernel to user space)
72
73A program needs to subscribe to multicast group XFRMNLGRP_AEVENTS
74to get notified of these events.
75
762) TLVS reflect the different parameters:
77-----------------------------------------
78
79a) byte value (XFRMA_LTIME_VAL)
80This TLV carries the running/current counter for byte lifetime since
81last event.
82
83b)replay value (XFRMA_REPLAY_VAL)
84This TLV carries the running/current counter for replay sequence since
85last event.
86
87c)replay threshold (XFRMA_REPLAY_THRESH)
88This TLV carries the threshold being used by the kernel to trigger events
89when the replay sequence is exceeded.
90
91d) expiry timer (XFRMA_ETIMER_THRESH)
92This is a timer value in milliseconds which is used as the nagle
93value to rate limit the events.
94
953) Default configurations for the parameters:
96----------------------------------------------
97
98By default these events should be turned off unless there is
99at least one listener registered to listen to the multicast
100group XFRMNLGRP_AEVENTS.
101
102Programs installing SAs will need to specify the two thresholds, however,
103in order to not change existing applications such as racoon
104we also provide default threshold values for these different parameters
105in case they are not specified.
106
107the two sysctls/proc entries are:
108a) /proc/sys/net/core/sysctl_xfrm_aevent_etime
109used to provide default values for the XFRMA_ETIMER_THRESH in incremental
110units of time of 100ms. The default is 10 (1 second)
111
112b) /proc/sys/net/core/sysctl_xfrm_aevent_rseqth
113used to provide default values for XFRMA_REPLAY_THRESH parameter
114in incremental packet count. The default is two packets.
115
1164) Message types
117----------------
118
119a) XFRM_MSG_GETAE issued by user-->kernel.
120XFRM_MSG_GETAE does not carry any TLVs.
121The response is a XFRM_MSG_NEWAE which is formatted based on what
122XFRM_MSG_GETAE queried for.
123The response will always have XFRMA_LTIME_VAL and XFRMA_REPLAY_VAL TLVs.
124*if XFRM_AE_RTHR flag is set, then XFRMA_REPLAY_THRESH is also retrieved
125*if XFRM_AE_ETHR flag is set, then XFRMA_ETIMER_THRESH is also retrieved
126
127b) XFRM_MSG_NEWAE is issued by either user space to configure
128or kernel to announce events or respond to a XFRM_MSG_GETAE.
129
130i) user --> kernel to configure a specific SA.
131any of the values or threshold parameters can be updated by passing the
132appropriate TLV.
133A response is issued back to the sender in user space to indicate success
134or failure.
135In the case of success, additionally an event with
136XFRM_MSG_NEWAE is also issued to any listeners as described in iii).
137
138ii) kernel->user direction as a response to XFRM_MSG_GETAE
139The response will always have XFRMA_LTIME_VAL and XFRMA_REPLAY_VAL TLVs.
140The threshold TLVs will be included if explicitly requested in
141the XFRM_MSG_GETAE message.
142
143iii) kernel->user to report as event if someone sets any values or
144thresholds for an SA using XFRM_MSG_NEWAE (as described in #i above).
145In such a case XFRM_AE_CU flag is set to inform the user that
146the change happened as a result of an update.
147The message will always have XFRMA_LTIME_VAL and XFRMA_REPLAY_VAL TLVs.
148
149iv) kernel->user to report event when replay threshold or a timeout
150is exceeded.
151In such a case either XFRM_AE_CR (replay exceeded) or XFRM_AE_CE (timeout
152happened) is set to inform the user what happened.
153Note the two flags are mutually exclusive.
154The message will always have XFRMA_LTIME_VAL and XFRMA_REPLAY_VAL TLVs.
155
156Exceptions to threshold settings
157--------------------------------
158
159If you have an SA that is getting hit by traffic in bursts such that
160there is a period where the timer threshold expires with no packets
161seen, then an odd behavior is seen as follows:
162The first packet arrival after a timer expiry will trigger a timeout
163aevent; i.e we dont wait for a timeout period or a packet threshold
164to be reached. This is done for simplicity and efficiency reasons.
165
166-JHS
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 606243d11793..96bdb73c2283 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1815,14 +1815,14 @@ static int irda_usb_probe(struct usb_interface *intf,
1815 self->needspatch = (ret < 0); 1815 self->needspatch = (ret < 0);
1816 if (ret < 0) { 1816 if (ret < 0) {
1817 printk("patch_device failed\n"); 1817 printk("patch_device failed\n");
1818 goto err_out_4; 1818 goto err_out_5;
1819 } 1819 }
1820 1820
1821 /* replace IrDA class descriptor with what patched device is now reporting */ 1821 /* replace IrDA class descriptor with what patched device is now reporting */
1822 irda_desc = irda_usb_find_class_desc (self->usbintf); 1822 irda_desc = irda_usb_find_class_desc (self->usbintf);
1823 if (irda_desc == NULL) { 1823 if (irda_desc == NULL) {
1824 ret = -ENODEV; 1824 ret = -ENODEV;
1825 goto err_out_4; 1825 goto err_out_5;
1826 } 1826 }
1827 if (self->irda_desc) 1827 if (self->irda_desc)
1828 kfree (self->irda_desc); 1828 kfree (self->irda_desc);
@@ -1832,6 +1832,8 @@ static int irda_usb_probe(struct usb_interface *intf,
1832 1832
1833 return 0; 1833 return 0;
1834 1834
1835err_out_5:
1836 unregister_netdev(self->netdev);
1835err_out_4: 1837err_out_4:
1836 kfree(self->speed_buff); 1838 kfree(self->speed_buff);
1837err_out_3: 1839err_out_3:
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index bbcfc8ec35a1..58f76cefbc83 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -225,6 +225,8 @@ static int __init smsc_superio_lpc(unsigned short cfg_base);
225#ifdef CONFIG_PCI 225#ifdef CONFIG_PCI
226static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf); 226static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf);
227static int __init preconfigure_through_82801(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); 227static int __init preconfigure_through_82801(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf);
228static void __init preconfigure_ali_port(struct pci_dev *dev,
229 unsigned short port);
228static int __init preconfigure_through_ali(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); 230static int __init preconfigure_through_ali(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf);
229static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, 231static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg,
230 unsigned short ircc_fir, 232 unsigned short ircc_fir,
@@ -2327,9 +2329,14 @@ static int __init smsc_superio_lpc(unsigned short cfg_base)
2327 * pre-configuration not properly done by the BIOS (especially laptops) 2329 * pre-configuration not properly done by the BIOS (especially laptops)
2328 * This code is based in part on smcinit.c, tosh1800-smcinit.c 2330 * This code is based in part on smcinit.c, tosh1800-smcinit.c
2329 * and tosh2450-smcinit.c. The table lists the device entries 2331 * and tosh2450-smcinit.c. The table lists the device entries
2330 * for ISA bridges with an LPC (Local Peripheral Configurator) 2332 * for ISA bridges with an LPC (Low Pin Count) controller which
2331 * that are in turn used to configure the SMSC device with default 2333 * handles the communication with the SMSC device. After the LPC
2332 * SIR and FIR I/O ports, DMA and IRQ. 2334 * controller is initialized through PCI, the SMSC device is initialized
2335 * through a dedicated port in the ISA port-mapped I/O area, this latter
2336 * area is used to configure the SMSC device with default
2337 * SIR and FIR I/O ports, DMA and IRQ. Different vendors have
2338 * used different sets of parameters and different control port
2339 * addresses making a subsystem device table necessary.
2333 */ 2340 */
2334#ifdef CONFIG_PCI 2341#ifdef CONFIG_PCI
2335#define PCIID_VENDOR_INTEL 0x8086 2342#define PCIID_VENDOR_INTEL 0x8086
@@ -2340,9 +2347,10 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __dev
2340 .device = 0x24cc, 2347 .device = 0x24cc,
2341 .subvendor = 0x103c, 2348 .subvendor = 0x103c,
2342 .subdevice = 0x088c, 2349 .subdevice = 0x088c,
2343 .sir_io = 0x02f8, /* Quite certain these are the same for nc8000 as for nc6000 */ 2350 /* Quite certain these are the same for nc8000 as for nc6000 */
2351 .sir_io = 0x02f8,
2344 .fir_io = 0x0130, 2352 .fir_io = 0x0130,
2345 .fir_irq = 0x09, 2353 .fir_irq = 0x05,
2346 .fir_dma = 0x03, 2354 .fir_dma = 0x03,
2347 .cfg_base = 0x004e, 2355 .cfg_base = 0x004e,
2348 .preconfigure = preconfigure_through_82801, 2356 .preconfigure = preconfigure_through_82801,
@@ -2355,60 +2363,79 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __dev
2355 .subdevice = 0x0890, 2363 .subdevice = 0x0890,
2356 .sir_io = 0x02f8, 2364 .sir_io = 0x02f8,
2357 .fir_io = 0x0130, 2365 .fir_io = 0x0130,
2358 .fir_irq = 0x09, 2366 .fir_irq = 0x05,
2359 .fir_dma = 0x03, 2367 .fir_dma = 0x03,
2360 .cfg_base = 0x004e, 2368 .cfg_base = 0x004e,
2361 .preconfigure = preconfigure_through_82801, 2369 .preconfigure = preconfigure_through_82801,
2362 .name = "HP nc6000", 2370 .name = "HP nc6000",
2363 }, 2371 },
2364 { 2372 {
2365 .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge */ 2373 /* Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge */
2374 .vendor = PCIID_VENDOR_INTEL,
2366 .device = 0x24c0, 2375 .device = 0x24c0,
2367 .subvendor = 0x1179, 2376 .subvendor = 0x1179,
2368 .subdevice = 0xffff, /* 0xffff is "any", Not sure, 0x0001 or 0x0002 */ 2377 .subdevice = 0xffff, /* 0xffff is "any" */
2369 .sir_io = 0x03f8, 2378 .sir_io = 0x03f8,
2370 .fir_io = 0x0130, 2379 .fir_io = 0x0130,
2371 .fir_irq = 0x07, 2380 .fir_irq = 0x07,
2372 .fir_dma = 0x01, 2381 .fir_dma = 0x01,
2373 .cfg_base = 0x002e, 2382 .cfg_base = 0x002e,
2374 .preconfigure = preconfigure_through_82801, 2383 .preconfigure = preconfigure_through_82801,
2375 .name = "Toshiba Satellite 2450", 2384 .name = "Toshiba laptop with Intel 82801DB/DBL LPC bridge",
2376 }, 2385 },
2377 { 2386 {
2378 .vendor = PCIID_VENDOR_INTEL, /* Intel 82801CAM ISA bridge */ 2387 .vendor = PCIID_VENDOR_INTEL, /* Intel 82801CAM ISA bridge */
2379 .device = 0x248c, /* Some use 24cc? */ 2388 .device = 0x248c,
2380 .subvendor = 0x1179, 2389 .subvendor = 0x1179,
2381 .subdevice = 0xffff, /* 0xffff is "any", Not sure, 0x0001 or 0x0002 */ 2390 .subdevice = 0xffff, /* 0xffff is "any" */
2382 .sir_io = 0x03f8, 2391 .sir_io = 0x03f8,
2383 .fir_io = 0x0130, 2392 .fir_io = 0x0130,
2384 .fir_irq = 0x03, 2393 .fir_irq = 0x03,
2385 .fir_dma = 0x03, 2394 .fir_dma = 0x03,
2386 .cfg_base = 0x002e, 2395 .cfg_base = 0x002e,
2387 .preconfigure = preconfigure_through_82801, 2396 .preconfigure = preconfigure_through_82801,
2388 .name = "Toshiba Satellite 5100/5200, Tecra 9100", 2397 .name = "Toshiba laptop with Intel 82801CAM ISA bridge",
2389 }, 2398 },
2390 { 2399 {
2391 .vendor = PCIID_VENDOR_ALI, /* ALi M1533/M1535 PCI to ISA Bridge [Aladdin IV/V/V+] */ 2400 /* 82801DBM (ICH4-M) LPC Interface Bridge */
2401 .vendor = PCIID_VENDOR_INTEL,
2402 .device = 0x24cc,
2403 .subvendor = 0x1179,
2404 .subdevice = 0xffff, /* 0xffff is "any" */
2405 .sir_io = 0x03f8,
2406 .fir_io = 0x0130,
2407 .fir_irq = 0x03,
2408 .fir_dma = 0x03,
2409 .cfg_base = 0x002e,
2410 .preconfigure = preconfigure_through_82801,
2411 .name = "Toshiba laptop with Intel 8281DBM LPC bridge",
2412 },
2413 {
2414 /* ALi M1533/M1535 PCI to ISA Bridge [Aladdin IV/V/V+] */
2415 .vendor = PCIID_VENDOR_ALI,
2392 .device = 0x1533, 2416 .device = 0x1533,
2393 .subvendor = 0x1179, 2417 .subvendor = 0x1179,
2394 .subdevice = 0xffff, /* 0xffff is "any", Not sure, 0x0001 or 0x0002 */ 2418 .subdevice = 0xffff, /* 0xffff is "any" */
2395 .sir_io = 0x02e8, 2419 .sir_io = 0x02e8,
2396 .fir_io = 0x02f8, 2420 .fir_io = 0x02f8,
2397 .fir_irq = 0x07, 2421 .fir_irq = 0x07,
2398 .fir_dma = 0x03, 2422 .fir_dma = 0x03,
2399 .cfg_base = 0x002e, 2423 .cfg_base = 0x002e,
2400 .preconfigure = preconfigure_through_ali, 2424 .preconfigure = preconfigure_through_ali,
2401 .name = "Toshiba Satellite 1800", 2425 .name = "Toshiba laptop with ALi ISA bridge",
2402 }, 2426 },
2403 { } // Terminator 2427 { } // Terminator
2404}; 2428};
2405 2429
2406 2430
2407/* 2431/*
2408 * This sets up the basic SMSC parameters (FIR port, SIR port, FIR DMA, FIR IRQ) 2432 * This sets up the basic SMSC parameters
2433 * (FIR port, SIR port, FIR DMA, FIR IRQ)
2409 * through the chip configuration port. 2434 * through the chip configuration port.
2410 */ 2435 */
2411static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf) 2436static int __init preconfigure_smsc_chip(struct
2437 smsc_ircc_subsystem_configuration
2438 *conf)
2412{ 2439{
2413 unsigned short iobase = conf->cfg_base; 2440 unsigned short iobase = conf->cfg_base;
2414 unsigned char tmpbyte; 2441 unsigned char tmpbyte;
@@ -2416,7 +2443,9 @@ static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuratio
2416 outb(LPC47N227_CFGACCESSKEY, iobase); // enter configuration state 2443 outb(LPC47N227_CFGACCESSKEY, iobase); // enter configuration state
2417 outb(SMSCSIOFLAT_DEVICEID_REG, iobase); // set for device ID 2444 outb(SMSCSIOFLAT_DEVICEID_REG, iobase); // set for device ID
2418 tmpbyte = inb(iobase +1); // Read device ID 2445 tmpbyte = inb(iobase +1); // Read device ID
2419 IRDA_DEBUG(0, "Detected Chip id: 0x%02x, setting up registers...\n",tmpbyte); 2446 IRDA_DEBUG(0,
2447 "Detected Chip id: 0x%02x, setting up registers...\n",
2448 tmpbyte);
2420 2449
2421 /* Disable UART1 and set up SIR I/O port */ 2450 /* Disable UART1 and set up SIR I/O port */
2422 outb(0x24, iobase); // select CR24 - UART1 base addr 2451 outb(0x24, iobase); // select CR24 - UART1 base addr
@@ -2426,6 +2455,7 @@ static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuratio
2426 tmpbyte = inb(iobase + 1); 2455 tmpbyte = inb(iobase + 1);
2427 if (tmpbyte != (conf->sir_io >> 2) ) { 2456 if (tmpbyte != (conf->sir_io >> 2) ) {
2428 IRDA_WARNING("ERROR: could not configure SIR ioport.\n"); 2457 IRDA_WARNING("ERROR: could not configure SIR ioport.\n");
2458 IRDA_WARNING("Try to supply ircc_cfg argument.\n");
2429 return -ENXIO; 2459 return -ENXIO;
2430 } 2460 }
2431 2461
@@ -2461,7 +2491,8 @@ static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuratio
2461 2491
2462 outb(SMSCSIOFLAT_UARTMODE0C_REG, iobase); // CR0C - UART mode 2492 outb(SMSCSIOFLAT_UARTMODE0C_REG, iobase); // CR0C - UART mode
2463 tmpbyte = inb(iobase + 1); 2493 tmpbyte = inb(iobase + 1);
2464 tmpbyte &= ~SMSCSIOFLAT_UART2MODE_MASK | SMSCSIOFLAT_UART2MODE_VAL_IRDA; 2494 tmpbyte &= ~SMSCSIOFLAT_UART2MODE_MASK |
2495 SMSCSIOFLAT_UART2MODE_VAL_IRDA;
2465 outb(tmpbyte, iobase + 1); // enable IrDA (HPSIR) mode, high speed 2496 outb(tmpbyte, iobase + 1); // enable IrDA (HPSIR) mode, high speed
2466 2497
2467 outb(LPC47N227_APMBOOTDRIVE_REG, iobase); // CR07 - Auto Pwr Mgt/boot drive sel 2498 outb(LPC47N227_APMBOOTDRIVE_REG, iobase); // CR07 - Auto Pwr Mgt/boot drive sel
@@ -2486,53 +2517,226 @@ static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuratio
2486 return 0; 2517 return 0;
2487} 2518}
2488 2519
2489/* 82801CAM registers */ 2520/* 82801CAM generic registers */
2490#define VID 0x00 2521#define VID 0x00
2491#define DID 0x02 2522#define DID 0x02
2492#define PIRQA_ROUT 0x60 2523#define PIRQ_A_D_ROUT 0x60
2524#define SIRQ_CNTL 0x64
2525#define PIRQ_E_H_ROUT 0x68
2493#define PCI_DMA_C 0x90 2526#define PCI_DMA_C 0x90
2527/* LPC-specific registers */
2494#define COM_DEC 0xe0 2528#define COM_DEC 0xe0
2529#define GEN1_DEC 0xe4
2495#define LPC_EN 0xe6 2530#define LPC_EN 0xe6
2496#define GEN2_DEC 0xec 2531#define GEN2_DEC 0xec
2497/* 2532/*
2498 * Sets up the I/O range using the 82801CAM ISA bridge, 82801DBM LPC bridge or 2533 * Sets up the I/O range using the 82801CAM ISA bridge, 82801DBM LPC bridge
2499 * Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge. They all work the same way! 2534 * or Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge.
2535 * They all work the same way!
2500 */ 2536 */
2501static int __init preconfigure_through_82801(struct pci_dev *dev, 2537static int __init preconfigure_through_82801(struct pci_dev *dev,
2502 struct smsc_ircc_subsystem_configuration *conf) 2538 struct
2539 smsc_ircc_subsystem_configuration
2540 *conf)
2503{ 2541{
2504 unsigned short tmpword; 2542 unsigned short tmpword;
2505 int ret; 2543 unsigned char tmpbyte;
2506 2544
2507 IRDA_MESSAGE("Setting up the SMSC device via the 82801 controller.\n"); 2545 IRDA_MESSAGE("Setting up Intel 82801 controller and SMSC device\n");
2508 pci_write_config_byte(dev, COM_DEC, 0x10); 2546 /*
2547 * Select the range for the COMA COM port (SIR)
2548 * Register COM_DEC:
2549 * Bit 7: reserved
2550 * Bit 6-4, COMB decode range
2551 * Bit 3: reserved
2552 * Bit 2-0, COMA decode range
2553 *
2554 * Decode ranges:
2555 * 000 = 0x3f8-0x3ff (COM1)
2556 * 001 = 0x2f8-0x2ff (COM2)
2557 * 010 = 0x220-0x227
2558 * 011 = 0x228-0x22f
2559 * 100 = 0x238-0x23f
2560 * 101 = 0x2e8-0x2ef (COM4)
2561 * 110 = 0x338-0x33f
2562 * 111 = 0x3e8-0x3ef (COM3)
2563 */
2564 pci_read_config_byte(dev, COM_DEC, &tmpbyte);
2565 tmpbyte &= 0xf8; /* mask COMA bits */
2566 switch(conf->sir_io) {
2567 case 0x3f8:
2568 tmpbyte |= 0x00;
2569 break;
2570 case 0x2f8:
2571 tmpbyte |= 0x01;
2572 break;
2573 case 0x220:
2574 tmpbyte |= 0x02;
2575 break;
2576 case 0x228:
2577 tmpbyte |= 0x03;
2578 break;
2579 case 0x238:
2580 tmpbyte |= 0x04;
2581 break;
2582 case 0x2e8:
2583 tmpbyte |= 0x05;
2584 break;
2585 case 0x338:
2586 tmpbyte |= 0x06;
2587 break;
2588 case 0x3e8:
2589 tmpbyte |= 0x07;
2590 break;
2591 default:
2592 tmpbyte |= 0x01; /* COM2 default */
2593 }
2594 IRDA_DEBUG(1, "COM_DEC (write): 0x%02x\n", tmpbyte);
2595 pci_write_config_byte(dev, COM_DEC, tmpbyte);
2509 2596
2510 /* Enable LPC */ 2597 /* Enable Low Pin Count interface */
2511 pci_read_config_word(dev, LPC_EN, &tmpword); /* LPC_EN register */ 2598 pci_read_config_word(dev, LPC_EN, &tmpword);
2512 tmpword &= 0xfffd; /* mask bit 1 */ 2599 /* These seem to be set up at all times,
2513 tmpword |= 0x0001; /* set bit 0 : COMA addr range enable */ 2600 * just make sure it is properly set.
2601 */
2602 switch(conf->cfg_base) {
2603 case 0x04e:
2604 tmpword |= 0x2000;
2605 break;
2606 case 0x02e:
2607 tmpword |= 0x1000;
2608 break;
2609 case 0x062:
2610 tmpword |= 0x0800;
2611 break;
2612 case 0x060:
2613 tmpword |= 0x0400;
2614 break;
2615 default:
2616 IRDA_WARNING("Uncommon I/O base address: 0x%04x\n",
2617 conf->cfg_base);
2618 break;
2619 }
2620 tmpword &= 0xfffd; /* disable LPC COMB */
2621 tmpword |= 0x0001; /* set bit 0 : enable LPC COMA addr range (GEN2) */
2622 IRDA_DEBUG(1, "LPC_EN (write): 0x%04x\n", tmpword);
2514 pci_write_config_word(dev, LPC_EN, tmpword); 2623 pci_write_config_word(dev, LPC_EN, tmpword);
2515 2624
2516 /* Setup DMA */ 2625 /*
2517 pci_write_config_word(dev, PCI_DMA_C, 0xc0c0); /* LPC I/F DMA on, channel 3 -- rtm (?? PCI DMA ?) */ 2626 * Configure LPC DMA channel
2518 pci_write_config_word(dev, GEN2_DEC, 0x131); /* LPC I/F 2nd decode range */ 2627 * PCI_DMA_C bits:
2628 * Bit 15-14: DMA channel 7 select
2629 * Bit 13-12: DMA channel 6 select
2630 * Bit 11-10: DMA channel 5 select
2631 * Bit 9-8: Reserved
2632 * Bit 7-6: DMA channel 3 select
2633 * Bit 5-4: DMA channel 2 select
2634 * Bit 3-2: DMA channel 1 select
2635 * Bit 1-0: DMA channel 0 select
2636 * 00 = Reserved value
2637 * 01 = PC/PCI DMA
2638 * 10 = Reserved value
2639 * 11 = LPC I/F DMA
2640 */
2641 pci_read_config_word(dev, PCI_DMA_C, &tmpword);
2642 switch(conf->fir_dma) {
2643 case 0x07:
2644 tmpword |= 0xc000;
2645 break;
2646 case 0x06:
2647 tmpword |= 0x3000;
2648 break;
2649 case 0x05:
2650 tmpword |= 0x0c00;
2651 break;
2652 case 0x03:
2653 tmpword |= 0x00c0;
2654 break;
2655 case 0x02:
2656 tmpword |= 0x0030;
2657 break;
2658 case 0x01:
2659 tmpword |= 0x000c;
2660 break;
2661 case 0x00:
2662 tmpword |= 0x0003;
2663 break;
2664 default:
2665 break; /* do not change settings */
2666 }
2667 IRDA_DEBUG(1, "PCI_DMA_C (write): 0x%04x\n", tmpword);
2668 pci_write_config_word(dev, PCI_DMA_C, tmpword);
2669
2670 /*
2671 * GEN2_DEC bits:
2672 * Bit 15-4: Generic I/O range
2673 * Bit 3-1: reserved (read as 0)
2674 * Bit 0: enable GEN2 range on LPC I/F
2675 */
2676 tmpword = conf->fir_io & 0xfff8;
2677 tmpword |= 0x0001;
2678 IRDA_DEBUG(1, "GEN2_DEC (write): 0x%04x\n", tmpword);
2679 pci_write_config_word(dev, GEN2_DEC, tmpword);
2519 2680
2520 /* Pre-configure chip */ 2681 /* Pre-configure chip */
2521 ret = preconfigure_smsc_chip(conf); 2682 return preconfigure_smsc_chip(conf);
2683}
2522 2684
2523 /* Disable LPC */ 2685/*
2524 pci_read_config_word(dev, LPC_EN, &tmpword); /* LPC_EN register */ 2686 * Pre-configure a certain port on the ALi 1533 bridge.
2525 tmpword &= 0xfffc; /* mask bit 1 and bit 0, COMA addr range disable */ 2687 * This is based on reverse-engineering since ALi does not
2526 pci_write_config_word(dev, LPC_EN, tmpword); 2688 * provide any data sheet for the 1533 chip.
2527 return ret; 2689 */
2690static void __init preconfigure_ali_port(struct pci_dev *dev,
2691 unsigned short port)
2692{
2693 unsigned char reg;
2694 /* These bits obviously control the different ports */
2695 unsigned char mask;
2696 unsigned char tmpbyte;
2697
2698 switch(port) {
2699 case 0x0130:
2700 case 0x0178:
2701 reg = 0xb0;
2702 mask = 0x80;
2703 break;
2704 case 0x03f8:
2705 reg = 0xb4;
2706 mask = 0x80;
2707 break;
2708 case 0x02f8:
2709 reg = 0xb4;
2710 mask = 0x30;
2711 break;
2712 case 0x02e8:
2713 reg = 0xb4;
2714 mask = 0x08;
2715 break;
2716 default:
2717 IRDA_ERROR("Failed to configure unsupported port on ALi 1533 bridge: 0x%04x\n", port);
2718 return;
2719 }
2720
2721 pci_read_config_byte(dev, reg, &tmpbyte);
2722 /* Turn on the right bits */
2723 tmpbyte |= mask;
2724 pci_write_config_byte(dev, reg, tmpbyte);
2725 IRDA_MESSAGE("Activated ALi 1533 ISA bridge port 0x%04x.\n", port);
2726 return;
2528} 2727}
2529 2728
2530static int __init preconfigure_through_ali(struct pci_dev *dev, 2729static int __init preconfigure_through_ali(struct pci_dev *dev,
2531 struct smsc_ircc_subsystem_configuration *conf) 2730 struct
2731 smsc_ircc_subsystem_configuration
2732 *conf)
2532{ 2733{
2533 /* TODO: put in ALi 1533 configuration here. */ 2734 /* Configure the two ports on the ALi 1533 */
2534 IRDA_MESSAGE("SORRY: %s has an unsupported bridge controller (ALi): not pre-configured.\n", conf->name); 2735 preconfigure_ali_port(dev, conf->sir_io);
2535 return -ENODEV; 2736 preconfigure_ali_port(dev, conf->fir_io);
2737
2738 /* Pre-configure chip */
2739 return preconfigure_smsc_chip(conf);
2536} 2740}
2537 2741
2538static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, 2742static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg,
@@ -2552,9 +2756,10 @@ static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg,
2552 struct smsc_ircc_subsystem_configuration *conf; 2756 struct smsc_ircc_subsystem_configuration *conf;
2553 2757
2554 /* 2758 /*
2555 * Cache the subsystem vendor/device: some manufacturers fail to set 2759 * Cache the subsystem vendor/device:
2556 * this for all components, so we save it in case there is just 2760 * some manufacturers fail to set this for all components,
2557 * 0x0000 0x0000 on the device we want to check. 2761 * so we save it in case there is just 0x0000 0x0000 on the
2762 * device we want to check.
2558 */ 2763 */
2559 if (dev->subsystem_vendor != 0x0000U) { 2764 if (dev->subsystem_vendor != 0x0000U) {
2560 ss_vendor = dev->subsystem_vendor; 2765 ss_vendor = dev->subsystem_vendor;
@@ -2564,13 +2769,20 @@ static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg,
2564 for( ; conf->subvendor; conf++) { 2769 for( ; conf->subvendor; conf++) {
2565 if(conf->vendor == dev->vendor && 2770 if(conf->vendor == dev->vendor &&
2566 conf->device == dev->device && 2771 conf->device == dev->device &&
2567 conf->subvendor == ss_vendor && /* Sometimes these are cached values */ 2772 conf->subvendor == ss_vendor &&
2568 (conf->subdevice == ss_device || conf->subdevice == 0xffff)) { 2773 /* Sometimes these are cached values */
2569 struct smsc_ircc_subsystem_configuration tmpconf; 2774 (conf->subdevice == ss_device ||
2775 conf->subdevice == 0xffff)) {
2776 struct smsc_ircc_subsystem_configuration
2777 tmpconf;
2570 2778
2571 memcpy(&tmpconf, conf, sizeof(struct smsc_ircc_subsystem_configuration)); 2779 memcpy(&tmpconf, conf,
2780 sizeof(struct smsc_ircc_subsystem_configuration));
2572 2781
2573 /* Override the default values with anything passed in as parameter */ 2782 /*
2783 * Override the default values with anything
2784 * passed in as parameter
2785 */
2574 if (ircc_cfg != 0) 2786 if (ircc_cfg != 0)
2575 tmpconf.cfg_base = ircc_cfg; 2787 tmpconf.cfg_base = ircc_cfg;
2576 if (ircc_fir != 0) 2788 if (ircc_fir != 0)
diff --git a/include/net/arp.h b/include/net/arp.h
index a13e30c35f42..643bded9f557 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -10,8 +10,6 @@
10extern struct neigh_table arp_tbl; 10extern struct neigh_table arp_tbl;
11 11
12extern void arp_init(void); 12extern void arp_init(void);
13extern int arp_rcv(struct sk_buff *skb, struct net_device *dev,
14 struct packet_type *pt, struct net_device *orig_dev);
15extern int arp_find(unsigned char *haddr, struct sk_buff *skb); 13extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
16extern int arp_ioctl(unsigned int cmd, void __user *arg); 14extern int arp_ioctl(unsigned int cmd, void __user *arg);
17extern void arp_send(int type, int ptype, u32 dest_ip, 15extern void arp_send(int type, int ptype, u32 dest_ip,
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 0d5529c382e8..afa508d92c93 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -143,6 +143,11 @@ struct xfrm_state
143 /* Replay detection state at the time we sent the last notification */ 143 /* Replay detection state at the time we sent the last notification */
144 struct xfrm_replay_state preplay; 144 struct xfrm_replay_state preplay;
145 145
146 /* internal flag that only holds state for delayed aevent at the
147 * moment
148 */
149 u32 xflags;
150
146 /* Replay detection notification settings */ 151 /* Replay detection notification settings */
147 u32 replay_maxage; 152 u32 replay_maxage;
148 u32 replay_maxdiff; 153 u32 replay_maxdiff;
@@ -168,6 +173,9 @@ struct xfrm_state
168 void *data; 173 void *data;
169}; 174};
170 175
176/* xflags - make enum if more show up */
177#define XFRM_TIME_DEFER 1
178
171enum { 179enum {
172 XFRM_STATE_VOID, 180 XFRM_STATE_VOID,
173 XFRM_STATE_ACQ, 181 XFRM_STATE_ACQ,
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 3ab4e7947bab..1a786bfaa416 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -2,7 +2,6 @@
2 2
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ 3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4 4
5
6#include <linux/config.h> 5#include <linux/config.h>
7#include <linux/string.h> 6#include <linux/string.h>
8#include <linux/errno.h> 7#include <linux/errno.h>
@@ -54,24 +53,24 @@ static struct net_device *clip_devs;
54static struct atm_vcc *atmarpd; 53static struct atm_vcc *atmarpd;
55static struct neigh_table clip_tbl; 54static struct neigh_table clip_tbl;
56static struct timer_list idle_timer; 55static struct timer_list idle_timer;
57static int start_timer = 1;
58
59 56
60static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip) 57static int to_atmarpd(enum atmarp_ctrl_type type, int itf, unsigned long ip)
61{ 58{
62 struct sock *sk; 59 struct sock *sk;
63 struct atmarp_ctrl *ctrl; 60 struct atmarp_ctrl *ctrl;
64 struct sk_buff *skb; 61 struct sk_buff *skb;
65 62
66 DPRINTK("to_atmarpd(%d)\n",type); 63 DPRINTK("to_atmarpd(%d)\n", type);
67 if (!atmarpd) return -EUNATCH; 64 if (!atmarpd)
65 return -EUNATCH;
68 skb = alloc_skb(sizeof(struct atmarp_ctrl),GFP_ATOMIC); 66 skb = alloc_skb(sizeof(struct atmarp_ctrl),GFP_ATOMIC);
69 if (!skb) return -ENOMEM; 67 if (!skb)
68 return -ENOMEM;
70 ctrl = (struct atmarp_ctrl *) skb_put(skb,sizeof(struct atmarp_ctrl)); 69 ctrl = (struct atmarp_ctrl *) skb_put(skb,sizeof(struct atmarp_ctrl));
71 ctrl->type = type; 70 ctrl->type = type;
72 ctrl->itf_num = itf; 71 ctrl->itf_num = itf;
73 ctrl->ip = ip; 72 ctrl->ip = ip;
74 atm_force_charge(atmarpd,skb->truesize); 73 atm_force_charge(atmarpd, skb->truesize);
75 74
76 sk = sk_atm(atmarpd); 75 sk = sk_atm(atmarpd);
77 skb_queue_tail(&sk->sk_receive_queue, skb); 76 skb_queue_tail(&sk->sk_receive_queue, skb);
@@ -79,26 +78,24 @@ static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip)
79 return 0; 78 return 0;
80} 79}
81 80
82 81static void link_vcc(struct clip_vcc *clip_vcc, struct atmarp_entry *entry)
83static void link_vcc(struct clip_vcc *clip_vcc,struct atmarp_entry *entry)
84{ 82{
85 DPRINTK("link_vcc %p to entry %p (neigh %p)\n",clip_vcc,entry, 83 DPRINTK("link_vcc %p to entry %p (neigh %p)\n", clip_vcc, entry,
86 entry->neigh); 84 entry->neigh);
87 clip_vcc->entry = entry; 85 clip_vcc->entry = entry;
88 clip_vcc->xoff = 0; /* @@@ may overrun buffer by one packet */ 86 clip_vcc->xoff = 0; /* @@@ may overrun buffer by one packet */
89 clip_vcc->next = entry->vccs; 87 clip_vcc->next = entry->vccs;
90 entry->vccs = clip_vcc; 88 entry->vccs = clip_vcc;
91 entry->neigh->used = jiffies; 89 entry->neigh->used = jiffies;
92} 90}
93 91
94
95static void unlink_clip_vcc(struct clip_vcc *clip_vcc) 92static void unlink_clip_vcc(struct clip_vcc *clip_vcc)
96{ 93{
97 struct atmarp_entry *entry = clip_vcc->entry; 94 struct atmarp_entry *entry = clip_vcc->entry;
98 struct clip_vcc **walk; 95 struct clip_vcc **walk;
99 96
100 if (!entry) { 97 if (!entry) {
101 printk(KERN_CRIT "!clip_vcc->entry (clip_vcc %p)\n",clip_vcc); 98 printk(KERN_CRIT "!clip_vcc->entry (clip_vcc %p)\n", clip_vcc);
102 return; 99 return;
103 } 100 }
104 spin_lock_bh(&entry->neigh->dev->xmit_lock); /* block clip_start_xmit() */ 101 spin_lock_bh(&entry->neigh->dev->xmit_lock); /* block clip_start_xmit() */
@@ -107,24 +104,24 @@ static void unlink_clip_vcc(struct clip_vcc *clip_vcc)
107 if (*walk == clip_vcc) { 104 if (*walk == clip_vcc) {
108 int error; 105 int error;
109 106
110 *walk = clip_vcc->next; /* atomic */ 107 *walk = clip_vcc->next; /* atomic */
111 clip_vcc->entry = NULL; 108 clip_vcc->entry = NULL;
112 if (clip_vcc->xoff) 109 if (clip_vcc->xoff)
113 netif_wake_queue(entry->neigh->dev); 110 netif_wake_queue(entry->neigh->dev);
114 if (entry->vccs) 111 if (entry->vccs)
115 goto out; 112 goto out;
116 entry->expires = jiffies-1; 113 entry->expires = jiffies - 1;
117 /* force resolution or expiration */ 114 /* force resolution or expiration */
118 error = neigh_update(entry->neigh, NULL, NUD_NONE, 115 error = neigh_update(entry->neigh, NULL, NUD_NONE,
119 NEIGH_UPDATE_F_ADMIN); 116 NEIGH_UPDATE_F_ADMIN);
120 if (error) 117 if (error)
121 printk(KERN_CRIT "unlink_clip_vcc: " 118 printk(KERN_CRIT "unlink_clip_vcc: "
122 "neigh_update failed with %d\n",error); 119 "neigh_update failed with %d\n", error);
123 goto out; 120 goto out;
124 } 121 }
125 printk(KERN_CRIT "ATMARP: unlink_clip_vcc failed (entry %p, vcc " 122 printk(KERN_CRIT "ATMARP: unlink_clip_vcc failed (entry %p, vcc "
126 "0x%p)\n",entry,clip_vcc); 123 "0x%p)\n", entry, clip_vcc);
127out: 124 out:
128 spin_unlock_bh(&entry->neigh->dev->xmit_lock); 125 spin_unlock_bh(&entry->neigh->dev->xmit_lock);
129} 126}
130 127
@@ -153,13 +150,13 @@ static int neigh_check_cb(struct neighbour *n)
153 DPRINTK("destruction postponed with ref %d\n", 150 DPRINTK("destruction postponed with ref %d\n",
154 atomic_read(&n->refcnt)); 151 atomic_read(&n->refcnt));
155 152
156 while ((skb = skb_dequeue(&n->arp_queue)) != NULL) 153 while ((skb = skb_dequeue(&n->arp_queue)) != NULL)
157 dev_kfree_skb(skb); 154 dev_kfree_skb(skb);
158 155
159 return 0; 156 return 0;
160 } 157 }
161 158
162 DPRINTK("expired neigh %p\n",n); 159 DPRINTK("expired neigh %p\n", n);
163 return 1; 160 return 1;
164} 161}
165 162
@@ -167,7 +164,7 @@ static void idle_timer_check(unsigned long dummy)
167{ 164{
168 write_lock(&clip_tbl.lock); 165 write_lock(&clip_tbl.lock);
169 __neigh_for_each_release(&clip_tbl, neigh_check_cb); 166 __neigh_for_each_release(&clip_tbl, neigh_check_cb);
170 mod_timer(&idle_timer, jiffies+CLIP_CHECK_INTERVAL*HZ); 167 mod_timer(&idle_timer, jiffies + CLIP_CHECK_INTERVAL * HZ);
171 write_unlock(&clip_tbl.lock); 168 write_unlock(&clip_tbl.lock);
172} 169}
173 170
@@ -177,13 +174,13 @@ static int clip_arp_rcv(struct sk_buff *skb)
177 174
178 DPRINTK("clip_arp_rcv\n"); 175 DPRINTK("clip_arp_rcv\n");
179 vcc = ATM_SKB(skb)->vcc; 176 vcc = ATM_SKB(skb)->vcc;
180 if (!vcc || !atm_charge(vcc,skb->truesize)) { 177 if (!vcc || !atm_charge(vcc, skb->truesize)) {
181 dev_kfree_skb_any(skb); 178 dev_kfree_skb_any(skb);
182 return 0; 179 return 0;
183 } 180 }
184 DPRINTK("pushing to %p\n",vcc); 181 DPRINTK("pushing to %p\n", vcc);
185 DPRINTK("using %p\n",CLIP_VCC(vcc)->old_push); 182 DPRINTK("using %p\n", CLIP_VCC(vcc)->old_push);
186 CLIP_VCC(vcc)->old_push(vcc,skb); 183 CLIP_VCC(vcc)->old_push(vcc, skb);
187 return 0; 184 return 0;
188} 185}
189 186
@@ -193,34 +190,38 @@ static const unsigned char llc_oui[] = {
193 0x03, /* Ctrl: Unnumbered Information Command PDU */ 190 0x03, /* Ctrl: Unnumbered Information Command PDU */
194 0x00, /* OUI: EtherType */ 191 0x00, /* OUI: EtherType */
195 0x00, 192 0x00,
196 0x00 }; 193 0x00
194};
197 195
198static void clip_push(struct atm_vcc *vcc,struct sk_buff *skb) 196static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)
199{ 197{
200 struct clip_vcc *clip_vcc = CLIP_VCC(vcc); 198 struct clip_vcc *clip_vcc = CLIP_VCC(vcc);
201 199
202 DPRINTK("clip push\n"); 200 DPRINTK("clip push\n");
203 if (!skb) { 201 if (!skb) {
204 DPRINTK("removing VCC %p\n",clip_vcc); 202 DPRINTK("removing VCC %p\n", clip_vcc);
205 if (clip_vcc->entry) unlink_clip_vcc(clip_vcc); 203 if (clip_vcc->entry)
206 clip_vcc->old_push(vcc,NULL); /* pass on the bad news */ 204 unlink_clip_vcc(clip_vcc);
205 clip_vcc->old_push(vcc, NULL); /* pass on the bad news */
207 kfree(clip_vcc); 206 kfree(clip_vcc);
208 return; 207 return;
209 } 208 }
210 atm_return(vcc,skb->truesize); 209 atm_return(vcc, skb->truesize);
211 skb->dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : clip_devs; 210 skb->dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : clip_devs;
212 /* clip_vcc->entry == NULL if we don't have an IP address yet */ 211 /* clip_vcc->entry == NULL if we don't have an IP address yet */
213 if (!skb->dev) { 212 if (!skb->dev) {
214 dev_kfree_skb_any(skb); 213 dev_kfree_skb_any(skb);
215 return; 214 return;
216 } 215 }
217 ATM_SKB(skb)->vcc = vcc; 216 ATM_SKB(skb)->vcc = vcc;
218 skb->mac.raw = skb->data; 217 skb->mac.raw = skb->data;
219 if (!clip_vcc->encap || skb->len < RFC1483LLC_LEN || memcmp(skb->data, 218 if (!clip_vcc->encap
220 llc_oui,sizeof(llc_oui))) skb->protocol = htons(ETH_P_IP); 219 || skb->len < RFC1483LLC_LEN
220 || memcmp(skb->data, llc_oui, sizeof (llc_oui)))
221 skb->protocol = htons(ETH_P_IP);
221 else { 222 else {
222 skb->protocol = ((u16 *) skb->data)[3]; 223 skb->protocol = ((u16 *) skb->data)[3];
223 skb_pull(skb,RFC1483LLC_LEN); 224 skb_pull(skb, RFC1483LLC_LEN);
224 if (skb->protocol == htons(ETH_P_ARP)) { 225 if (skb->protocol == htons(ETH_P_ARP)) {
225 PRIV(skb->dev)->stats.rx_packets++; 226 PRIV(skb->dev)->stats.rx_packets++;
226 PRIV(skb->dev)->stats.rx_bytes += skb->len; 227 PRIV(skb->dev)->stats.rx_bytes += skb->len;
@@ -235,58 +236,54 @@ static void clip_push(struct atm_vcc *vcc,struct sk_buff *skb)
235 netif_rx(skb); 236 netif_rx(skb);
236} 237}
237 238
238
239/* 239/*
240 * Note: these spinlocks _must_not_ block on non-SMP. The only goal is that 240 * Note: these spinlocks _must_not_ block on non-SMP. The only goal is that
241 * clip_pop is atomic with respect to the critical section in clip_start_xmit. 241 * clip_pop is atomic with respect to the critical section in clip_start_xmit.
242 */ 242 */
243 243
244 244static void clip_pop(struct atm_vcc *vcc, struct sk_buff *skb)
245static void clip_pop(struct atm_vcc *vcc,struct sk_buff *skb)
246{ 245{
247 struct clip_vcc *clip_vcc = CLIP_VCC(vcc); 246 struct clip_vcc *clip_vcc = CLIP_VCC(vcc);
248 struct net_device *dev = skb->dev; 247 struct net_device *dev = skb->dev;
249 int old; 248 int old;
250 unsigned long flags; 249 unsigned long flags;
251 250
252 DPRINTK("clip_pop(vcc %p)\n",vcc); 251 DPRINTK("clip_pop(vcc %p)\n", vcc);
253 clip_vcc->old_pop(vcc,skb); 252 clip_vcc->old_pop(vcc, skb);
254 /* skb->dev == NULL in outbound ARP packets */ 253 /* skb->dev == NULL in outbound ARP packets */
255 if (!dev) return; 254 if (!dev)
256 spin_lock_irqsave(&PRIV(dev)->xoff_lock,flags); 255 return;
257 if (atm_may_send(vcc,0)) { 256 spin_lock_irqsave(&PRIV(dev)->xoff_lock, flags);
258 old = xchg(&clip_vcc->xoff,0); 257 if (atm_may_send(vcc, 0)) {
259 if (old) netif_wake_queue(dev); 258 old = xchg(&clip_vcc->xoff, 0);
259 if (old)
260 netif_wake_queue(dev);
260 } 261 }
261 spin_unlock_irqrestore(&PRIV(dev)->xoff_lock,flags); 262 spin_unlock_irqrestore(&PRIV(dev)->xoff_lock, flags);
262} 263}
263 264
264
265static void clip_neigh_destroy(struct neighbour *neigh) 265static void clip_neigh_destroy(struct neighbour *neigh)
266{ 266{
267 DPRINTK("clip_neigh_destroy (neigh %p)\n",neigh); 267 DPRINTK("clip_neigh_destroy (neigh %p)\n", neigh);
268 if (NEIGH2ENTRY(neigh)->vccs) 268 if (NEIGH2ENTRY(neigh)->vccs)
269 printk(KERN_CRIT "clip_neigh_destroy: vccs != NULL !!!\n"); 269 printk(KERN_CRIT "clip_neigh_destroy: vccs != NULL !!!\n");
270 NEIGH2ENTRY(neigh)->vccs = (void *) 0xdeadbeef; 270 NEIGH2ENTRY(neigh)->vccs = (void *) 0xdeadbeef;
271} 271}
272 272
273 273static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb)
274static void clip_neigh_solicit(struct neighbour *neigh,struct sk_buff *skb)
275{ 274{
276 DPRINTK("clip_neigh_solicit (neigh %p, skb %p)\n",neigh,skb); 275 DPRINTK("clip_neigh_solicit (neigh %p, skb %p)\n", neigh, skb);
277 to_atmarpd(act_need,PRIV(neigh->dev)->number,NEIGH2ENTRY(neigh)->ip); 276 to_atmarpd(act_need, PRIV(neigh->dev)->number, NEIGH2ENTRY(neigh)->ip);
278} 277}
279 278
280 279static void clip_neigh_error(struct neighbour *neigh, struct sk_buff *skb)
281static void clip_neigh_error(struct neighbour *neigh,struct sk_buff *skb)
282{ 280{
283#ifndef CONFIG_ATM_CLIP_NO_ICMP 281#ifndef CONFIG_ATM_CLIP_NO_ICMP
284 icmp_send(skb,ICMP_DEST_UNREACH,ICMP_HOST_UNREACH,0); 282 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0);
285#endif 283#endif
286 kfree_skb(skb); 284 kfree_skb(skb);
287} 285}
288 286
289
290static struct neigh_ops clip_neigh_ops = { 287static struct neigh_ops clip_neigh_ops = {
291 .family = AF_INET, 288 .family = AF_INET,
292 .solicit = clip_neigh_solicit, 289 .solicit = clip_neigh_solicit,
@@ -297,7 +294,6 @@ static struct neigh_ops clip_neigh_ops = {
297 .queue_xmit = dev_queue_xmit, 294 .queue_xmit = dev_queue_xmit,
298}; 295};
299 296
300
301static int clip_constructor(struct neighbour *neigh) 297static int clip_constructor(struct neighbour *neigh)
302{ 298{
303 struct atmarp_entry *entry = NEIGH2ENTRY(neigh); 299 struct atmarp_entry *entry = NEIGH2ENTRY(neigh);
@@ -305,9 +301,10 @@ static int clip_constructor(struct neighbour *neigh)
305 struct in_device *in_dev; 301 struct in_device *in_dev;
306 struct neigh_parms *parms; 302 struct neigh_parms *parms;
307 303
308 DPRINTK("clip_constructor (neigh %p, entry %p)\n",neigh,entry); 304 DPRINTK("clip_constructor (neigh %p, entry %p)\n", neigh, entry);
309 neigh->type = inet_addr_type(entry->ip); 305 neigh->type = inet_addr_type(entry->ip);
310 if (neigh->type != RTN_UNICAST) return -EINVAL; 306 if (neigh->type != RTN_UNICAST)
307 return -EINVAL;
311 308
312 rcu_read_lock(); 309 rcu_read_lock();
313 in_dev = __in_dev_get_rcu(dev); 310 in_dev = __in_dev_get_rcu(dev);
@@ -326,13 +323,13 @@ static int clip_constructor(struct neighbour *neigh)
326 neigh->ops->connected_output : neigh->ops->output; 323 neigh->ops->connected_output : neigh->ops->output;
327 entry->neigh = neigh; 324 entry->neigh = neigh;
328 entry->vccs = NULL; 325 entry->vccs = NULL;
329 entry->expires = jiffies-1; 326 entry->expires = jiffies - 1;
330 return 0; 327 return 0;
331} 328}
332 329
333static u32 clip_hash(const void *pkey, const struct net_device *dev) 330static u32 clip_hash(const void *pkey, const struct net_device *dev)
334{ 331{
335 return jhash_2words(*(u32 *)pkey, dev->ifindex, clip_tbl.hash_rnd); 332 return jhash_2words(*(u32 *) pkey, dev->ifindex, clip_tbl.hash_rnd);
336} 333}
337 334
338static struct neigh_table clip_tbl = { 335static struct neigh_table clip_tbl = {
@@ -366,7 +363,6 @@ static struct neigh_table clip_tbl = {
366 .gc_thresh3 = 1024, 363 .gc_thresh3 = 1024,
367}; 364};
368 365
369
370/* @@@ copy bh locking from arp.c -- need to bh-enable atm code before */ 366/* @@@ copy bh locking from arp.c -- need to bh-enable atm code before */
371 367
372/* 368/*
@@ -376,15 +372,13 @@ static struct neigh_table clip_tbl = {
376 * clip_setentry. 372 * clip_setentry.
377 */ 373 */
378 374
379 375static int clip_encap(struct atm_vcc *vcc, int mode)
380static int clip_encap(struct atm_vcc *vcc,int mode)
381{ 376{
382 CLIP_VCC(vcc)->encap = mode; 377 CLIP_VCC(vcc)->encap = mode;
383 return 0; 378 return 0;
384} 379}
385 380
386 381static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev)
387static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev)
388{ 382{
389 struct clip_priv *clip_priv = PRIV(dev); 383 struct clip_priv *clip_priv = PRIV(dev);
390 struct atmarp_entry *entry; 384 struct atmarp_entry *entry;
@@ -392,7 +386,7 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev)
392 int old; 386 int old;
393 unsigned long flags; 387 unsigned long flags;
394 388
395 DPRINTK("clip_start_xmit (skb %p)\n",skb); 389 DPRINTK("clip_start_xmit (skb %p)\n", skb);
396 if (!skb->dst) { 390 if (!skb->dst) {
397 printk(KERN_ERR "clip_start_xmit: skb->dst == NULL\n"); 391 printk(KERN_ERR "clip_start_xmit: skb->dst == NULL\n");
398 dev_kfree_skb(skb); 392 dev_kfree_skb(skb);
@@ -401,9 +395,9 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev)
401 } 395 }
402 if (!skb->dst->neighbour) { 396 if (!skb->dst->neighbour) {
403#if 0 397#if 0
404 skb->dst->neighbour = clip_find_neighbour(skb->dst,1); 398 skb->dst->neighbour = clip_find_neighbour(skb->dst, 1);
405 if (!skb->dst->neighbour) { 399 if (!skb->dst->neighbour) {
406 dev_kfree_skb(skb); /* lost that one */ 400 dev_kfree_skb(skb); /* lost that one */
407 clip_priv->stats.tx_dropped++; 401 clip_priv->stats.tx_dropped++;
408 return 0; 402 return 0;
409 } 403 }
@@ -417,73 +411,73 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev)
417 if (!entry->vccs) { 411 if (!entry->vccs) {
418 if (time_after(jiffies, entry->expires)) { 412 if (time_after(jiffies, entry->expires)) {
419 /* should be resolved */ 413 /* should be resolved */
420 entry->expires = jiffies+ATMARP_RETRY_DELAY*HZ; 414 entry->expires = jiffies + ATMARP_RETRY_DELAY * HZ;
421 to_atmarpd(act_need,PRIV(dev)->number,entry->ip); 415 to_atmarpd(act_need, PRIV(dev)->number, entry->ip);
422 } 416 }
423 if (entry->neigh->arp_queue.qlen < ATMARP_MAX_UNRES_PACKETS) 417 if (entry->neigh->arp_queue.qlen < ATMARP_MAX_UNRES_PACKETS)
424 skb_queue_tail(&entry->neigh->arp_queue,skb); 418 skb_queue_tail(&entry->neigh->arp_queue, skb);
425 else { 419 else {
426 dev_kfree_skb(skb); 420 dev_kfree_skb(skb);
427 clip_priv->stats.tx_dropped++; 421 clip_priv->stats.tx_dropped++;
428 } 422 }
429 return 0; 423 return 0;
430 } 424 }
431 DPRINTK("neigh %p, vccs %p\n",entry,entry->vccs); 425 DPRINTK("neigh %p, vccs %p\n", entry, entry->vccs);
432 ATM_SKB(skb)->vcc = vcc = entry->vccs->vcc; 426 ATM_SKB(skb)->vcc = vcc = entry->vccs->vcc;
433 DPRINTK("using neighbour %p, vcc %p\n",skb->dst->neighbour,vcc); 427 DPRINTK("using neighbour %p, vcc %p\n", skb->dst->neighbour, vcc);
434 if (entry->vccs->encap) { 428 if (entry->vccs->encap) {
435 void *here; 429 void *here;
436 430
437 here = skb_push(skb,RFC1483LLC_LEN); 431 here = skb_push(skb, RFC1483LLC_LEN);
438 memcpy(here,llc_oui,sizeof(llc_oui)); 432 memcpy(here, llc_oui, sizeof(llc_oui));
439 ((u16 *) here)[3] = skb->protocol; 433 ((u16 *) here)[3] = skb->protocol;
440 } 434 }
441 atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); 435 atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
442 ATM_SKB(skb)->atm_options = vcc->atm_options; 436 ATM_SKB(skb)->atm_options = vcc->atm_options;
443 entry->vccs->last_use = jiffies; 437 entry->vccs->last_use = jiffies;
444 DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n",skb,vcc,vcc->dev); 438 DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, vcc, vcc->dev);
445 old = xchg(&entry->vccs->xoff,1); /* assume XOFF ... */ 439 old = xchg(&entry->vccs->xoff, 1); /* assume XOFF ... */
446 if (old) { 440 if (old) {
447 printk(KERN_WARNING "clip_start_xmit: XOFF->XOFF transition\n"); 441 printk(KERN_WARNING "clip_start_xmit: XOFF->XOFF transition\n");
448 return 0; 442 return 0;
449 } 443 }
450 clip_priv->stats.tx_packets++; 444 clip_priv->stats.tx_packets++;
451 clip_priv->stats.tx_bytes += skb->len; 445 clip_priv->stats.tx_bytes += skb->len;
452 (void) vcc->send(vcc,skb); 446 vcc->send(vcc, skb);
453 if (atm_may_send(vcc,0)) { 447 if (atm_may_send(vcc, 0)) {
454 entry->vccs->xoff = 0; 448 entry->vccs->xoff = 0;
455 return 0; 449 return 0;
456 } 450 }
457 spin_lock_irqsave(&clip_priv->xoff_lock,flags); 451 spin_lock_irqsave(&clip_priv->xoff_lock, flags);
458 netif_stop_queue(dev); /* XOFF -> throttle immediately */ 452 netif_stop_queue(dev); /* XOFF -> throttle immediately */
459 barrier(); 453 barrier();
460 if (!entry->vccs->xoff) 454 if (!entry->vccs->xoff)
461 netif_start_queue(dev); 455 netif_start_queue(dev);
462 /* Oh, we just raced with clip_pop. netif_start_queue should be 456 /* Oh, we just raced with clip_pop. netif_start_queue should be
463 good enough, because nothing should really be asleep because 457 good enough, because nothing should really be asleep because
464 of the brief netif_stop_queue. If this isn't true or if it 458 of the brief netif_stop_queue. If this isn't true or if it
465 changes, use netif_wake_queue instead. */ 459 changes, use netif_wake_queue instead. */
466 spin_unlock_irqrestore(&clip_priv->xoff_lock,flags); 460 spin_unlock_irqrestore(&clip_priv->xoff_lock, flags);
467 return 0; 461 return 0;
468} 462}
469 463
470
471static struct net_device_stats *clip_get_stats(struct net_device *dev) 464static struct net_device_stats *clip_get_stats(struct net_device *dev)
472{ 465{
473 return &PRIV(dev)->stats; 466 return &PRIV(dev)->stats;
474} 467}
475 468
476 469static int clip_mkip(struct atm_vcc *vcc, int timeout)
477static int clip_mkip(struct atm_vcc *vcc,int timeout)
478{ 470{
479 struct clip_vcc *clip_vcc; 471 struct clip_vcc *clip_vcc;
480 struct sk_buff_head copy; 472 struct sk_buff_head copy;
481 struct sk_buff *skb; 473 struct sk_buff *skb;
482 474
483 if (!vcc->push) return -EBADFD; 475 if (!vcc->push)
484 clip_vcc = kmalloc(sizeof(struct clip_vcc),GFP_KERNEL); 476 return -EBADFD;
485 if (!clip_vcc) return -ENOMEM; 477 clip_vcc = kmalloc(sizeof(struct clip_vcc), GFP_KERNEL);
486 DPRINTK("mkip clip_vcc %p vcc %p\n",clip_vcc,vcc); 478 if (!clip_vcc)
479 return -ENOMEM;
480 DPRINTK("mkip clip_vcc %p vcc %p\n", clip_vcc, vcc);
487 clip_vcc->vcc = vcc; 481 clip_vcc->vcc = vcc;
488 vcc->user_back = clip_vcc; 482 vcc->user_back = clip_vcc;
489 set_bit(ATM_VF_IS_CLIP, &vcc->flags); 483 set_bit(ATM_VF_IS_CLIP, &vcc->flags);
@@ -491,7 +485,7 @@ static int clip_mkip(struct atm_vcc *vcc,int timeout)
491 clip_vcc->xoff = 0; 485 clip_vcc->xoff = 0;
492 clip_vcc->encap = 1; 486 clip_vcc->encap = 1;
493 clip_vcc->last_use = jiffies; 487 clip_vcc->last_use = jiffies;
494 clip_vcc->idle_timeout = timeout*HZ; 488 clip_vcc->idle_timeout = timeout * HZ;
495 clip_vcc->old_push = vcc->push; 489 clip_vcc->old_push = vcc->push;
496 clip_vcc->old_pop = vcc->pop; 490 clip_vcc->old_pop = vcc->pop;
497 vcc->push = clip_push; 491 vcc->push = clip_push;
@@ -501,27 +495,25 @@ static int clip_mkip(struct atm_vcc *vcc,int timeout)
501 /* re-process everything received between connection setup and MKIP */ 495 /* re-process everything received between connection setup and MKIP */
502 while ((skb = skb_dequeue(&copy)) != NULL) 496 while ((skb = skb_dequeue(&copy)) != NULL)
503 if (!clip_devs) { 497 if (!clip_devs) {
504 atm_return(vcc,skb->truesize); 498 atm_return(vcc, skb->truesize);
505 kfree_skb(skb); 499 kfree_skb(skb);
506 } 500 } else {
507 else {
508 unsigned int len = skb->len; 501 unsigned int len = skb->len;
509 502
510 clip_push(vcc,skb); 503 clip_push(vcc, skb);
511 PRIV(skb->dev)->stats.rx_packets--; 504 PRIV(skb->dev)->stats.rx_packets--;
512 PRIV(skb->dev)->stats.rx_bytes -= len; 505 PRIV(skb->dev)->stats.rx_bytes -= len;
513 } 506 }
514 return 0; 507 return 0;
515} 508}
516 509
517 510static int clip_setentry(struct atm_vcc *vcc, u32 ip)
518static int clip_setentry(struct atm_vcc *vcc,u32 ip)
519{ 511{
520 struct neighbour *neigh; 512 struct neighbour *neigh;
521 struct atmarp_entry *entry; 513 struct atmarp_entry *entry;
522 int error; 514 int error;
523 struct clip_vcc *clip_vcc; 515 struct clip_vcc *clip_vcc;
524 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip, .tos = 1 } } }; 516 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip, .tos = 1}} };
525 struct rtable *rt; 517 struct rtable *rt;
526 518
527 if (vcc->push != clip_push) { 519 if (vcc->push != clip_push) {
@@ -538,28 +530,29 @@ static int clip_setentry(struct atm_vcc *vcc,u32 ip)
538 unlink_clip_vcc(clip_vcc); 530 unlink_clip_vcc(clip_vcc);
539 return 0; 531 return 0;
540 } 532 }
541 error = ip_route_output_key(&rt,&fl); 533 error = ip_route_output_key(&rt, &fl);
542 if (error) return error; 534 if (error)
543 neigh = __neigh_lookup(&clip_tbl,&ip,rt->u.dst.dev,1); 535 return error;
536 neigh = __neigh_lookup(&clip_tbl, &ip, rt->u.dst.dev, 1);
544 ip_rt_put(rt); 537 ip_rt_put(rt);
545 if (!neigh) 538 if (!neigh)
546 return -ENOMEM; 539 return -ENOMEM;
547 entry = NEIGH2ENTRY(neigh); 540 entry = NEIGH2ENTRY(neigh);
548 if (entry != clip_vcc->entry) { 541 if (entry != clip_vcc->entry) {
549 if (!clip_vcc->entry) DPRINTK("setentry: add\n"); 542 if (!clip_vcc->entry)
543 DPRINTK("setentry: add\n");
550 else { 544 else {
551 DPRINTK("setentry: update\n"); 545 DPRINTK("setentry: update\n");
552 unlink_clip_vcc(clip_vcc); 546 unlink_clip_vcc(clip_vcc);
553 } 547 }
554 link_vcc(clip_vcc,entry); 548 link_vcc(clip_vcc, entry);
555 } 549 }
556 error = neigh_update(neigh, llc_oui, NUD_PERMANENT, 550 error = neigh_update(neigh, llc_oui, NUD_PERMANENT,
557 NEIGH_UPDATE_F_OVERRIDE|NEIGH_UPDATE_F_ADMIN); 551 NEIGH_UPDATE_F_OVERRIDE | NEIGH_UPDATE_F_ADMIN);
558 neigh_release(neigh); 552 neigh_release(neigh);
559 return error; 553 return error;
560} 554}
561 555
562
563static void clip_setup(struct net_device *dev) 556static void clip_setup(struct net_device *dev)
564{ 557{
565 dev->hard_start_xmit = clip_start_xmit; 558 dev->hard_start_xmit = clip_start_xmit;
@@ -568,15 +561,14 @@ static void clip_setup(struct net_device *dev)
568 dev->type = ARPHRD_ATM; 561 dev->type = ARPHRD_ATM;
569 dev->hard_header_len = RFC1483LLC_LEN; 562 dev->hard_header_len = RFC1483LLC_LEN;
570 dev->mtu = RFC1626_MTU; 563 dev->mtu = RFC1626_MTU;
571 dev->tx_queue_len = 100; /* "normal" queue (packets) */ 564 dev->tx_queue_len = 100; /* "normal" queue (packets) */
572 /* When using a "real" qdisc, the qdisc determines the queue */ 565 /* When using a "real" qdisc, the qdisc determines the queue */
573 /* length. tx_queue_len is only used for the default case, */ 566 /* length. tx_queue_len is only used for the default case, */
574 /* without any more elaborate queuing. 100 is a reasonable */ 567 /* without any more elaborate queuing. 100 is a reasonable */
575 /* compromise between decent burst-tolerance and protection */ 568 /* compromise between decent burst-tolerance and protection */
576 /* against memory hogs. */ 569 /* against memory hogs. */
577} 570}
578 571
579
580static int clip_create(int number) 572static int clip_create(int number)
581{ 573{
582 struct net_device *dev; 574 struct net_device *dev;
@@ -585,19 +577,19 @@ static int clip_create(int number)
585 577
586 if (number != -1) { 578 if (number != -1) {
587 for (dev = clip_devs; dev; dev = PRIV(dev)->next) 579 for (dev = clip_devs; dev; dev = PRIV(dev)->next)
588 if (PRIV(dev)->number == number) return -EEXIST; 580 if (PRIV(dev)->number == number)
589 } 581 return -EEXIST;
590 else { 582 } else {
591 number = 0; 583 number = 0;
592 for (dev = clip_devs; dev; dev = PRIV(dev)->next) 584 for (dev = clip_devs; dev; dev = PRIV(dev)->next)
593 if (PRIV(dev)->number >= number) 585 if (PRIV(dev)->number >= number)
594 number = PRIV(dev)->number+1; 586 number = PRIV(dev)->number + 1;
595 } 587 }
596 dev = alloc_netdev(sizeof(struct clip_priv), "", clip_setup); 588 dev = alloc_netdev(sizeof(struct clip_priv), "", clip_setup);
597 if (!dev) 589 if (!dev)
598 return -ENOMEM; 590 return -ENOMEM;
599 clip_priv = PRIV(dev); 591 clip_priv = PRIV(dev);
600 sprintf(dev->name,"atm%d",number); 592 sprintf(dev->name, "atm%d", number);
601 spin_lock_init(&clip_priv->xoff_lock); 593 spin_lock_init(&clip_priv->xoff_lock);
602 clip_priv->number = number; 594 clip_priv->number = number;
603 error = register_netdev(dev); 595 error = register_netdev(dev);
@@ -607,53 +599,48 @@ static int clip_create(int number)
607 } 599 }
608 clip_priv->next = clip_devs; 600 clip_priv->next = clip_devs;
609 clip_devs = dev; 601 clip_devs = dev;
610 DPRINTK("registered (net:%s)\n",dev->name); 602 DPRINTK("registered (net:%s)\n", dev->name);
611 return number; 603 return number;
612} 604}
613 605
614 606static int clip_device_event(struct notifier_block *this, unsigned long event,
615static int clip_device_event(struct notifier_block *this,unsigned long event, 607 void *arg)
616 void *dev)
617{ 608{
609 struct net_device *dev = arg;
610
611 if (event == NETDEV_UNREGISTER) {
612 neigh_ifdown(&clip_tbl, dev);
613 return NOTIFY_DONE;
614 }
615
618 /* ignore non-CLIP devices */ 616 /* ignore non-CLIP devices */
619 if (((struct net_device *) dev)->type != ARPHRD_ATM || 617 if (dev->type != ARPHRD_ATM || dev->hard_start_xmit != clip_start_xmit)
620 ((struct net_device *) dev)->hard_start_xmit != clip_start_xmit)
621 return NOTIFY_DONE; 618 return NOTIFY_DONE;
619
622 switch (event) { 620 switch (event) {
623 case NETDEV_UP: 621 case NETDEV_UP:
624 DPRINTK("clip_device_event NETDEV_UP\n"); 622 DPRINTK("clip_device_event NETDEV_UP\n");
625 (void) to_atmarpd(act_up,PRIV(dev)->number,0); 623 to_atmarpd(act_up, PRIV(dev)->number, 0);
626 break; 624 break;
627 case NETDEV_GOING_DOWN: 625 case NETDEV_GOING_DOWN:
628 DPRINTK("clip_device_event NETDEV_DOWN\n"); 626 DPRINTK("clip_device_event NETDEV_DOWN\n");
629 (void) to_atmarpd(act_down,PRIV(dev)->number,0); 627 to_atmarpd(act_down, PRIV(dev)->number, 0);
630 break; 628 break;
631 case NETDEV_CHANGE: 629 case NETDEV_CHANGE:
632 case NETDEV_CHANGEMTU: 630 case NETDEV_CHANGEMTU:
633 DPRINTK("clip_device_event NETDEV_CHANGE*\n"); 631 DPRINTK("clip_device_event NETDEV_CHANGE*\n");
634 (void) to_atmarpd(act_change,PRIV(dev)->number,0); 632 to_atmarpd(act_change, PRIV(dev)->number, 0);
635 break; 633 break;
636 case NETDEV_REBOOT:
637 case NETDEV_REGISTER:
638 case NETDEV_DOWN:
639 DPRINTK("clip_device_event %ld\n",event);
640 /* ignore */
641 break;
642 default:
643 printk(KERN_WARNING "clip_device_event: unknown event "
644 "%ld\n",event);
645 break;
646 } 634 }
647 return NOTIFY_DONE; 635 return NOTIFY_DONE;
648} 636}
649 637
650 638static int clip_inet_event(struct notifier_block *this, unsigned long event,
651static int clip_inet_event(struct notifier_block *this,unsigned long event, 639 void *ifa)
652 void *ifa)
653{ 640{
654 struct in_device *in_dev; 641 struct in_device *in_dev;
655 642
656 in_dev = ((struct in_ifaddr *) ifa)->ifa_dev; 643 in_dev = ((struct in_ifaddr *)ifa)->ifa_dev;
657 if (!in_dev || !in_dev->dev) { 644 if (!in_dev || !in_dev->dev) {
658 printk(KERN_WARNING "clip_inet_event: no device\n"); 645 printk(KERN_WARNING "clip_inet_event: no device\n");
659 return NOTIFY_DONE; 646 return NOTIFY_DONE;
@@ -662,23 +649,20 @@ static int clip_inet_event(struct notifier_block *this,unsigned long event,
662 * Transitions are of the down-change-up type, so it's sufficient to 649 * Transitions are of the down-change-up type, so it's sufficient to
663 * handle the change on up. 650 * handle the change on up.
664 */ 651 */
665 if (event != NETDEV_UP) return NOTIFY_DONE; 652 if (event != NETDEV_UP)
666 return clip_device_event(this,NETDEV_CHANGE,in_dev->dev); 653 return NOTIFY_DONE;
654 return clip_device_event(this, NETDEV_CHANGE, in_dev->dev);
667} 655}
668 656
669 657
670static struct notifier_block clip_dev_notifier = { 658static struct notifier_block clip_dev_notifier = {
671 clip_device_event, 659 .notifier_call = clip_device_event,
672 NULL,
673 0
674}; 660};
675 661
676 662
677 663
678static struct notifier_block clip_inet_notifier = { 664static struct notifier_block clip_inet_notifier = {
679 clip_inet_event, 665 .notifier_call = clip_inet_event,
680 NULL,
681 0
682}; 666};
683 667
684 668
@@ -686,14 +670,12 @@ static struct notifier_block clip_inet_notifier = {
686static void atmarpd_close(struct atm_vcc *vcc) 670static void atmarpd_close(struct atm_vcc *vcc)
687{ 671{
688 DPRINTK("atmarpd_close\n"); 672 DPRINTK("atmarpd_close\n");
689 atmarpd = NULL; /* assumed to be atomic */ 673
690 barrier(); 674 rtnl_lock();
691 unregister_inetaddr_notifier(&clip_inet_notifier); 675 atmarpd = NULL;
692 unregister_netdevice_notifier(&clip_dev_notifier);
693 if (skb_peek(&sk_atm(vcc)->sk_receive_queue))
694 printk(KERN_ERR "atmarpd_close: closing with requests "
695 "pending\n");
696 skb_queue_purge(&sk_atm(vcc)->sk_receive_queue); 676 skb_queue_purge(&sk_atm(vcc)->sk_receive_queue);
677 rtnl_unlock();
678
697 DPRINTK("(done)\n"); 679 DPRINTK("(done)\n");
698 module_put(THIS_MODULE); 680 module_put(THIS_MODULE);
699} 681}
@@ -714,14 +696,14 @@ static struct atm_dev atmarpd_dev = {
714 696
715static int atm_init_atmarp(struct atm_vcc *vcc) 697static int atm_init_atmarp(struct atm_vcc *vcc)
716{ 698{
717 if (atmarpd) return -EADDRINUSE; 699 rtnl_lock();
718 if (start_timer) { 700 if (atmarpd) {
719 start_timer = 0; 701 rtnl_unlock();
720 init_timer(&idle_timer); 702 return -EADDRINUSE;
721 idle_timer.expires = jiffies+CLIP_CHECK_INTERVAL*HZ;
722 idle_timer.function = idle_timer_check;
723 add_timer(&idle_timer);
724 } 703 }
704
705 mod_timer(&idle_timer, jiffies+CLIP_CHECK_INTERVAL*HZ);
706
725 atmarpd = vcc; 707 atmarpd = vcc;
726 set_bit(ATM_VF_META,&vcc->flags); 708 set_bit(ATM_VF_META,&vcc->flags);
727 set_bit(ATM_VF_READY,&vcc->flags); 709 set_bit(ATM_VF_READY,&vcc->flags);
@@ -731,10 +713,7 @@ static int atm_init_atmarp(struct atm_vcc *vcc)
731 vcc->push = NULL; 713 vcc->push = NULL;
732 vcc->pop = NULL; /* crash */ 714 vcc->pop = NULL; /* crash */
733 vcc->push_oam = NULL; /* crash */ 715 vcc->push_oam = NULL; /* crash */
734 if (register_netdevice_notifier(&clip_dev_notifier)) 716 rtnl_unlock();
735 printk(KERN_ERR "register_netdevice_notifier failed\n");
736 if (register_inetaddr_notifier(&clip_inet_notifier))
737 printk(KERN_ERR "register_inetaddr_notifier failed\n");
738 return 0; 717 return 0;
739} 718}
740 719
@@ -744,53 +723,53 @@ static int clip_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
744 int err = 0; 723 int err = 0;
745 724
746 switch (cmd) { 725 switch (cmd) {
747 case SIOCMKCLIP: 726 case SIOCMKCLIP:
748 case ATMARPD_CTRL: 727 case ATMARPD_CTRL:
749 case ATMARP_MKIP: 728 case ATMARP_MKIP:
750 case ATMARP_SETENTRY: 729 case ATMARP_SETENTRY:
751 case ATMARP_ENCAP: 730 case ATMARP_ENCAP:
752 if (!capable(CAP_NET_ADMIN)) 731 if (!capable(CAP_NET_ADMIN))
753 return -EPERM; 732 return -EPERM;
754 break; 733 break;
755 default: 734 default:
756 return -ENOIOCTLCMD; 735 return -ENOIOCTLCMD;
757 } 736 }
758 737
759 switch (cmd) { 738 switch (cmd) {
760 case SIOCMKCLIP: 739 case SIOCMKCLIP:
761 err = clip_create(arg); 740 err = clip_create(arg);
762 break; 741 break;
763 case ATMARPD_CTRL: 742 case ATMARPD_CTRL:
764 err = atm_init_atmarp(vcc); 743 err = atm_init_atmarp(vcc);
765 if (!err) { 744 if (!err) {
766 sock->state = SS_CONNECTED; 745 sock->state = SS_CONNECTED;
767 __module_get(THIS_MODULE); 746 __module_get(THIS_MODULE);
768 } 747 }
769 break; 748 break;
770 case ATMARP_MKIP: 749 case ATMARP_MKIP:
771 err = clip_mkip(vcc ,arg); 750 err = clip_mkip(vcc, arg);
772 break; 751 break;
773 case ATMARP_SETENTRY: 752 case ATMARP_SETENTRY:
774 err = clip_setentry(vcc, arg); 753 err = clip_setentry(vcc, arg);
775 break; 754 break;
776 case ATMARP_ENCAP: 755 case ATMARP_ENCAP:
777 err = clip_encap(vcc, arg); 756 err = clip_encap(vcc, arg);
778 break; 757 break;
779 } 758 }
780 return err; 759 return err;
781} 760}
782 761
783static struct atm_ioctl clip_ioctl_ops = { 762static struct atm_ioctl clip_ioctl_ops = {
784 .owner = THIS_MODULE, 763 .owner = THIS_MODULE,
785 .ioctl = clip_ioctl, 764 .ioctl = clip_ioctl,
786}; 765};
787 766
788#ifdef CONFIG_PROC_FS 767#ifdef CONFIG_PROC_FS
789 768
790static void svc_addr(struct seq_file *seq, struct sockaddr_atmsvc *addr) 769static void svc_addr(struct seq_file *seq, struct sockaddr_atmsvc *addr)
791{ 770{
792 static int code[] = { 1,2,10,6,1,0 }; 771 static int code[] = { 1, 2, 10, 6, 1, 0 };
793 static int e164[] = { 1,8,4,6,1,0 }; 772 static int e164[] = { 1, 8, 4, 6, 1, 0 };
794 773
795 if (*addr->sas_addr.pub) { 774 if (*addr->sas_addr.pub) {
796 seq_printf(seq, "%s", addr->sas_addr.pub); 775 seq_printf(seq, "%s", addr->sas_addr.pub);
@@ -809,7 +788,7 @@ static void svc_addr(struct seq_file *seq, struct sockaddr_atmsvc *addr)
809 for (i = 0; fields[i]; i++) { 788 for (i = 0; fields[i]; i++) {
810 for (j = fields[i]; j; j--) 789 for (j = fields[i]; j; j--)
811 seq_printf(seq, "%02X", *prv++); 790 seq_printf(seq, "%02X", *prv++);
812 if (fields[i+1]) 791 if (fields[i + 1])
813 seq_putc(seq, '.'); 792 seq_putc(seq, '.');
814 } 793 }
815 } 794 }
@@ -828,8 +807,7 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev,
828 svc = ((clip_vcc == SEQ_NO_VCC_TOKEN) || 807 svc = ((clip_vcc == SEQ_NO_VCC_TOKEN) ||
829 (sk_atm(clip_vcc->vcc)->sk_family == AF_ATMSVC)); 808 (sk_atm(clip_vcc->vcc)->sk_family == AF_ATMSVC));
830 809
831 llc = ((clip_vcc == SEQ_NO_VCC_TOKEN) || 810 llc = ((clip_vcc == SEQ_NO_VCC_TOKEN) || clip_vcc->encap);
832 clip_vcc->encap);
833 811
834 if (clip_vcc == SEQ_NO_VCC_TOKEN) 812 if (clip_vcc == SEQ_NO_VCC_TOKEN)
835 exp = entry->neigh->used; 813 exp = entry->neigh->used;
@@ -839,10 +817,7 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev,
839 exp = (jiffies - exp) / HZ; 817 exp = (jiffies - exp) / HZ;
840 818
841 seq_printf(seq, "%-6s%-4s%-4s%5ld ", 819 seq_printf(seq, "%-6s%-4s%-4s%5ld ",
842 dev->name, 820 dev->name, svc ? "SVC" : "PVC", llc ? "LLC" : "NULL", exp);
843 svc ? "SVC" : "PVC",
844 llc ? "LLC" : "NULL",
845 exp);
846 821
847 off = scnprintf(buf, sizeof(buf) - 1, "%d.%d.%d.%d", 822 off = scnprintf(buf, sizeof(buf) - 1, "%d.%d.%d.%d",
848 NIPQUAD(entry->ip)); 823 NIPQUAD(entry->ip));
@@ -860,8 +835,7 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev,
860 } else if (!svc) { 835 } else if (!svc) {
861 seq_printf(seq, "%d.%d.%d\n", 836 seq_printf(seq, "%d.%d.%d\n",
862 clip_vcc->vcc->dev->number, 837 clip_vcc->vcc->dev->number,
863 clip_vcc->vcc->vpi, 838 clip_vcc->vcc->vpi, clip_vcc->vcc->vci);
864 clip_vcc->vcc->vci);
865 } else { 839 } else {
866 svc_addr(seq, &clip_vcc->vcc->remote); 840 svc_addr(seq, &clip_vcc->vcc->remote);
867 seq_putc(seq, '\n'); 841 seq_putc(seq, '\n');
@@ -894,7 +868,7 @@ static struct clip_vcc *clip_seq_next_vcc(struct atmarp_entry *e,
894} 868}
895 869
896static void *clip_seq_vcc_walk(struct clip_seq_state *state, 870static void *clip_seq_vcc_walk(struct clip_seq_state *state,
897 struct atmarp_entry *e, loff_t *pos) 871 struct atmarp_entry *e, loff_t * pos)
898{ 872{
899 struct clip_vcc *vcc = state->vcc; 873 struct clip_vcc *vcc = state->vcc;
900 874
@@ -911,24 +885,24 @@ static void *clip_seq_vcc_walk(struct clip_seq_state *state,
911 885
912 return vcc; 886 return vcc;
913} 887}
914 888
915static void *clip_seq_sub_iter(struct neigh_seq_state *_state, 889static void *clip_seq_sub_iter(struct neigh_seq_state *_state,
916 struct neighbour *n, loff_t *pos) 890 struct neighbour *n, loff_t * pos)
917{ 891{
918 struct clip_seq_state *state = (struct clip_seq_state *) _state; 892 struct clip_seq_state *state = (struct clip_seq_state *)_state;
919 893
920 return clip_seq_vcc_walk(state, NEIGH2ENTRY(n), pos); 894 return clip_seq_vcc_walk(state, NEIGH2ENTRY(n), pos);
921} 895}
922 896
923static void *clip_seq_start(struct seq_file *seq, loff_t *pos) 897static void *clip_seq_start(struct seq_file *seq, loff_t * pos)
924{ 898{
925 return neigh_seq_start(seq, pos, &clip_tbl, NEIGH_SEQ_NEIGH_ONLY); 899 return neigh_seq_start(seq, pos, &clip_tbl, NEIGH_SEQ_NEIGH_ONLY);
926} 900}
927 901
928static int clip_seq_show(struct seq_file *seq, void *v) 902static int clip_seq_show(struct seq_file *seq, void *v)
929{ 903{
930 static char atm_arp_banner[] = 904 static char atm_arp_banner[] =
931 "IPitf TypeEncp Idle IP address ATM address\n"; 905 "IPitf TypeEncp Idle IP address ATM address\n";
932 906
933 if (v == SEQ_START_TOKEN) { 907 if (v == SEQ_START_TOKEN) {
934 seq_puts(seq, atm_arp_banner); 908 seq_puts(seq, atm_arp_banner);
@@ -939,7 +913,7 @@ static int clip_seq_show(struct seq_file *seq, void *v)
939 913
940 atmarp_info(seq, n->dev, NEIGH2ENTRY(n), vcc); 914 atmarp_info(seq, n->dev, NEIGH2ENTRY(n), vcc);
941 } 915 }
942 return 0; 916 return 0;
943} 917}
944 918
945static struct seq_operations arp_seq_ops = { 919static struct seq_operations arp_seq_ops = {
@@ -988,20 +962,19 @@ static struct file_operations arp_seq_fops = {
988 962
989static int __init atm_clip_init(void) 963static int __init atm_clip_init(void)
990{ 964{
965 struct proc_dir_entry *p;
991 neigh_table_init(&clip_tbl); 966 neigh_table_init(&clip_tbl);
992 967
993 clip_tbl_hook = &clip_tbl; 968 clip_tbl_hook = &clip_tbl;
994 register_atm_ioctl(&clip_ioctl_ops); 969 register_atm_ioctl(&clip_ioctl_ops);
970 register_netdevice_notifier(&clip_dev_notifier);
971 register_inetaddr_notifier(&clip_inet_notifier);
995 972
996#ifdef CONFIG_PROC_FS 973 setup_timer(&idle_timer, idle_timer_check, 0);
997{
998 struct proc_dir_entry *p;
999 974
1000 p = create_proc_entry("arp", S_IRUGO, atm_proc_root); 975 p = create_proc_entry("arp", S_IRUGO, atm_proc_root);
1001 if (p) 976 if (p)
1002 p->proc_fops = &arp_seq_fops; 977 p->proc_fops = &arp_seq_fops;
1003}
1004#endif
1005 978
1006 return 0; 979 return 0;
1007} 980}
@@ -1012,13 +985,15 @@ static void __exit atm_clip_exit(void)
1012 985
1013 remove_proc_entry("arp", atm_proc_root); 986 remove_proc_entry("arp", atm_proc_root);
1014 987
988 unregister_inetaddr_notifier(&clip_inet_notifier);
989 unregister_netdevice_notifier(&clip_dev_notifier);
990
1015 deregister_atm_ioctl(&clip_ioctl_ops); 991 deregister_atm_ioctl(&clip_ioctl_ops);
1016 992
1017 /* First, stop the idle timer, so it stops banging 993 /* First, stop the idle timer, so it stops banging
1018 * on the table. 994 * on the table.
1019 */ 995 */
1020 if (start_timer == 0) 996 del_timer_sync(&idle_timer);
1021 del_timer(&idle_timer);
1022 997
1023 /* Next, purge the table, so that the device 998 /* Next, purge the table, so that the device
1024 * unregister loop below does not hang due to 999 * unregister loop below does not hang due to
@@ -1042,5 +1017,6 @@ static void __exit atm_clip_exit(void)
1042 1017
1043module_init(atm_clip_init); 1018module_init(atm_clip_init);
1044module_exit(atm_clip_exit); 1019module_exit(atm_clip_exit);
1045 1020MODULE_AUTHOR("Werner Almesberger");
1021MODULE_DESCRIPTION("Classical/IP over ATM interface");
1046MODULE_LICENSE("GPL"); 1022MODULE_LICENSE("GPL");
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 041dadde31af..4749d504c629 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -928,7 +928,8 @@ static void parp_redo(struct sk_buff *skb)
928 * Receive an arp request from the device layer. 928 * Receive an arp request from the device layer.
929 */ 929 */
930 930
931int arp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) 931static int arp_rcv(struct sk_buff *skb, struct net_device *dev,
932 struct packet_type *pt, struct net_device *orig_dev)
932{ 933{
933 struct arphdr *arp; 934 struct arphdr *arp;
934 935
@@ -1417,7 +1418,6 @@ static int __init arp_proc_init(void)
1417 1418
1418EXPORT_SYMBOL(arp_broken_ops); 1419EXPORT_SYMBOL(arp_broken_ops);
1419EXPORT_SYMBOL(arp_find); 1420EXPORT_SYMBOL(arp_find);
1420EXPORT_SYMBOL(arp_rcv);
1421EXPORT_SYMBOL(arp_create); 1421EXPORT_SYMBOL(arp_create);
1422EXPORT_SYMBOL(arp_xmit); 1422EXPORT_SYMBOL(arp_xmit);
1423EXPORT_SYMBOL(arp_send); 1423EXPORT_SYMBOL(arp_send);
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 81c2f7885292..54419b27686f 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1556,7 +1556,6 @@ void __init devinet_init(void)
1556#endif 1556#endif
1557} 1557}
1558 1558
1559EXPORT_SYMBOL(devinet_ioctl);
1560EXPORT_SYMBOL(in_dev_finish_destroy); 1559EXPORT_SYMBOL(in_dev_finish_destroy);
1561EXPORT_SYMBOL(inet_select_addr); 1560EXPORT_SYMBOL(inet_select_addr);
1562EXPORT_SYMBOL(inetdev_by_index); 1561EXPORT_SYMBOL(inetdev_by_index);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 4e3d3811dea2..cdde96390960 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -666,4 +666,3 @@ void __init ip_fib_init(void)
666} 666}
667 667
668EXPORT_SYMBOL(inet_addr_type); 668EXPORT_SYMBOL(inet_addr_type);
669EXPORT_SYMBOL(ip_rt_ioctl);
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index ef7366fc132f..ee9b5515b9ae 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -43,8 +43,6 @@ struct inet_bind_bucket *inet_bind_bucket_create(kmem_cache_t *cachep,
43 return tb; 43 return tb;
44} 44}
45 45
46EXPORT_SYMBOL(inet_bind_bucket_create);
47
48/* 46/*
49 * Caller must hold hashbucket lock for this tb with local BH disabled 47 * Caller must hold hashbucket lock for this tb with local BH disabled
50 */ 48 */
@@ -64,8 +62,6 @@ void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
64 inet_csk(sk)->icsk_bind_hash = tb; 62 inet_csk(sk)->icsk_bind_hash = tb;
65} 63}
66 64
67EXPORT_SYMBOL(inet_bind_hash);
68
69/* 65/*
70 * Get rid of any references to a local port held by the given sock. 66 * Get rid of any references to a local port held by the given sock.
71 */ 67 */
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 8dcba3887f04..cff9c3a72daf 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -904,7 +904,7 @@ alloc_new_skb:
904 * because we have no idea what fragment will be 904 * because we have no idea what fragment will be
905 * the last. 905 * the last.
906 */ 906 */
907 if (datalen == length) 907 if (datalen == length + fraggap)
908 alloclen += rt->u.dst.trailer_len; 908 alloclen += rt->u.dst.trailer_len;
909 909
910 if (transhdrlen) { 910 if (transhdrlen) {
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 195d83584558..9f0cca4c4fae 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4559,7 +4559,6 @@ discard:
4559 4559
4560EXPORT_SYMBOL(sysctl_tcp_ecn); 4560EXPORT_SYMBOL(sysctl_tcp_ecn);
4561EXPORT_SYMBOL(sysctl_tcp_reordering); 4561EXPORT_SYMBOL(sysctl_tcp_reordering);
4562EXPORT_SYMBOL(sysctl_tcp_abc);
4563EXPORT_SYMBOL(tcp_parse_options); 4562EXPORT_SYMBOL(tcp_parse_options);
4564EXPORT_SYMBOL(tcp_rcv_established); 4563EXPORT_SYMBOL(tcp_rcv_established);
4565EXPORT_SYMBOL(tcp_rcv_state_process); 4564EXPORT_SYMBOL(tcp_rcv_state_process);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 9e85c0416109..672950e54c49 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1859,5 +1859,4 @@ EXPORT_SYMBOL(tcp_proc_unregister);
1859#endif 1859#endif
1860EXPORT_SYMBOL(sysctl_local_port_range); 1860EXPORT_SYMBOL(sysctl_local_port_range);
1861EXPORT_SYMBOL(sysctl_tcp_low_latency); 1861EXPORT_SYMBOL(sysctl_tcp_low_latency);
1862EXPORT_SYMBOL(sysctl_tcp_tw_reuse);
1863 1862
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 9d79546d384e..b871db6adc55 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -59,9 +59,6 @@ int sysctl_tcp_tso_win_divisor = 3;
59int sysctl_tcp_mtu_probing = 0; 59int sysctl_tcp_mtu_probing = 0;
60int sysctl_tcp_base_mss = 512; 60int sysctl_tcp_base_mss = 512;
61 61
62EXPORT_SYMBOL(sysctl_tcp_mtu_probing);
63EXPORT_SYMBOL(sysctl_tcp_base_mss);
64
65static void update_send_head(struct sock *sk, struct tcp_sock *tp, 62static void update_send_head(struct sock *sk, struct tcp_sock *tp,
66 struct sk_buff *skb) 63 struct sk_buff *skb)
67{ 64{
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index a8e14dc1b04e..3dc3e1f3b7aa 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -805,16 +805,22 @@ void xfrm_replay_notify(struct xfrm_state *x, int event)
805 case XFRM_REPLAY_UPDATE: 805 case XFRM_REPLAY_UPDATE:
806 if (x->replay_maxdiff && 806 if (x->replay_maxdiff &&
807 (x->replay.seq - x->preplay.seq < x->replay_maxdiff) && 807 (x->replay.seq - x->preplay.seq < x->replay_maxdiff) &&
808 (x->replay.oseq - x->preplay.oseq < x->replay_maxdiff)) 808 (x->replay.oseq - x->preplay.oseq < x->replay_maxdiff)) {
809 return; 809 if (x->xflags & XFRM_TIME_DEFER)
810 event = XFRM_REPLAY_TIMEOUT;
811 else
812 return;
813 }
810 814
811 break; 815 break;
812 816
813 case XFRM_REPLAY_TIMEOUT: 817 case XFRM_REPLAY_TIMEOUT:
814 if ((x->replay.seq == x->preplay.seq) && 818 if ((x->replay.seq == x->preplay.seq) &&
815 (x->replay.bitmap == x->preplay.bitmap) && 819 (x->replay.bitmap == x->preplay.bitmap) &&
816 (x->replay.oseq == x->preplay.oseq)) 820 (x->replay.oseq == x->preplay.oseq)) {
821 x->xflags |= XFRM_TIME_DEFER;
817 return; 822 return;
823 }
818 824
819 break; 825 break;
820 } 826 }
@@ -825,8 +831,10 @@ void xfrm_replay_notify(struct xfrm_state *x, int event)
825 km_state_notify(x, &c); 831 km_state_notify(x, &c);
826 832
827 if (x->replay_maxage && 833 if (x->replay_maxage &&
828 !mod_timer(&x->rtimer, jiffies + x->replay_maxage)) 834 !mod_timer(&x->rtimer, jiffies + x->replay_maxage)) {
829 xfrm_state_hold(x); 835 xfrm_state_hold(x);
836 x->xflags &= ~XFRM_TIME_DEFER;
837 }
830} 838}
831EXPORT_SYMBOL(xfrm_replay_notify); 839EXPORT_SYMBOL(xfrm_replay_notify);
832 840
@@ -836,10 +844,15 @@ static void xfrm_replay_timer_handler(unsigned long data)
836 844
837 spin_lock(&x->lock); 845 spin_lock(&x->lock);
838 846
839 if (xfrm_aevent_is_on() && x->km.state == XFRM_STATE_VALID) 847 if (x->km.state == XFRM_STATE_VALID) {
840 xfrm_replay_notify(x, XFRM_REPLAY_TIMEOUT); 848 if (xfrm_aevent_is_on())
849 xfrm_replay_notify(x, XFRM_REPLAY_TIMEOUT);
850 else
851 x->xflags |= XFRM_TIME_DEFER;
852 }
841 853
842 spin_unlock(&x->lock); 854 spin_unlock(&x->lock);
855 xfrm_state_put(x);
843} 856}
844 857
845int xfrm_replay_check(struct xfrm_state *x, u32 seq) 858int xfrm_replay_check(struct xfrm_state *x, u32 seq)