aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-29 20:32:08 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-29 20:32:08 -0500
commit12074a35b4ef36d7a971beaf42412b22f304cdd1 (patch)
treeee52353367f9b2f2bd983d18806a3e64f00886f3
parent49c91fb01ff3948285608c65754b3ffbf57d50f2 (diff)
parent34a0b3cdc078746788ffc49e56da0db62b8b6ea4 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
-rw-r--r--drivers/atm/Kconfig7
-rw-r--r--drivers/atm/Makefile1
-rw-r--r--drivers/atm/adummy.c168
-rw-r--r--drivers/atm/atmdev_init.c54
-rw-r--r--drivers/atm/atmtcp.c20
-rw-r--r--drivers/atm/lanai.c102
-rw-r--r--drivers/usb/atm/usbatm.c4
-rw-r--r--include/linux/atmdev.h18
-rw-r--r--net/atm/atm_misc.c11
-rw-r--r--net/atm/common.c66
-rw-r--r--net/atm/common.h2
-rw-r--r--net/atm/resources.c78
-rw-r--r--net/atm/resources.h3
-rw-r--r--net/ipv4/fib_hash.c2
-rw-r--r--net/ipv4/fib_semantics.c2
-rw-r--r--net/ipv4/icmp.c4
-rw-r--r--net/ipv4/ip_gre.c2
-rw-r--r--net/ipv4/ip_output.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_conn.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c4
-rw-r--r--net/ipv4/ipvs/ip_vs_proto_tcp.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_amanda.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_core.c4
-rw-r--r--net/ipv4/netfilter/ip_conntrack_ftp.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_irc.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_icmp.c4
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_sctp.c4
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_tcp.c6
-rw-r--r--net/ipv4/netfilter/ip_nat_core.c2
-rw-r--r--net/ipv4/netfilter/ip_tables.c2
-rw-r--r--net/ipv4/netfilter/ipt_LOG.c4
-rw-r--r--net/ipv4/proc.c10
-rw-r--r--net/ipv4/route.c5
-rw-r--r--net/ipv4/tcp.c8
-rw-r--r--net/ipv6/icmp.c2
-rw-r--r--net/ipv6/ip6_output.c3
-rw-r--r--net/ipv6/ipv6_sockglue.c4
-rw-r--r--net/ipv6/netfilter/ip6_tables.c2
38 files changed, 320 insertions, 300 deletions
diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig
index 489de81ea609..01a9f1cb7743 100644
--- a/drivers/atm/Kconfig
+++ b/drivers/atm/Kconfig
@@ -5,6 +5,13 @@
5menu "ATM drivers" 5menu "ATM drivers"
6 depends on NETDEVICES && ATM 6 depends on NETDEVICES && ATM
7 7
8config ATM_DUMMY
9 tristate "Dummy ATM driver"
10 depends on ATM
11 help
12 Dummy ATM driver. Useful for proxy signalling, testing,
13 and development. If unsure, say N.
14
8config ATM_TCP 15config ATM_TCP
9 tristate "ATM over TCP" 16 tristate "ATM over TCP"
10 depends on INET && ATM 17 depends on INET && ATM
diff --git a/drivers/atm/Makefile b/drivers/atm/Makefile
index 5b77188527a9..b5077ce8cb40 100644
--- a/drivers/atm/Makefile
+++ b/drivers/atm/Makefile
@@ -31,6 +31,7 @@ ifeq ($(CONFIG_ATM_IDT77252_USE_SUNI),y)
31 obj-$(CONFIG_ATM_IDT77252) += suni.o 31 obj-$(CONFIG_ATM_IDT77252) += suni.o
32endif 32endif
33 33
34obj-$(CONFIG_ATM_DUMMY) += adummy.o
34obj-$(CONFIG_ATM_TCP) += atmtcp.o 35obj-$(CONFIG_ATM_TCP) += atmtcp.o
35obj-$(CONFIG_ATM_FIRESTREAM) += firestream.o 36obj-$(CONFIG_ATM_FIRESTREAM) += firestream.o
36obj-$(CONFIG_ATM_LANAI) += lanai.o 37obj-$(CONFIG_ATM_LANAI) += lanai.o
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
new file mode 100644
index 000000000000..d15c194be44a
--- /dev/null
+++ b/drivers/atm/adummy.c
@@ -0,0 +1,168 @@
1/*
2 * adummy.c: a dummy ATM driver
3 */
4
5#include <linux/config.h>
6#include <linux/module.h>
7#include <linux/version.h>
8#include <linux/kernel.h>
9#include <linux/skbuff.h>
10#include <linux/pci.h>
11#include <linux/errno.h>
12#include <linux/types.h>
13#include <linux/string.h>
14#include <linux/delay.h>
15#include <linux/init.h>
16#include <linux/mm.h>
17#include <linux/sched.h>
18#include <linux/timer.h>
19#include <linux/interrupt.h>
20#include <asm/io.h>
21#include <asm/byteorder.h>
22#include <asm/uaccess.h>
23
24#include <linux/atmdev.h>
25#include <linux/atm.h>
26#include <linux/sonet.h>
27
28/* version definition */
29
30#define DRV_VERSION "1.0"
31
32#define DEV_LABEL "adummy"
33
34#define ADUMMY_DEV(dev) ((struct adummy_dev *) (dev)->dev_data)
35
36struct adummy_dev {
37 struct atm_dev *atm_dev;
38
39 struct list_head entry;
40};
41
42/* globals */
43
44static LIST_HEAD(adummy_devs);
45
46static int __init
47adummy_start(struct atm_dev *dev)
48{
49 dev->ci_range.vpi_bits = 4;
50 dev->ci_range.vci_bits = 12;
51
52 return 0;
53}
54
55static int
56adummy_open(struct atm_vcc *vcc)
57{
58 short vpi = vcc->vpi;
59 int vci = vcc->vci;
60
61 if (vci == ATM_VCI_UNSPEC || vpi == ATM_VPI_UNSPEC)
62 return 0;
63
64 set_bit(ATM_VF_ADDR, &vcc->flags);
65 set_bit(ATM_VF_READY, &vcc->flags);
66
67 return 0;
68}
69
70static void
71adummy_close(struct atm_vcc *vcc)
72{
73 clear_bit(ATM_VF_READY, &vcc->flags);
74 clear_bit(ATM_VF_ADDR, &vcc->flags);
75}
76
77static int
78adummy_send(struct atm_vcc *vcc, struct sk_buff *skb)
79{
80 if (vcc->pop)
81 vcc->pop(vcc, skb);
82 else
83 dev_kfree_skb_any(skb);
84 atomic_inc(&vcc->stats->tx);
85
86 return 0;
87}
88
89static int
90adummy_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
91{
92 int left = *pos;
93
94 if (!left--)
95 return sprintf(page, "version %s\n", DRV_VERSION);
96
97 return 0;
98}
99
100static struct atmdev_ops adummy_ops =
101{
102 .open = adummy_open,
103 .close = adummy_close,
104 .send = adummy_send,
105 .proc_read = adummy_proc_read,
106 .owner = THIS_MODULE
107};
108
109static int __init adummy_init(void)
110{
111 struct atm_dev *atm_dev;
112 struct adummy_dev *adummy_dev;
113 int err = 0;
114
115 printk(KERN_ERR "adummy: version %s\n", DRV_VERSION);
116
117 adummy_dev = (struct adummy_dev *) kmalloc(sizeof(struct adummy_dev),
118 GFP_KERNEL);
119 if (!adummy_dev) {
120 printk(KERN_ERR DEV_LABEL ": kmalloc() failed\n");
121 err = -ENOMEM;
122 goto out;
123 }
124 memset(adummy_dev, 0, sizeof(struct adummy_dev));
125
126 atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, 0);
127 if (!atm_dev) {
128 printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n");
129 err = -ENODEV;
130 goto out_kfree;
131 }
132
133 adummy_dev->atm_dev = atm_dev;
134 atm_dev->dev_data = adummy_dev;
135
136 if (adummy_start(atm_dev)) {
137 printk(KERN_ERR DEV_LABEL ": adummy_start() failed\n");
138 err = -ENODEV;
139 goto out_unregister;
140 }
141
142 list_add(&adummy_dev->entry, &adummy_devs);
143out:
144 return err;
145
146out_unregister:
147 atm_dev_deregister(atm_dev);
148out_kfree:
149 kfree(adummy_dev);
150 goto out;
151}
152
153static void __exit adummy_cleanup(void)
154{
155 struct adummy_dev *adummy_dev, *next;
156
157 list_for_each_entry_safe(adummy_dev, next, &adummy_devs, entry) {
158 atm_dev_deregister(adummy_dev->atm_dev);
159 kfree(adummy_dev);
160 }
161}
162
163module_init(adummy_init);
164module_exit(adummy_cleanup);
165
166MODULE_AUTHOR("chas williams <chas@cmf.nrl.navy.mil>");
167MODULE_DESCRIPTION("dummy ATM driver");
168MODULE_LICENSE("GPL");
diff --git a/drivers/atm/atmdev_init.c b/drivers/atm/atmdev_init.c
deleted file mode 100644
index 0e09e5c28e3f..000000000000
--- a/drivers/atm/atmdev_init.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/* drivers/atm/atmdev_init.c - ATM device driver initialization */
2
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4
5
6#include <linux/config.h>
7#include <linux/init.h>
8
9
10#ifdef CONFIG_ATM_ZATM
11extern int zatm_detect(void);
12#endif
13#ifdef CONFIG_ATM_AMBASSADOR
14extern int amb_detect(void);
15#endif
16#ifdef CONFIG_ATM_HORIZON
17extern int hrz_detect(void);
18#endif
19#ifdef CONFIG_ATM_FORE200E
20extern int fore200e_detect(void);
21#endif
22#ifdef CONFIG_ATM_LANAI
23extern int lanai_detect(void);
24#endif
25
26
27/*
28 * For historical reasons, atmdev_init returns the number of devices found.
29 * Note that some detections may not go via atmdev_init (e.g. eni.c), so this
30 * number is meaningless.
31 */
32
33int __init atmdev_init(void)
34{
35 int devs;
36
37 devs = 0;
38#ifdef CONFIG_ATM_ZATM
39 devs += zatm_detect();
40#endif
41#ifdef CONFIG_ATM_AMBASSADOR
42 devs += amb_detect();
43#endif
44#ifdef CONFIG_ATM_HORIZON
45 devs += hrz_detect();
46#endif
47#ifdef CONFIG_ATM_FORE200E
48 devs += fore200e_detect();
49#endif
50#ifdef CONFIG_ATM_LANAI
51 devs += lanai_detect();
52#endif
53 return devs;
54}
diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index 57f1810fdccd..fc518d85543d 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -246,10 +246,6 @@ static void atmtcp_c_close(struct atm_vcc *vcc)
246{ 246{
247 struct atm_dev *atmtcp_dev; 247 struct atm_dev *atmtcp_dev;
248 struct atmtcp_dev_data *dev_data; 248 struct atmtcp_dev_data *dev_data;
249 struct sock *s;
250 struct hlist_node *node;
251 struct atm_vcc *walk;
252 int i;
253 249
254 atmtcp_dev = (struct atm_dev *) vcc->dev_data; 250 atmtcp_dev = (struct atm_dev *) vcc->dev_data;
255 dev_data = PRIV(atmtcp_dev); 251 dev_data = PRIV(atmtcp_dev);
@@ -257,20 +253,8 @@ static void atmtcp_c_close(struct atm_vcc *vcc)
257 if (dev_data->persist) return; 253 if (dev_data->persist) return;
258 atmtcp_dev->dev_data = NULL; 254 atmtcp_dev->dev_data = NULL;
259 kfree(dev_data); 255 kfree(dev_data);
260 shutdown_atm_dev(atmtcp_dev); 256 atm_dev_deregister(atmtcp_dev);
261 vcc->dev_data = NULL; 257 vcc->dev_data = NULL;
262 read_lock(&vcc_sklist_lock);
263 for(i = 0; i < VCC_HTABLE_SIZE; ++i) {
264 struct hlist_head *head = &vcc_hash[i];
265
266 sk_for_each(s, node, head) {
267 walk = atm_sk(s);
268 if (walk->dev != atmtcp_dev)
269 continue;
270 wake_up(s->sk_sleep);
271 }
272 }
273 read_unlock(&vcc_sklist_lock);
274 module_put(THIS_MODULE); 258 module_put(THIS_MODULE);
275} 259}
276 260
@@ -450,7 +434,7 @@ static int atmtcp_remove_persistent(int itf)
450 if (PRIV(dev)->vcc) return 0; 434 if (PRIV(dev)->vcc) return 0;
451 kfree(dev_data); 435 kfree(dev_data);
452 atm_dev_put(dev); 436 atm_dev_put(dev);
453 shutdown_atm_dev(dev); 437 atm_dev_deregister(dev);
454 return 0; 438 return 0;
455} 439}
456 440
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 51ec14787293..69f4c7ce9a63 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -39,7 +39,7 @@
39 * o lanai_change_qos() isn't written yet 39 * o lanai_change_qos() isn't written yet
40 * 40 *
41 * o There aren't any ioctl's yet -- I'd like to eventually support 41 * o There aren't any ioctl's yet -- I'd like to eventually support
42 * setting loopback and LED modes that way. (see lanai_ioctl) 42 * setting loopback and LED modes that way.
43 * 43 *
44 * o If the segmentation engine or DMA gets shut down we should restart 44 * o If the segmentation engine or DMA gets shut down we should restart
45 * card as per section 17.0i. (see lanai_reset) 45 * card as per section 17.0i. (see lanai_reset)
@@ -305,7 +305,7 @@ struct lanai_dev {
305 * vci with their bit set 305 * vci with their bit set
306 */ 306 */
307static void vci_bitfield_iterate(struct lanai_dev *lanai, 307static void vci_bitfield_iterate(struct lanai_dev *lanai,
308 /*const*/ unsigned long *lp, 308 const unsigned long *lp,
309 void (*func)(struct lanai_dev *,vci_t vci)) 309 void (*func)(struct lanai_dev *,vci_t vci))
310{ 310{
311 vci_t vci = find_first_bit(lp, NUM_VCI); 311 vci_t vci = find_first_bit(lp, NUM_VCI);
@@ -951,7 +951,7 @@ static int __devinit eeprom_read(struct lanai_dev *lanai)
951/* read a big-endian 4-byte value out of eeprom */ 951/* read a big-endian 4-byte value out of eeprom */
952static inline u32 eeprom_be4(const struct lanai_dev *lanai, int address) 952static inline u32 eeprom_be4(const struct lanai_dev *lanai, int address)
953{ 953{
954 return be32_to_cpup((u32 *) (&lanai->eeprom[address])); 954 return be32_to_cpup((const u32 *) &lanai->eeprom[address]);
955} 955}
956 956
957/* Checksum/validate EEPROM contents */ 957/* Checksum/validate EEPROM contents */
@@ -1160,7 +1160,7 @@ static inline int vcc_tx_space(const struct lanai_vcc *lvcc, int endptr)
1160} 1160}
1161 1161
1162/* test if VCC is currently backlogged */ 1162/* test if VCC is currently backlogged */
1163static inline int vcc_is_backlogged(/*const*/ struct lanai_vcc *lvcc) 1163static inline int vcc_is_backlogged(const struct lanai_vcc *lvcc)
1164{ 1164{
1165 return !skb_queue_empty(&lvcc->tx.backlog); 1165 return !skb_queue_empty(&lvcc->tx.backlog);
1166} 1166}
@@ -1395,7 +1395,8 @@ static void vcc_rx_aal5(struct lanai_vcc *lvcc, int endptr)
1395{ 1395{
1396 int size; 1396 int size;
1397 struct sk_buff *skb; 1397 struct sk_buff *skb;
1398 /*const*/ u32 *x, *end = &lvcc->rx.buf.start[endptr * 4]; 1398 const u32 *x;
1399 u32 *end = &lvcc->rx.buf.start[endptr * 4];
1399 int n = ((unsigned long) end) - ((unsigned long) lvcc->rx.buf.ptr); 1400 int n = ((unsigned long) end) - ((unsigned long) lvcc->rx.buf.ptr);
1400 if (n < 0) 1401 if (n < 0)
1401 n += lanai_buf_size(&lvcc->rx.buf); 1402 n += lanai_buf_size(&lvcc->rx.buf);
@@ -2111,7 +2112,7 @@ static int lanai_normalize_ci(struct lanai_dev *lanai,
2111 * shifted by that much as we compute 2112 * shifted by that much as we compute
2112 * 2113 *
2113 */ 2114 */
2114static int pcr_to_cbricg(/*const*/ struct atm_qos *qos) 2115static int pcr_to_cbricg(const struct atm_qos *qos)
2115{ 2116{
2116 int rounddown = 0; /* 1 = Round PCR down, i.e. round ICG _up_ */ 2117 int rounddown = 0; /* 1 = Round PCR down, i.e. round ICG _up_ */
2117 int x, icg, pcr = atm_pcr_goal(&qos->txtp); 2118 int x, icg, pcr = atm_pcr_goal(&qos->txtp);
@@ -2434,93 +2435,6 @@ static int lanai_open(struct atm_vcc *atmvcc)
2434 return result; 2435 return result;
2435} 2436}
2436 2437
2437#if 0
2438/* ioctl operations for card */
2439/* NOTE: these are all DEBUGGING ONLY currently */
2440static int lanai_ioctl(struct atm_dev *atmdev, unsigned int cmd, void __user *arg)
2441{
2442 int result = 0;
2443 struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data;
2444 switch(cmd) {
2445 case 2106275:
2446 shutdown_atm_dev(atmdev);
2447 return 0;
2448 case 2200000: {
2449 unsigned long flags;
2450 spin_lock_irqsave(&lanai->servicelock, flags);
2451 run_service(lanai);
2452 spin_unlock_irqrestore(&lanai->servicelock, flags);
2453 return 0; }
2454 case 2200002:
2455 get_statistics(lanai);
2456 return 0;
2457 case 2200003: {
2458 unsigned int i;
2459 for (i = 0; i <= 0x5C ; i += 4) {
2460 if (i==0x48) /* Write-only butt reg */
2461 continue;
2462 printk(KERN_CRIT DEV_LABEL " 0x%02X: "
2463 "0x%08X\n", i,
2464 (unsigned int) readl(lanai->base + i));
2465 barrier(); mb();
2466 pcistatus_check(lanai, 0);
2467 barrier(); mb();
2468 }
2469 return 0; }
2470 case 2200004: {
2471 u8 b;
2472 u16 w;
2473 u32 dw;
2474 struct pci_dev *pci = lanai->pci;
2475 (void) pci_read_config_word(pci, PCI_VENDOR_ID, &w);
2476 DPRINTK("vendor = 0x%X\n", (unsigned int) w);
2477 (void) pci_read_config_word(pci, PCI_DEVICE_ID, &w);
2478 DPRINTK("device = 0x%X\n", (unsigned int) w);
2479 (void) pci_read_config_word(pci, PCI_COMMAND, &w);
2480 DPRINTK("command = 0x%X\n", (unsigned int) w);
2481 (void) pci_read_config_word(pci, PCI_STATUS, &w);
2482 DPRINTK("status = 0x%X\n", (unsigned int) w);
2483 (void) pci_read_config_dword(pci,
2484 PCI_CLASS_REVISION, &dw);
2485 DPRINTK("class/revision = 0x%X\n", (unsigned int) dw);
2486 (void) pci_read_config_byte(pci,
2487 PCI_CACHE_LINE_SIZE, &b);
2488 DPRINTK("cache line size = 0x%X\n", (unsigned int) b);
2489 (void) pci_read_config_byte(pci, PCI_LATENCY_TIMER, &b);
2490 DPRINTK("latency = %d (0x%X)\n",
2491 (int) b, (unsigned int) b);
2492 (void) pci_read_config_byte(pci, PCI_HEADER_TYPE, &b);
2493 DPRINTK("header type = 0x%X\n", (unsigned int) b);
2494 (void) pci_read_config_byte(pci, PCI_BIST, &b);
2495 DPRINTK("bist = 0x%X\n", (unsigned int) b);
2496 /* skipping a few here */
2497 (void) pci_read_config_byte(pci,
2498 PCI_INTERRUPT_LINE, &b);
2499 DPRINTK("pci_int_line = 0x%X\n", (unsigned int) b);
2500 (void) pci_read_config_byte(pci,
2501 PCI_INTERRUPT_PIN, &b);
2502 DPRINTK("pci_int_pin = 0x%X\n", (unsigned int) b);
2503 (void) pci_read_config_byte(pci, PCI_MIN_GNT, &b);
2504 DPRINTK("min_gnt = 0x%X\n", (unsigned int) b);
2505 (void) pci_read_config_byte(pci, PCI_MAX_LAT, &b);
2506 DPRINTK("max_lat = 0x%X\n", (unsigned int) b); }
2507 return 0;
2508#ifdef USE_POWERDOWN
2509 case 2200005:
2510 DPRINTK("Coming out of powerdown\n");
2511 lanai->conf1 &= ~CONFIG1_POWERDOWN;
2512 conf1_write(lanai);
2513 return 0;
2514#endif
2515 default:
2516 result = -ENOIOCTLCMD;
2517 }
2518 return result;
2519}
2520#else /* !0 */
2521#define lanai_ioctl NULL
2522#endif /* 0 */
2523
2524static int lanai_send(struct atm_vcc *atmvcc, struct sk_buff *skb) 2438static int lanai_send(struct atm_vcc *atmvcc, struct sk_buff *skb)
2525{ 2439{
2526 struct lanai_vcc *lvcc = (struct lanai_vcc *) atmvcc->dev_data; 2440 struct lanai_vcc *lvcc = (struct lanai_vcc *) atmvcc->dev_data;
@@ -2678,7 +2592,6 @@ static const struct atmdev_ops ops = {
2678 .dev_close = lanai_dev_close, 2592 .dev_close = lanai_dev_close,
2679 .open = lanai_open, 2593 .open = lanai_open,
2680 .close = lanai_close, 2594 .close = lanai_close,
2681 .ioctl = lanai_ioctl,
2682 .getsockopt = NULL, 2595 .getsockopt = NULL,
2683 .setsockopt = NULL, 2596 .setsockopt = NULL,
2684 .send = lanai_send, 2597 .send = lanai_send,
@@ -2760,6 +2673,7 @@ static void __exit lanai_module_exit(void)
2760 * gone, so there isn't much to do 2673 * gone, so there isn't much to do
2761 */ 2674 */
2762 DPRINTK("cleanup_module()\n"); 2675 DPRINTK("cleanup_module()\n");
2676 pci_unregister_driver(&lanai_driver);
2763} 2677}
2764 2678
2765module_init(lanai_module_init); 2679module_init(lanai_module_init);
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index c466739428b2..2e6593e6c1bd 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -879,7 +879,7 @@ static int usbatm_atm_init(struct usbatm_data *instance)
879 879
880 fail: 880 fail:
881 instance->atm_dev = NULL; 881 instance->atm_dev = NULL;
882 shutdown_atm_dev(atm_dev); /* usbatm_atm_dev_close will eventually be called */ 882 atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be called */
883 return ret; 883 return ret;
884} 884}
885 885
@@ -1164,7 +1164,7 @@ void usbatm_usb_disconnect(struct usb_interface *intf)
1164 1164
1165 /* ATM finalize */ 1165 /* ATM finalize */
1166 if (instance->atm_dev) 1166 if (instance->atm_dev)
1167 shutdown_atm_dev(instance->atm_dev); 1167 atm_dev_deregister(instance->atm_dev);
1168 1168
1169 usbatm_put_instance(instance); /* taken in usbatm_usb_probe */ 1169 usbatm_put_instance(instance); /* taken in usbatm_usb_probe */
1170} 1170}
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index e7d0593bb576..b203ea82a0a8 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -7,7 +7,6 @@
7#define LINUX_ATMDEV_H 7#define LINUX_ATMDEV_H
8 8
9 9
10#include <linux/config.h>
11#include <linux/atmapi.h> 10#include <linux/atmapi.h>
12#include <linux/atm.h> 11#include <linux/atm.h>
13#include <linux/atmioc.h> 12#include <linux/atmioc.h>
@@ -210,6 +209,7 @@ struct atm_cirange {
210 209
211#ifdef __KERNEL__ 210#ifdef __KERNEL__
212 211
212#include <linux/config.h>
213#include <linux/wait.h> /* wait_queue_head_t */ 213#include <linux/wait.h> /* wait_queue_head_t */
214#include <linux/time.h> /* struct timeval */ 214#include <linux/time.h> /* struct timeval */
215#include <linux/net.h> 215#include <linux/net.h>
@@ -274,7 +274,7 @@ enum {
274 274
275 275
276enum { 276enum {
277 ATM_DF_CLOSE, /* close device when last VCC is closed */ 277 ATM_DF_REMOVED, /* device was removed from atm_devs list */
278}; 278};
279 279
280 280
@@ -415,7 +415,6 @@ struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
415 int number,unsigned long *flags); /* number == -1: pick first available */ 415 int number,unsigned long *flags); /* number == -1: pick first available */
416struct atm_dev *atm_dev_lookup(int number); 416struct atm_dev *atm_dev_lookup(int number);
417void atm_dev_deregister(struct atm_dev *dev); 417void atm_dev_deregister(struct atm_dev *dev);
418void shutdown_atm_dev(struct atm_dev *dev);
419void vcc_insert_socket(struct sock *sk); 418void vcc_insert_socket(struct sock *sk);
420 419
421 420
@@ -457,18 +456,19 @@ static inline void atm_dev_hold(struct atm_dev *dev)
457 456
458static inline void atm_dev_put(struct atm_dev *dev) 457static inline void atm_dev_put(struct atm_dev *dev)
459{ 458{
460 atomic_dec(&dev->refcnt); 459 if (atomic_dec_and_test(&dev->refcnt)) {
461 460 BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags));
462 if ((atomic_read(&dev->refcnt) == 1) && 461 if (dev->ops->dev_close)
463 test_bit(ATM_DF_CLOSE,&dev->flags)) 462 dev->ops->dev_close(dev);
464 shutdown_atm_dev(dev); 463 kfree(dev);
464 }
465} 465}
466 466
467 467
468int atm_charge(struct atm_vcc *vcc,int truesize); 468int atm_charge(struct atm_vcc *vcc,int truesize);
469struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, 469struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
470 gfp_t gfp_flags); 470 gfp_t gfp_flags);
471int atm_pcr_goal(struct atm_trafprm *tp); 471int atm_pcr_goal(const struct atm_trafprm *tp);
472 472
473void vcc_release_async(struct atm_vcc *vcc, int reply); 473void vcc_release_async(struct atm_vcc *vcc, int reply);
474 474
diff --git a/net/atm/atm_misc.c b/net/atm/atm_misc.c
index 223c7ad5bd0f..02cc7e71efea 100644
--- a/net/atm/atm_misc.c
+++ b/net/atm/atm_misc.c
@@ -74,11 +74,14 @@ struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
74 */ 74 */
75 75
76 76
77int atm_pcr_goal(struct atm_trafprm *tp) 77int atm_pcr_goal(const struct atm_trafprm *tp)
78{ 78{
79 if (tp->pcr && tp->pcr != ATM_MAX_PCR) return -tp->pcr; 79 if (tp->pcr && tp->pcr != ATM_MAX_PCR)
80 if (tp->min_pcr && !tp->pcr) return tp->min_pcr; 80 return -tp->pcr;
81 if (tp->max_pcr != ATM_MAX_PCR) return -tp->max_pcr; 81 if (tp->min_pcr && !tp->pcr)
82 return tp->min_pcr;
83 if (tp->max_pcr != ATM_MAX_PCR)
84 return -tp->max_pcr;
82 return 0; 85 return 0;
83} 86}
84 87
diff --git a/net/atm/common.c b/net/atm/common.c
index 63feea49fb13..6656b111cc05 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -221,6 +221,29 @@ void vcc_release_async(struct atm_vcc *vcc, int reply)
221EXPORT_SYMBOL(vcc_release_async); 221EXPORT_SYMBOL(vcc_release_async);
222 222
223 223
224void atm_dev_release_vccs(struct atm_dev *dev)
225{
226 int i;
227
228 write_lock_irq(&vcc_sklist_lock);
229 for (i = 0; i < VCC_HTABLE_SIZE; i++) {
230 struct hlist_head *head = &vcc_hash[i];
231 struct hlist_node *node, *tmp;
232 struct sock *s;
233 struct atm_vcc *vcc;
234
235 sk_for_each_safe(s, node, tmp, head) {
236 vcc = atm_sk(s);
237 if (vcc->dev == dev) {
238 vcc_release_async(vcc, -EPIPE);
239 sk_del_node_init(s);
240 }
241 }
242 }
243 write_unlock_irq(&vcc_sklist_lock);
244}
245
246
224static int adjust_tp(struct atm_trafprm *tp,unsigned char aal) 247static int adjust_tp(struct atm_trafprm *tp,unsigned char aal)
225{ 248{
226 int max_sdu; 249 int max_sdu;
@@ -332,12 +355,13 @@ static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi,
332 return -EINVAL; 355 return -EINVAL;
333 if (vci > 0 && vci < ATM_NOT_RSV_VCI && !capable(CAP_NET_BIND_SERVICE)) 356 if (vci > 0 && vci < ATM_NOT_RSV_VCI && !capable(CAP_NET_BIND_SERVICE))
334 return -EPERM; 357 return -EPERM;
335 error = 0; 358 error = -ENODEV;
336 if (!try_module_get(dev->ops->owner)) 359 if (!try_module_get(dev->ops->owner))
337 return -ENODEV; 360 return error;
338 vcc->dev = dev; 361 vcc->dev = dev;
339 write_lock_irq(&vcc_sklist_lock); 362 write_lock_irq(&vcc_sklist_lock);
340 if ((error = find_ci(vcc, &vpi, &vci))) { 363 if (test_bit(ATM_DF_REMOVED, &dev->flags) ||
364 (error = find_ci(vcc, &vpi, &vci))) {
341 write_unlock_irq(&vcc_sklist_lock); 365 write_unlock_irq(&vcc_sklist_lock);
342 goto fail_module_put; 366 goto fail_module_put;
343 } 367 }
@@ -423,33 +447,23 @@ int vcc_connect(struct socket *sock, int itf, short vpi, int vci)
423 if (vcc->qos.txtp.traffic_class == ATM_ANYCLASS || 447 if (vcc->qos.txtp.traffic_class == ATM_ANYCLASS ||
424 vcc->qos.rxtp.traffic_class == ATM_ANYCLASS) 448 vcc->qos.rxtp.traffic_class == ATM_ANYCLASS)
425 return -EINVAL; 449 return -EINVAL;
426 if (itf != ATM_ITF_ANY) { 450 if (likely(itf != ATM_ITF_ANY)) {
427 dev = atm_dev_lookup(itf); 451 dev = try_then_request_module(atm_dev_lookup(itf), "atm-device-%d", itf);
428 if (!dev)
429 return -ENODEV;
430 error = __vcc_connect(vcc, dev, vpi, vci);
431 if (error) {
432 atm_dev_put(dev);
433 return error;
434 }
435 } else { 452 } else {
436 struct list_head *p, *next;
437
438 dev = NULL; 453 dev = NULL;
439 spin_lock(&atm_dev_lock); 454 down(&atm_dev_mutex);
440 list_for_each_safe(p, next, &atm_devs) { 455 if (!list_empty(&atm_devs)) {
441 dev = list_entry(p, struct atm_dev, dev_list); 456 dev = list_entry(atm_devs.next, struct atm_dev, dev_list);
442 atm_dev_hold(dev); 457 atm_dev_hold(dev);
443 spin_unlock(&atm_dev_lock);
444 if (!__vcc_connect(vcc, dev, vpi, vci))
445 break;
446 atm_dev_put(dev);
447 dev = NULL;
448 spin_lock(&atm_dev_lock);
449 } 458 }
450 spin_unlock(&atm_dev_lock); 459 up(&atm_dev_mutex);
451 if (!dev) 460 }
452 return -ENODEV; 461 if (!dev)
462 return -ENODEV;
463 error = __vcc_connect(vcc, dev, vpi, vci);
464 if (error) {
465 atm_dev_put(dev);
466 return error;
453 } 467 }
454 if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC) 468 if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC)
455 set_bit(ATM_VF_PARTIAL,&vcc->flags); 469 set_bit(ATM_VF_PARTIAL,&vcc->flags);
diff --git a/net/atm/common.h b/net/atm/common.h
index e49ed41c0e33..4887c317cefe 100644
--- a/net/atm/common.h
+++ b/net/atm/common.h
@@ -47,4 +47,6 @@ static inline void atm_proc_exit(void)
47/* SVC */ 47/* SVC */
48int svc_change_qos(struct atm_vcc *vcc,struct atm_qos *qos); 48int svc_change_qos(struct atm_vcc *vcc,struct atm_qos *qos);
49 49
50void atm_dev_release_vccs(struct atm_dev *dev);
51
50#endif 52#endif
diff --git a/net/atm/resources.c b/net/atm/resources.c
index 415d2615d475..c8c459fcb038 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -25,7 +25,7 @@
25 25
26 26
27LIST_HEAD(atm_devs); 27LIST_HEAD(atm_devs);
28DEFINE_SPINLOCK(atm_dev_lock); 28DECLARE_MUTEX(atm_dev_mutex);
29 29
30static struct atm_dev *__alloc_atm_dev(const char *type) 30static struct atm_dev *__alloc_atm_dev(const char *type)
31{ 31{
@@ -52,7 +52,7 @@ static struct atm_dev *__atm_dev_lookup(int number)
52 52
53 list_for_each(p, &atm_devs) { 53 list_for_each(p, &atm_devs) {
54 dev = list_entry(p, struct atm_dev, dev_list); 54 dev = list_entry(p, struct atm_dev, dev_list);
55 if ((dev->ops) && (dev->number == number)) { 55 if (dev->number == number) {
56 atm_dev_hold(dev); 56 atm_dev_hold(dev);
57 return dev; 57 return dev;
58 } 58 }
@@ -64,12 +64,13 @@ struct atm_dev *atm_dev_lookup(int number)
64{ 64{
65 struct atm_dev *dev; 65 struct atm_dev *dev;
66 66
67 spin_lock(&atm_dev_lock); 67 down(&atm_dev_mutex);
68 dev = __atm_dev_lookup(number); 68 dev = __atm_dev_lookup(number);
69 spin_unlock(&atm_dev_lock); 69 up(&atm_dev_mutex);
70 return dev; 70 return dev;
71} 71}
72 72
73
73struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, 74struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
74 int number, unsigned long *flags) 75 int number, unsigned long *flags)
75{ 76{
@@ -81,11 +82,11 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
81 type); 82 type);
82 return NULL; 83 return NULL;
83 } 84 }
84 spin_lock(&atm_dev_lock); 85 down(&atm_dev_mutex);
85 if (number != -1) { 86 if (number != -1) {
86 if ((inuse = __atm_dev_lookup(number))) { 87 if ((inuse = __atm_dev_lookup(number))) {
87 atm_dev_put(inuse); 88 atm_dev_put(inuse);
88 spin_unlock(&atm_dev_lock); 89 up(&atm_dev_mutex);
89 kfree(dev); 90 kfree(dev);
90 return NULL; 91 return NULL;
91 } 92 }
@@ -105,19 +106,17 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
105 memset(&dev->flags, 0, sizeof(dev->flags)); 106 memset(&dev->flags, 0, sizeof(dev->flags));
106 memset(&dev->stats, 0, sizeof(dev->stats)); 107 memset(&dev->stats, 0, sizeof(dev->stats));
107 atomic_set(&dev->refcnt, 1); 108 atomic_set(&dev->refcnt, 1);
108 list_add_tail(&dev->dev_list, &atm_devs);
109 spin_unlock(&atm_dev_lock);
110 109
111 if (atm_proc_dev_register(dev) < 0) { 110 if (atm_proc_dev_register(dev) < 0) {
112 printk(KERN_ERR "atm_dev_register: " 111 printk(KERN_ERR "atm_dev_register: "
113 "atm_proc_dev_register failed for dev %s\n", 112 "atm_proc_dev_register failed for dev %s\n",
114 type); 113 type);
115 spin_lock(&atm_dev_lock); 114 up(&atm_dev_mutex);
116 list_del(&dev->dev_list);
117 spin_unlock(&atm_dev_lock);
118 kfree(dev); 115 kfree(dev);
119 return NULL; 116 return NULL;
120 } 117 }
118 list_add_tail(&dev->dev_list, &atm_devs);
119 up(&atm_dev_mutex);
121 120
122 return dev; 121 return dev;
123} 122}
@@ -125,37 +124,22 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
125 124
126void atm_dev_deregister(struct atm_dev *dev) 125void atm_dev_deregister(struct atm_dev *dev)
127{ 126{
128 unsigned long warning_time; 127 BUG_ON(test_bit(ATM_DF_REMOVED, &dev->flags));
128 set_bit(ATM_DF_REMOVED, &dev->flags);
129
130 /*
131 * if we remove current device from atm_devs list, new device
132 * with same number can appear, such we need deregister proc,
133 * release async all vccs and remove them from vccs list too
134 */
135 down(&atm_dev_mutex);
136 list_del(&dev->dev_list);
137 up(&atm_dev_mutex);
129 138
139 atm_dev_release_vccs(dev);
130 atm_proc_dev_deregister(dev); 140 atm_proc_dev_deregister(dev);
131 141
132 spin_lock(&atm_dev_lock); 142 atm_dev_put(dev);
133 list_del(&dev->dev_list);
134 spin_unlock(&atm_dev_lock);
135
136 warning_time = jiffies;
137 while (atomic_read(&dev->refcnt) != 1) {
138 msleep(250);
139 if ((jiffies - warning_time) > 10 * HZ) {
140 printk(KERN_EMERG "atm_dev_deregister: waiting for "
141 "dev %d to become free. Usage count = %d\n",
142 dev->number, atomic_read(&dev->refcnt));
143 warning_time = jiffies;
144 }
145 }
146
147 kfree(dev);
148}
149
150void shutdown_atm_dev(struct atm_dev *dev)
151{
152 if (atomic_read(&dev->refcnt) > 1) {
153 set_bit(ATM_DF_CLOSE, &dev->flags);
154 return;
155 }
156 if (dev->ops->dev_close)
157 dev->ops->dev_close(dev);
158 atm_dev_deregister(dev);
159} 143}
160 144
161 145
@@ -211,16 +195,16 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
211 return -EFAULT; 195 return -EFAULT;
212 if (get_user(len, &iobuf->length)) 196 if (get_user(len, &iobuf->length))
213 return -EFAULT; 197 return -EFAULT;
214 spin_lock(&atm_dev_lock); 198 down(&atm_dev_mutex);
215 list_for_each(p, &atm_devs) 199 list_for_each(p, &atm_devs)
216 size += sizeof(int); 200 size += sizeof(int);
217 if (size > len) { 201 if (size > len) {
218 spin_unlock(&atm_dev_lock); 202 up(&atm_dev_mutex);
219 return -E2BIG; 203 return -E2BIG;
220 } 204 }
221 tmp_buf = kmalloc(size, GFP_ATOMIC); 205 tmp_buf = kmalloc(size, GFP_ATOMIC);
222 if (!tmp_buf) { 206 if (!tmp_buf) {
223 spin_unlock(&atm_dev_lock); 207 up(&atm_dev_mutex);
224 return -ENOMEM; 208 return -ENOMEM;
225 } 209 }
226 tmp_p = tmp_buf; 210 tmp_p = tmp_buf;
@@ -228,7 +212,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
228 dev = list_entry(p, struct atm_dev, dev_list); 212 dev = list_entry(p, struct atm_dev, dev_list);
229 *tmp_p++ = dev->number; 213 *tmp_p++ = dev->number;
230 } 214 }
231 spin_unlock(&atm_dev_lock); 215 up(&atm_dev_mutex);
232 error = ((copy_to_user(buf, tmp_buf, size)) || 216 error = ((copy_to_user(buf, tmp_buf, size)) ||
233 put_user(size, &iobuf->length)) 217 put_user(size, &iobuf->length))
234 ? -EFAULT : 0; 218 ? -EFAULT : 0;
@@ -245,7 +229,8 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
245 if (get_user(number, &sioc->number)) 229 if (get_user(number, &sioc->number))
246 return -EFAULT; 230 return -EFAULT;
247 231
248 if (!(dev = atm_dev_lookup(number))) 232 if (!(dev = try_then_request_module(atm_dev_lookup(number),
233 "atm-device-%d", number)))
249 return -ENODEV; 234 return -ENODEV;
250 235
251 switch (cmd) { 236 switch (cmd) {
@@ -414,13 +399,13 @@ static __inline__ void *dev_get_idx(loff_t left)
414 399
415void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos) 400void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos)
416{ 401{
417 spin_lock(&atm_dev_lock); 402 down(&atm_dev_mutex);
418 return *pos ? dev_get_idx(*pos) : (void *) 1; 403 return *pos ? dev_get_idx(*pos) : (void *) 1;
419} 404}
420 405
421void atm_dev_seq_stop(struct seq_file *seq, void *v) 406void atm_dev_seq_stop(struct seq_file *seq, void *v)
422{ 407{
423 spin_unlock(&atm_dev_lock); 408 up(&atm_dev_mutex);
424} 409}
425 410
426void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) 411void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
@@ -434,4 +419,3 @@ void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
434EXPORT_SYMBOL(atm_dev_register); 419EXPORT_SYMBOL(atm_dev_register);
435EXPORT_SYMBOL(atm_dev_deregister); 420EXPORT_SYMBOL(atm_dev_deregister);
436EXPORT_SYMBOL(atm_dev_lookup); 421EXPORT_SYMBOL(atm_dev_lookup);
437EXPORT_SYMBOL(shutdown_atm_dev);
diff --git a/net/atm/resources.h b/net/atm/resources.h
index 12910619dbb6..b7fb82a93b42 100644
--- a/net/atm/resources.h
+++ b/net/atm/resources.h
@@ -11,8 +11,7 @@
11 11
12 12
13extern struct list_head atm_devs; 13extern struct list_head atm_devs;
14extern spinlock_t atm_dev_lock; 14extern struct semaphore atm_dev_mutex;
15
16 15
17int atm_dev_ioctl(unsigned int cmd, void __user *arg); 16int atm_dev_ioctl(unsigned int cmd, void __user *arg);
18 17
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index 2a8c9afc3695..7ea0209cb169 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -975,7 +975,7 @@ static void fib_seq_stop(struct seq_file *seq, void *v)
975 975
976static unsigned fib_flag_trans(int type, u32 mask, struct fib_info *fi) 976static unsigned fib_flag_trans(int type, u32 mask, struct fib_info *fi)
977{ 977{
978 static unsigned type2flags[RTN_MAX + 1] = { 978 static const unsigned type2flags[RTN_MAX + 1] = {
979 [7] = RTF_REJECT, [8] = RTF_REJECT, 979 [7] = RTF_REJECT, [8] = RTF_REJECT,
980 }; 980 };
981 unsigned flags = type2flags[type]; 981 unsigned flags = type2flags[type];
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 186f20c4a45e..6d2a6ac070e3 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -83,7 +83,7 @@ for (nhsel=0; nhsel < 1; nhsel++)
83#define endfor_nexthops(fi) } 83#define endfor_nexthops(fi) }
84 84
85 85
86static struct 86static const struct
87{ 87{
88 int error; 88 int error;
89 u8 scope; 89 u8 scope;
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index e3eceecd0496..92e23b2ad4d2 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -220,7 +220,7 @@ struct icmp_control {
220 short error; /* This ICMP is classed as an error message */ 220 short error; /* This ICMP is classed as an error message */
221}; 221};
222 222
223static struct icmp_control icmp_pointers[NR_ICMP_TYPES+1]; 223static const struct icmp_control icmp_pointers[NR_ICMP_TYPES+1];
224 224
225/* 225/*
226 * The ICMP socket(s). This is the most convenient way to flow control 226 * The ICMP socket(s). This is the most convenient way to flow control
@@ -994,7 +994,7 @@ error:
994/* 994/*
995 * This table is the definition of how we handle ICMP. 995 * This table is the definition of how we handle ICMP.
996 */ 996 */
997static struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = { 997static const struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
998 [ICMP_ECHOREPLY] = { 998 [ICMP_ECHOREPLY] = {
999 .output_entry = ICMP_MIB_OUTECHOREPS, 999 .output_entry = ICMP_MIB_OUTECHOREPS,
1000 .input_entry = ICMP_MIB_INECHOREPS, 1000 .input_entry = ICMP_MIB_INECHOREPS,
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 4e9c74b54b15..a4c347c3b8e3 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1217,7 +1217,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
1217 return 0; 1217 return 0;
1218} 1218}
1219 1219
1220int __init ipgre_fb_tunnel_init(struct net_device *dev) 1220static int __init ipgre_fb_tunnel_init(struct net_device *dev)
1221{ 1221{
1222 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 1222 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv;
1223 struct iphdr *iph = &tunnel->parms.iph; 1223 struct iphdr *iph = &tunnel->parms.iph;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 11c2f68254f0..eba64e2bd397 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -690,7 +690,7 @@ csum_page(struct page *page, int offset, int copy)
690 return csum; 690 return csum;
691} 691}
692 692
693inline int ip_ufo_append_data(struct sock *sk, 693static inline int ip_ufo_append_data(struct sock *sk,
694 int getfrag(void *from, char *to, int offset, int len, 694 int getfrag(void *from, char *to, int offset, int len,
695 int odd, struct sk_buff *skb), 695 int odd, struct sk_buff *skb),
696 void *from, int length, int hh_len, int fragheaderlen, 696 void *from, int length, int hh_len, int fragheaderlen,
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c
index f828fa2eb7de..2a3a8c59c655 100644
--- a/net/ipv4/ipvs/ip_vs_conn.c
+++ b/net/ipv4/ipvs/ip_vs_conn.c
@@ -771,7 +771,7 @@ static inline int todrop_entry(struct ip_vs_conn *cp)
771 * The drop rate array needs tuning for real environments. 771 * The drop rate array needs tuning for real environments.
772 * Called from timer bh only => no locking 772 * Called from timer bh only => no locking
773 */ 773 */
774 static char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; 774 static const char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
775 static char todrop_counter[9] = {0}; 775 static char todrop_counter[9] = {0};
776 int i; 776 int i;
777 777
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index 2d66848e7aa0..9bdcf31b760e 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -1909,7 +1909,7 @@ static int ip_vs_set_timeout(struct ip_vs_timeout_user *u)
1909#define DAEMON_ARG_LEN (sizeof(struct ip_vs_daemon_user)) 1909#define DAEMON_ARG_LEN (sizeof(struct ip_vs_daemon_user))
1910#define MAX_ARG_LEN SVCDEST_ARG_LEN 1910#define MAX_ARG_LEN SVCDEST_ARG_LEN
1911 1911
1912static unsigned char set_arglen[SET_CMDID(IP_VS_SO_SET_MAX)+1] = { 1912static const unsigned char set_arglen[SET_CMDID(IP_VS_SO_SET_MAX)+1] = {
1913 [SET_CMDID(IP_VS_SO_SET_ADD)] = SERVICE_ARG_LEN, 1913 [SET_CMDID(IP_VS_SO_SET_ADD)] = SERVICE_ARG_LEN,
1914 [SET_CMDID(IP_VS_SO_SET_EDIT)] = SERVICE_ARG_LEN, 1914 [SET_CMDID(IP_VS_SO_SET_EDIT)] = SERVICE_ARG_LEN,
1915 [SET_CMDID(IP_VS_SO_SET_DEL)] = SERVICE_ARG_LEN, 1915 [SET_CMDID(IP_VS_SO_SET_DEL)] = SERVICE_ARG_LEN,
@@ -2180,7 +2180,7 @@ __ip_vs_get_timeouts(struct ip_vs_timeout_user *u)
2180#define GET_TIMEOUT_ARG_LEN (sizeof(struct ip_vs_timeout_user)) 2180#define GET_TIMEOUT_ARG_LEN (sizeof(struct ip_vs_timeout_user))
2181#define GET_DAEMON_ARG_LEN (sizeof(struct ip_vs_daemon_user) * 2) 2181#define GET_DAEMON_ARG_LEN (sizeof(struct ip_vs_daemon_user) * 2)
2182 2182
2183static unsigned char get_arglen[GET_CMDID(IP_VS_SO_GET_MAX)+1] = { 2183static const unsigned char get_arglen[GET_CMDID(IP_VS_SO_GET_MAX)+1] = {
2184 [GET_CMDID(IP_VS_SO_GET_VERSION)] = 64, 2184 [GET_CMDID(IP_VS_SO_GET_VERSION)] = 64,
2185 [GET_CMDID(IP_VS_SO_GET_INFO)] = GET_INFO_ARG_LEN, 2185 [GET_CMDID(IP_VS_SO_GET_INFO)] = GET_INFO_ARG_LEN,
2186 [GET_CMDID(IP_VS_SO_GET_SERVICES)] = GET_SERVICES_ARG_LEN, 2186 [GET_CMDID(IP_VS_SO_GET_SERVICES)] = GET_SERVICES_ARG_LEN,
diff --git a/net/ipv4/ipvs/ip_vs_proto_tcp.c b/net/ipv4/ipvs/ip_vs_proto_tcp.c
index c19408973c09..0e878fd6215c 100644
--- a/net/ipv4/ipvs/ip_vs_proto_tcp.c
+++ b/net/ipv4/ipvs/ip_vs_proto_tcp.c
@@ -251,7 +251,7 @@ tcp_csum_check(struct sk_buff *skb, struct ip_vs_protocol *pp)
251#define TCP_DIR_OUTPUT 4 251#define TCP_DIR_OUTPUT 4
252#define TCP_DIR_INPUT_ONLY 8 252#define TCP_DIR_INPUT_ONLY 8
253 253
254static int tcp_state_off[IP_VS_DIR_LAST] = { 254static const int tcp_state_off[IP_VS_DIR_LAST] = {
255 [IP_VS_DIR_INPUT] = TCP_DIR_INPUT, 255 [IP_VS_DIR_INPUT] = TCP_DIR_INPUT,
256 [IP_VS_DIR_OUTPUT] = TCP_DIR_OUTPUT, 256 [IP_VS_DIR_OUTPUT] = TCP_DIR_OUTPUT,
257 [IP_VS_DIR_INPUT_ONLY] = TCP_DIR_INPUT_ONLY, 257 [IP_VS_DIR_INPUT_ONLY] = TCP_DIR_INPUT_ONLY,
diff --git a/net/ipv4/netfilter/ip_conntrack_amanda.c b/net/ipv4/netfilter/ip_conntrack_amanda.c
index fa3f914117ec..e52847fa10f5 100644
--- a/net/ipv4/netfilter/ip_conntrack_amanda.c
+++ b/net/ipv4/netfilter/ip_conntrack_amanda.c
@@ -37,7 +37,7 @@ MODULE_LICENSE("GPL");
37module_param(master_timeout, int, 0600); 37module_param(master_timeout, int, 0600);
38MODULE_PARM_DESC(master_timeout, "timeout for the master connection"); 38MODULE_PARM_DESC(master_timeout, "timeout for the master connection");
39 39
40static char *conns[] = { "DATA ", "MESG ", "INDEX " }; 40static const char *conns[] = { "DATA ", "MESG ", "INDEX " };
41 41
42/* This is slow, but it's simple. --RR */ 42/* This is slow, but it's simple. --RR */
43static char *amanda_buffer; 43static char *amanda_buffer;
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
index 422ab68ee7fb..7a4ecddd597b 100644
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -1354,7 +1354,7 @@ static void free_conntrack_hash(struct list_head *hash, int vmalloced,int size)
1354 get_order(sizeof(struct list_head) * size)); 1354 get_order(sizeof(struct list_head) * size));
1355} 1355}
1356 1356
1357void ip_conntrack_flush() 1357void ip_conntrack_flush(void)
1358{ 1358{
1359 /* This makes sure all current packets have passed through 1359 /* This makes sure all current packets have passed through
1360 netfilter framework. Roll on, two-stage module 1360 netfilter framework. Roll on, two-stage module
@@ -1408,7 +1408,7 @@ static struct list_head *alloc_hashtable(int size, int *vmalloced)
1408 return hash; 1408 return hash;
1409} 1409}
1410 1410
1411int set_hashsize(const char *val, struct kernel_param *kp) 1411static int set_hashsize(const char *val, struct kernel_param *kp)
1412{ 1412{
1413 int i, bucket, hashsize, vmalloced; 1413 int i, bucket, hashsize, vmalloced;
1414 int old_vmalloced, old_size; 1414 int old_vmalloced, old_size;
diff --git a/net/ipv4/netfilter/ip_conntrack_ftp.c b/net/ipv4/netfilter/ip_conntrack_ftp.c
index 59e12b02b22c..68b173bcda60 100644
--- a/net/ipv4/netfilter/ip_conntrack_ftp.c
+++ b/net/ipv4/netfilter/ip_conntrack_ftp.c
@@ -55,7 +55,7 @@ static int try_rfc959(const char *, size_t, u_int32_t [], char);
55static int try_eprt(const char *, size_t, u_int32_t [], char); 55static int try_eprt(const char *, size_t, u_int32_t [], char);
56static int try_epsv_response(const char *, size_t, u_int32_t [], char); 56static int try_epsv_response(const char *, size_t, u_int32_t [], char);
57 57
58static struct ftp_search { 58static const struct ftp_search {
59 enum ip_conntrack_dir dir; 59 enum ip_conntrack_dir dir;
60 const char *pattern; 60 const char *pattern;
61 size_t plen; 61 size_t plen;
diff --git a/net/ipv4/netfilter/ip_conntrack_irc.c b/net/ipv4/netfilter/ip_conntrack_irc.c
index 2dea1db14406..d7c40421d0d1 100644
--- a/net/ipv4/netfilter/ip_conntrack_irc.c
+++ b/net/ipv4/netfilter/ip_conntrack_irc.c
@@ -59,7 +59,7 @@ MODULE_PARM_DESC(max_dcc_channels, "max number of expected DCC channels per IRC
59module_param(dcc_timeout, int, 0400); 59module_param(dcc_timeout, int, 0400);
60MODULE_PARM_DESC(dcc_timeout, "timeout on for unestablished DCC channels"); 60MODULE_PARM_DESC(dcc_timeout, "timeout on for unestablished DCC channels");
61 61
62static char *dccprotos[] = { "SEND ", "CHAT ", "MOVE ", "TSEND ", "SCHAT " }; 62static const char *dccprotos[] = { "SEND ", "CHAT ", "MOVE ", "TSEND ", "SCHAT " };
63#define MINMATCHLEN 5 63#define MINMATCHLEN 5
64 64
65#if 0 65#if 0
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
index e4d6b268e8c4..5f9925db608e 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
@@ -51,7 +51,7 @@ static int icmp_invert_tuple(struct ip_conntrack_tuple *tuple,
51 const struct ip_conntrack_tuple *orig) 51 const struct ip_conntrack_tuple *orig)
52{ 52{
53 /* Add 1; spaces filled with 0. */ 53 /* Add 1; spaces filled with 0. */
54 static u_int8_t invmap[] 54 static const u_int8_t invmap[]
55 = { [ICMP_ECHO] = ICMP_ECHOREPLY + 1, 55 = { [ICMP_ECHO] = ICMP_ECHOREPLY + 1,
56 [ICMP_ECHOREPLY] = ICMP_ECHO + 1, 56 [ICMP_ECHOREPLY] = ICMP_ECHO + 1,
57 [ICMP_TIMESTAMP] = ICMP_TIMESTAMPREPLY + 1, 57 [ICMP_TIMESTAMP] = ICMP_TIMESTAMPREPLY + 1,
@@ -110,7 +110,7 @@ static int icmp_packet(struct ip_conntrack *ct,
110 return NF_ACCEPT; 110 return NF_ACCEPT;
111} 111}
112 112
113static u_int8_t valid_new[] = { 113static const u_int8_t valid_new[] = {
114 [ICMP_ECHO] = 1, 114 [ICMP_ECHO] = 1,
115 [ICMP_TIMESTAMP] = 1, 115 [ICMP_TIMESTAMP] = 1,
116 [ICMP_INFO_REQUEST] = 1, 116 [ICMP_INFO_REQUEST] = 1,
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c
index 59a4a0111dd3..977fb59d4563 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c
@@ -65,7 +65,7 @@ static unsigned long ip_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000;
65static unsigned long ip_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000; 65static unsigned long ip_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000;
66static unsigned long ip_ct_sctp_timeout_shutdown_ack_sent = 3 SECS; 66static unsigned long ip_ct_sctp_timeout_shutdown_ack_sent = 3 SECS;
67 67
68static unsigned long * sctp_timeouts[] 68static const unsigned long * sctp_timeouts[]
69= { NULL, /* SCTP_CONNTRACK_NONE */ 69= { NULL, /* SCTP_CONNTRACK_NONE */
70 &ip_ct_sctp_timeout_closed, /* SCTP_CONNTRACK_CLOSED */ 70 &ip_ct_sctp_timeout_closed, /* SCTP_CONNTRACK_CLOSED */
71 &ip_ct_sctp_timeout_cookie_wait, /* SCTP_CONNTRACK_COOKIE_WAIT */ 71 &ip_ct_sctp_timeout_cookie_wait, /* SCTP_CONNTRACK_COOKIE_WAIT */
@@ -118,7 +118,7 @@ cookie echoed to closed.
118*/ 118*/
119 119
120/* SCTP conntrack state transitions */ 120/* SCTP conntrack state transitions */
121static enum sctp_conntrack sctp_conntracks[2][9][SCTP_CONNTRACK_MAX] = { 121static const enum sctp_conntrack sctp_conntracks[2][9][SCTP_CONNTRACK_MAX] = {
122 { 122 {
123/* ORIGINAL */ 123/* ORIGINAL */
124/* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA */ 124/* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA */
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
index ee3b7d6c4d2e..625981676776 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
@@ -99,7 +99,7 @@ unsigned long ip_ct_tcp_timeout_close = 10 SECS;
99 to ~13-30min depending on RTO. */ 99 to ~13-30min depending on RTO. */
100unsigned long ip_ct_tcp_timeout_max_retrans = 5 MINS; 100unsigned long ip_ct_tcp_timeout_max_retrans = 5 MINS;
101 101
102static unsigned long * tcp_timeouts[] 102static const unsigned long * tcp_timeouts[]
103= { NULL, /* TCP_CONNTRACK_NONE */ 103= { NULL, /* TCP_CONNTRACK_NONE */
104 &ip_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */ 104 &ip_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */
105 &ip_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */ 105 &ip_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */
@@ -170,7 +170,7 @@ enum tcp_bit_set {
170 * if they are invalid 170 * if they are invalid
171 * or we do not support the request (simultaneous open) 171 * or we do not support the request (simultaneous open)
172 */ 172 */
173static enum tcp_conntrack tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { 173static const enum tcp_conntrack tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = {
174 { 174 {
175/* ORIGINAL */ 175/* ORIGINAL */
176/* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sLI */ 176/* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sLI */
@@ -817,7 +817,7 @@ void ip_conntrack_tcp_update(struct sk_buff *skb,
817#define TH_CWR 0x80 817#define TH_CWR 0x80
818 818
819/* table of valid flag combinations - ECE and CWR are always valid */ 819/* table of valid flag combinations - ECE and CWR are always valid */
820static u8 tcp_valid_flags[(TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG) + 1] = 820static const u8 tcp_valid_flags[(TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG) + 1] =
821{ 821{
822 [TH_SYN] = 1, 822 [TH_SYN] = 1,
823 [TH_SYN|TH_ACK] = 1, 823 [TH_SYN|TH_ACK] = 1,
diff --git a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c
index 762f4d93936b..c1a61462507f 100644
--- a/net/ipv4/netfilter/ip_nat_core.c
+++ b/net/ipv4/netfilter/ip_nat_core.c
@@ -49,7 +49,7 @@ static unsigned int ip_nat_htable_size;
49static struct list_head *bysource; 49static struct list_head *bysource;
50 50
51#define MAX_IP_NAT_PROTO 256 51#define MAX_IP_NAT_PROTO 256
52struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO]; 52static struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO];
53 53
54static inline struct ip_nat_protocol * 54static inline struct ip_nat_protocol *
55__ip_nat_proto_find(u_int8_t protonum) 55__ip_nat_proto_find(u_int8_t protonum)
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 75c27e92f6ab..45886c8475e8 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -1892,7 +1892,7 @@ static int ipt_get_matches(char *buffer, char **start, off_t offset, int length)
1892 return pos; 1892 return pos;
1893} 1893}
1894 1894
1895static struct { char *name; get_info_t *get_info; } ipt_proc_entry[] = 1895static const struct { char *name; get_info_t *get_info; } ipt_proc_entry[] =
1896{ { "ip_tables_names", ipt_get_tables }, 1896{ { "ip_tables_names", ipt_get_tables },
1897 { "ip_tables_targets", ipt_get_targets }, 1897 { "ip_tables_targets", ipt_get_targets },
1898 { "ip_tables_matches", ipt_get_matches }, 1898 { "ip_tables_matches", ipt_get_matches },
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c
index 92ed050fac69..30be0f1dae37 100644
--- a/net/ipv4/netfilter/ipt_LOG.c
+++ b/net/ipv4/netfilter/ipt_LOG.c
@@ -197,7 +197,7 @@ static void dump_packet(const struct nf_loginfo *info,
197 } 197 }
198 case IPPROTO_ICMP: { 198 case IPPROTO_ICMP: {
199 struct icmphdr _icmph, *ich; 199 struct icmphdr _icmph, *ich;
200 static size_t required_len[NR_ICMP_TYPES+1] 200 static const size_t required_len[NR_ICMP_TYPES+1]
201 = { [ICMP_ECHOREPLY] = 4, 201 = { [ICMP_ECHOREPLY] = 4,
202 [ICMP_DEST_UNREACH] 202 [ICMP_DEST_UNREACH]
203 = 8 + sizeof(struct iphdr), 203 = 8 + sizeof(struct iphdr),
@@ -351,7 +351,7 @@ static void dump_packet(const struct nf_loginfo *info,
351 /* maxlen = 230+ 91 + 230 + 252 = 803 */ 351 /* maxlen = 230+ 91 + 230 + 252 = 803 */
352} 352}
353 353
354struct nf_loginfo default_loginfo = { 354static struct nf_loginfo default_loginfo = {
355 .type = NF_LOG_TYPE_LOG, 355 .type = NF_LOG_TYPE_LOG,
356 .u = { 356 .u = {
357 .log = { 357 .log = {
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index a65e508fbd40..0d7dc668db46 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -98,7 +98,7 @@ fold_field(void *mib[], int offt)
98} 98}
99 99
100/* snmp items */ 100/* snmp items */
101static struct snmp_mib snmp4_ipstats_list[] = { 101static const struct snmp_mib snmp4_ipstats_list[] = {
102 SNMP_MIB_ITEM("InReceives", IPSTATS_MIB_INRECEIVES), 102 SNMP_MIB_ITEM("InReceives", IPSTATS_MIB_INRECEIVES),
103 SNMP_MIB_ITEM("InHdrErrors", IPSTATS_MIB_INHDRERRORS), 103 SNMP_MIB_ITEM("InHdrErrors", IPSTATS_MIB_INHDRERRORS),
104 SNMP_MIB_ITEM("InAddrErrors", IPSTATS_MIB_INADDRERRORS), 104 SNMP_MIB_ITEM("InAddrErrors", IPSTATS_MIB_INADDRERRORS),
@@ -119,7 +119,7 @@ static struct snmp_mib snmp4_ipstats_list[] = {
119 SNMP_MIB_SENTINEL 119 SNMP_MIB_SENTINEL
120}; 120};
121 121
122static struct snmp_mib snmp4_icmp_list[] = { 122static const struct snmp_mib snmp4_icmp_list[] = {
123 SNMP_MIB_ITEM("InMsgs", ICMP_MIB_INMSGS), 123 SNMP_MIB_ITEM("InMsgs", ICMP_MIB_INMSGS),
124 SNMP_MIB_ITEM("InErrors", ICMP_MIB_INERRORS), 124 SNMP_MIB_ITEM("InErrors", ICMP_MIB_INERRORS),
125 SNMP_MIB_ITEM("InDestUnreachs", ICMP_MIB_INDESTUNREACHS), 125 SNMP_MIB_ITEM("InDestUnreachs", ICMP_MIB_INDESTUNREACHS),
@@ -149,7 +149,7 @@ static struct snmp_mib snmp4_icmp_list[] = {
149 SNMP_MIB_SENTINEL 149 SNMP_MIB_SENTINEL
150}; 150};
151 151
152static struct snmp_mib snmp4_tcp_list[] = { 152static const struct snmp_mib snmp4_tcp_list[] = {
153 SNMP_MIB_ITEM("RtoAlgorithm", TCP_MIB_RTOALGORITHM), 153 SNMP_MIB_ITEM("RtoAlgorithm", TCP_MIB_RTOALGORITHM),
154 SNMP_MIB_ITEM("RtoMin", TCP_MIB_RTOMIN), 154 SNMP_MIB_ITEM("RtoMin", TCP_MIB_RTOMIN),
155 SNMP_MIB_ITEM("RtoMax", TCP_MIB_RTOMAX), 155 SNMP_MIB_ITEM("RtoMax", TCP_MIB_RTOMAX),
@@ -167,7 +167,7 @@ static struct snmp_mib snmp4_tcp_list[] = {
167 SNMP_MIB_SENTINEL 167 SNMP_MIB_SENTINEL
168}; 168};
169 169
170static struct snmp_mib snmp4_udp_list[] = { 170static const struct snmp_mib snmp4_udp_list[] = {
171 SNMP_MIB_ITEM("InDatagrams", UDP_MIB_INDATAGRAMS), 171 SNMP_MIB_ITEM("InDatagrams", UDP_MIB_INDATAGRAMS),
172 SNMP_MIB_ITEM("NoPorts", UDP_MIB_NOPORTS), 172 SNMP_MIB_ITEM("NoPorts", UDP_MIB_NOPORTS),
173 SNMP_MIB_ITEM("InErrors", UDP_MIB_INERRORS), 173 SNMP_MIB_ITEM("InErrors", UDP_MIB_INERRORS),
@@ -175,7 +175,7 @@ static struct snmp_mib snmp4_udp_list[] = {
175 SNMP_MIB_SENTINEL 175 SNMP_MIB_SENTINEL
176}; 176};
177 177
178static struct snmp_mib snmp4_net_list[] = { 178static const struct snmp_mib snmp4_net_list[] = {
179 SNMP_MIB_ITEM("SyncookiesSent", LINUX_MIB_SYNCOOKIESSENT), 179 SNMP_MIB_ITEM("SyncookiesSent", LINUX_MIB_SYNCOOKIESSENT),
180 SNMP_MIB_ITEM("SyncookiesRecv", LINUX_MIB_SYNCOOKIESRECV), 180 SNMP_MIB_ITEM("SyncookiesRecv", LINUX_MIB_SYNCOOKIESRECV),
181 SNMP_MIB_ITEM("SyncookiesFailed", LINUX_MIB_SYNCOOKIESFAILED), 181 SNMP_MIB_ITEM("SyncookiesFailed", LINUX_MIB_SYNCOOKIESFAILED),
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 381dd6a6aebb..f701a136a6ae 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1371,7 +1371,7 @@ out: kfree_skb(skb);
1371 * are needed for AMPRnet AX.25 paths. 1371 * are needed for AMPRnet AX.25 paths.
1372 */ 1372 */
1373 1373
1374static unsigned short mtu_plateau[] = 1374static const unsigned short mtu_plateau[] =
1375{32000, 17914, 8166, 4352, 2002, 1492, 576, 296, 216, 128 }; 1375{32000, 17914, 8166, 4352, 2002, 1492, 576, 296, 216, 128 };
1376 1376
1377static __inline__ unsigned short guess_mtu(unsigned short old_mtu) 1377static __inline__ unsigned short guess_mtu(unsigned short old_mtu)
@@ -3149,8 +3149,7 @@ int __init ip_rt_init(void)
3149 sizeof(struct rt_hash_bucket), 3149 sizeof(struct rt_hash_bucket),
3150 rhash_entries, 3150 rhash_entries,
3151 (num_physpages >= 128 * 1024) ? 3151 (num_physpages >= 128 * 1024) ?
3152 (27 - PAGE_SHIFT) : 3152 15 : 17,
3153 (29 - PAGE_SHIFT),
3154 HASH_HIGHMEM, 3153 HASH_HIGHMEM,
3155 &rt_hash_log, 3154 &rt_hash_log,
3156 &rt_hash_mask, 3155 &rt_hash_mask,
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 9ac7a4f46bd8..ef98b14ac56d 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1413,7 +1413,7 @@ recv_urg:
1413 * closed. 1413 * closed.
1414 */ 1414 */
1415 1415
1416static unsigned char new_state[16] = { 1416static const unsigned char new_state[16] = {
1417 /* current state: new state: action: */ 1417 /* current state: new state: action: */
1418 /* (Invalid) */ TCP_CLOSE, 1418 /* (Invalid) */ TCP_CLOSE,
1419 /* TCP_ESTABLISHED */ TCP_FIN_WAIT1 | TCP_ACTION_FIN, 1419 /* TCP_ESTABLISHED */ TCP_FIN_WAIT1 | TCP_ACTION_FIN,
@@ -2065,8 +2065,7 @@ void __init tcp_init(void)
2065 sizeof(struct inet_ehash_bucket), 2065 sizeof(struct inet_ehash_bucket),
2066 thash_entries, 2066 thash_entries,
2067 (num_physpages >= 128 * 1024) ? 2067 (num_physpages >= 128 * 1024) ?
2068 (25 - PAGE_SHIFT) : 2068 13 : 15,
2069 (27 - PAGE_SHIFT),
2070 HASH_HIGHMEM, 2069 HASH_HIGHMEM,
2071 &tcp_hashinfo.ehash_size, 2070 &tcp_hashinfo.ehash_size,
2072 NULL, 2071 NULL,
@@ -2082,8 +2081,7 @@ void __init tcp_init(void)
2082 sizeof(struct inet_bind_hashbucket), 2081 sizeof(struct inet_bind_hashbucket),
2083 tcp_hashinfo.ehash_size, 2082 tcp_hashinfo.ehash_size,
2084 (num_physpages >= 128 * 1024) ? 2083 (num_physpages >= 128 * 1024) ?
2085 (25 - PAGE_SHIFT) : 2084 13 : 15,
2086 (27 - PAGE_SHIFT),
2087 HASH_HIGHMEM, 2085 HASH_HIGHMEM,
2088 &tcp_hashinfo.bhash_size, 2086 &tcp_hashinfo.bhash_size,
2089 NULL, 2087 NULL,
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 1bdf0fb8bf8a..34a332225c17 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -751,7 +751,7 @@ void icmpv6_cleanup(void)
751 inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6); 751 inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6);
752} 752}
753 753
754static struct icmp6_err { 754static const struct icmp6_err {
755 int err; 755 int err;
756 int fatal; 756 int fatal;
757} tab_unreach[] = { 757} tab_unreach[] = {
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index c1fa693511a1..8523c76ebf76 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -774,7 +774,8 @@ out_err_release:
774 *dst = NULL; 774 *dst = NULL;
775 return err; 775 return err;
776} 776}
777inline int ip6_ufo_append_data(struct sock *sk, 777
778static inline int ip6_ufo_append_data(struct sock *sk,
778 int getfrag(void *from, char *to, int offset, int len, 779 int getfrag(void *from, char *to, int offset, int len,
779 int odd, struct sk_buff *skb), 780 int odd, struct sk_buff *skb),
780 void *from, int length, int hh_len, int fragheaderlen, 781 void *from, int length, int hh_len, int fragheaderlen,
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 25757ade989f..3620718defe6 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -628,8 +628,8 @@ e_inval:
628 return -EINVAL; 628 return -EINVAL;
629} 629}
630 630
631int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_opt_hdr *hdr, 631static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_opt_hdr *hdr,
632 char __user *optval, int len) 632 char __user *optval, int len)
633{ 633{
634 if (!hdr) 634 if (!hdr)
635 return 0; 635 return 0;
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 7d492226c16e..95d469271c4d 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -1972,7 +1972,7 @@ static int ip6t_get_matches(char *buffer, char **start, off_t offset, int length
1972 return pos; 1972 return pos;
1973} 1973}
1974 1974
1975static struct { char *name; get_info_t *get_info; } ip6t_proc_entry[] = 1975static const struct { char *name; get_info_t *get_info; } ip6t_proc_entry[] =
1976{ { "ip6_tables_names", ip6t_get_tables }, 1976{ { "ip6_tables_names", ip6t_get_tables },
1977 { "ip6_tables_targets", ip6t_get_targets }, 1977 { "ip6_tables_targets", ip6t_get_targets },
1978 { "ip6_tables_matches", ip6t_get_matches }, 1978 { "ip6_tables_matches", ip6t_get_matches },