aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild5
-rw-r--r--include/linux/arcdevice.h4
-rw-r--r--include/linux/atalk.h2
-rw-r--r--include/linux/attribute_container.h2
-rw-r--r--include/linux/audit.h29
-rw-r--r--include/linux/clocksource.h1
-rw-r--r--include/linux/dmaengine.h36
-rw-r--r--include/linux/filter.h35
-rw-r--r--include/linux/fsl_devices.h2
-rw-r--r--include/linux/hdreg.h4
-rw-r--r--include/linux/hrtimer.h2
-rw-r--r--include/linux/icmpv6.h11
-rw-r--r--include/linux/ide.h174
-rw-r--r--include/linux/ieee80211.h35
-rw-r--r--include/linux/if_arp.h6
-rw-r--r--include/linux/if_tun.h39
-rw-r--r--include/linux/if_tunnel.h22
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/if_wanpipe.h124
-rw-r--r--include/linux/igmp.h38
-rw-r--r--include/linux/in6.h34
-rw-r--r--include/linux/inetdevice.h8
-rw-r--r--include/linux/interrupt.h19
-rw-r--r--include/linux/iocontext.h4
-rw-r--r--include/linux/ipv6.h50
-rw-r--r--include/linux/irq.h10
-rw-r--r--include/linux/isdn.h6
-rw-r--r--include/linux/kgdb.h281
-rw-r--r--include/linux/libata.h718
-rw-r--r--include/linux/lm_interface.h10
-rw-r--r--include/linux/mbcache.h2
-rw-r--r--include/linux/mlx4/cmd.h2
-rw-r--r--include/linux/mlx4/cq.h19
-rw-r--r--include/linux/mlx4/device.h1
-rw-r--r--include/linux/mlx4/driver.h3
-rw-r--r--include/linux/mlx4/qp.h15
-rw-r--r--include/linux/mroute.h25
-rw-r--r--include/linux/mroute6.h228
-rw-r--r--include/linux/mtio.h1
-rw-r--r--include/linux/net.h3
-rw-r--r--include/linux/netdevice.h36
-rw-r--r--include/linux/netfilter.h85
-rw-r--r--include/linux/netfilter/nf_conntrack_dccp.h40
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h185
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h8
-rw-r--r--include/linux/netfilter/x_tables.h4
-rw-r--r--include/linux/netfilter/xt_sctp.h84
-rw-r--r--include/linux/netfilter_arp/arp_tables.h17
-rw-r--r--include/linux/netfilter_bridge/ebt_nflog.h21
-rw-r--r--include/linux/netfilter_ipv4.h2
-rw-r--r--include/linux/nl80211.h218
-rw-r--r--include/linux/pcounter.h74
-rw-r--r--include/linux/phy.h61
-rw-r--r--include/linux/pim.h45
-rw-r--r--include/linux/quota.h8
-rw-r--r--include/linux/scatterlist.h5
-rw-r--r--include/linux/security.h162
-rw-r--r--include/linux/selinux.h134
-rw-r--r--include/linux/semaphore.h51
-rw-r--r--include/linux/seq_file.h13
-rw-r--r--include/linux/seq_file_net.h27
-rw-r--r--include/linux/serial_core.h4
-rw-r--r--include/linux/skbuff.h206
-rw-r--r--include/linux/slub_def.h2
-rw-r--r--include/linux/smc91x.h13
-rw-r--r--include/linux/spinlock.h37
-rw-r--r--include/linux/ssb/ssb.h54
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h7
-rw-r--r--include/linux/ssb/ssb_driver_gige.h174
-rw-r--r--include/linux/ssb/ssb_driver_pci.h19
-rw-r--r--include/linux/tcp.h7
-rw-r--r--include/linux/thermal.h2
-rw-r--r--include/linux/thread_info.h12
-rw-r--r--include/linux/transport_class.h5
-rw-r--r--include/linux/tty_driver.h12
-rw-r--r--include/linux/uaccess.h22
-rw-r--r--include/linux/udp.h19
-rw-r--r--include/linux/wireless.h1
-rw-r--r--include/linux/xfrm.h3
79 files changed, 2644 insertions, 1251 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 9cdd12a9e843..b3d9ccde0c27 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -86,6 +86,7 @@ header-y += if_plip.h
86header-y += if_ppp.h 86header-y += if_ppp.h
87header-y += if_slip.h 87header-y += if_slip.h
88header-y += if_strip.h 88header-y += if_strip.h
89header-y += if_tun.h
89header-y += if_tunnel.h 90header-y += if_tunnel.h
90header-y += in6.h 91header-y += in6.h
91header-y += in_route.h 92header-y += in_route.h
@@ -229,9 +230,7 @@ unifdef-y += if_link.h
229unifdef-y += if_pppol2tp.h 230unifdef-y += if_pppol2tp.h
230unifdef-y += if_pppox.h 231unifdef-y += if_pppox.h
231unifdef-y += if_tr.h 232unifdef-y += if_tr.h
232unifdef-y += if_tun.h
233unifdef-y += if_vlan.h 233unifdef-y += if_vlan.h
234unifdef-y += if_wanpipe.h
235unifdef-y += igmp.h 234unifdef-y += igmp.h
236unifdef-y += inet_diag.h 235unifdef-y += inet_diag.h
237unifdef-y += in.h 236unifdef-y += in.h
@@ -261,6 +260,7 @@ unifdef-y += mempolicy.h
261unifdef-y += mii.h 260unifdef-y += mii.h
262unifdef-y += mman.h 261unifdef-y += mman.h
263unifdef-y += mroute.h 262unifdef-y += mroute.h
263unifdef-y += mroute6.h
264unifdef-y += msdos_fs.h 264unifdef-y += msdos_fs.h
265unifdef-y += msg.h 265unifdef-y += msg.h
266unifdef-y += nbd.h 266unifdef-y += nbd.h
@@ -289,6 +289,7 @@ unifdef-y += parport.h
289unifdef-y += patchkey.h 289unifdef-y += patchkey.h
290unifdef-y += pci.h 290unifdef-y += pci.h
291unifdef-y += personality.h 291unifdef-y += personality.h
292unifdef-y += pim.h
292unifdef-y += pktcdvd.h 293unifdef-y += pktcdvd.h
293unifdef-y += pmu.h 294unifdef-y += pmu.h
294unifdef-y += poll.h 295unifdef-y += poll.h
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index fde675872c56..a1916078fd08 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -283,8 +283,8 @@ struct arcnet_local {
283 int next_buf, first_free_buf; 283 int next_buf, first_free_buf;
284 284
285 /* network "reconfiguration" handling */ 285 /* network "reconfiguration" handling */
286 time_t first_recon, /* time of "first" RECON message to count */ 286 unsigned long first_recon; /* time of "first" RECON message to count */
287 last_recon; /* time of most recent RECON */ 287 unsigned long last_recon; /* time of most recent RECON */
288 int num_recons; /* number of RECONs between first and last. */ 288 int num_recons; /* number of RECONs between first and last. */
289 bool network_down; /* do we think the network is down? */ 289 bool network_down; /* do we think the network is down? */
290 290
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index ced8a1ed080c..e9ebac2e2ecc 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -85,8 +85,6 @@ static inline struct atalk_sock *at_sk(struct sock *sk)
85 return (struct atalk_sock *)sk; 85 return (struct atalk_sock *)sk;
86} 86}
87 87
88#include <asm/byteorder.h>
89
90struct ddpehdr { 88struct ddpehdr {
91 __be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */ 89 __be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */
92 __be16 deh_sum; 90 __be16 deh_sum;
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index f5582332af04..574b201b99d8 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -37,7 +37,7 @@ attribute_container_set_no_classdevs(struct attribute_container *atc)
37} 37}
38 38
39int attribute_container_register(struct attribute_container *cont); 39int attribute_container_register(struct attribute_container *cont);
40int attribute_container_unregister(struct attribute_container *cont); 40int __must_check attribute_container_unregister(struct attribute_container *cont);
41void attribute_container_create_device(struct device *dev, 41void attribute_container_create_device(struct device *dev,
42 int (*fn)(struct attribute_container *, 42 int (*fn)(struct attribute_container *,
43 struct device *, 43 struct device *,
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 2af9ec025015..4ccb048cae1d 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -353,6 +353,33 @@ struct netlink_skb_parms;
353struct linux_binprm; 353struct linux_binprm;
354struct mq_attr; 354struct mq_attr;
355struct mqstat; 355struct mqstat;
356struct audit_watch;
357struct audit_tree;
358
359struct audit_krule {
360 int vers_ops;
361 u32 flags;
362 u32 listnr;
363 u32 action;
364 u32 mask[AUDIT_BITMASK_SIZE];
365 u32 buflen; /* for data alloc on list rules */
366 u32 field_count;
367 char *filterkey; /* ties events to rules */
368 struct audit_field *fields;
369 struct audit_field *arch_f; /* quick access to arch field */
370 struct audit_field *inode_f; /* quick access to an inode field */
371 struct audit_watch *watch; /* associated watch */
372 struct audit_tree *tree; /* associated watched tree */
373 struct list_head rlist; /* entry in audit_{watch,tree}.rules list */
374};
375
376struct audit_field {
377 u32 type;
378 u32 val;
379 u32 op;
380 char *lsm_str;
381 void *lsm_rule;
382};
356 383
357#define AUDITSC_INVALID 0 384#define AUDITSC_INVALID 0
358#define AUDITSC_SUCCESS 1 385#define AUDITSC_SUCCESS 1
@@ -536,6 +563,8 @@ extern void audit_log_d_path(struct audit_buffer *ab,
536 const char *prefix, 563 const char *prefix,
537 struct path *path); 564 struct path *path);
538extern void audit_log_lost(const char *message); 565extern void audit_log_lost(const char *message);
566extern int audit_update_lsm_rules(void);
567
539 /* Private API (for audit.c only) */ 568 /* Private API (for audit.c only) */
540extern int audit_filter_user(struct netlink_skb_parms *cb, int type); 569extern int audit_filter_user(struct netlink_skb_parms *cb, int type);
541extern int audit_filter_type(int type); 570extern int audit_filter_type(int type);
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 85778a4b1209..35094479ca55 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -216,6 +216,7 @@ static inline void clocksource_calculate_interval(struct clocksource *c,
216/* used to install a new clocksource */ 216/* used to install a new clocksource */
217extern int clocksource_register(struct clocksource*); 217extern int clocksource_register(struct clocksource*);
218extern void clocksource_unregister(struct clocksource*); 218extern void clocksource_unregister(struct clocksource*);
219extern void clocksource_touch_watchdog(void);
219extern struct clocksource* clocksource_get_next(void); 220extern struct clocksource* clocksource_get_next(void);
220extern void clocksource_change_rating(struct clocksource *cs, int rating); 221extern void clocksource_change_rating(struct clocksource *cs, int rating);
221extern void clocksource_resume(void); 222extern void clocksource_resume(void);
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 34d440698293..b4d84ed6187d 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -95,12 +95,17 @@ enum dma_transaction_type {
95#define DMA_TX_TYPE_END (DMA_INTERRUPT + 1) 95#define DMA_TX_TYPE_END (DMA_INTERRUPT + 1)
96 96
97/** 97/**
98 * enum dma_prep_flags - DMA flags to augment operation preparation 98 * enum dma_ctrl_flags - DMA flags to augment operation preparation,
99 * control completion, and communicate status.
99 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of 100 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of
100 * this transaction 101 * this transaction
102 * @DMA_CTRL_ACK - the descriptor cannot be reused until the client
103 * acknowledges receipt, i.e. has has a chance to establish any
104 * dependency chains
101 */ 105 */
102enum dma_prep_flags { 106enum dma_ctrl_flags {
103 DMA_PREP_INTERRUPT = (1 << 0), 107 DMA_PREP_INTERRUPT = (1 << 0),
108 DMA_CTRL_ACK = (1 << 1),
104}; 109};
105 110
106/** 111/**
@@ -211,8 +216,8 @@ typedef void (*dma_async_tx_callback)(void *dma_async_param);
211 * ---dma generic offload fields--- 216 * ---dma generic offload fields---
212 * @cookie: tracking cookie for this transaction, set to -EBUSY if 217 * @cookie: tracking cookie for this transaction, set to -EBUSY if
213 * this tx is sitting on a dependency list 218 * this tx is sitting on a dependency list
214 * @ack: the descriptor can not be reused until the client acknowledges 219 * @flags: flags to augment operation preparation, control completion, and
215 * receipt, i.e. has has a chance to establish any dependency chains 220 * communicate status
216 * @phys: physical address of the descriptor 221 * @phys: physical address of the descriptor
217 * @tx_list: driver common field for operations that require multiple 222 * @tx_list: driver common field for operations that require multiple
218 * descriptors 223 * descriptors
@@ -221,23 +226,20 @@ typedef void (*dma_async_tx_callback)(void *dma_async_param);
221 * @callback: routine to call after this operation is complete 226 * @callback: routine to call after this operation is complete
222 * @callback_param: general parameter to pass to the callback routine 227 * @callback_param: general parameter to pass to the callback routine
223 * ---async_tx api specific fields--- 228 * ---async_tx api specific fields---
224 * @depend_list: at completion this list of transactions are submitted 229 * @next: at completion submit this descriptor
225 * @depend_node: allow this transaction to be executed after another
226 * transaction has completed, possibly on another channel
227 * @parent: pointer to the next level up in the dependency chain 230 * @parent: pointer to the next level up in the dependency chain
228 * @lock: protect the dependency list 231 * @lock: protect the parent and next pointers
229 */ 232 */
230struct dma_async_tx_descriptor { 233struct dma_async_tx_descriptor {
231 dma_cookie_t cookie; 234 dma_cookie_t cookie;
232 int ack; 235 enum dma_ctrl_flags flags; /* not a 'long' to pack with cookie */
233 dma_addr_t phys; 236 dma_addr_t phys;
234 struct list_head tx_list; 237 struct list_head tx_list;
235 struct dma_chan *chan; 238 struct dma_chan *chan;
236 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); 239 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
237 dma_async_tx_callback callback; 240 dma_async_tx_callback callback;
238 void *callback_param; 241 void *callback_param;
239 struct list_head depend_list; 242 struct dma_async_tx_descriptor *next;
240 struct list_head depend_node;
241 struct dma_async_tx_descriptor *parent; 243 struct dma_async_tx_descriptor *parent;
242 spinlock_t lock; 244 spinlock_t lock;
243}; 245};
@@ -261,7 +263,6 @@ struct dma_async_tx_descriptor {
261 * @device_prep_dma_zero_sum: prepares a zero_sum operation 263 * @device_prep_dma_zero_sum: prepares a zero_sum operation
262 * @device_prep_dma_memset: prepares a memset operation 264 * @device_prep_dma_memset: prepares a memset operation
263 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 265 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
264 * @device_dependency_added: async_tx notifies the channel about new deps
265 * @device_issue_pending: push pending transactions to hardware 266 * @device_issue_pending: push pending transactions to hardware
266 */ 267 */
267struct dma_device { 268struct dma_device {
@@ -294,9 +295,8 @@ struct dma_device {
294 struct dma_chan *chan, dma_addr_t dest, int value, size_t len, 295 struct dma_chan *chan, dma_addr_t dest, int value, size_t len,
295 unsigned long flags); 296 unsigned long flags);
296 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( 297 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)(
297 struct dma_chan *chan); 298 struct dma_chan *chan, unsigned long flags);
298 299
299 void (*device_dependency_added)(struct dma_chan *chan);
300 enum dma_status (*device_is_tx_complete)(struct dma_chan *chan, 300 enum dma_status (*device_is_tx_complete)(struct dma_chan *chan,
301 dma_cookie_t cookie, dma_cookie_t *last, 301 dma_cookie_t cookie, dma_cookie_t *last,
302 dma_cookie_t *used); 302 dma_cookie_t *used);
@@ -321,7 +321,13 @@ void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx,
321static inline void 321static inline void
322async_tx_ack(struct dma_async_tx_descriptor *tx) 322async_tx_ack(struct dma_async_tx_descriptor *tx)
323{ 323{
324 tx->ack = 1; 324 tx->flags |= DMA_CTRL_ACK;
325}
326
327static inline int
328async_tx_test_ack(struct dma_async_tx_descriptor *tx)
329{
330 return tx->flags & DMA_CTRL_ACK;
325} 331}
326 332
327#define first_dma_cap(mask) __first_dma_cap(&(mask)) 333#define first_dma_cap(mask) __first_dma_cap(&(mask))
diff --git a/include/linux/filter.h b/include/linux/filter.h
index ddfa0372a3b7..b6ea9aa9e853 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -37,21 +37,6 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */
37 struct sock_filter __user *filter; 37 struct sock_filter __user *filter;
38}; 38};
39 39
40#ifdef __KERNEL__
41struct sk_filter
42{
43 atomic_t refcnt;
44 unsigned int len; /* Number of filter blocks */
45 struct rcu_head rcu;
46 struct sock_filter insns[0];
47};
48
49static inline unsigned int sk_filter_len(struct sk_filter *fp)
50{
51 return fp->len*sizeof(struct sock_filter) + sizeof(*fp);
52}
53#endif
54
55/* 40/*
56 * Instruction classes 41 * Instruction classes
57 */ 42 */
@@ -136,15 +121,31 @@ static inline unsigned int sk_filter_len(struct sk_filter *fp)
136#define SKF_AD_PROTOCOL 0 121#define SKF_AD_PROTOCOL 0
137#define SKF_AD_PKTTYPE 4 122#define SKF_AD_PKTTYPE 4
138#define SKF_AD_IFINDEX 8 123#define SKF_AD_IFINDEX 8
139#define SKF_AD_MAX 12 124#define SKF_AD_NLATTR 12
125#define SKF_AD_MAX 16
140#define SKF_NET_OFF (-0x100000) 126#define SKF_NET_OFF (-0x100000)
141#define SKF_LL_OFF (-0x200000) 127#define SKF_LL_OFF (-0x200000)
142 128
143#ifdef __KERNEL__ 129#ifdef __KERNEL__
130struct sk_filter
131{
132 atomic_t refcnt;
133 unsigned int len; /* Number of filter blocks */
134 struct rcu_head rcu;
135 struct sock_filter insns[0];
136};
137
138static inline unsigned int sk_filter_len(const struct sk_filter *fp)
139{
140 return fp->len * sizeof(struct sock_filter) + sizeof(*fp);
141}
142
144struct sk_buff; 143struct sk_buff;
145struct sock; 144struct sock;
146 145
147extern unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen); 146extern int sk_filter(struct sock *sk, struct sk_buff *skb);
147extern unsigned int sk_run_filter(struct sk_buff *skb,
148 struct sock_filter *filter, int flen);
148extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 149extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
149extern int sk_detach_filter(struct sock *sk); 150extern int sk_detach_filter(struct sock *sk);
150extern int sk_chk_filter(struct sock_filter *filter, int flen); 151extern int sk_chk_filter(struct sock_filter *filter, int flen);
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 1831b196c70a..2cad5c67397e 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -50,7 +50,7 @@ struct gianfar_platform_data {
50 u32 device_flags; 50 u32 device_flags;
51 /* board specific information */ 51 /* board specific information */
52 u32 board_flags; 52 u32 board_flags;
53 u32 bus_id; 53 char bus_id[MII_BUS_ID_SIZE];
54 u32 phy_id; 54 u32 phy_id;
55 u8 mac_addr[6]; 55 u8 mac_addr[6];
56 phy_interface_t interface; 56 phy_interface_t interface;
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index e38e75967e74..c37e9241fae7 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -422,9 +422,11 @@ struct hd_geometry {
422#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 422#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
423#define HDIO_SET_DMA 0x0326 /* change use-dma flag */ 423#define HDIO_SET_DMA 0x0326 /* change use-dma flag */
424#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 424#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
425#ifndef __KERNEL__
425#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ 426#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */
426#define HDIO_SET_NICE 0x0329 /* set nice flags */
427#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ 427#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */
428#endif
429#define HDIO_SET_NICE 0x0329 /* set nice flags */
428#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ 430#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */
429#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ 431#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */
430#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ 432#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 1ad56a7b2f74..56f3236da829 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -173,7 +173,6 @@ struct hrtimer_clock_base {
173 * struct hrtimer_cpu_base - the per cpu clock bases 173 * struct hrtimer_cpu_base - the per cpu clock bases
174 * @lock: lock protecting the base and associated clock bases 174 * @lock: lock protecting the base and associated clock bases
175 * and timers 175 * and timers
176 * @lock_key: the lock_class_key for use with lockdep
177 * @clock_base: array of clock bases for this cpu 176 * @clock_base: array of clock bases for this cpu
178 * @curr_timer: the timer which is executing a callback right now 177 * @curr_timer: the timer which is executing a callback right now
179 * @expires_next: absolute time of the next event which was scheduled 178 * @expires_next: absolute time of the next event which was scheduled
@@ -189,7 +188,6 @@ struct hrtimer_clock_base {
189 */ 188 */
190struct hrtimer_cpu_base { 189struct hrtimer_cpu_base {
191 spinlock_t lock; 190 spinlock_t lock;
192 struct lock_class_key lock_key;
193 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; 191 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
194 struct list_head cb_pending; 192 struct list_head cb_pending;
195#ifdef CONFIG_HIGH_RES_TIMERS 193#ifdef CONFIG_HIGH_RES_TIMERS
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 7c5e9817e998..03067443198a 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -176,12 +176,21 @@ extern void icmpv6_send(struct sk_buff *skb,
176 __u32 info, 176 __u32 info,
177 struct net_device *dev); 177 struct net_device *dev);
178 178
179extern int icmpv6_init(struct net_proto_family *ops); 179extern int icmpv6_init(void);
180extern int icmpv6_err_convert(int type, int code, 180extern int icmpv6_err_convert(int type, int code,
181 int *err); 181 int *err);
182extern void icmpv6_cleanup(void); 182extern void icmpv6_cleanup(void);
183extern void icmpv6_param_prob(struct sk_buff *skb, 183extern void icmpv6_param_prob(struct sk_buff *skb,
184 int code, int pos); 184 int code, int pos);
185
186struct flowi;
187struct in6_addr;
188extern void icmpv6_flow_init(struct sock *sk,
189 struct flowi *fl,
190 u8 type,
191 const struct in6_addr *saddr,
192 const struct in6_addr *daddr,
193 int oif);
185#endif 194#endif
186 195
187#endif 196#endif
diff --git a/include/linux/ide.h b/include/linux/ide.h
index bc26b2f27359..6c39482fd1a1 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -82,24 +82,10 @@ typedef unsigned char byte; /* used everywhere */
82 82
83#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET 83#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET
84#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET 84#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET
85 85#define IDE_ALTSTATUS_OFFSET IDE_CONTROL_OFFSET
86#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET]) 86#define IDE_IREASON_OFFSET IDE_NSECTOR_OFFSET
87#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET]) 87#define IDE_BCOUNTL_OFFSET IDE_LCYL_OFFSET
88#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET]) 88#define IDE_BCOUNTH_OFFSET IDE_HCYL_OFFSET
89#define IDE_SECTOR_REG (HWIF(drive)->io_ports[IDE_SECTOR_OFFSET])
90#define IDE_LCYL_REG (HWIF(drive)->io_ports[IDE_LCYL_OFFSET])
91#define IDE_HCYL_REG (HWIF(drive)->io_ports[IDE_HCYL_OFFSET])
92#define IDE_SELECT_REG (HWIF(drive)->io_ports[IDE_SELECT_OFFSET])
93#define IDE_STATUS_REG (HWIF(drive)->io_ports[IDE_STATUS_OFFSET])
94#define IDE_CONTROL_REG (HWIF(drive)->io_ports[IDE_CONTROL_OFFSET])
95#define IDE_IRQ_REG (HWIF(drive)->io_ports[IDE_IRQ_OFFSET])
96
97#define IDE_FEATURE_REG IDE_ERROR_REG
98#define IDE_COMMAND_REG IDE_STATUS_REG
99#define IDE_ALTSTATUS_REG IDE_CONTROL_REG
100#define IDE_IREASON_REG IDE_NSECTOR_REG
101#define IDE_BCOUNTL_REG IDE_LCYL_REG
102#define IDE_BCOUNTH_REG IDE_HCYL_REG
103 89
104#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) 90#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good))
105#define BAD_R_STAT (BUSY_STAT | ERR_STAT) 91#define BAD_R_STAT (BUSY_STAT | ERR_STAT)
@@ -169,7 +155,7 @@ enum { ide_unknown, ide_generic, ide_pci,
169 ide_rz1000, ide_trm290, 155 ide_rz1000, ide_trm290,
170 ide_cmd646, ide_cy82c693, ide_4drives, 156 ide_cmd646, ide_cy82c693, ide_4drives,
171 ide_pmac, ide_etrax100, ide_acorn, 157 ide_pmac, ide_etrax100, ide_acorn,
172 ide_au1xxx, ide_palm3710, ide_forced 158 ide_au1xxx, ide_palm3710
173}; 159};
174 160
175typedef u8 hwif_chipset_t; 161typedef u8 hwif_chipset_t;
@@ -186,14 +172,9 @@ typedef struct hw_regs_s {
186} hw_regs_t; 172} hw_regs_t;
187 173
188struct hwif_s * ide_find_port(unsigned long); 174struct hwif_s * ide_find_port(unsigned long);
189struct hwif_s *ide_deprecated_find_port(unsigned long);
190void ide_init_port_data(struct hwif_s *, unsigned int); 175void ide_init_port_data(struct hwif_s *, unsigned int);
191void ide_init_port_hw(struct hwif_s *, hw_regs_t *); 176void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
192 177
193struct ide_drive_s;
194int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *),
195 struct hwif_s **);
196
197static inline void ide_std_init_ports(hw_regs_t *hw, 178static inline void ide_std_init_ports(hw_regs_t *hw,
198 unsigned long io_addr, 179 unsigned long io_addr,
199 unsigned long ctl_addr) 180 unsigned long ctl_addr)
@@ -213,45 +194,6 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
213#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS 194#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS
214#endif 195#endif
215 196
216/* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */
217#ifndef IDE_ARCH_OBSOLETE_DEFAULTS
218# define ide_default_io_base(index) (0)
219# define ide_default_irq(base) (0)
220# define ide_init_default_irq(base) (0)
221#endif
222
223#ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT
224static inline void ide_init_hwif_ports(hw_regs_t *hw,
225 unsigned long io_addr,
226 unsigned long ctl_addr,
227 int *irq)
228{
229 if (!ctl_addr)
230 ide_std_init_ports(hw, io_addr, ide_default_io_ctl(io_addr));
231 else
232 ide_std_init_ports(hw, io_addr, ctl_addr);
233
234 if (irq)
235 *irq = 0;
236
237 hw->io_ports[IDE_IRQ_OFFSET] = 0;
238
239#ifdef CONFIG_PPC32
240 if (ppc_ide_md.ide_init_hwif)
241 ppc_ide_md.ide_init_hwif(hw, io_addr, ctl_addr, irq);
242#endif
243}
244#else
245static inline void ide_init_hwif_ports(hw_regs_t *hw,
246 unsigned long io_addr,
247 unsigned long ctl_addr,
248 int *irq)
249{
250 if (io_addr || ctl_addr)
251 printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__);
252}
253#endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */
254
255/* Currently only m68k, apus and m8xx need it */ 197/* Currently only m68k, apus and m8xx need it */
256#ifndef IDE_ARCH_ACK_INTR 198#ifndef IDE_ARCH_ACK_INTR
257# define ide_ack_intr(hwif) (1) 199# define ide_ack_intr(hwif) (1)
@@ -406,7 +348,7 @@ typedef struct ide_drive_s {
406 u8 wcache; /* status of write cache */ 348 u8 wcache; /* status of write cache */
407 u8 acoustic; /* acoustic management */ 349 u8 acoustic; /* acoustic management */
408 u8 media; /* disk, cdrom, tape, floppy, ... */ 350 u8 media; /* disk, cdrom, tape, floppy, ... */
409 u8 ctl; /* "normal" value for IDE_CONTROL_REG */ 351 u8 ctl; /* "normal" value for Control register */
410 u8 ready_stat; /* min status value for drive ready */ 352 u8 ready_stat; /* min status value for drive ready */
411 u8 mult_count; /* current multiple sector setting */ 353 u8 mult_count; /* current multiple sector setting */
412 u8 mult_req; /* requested multiple sector setting */ 354 u8 mult_req; /* requested multiple sector setting */
@@ -507,8 +449,6 @@ typedef struct hwif_s {
507 void (*maskproc)(ide_drive_t *, int); 449 void (*maskproc)(ide_drive_t *, int);
508 /* check host's drive quirk list */ 450 /* check host's drive quirk list */
509 void (*quirkproc)(ide_drive_t *); 451 void (*quirkproc)(ide_drive_t *);
510 /* driver soft-power interface */
511 int (*busproc)(ide_drive_t *, int);
512#endif 452#endif
513 u8 (*mdma_filter)(ide_drive_t *); 453 u8 (*mdma_filter)(ide_drive_t *);
514 u8 (*udma_filter)(ide_drive_t *); 454 u8 (*udma_filter)(ide_drive_t *);
@@ -578,7 +518,6 @@ typedef struct hwif_s {
578 518
579 unsigned noprobe : 1; /* don't probe for this interface */ 519 unsigned noprobe : 1; /* don't probe for this interface */
580 unsigned present : 1; /* this interface exists */ 520 unsigned present : 1; /* this interface exists */
581 unsigned hold : 1; /* this interface is always present */
582 unsigned serialized : 1; /* serialized all channel operation */ 521 unsigned serialized : 1; /* serialized all channel operation */
583 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ 522 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
584 unsigned reset : 1; /* reset after probe */ 523 unsigned reset : 1; /* reset after probe */
@@ -586,7 +525,9 @@ typedef struct hwif_s {
586 unsigned mmio : 1; /* host uses MMIO */ 525 unsigned mmio : 1; /* host uses MMIO */
587 unsigned straight8 : 1; /* Alan's straight 8 check */ 526 unsigned straight8 : 1; /* Alan's straight 8 check */
588 527
589 struct device gendev; 528 struct device gendev;
529 struct device *portdev;
530
590 struct completion gendev_rel_comp; /* To deal with device release() */ 531 struct completion gendev_rel_comp; /* To deal with device release() */
591 532
592 void *hwif_data; /* extra hwif data */ 533 void *hwif_data; /* extra hwif data */
@@ -647,6 +588,68 @@ int set_io_32bit(ide_drive_t *, int);
647int set_pio_mode(ide_drive_t *, int); 588int set_pio_mode(ide_drive_t *, int);
648int set_using_dma(ide_drive_t *, int); 589int set_using_dma(ide_drive_t *, int);
649 590
591/* ATAPI packet command flags */
592enum {
593 /* set when an error is considered normal - no retry (ide-tape) */
594 PC_FLAG_ABORT = (1 << 0),
595 PC_FLAG_SUPPRESS_ERROR = (1 << 1),
596 PC_FLAG_WAIT_FOR_DSC = (1 << 2),
597 PC_FLAG_DMA_OK = (1 << 3),
598 PC_FLAG_DMA_RECOMMENDED = (1 << 4),
599 PC_FLAG_DMA_IN_PROGRESS = (1 << 5),
600 PC_FLAG_DMA_ERROR = (1 << 6),
601 PC_FLAG_WRITING = (1 << 7),
602 /* command timed out */
603 PC_FLAG_TIMEDOUT = (1 << 8),
604};
605
606struct ide_atapi_pc {
607 /* actual packet bytes */
608 u8 c[12];
609 /* incremented on each retry */
610 int retries;
611 int error;
612
613 /* bytes to transfer */
614 int req_xfer;
615 /* bytes actually transferred */
616 int xferred;
617
618 /* data buffer */
619 u8 *buf;
620 /* current buffer position */
621 u8 *cur_pos;
622 int buf_size;
623 /* missing/available data on the current buffer */
624 int b_count;
625
626 /* the corresponding request */
627 struct request *rq;
628
629 unsigned long flags;
630
631 /*
632 * those are more or less driver-specific and some of them are subject
633 * to change/removal later.
634 */
635 u8 pc_buf[256];
636 void (*idefloppy_callback) (ide_drive_t *);
637 ide_startstop_t (*idetape_callback) (ide_drive_t *);
638
639 /* idetape only */
640 struct idetape_bh *bh;
641 char *b_data;
642
643 /* idescsi only for now */
644 struct scatterlist *sg;
645 unsigned int sg_cnt;
646
647 struct scsi_cmnd *scsi_cmd;
648 void (*done) (struct scsi_cmnd *);
649
650 unsigned long timeout;
651};
652
650#ifdef CONFIG_IDE_PROC_FS 653#ifdef CONFIG_IDE_PROC_FS
651/* 654/*
652 * configurable drive settings 655 * configurable drive settings
@@ -691,6 +694,7 @@ void proc_ide_create(void);
691void proc_ide_destroy(void); 694void proc_ide_destroy(void);
692void ide_proc_register_port(ide_hwif_t *); 695void ide_proc_register_port(ide_hwif_t *);
693void ide_proc_port_register_devices(ide_hwif_t *); 696void ide_proc_port_register_devices(ide_hwif_t *);
697void ide_proc_unregister_device(ide_drive_t *);
694void ide_proc_unregister_port(ide_hwif_t *); 698void ide_proc_unregister_port(ide_hwif_t *);
695void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); 699void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
696void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); 700void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
@@ -724,6 +728,7 @@ static inline void proc_ide_create(void) { ; }
724static inline void proc_ide_destroy(void) { ; } 728static inline void proc_ide_destroy(void) { ; }
725static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } 729static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
726static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } 730static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
731static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; }
727static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } 732static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
728static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 733static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
729static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 734static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
@@ -990,7 +995,6 @@ extern void do_ide_request(struct request_queue *);
990void ide_init_disk(struct gendisk *, ide_drive_t *); 995void ide_init_disk(struct gendisk *, ide_drive_t *);
991 996
992#ifdef CONFIG_IDEPCI_PCIBUS_ORDER 997#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
993extern int ide_scan_direction;
994extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); 998extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
995#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) 999#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
996#else 1000#else
@@ -1195,7 +1199,7 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1195void ide_remove_port_from_hwgroup(ide_hwif_t *); 1199void ide_remove_port_from_hwgroup(ide_hwif_t *);
1196extern int ide_hwif_request_regions(ide_hwif_t *hwif); 1200extern int ide_hwif_request_regions(ide_hwif_t *hwif);
1197extern void ide_hwif_release_regions(ide_hwif_t* hwif); 1201extern void ide_hwif_release_regions(ide_hwif_t* hwif);
1198void ide_unregister(unsigned int, int, int); 1202void ide_unregister(unsigned int);
1199 1203
1200void ide_register_region(struct gendisk *); 1204void ide_register_region(struct gendisk *);
1201void ide_unregister_region(struct gendisk *); 1205void ide_unregister_region(struct gendisk *);
@@ -1204,6 +1208,8 @@ void ide_undecoded_slave(ide_drive_t *);
1204 1208
1205int ide_device_add_all(u8 *idx, const struct ide_port_info *); 1209int ide_device_add_all(u8 *idx, const struct ide_port_info *);
1206int ide_device_add(u8 idx[4], const struct ide_port_info *); 1210int ide_device_add(u8 idx[4], const struct ide_port_info *);
1211void ide_port_unregister_devices(ide_hwif_t *);
1212void ide_port_scan(ide_hwif_t *);
1207 1213
1208static inline void *ide_get_hwifdata (ide_hwif_t * hwif) 1214static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
1209{ 1215{
@@ -1279,6 +1285,7 @@ extern struct mutex ide_cfg_mtx;
1279#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0) 1285#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0)
1280 1286
1281extern struct bus_type ide_bus_type; 1287extern struct bus_type ide_bus_type;
1288extern struct class *ide_port_class;
1282 1289
1283/* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ 1290/* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */
1284#define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) 1291#define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000)
@@ -1307,7 +1314,10 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
1307 1314
1308static inline void ide_set_irq(ide_drive_t *drive, int on) 1315static inline void ide_set_irq(ide_drive_t *drive, int on)
1309{ 1316{
1310 drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG); 1317 ide_hwif_t *hwif = drive->hwif;
1318
1319 hwif->OUTB(drive->ctl | (on ? 0 : 2),
1320 hwif->io_ports[IDE_CONTROL_OFFSET]);
1311} 1321}
1312 1322
1313static inline u8 ide_read_status(ide_drive_t *drive) 1323static inline u8 ide_read_status(ide_drive_t *drive)
@@ -1331,4 +1341,26 @@ static inline u8 ide_read_error(ide_drive_t *drive)
1331 return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]); 1341 return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]);
1332} 1342}
1333 1343
1344/*
1345 * Too bad. The drive wants to send us data which we are not ready to accept.
1346 * Just throw it away.
1347 */
1348static inline void ide_atapi_discard_data(ide_drive_t *drive, unsigned bcount)
1349{
1350 ide_hwif_t *hwif = drive->hwif;
1351
1352 /* FIXME: use ->atapi_input_bytes */
1353 while (bcount--)
1354 (void)hwif->INB(hwif->io_ports[IDE_DATA_OFFSET]);
1355}
1356
1357static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount)
1358{
1359 ide_hwif_t *hwif = drive->hwif;
1360
1361 /* FIXME: use ->atapi_output_bytes */
1362 while (bcount--)
1363 hwif->OUTB(0, hwif->io_ports[IDE_DATA_OFFSET]);
1364}
1365
1334#endif /* _IDE_H */ 1366#endif /* _IDE_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index f577c8f1c66d..f27d11ab418b 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -97,6 +97,7 @@
97#define IEEE80211_MAX_FRAME_LEN 2352 97#define IEEE80211_MAX_FRAME_LEN 2352
98 98
99#define IEEE80211_MAX_SSID_LEN 32 99#define IEEE80211_MAX_SSID_LEN 32
100#define IEEE80211_MAX_MESH_ID_LEN 32
100 101
101struct ieee80211_hdr { 102struct ieee80211_hdr {
102 __le16 frame_control; 103 __le16 frame_control;
@@ -109,6 +110,16 @@ struct ieee80211_hdr {
109} __attribute__ ((packed)); 110} __attribute__ ((packed));
110 111
111 112
113struct ieee80211s_hdr {
114 u8 flags;
115 u8 ttl;
116 u8 seqnum[3];
117 u8 eaddr1[6];
118 u8 eaddr2[6];
119 u8 eaddr3[6];
120} __attribute__ ((packed));
121
122
112struct ieee80211_mgmt { 123struct ieee80211_mgmt {
113 __le16 frame_control; 124 __le16 frame_control;
114 __le16 duration; 125 __le16 duration;
@@ -206,6 +217,23 @@ struct ieee80211_mgmt {
206 __le16 params; 217 __le16 params;
207 __le16 reason_code; 218 __le16 reason_code;
208 } __attribute__((packed)) delba; 219 } __attribute__((packed)) delba;
220 struct{
221 u8 action_code;
222 /* capab_info for open and confirm,
223 * reason for close
224 */
225 __le16 aux;
226 /* Followed in plink_confirm by status
227 * code, AID and supported rates,
228 * and directly by supported rates in
229 * plink_open and plink_close
230 */
231 u8 variable[0];
232 } __attribute__((packed)) plink_action;
233 struct{
234 u8 action_code;
235 u8 variable[0];
236 } __attribute__((packed)) mesh_action;
209 } u; 237 } u;
210 } __attribute__ ((packed)) action; 238 } __attribute__ ((packed)) action;
211 } u; 239 } u;
@@ -437,6 +465,13 @@ enum ieee80211_eid {
437 WLAN_EID_TS_DELAY = 43, 465 WLAN_EID_TS_DELAY = 43,
438 WLAN_EID_TCLAS_PROCESSING = 44, 466 WLAN_EID_TCLAS_PROCESSING = 44,
439 WLAN_EID_QOS_CAPA = 46, 467 WLAN_EID_QOS_CAPA = 46,
468 /* 802.11s */
469 WLAN_EID_MESH_CONFIG = 36, /* Pending IEEE 802.11 ANA approval */
470 WLAN_EID_MESH_ID = 37, /* Pending IEEE 802.11 ANA approval */
471 WLAN_EID_PEER_LINK = 40, /* Pending IEEE 802.11 ANA approval */
472 WLAN_EID_PREQ = 53, /* Pending IEEE 802.11 ANA approval */
473 WLAN_EID_PREP = 54, /* Pending IEEE 802.11 ANA approval */
474 WLAN_EID_PERR = 55, /* Pending IEEE 802.11 ANA approval */
440 /* 802.11h */ 475 /* 802.11h */
441 WLAN_EID_PWR_CONSTRAINT = 32, 476 WLAN_EID_PWR_CONSTRAINT = 32,
442 WLAN_EID_PWR_CAPABILITY = 33, 477 WLAN_EID_PWR_CAPABILITY = 33,
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 296e8e86e91d..4d3401812e6c 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -156,6 +156,12 @@ static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
156{ 156{
157 return (struct arphdr *)skb_network_header(skb); 157 return (struct arphdr *)skb_network_header(skb);
158} 158}
159
160static inline int arp_hdr_len(struct net_device *dev)
161{
162 /* ARP header, plus 2 device addresses, plus 2 IP addresses. */
163 return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2;
164}
159#endif 165#endif
160 166
161#endif /* _LINUX_IF_ARP_H */ 167#endif /* _LINUX_IF_ARP_H */
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 72f1c5f47be3..8c71fe2fb1f5 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -18,47 +18,8 @@
18#ifndef __IF_TUN_H 18#ifndef __IF_TUN_H
19#define __IF_TUN_H 19#define __IF_TUN_H
20 20
21/* Uncomment to enable debugging */
22/* #define TUN_DEBUG 1 */
23
24#include <linux/types.h> 21#include <linux/types.h>
25 22
26#ifdef __KERNEL__
27
28#ifdef TUN_DEBUG
29#define DBG if(tun->debug)printk
30#define DBG1 if(debug==2)printk
31#else
32#define DBG( a... )
33#define DBG1( a... )
34#endif
35
36struct tun_struct {
37 struct list_head list;
38 unsigned long flags;
39 int attached;
40 uid_t owner;
41 gid_t group;
42
43 wait_queue_head_t read_wait;
44 struct sk_buff_head readq;
45
46 struct net_device *dev;
47
48 struct fasync_struct *fasync;
49
50 unsigned long if_flags;
51 u8 dev_addr[ETH_ALEN];
52 u32 chr_filter[2];
53 u32 net_filter[2];
54
55#ifdef TUN_DEBUG
56 int debug;
57#endif
58};
59
60#endif /* __KERNEL__ */
61
62/* Read queue size */ 23/* Read queue size */
63#define TUN_READQ_SIZE 500 24#define TUN_READQ_SIZE 500
64 25
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 228eb4eb3129..f1fbe9c930d7 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -7,6 +7,10 @@
7#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) 7#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
8#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) 8#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2)
9#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) 9#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3)
10#define SIOCGETPRL (SIOCDEVPRIVATE + 4)
11#define SIOCADDPRL (SIOCDEVPRIVATE + 5)
12#define SIOCDELPRL (SIOCDEVPRIVATE + 6)
13#define SIOCCHGPRL (SIOCDEVPRIVATE + 7)
10 14
11#define GRE_CSUM __constant_htons(0x8000) 15#define GRE_CSUM __constant_htons(0x8000)
12#define GRE_ROUTING __constant_htons(0x4000) 16#define GRE_ROUTING __constant_htons(0x4000)
@@ -17,9 +21,6 @@
17#define GRE_FLAGS __constant_htons(0x00F8) 21#define GRE_FLAGS __constant_htons(0x00F8)
18#define GRE_VERSION __constant_htons(0x0007) 22#define GRE_VERSION __constant_htons(0x0007)
19 23
20/* i_flags values for SIT mode */
21#define SIT_ISATAP 0x0001
22
23struct ip_tunnel_parm 24struct ip_tunnel_parm
24{ 25{
25 char name[IFNAMSIZ]; 26 char name[IFNAMSIZ];
@@ -31,4 +32,19 @@ struct ip_tunnel_parm
31 struct iphdr iph; 32 struct iphdr iph;
32}; 33};
33 34
35/* SIT-mode i_flags */
36#define SIT_ISATAP 0x0001
37
38struct ip_tunnel_prl {
39 __be32 addr;
40 __u16 flags;
41 __u16 __reserved;
42 __u32 datalen;
43 __u32 __reserved2;
44 void __user *data;
45};
46
47/* PRL flags */
48#define PRL_DEFAULT 0x0001
49
34#endif /* _IF_TUNNEL_H_ */ 50#endif /* _IF_TUNNEL_H_ */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 79504b22a932..15ace02b7b24 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -81,7 +81,9 @@ extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
81#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS) 81#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS)
82 82
83struct vlan_group { 83struct vlan_group {
84 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ 84 struct net_device *real_dev; /* The ethernet(like) device
85 * the vlan is attached to.
86 */
85 unsigned int nr_vlans; 87 unsigned int nr_vlans;
86 struct hlist_node hlist; /* linked list */ 88 struct hlist_node hlist; /* linked list */
87 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; 89 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
@@ -93,7 +95,7 @@ static inline struct net_device *vlan_group_get_device(struct vlan_group *vg,
93{ 95{
94 struct net_device **array; 96 struct net_device **array;
95 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; 97 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
96 return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN]; 98 return array ? array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] : NULL;
97} 99}
98 100
99static inline void vlan_group_set_device(struct vlan_group *vg, 101static inline void vlan_group_set_device(struct vlan_group *vg,
diff --git a/include/linux/if_wanpipe.h b/include/linux/if_wanpipe.h
deleted file mode 100644
index e594ca6069e5..000000000000
--- a/include/linux/if_wanpipe.h
+++ /dev/null
@@ -1,124 +0,0 @@
1/*****************************************************************************
2* if_wanpipe.h Header file for the Sangoma AF_WANPIPE Socket
3*
4* Author: Nenad Corbic
5*
6* Copyright: (c) 2000 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13*
14* Jan 28, 2000 Nenad Corbic Initial Version
15*
16*****************************************************************************/
17
18#ifndef __LINUX_IF_WAN_PACKET_H
19#define __LINUX_IF_WAN_PACKET_H
20
21struct wan_sockaddr_ll
22{
23 unsigned short sll_family;
24 unsigned short sll_protocol;
25 int sll_ifindex;
26 unsigned short sll_hatype;
27 unsigned char sll_pkttype;
28 unsigned char sll_halen;
29 unsigned char sll_addr[8];
30 unsigned char sll_device[14];
31 unsigned char sll_card[14];
32};
33
34typedef struct
35{
36 unsigned char free;
37 unsigned char state_sk;
38 int rcvbuf;
39 int sndbuf;
40 int rmem;
41 int wmem;
42 int sk_count;
43 unsigned char bound;
44 char name[14];
45 unsigned char d_state;
46 unsigned char svc;
47 unsigned short lcn;
48 unsigned char mbox;
49 unsigned char cmd_busy;
50 unsigned char command;
51 unsigned poll;
52 unsigned poll_cnt;
53 int rblock;
54} wan_debug_hdr_t;
55
56#define MAX_NUM_DEBUG 10
57#define X25_PROT 0x16
58#define PVC_PROT 0x17
59
60typedef struct
61{
62 wan_debug_hdr_t debug[MAX_NUM_DEBUG];
63}wan_debug_t;
64
65#define SIOC_WANPIPE_GET_CALL_DATA (SIOCPROTOPRIVATE + 0)
66#define SIOC_WANPIPE_SET_CALL_DATA (SIOCPROTOPRIVATE + 1)
67#define SIOC_WANPIPE_ACCEPT_CALL (SIOCPROTOPRIVATE + 2)
68#define SIOC_WANPIPE_CLEAR_CALL (SIOCPROTOPRIVATE + 3)
69#define SIOC_WANPIPE_RESET_CALL (SIOCPROTOPRIVATE + 4)
70#define SIOC_WANPIPE_DEBUG (SIOCPROTOPRIVATE + 5)
71#define SIOC_WANPIPE_SET_NONBLOCK (SIOCPROTOPRIVATE + 6)
72#define SIOC_WANPIPE_CHECK_TX (SIOCPROTOPRIVATE + 7)
73#define SIOC_WANPIPE_SOCK_STATE (SIOCPROTOPRIVATE + 8)
74
75/* Packet types */
76
77#define WAN_PACKET_HOST 0 /* To us */
78#define WAN_PACKET_BROADCAST 1 /* To all */
79#define WAN_PACKET_MULTICAST 2 /* To group */
80#define WAN_PACKET_OTHERHOST 3 /* To someone else */
81#define WAN_PACKET_OUTGOING 4 /* Outgoing of any type */
82/* These ones are invisible by user level */
83#define WAN_PACKET_LOOPBACK 5 /* MC/BRD frame looped back */
84#define WAN_PACKET_FASTROUTE 6 /* Fastrouted frame */
85
86
87/* X25 specific */
88#define WAN_PACKET_DATA 7
89#define WAN_PACKET_CMD 8
90#define WAN_PACKET_ASYNC 9
91#define WAN_PACKET_ERR 10
92
93/* Packet socket options */
94
95#define WAN_PACKET_ADD_MEMBERSHIP 1
96#define WAN_PACKET_DROP_MEMBERSHIP 2
97
98#define WAN_PACKET_MR_MULTICAST 0
99#define WAN_PACKET_MR_PROMISC 1
100#define WAN_PACKET_MR_ALLMULTI 2
101
102#ifdef __KERNEL__
103
104/* Private wanpipe socket structures. */
105struct wanpipe_opt
106{
107 void *mbox; /* Mail box */
108 void *card; /* Card bouded to */
109 struct net_device *dev; /* Bounded device */
110 unsigned short lcn; /* Binded LCN */
111 unsigned char svc; /* 0=pvc, 1=svc */
112 unsigned char timer; /* flag for delayed transmit*/
113 struct timer_list tx_timer;
114 unsigned poll_cnt;
115 unsigned char force; /* Used to force sock release */
116 atomic_t packet_sent;
117 unsigned short num;
118};
119
120#define wp_sk(__sk) ((struct wanpipe_opt *)(__sk)->sk_protinfo)
121
122#endif
123
124#endif
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index f510e7e382a8..f5a1a0db2e8e 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -80,27 +80,6 @@ struct igmpv3_query {
80 __be32 srcs[0]; 80 __be32 srcs[0];
81}; 81};
82 82
83#ifdef __KERNEL__
84#include <linux/skbuff.h>
85
86static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
87{
88 return (struct igmphdr *)skb_transport_header(skb);
89}
90
91static inline struct igmpv3_report *
92 igmpv3_report_hdr(const struct sk_buff *skb)
93{
94 return (struct igmpv3_report *)skb_transport_header(skb);
95}
96
97static inline struct igmpv3_query *
98 igmpv3_query_hdr(const struct sk_buff *skb)
99{
100 return (struct igmpv3_query *)skb_transport_header(skb);
101}
102#endif
103
104#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ 83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
105#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ 84#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
106#define IGMP_DVMRP 0x13 /* DVMRP routing */ 85#define IGMP_DVMRP 0x13 /* DVMRP routing */
@@ -151,6 +130,23 @@ static inline struct igmpv3_query *
151#include <linux/timer.h> 130#include <linux/timer.h>
152#include <linux/in.h> 131#include <linux/in.h>
153 132
133static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
134{
135 return (struct igmphdr *)skb_transport_header(skb);
136}
137
138static inline struct igmpv3_report *
139 igmpv3_report_hdr(const struct sk_buff *skb)
140{
141 return (struct igmpv3_report *)skb_transport_header(skb);
142}
143
144static inline struct igmpv3_query *
145 igmpv3_query_hdr(const struct sk_buff *skb)
146{
147 return (struct igmpv3_query *)skb_transport_header(skb);
148}
149
154extern int sysctl_igmp_max_memberships; 150extern int sysctl_igmp_max_memberships;
155extern int sysctl_igmp_max_msf; 151extern int sysctl_igmp_max_msf;
156 152
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 2a61c82af115..bc492048c349 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -48,6 +48,14 @@ extern const struct in6_addr in6addr_any;
48#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } 48#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
49extern const struct in6_addr in6addr_loopback; 49extern const struct in6_addr in6addr_loopback;
50#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } 50#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
51#ifdef __KERNEL__
52extern const struct in6_addr in6addr_linklocal_allnodes;
53#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
54 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
55extern const struct in6_addr in6addr_linklocal_allrouters;
56#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
57 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } }
58#endif
51 59
52struct sockaddr_in6 { 60struct sockaddr_in6 {
53 unsigned short int sin6_family; /* AF_INET6 */ 61 unsigned short int sin6_family; /* AF_INET6 */
@@ -249,4 +257,30 @@ struct in6_flowlabel_req
249 * IP6T_SO_GET_REVISION_TARGET 69 257 * IP6T_SO_GET_REVISION_TARGET 69
250 */ 258 */
251 259
260/* RFC5014: Source address selection */
261#define IPV6_ADDR_PREFERENCES 72
262
263#define IPV6_PREFER_SRC_TMP 0x0001
264#define IPV6_PREFER_SRC_PUBLIC 0x0002
265#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100
266#define IPV6_PREFER_SRC_COA 0x0004
267#define IPV6_PREFER_SRC_HOME 0x0400
268#define IPV6_PREFER_SRC_CGA 0x0008
269#define IPV6_PREFER_SRC_NONCGA 0x0800
270
271/*
272 * Multicast Routing:
273 * see include/linux/mroute6.h.
274 *
275 * MRT6_INIT 200
276 * MRT6_DONE 201
277 * MRT6_ADD_MIF 202
278 * MRT6_DEL_MIF 203
279 * MRT6_ADD_MFC 204
280 * MRT6_DEL_MFC 205
281 * MRT6_VERSION 206
282 * MRT6_ASSERT 207
283 * MRT6_PIM 208
284 * (reserved) 209
285 */
252#endif 286#endif
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index fc4e3db649e8..7009b0cdd06f 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -70,13 +70,13 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
70 ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) 70 ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val))
71 71
72#define IN_DEV_ANDCONF(in_dev, attr) \ 72#define IN_DEV_ANDCONF(in_dev, attr) \
73 (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \ 73 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \
74 IN_DEV_CONF_GET((in_dev), attr)) 74 IN_DEV_CONF_GET((in_dev), attr))
75#define IN_DEV_ORCONF(in_dev, attr) \ 75#define IN_DEV_ORCONF(in_dev, attr) \
76 (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \ 76 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) || \
77 IN_DEV_CONF_GET((in_dev), attr)) 77 IN_DEV_CONF_GET((in_dev), attr))
78#define IN_DEV_MAXCONF(in_dev, attr) \ 78#define IN_DEV_MAXCONF(in_dev, attr) \
79 (max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \ 79 (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \
80 IN_DEV_CONF_GET((in_dev), attr))) 80 IN_DEV_CONF_GET((in_dev), attr)))
81 81
82#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) 82#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
@@ -129,7 +129,7 @@ extern int unregister_inetaddr_notifier(struct notifier_block *nb);
129 129
130extern struct net_device *ip_dev_find(struct net *net, __be32 addr); 130extern struct net_device *ip_dev_find(struct net *net, __be32 addr);
131extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); 131extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
132extern int devinet_ioctl(unsigned int cmd, void __user *); 132extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *);
133extern void devinet_init(void); 133extern void devinet_init(void);
134extern struct in_device *inetdev_by_index(struct net *, int); 134extern struct in_device *inetdev_by_index(struct net *, int);
135extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); 135extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index f8ab4ce70564..b5fef13148bd 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -102,6 +102,25 @@ extern void disable_irq_nosync(unsigned int irq);
102extern void disable_irq(unsigned int irq); 102extern void disable_irq(unsigned int irq);
103extern void enable_irq(unsigned int irq); 103extern void enable_irq(unsigned int irq);
104 104
105#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
106
107extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
108extern int irq_can_set_affinity(unsigned int irq);
109
110#else /* CONFIG_SMP */
111
112static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
113{
114 return -EINVAL;
115}
116
117static inline int irq_can_set_affinity(unsigned int irq)
118{
119 return 0;
120}
121
122#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */
123
105#ifdef CONFIG_GENERIC_HARDIRQS 124#ifdef CONFIG_GENERIC_HARDIRQS
106/* 125/*
107 * Special lockdep variants of irq disabling/enabling. 126 * Special lockdep variants of irq disabling/enabling.
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index cac4b364cd40..2b7a1187cb29 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -91,8 +91,10 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
91 * if ref count is zero, don't allow sharing (ioc is going away, it's 91 * if ref count is zero, don't allow sharing (ioc is going away, it's
92 * a race). 92 * a race).
93 */ 93 */
94 if (ioc && atomic_inc_not_zero(&ioc->refcount)) 94 if (ioc && atomic_inc_not_zero(&ioc->refcount)) {
95 atomic_inc(&ioc->nr_tasks);
95 return ioc; 96 return ioc;
97 }
96 98
97 return NULL; 99 return NULL;
98} 100}
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 4aaefc349a4b..10b666b61add 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -53,7 +53,7 @@ struct ipv6_opt_hdr {
53 /* 53 /*
54 * TLV encoded option data follows. 54 * TLV encoded option data follows.
55 */ 55 */
56}; 56} __attribute__ ((packed)); /* required for some archs */
57 57
58#define ipv6_destopt_hdr ipv6_opt_hdr 58#define ipv6_destopt_hdr ipv6_opt_hdr
59#define ipv6_hopopt_hdr ipv6_opt_hdr 59#define ipv6_hopopt_hdr ipv6_opt_hdr
@@ -160,6 +160,9 @@ struct ipv6_devconf {
160#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 160#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
161 __s32 optimistic_dad; 161 __s32 optimistic_dad;
162#endif 162#endif
163#ifdef CONFIG_IPV6_MROUTE
164 __s32 mc_forwarding;
165#endif
163 void *sysctl; 166 void *sysctl;
164}; 167};
165 168
@@ -190,6 +193,7 @@ enum {
190 DEVCONF_PROXY_NDP, 193 DEVCONF_PROXY_NDP,
191 DEVCONF_OPTIMISTIC_DAD, 194 DEVCONF_OPTIMISTIC_DAD,
192 DEVCONF_ACCEPT_SOURCE_ROUTE, 195 DEVCONF_ACCEPT_SOURCE_ROUTE,
196 DEVCONF_MC_FORWARDING,
193 DEVCONF_MAX 197 DEVCONF_MAX
194}; 198};
195 199
@@ -230,6 +234,7 @@ struct inet6_skb_parm {
230#endif 234#endif
231 235
232#define IP6SKB_XFRM_TRANSFORMED 1 236#define IP6SKB_XFRM_TRANSFORMED 1
237#define IP6SKB_FORWARDED 2
233}; 238};
234 239
235#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 240#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
@@ -274,8 +279,29 @@ struct ipv6_pinfo {
274 279
275 __be32 flow_label; 280 __be32 flow_label;
276 __u32 frag_size; 281 __u32 frag_size;
277 __s16 hop_limit; 282
278 __s16 mcast_hops; 283 /*
284 * Packed in 16bits.
285 * Omit one shift by by putting the signed field at MSB.
286 */
287#if defined(__BIG_ENDIAN_BITFIELD)
288 __s16 hop_limit:9;
289 __u16 __unused_1:7;
290#else
291 __u16 __unused_1:7;
292 __s16 hop_limit:9;
293#endif
294
295#if defined(__BIG_ENDIAN_BITFIELD)
296 /* Packed in 16bits. */
297 __s16 mcast_hops:9;
298 __u16 __unused_2:6,
299 mc_loop:1;
300#else
301 __u16 mc_loop:1,
302 __unused_2:6;
303 __s16 mcast_hops:9;
304#endif
279 int mcast_oif; 305 int mcast_oif;
280 306
281 /* pktoption flags */ 307 /* pktoption flags */
@@ -298,11 +324,14 @@ struct ipv6_pinfo {
298 } rxopt; 324 } rxopt;
299 325
300 /* sockopt flags */ 326 /* sockopt flags */
301 __u8 mc_loop:1, 327 __u8 recverr:1,
302 recverr:1,
303 sndflow:1, 328 sndflow:1,
304 pmtudisc:2, 329 pmtudisc:2,
305 ipv6only:1; 330 ipv6only:1,
331 srcprefs:3; /* 001: prefer temporary address
332 * 010: prefer public address
333 * 100: prefer care-of address
334 */
306 __u8 tclass; 335 __u8 tclass;
307 336
308 __u32 dst_cookie; 337 __u32 dst_cookie;
@@ -315,9 +344,8 @@ struct ipv6_pinfo {
315 struct sk_buff *pktoptions; 344 struct sk_buff *pktoptions;
316 struct { 345 struct {
317 struct ipv6_txoptions *opt; 346 struct ipv6_txoptions *opt;
318 struct rt6_info *rt; 347 u8 hop_limit;
319 int hop_limit; 348 u8 tclass;
320 int tclass;
321 } cork; 349 } cork;
322}; 350};
323 351
@@ -458,7 +486,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
458#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 486#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
459 487
460#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ 488#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
461 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ 489 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
462 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 490 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
463 ((__sk)->sk_family == AF_INET6) && \ 491 ((__sk)->sk_family == AF_INET6) && \
464 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 492 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
@@ -466,7 +494,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
466 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 494 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
467 495
468#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \ 496#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \
469 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ 497 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
470 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \ 498 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \
471 ((__sk)->sk_family == PF_INET6) && \ 499 ((__sk)->sk_family == PF_INET6) && \
472 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \ 500 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 176e5e790a44..1883a85625dd 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -228,21 +228,11 @@ static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
228 228
229#endif /* CONFIG_GENERIC_PENDING_IRQ */ 229#endif /* CONFIG_GENERIC_PENDING_IRQ */
230 230
231extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
232extern int irq_can_set_affinity(unsigned int irq);
233
234#else /* CONFIG_SMP */ 231#else /* CONFIG_SMP */
235 232
236#define move_native_irq(x) 233#define move_native_irq(x)
237#define move_masked_irq(x) 234#define move_masked_irq(x)
238 235
239static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
240{
241 return -EINVAL;
242}
243
244static inline int irq_can_set_affinity(unsigned int irq) { return 0; }
245
246#endif /* CONFIG_SMP */ 236#endif /* CONFIG_SMP */
247 237
248#ifdef CONFIG_IRQBALANCE 238#ifdef CONFIG_IRQBALANCE
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 9cb2855bb170..44cd663c53b6 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -16,14 +16,8 @@
16 16
17#include <linux/ioctl.h> 17#include <linux/ioctl.h>
18 18
19#ifdef CONFIG_COBALT_MICRO_SERVER
20/* Save memory */
21#define ISDN_MAX_DRIVERS 2
22#define ISDN_MAX_CHANNELS 8
23#else
24#define ISDN_MAX_DRIVERS 32 19#define ISDN_MAX_DRIVERS 32
25#define ISDN_MAX_CHANNELS 64 20#define ISDN_MAX_CHANNELS 64
26#endif
27 21
28/* New ioctl-codes */ 22/* New ioctl-codes */
29#define IIOCNETAIF _IO('I',1) 23#define IIOCNETAIF _IO('I',1)
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
new file mode 100644
index 000000000000..9757b1a6d9dc
--- /dev/null
+++ b/include/linux/kgdb.h
@@ -0,0 +1,281 @@
1/*
2 * This provides the callbacks and functions that KGDB needs to share between
3 * the core, I/O and arch-specific portions.
4 *
5 * Author: Amit Kale <amitkale@linsyssoft.com> and
6 * Tom Rini <trini@kernel.crashing.org>
7 *
8 * 2001-2004 (c) Amit S. Kale and 2003-2005 (c) MontaVista Software, Inc.
9 * This file is licensed under the terms of the GNU General Public License
10 * version 2. This program is licensed "as is" without any warranty of any
11 * kind, whether express or implied.
12 */
13#ifndef _KGDB_H_
14#define _KGDB_H_
15
16#include <linux/serial_8250.h>
17#include <linux/linkage.h>
18#include <linux/init.h>
19
20#include <asm/atomic.h>
21#include <asm/kgdb.h>
22
23struct pt_regs;
24
25/**
26 * kgdb_skipexception - (optional) exit kgdb_handle_exception early
27 * @exception: Exception vector number
28 * @regs: Current &struct pt_regs.
29 *
30 * On some architectures it is required to skip a breakpoint
31 * exception when it occurs after a breakpoint has been removed.
32 * This can be implemented in the architecture specific portion of
33 * for kgdb.
34 */
35extern int kgdb_skipexception(int exception, struct pt_regs *regs);
36
37/**
38 * kgdb_post_primary_code - (optional) Save error vector/code numbers.
39 * @regs: Original pt_regs.
40 * @e_vector: Original error vector.
41 * @err_code: Original error code.
42 *
43 * This is usually needed on architectures which support SMP and
44 * KGDB. This function is called after all the secondary cpus have
45 * been put to a know spin state and the primary CPU has control over
46 * KGDB.
47 */
48extern void kgdb_post_primary_code(struct pt_regs *regs, int e_vector,
49 int err_code);
50
51/**
52 * kgdb_disable_hw_debug - (optional) Disable hardware debugging hook
53 * @regs: Current &struct pt_regs.
54 *
55 * This function will be called if the particular architecture must
56 * disable hardware debugging while it is processing gdb packets or
57 * handling exception.
58 */
59extern void kgdb_disable_hw_debug(struct pt_regs *regs);
60
61struct tasklet_struct;
62struct task_struct;
63struct uart_port;
64
65/**
66 * kgdb_breakpoint - compiled in breakpoint
67 *
68 * This will be impelmented a static inline per architecture. This
69 * function is called by the kgdb core to execute an architecture
70 * specific trap to cause kgdb to enter the exception processing.
71 *
72 */
73void kgdb_breakpoint(void);
74
75extern int kgdb_connected;
76
77extern atomic_t kgdb_setting_breakpoint;
78extern atomic_t kgdb_cpu_doing_single_step;
79
80extern struct task_struct *kgdb_usethread;
81extern struct task_struct *kgdb_contthread;
82
83enum kgdb_bptype {
84 BP_BREAKPOINT = 0,
85 BP_HARDWARE_BREAKPOINT,
86 BP_WRITE_WATCHPOINT,
87 BP_READ_WATCHPOINT,
88 BP_ACCESS_WATCHPOINT
89};
90
91enum kgdb_bpstate {
92 BP_UNDEFINED = 0,
93 BP_REMOVED,
94 BP_SET,
95 BP_ACTIVE
96};
97
98struct kgdb_bkpt {
99 unsigned long bpt_addr;
100 unsigned char saved_instr[BREAK_INSTR_SIZE];
101 enum kgdb_bptype type;
102 enum kgdb_bpstate state;
103};
104
105#ifndef KGDB_MAX_BREAKPOINTS
106# define KGDB_MAX_BREAKPOINTS 1000
107#endif
108
109#define KGDB_HW_BREAKPOINT 1
110
111/*
112 * Functions each KGDB-supporting architecture must provide:
113 */
114
115/**
116 * kgdb_arch_init - Perform any architecture specific initalization.
117 *
118 * This function will handle the initalization of any architecture
119 * specific callbacks.
120 */
121extern int kgdb_arch_init(void);
122
123/**
124 * kgdb_arch_exit - Perform any architecture specific uninitalization.
125 *
126 * This function will handle the uninitalization of any architecture
127 * specific callbacks, for dynamic registration and unregistration.
128 */
129extern void kgdb_arch_exit(void);
130
131/**
132 * pt_regs_to_gdb_regs - Convert ptrace regs to GDB regs
133 * @gdb_regs: A pointer to hold the registers in the order GDB wants.
134 * @regs: The &struct pt_regs of the current process.
135 *
136 * Convert the pt_regs in @regs into the format for registers that
137 * GDB expects, stored in @gdb_regs.
138 */
139extern void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs);
140
141/**
142 * sleeping_thread_to_gdb_regs - Convert ptrace regs to GDB regs
143 * @gdb_regs: A pointer to hold the registers in the order GDB wants.
144 * @p: The &struct task_struct of the desired process.
145 *
146 * Convert the register values of the sleeping process in @p to
147 * the format that GDB expects.
148 * This function is called when kgdb does not have access to the
149 * &struct pt_regs and therefore it should fill the gdb registers
150 * @gdb_regs with what has been saved in &struct thread_struct
151 * thread field during switch_to.
152 */
153extern void
154sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p);
155
156/**
157 * gdb_regs_to_pt_regs - Convert GDB regs to ptrace regs.
158 * @gdb_regs: A pointer to hold the registers we've received from GDB.
159 * @regs: A pointer to a &struct pt_regs to hold these values in.
160 *
161 * Convert the GDB regs in @gdb_regs into the pt_regs, and store them
162 * in @regs.
163 */
164extern void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs);
165
166/**
167 * kgdb_arch_handle_exception - Handle architecture specific GDB packets.
168 * @vector: The error vector of the exception that happened.
169 * @signo: The signal number of the exception that happened.
170 * @err_code: The error code of the exception that happened.
171 * @remcom_in_buffer: The buffer of the packet we have read.
172 * @remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into.
173 * @regs: The &struct pt_regs of the current process.
174 *
175 * This function MUST handle the 'c' and 's' command packets,
176 * as well packets to set / remove a hardware breakpoint, if used.
177 * If there are additional packets which the hardware needs to handle,
178 * they are handled here. The code should return -1 if it wants to
179 * process more packets, and a %0 or %1 if it wants to exit from the
180 * kgdb callback.
181 */
182extern int
183kgdb_arch_handle_exception(int vector, int signo, int err_code,
184 char *remcom_in_buffer,
185 char *remcom_out_buffer,
186 struct pt_regs *regs);
187
188/**
189 * kgdb_roundup_cpus - Get other CPUs into a holding pattern
190 * @flags: Current IRQ state
191 *
192 * On SMP systems, we need to get the attention of the other CPUs
193 * and get them be in a known state. This should do what is needed
194 * to get the other CPUs to call kgdb_wait(). Note that on some arches,
195 * the NMI approach is not used for rounding up all the CPUs. For example,
196 * in case of MIPS, smp_call_function() is used to roundup CPUs. In
197 * this case, we have to make sure that interrupts are enabled before
198 * calling smp_call_function(). The argument to this function is
199 * the flags that will be used when restoring the interrupts. There is
200 * local_irq_save() call before kgdb_roundup_cpus().
201 *
202 * On non-SMP systems, this is not called.
203 */
204extern void kgdb_roundup_cpus(unsigned long flags);
205
206/* Optional functions. */
207extern int kgdb_validate_break_address(unsigned long addr);
208extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr);
209extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle);
210
211/**
212 * struct kgdb_arch - Describe architecture specific values.
213 * @gdb_bpt_instr: The instruction to trigger a breakpoint.
214 * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT.
215 * @set_breakpoint: Allow an architecture to specify how to set a software
216 * breakpoint.
217 * @remove_breakpoint: Allow an architecture to specify how to remove a
218 * software breakpoint.
219 * @set_hw_breakpoint: Allow an architecture to specify how to set a hardware
220 * breakpoint.
221 * @remove_hw_breakpoint: Allow an architecture to specify how to remove a
222 * hardware breakpoint.
223 * @remove_all_hw_break: Allow an architecture to specify how to remove all
224 * hardware breakpoints.
225 * @correct_hw_break: Allow an architecture to specify how to correct the
226 * hardware debug registers.
227 */
228struct kgdb_arch {
229 unsigned char gdb_bpt_instr[BREAK_INSTR_SIZE];
230 unsigned long flags;
231
232 int (*set_breakpoint)(unsigned long, char *);
233 int (*remove_breakpoint)(unsigned long, char *);
234 int (*set_hw_breakpoint)(unsigned long, int, enum kgdb_bptype);
235 int (*remove_hw_breakpoint)(unsigned long, int, enum kgdb_bptype);
236 void (*remove_all_hw_break)(void);
237 void (*correct_hw_break)(void);
238};
239
240/**
241 * struct kgdb_io - Describe the interface for an I/O driver to talk with KGDB.
242 * @name: Name of the I/O driver.
243 * @read_char: Pointer to a function that will return one char.
244 * @write_char: Pointer to a function that will write one char.
245 * @flush: Pointer to a function that will flush any pending writes.
246 * @init: Pointer to a function that will initialize the device.
247 * @pre_exception: Pointer to a function that will do any prep work for
248 * the I/O driver.
249 * @post_exception: Pointer to a function that will do any cleanup work
250 * for the I/O driver.
251 */
252struct kgdb_io {
253 const char *name;
254 int (*read_char) (void);
255 void (*write_char) (u8);
256 void (*flush) (void);
257 int (*init) (void);
258 void (*pre_exception) (void);
259 void (*post_exception) (void);
260};
261
262extern struct kgdb_arch arch_kgdb_ops;
263
264extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops);
265extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
266
267extern int kgdb_hex2long(char **ptr, long *long_val);
268extern int kgdb_mem2hex(char *mem, char *buf, int count);
269extern int kgdb_hex2mem(char *buf, char *mem, int count);
270
271extern int kgdb_isremovedbreak(unsigned long addr);
272
273extern int
274kgdb_handle_exception(int ex_vector, int signo, int err_code,
275 struct pt_regs *regs);
276extern int kgdb_nmicallback(int cpu, void *regs);
277
278extern int kgdb_single_step;
279extern atomic_t kgdb_active;
280
281#endif /* _KGDB_H_ */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 37ee881c42ac..165734a2dd47 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -122,6 +122,8 @@ enum {
122 122
123 ATAPI_MAX_DRAIN = 16 << 10, 123 ATAPI_MAX_DRAIN = 16 << 10,
124 124
125 ATA_ALL_DEVICES = (1 << ATA_MAX_DEVICES) - 1,
126
125 ATA_SHT_EMULATED = 1, 127 ATA_SHT_EMULATED = 1,
126 ATA_SHT_CMD_PER_LUN = 1, 128 ATA_SHT_CMD_PER_LUN = 1,
127 ATA_SHT_THIS_ID = -1, 129 ATA_SHT_THIS_ID = -1,
@@ -163,9 +165,6 @@ enum {
163 ATA_DEV_NONE = 9, /* no device */ 165 ATA_DEV_NONE = 9, /* no device */
164 166
165 /* struct ata_link flags */ 167 /* struct ata_link flags */
166 ATA_LFLAG_HRST_TO_RESUME = (1 << 0), /* hardreset to resume link */
167 ATA_LFLAG_SKIP_D2H_BSY = (1 << 1), /* can't wait for the first D2H
168 * Register FIS clearing BSY */
169 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ 168 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */
170 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ 169 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */
171 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */ 170 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */
@@ -225,6 +224,7 @@ enum {
225 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ 224 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */
226 ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */ 225 ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */
227 ATA_QCFLAG_QUIET = (1 << 6), /* don't report device error */ 226 ATA_QCFLAG_QUIET = (1 << 6), /* don't report device error */
227 ATA_QCFLAG_RETRY = (1 << 7), /* retry after failure */
228 228
229 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */ 229 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */
230 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */ 230 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */
@@ -249,6 +249,25 @@ enum {
249 */ 249 */
250 ATA_TMOUT_FF_WAIT = 4 * HZ / 5, 250 ATA_TMOUT_FF_WAIT = 4 * HZ / 5,
251 251
252 /* Spec mandates to wait for ">= 2ms" before checking status
253 * after reset. We wait 150ms, because that was the magic
254 * delay used for ATAPI devices in Hale Landis's ATADRVR, for
255 * the period of time between when the ATA command register is
256 * written, and then status is checked. Because waiting for
257 * "a while" before checking status is fine, post SRST, we
258 * perform this magic delay here as well.
259 *
260 * Old drivers/ide uses the 2mS rule and then waits for ready.
261 */
262 ATA_WAIT_AFTER_RESET_MSECS = 150,
263
264 /* If PMP is supported, we have to do follow-up SRST. As some
265 * PMPs don't send D2H Reg FIS after hardreset, LLDs are
266 * advised to wait only for the following duration before
267 * doing SRST.
268 */
269 ATA_TMOUT_PMP_SRST_WAIT = 1 * HZ,
270
252 /* ATA bus states */ 271 /* ATA bus states */
253 BUS_UNKNOWN = 0, 272 BUS_UNKNOWN = 0,
254 BUS_DMA = 1, 273 BUS_DMA = 1,
@@ -292,17 +311,16 @@ enum {
292 311
293 /* reset / recovery action types */ 312 /* reset / recovery action types */
294 ATA_EH_REVALIDATE = (1 << 0), 313 ATA_EH_REVALIDATE = (1 << 0),
295 ATA_EH_SOFTRESET = (1 << 1), 314 ATA_EH_SOFTRESET = (1 << 1), /* meaningful only in ->prereset */
296 ATA_EH_HARDRESET = (1 << 2), 315 ATA_EH_HARDRESET = (1 << 2), /* meaningful only in ->prereset */
316 ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
297 ATA_EH_ENABLE_LINK = (1 << 3), 317 ATA_EH_ENABLE_LINK = (1 << 3),
298 ATA_EH_LPM = (1 << 4), /* link power management action */ 318 ATA_EH_LPM = (1 << 4), /* link power management action */
299 319
300 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
301 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, 320 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE,
302 321
303 /* ata_eh_info->flags */ 322 /* ata_eh_info->flags */
304 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ 323 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */
305 ATA_EHI_RESUME_LINK = (1 << 1), /* resume link (reset modifier) */
306 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ 324 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */
307 ATA_EHI_QUIET = (1 << 3), /* be quiet */ 325 ATA_EHI_QUIET = (1 << 3), /* be quiet */
308 326
@@ -313,7 +331,6 @@ enum {
313 ATA_EHI_POST_SETMODE = (1 << 20), /* revaildating after setmode */ 331 ATA_EHI_POST_SETMODE = (1 << 20), /* revaildating after setmode */
314 332
315 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, 333 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,
316 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
317 334
318 /* max tries if error condition is still set after ->error_handler */ 335 /* max tries if error condition is still set after ->error_handler */
319 ATA_EH_MAX_TRIES = 5, 336 ATA_EH_MAX_TRIES = 5,
@@ -352,6 +369,22 @@ enum {
352 ATAPI_READ_CD = 2, /* READ CD [MSF] */ 369 ATAPI_READ_CD = 2, /* READ CD [MSF] */
353 ATAPI_PASS_THRU = 3, /* SAT pass-thru */ 370 ATAPI_PASS_THRU = 3, /* SAT pass-thru */
354 ATAPI_MISC = 4, /* the rest */ 371 ATAPI_MISC = 4, /* the rest */
372
373 /* Timing constants */
374 ATA_TIMING_SETUP = (1 << 0),
375 ATA_TIMING_ACT8B = (1 << 1),
376 ATA_TIMING_REC8B = (1 << 2),
377 ATA_TIMING_CYC8B = (1 << 3),
378 ATA_TIMING_8BIT = ATA_TIMING_ACT8B | ATA_TIMING_REC8B |
379 ATA_TIMING_CYC8B,
380 ATA_TIMING_ACTIVE = (1 << 4),
381 ATA_TIMING_RECOVER = (1 << 5),
382 ATA_TIMING_CYCLE = (1 << 6),
383 ATA_TIMING_UDMA = (1 << 7),
384 ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B |
385 ATA_TIMING_REC8B | ATA_TIMING_CYC8B |
386 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER |
387 ATA_TIMING_CYCLE | ATA_TIMING_UDMA,
355}; 388};
356 389
357enum ata_xfer_mask { 390enum ata_xfer_mask {
@@ -412,6 +445,7 @@ enum link_pm {
412}; 445};
413extern struct class_device_attribute class_device_attr_link_power_management_policy; 446extern struct class_device_attribute class_device_attr_link_power_management_policy;
414 447
448#ifdef CONFIG_ATA_SFF
415struct ata_ioports { 449struct ata_ioports {
416 void __iomem *cmd_addr; 450 void __iomem *cmd_addr;
417 void __iomem *data_addr; 451 void __iomem *data_addr;
@@ -429,6 +463,7 @@ struct ata_ioports {
429 void __iomem *bmdma_addr; 463 void __iomem *bmdma_addr;
430 void __iomem *scr_addr; 464 void __iomem *scr_addr;
431}; 465};
466#endif /* CONFIG_ATA_SFF */
432 467
433struct ata_host { 468struct ata_host {
434 spinlock_t lock; 469 spinlock_t lock;
@@ -436,7 +471,7 @@ struct ata_host {
436 void __iomem * const *iomap; 471 void __iomem * const *iomap;
437 unsigned int n_ports; 472 unsigned int n_ports;
438 void *private_data; 473 void *private_data;
439 const struct ata_port_operations *ops; 474 struct ata_port_operations *ops;
440 unsigned long flags; 475 unsigned long flags;
441#ifdef CONFIG_ATA_ACPI 476#ifdef CONFIG_ATA_ACPI
442 acpi_handle acpi_handle; 477 acpi_handle acpi_handle;
@@ -605,7 +640,7 @@ struct ata_link {
605 640
606struct ata_port { 641struct ata_port {
607 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ 642 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
608 const struct ata_port_operations *ops; 643 struct ata_port_operations *ops;
609 spinlock_t *lock; 644 spinlock_t *lock;
610 unsigned long flags; /* ATA_FLAG_xxx */ 645 unsigned long flags; /* ATA_FLAG_xxx */
611 unsigned int pflags; /* ATA_PFLAG_xxx */ 646 unsigned int pflags; /* ATA_PFLAG_xxx */
@@ -615,7 +650,9 @@ struct ata_port {
615 struct ata_prd *prd; /* our SG list */ 650 struct ata_prd *prd; /* our SG list */
616 dma_addr_t prd_dma; /* and its DMA mapping */ 651 dma_addr_t prd_dma; /* and its DMA mapping */
617 652
653#ifdef CONFIG_ATA_SFF
618 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ 654 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */
655#endif /* CONFIG_ATA_SFF */
619 656
620 u8 ctl; /* cache of ATA control register */ 657 u8 ctl; /* cache of ATA control register */
621 u8 last_ctl; /* Cache last written value */ 658 u8 last_ctl; /* Cache last written value */
@@ -667,81 +704,108 @@ struct ata_port {
667 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ 704 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */
668}; 705};
669 706
670struct ata_port_operations { 707/* The following initializer overrides a method to NULL whether one of
671 void (*dev_config) (struct ata_device *); 708 * its parent has the method defined or not. This is equivalent to
672 709 * ERR_PTR(-ENOENT). Unfortunately, ERR_PTR doesn't render a constant
673 void (*set_piomode) (struct ata_port *, struct ata_device *); 710 * expression and thus can't be used as an initializer.
674 void (*set_dmamode) (struct ata_port *, struct ata_device *); 711 */
675 unsigned long (*mode_filter) (struct ata_device *, unsigned long); 712#define ATA_OP_NULL (void *)(unsigned long)(-ENOENT)
676
677 void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf);
678 void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);
679
680 void (*exec_command)(struct ata_port *ap, const struct ata_taskfile *tf);
681 u8 (*check_status)(struct ata_port *ap);
682 u8 (*check_altstatus)(struct ata_port *ap);
683 void (*dev_select)(struct ata_port *ap, unsigned int device);
684
685 void (*phy_reset) (struct ata_port *ap); /* obsolete */
686 int (*set_mode) (struct ata_link *link, struct ata_device **r_failed_dev);
687
688 int (*cable_detect) (struct ata_port *ap);
689
690 int (*check_atapi_dma) (struct ata_queued_cmd *qc);
691
692 void (*bmdma_setup) (struct ata_queued_cmd *qc);
693 void (*bmdma_start) (struct ata_queued_cmd *qc);
694
695 unsigned int (*data_xfer) (struct ata_device *dev, unsigned char *buf,
696 unsigned int buflen, int rw);
697
698 int (*qc_defer) (struct ata_queued_cmd *qc);
699 void (*qc_prep) (struct ata_queued_cmd *qc);
700 unsigned int (*qc_issue) (struct ata_queued_cmd *qc);
701
702 /* port multiplier */
703 void (*pmp_attach) (struct ata_port *ap);
704 void (*pmp_detach) (struct ata_port *ap);
705 713
706 /* Error handlers. ->error_handler overrides ->eng_timeout and 714struct ata_port_operations {
707 * indicates that new-style EH is in place. 715 /*
716 * Command execution
708 */ 717 */
709 void (*eng_timeout) (struct ata_port *ap); /* obsolete */ 718 int (*qc_defer)(struct ata_queued_cmd *qc);
710 719 int (*check_atapi_dma)(struct ata_queued_cmd *qc);
711 void (*freeze) (struct ata_port *ap); 720 void (*qc_prep)(struct ata_queued_cmd *qc);
712 void (*thaw) (struct ata_port *ap); 721 unsigned int (*qc_issue)(struct ata_queued_cmd *qc);
713 void (*error_handler) (struct ata_port *ap); 722 bool (*qc_fill_rtf)(struct ata_queued_cmd *qc);
714 void (*post_internal_cmd) (struct ata_queued_cmd *qc); 723
715 724 /*
716 irq_handler_t irq_handler; 725 * Configuration and exception handling
717 void (*irq_clear) (struct ata_port *); 726 */
718 u8 (*irq_on) (struct ata_port *); 727 int (*cable_detect)(struct ata_port *ap);
719 728 unsigned long (*mode_filter)(struct ata_device *dev, unsigned long xfer_mask);
720 int (*scr_read) (struct ata_port *ap, unsigned int sc_reg, u32 *val); 729 void (*set_piomode)(struct ata_port *ap, struct ata_device *dev);
721 int (*scr_write) (struct ata_port *ap, unsigned int sc_reg, u32 val); 730 void (*set_dmamode)(struct ata_port *ap, struct ata_device *dev);
731 int (*set_mode)(struct ata_link *link, struct ata_device **r_failed_dev);
732
733 void (*dev_config)(struct ata_device *dev);
734
735 void (*freeze)(struct ata_port *ap);
736 void (*thaw)(struct ata_port *ap);
737 ata_prereset_fn_t prereset;
738 ata_reset_fn_t softreset;
739 ata_reset_fn_t hardreset;
740 ata_postreset_fn_t postreset;
741 ata_prereset_fn_t pmp_prereset;
742 ata_reset_fn_t pmp_softreset;
743 ata_reset_fn_t pmp_hardreset;
744 ata_postreset_fn_t pmp_postreset;
745 void (*error_handler)(struct ata_port *ap);
746 void (*post_internal_cmd)(struct ata_queued_cmd *qc);
747
748 /*
749 * Optional features
750 */
751 int (*scr_read)(struct ata_port *ap, unsigned int sc_reg, u32 *val);
752 int (*scr_write)(struct ata_port *ap, unsigned int sc_reg, u32 val);
753 void (*pmp_attach)(struct ata_port *ap);
754 void (*pmp_detach)(struct ata_port *ap);
755 int (*enable_pm)(struct ata_port *ap, enum link_pm policy);
756 void (*disable_pm)(struct ata_port *ap);
757
758 /*
759 * Start, stop, suspend and resume
760 */
761 int (*port_suspend)(struct ata_port *ap, pm_message_t mesg);
762 int (*port_resume)(struct ata_port *ap);
763 int (*port_start)(struct ata_port *ap);
764 void (*port_stop)(struct ata_port *ap);
765 void (*host_stop)(struct ata_host *host);
766
767#ifdef CONFIG_ATA_SFF
768 /*
769 * SFF / taskfile oriented ops
770 */
771 void (*sff_dev_select)(struct ata_port *ap, unsigned int device);
772 u8 (*sff_check_status)(struct ata_port *ap);
773 u8 (*sff_check_altstatus)(struct ata_port *ap);
774 void (*sff_tf_load)(struct ata_port *ap, const struct ata_taskfile *tf);
775 void (*sff_tf_read)(struct ata_port *ap, struct ata_taskfile *tf);
776 void (*sff_exec_command)(struct ata_port *ap,
777 const struct ata_taskfile *tf);
778 unsigned int (*sff_data_xfer)(struct ata_device *dev,
779 unsigned char *buf, unsigned int buflen, int rw);
780 u8 (*sff_irq_on)(struct ata_port *);
781 void (*sff_irq_clear)(struct ata_port *);
722 782
723 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg); 783 void (*bmdma_setup)(struct ata_queued_cmd *qc);
724 int (*port_resume) (struct ata_port *ap); 784 void (*bmdma_start)(struct ata_queued_cmd *qc);
725 int (*enable_pm) (struct ata_port *ap, enum link_pm policy); 785 void (*bmdma_stop)(struct ata_queued_cmd *qc);
726 void (*disable_pm) (struct ata_port *ap); 786 u8 (*bmdma_status)(struct ata_port *ap);
727 int (*port_start) (struct ata_port *ap); 787#endif /* CONFIG_ATA_SFF */
728 void (*port_stop) (struct ata_port *ap);
729 788
730 void (*host_stop) (struct ata_host *host); 789 /*
790 * Obsolete
791 */
792 void (*phy_reset)(struct ata_port *ap);
793 void (*eng_timeout)(struct ata_port *ap);
731 794
732 void (*bmdma_stop) (struct ata_queued_cmd *qc); 795 /*
733 u8 (*bmdma_status) (struct ata_port *ap); 796 * ->inherits must be the last field and all the preceding
797 * fields must be pointers.
798 */
799 const struct ata_port_operations *inherits;
734}; 800};
735 801
736struct ata_port_info { 802struct ata_port_info {
737 struct scsi_host_template *sht;
738 unsigned long flags; 803 unsigned long flags;
739 unsigned long link_flags; 804 unsigned long link_flags;
740 unsigned long pio_mask; 805 unsigned long pio_mask;
741 unsigned long mwdma_mask; 806 unsigned long mwdma_mask;
742 unsigned long udma_mask; 807 unsigned long udma_mask;
743 const struct ata_port_operations *port_ops; 808 struct ata_port_operations *port_ops;
744 irq_handler_t irq_handler;
745 void *private_data; 809 void *private_data;
746}; 810};
747 811
@@ -759,11 +823,14 @@ struct ata_timing {
759 823
760#define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin) 824#define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin)
761 825
826/*
827 * Core layer - drivers/ata/libata-core.c
828 */
762extern const unsigned long sata_deb_timing_normal[]; 829extern const unsigned long sata_deb_timing_normal[];
763extern const unsigned long sata_deb_timing_hotplug[]; 830extern const unsigned long sata_deb_timing_hotplug[];
764extern const unsigned long sata_deb_timing_long[]; 831extern const unsigned long sata_deb_timing_long[];
765 832
766extern const struct ata_port_operations ata_dummy_port_ops; 833extern struct ata_port_operations ata_dummy_port_ops;
767extern const struct ata_port_info ata_dummy_port_info; 834extern const struct ata_port_info ata_dummy_port_info;
768 835
769static inline const unsigned long * 836static inline const unsigned long *
@@ -782,22 +849,21 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
782 849
783extern void sata_print_link_status(struct ata_link *link); 850extern void sata_print_link_status(struct ata_link *link);
784extern void ata_port_probe(struct ata_port *); 851extern void ata_port_probe(struct ata_port *);
785extern void ata_bus_reset(struct ata_port *ap);
786extern int sata_set_spd(struct ata_link *link); 852extern int sata_set_spd(struct ata_link *link);
853extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
854extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline,
855 int (*check_ready)(struct ata_link *link));
787extern int sata_link_debounce(struct ata_link *link, 856extern int sata_link_debounce(struct ata_link *link,
788 const unsigned long *params, unsigned long deadline); 857 const unsigned long *params, unsigned long deadline);
789extern int sata_link_resume(struct ata_link *link, const unsigned long *params, 858extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
790 unsigned long deadline); 859 unsigned long deadline);
791extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
792extern int ata_std_softreset(struct ata_link *link, unsigned int *classes,
793 unsigned long deadline);
794extern int sata_link_hardreset(struct ata_link *link, 860extern int sata_link_hardreset(struct ata_link *link,
795 const unsigned long *timing, unsigned long deadline); 861 const unsigned long *timing, unsigned long deadline,
862 bool *online, int (*check_ready)(struct ata_link *));
796extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, 863extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,
797 unsigned long deadline); 864 unsigned long deadline);
798extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); 865extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);
799extern void ata_port_disable(struct ata_port *); 866extern void ata_port_disable(struct ata_port *);
800extern void ata_std_ports(struct ata_ioports *ioaddr);
801 867
802extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); 868extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
803extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 869extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
@@ -810,7 +876,7 @@ extern int ata_host_activate(struct ata_host *host, int irq,
810 struct scsi_host_template *sht); 876 struct scsi_host_template *sht);
811extern void ata_host_detach(struct ata_host *host); 877extern void ata_host_detach(struct ata_host *host);
812extern void ata_host_init(struct ata_host *, struct device *, 878extern void ata_host_init(struct ata_host *, struct device *,
813 unsigned long, const struct ata_port_operations *); 879 unsigned long, struct ata_port_operations *);
814extern int ata_scsi_detect(struct scsi_host_template *sht); 880extern int ata_scsi_detect(struct scsi_host_template *sht);
815extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 881extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
816extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 882extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
@@ -823,7 +889,6 @@ extern void ata_sas_port_stop(struct ata_port *ap);
823extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); 889extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
824extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), 890extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
825 struct ata_port *ap); 891 struct ata_port *ap);
826extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
827extern int sata_scr_valid(struct ata_link *link); 892extern int sata_scr_valid(struct ata_link *link);
828extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); 893extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
829extern int sata_scr_write(struct ata_link *link, int reg, u32 val); 894extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
@@ -835,21 +900,9 @@ extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
835extern void ata_host_resume(struct ata_host *host); 900extern void ata_host_resume(struct ata_host *host);
836#endif 901#endif
837extern int ata_ratelimit(void); 902extern int ata_ratelimit(void);
838extern int ata_busy_sleep(struct ata_port *ap,
839 unsigned long timeout_pat, unsigned long timeout);
840extern void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline);
841extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline);
842extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 903extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
843 unsigned long interval_msec, 904 unsigned long interval_msec,
844 unsigned long timeout_msec); 905 unsigned long timeout_msec);
845extern unsigned int ata_dev_try_classify(struct ata_device *dev, int present,
846 u8 *r_err);
847
848/*
849 * Default driver ops implementations
850 */
851extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
852extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
853extern int atapi_cmd_type(u8 opcode); 906extern int atapi_cmd_type(u8 opcode);
854extern void ata_tf_to_fis(const struct ata_taskfile *tf, 907extern void ata_tf_to_fis(const struct ata_taskfile *tf,
855 u8 pmp, int is_cmd, u8 *fis); 908 u8 pmp, int is_cmd, u8 *fis);
@@ -864,23 +917,9 @@ extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);
864extern int ata_xfer_mode2shift(unsigned long xfer_mode); 917extern int ata_xfer_mode2shift(unsigned long xfer_mode);
865extern const char *ata_mode_string(unsigned long xfer_mask); 918extern const char *ata_mode_string(unsigned long xfer_mask);
866extern unsigned long ata_id_xfermask(const u16 *id); 919extern unsigned long ata_id_xfermask(const u16 *id);
867extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device);
868extern void ata_std_dev_select(struct ata_port *ap, unsigned int device);
869extern u8 ata_check_status(struct ata_port *ap);
870extern u8 ata_altstatus(struct ata_port *ap);
871extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
872extern int ata_port_start(struct ata_port *ap); 920extern int ata_port_start(struct ata_port *ap);
873extern int ata_sff_port_start(struct ata_port *ap);
874extern irqreturn_t ata_interrupt(int irq, void *dev_instance);
875extern unsigned int ata_data_xfer(struct ata_device *dev,
876 unsigned char *buf, unsigned int buflen, int rw);
877extern unsigned int ata_data_xfer_noirq(struct ata_device *dev,
878 unsigned char *buf, unsigned int buflen, int rw);
879extern int ata_std_qc_defer(struct ata_queued_cmd *qc); 921extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
880extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc);
881extern void ata_qc_prep(struct ata_queued_cmd *qc);
882extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 922extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
883extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
884extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 923extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
885 unsigned int n_elem); 924 unsigned int n_elem);
886extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); 925extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
@@ -889,24 +928,8 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
889 unsigned int ofs, unsigned int len); 928 unsigned int ofs, unsigned int len);
890extern void ata_id_c_string(const u16 *id, unsigned char *s, 929extern void ata_id_c_string(const u16 *id, unsigned char *s,
891 unsigned int ofs, unsigned int len); 930 unsigned int ofs, unsigned int len);
892extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
893extern void ata_bmdma_start(struct ata_queued_cmd *qc);
894extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
895extern u8 ata_bmdma_status(struct ata_port *ap);
896extern void ata_bmdma_irq_clear(struct ata_port *ap);
897extern void ata_bmdma_freeze(struct ata_port *ap);
898extern void ata_bmdma_thaw(struct ata_port *ap);
899extern void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
900 ata_reset_fn_t softreset,
901 ata_reset_fn_t hardreset,
902 ata_postreset_fn_t postreset);
903extern void ata_bmdma_error_handler(struct ata_port *ap);
904extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc);
905extern int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
906 u8 status, int in_wq);
907extern void ata_qc_complete(struct ata_queued_cmd *qc); 931extern void ata_qc_complete(struct ata_queued_cmd *qc);
908extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active, 932extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active);
909 void (*finish_qc)(struct ata_queued_cmd *));
910extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, 933extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
911 void (*done)(struct scsi_cmnd *)); 934 void (*done)(struct scsi_cmnd *));
912extern int ata_std_bios_param(struct scsi_device *sdev, 935extern int ata_std_bios_param(struct scsi_device *sdev,
@@ -918,7 +941,6 @@ extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
918 int queue_depth); 941 int queue_depth);
919extern struct ata_device *ata_dev_pair(struct ata_device *adev); 942extern struct ata_device *ata_dev_pair(struct ata_device *adev);
920extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); 943extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
921extern u8 ata_irq_on(struct ata_port *ap);
922 944
923extern int ata_cable_40wire(struct ata_port *ap); 945extern int ata_cable_40wire(struct ata_port *ap);
924extern int ata_cable_80wire(struct ata_port *ap); 946extern int ata_cable_80wire(struct ata_port *ap);
@@ -926,10 +948,7 @@ extern int ata_cable_sata(struct ata_port *ap);
926extern int ata_cable_ignore(struct ata_port *ap); 948extern int ata_cable_ignore(struct ata_port *ap);
927extern int ata_cable_unknown(struct ata_port *ap); 949extern int ata_cable_unknown(struct ata_port *ap);
928 950
929/* 951/* Timing helpers */
930 * Timing helpers
931 */
932
933extern unsigned int ata_pio_need_iordy(const struct ata_device *); 952extern unsigned int ata_pio_need_iordy(const struct ata_device *);
934extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); 953extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
935extern int ata_timing_compute(struct ata_device *, unsigned short, 954extern int ata_timing_compute(struct ata_device *, unsigned short,
@@ -939,24 +958,31 @@ extern void ata_timing_merge(const struct ata_timing *,
939 unsigned int); 958 unsigned int);
940extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle); 959extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle);
941 960
942enum { 961/* PCI */
943 ATA_TIMING_SETUP = (1 << 0), 962#ifdef CONFIG_PCI
944 ATA_TIMING_ACT8B = (1 << 1), 963struct pci_dev;
945 ATA_TIMING_REC8B = (1 << 2), 964
946 ATA_TIMING_CYC8B = (1 << 3), 965struct pci_bits {
947 ATA_TIMING_8BIT = ATA_TIMING_ACT8B | ATA_TIMING_REC8B | 966 unsigned int reg; /* PCI config register to read */
948 ATA_TIMING_CYC8B, 967 unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */
949 ATA_TIMING_ACTIVE = (1 << 4), 968 unsigned long mask;
950 ATA_TIMING_RECOVER = (1 << 5), 969 unsigned long val;
951 ATA_TIMING_CYCLE = (1 << 6),
952 ATA_TIMING_UDMA = (1 << 7),
953 ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B |
954 ATA_TIMING_REC8B | ATA_TIMING_CYC8B |
955 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER |
956 ATA_TIMING_CYCLE | ATA_TIMING_UDMA,
957}; 970};
958 971
959/* libata-acpi.c */ 972extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
973extern void ata_pci_remove_one(struct pci_dev *pdev);
974
975#ifdef CONFIG_PM
976extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
977extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
978extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
979extern int ata_pci_device_resume(struct pci_dev *pdev);
980#endif /* CONFIG_PM */
981#endif /* CONFIG_PCI */
982
983/*
984 * ACPI - drivers/ata/libata-acpi.c
985 */
960#ifdef CONFIG_ATA_ACPI 986#ifdef CONFIG_ATA_ACPI
961static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) 987static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
962{ 988{
@@ -1000,56 +1026,8 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap,
1000} 1026}
1001#endif 1027#endif
1002 1028
1003#ifdef CONFIG_PCI
1004struct pci_dev;
1005
1006extern int ata_pci_init_one(struct pci_dev *pdev,
1007 const struct ata_port_info * const * ppi);
1008extern void ata_pci_remove_one(struct pci_dev *pdev);
1009#ifdef CONFIG_PM
1010extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
1011extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
1012extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
1013extern int ata_pci_device_resume(struct pci_dev *pdev);
1014#endif
1015extern int ata_pci_clear_simplex(struct pci_dev *pdev);
1016
1017struct pci_bits {
1018 unsigned int reg; /* PCI config register to read */
1019 unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */
1020 unsigned long mask;
1021 unsigned long val;
1022};
1023
1024extern int ata_pci_init_sff_host(struct ata_host *host);
1025extern int ata_pci_init_bmdma(struct ata_host *host);
1026extern int ata_pci_prepare_sff_host(struct pci_dev *pdev,
1027 const struct ata_port_info * const * ppi,
1028 struct ata_host **r_host);
1029extern int ata_pci_activate_sff_host(struct ata_host *host,
1030 irq_handler_t irq_handler,
1031 struct scsi_host_template *sht);
1032extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
1033extern unsigned long ata_pci_default_filter(struct ata_device *dev,
1034 unsigned long xfer_mask);
1035#endif /* CONFIG_PCI */
1036
1037/*
1038 * PMP
1039 */
1040extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc);
1041extern int sata_pmp_std_prereset(struct ata_link *link, unsigned long deadline);
1042extern int sata_pmp_std_hardreset(struct ata_link *link, unsigned int *class,
1043 unsigned long deadline);
1044extern void sata_pmp_std_postreset(struct ata_link *link, unsigned int *class);
1045extern void sata_pmp_do_eh(struct ata_port *ap,
1046 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
1047 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset,
1048 ata_prereset_fn_t pmp_prereset, ata_reset_fn_t pmp_softreset,
1049 ata_reset_fn_t pmp_hardreset, ata_postreset_fn_t pmp_postreset);
1050
1051/* 1029/*
1052 * EH 1030 * EH - drivers/ata/libata-eh.c
1053 */ 1031 */
1054extern void ata_port_schedule_eh(struct ata_port *ap); 1032extern void ata_port_schedule_eh(struct ata_port *ap);
1055extern int ata_link_abort(struct ata_link *link); 1033extern int ata_link_abort(struct ata_link *link);
@@ -1066,6 +1044,92 @@ extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
1066extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, 1044extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
1067 ata_reset_fn_t softreset, ata_reset_fn_t hardreset, 1045 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
1068 ata_postreset_fn_t postreset); 1046 ata_postreset_fn_t postreset);
1047extern void ata_std_error_handler(struct ata_port *ap);
1048
1049/*
1050 * Base operations to inherit from and initializers for sht
1051 *
1052 * Operations
1053 *
1054 * base : Common to all libata drivers.
1055 * sata : SATA controllers w/ native interface.
1056 * pmp : SATA controllers w/ PMP support.
1057 * sff : SFF ATA controllers w/o BMDMA support.
1058 * bmdma : SFF ATA controllers w/ BMDMA support.
1059 *
1060 * sht initializers
1061 *
1062 * BASE : Common to all libata drivers. The user must set
1063 * sg_tablesize and dma_boundary.
1064 * PIO : SFF ATA controllers w/ only PIO support.
1065 * BMDMA : SFF ATA controllers w/ BMDMA support. sg_tablesize and
1066 * dma_boundary are set to BMDMA limits.
1067 * NCQ : SATA controllers supporting NCQ. The user must set
1068 * sg_tablesize, dma_boundary and can_queue.
1069 */
1070extern const struct ata_port_operations ata_base_port_ops;
1071extern const struct ata_port_operations sata_port_ops;
1072
1073#define ATA_BASE_SHT(drv_name) \
1074 .module = THIS_MODULE, \
1075 .name = drv_name, \
1076 .ioctl = ata_scsi_ioctl, \
1077 .queuecommand = ata_scsi_queuecmd, \
1078 .can_queue = ATA_DEF_QUEUE, \
1079 .this_id = ATA_SHT_THIS_ID, \
1080 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, \
1081 .emulated = ATA_SHT_EMULATED, \
1082 .use_clustering = ATA_SHT_USE_CLUSTERING, \
1083 .proc_name = drv_name, \
1084 .slave_configure = ata_scsi_slave_config, \
1085 .slave_destroy = ata_scsi_slave_destroy, \
1086 .bios_param = ata_std_bios_param
1087
1088#define ATA_NCQ_SHT(drv_name) \
1089 ATA_BASE_SHT(drv_name), \
1090 .change_queue_depth = ata_scsi_change_queue_depth
1091
1092/*
1093 * PMP helpers
1094 */
1095#ifdef CONFIG_SATA_PMP
1096static inline bool sata_pmp_supported(struct ata_port *ap)
1097{
1098 return ap->flags & ATA_FLAG_PMP;
1099}
1100
1101static inline bool sata_pmp_attached(struct ata_port *ap)
1102{
1103 return ap->nr_pmp_links != 0;
1104}
1105
1106static inline int ata_is_host_link(const struct ata_link *link)
1107{
1108 return link == &link->ap->link;
1109}
1110#else /* CONFIG_SATA_PMP */
1111static inline bool sata_pmp_supported(struct ata_port *ap)
1112{
1113 return false;
1114}
1115
1116static inline bool sata_pmp_attached(struct ata_port *ap)
1117{
1118 return false;
1119}
1120
1121static inline int ata_is_host_link(const struct ata_link *link)
1122{
1123 return 1;
1124}
1125#endif /* CONFIG_SATA_PMP */
1126
1127static inline int sata_srst_pmp(struct ata_link *link)
1128{
1129 if (sata_pmp_supported(link->ap) && ata_is_host_link(link))
1130 return SATA_PMP_CTRL_PORT;
1131 return link->pmp;
1132}
1069 1133
1070/* 1134/*
1071 * printk helpers 1135 * printk helpers
@@ -1074,7 +1138,7 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
1074 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) 1138 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args)
1075 1139
1076#define ata_link_printk(link, lv, fmt, args...) do { \ 1140#define ata_link_printk(link, lv, fmt, args...) do { \
1077 if ((link)->ap->nr_pmp_links) \ 1141 if (sata_pmp_attached((link)->ap)) \
1078 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ 1142 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \
1079 (link)->pmp , ##args); \ 1143 (link)->pmp , ##args); \
1080 else \ 1144 else \
@@ -1094,18 +1158,11 @@ extern void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
1094 __attribute__ ((format (printf, 2, 3))); 1158 __attribute__ ((format (printf, 2, 3)));
1095extern void ata_ehi_clear_desc(struct ata_eh_info *ehi); 1159extern void ata_ehi_clear_desc(struct ata_eh_info *ehi);
1096 1160
1097static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi)
1098{
1099 ehi->flags |= ATA_EHI_RESUME_LINK;
1100 ehi->action |= ATA_EH_SOFTRESET;
1101 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
1102}
1103
1104static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi) 1161static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi)
1105{ 1162{
1106 ata_ehi_schedule_probe(ehi); 1163 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
1107 ehi->flags |= ATA_EHI_HOTPLUGGED; 1164 ehi->flags |= ATA_EHI_HOTPLUGGED;
1108 ehi->action |= ATA_EH_ENABLE_LINK; 1165 ehi->action |= ATA_EH_RESET | ATA_EH_ENABLE_LINK;
1109 ehi->err_mask |= AC_ERR_ATA_BUS; 1166 ehi->err_mask |= AC_ERR_ATA_BUS;
1110} 1167}
1111 1168
@@ -1126,7 +1183,7 @@ static inline unsigned int ata_tag_valid(unsigned int tag)
1126 1183
1127static inline unsigned int ata_tag_internal(unsigned int tag) 1184static inline unsigned int ata_tag_internal(unsigned int tag)
1128{ 1185{
1129 return tag == ATA_MAX_QUEUE - 1; 1186 return tag == ATA_TAG_INTERNAL;
1130} 1187}
1131 1188
1132/* 1189/*
@@ -1167,11 +1224,6 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev)
1167/* 1224/*
1168 * link helpers 1225 * link helpers
1169 */ 1226 */
1170static inline int ata_is_host_link(const struct ata_link *link)
1171{
1172 return link == &link->ap->link;
1173}
1174
1175static inline int ata_link_max_devices(const struct ata_link *link) 1227static inline int ata_link_max_devices(const struct ata_link *link)
1176{ 1228{
1177 if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS) 1229 if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS)
@@ -1186,7 +1238,7 @@ static inline int ata_link_active(struct ata_link *link)
1186 1238
1187static inline struct ata_link *ata_port_first_link(struct ata_port *ap) 1239static inline struct ata_link *ata_port_first_link(struct ata_port *ap)
1188{ 1240{
1189 if (ap->nr_pmp_links) 1241 if (sata_pmp_attached(ap))
1190 return ap->pmp_link; 1242 return ap->pmp_link;
1191 return &ap->link; 1243 return &ap->link;
1192} 1244}
@@ -1195,8 +1247,8 @@ static inline struct ata_link *ata_port_next_link(struct ata_link *link)
1195{ 1247{
1196 struct ata_port *ap = link->ap; 1248 struct ata_port *ap = link->ap;
1197 1249
1198 if (link == &ap->link) { 1250 if (ata_is_host_link(link)) {
1199 if (!ap->nr_pmp_links) 1251 if (!sata_pmp_attached(ap))
1200 return NULL; 1252 return NULL;
1201 return ap->pmp_link; 1253 return ap->pmp_link;
1202 } 1254 }
@@ -1222,11 +1274,6 @@ static inline struct ata_link *ata_port_next_link(struct ata_link *link)
1222 for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \ 1274 for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \
1223 (dev) >= (link)->device || ((dev) = NULL); (dev)--) 1275 (dev) >= (link)->device || ((dev) = NULL); (dev)--)
1224 1276
1225static inline u8 ata_chk_status(struct ata_port *ap)
1226{
1227 return ap->ops->check_status(ap);
1228}
1229
1230/** 1277/**
1231 * ata_ncq_enabled - Test whether NCQ is enabled 1278 * ata_ncq_enabled - Test whether NCQ is enabled
1232 * @dev: ATA device to test for 1279 * @dev: ATA device to test for
@@ -1243,74 +1290,6 @@ static inline int ata_ncq_enabled(struct ata_device *dev)
1243 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; 1290 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ;
1244} 1291}
1245 1292
1246/**
1247 * ata_pause - Flush writes and pause 400 nanoseconds.
1248 * @ap: Port to wait for.
1249 *
1250 * LOCKING:
1251 * Inherited from caller.
1252 */
1253
1254static inline void ata_pause(struct ata_port *ap)
1255{
1256 ata_altstatus(ap);
1257 ndelay(400);
1258}
1259
1260
1261/**
1262 * ata_busy_wait - Wait for a port status register
1263 * @ap: Port to wait for.
1264 * @bits: bits that must be clear
1265 * @max: number of 10uS waits to perform
1266 *
1267 * Waits up to max*10 microseconds for the selected bits in the port's
1268 * status register to be cleared.
1269 * Returns final value of status register.
1270 *
1271 * LOCKING:
1272 * Inherited from caller.
1273 */
1274
1275static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,
1276 unsigned int max)
1277{
1278 u8 status;
1279
1280 do {
1281 udelay(10);
1282 status = ata_chk_status(ap);
1283 max--;
1284 } while (status != 0xff && (status & bits) && (max > 0));
1285
1286 return status;
1287}
1288
1289
1290/**
1291 * ata_wait_idle - Wait for a port to be idle.
1292 * @ap: Port to wait for.
1293 *
1294 * Waits up to 10ms for port's BUSY and DRQ signals to clear.
1295 * Returns final value of status register.
1296 *
1297 * LOCKING:
1298 * Inherited from caller.
1299 */
1300
1301static inline u8 ata_wait_idle(struct ata_port *ap)
1302{
1303 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1304
1305#ifdef ATA_DEBUG
1306 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ)))
1307 ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n",
1308 status);
1309#endif
1310
1311 return status;
1312}
1313
1314static inline void ata_qc_set_polling(struct ata_queued_cmd *qc) 1293static inline void ata_qc_set_polling(struct ata_queued_cmd *qc)
1315{ 1294{
1316 qc->tf.ctl |= ATA_NIEN; 1295 qc->tf.ctl |= ATA_NIEN;
@@ -1403,4 +1382,171 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
1403 return *(struct ata_port **)&host->hostdata[0]; 1382 return *(struct ata_port **)&host->hostdata[0];
1404} 1383}
1405 1384
1385
1386/**************************************************************************
1387 * PMP - drivers/ata/libata-pmp.c
1388 */
1389#ifdef CONFIG_SATA_PMP
1390
1391extern const struct ata_port_operations sata_pmp_port_ops;
1392
1393extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc);
1394extern void sata_pmp_error_handler(struct ata_port *ap);
1395
1396#else /* CONFIG_SATA_PMP */
1397
1398#define sata_pmp_port_ops sata_port_ops
1399#define sata_pmp_qc_defer_cmd_switch ata_std_qc_defer
1400#define sata_pmp_error_handler ata_std_error_handler
1401
1402#endif /* CONFIG_SATA_PMP */
1403
1404
1405/**************************************************************************
1406 * SFF - drivers/ata/libata-sff.c
1407 */
1408#ifdef CONFIG_ATA_SFF
1409
1410extern const struct ata_port_operations ata_sff_port_ops;
1411extern const struct ata_port_operations ata_bmdma_port_ops;
1412
1413/* PIO only, sg_tablesize and dma_boundary limits can be removed */
1414#define ATA_PIO_SHT(drv_name) \
1415 ATA_BASE_SHT(drv_name), \
1416 .sg_tablesize = LIBATA_MAX_PRD, \
1417 .dma_boundary = ATA_DMA_BOUNDARY
1418
1419#define ATA_BMDMA_SHT(drv_name) \
1420 ATA_BASE_SHT(drv_name), \
1421 .sg_tablesize = LIBATA_MAX_PRD, \
1422 .dma_boundary = ATA_DMA_BOUNDARY
1423
1424extern void ata_sff_qc_prep(struct ata_queued_cmd *qc);
1425extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc);
1426extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device);
1427extern u8 ata_sff_check_status(struct ata_port *ap);
1428extern u8 ata_sff_altstatus(struct ata_port *ap);
1429extern int ata_sff_busy_sleep(struct ata_port *ap,
1430 unsigned long timeout_pat, unsigned long timeout);
1431extern int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline);
1432extern void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
1433extern void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
1434extern void ata_sff_exec_command(struct ata_port *ap,
1435 const struct ata_taskfile *tf);
1436extern unsigned int ata_sff_data_xfer(struct ata_device *dev,
1437 unsigned char *buf, unsigned int buflen, int rw);
1438extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev,
1439 unsigned char *buf, unsigned int buflen, int rw);
1440extern u8 ata_sff_irq_on(struct ata_port *ap);
1441extern void ata_sff_irq_clear(struct ata_port *ap);
1442extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
1443 u8 status, int in_wq);
1444extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc);
1445extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc);
1446extern unsigned int ata_sff_host_intr(struct ata_port *ap,
1447 struct ata_queued_cmd *qc);
1448extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance);
1449extern void ata_sff_freeze(struct ata_port *ap);
1450extern void ata_sff_thaw(struct ata_port *ap);
1451extern int ata_sff_prereset(struct ata_link *link, unsigned long deadline);
1452extern unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
1453 u8 *r_err);
1454extern int ata_sff_wait_after_reset(struct ata_link *link, unsigned int devmask,
1455 unsigned long deadline);
1456extern int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
1457 unsigned long deadline);
1458extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
1459 unsigned long deadline);
1460extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes);
1461extern void ata_sff_error_handler(struct ata_port *ap);
1462extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc);
1463extern int ata_sff_port_start(struct ata_port *ap);
1464extern void ata_sff_std_ports(struct ata_ioports *ioaddr);
1465extern unsigned long ata_bmdma_mode_filter(struct ata_device *dev,
1466 unsigned long xfer_mask);
1467extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
1468extern void ata_bmdma_start(struct ata_queued_cmd *qc);
1469extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
1470extern u8 ata_bmdma_status(struct ata_port *ap);
1471extern void ata_bus_reset(struct ata_port *ap);
1472
1473#ifdef CONFIG_PCI
1474extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev);
1475extern int ata_pci_bmdma_init(struct ata_host *host);
1476extern int ata_pci_sff_init_host(struct ata_host *host);
1477extern int ata_pci_sff_prepare_host(struct pci_dev *pdev,
1478 const struct ata_port_info * const * ppi,
1479 struct ata_host **r_host);
1480extern int ata_pci_sff_activate_host(struct ata_host *host,
1481 irq_handler_t irq_handler,
1482 struct scsi_host_template *sht);
1483extern int ata_pci_sff_init_one(struct pci_dev *pdev,
1484 const struct ata_port_info * const * ppi,
1485 struct scsi_host_template *sht, void *host_priv);
1486#endif /* CONFIG_PCI */
1487
1488/**
1489 * ata_sff_pause - Flush writes and pause 400 nanoseconds.
1490 * @ap: Port to wait for.
1491 *
1492 * LOCKING:
1493 * Inherited from caller.
1494 */
1495static inline void ata_sff_pause(struct ata_port *ap)
1496{
1497 ata_sff_altstatus(ap);
1498 ndelay(400);
1499}
1500
1501/**
1502 * ata_sff_busy_wait - Wait for a port status register
1503 * @ap: Port to wait for.
1504 * @bits: bits that must be clear
1505 * @max: number of 10uS waits to perform
1506 *
1507 * Waits up to max*10 microseconds for the selected bits in the port's
1508 * status register to be cleared.
1509 * Returns final value of status register.
1510 *
1511 * LOCKING:
1512 * Inherited from caller.
1513 */
1514static inline u8 ata_sff_busy_wait(struct ata_port *ap, unsigned int bits,
1515 unsigned int max)
1516{
1517 u8 status;
1518
1519 do {
1520 udelay(10);
1521 status = ap->ops->sff_check_status(ap);
1522 max--;
1523 } while (status != 0xff && (status & bits) && (max > 0));
1524
1525 return status;
1526}
1527
1528/**
1529 * ata_wait_idle - Wait for a port to be idle.
1530 * @ap: Port to wait for.
1531 *
1532 * Waits up to 10ms for port's BUSY and DRQ signals to clear.
1533 * Returns final value of status register.
1534 *
1535 * LOCKING:
1536 * Inherited from caller.
1537 */
1538static inline u8 ata_wait_idle(struct ata_port *ap)
1539{
1540 u8 status = ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1541
1542#ifdef ATA_DEBUG
1543 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ)))
1544 ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n",
1545 status);
1546#endif
1547
1548 return status;
1549}
1550#endif /* CONFIG_ATA_SFF */
1551
1406#endif /* __LINUX_LIBATA_H__ */ 1552#endif /* __LINUX_LIBATA_H__ */
diff --git a/include/linux/lm_interface.h b/include/linux/lm_interface.h
index 1418fdc9ac02..f274997bc283 100644
--- a/include/linux/lm_interface.h
+++ b/include/linux/lm_interface.h
@@ -21,9 +21,15 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
21 * modify the filesystem. The lock module shouldn't assign a journal to the FS 21 * modify the filesystem. The lock module shouldn't assign a journal to the FS
22 * mount. It shouldn't send recovery callbacks to the FS mount. If the node 22 * mount. It shouldn't send recovery callbacks to the FS mount. If the node
23 * dies or withdraws, all locks can be wiped immediately. 23 * dies or withdraws, all locks can be wiped immediately.
24 *
25 * LM_MFLAG_CONV_NODROP
26 * Do not allow the dlm to internally resolve conversion deadlocks by demoting
27 * the lock to unlocked and then reacquiring it in the requested mode. Instead,
28 * it should cancel the request and return LM_OUT_CONV_DEADLK.
24 */ 29 */
25 30
26#define LM_MFLAG_SPECTATOR 0x00000001 31#define LM_MFLAG_SPECTATOR 0x00000001
32#define LM_MFLAG_CONV_NODROP 0x00000002
27 33
28/* 34/*
29 * lm_lockstruct flags 35 * lm_lockstruct flags
@@ -110,6 +116,9 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
110 * 116 *
111 * LM_OUT_ASYNC 117 * LM_OUT_ASYNC
112 * The result of the request will be returned in an LM_CB_ASYNC callback. 118 * The result of the request will be returned in an LM_CB_ASYNC callback.
119 *
120 * LM_OUT_CONV_DEADLK
121 * The lock request was canceled do to a conversion deadlock.
113 */ 122 */
114 123
115#define LM_OUT_ST_MASK 0x00000003 124#define LM_OUT_ST_MASK 0x00000003
@@ -117,6 +126,7 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
117#define LM_OUT_CANCELED 0x00000008 126#define LM_OUT_CANCELED 0x00000008
118#define LM_OUT_ASYNC 0x00000080 127#define LM_OUT_ASYNC 0x00000080
119#define LM_OUT_ERROR 0x00000100 128#define LM_OUT_ERROR 0x00000100
129#define LM_OUT_CONV_DEADLK 0x00000200
120 130
121/* 131/*
122 * lm_callback_t types 132 * lm_callback_t types
diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h
index 99e044b4efc6..a09b84e4fdb4 100644
--- a/include/linux/mbcache.h
+++ b/include/linux/mbcache.h
@@ -34,7 +34,7 @@ void mb_cache_destroy(struct mb_cache *);
34 34
35/* Functions on cache entries */ 35/* Functions on cache entries */
36 36
37struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *); 37struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *, gfp_t);
38int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *, 38int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *,
39 sector_t, unsigned int[]); 39 sector_t, unsigned int[]);
40void mb_cache_entry_release(struct mb_cache_entry *); 40void mb_cache_entry_release(struct mb_cache_entry *);
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 7d1eaa97de13..77323a72dd3c 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -81,7 +81,7 @@ enum {
81 MLX4_CMD_SW2HW_CQ = 0x16, 81 MLX4_CMD_SW2HW_CQ = 0x16,
82 MLX4_CMD_HW2SW_CQ = 0x17, 82 MLX4_CMD_HW2SW_CQ = 0x17,
83 MLX4_CMD_QUERY_CQ = 0x18, 83 MLX4_CMD_QUERY_CQ = 0x18,
84 MLX4_CMD_RESIZE_CQ = 0x2c, 84 MLX4_CMD_MODIFY_CQ = 0x2c,
85 85
86 /* SRQ commands */ 86 /* SRQ commands */
87 MLX4_CMD_SW2HW_SRQ = 0x35, 87 MLX4_CMD_SW2HW_SRQ = 0x35,
diff --git a/include/linux/mlx4/cq.h b/include/linux/mlx4/cq.h
index 0181e0a57cbf..071cf96cf01f 100644
--- a/include/linux/mlx4/cq.h
+++ b/include/linux/mlx4/cq.h
@@ -45,11 +45,11 @@ struct mlx4_cqe {
45 u8 sl; 45 u8 sl;
46 u8 reserved1; 46 u8 reserved1;
47 __be16 rlid; 47 __be16 rlid;
48 u32 reserved2; 48 __be32 ipoib_status;
49 __be32 byte_cnt; 49 __be32 byte_cnt;
50 __be16 wqe_index; 50 __be16 wqe_index;
51 __be16 checksum; 51 __be16 checksum;
52 u8 reserved3[3]; 52 u8 reserved2[3];
53 u8 owner_sr_opcode; 53 u8 owner_sr_opcode;
54}; 54};
55 55
@@ -85,6 +85,16 @@ enum {
85 MLX4_CQE_SYNDROME_REMOTE_ABORTED_ERR = 0x22, 85 MLX4_CQE_SYNDROME_REMOTE_ABORTED_ERR = 0x22,
86}; 86};
87 87
88enum {
89 MLX4_CQE_IPOIB_STATUS_IPV4 = 1 << 22,
90 MLX4_CQE_IPOIB_STATUS_IPV4F = 1 << 23,
91 MLX4_CQE_IPOIB_STATUS_IPV6 = 1 << 24,
92 MLX4_CQE_IPOIB_STATUS_IPV4OPT = 1 << 25,
93 MLX4_CQE_IPOIB_STATUS_TCP = 1 << 26,
94 MLX4_CQE_IPOIB_STATUS_UDP = 1 << 27,
95 MLX4_CQE_IPOIB_STATUS_IPOK = 1 << 28,
96};
97
88static inline void mlx4_cq_arm(struct mlx4_cq *cq, u32 cmd, 98static inline void mlx4_cq_arm(struct mlx4_cq *cq, u32 cmd,
89 void __iomem *uar_page, 99 void __iomem *uar_page,
90 spinlock_t *doorbell_lock) 100 spinlock_t *doorbell_lock)
@@ -120,4 +130,9 @@ enum {
120 MLX4_CQ_DB_REQ_NOT = 2 << 24 130 MLX4_CQ_DB_REQ_NOT = 2 << 24
121}; 131};
122 132
133int mlx4_cq_modify(struct mlx4_dev *dev, struct mlx4_cq *cq,
134 u16 count, u16 period);
135int mlx4_cq_resize(struct mlx4_dev *dev, struct mlx4_cq *cq,
136 int entries, struct mlx4_mtt *mtt);
137
123#endif /* MLX4_CQ_H */ 138#endif /* MLX4_CQ_H */
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 6cdf813cd478..ff7df1a2222f 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -186,6 +186,7 @@ struct mlx4_caps {
186 u32 flags; 186 u32 flags;
187 u16 stat_rate_support; 187 u16 stat_rate_support;
188 u8 port_width_cap[MLX4_MAX_PORTS + 1]; 188 u8 port_width_cap[MLX4_MAX_PORTS + 1];
189 int max_gso_sz;
189}; 190};
190 191
191struct mlx4_buf_list { 192struct mlx4_buf_list {
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index 1b835ca49df1..53c5fdb6eac4 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -48,8 +48,7 @@ struct mlx4_interface {
48 void * (*add) (struct mlx4_dev *dev); 48 void * (*add) (struct mlx4_dev *dev);
49 void (*remove)(struct mlx4_dev *dev, void *context); 49 void (*remove)(struct mlx4_dev *dev, void *context);
50 void (*event) (struct mlx4_dev *dev, void *context, 50 void (*event) (struct mlx4_dev *dev, void *context,
51 enum mlx4_dev_event event, int subtype, 51 enum mlx4_dev_event event, int port);
52 int port);
53 struct list_head list; 52 struct list_head list;
54}; 53};
55 54
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 09a2230923f2..a5e43febee4f 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -158,10 +158,12 @@ struct mlx4_qp_context {
158#define MLX4_FW_VER_WQE_CTRL_NEC mlx4_fw_ver(2, 2, 232) 158#define MLX4_FW_VER_WQE_CTRL_NEC mlx4_fw_ver(2, 2, 232)
159 159
160enum { 160enum {
161 MLX4_WQE_CTRL_NEC = 1 << 29, 161 MLX4_WQE_CTRL_NEC = 1 << 29,
162 MLX4_WQE_CTRL_FENCE = 1 << 6, 162 MLX4_WQE_CTRL_FENCE = 1 << 6,
163 MLX4_WQE_CTRL_CQ_UPDATE = 3 << 2, 163 MLX4_WQE_CTRL_CQ_UPDATE = 3 << 2,
164 MLX4_WQE_CTRL_SOLICITED = 1 << 1, 164 MLX4_WQE_CTRL_SOLICITED = 1 << 1,
165 MLX4_WQE_CTRL_IP_CSUM = 1 << 4,
166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5,
165}; 167};
166 168
167struct mlx4_wqe_ctrl_seg { 169struct mlx4_wqe_ctrl_seg {
@@ -217,6 +219,11 @@ struct mlx4_wqe_datagram_seg {
217 __be32 reservd[2]; 219 __be32 reservd[2];
218}; 220};
219 221
222struct mlx4_lso_seg {
223 __be32 mss_hdr_size;
224 __be32 header[0];
225};
226
220struct mlx4_wqe_bind_seg { 227struct mlx4_wqe_bind_seg {
221 __be32 flags1; 228 __be32 flags1;
222 __be32 flags2; 229 __be32 flags2;
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 35a8277ec1bd..de4decfa1bfc 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -2,7 +2,11 @@
2#define __LINUX_MROUTE_H 2#define __LINUX_MROUTE_H
3 3
4#include <linux/sockios.h> 4#include <linux/sockios.h>
5#include <linux/types.h>
6#ifdef __KERNEL__
5#include <linux/in.h> 7#include <linux/in.h>
8#endif
9#include <linux/pim.h>
6 10
7/* 11/*
8 * Based on the MROUTING 3.5 defines primarily to keep 12 * Based on the MROUTING 3.5 defines primarily to keep
@@ -210,27 +214,6 @@ struct mfc_cache
210#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */ 214#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */
211 215
212#ifdef __KERNEL__ 216#ifdef __KERNEL__
213
214#define PIM_V1_VERSION __constant_htonl(0x10000000)
215#define PIM_V1_REGISTER 1
216
217#define PIM_VERSION 2
218#define PIM_REGISTER 1
219
220#define PIM_NULL_REGISTER __constant_htonl(0x40000000)
221
222/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */
223
224struct pimreghdr
225{
226 __u8 type;
227 __u8 reserved;
228 __be16 csum;
229 __be32 flags;
230};
231
232extern int pim_rcv_v1(struct sk_buff *);
233
234struct rtmsg; 217struct rtmsg;
235extern int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait); 218extern int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait);
236#endif 219#endif
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
new file mode 100644
index 000000000000..e7989593142b
--- /dev/null
+++ b/include/linux/mroute6.h
@@ -0,0 +1,228 @@
1#ifndef __LINUX_MROUTE6_H
2#define __LINUX_MROUTE6_H
3
4#include <linux/types.h>
5#include <linux/sockios.h>
6
7/*
8 * Based on the MROUTING 3.5 defines primarily to keep
9 * source compatibility with BSD.
10 *
11 * See the pim6sd code for the original history.
12 *
13 * Protocol Independent Multicast (PIM) data structures included
14 * Carlos Picoto (cap@di.fc.ul.pt)
15 *
16 */
17
18#define MRT6_BASE 200
19#define MRT6_INIT (MRT6_BASE) /* Activate the kernel mroute code */
20#define MRT6_DONE (MRT6_BASE+1) /* Shutdown the kernel mroute */
21#define MRT6_ADD_MIF (MRT6_BASE+2) /* Add a virtual interface */
22#define MRT6_DEL_MIF (MRT6_BASE+3) /* Delete a virtual interface */
23#define MRT6_ADD_MFC (MRT6_BASE+4) /* Add a multicast forwarding entry */
24#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */
25#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */
26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */
27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */
28
29#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */
30#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)
31#define SIOCGETRPF (SIOCPROTOPRIVATE+2)
32
33#define MAXMIFS 32
34typedef unsigned long mifbitmap_t; /* User mode code depends on this lot */
35typedef unsigned short mifi_t;
36#define ALL_MIFS ((mifi_t)(-1))
37
38#ifndef IF_SETSIZE
39#define IF_SETSIZE 256
40#endif
41
42typedef __u32 if_mask;
43#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */
44
45#if !defined(__KERNEL__) && !defined(DIV_ROUND_UP)
46#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y))
47#endif
48
49typedef struct if_set {
50 if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)];
51} if_set;
52
53#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
54#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
55#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
56#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f)))
57#define IF_ZERO(p) bzero(p, sizeof(*(p)))
58
59/*
60 * Passed by mrouted for an MRT_ADD_MIF - again we use the
61 * mrouted 3.6 structures for compatibility
62 */
63
64struct mif6ctl {
65 mifi_t mif6c_mifi; /* Index of MIF */
66 unsigned char mif6c_flags; /* MIFF_ flags */
67 unsigned char vifc_threshold; /* ttl limit */
68 u_short mif6c_pifi; /* the index of the physical IF */
69 unsigned int vifc_rate_limit; /* Rate limiter values (NI) */
70};
71
72#define MIFF_REGISTER 0x1 /* register vif */
73
74/*
75 * Cache manipulation structures for mrouted and PIMd
76 */
77
78struct mf6cctl
79{
80 struct sockaddr_in6 mf6cc_origin; /* Origin of mcast */
81 struct sockaddr_in6 mf6cc_mcastgrp; /* Group in question */
82 mifi_t mf6cc_parent; /* Where it arrived */
83 struct if_set mf6cc_ifset; /* Where it is going */
84};
85
86/*
87 * Group count retrieval for pim6sd
88 */
89
90struct sioc_sg_req6
91{
92 struct sockaddr_in6 src;
93 struct sockaddr_in6 grp;
94 unsigned long pktcnt;
95 unsigned long bytecnt;
96 unsigned long wrong_if;
97};
98
99/*
100 * To get vif packet counts
101 */
102
103struct sioc_mif_req6
104{
105 mifi_t mifi; /* Which iface */
106 unsigned long icount; /* In packets */
107 unsigned long ocount; /* Out packets */
108 unsigned long ibytes; /* In bytes */
109 unsigned long obytes; /* Out bytes */
110};
111
112/*
113 * That's all usermode folks
114 */
115
116#ifdef __KERNEL__
117
118#include <linux/skbuff.h> /* for struct sk_buff_head */
119
120#ifdef CONFIG_IPV6_MROUTE
121static inline int ip6_mroute_opt(int opt)
122{
123 return (opt >= MRT6_BASE) && (opt <= MRT6_BASE + 10);
124}
125#else
126static inline int ip6_mroute_opt(int opt)
127{
128 return 0;
129}
130#endif
131
132struct sock;
133
134extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int);
135extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
136extern int ip6_mr_input(struct sk_buff *skb);
137extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
138extern void ip6_mr_init(void);
139
140struct mif_device
141{
142 struct net_device *dev; /* Device we are using */
143 unsigned long bytes_in,bytes_out;
144 unsigned long pkt_in,pkt_out; /* Statistics */
145 unsigned long rate_limit; /* Traffic shaping (NI) */
146 unsigned char threshold; /* TTL threshold */
147 unsigned short flags; /* Control flags */
148 int link; /* Physical interface index */
149};
150
151#define VIFF_STATIC 0x8000
152
153struct mfc6_cache
154{
155 struct mfc6_cache *next; /* Next entry on cache line */
156 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */
157 struct in6_addr mf6c_origin; /* Source of packet */
158 mifi_t mf6c_parent; /* Source interface */
159 int mfc_flags; /* Flags on line */
160
161 union {
162 struct {
163 unsigned long expires;
164 struct sk_buff_head unresolved; /* Unresolved buffers */
165 } unres;
166 struct {
167 unsigned long last_assert;
168 int minvif;
169 int maxvif;
170 unsigned long bytes;
171 unsigned long pkt;
172 unsigned long wrong_if;
173 unsigned char ttls[MAXMIFS]; /* TTL thresholds */
174 } res;
175 } mfc_un;
176};
177
178#define MFC_STATIC 1
179#define MFC_NOTIFY 2
180
181#define MFC6_LINES 64
182
183#define MFC6_HASH(a, g) (((__force u32)(a)->s6_addr32[0] ^ \
184 (__force u32)(a)->s6_addr32[1] ^ \
185 (__force u32)(a)->s6_addr32[2] ^ \
186 (__force u32)(a)->s6_addr32[3] ^ \
187 (__force u32)(g)->s6_addr32[0] ^ \
188 (__force u32)(g)->s6_addr32[1] ^ \
189 (__force u32)(g)->s6_addr32[2] ^ \
190 (__force u32)(g)->s6_addr32[3]) % MFC6_LINES)
191
192#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */
193
194#endif
195
196#ifdef __KERNEL__
197struct rtmsg;
198extern int ip6mr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait);
199
200#ifdef CONFIG_IPV6_MROUTE
201extern struct sock *mroute6_socket;
202extern int ip6mr_sk_done(struct sock *sk);
203#else
204#define mroute6_socket NULL
205static inline int ip6mr_sk_done(struct sock *sk) { return 0; }
206#endif
207#endif
208
209/*
210 * Structure used to communicate from kernel to multicast router.
211 * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{}
212 * used for IPv4 implementation). This is because this structure will be passed via an
213 * IPv6 raw socket, on wich an application will only receiver the payload i.e the data after
214 * the IPv6 header and all the extension headers. (See section 3 of RFC 3542)
215 */
216
217struct mrt6msg {
218#define MRT6MSG_NOCACHE 1
219#define MRT6MSG_WRONGMIF 2
220#define MRT6MSG_WHOLEPKT 3 /* used for use level encap */
221 __u8 im6_mbz; /* must be zero */
222 __u8 im6_msgtype; /* what type of message */
223 __u16 im6_mif; /* mif rec'd on */
224 __u32 im6_pad; /* padding for 64 bit arch */
225 struct in6_addr im6_src, im6_dst;
226};
227
228#endif
diff --git a/include/linux/mtio.h b/include/linux/mtio.h
index 6f8d2d45a8fb..ef01d6aa5934 100644
--- a/include/linux/mtio.h
+++ b/include/linux/mtio.h
@@ -192,6 +192,7 @@ struct mtpos {
192#define MT_ST_SCSI2LOGICAL 0x800 192#define MT_ST_SCSI2LOGICAL 0x800
193#define MT_ST_SYSV 0x1000 193#define MT_ST_SYSV 0x1000
194#define MT_ST_NOWAIT 0x2000 194#define MT_ST_NOWAIT 0x2000
195#define MT_ST_SILI 0x4000
195 196
196/* The mode parameters to be controlled. Parameter chosen with bits 20-28 */ 197/* The mode parameters to be controlled. Parameter chosen with bits 20-28 */
197#define MT_ST_CLEAR_DEFAULT 0xfffff 198#define MT_ST_CLEAR_DEFAULT 0xfffff
diff --git a/include/linux/net.h b/include/linux/net.h
index c414d90e647b..71f7dd559285 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -19,6 +19,7 @@
19#define _LINUX_NET_H 19#define _LINUX_NET_H
20 20
21#include <linux/wait.h> 21#include <linux/wait.h>
22#include <linux/socket.h>
22#include <asm/socket.h> 23#include <asm/socket.h>
23 24
24struct poll_table_struct; 25struct poll_table_struct;
@@ -26,7 +27,7 @@ struct pipe_inode_info;
26struct inode; 27struct inode;
27struct net; 28struct net;
28 29
29#define NPROTO 34 /* should be enough for now.. */ 30#define NPROTO AF_MAX
30 31
31#define SYS_SOCKET 1 /* sys_socket(2) */ 32#define SYS_SOCKET 1 /* sys_socket(2) */
32#define SYS_BIND 2 /* sys_bind(2) */ 33#define SYS_BIND 2 /* sys_bind(2) */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ee81906b5164..7c1d4466583b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -710,8 +710,10 @@ struct net_device
710 void (*poll_controller)(struct net_device *dev); 710 void (*poll_controller)(struct net_device *dev);
711#endif 711#endif
712 712
713#ifdef CONFIG_NET_NS
713 /* Network namespace this network device is inside */ 714 /* Network namespace this network device is inside */
714 struct net *nd_net; 715 struct net *nd_net;
716#endif
715 717
716 /* bridge stuff */ 718 /* bridge stuff */
717 struct net_bridge_port *br_port; 719 struct net_bridge_port *br_port;
@@ -726,6 +728,10 @@ struct net_device
726 /* rtnetlink link ops */ 728 /* rtnetlink link ops */
727 const struct rtnl_link_ops *rtnl_link_ops; 729 const struct rtnl_link_ops *rtnl_link_ops;
728 730
731 /* for setting kernel sock attribute on TCP connection setup */
732#define GSO_MAX_SIZE 65536
733 unsigned int gso_max_size;
734
729 /* The TX queue control structures */ 735 /* The TX queue control structures */
730 unsigned int egress_subqueue_count; 736 unsigned int egress_subqueue_count;
731 struct net_device_subqueue egress_subqueue[1]; 737 struct net_device_subqueue egress_subqueue[1];
@@ -735,6 +741,28 @@ struct net_device
735#define NETDEV_ALIGN 32 741#define NETDEV_ALIGN 32
736#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) 742#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
737 743
744/*
745 * Net namespace inlines
746 */
747static inline
748struct net *dev_net(const struct net_device *dev)
749{
750#ifdef CONFIG_NET_NS
751 return dev->nd_net;
752#else
753 return &init_net;
754#endif
755}
756
757static inline
758void dev_net_set(struct net_device *dev, struct net *net)
759{
760#ifdef CONFIG_NET_NS
761 release_net(dev->nd_net);
762 dev->nd_net = hold_net(net);
763#endif
764}
765
738/** 766/**
739 * netdev_priv - access network device private data 767 * netdev_priv - access network device private data
740 * @dev: network device 768 * @dev: network device
@@ -811,7 +839,7 @@ static inline struct net_device *next_net_device(struct net_device *dev)
811 struct list_head *lh; 839 struct list_head *lh;
812 struct net *net; 840 struct net *net;
813 841
814 net = dev->nd_net; 842 net = dev_net(dev);
815 lh = dev->dev_list.next; 843 lh = dev->dev_list.next;
816 return lh == &net->dev_base_head ? NULL : net_device_entry(lh); 844 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
817} 845}
@@ -1479,6 +1507,12 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1479 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 1507 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1480} 1508}
1481 1509
1510static inline void netif_set_gso_max_size(struct net_device *dev,
1511 unsigned int size)
1512{
1513 dev->gso_max_size = size;
1514}
1515
1482/* On bonding slaves other than the currently active slave, suppress 1516/* On bonding slaves other than the currently active slave, suppress
1483 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and 1517 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
1484 * ARP on active-backup slaves with arp_validate enabled. 1518 * ARP on active-backup slaves with arp_validate enabled.
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index f0680c2bee73..e4c66593b5c6 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -6,11 +6,13 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/skbuff.h> 7#include <linux/skbuff.h>
8#include <linux/net.h> 8#include <linux/net.h>
9#include <linux/netdevice.h>
9#include <linux/if.h> 10#include <linux/if.h>
10#include <linux/in.h> 11#include <linux/in.h>
11#include <linux/in6.h> 12#include <linux/in6.h>
12#include <linux/wait.h> 13#include <linux/wait.h>
13#include <linux/list.h> 14#include <linux/list.h>
15#include <net/net_namespace.h>
14#endif 16#endif
15#include <linux/compiler.h> 17#include <linux/compiler.h>
16 18
@@ -61,13 +63,21 @@ union nf_inet_addr {
61#ifdef __KERNEL__ 63#ifdef __KERNEL__
62#ifdef CONFIG_NETFILTER 64#ifdef CONFIG_NETFILTER
63 65
66static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1,
67 const union nf_inet_addr *a2)
68{
69 return a1->all[0] == a2->all[0] &&
70 a1->all[1] == a2->all[1] &&
71 a1->all[2] == a2->all[2] &&
72 a1->all[3] == a2->all[3];
73}
74
64extern void netfilter_init(void); 75extern void netfilter_init(void);
65 76
66/* Largest hook number + 1 */ 77/* Largest hook number + 1 */
67#define NF_MAX_HOOKS 8 78#define NF_MAX_HOOKS 8
68 79
69struct sk_buff; 80struct sk_buff;
70struct net_device;
71 81
72typedef unsigned int nf_hookfn(unsigned int hooknum, 82typedef unsigned int nf_hookfn(unsigned int hooknum,
73 struct sk_buff *skb, 83 struct sk_buff *skb,
@@ -224,6 +234,11 @@ struct nf_afinfo {
224 unsigned short family; 234 unsigned short family;
225 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook, 235 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
226 unsigned int dataoff, u_int8_t protocol); 236 unsigned int dataoff, u_int8_t protocol);
237 __sum16 (*checksum_partial)(struct sk_buff *skb,
238 unsigned int hook,
239 unsigned int dataoff,
240 unsigned int len,
241 u_int8_t protocol);
227 int (*route)(struct dst_entry **dst, struct flowi *fl); 242 int (*route)(struct dst_entry **dst, struct flowi *fl);
228 void (*saveroute)(const struct sk_buff *skb, 243 void (*saveroute)(const struct sk_buff *skb,
229 struct nf_queue_entry *entry); 244 struct nf_queue_entry *entry);
@@ -253,6 +268,23 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
253 return csum; 268 return csum;
254} 269}
255 270
271static inline __sum16
272nf_checksum_partial(struct sk_buff *skb, unsigned int hook,
273 unsigned int dataoff, unsigned int len,
274 u_int8_t protocol, unsigned short family)
275{
276 const struct nf_afinfo *afinfo;
277 __sum16 csum = 0;
278
279 rcu_read_lock();
280 afinfo = nf_get_afinfo(family);
281 if (afinfo)
282 csum = afinfo->checksum_partial(skb, hook, dataoff, len,
283 protocol);
284 rcu_read_unlock();
285 return csum;
286}
287
256extern int nf_register_afinfo(const struct nf_afinfo *afinfo); 288extern int nf_register_afinfo(const struct nf_afinfo *afinfo);
257extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo); 289extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
258 290
@@ -311,5 +343,56 @@ extern void (*nf_ct_destroy)(struct nf_conntrack *);
311static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 343static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
312#endif 344#endif
313 345
346static inline struct net *nf_pre_routing_net(const struct net_device *in,
347 const struct net_device *out)
348{
349#ifdef CONFIG_NET_NS
350 return in->nd_net;
351#else
352 return &init_net;
353#endif
354}
355
356static inline struct net *nf_local_in_net(const struct net_device *in,
357 const struct net_device *out)
358{
359#ifdef CONFIG_NET_NS
360 return in->nd_net;
361#else
362 return &init_net;
363#endif
364}
365
366static inline struct net *nf_forward_net(const struct net_device *in,
367 const struct net_device *out)
368{
369#ifdef CONFIG_NET_NS
370 BUG_ON(in->nd_net != out->nd_net);
371 return in->nd_net;
372#else
373 return &init_net;
374#endif
375}
376
377static inline struct net *nf_local_out_net(const struct net_device *in,
378 const struct net_device *out)
379{
380#ifdef CONFIG_NET_NS
381 return out->nd_net;
382#else
383 return &init_net;
384#endif
385}
386
387static inline struct net *nf_post_routing_net(const struct net_device *in,
388 const struct net_device *out)
389{
390#ifdef CONFIG_NET_NS
391 return out->nd_net;
392#else
393 return &init_net;
394#endif
395}
396
314#endif /*__KERNEL__*/ 397#endif /*__KERNEL__*/
315#endif /*__LINUX_NETFILTER_H*/ 398#endif /*__LINUX_NETFILTER_H*/
diff --git a/include/linux/netfilter/nf_conntrack_dccp.h b/include/linux/netfilter/nf_conntrack_dccp.h
new file mode 100644
index 000000000000..40dcc82058d1
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_dccp.h
@@ -0,0 +1,40 @@
1#ifndef _NF_CONNTRACK_DCCP_H
2#define _NF_CONNTRACK_DCCP_H
3
4/* Exposed to userspace over nfnetlink */
5enum ct_dccp_states {
6 CT_DCCP_NONE,
7 CT_DCCP_REQUEST,
8 CT_DCCP_RESPOND,
9 CT_DCCP_PARTOPEN,
10 CT_DCCP_OPEN,
11 CT_DCCP_CLOSEREQ,
12 CT_DCCP_CLOSING,
13 CT_DCCP_TIMEWAIT,
14 CT_DCCP_IGNORE,
15 CT_DCCP_INVALID,
16 __CT_DCCP_MAX
17};
18#define CT_DCCP_MAX (__CT_DCCP_MAX - 1)
19
20enum ct_dccp_roles {
21 CT_DCCP_ROLE_CLIENT,
22 CT_DCCP_ROLE_SERVER,
23 __CT_DCCP_ROLE_MAX
24};
25#define CT_DCCP_ROLE_MAX (__CT_DCCP_ROLE_MAX - 1)
26
27#ifdef __KERNEL__
28#include <net/netfilter/nf_conntrack_tuple.h>
29
30struct nf_ct_dccp {
31 u_int8_t role[IP_CT_DIR_MAX];
32 u_int8_t state;
33 u_int8_t last_pkt;
34 u_int8_t last_dir;
35 u_int64_t handshake_seq;
36};
37
38#endif /* __KERNEL__ */
39
40#endif /* _NF_CONNTRACK_DCCP_H */
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index 8e5ce1ca7bfc..5da04e586a3f 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -5,37 +5,164 @@
5#define SIP_PORT 5060 5#define SIP_PORT 5060
6#define SIP_TIMEOUT 3600 6#define SIP_TIMEOUT 3600
7 7
8enum sip_header_pos { 8struct nf_ct_sip_master {
9 POS_REG_REQ_URI, 9 unsigned int register_cseq;
10 POS_REQ_URI, 10};
11 POS_FROM, 11
12 POS_TO, 12enum sip_expectation_classes {
13 POS_VIA, 13 SIP_EXPECT_SIGNALLING,
14 POS_CONTACT, 14 SIP_EXPECT_AUDIO,
15 POS_CONTENT, 15 SIP_EXPECT_VIDEO,
16 POS_MEDIA, 16 __SIP_EXPECT_MAX
17 POS_OWNER_IP4, 17};
18 POS_CONNECTION_IP4, 18#define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1)
19 POS_OWNER_IP6, 19
20 POS_CONNECTION_IP6, 20struct sdp_media_type {
21 POS_SDP_HEADER, 21 const char *name;
22 unsigned int len;
23 enum sip_expectation_classes class;
24};
25
26#define SDP_MEDIA_TYPE(__name, __class) \
27{ \
28 .name = (__name), \
29 .len = sizeof(__name) - 1, \
30 .class = (__class), \
31}
32
33struct sip_handler {
34 const char *method;
35 unsigned int len;
36 int (*request)(struct sk_buff *skb,
37 const char **dptr, unsigned int *datalen,
38 unsigned int cseq);
39 int (*response)(struct sk_buff *skb,
40 const char **dptr, unsigned int *datalen,
41 unsigned int cseq, unsigned int code);
42};
43
44#define SIP_HANDLER(__method, __request, __response) \
45{ \
46 .method = (__method), \
47 .len = sizeof(__method) - 1, \
48 .request = (__request), \
49 .response = (__response), \
50}
51
52struct sip_header {
53 const char *name;
54 const char *cname;
55 const char *search;
56 unsigned int len;
57 unsigned int clen;
58 unsigned int slen;
59 int (*match_len)(const struct nf_conn *ct,
60 const char *dptr, const char *limit,
61 int *shift);
62};
63
64#define __SIP_HDR(__name, __cname, __search, __match) \
65{ \
66 .name = (__name), \
67 .len = sizeof(__name) - 1, \
68 .cname = (__cname), \
69 .clen = (__cname) ? sizeof(__cname) - 1 : 0, \
70 .search = (__search), \
71 .slen = (__search) ? sizeof(__search) - 1 : 0, \
72 .match_len = (__match), \
73}
74
75#define SIP_HDR(__name, __cname, __search, __match) \
76 __SIP_HDR(__name, __cname, __search, __match)
77
78#define SDP_HDR(__name, __search, __match) \
79 __SIP_HDR(__name, NULL, __search, __match)
80
81enum sip_header_types {
82 SIP_HDR_CSEQ,
83 SIP_HDR_FROM,
84 SIP_HDR_TO,
85 SIP_HDR_CONTACT,
86 SIP_HDR_VIA,
87 SIP_HDR_EXPIRES,
88 SIP_HDR_CONTENT_LENGTH,
89};
90
91enum sdp_header_types {
92 SDP_HDR_UNSPEC,
93 SDP_HDR_VERSION,
94 SDP_HDR_OWNER_IP4,
95 SDP_HDR_CONNECTION_IP4,
96 SDP_HDR_OWNER_IP6,
97 SDP_HDR_CONNECTION_IP6,
98 SDP_HDR_MEDIA,
22}; 99};
23 100
24extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, 101extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb,
25 enum ip_conntrack_info ctinfo, 102 const char **dptr,
26 struct nf_conn *ct, 103 unsigned int *datalen);
27 const char **dptr); 104extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb,
28extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb, 105 const char **dptr,
29 enum ip_conntrack_info ctinfo, 106 unsigned int *datalen,
30 struct nf_conntrack_expect *exp, 107 struct nf_conntrack_expect *exp,
31 const char *dptr); 108 unsigned int matchoff,
32 109 unsigned int matchlen);
33extern int ct_sip_get_info(const struct nf_conn *ct, const char *dptr, 110extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb,
34 size_t dlen, unsigned int *matchoff, 111 const char **dptr,
35 unsigned int *matchlen, enum sip_header_pos pos); 112 unsigned int dataoff,
36extern int ct_sip_lnlen(const char *line, const char *limit); 113 unsigned int *datalen,
37extern const char *ct_sip_search(const char *needle, const char *haystack, 114 enum sdp_header_types type,
38 size_t needle_len, size_t haystack_len, 115 enum sdp_header_types term,
39 int case_sensitive); 116 const union nf_inet_addr *addr);
117extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb,
118 const char **dptr,
119 unsigned int *datalen,
120 unsigned int matchoff,
121 unsigned int matchlen,
122 u_int16_t port);
123extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb,
124 const char **dptr,
125 unsigned int dataoff,
126 unsigned int *datalen,
127 const union nf_inet_addr *addr);
128extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb,
129 const char **dptr,
130 unsigned int *datalen,
131 struct nf_conntrack_expect *rtp_exp,
132 struct nf_conntrack_expect *rtcp_exp,
133 unsigned int mediaoff,
134 unsigned int medialen,
135 union nf_inet_addr *rtp_addr);
136
137extern int ct_sip_parse_request(const struct nf_conn *ct,
138 const char *dptr, unsigned int datalen,
139 unsigned int *matchoff, unsigned int *matchlen,
140 union nf_inet_addr *addr, __be16 *port);
141extern int ct_sip_get_header(const struct nf_conn *ct, const char *dptr,
142 unsigned int dataoff, unsigned int datalen,
143 enum sip_header_types type,
144 unsigned int *matchoff, unsigned int *matchlen);
145extern int ct_sip_parse_header_uri(const struct nf_conn *ct, const char *dptr,
146 unsigned int *dataoff, unsigned int datalen,
147 enum sip_header_types type, int *in_header,
148 unsigned int *matchoff, unsigned int *matchlen,
149 union nf_inet_addr *addr, __be16 *port);
150extern int ct_sip_parse_address_param(const struct nf_conn *ct, const char *dptr,
151 unsigned int dataoff, unsigned int datalen,
152 const char *name,
153 unsigned int *matchoff, unsigned int *matchlen,
154 union nf_inet_addr *addr);
155extern int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr,
156 unsigned int off, unsigned int datalen,
157 const char *name,
158 unsigned int *matchoff, unsigned int *matchen,
159 unsigned int *val);
160
161extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr,
162 unsigned int dataoff, unsigned int datalen,
163 enum sdp_header_types type,
164 enum sdp_header_types term,
165 unsigned int *matchoff, unsigned int *matchlen);
166
40#endif /* __KERNEL__ */ 167#endif /* __KERNEL__ */
41#endif /* __NF_CONNTRACK_SIP_H__ */ 168#endif /* __NF_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index e3e1533aba2d..0a383ac083cb 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -80,6 +80,7 @@ enum ctattr_l4proto {
80enum ctattr_protoinfo { 80enum ctattr_protoinfo {
81 CTA_PROTOINFO_UNSPEC, 81 CTA_PROTOINFO_UNSPEC,
82 CTA_PROTOINFO_TCP, 82 CTA_PROTOINFO_TCP,
83 CTA_PROTOINFO_DCCP,
83 __CTA_PROTOINFO_MAX 84 __CTA_PROTOINFO_MAX
84}; 85};
85#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) 86#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1)
@@ -95,6 +96,13 @@ enum ctattr_protoinfo_tcp {
95}; 96};
96#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) 97#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1)
97 98
99enum ctattr_protoinfo_dccp {
100 CTA_PROTOINFO_DCCP_UNSPEC,
101 CTA_PROTOINFO_DCCP_STATE,
102 __CTA_PROTOINFO_DCCP_MAX,
103};
104#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1)
105
98enum ctattr_counters { 106enum ctattr_counters {
99 CTA_COUNTERS_UNSPEC, 107 CTA_COUNTERS_UNSPEC,
100 CTA_COUNTERS_PACKETS, /* old 64bit counters */ 108 CTA_COUNTERS_PACKETS, /* old 64bit counters */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index b2c62cc618f5..2326296b6f25 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -430,13 +430,13 @@ extern int xt_compat_add_offset(int af, unsigned int offset, short delta);
430extern void xt_compat_flush_offsets(int af); 430extern void xt_compat_flush_offsets(int af);
431extern short xt_compat_calc_jump(int af, unsigned int offset); 431extern short xt_compat_calc_jump(int af, unsigned int offset);
432 432
433extern int xt_compat_match_offset(struct xt_match *match); 433extern int xt_compat_match_offset(const struct xt_match *match);
434extern int xt_compat_match_from_user(struct xt_entry_match *m, 434extern int xt_compat_match_from_user(struct xt_entry_match *m,
435 void **dstptr, unsigned int *size); 435 void **dstptr, unsigned int *size);
436extern int xt_compat_match_to_user(struct xt_entry_match *m, 436extern int xt_compat_match_to_user(struct xt_entry_match *m,
437 void __user **dstptr, unsigned int *size); 437 void __user **dstptr, unsigned int *size);
438 438
439extern int xt_compat_target_offset(struct xt_target *target); 439extern int xt_compat_target_offset(const struct xt_target *target);
440extern void xt_compat_target_from_user(struct xt_entry_target *t, 440extern void xt_compat_target_from_user(struct xt_entry_target *t,
441 void **dstptr, unsigned int *size); 441 void **dstptr, unsigned int *size);
442extern int xt_compat_target_to_user(struct xt_entry_target *t, 442extern int xt_compat_target_to_user(struct xt_entry_target *t,
diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h
index dd5a4fd4cfd3..32000ba6ecef 100644
--- a/include/linux/netfilter/xt_sctp.h
+++ b/include/linux/netfilter/xt_sctp.h
@@ -37,68 +37,54 @@ struct xt_sctp_info {
37 37
38#define SCTP_CHUNKMAP_SET(chunkmap, type) \ 38#define SCTP_CHUNKMAP_SET(chunkmap, type) \
39 do { \ 39 do { \
40 chunkmap[type / bytes(u_int32_t)] |= \ 40 (chunkmap)[type / bytes(u_int32_t)] |= \
41 1 << (type % bytes(u_int32_t)); \ 41 1 << (type % bytes(u_int32_t)); \
42 } while (0) 42 } while (0)
43 43
44#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ 44#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
45 do { \ 45 do { \
46 chunkmap[type / bytes(u_int32_t)] &= \ 46 (chunkmap)[type / bytes(u_int32_t)] &= \
47 ~(1 << (type % bytes(u_int32_t))); \ 47 ~(1 << (type % bytes(u_int32_t))); \
48 } while (0) 48 } while (0)
49 49
50#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ 50#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
51({ \ 51({ \
52 (chunkmap[type / bytes (u_int32_t)] & \ 52 ((chunkmap)[type / bytes (u_int32_t)] & \
53 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \ 53 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \
54}) 54})
55 55
56#define SCTP_CHUNKMAP_RESET(chunkmap) \ 56#define SCTP_CHUNKMAP_RESET(chunkmap) \
57 do { \ 57 memset((chunkmap), 0, sizeof(chunkmap))
58 int i; \ 58
59 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \ 59#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
60 chunkmap[i] = 0; \ 60 memset((chunkmap), ~0U, sizeof(chunkmap))
61 } while (0) 61
62 62#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
63#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ 63 memcpy((destmap), (srcmap), sizeof(srcmap))
64 do { \ 64
65 int i; \ 65#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
66 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \ 66 __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
67 chunkmap[i] = ~0; \ 67static inline bool
68 } while (0) 68__sctp_chunkmap_is_clear(const u_int32_t *chunkmap, unsigned int n)
69 69{
70#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ 70 unsigned int i;
71 do { \ 71 for (i = 0; i < n; ++i)
72 int i; \ 72 if (chunkmap[i])
73 for (i = 0; i < ARRAY_SIZE(srcmap); i++) \ 73 return false;
74 destmap[i] = srcmap[i]; \ 74 return true;
75 } while (0) 75}
76 76
77#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ 77#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
78({ \ 78 __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
79 int i; \ 79static inline bool
80 int flag = 1; \ 80__sctp_chunkmap_is_all_set(const u_int32_t *chunkmap, unsigned int n)
81 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \ 81{
82 if (chunkmap[i]) { \ 82 unsigned int i;
83 flag = 0; \ 83 for (i = 0; i < n; ++i)
84 break; \ 84 if (chunkmap[i] != ~0U)
85 } \ 85 return false;
86 } \ 86 return true;
87 flag; \ 87}
88})
89
90#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
91({ \
92 int i; \
93 int flag = 1; \
94 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
95 if (chunkmap[i] != ~0) { \
96 flag = 0; \
97 break; \
98 } \
99 } \
100 flag; \
101})
102 88
103#endif /* _XT_SCTP_H_ */ 89#endif /* _XT_SCTP_H_ */
104 90
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index db223ca92c8b..dd9c97f2d436 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -23,8 +23,6 @@
23 23
24#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN 24#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
25#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN 25#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
26#define arpt_target xt_target
27#define arpt_table xt_table
28 26
29#define ARPT_DEV_ADDR_LEN_MAX 16 27#define ARPT_DEV_ADDR_LEN_MAX 16
30 28
@@ -266,20 +264,15 @@ struct arpt_error
266 .target.errorname = "ERROR", \ 264 .target.errorname = "ERROR", \
267} 265}
268 266
269#define arpt_register_target(tgt) \ 267extern struct xt_table *arpt_register_table(struct net *net,
270({ (tgt)->family = NF_ARP; \ 268 struct xt_table *table,
271 xt_register_target(tgt); }) 269 const struct arpt_replace *repl);
272#define arpt_unregister_target(tgt) xt_unregister_target(tgt) 270extern void arpt_unregister_table(struct xt_table *table);
273
274extern struct arpt_table *arpt_register_table(struct net *net,
275 struct arpt_table *table,
276 const struct arpt_replace *repl);
277extern void arpt_unregister_table(struct arpt_table *table);
278extern unsigned int arpt_do_table(struct sk_buff *skb, 271extern unsigned int arpt_do_table(struct sk_buff *skb,
279 unsigned int hook, 272 unsigned int hook,
280 const struct net_device *in, 273 const struct net_device *in,
281 const struct net_device *out, 274 const struct net_device *out,
282 struct arpt_table *table); 275 struct xt_table *table);
283 276
284#define ARPT_ALIGN(s) XT_ALIGN(s) 277#define ARPT_ALIGN(s) XT_ALIGN(s)
285 278
diff --git a/include/linux/netfilter_bridge/ebt_nflog.h b/include/linux/netfilter_bridge/ebt_nflog.h
new file mode 100644
index 000000000000..052817849b83
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_nflog.h
@@ -0,0 +1,21 @@
1#ifndef __LINUX_BRIDGE_EBT_NFLOG_H
2#define __LINUX_BRIDGE_EBT_NFLOG_H
3
4#define EBT_NFLOG_MASK 0x0
5
6#define EBT_NFLOG_PREFIX_SIZE 64
7#define EBT_NFLOG_WATCHER "nflog"
8
9#define EBT_NFLOG_DEFAULT_GROUP 0x1
10#define EBT_NFLOG_DEFAULT_THRESHOLD 1
11
12struct ebt_nflog_info {
13 u_int32_t len;
14 u_int16_t group;
15 u_int16_t threshold;
16 u_int16_t flags;
17 u_int16_t pad;
18 char prefix[EBT_NFLOG_PREFIX_SIZE];
19};
20
21#endif /* __LINUX_BRIDGE_EBT_NFLOG_H */
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 9a10092e358c..650318b0c405 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -62,8 +62,6 @@ enum nf_ip_hook_priorities {
62 NF_IP_PRI_FILTER = 0, 62 NF_IP_PRI_FILTER = 0,
63 NF_IP_PRI_NAT_SRC = 100, 63 NF_IP_PRI_NAT_SRC = 100,
64 NF_IP_PRI_SELINUX_LAST = 225, 64 NF_IP_PRI_SELINUX_LAST = 225,
65 NF_IP_PRI_CONNTRACK_HELPER = INT_MAX - 2,
66 NF_IP_PRI_NAT_SEQ_ADJUST = INT_MAX - 1,
67 NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, 65 NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX,
68 NF_IP_PRI_LAST = INT_MAX, 66 NF_IP_PRI_LAST = INT_MAX,
69}; 67};
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 9fecf902419c..ea6517e58b04 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -78,6 +78,18 @@
78 * or, if no MAC address given, all stations, on the interface identified 78 * or, if no MAC address given, all stations, on the interface identified
79 * by %NL80211_ATTR_IFINDEX. 79 * by %NL80211_ATTR_IFINDEX.
80 * 80 *
81 * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to
82 * destination %NL80211_ATTR_MAC on the interface identified by
83 * %NL80211_ATTR_IFINDEX.
84 * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to
85 * destination %NL80211_ATTR_MAC on the interface identified by
86 * %NL80211_ATTR_IFINDEX.
87 * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the
88 * the interface identified by %NL80211_ATTR_IFINDEX.
89 * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC
90 * or, if no MAC address given, all mesh paths, on the interface identified
91 * by %NL80211_ATTR_IFINDEX.
92 *
81 * @NL80211_CMD_MAX: highest used command number 93 * @NL80211_CMD_MAX: highest used command number
82 * @__NL80211_CMD_AFTER_LAST: internal use 94 * @__NL80211_CMD_AFTER_LAST: internal use
83 */ 95 */
@@ -112,6 +124,11 @@ enum nl80211_commands {
112 124
113 /* add commands here */ 125 /* add commands here */
114 126
127 NL80211_CMD_GET_MPATH,
128 NL80211_CMD_SET_MPATH,
129 NL80211_CMD_NEW_MPATH,
130 NL80211_CMD_DEL_MPATH,
131
115 /* used to define NL80211_CMD_MAX below */ 132 /* used to define NL80211_CMD_MAX below */
116 __NL80211_CMD_AFTER_LAST, 133 __NL80211_CMD_AFTER_LAST,
117 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 134 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
@@ -157,9 +174,23 @@ enum nl80211_commands {
157 * restriction (at most %NL80211_MAX_SUPP_RATES). 174 * restriction (at most %NL80211_MAX_SUPP_RATES).
158 * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station 175 * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station
159 * to, or the AP interface the station was originally added to to. 176 * to, or the AP interface the station was originally added to to.
160 * @NL80211_ATTR_STA_STATS: statistics for a station, part of station info 177 * @NL80211_ATTR_STA_INFO: information about a station, part of station info
161 * given for %NL80211_CMD_GET_STATION, nested attribute containing 178 * given for %NL80211_CMD_GET_STATION, nested attribute containing
162 * info as possible, see &enum nl80211_sta_stats. 179 * info as possible, see &enum nl80211_sta_info.
180 *
181 * @NL80211_ATTR_WIPHY_BANDS: Information about an operating bands,
182 * consisting of a nested array.
183 *
184 * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes).
185 * @NL80211_ATTR_PLINK_ACTION: action to perform on the mesh peer link.
186 * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path.
187 * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path
188 * info given for %NL80211_CMD_GET_MPATH, nested attribute described at
189 * &enum nl80211_mpath_info.
190 *
191 *
192 * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of
193 * &enum nl80211_mntr_flags.
163 * 194 *
164 * @NL80211_ATTR_MAX: highest attribute number currently defined 195 * @NL80211_ATTR_MAX: highest attribute number currently defined
165 * @__NL80211_ATTR_AFTER_LAST: internal use 196 * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -193,10 +224,19 @@ enum nl80211_attrs {
193 NL80211_ATTR_STA_LISTEN_INTERVAL, 224 NL80211_ATTR_STA_LISTEN_INTERVAL,
194 NL80211_ATTR_STA_SUPPORTED_RATES, 225 NL80211_ATTR_STA_SUPPORTED_RATES,
195 NL80211_ATTR_STA_VLAN, 226 NL80211_ATTR_STA_VLAN,
196 NL80211_ATTR_STA_STATS, 227 NL80211_ATTR_STA_INFO,
228
229 NL80211_ATTR_WIPHY_BANDS,
230
231 NL80211_ATTR_MNTR_FLAGS,
197 232
198 /* add attributes here, update the policy in nl80211.c */ 233 /* add attributes here, update the policy in nl80211.c */
199 234
235 NL80211_ATTR_MESH_ID,
236 NL80211_ATTR_STA_PLINK_ACTION,
237 NL80211_ATTR_MPATH_NEXT_HOP,
238 NL80211_ATTR_MPATH_INFO,
239
200 __NL80211_ATTR_AFTER_LAST, 240 __NL80211_ATTR_AFTER_LAST,
201 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 241 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
202}; 242};
@@ -213,6 +253,7 @@ enum nl80211_attrs {
213 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points 253 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
214 * @NL80211_IFTYPE_WDS: wireless distribution interface 254 * @NL80211_IFTYPE_WDS: wireless distribution interface
215 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames 255 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
256 * @NL80211_IFTYPE_MESH_POINT: mesh point
216 * @NL80211_IFTYPE_MAX: highest interface type number currently defined 257 * @NL80211_IFTYPE_MAX: highest interface type number currently defined
217 * @__NL80211_IFTYPE_AFTER_LAST: internal use 258 * @__NL80211_IFTYPE_AFTER_LAST: internal use
218 * 259 *
@@ -228,6 +269,7 @@ enum nl80211_iftype {
228 NL80211_IFTYPE_AP_VLAN, 269 NL80211_IFTYPE_AP_VLAN,
229 NL80211_IFTYPE_WDS, 270 NL80211_IFTYPE_WDS,
230 NL80211_IFTYPE_MONITOR, 271 NL80211_IFTYPE_MONITOR,
272 NL80211_IFTYPE_MESH_POINT,
231 273
232 /* keep last */ 274 /* keep last */
233 __NL80211_IFTYPE_AFTER_LAST, 275 __NL80211_IFTYPE_AFTER_LAST,
@@ -257,27 +299,167 @@ enum nl80211_sta_flags {
257}; 299};
258 300
259/** 301/**
260 * enum nl80211_sta_stats - station statistics 302 * enum nl80211_sta_info - station information
261 * 303 *
262 * These attribute types are used with %NL80211_ATTR_STA_STATS 304 * These attribute types are used with %NL80211_ATTR_STA_INFO
263 * when getting information about a station. 305 * when getting information about a station.
264 * 306 *
265 * @__NL80211_STA_STAT_INVALID: attribute number 0 is reserved 307 * @__NL80211_STA_INFO_INVALID: attribute number 0 is reserved
266 * @NL80211_STA_STAT_INACTIVE_TIME: time since last activity (u32, msecs) 308 * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs)
267 * @NL80211_STA_STAT_RX_BYTES: total received bytes (u32, from this station) 309 * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station)
268 * @NL80211_STA_STAT_TX_BYTES: total transmitted bytes (u32, to this station) 310 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
269 * @__NL80211_STA_STAT_AFTER_LAST: internal 311 * @__NL80211_STA_INFO_AFTER_LAST: internal
270 * @NL80211_STA_STAT_MAX: highest possible station stats attribute 312 * @NL80211_STA_INFO_MAX: highest possible station info attribute
313 */
314enum nl80211_sta_info {
315 __NL80211_STA_INFO_INVALID,
316 NL80211_STA_INFO_INACTIVE_TIME,
317 NL80211_STA_INFO_RX_BYTES,
318 NL80211_STA_INFO_TX_BYTES,
319 NL80211_STA_INFO_LLID,
320 NL80211_STA_INFO_PLID,
321 NL80211_STA_INFO_PLINK_STATE,
322
323 /* keep last */
324 __NL80211_STA_INFO_AFTER_LAST,
325 NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1
326};
327
328/**
329 * enum nl80211_mpath_flags - nl80211 mesh path flags
330 *
331 * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active
332 * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running
333 * @NL80211_MPATH_FLAG_DSN_VALID: the mesh path contains a valid DSN
334 * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set
335 * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded
336 */
337enum nl80211_mpath_flags {
338 NL80211_MPATH_FLAG_ACTIVE = 1<<0,
339 NL80211_MPATH_FLAG_RESOLVING = 1<<1,
340 NL80211_MPATH_FLAG_DSN_VALID = 1<<2,
341 NL80211_MPATH_FLAG_FIXED = 1<<3,
342 NL80211_MPATH_FLAG_RESOLVED = 1<<4,
343};
344
345/**
346 * enum nl80211_mpath_info - mesh path information
347 *
348 * These attribute types are used with %NL80211_ATTR_MPATH_INFO when getting
349 * information about a mesh path.
350 *
351 * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved
352 * @NL80211_ATTR_MPATH_FRAME_QLEN: number of queued frames for this destination
353 * @NL80211_ATTR_MPATH_DSN: destination sequence number
354 * @NL80211_ATTR_MPATH_METRIC: metric (cost) of this mesh path
355 * @NL80211_ATTR_MPATH_EXPTIME: expiration time for the path, in msec from now
356 * @NL80211_ATTR_MPATH_FLAGS: mesh path flags, enumerated in
357 * &enum nl80211_mpath_flags;
358 * @NL80211_ATTR_MPATH_DISCOVERY_TIMEOUT: total path discovery timeout, in msec
359 * @NL80211_ATTR_MPATH_DISCOVERY_RETRIES: mesh path discovery retries
360 */
361enum nl80211_mpath_info {
362 __NL80211_MPATH_INFO_INVALID,
363 NL80211_MPATH_INFO_FRAME_QLEN,
364 NL80211_MPATH_INFO_DSN,
365 NL80211_MPATH_INFO_METRIC,
366 NL80211_MPATH_INFO_EXPTIME,
367 NL80211_MPATH_INFO_FLAGS,
368 NL80211_MPATH_INFO_DISCOVERY_TIMEOUT,
369 NL80211_MPATH_INFO_DISCOVERY_RETRIES,
370
371 /* keep last */
372 __NL80211_MPATH_INFO_AFTER_LAST,
373 NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1
374};
375
376/**
377 * enum nl80211_band_attr - band attributes
378 * @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved
379 * @NL80211_BAND_ATTR_FREQS: supported frequencies in this band,
380 * an array of nested frequency attributes
381 * @NL80211_BAND_ATTR_RATES: supported bitrates in this band,
382 * an array of nested bitrate attributes
383 */
384enum nl80211_band_attr {
385 __NL80211_BAND_ATTR_INVALID,
386 NL80211_BAND_ATTR_FREQS,
387 NL80211_BAND_ATTR_RATES,
388
389 /* keep last */
390 __NL80211_BAND_ATTR_AFTER_LAST,
391 NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1
392};
393
394/**
395 * enum nl80211_frequency_attr - frequency attributes
396 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
397 * @NL80211_FREQUENCY_ATTR_DISABLED: Channel is disabled in current
398 * regulatory domain.
399 * @NL80211_FREQUENCY_ATTR_PASSIVE_SCAN: Only passive scanning is
400 * permitted on this channel in current regulatory domain.
401 * @NL80211_FREQUENCY_ATTR_NO_IBSS: IBSS networks are not permitted
402 * on this channel in current regulatory domain.
403 * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory
404 * on this channel in current regulatory domain.
405 */
406enum nl80211_frequency_attr {
407 __NL80211_FREQUENCY_ATTR_INVALID,
408 NL80211_FREQUENCY_ATTR_FREQ,
409 NL80211_FREQUENCY_ATTR_DISABLED,
410 NL80211_FREQUENCY_ATTR_PASSIVE_SCAN,
411 NL80211_FREQUENCY_ATTR_NO_IBSS,
412 NL80211_FREQUENCY_ATTR_RADAR,
413
414 /* keep last */
415 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
416 NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
417};
418
419/**
420 * enum nl80211_bitrate_attr - bitrate attributes
421 * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps
422 * @NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE: Short preamble supported
423 * in 2.4 GHz band.
424 */
425enum nl80211_bitrate_attr {
426 __NL80211_BITRATE_ATTR_INVALID,
427 NL80211_BITRATE_ATTR_RATE,
428 NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE,
429
430 /* keep last */
431 __NL80211_BITRATE_ATTR_AFTER_LAST,
432 NL80211_BITRATE_ATTR_MAX = __NL80211_BITRATE_ATTR_AFTER_LAST - 1
433};
434
435/**
436 * enum nl80211_mntr_flags - monitor configuration flags
437 *
438 * Monitor configuration flags.
439 *
440 * @__NL80211_MNTR_FLAG_INVALID: reserved
441 *
442 * @NL80211_MNTR_FLAG_FCSFAIL: pass frames with bad FCS
443 * @NL80211_MNTR_FLAG_PLCPFAIL: pass frames with bad PLCP
444 * @NL80211_MNTR_FLAG_CONTROL: pass control frames
445 * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering
446 * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing.
447 * overrides all other flags.
448 *
449 * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use
450 * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag
271 */ 451 */
272enum nl80211_sta_stats { 452enum nl80211_mntr_flags {
273 __NL80211_STA_STAT_INVALID, 453 __NL80211_MNTR_FLAG_INVALID,
274 NL80211_STA_STAT_INACTIVE_TIME, 454 NL80211_MNTR_FLAG_FCSFAIL,
275 NL80211_STA_STAT_RX_BYTES, 455 NL80211_MNTR_FLAG_PLCPFAIL,
276 NL80211_STA_STAT_TX_BYTES, 456 NL80211_MNTR_FLAG_CONTROL,
457 NL80211_MNTR_FLAG_OTHER_BSS,
458 NL80211_MNTR_FLAG_COOK_FRAMES,
277 459
278 /* keep last */ 460 /* keep last */
279 __NL80211_STA_STAT_AFTER_LAST, 461 __NL80211_MNTR_FLAG_AFTER_LAST,
280 NL80211_STA_STAT_MAX = __NL80211_STA_STAT_AFTER_LAST - 1 462 NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1
281}; 463};
282 464
283#endif /* __LINUX_NL80211_H */ 465#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/pcounter.h b/include/linux/pcounter.h
deleted file mode 100644
index a82d9f2628ca..000000000000
--- a/include/linux/pcounter.h
+++ /dev/null
@@ -1,74 +0,0 @@
1#ifndef __LINUX_PCOUNTER_H
2#define __LINUX_PCOUNTER_H
3/*
4 * Using a dynamic percpu 'int' variable has a cost :
5 * 1) Extra dereference
6 * Current per_cpu_ptr() implementation uses an array per 'percpu variable'.
7 * 2) memory cost of NR_CPUS*(32+sizeof(void *)) instead of num_possible_cpus()*4
8 *
9 * This pcounter implementation is an abstraction to be able to use
10 * either a static or a dynamic per cpu variable.
11 * One dynamic per cpu variable gets a fast & cheap implementation, we can
12 * change pcounter implementation too.
13 */
14struct pcounter {
15#ifdef CONFIG_SMP
16 void (*add)(struct pcounter *self, int inc);
17 int (*getval)(const struct pcounter *self, int cpu);
18 int *per_cpu_values;
19#else
20 int val;
21#endif
22};
23
24#ifdef CONFIG_SMP
25#include <linux/percpu.h>
26
27#define DEFINE_PCOUNTER(NAME) \
28static DEFINE_PER_CPU(int, NAME##_pcounter_values); \
29static void NAME##_pcounter_add(struct pcounter *self, int val) \
30{ \
31 __get_cpu_var(NAME##_pcounter_values) += val; \
32} \
33static int NAME##_pcounter_getval(const struct pcounter *self, int cpu) \
34{ \
35 return per_cpu(NAME##_pcounter_values, cpu); \
36} \
37
38#define PCOUNTER_MEMBER_INITIALIZER(NAME, MEMBER) \
39 MEMBER = { \
40 .add = NAME##_pcounter_add, \
41 .getval = NAME##_pcounter_getval, \
42 }
43
44
45static inline void pcounter_add(struct pcounter *self, int inc)
46{
47 self->add(self, inc);
48}
49
50extern int pcounter_getval(const struct pcounter *self);
51extern int pcounter_alloc(struct pcounter *self);
52extern void pcounter_free(struct pcounter *self);
53
54
55#else /* CONFIG_SMP */
56
57static inline void pcounter_add(struct pcounter *self, int inc)
58{
59 self->val += inc;
60}
61
62static inline int pcounter_getval(const struct pcounter *self)
63{
64 return self->val;
65}
66
67#define DEFINE_PCOUNTER(NAME)
68#define PCOUNTER_MEMBER_INITIALIZER(NAME, MEMBER)
69#define pcounter_alloc(self) 0
70#define pcounter_free(self)
71
72#endif /* CONFIG_SMP */
73
74#endif /* __LINUX_PCOUNTER_H */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 5e43ae751412..779cbcd65f62 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -39,7 +39,8 @@
39 SUPPORTED_1000baseT_Half | \ 39 SUPPORTED_1000baseT_Half | \
40 SUPPORTED_1000baseT_Full) 40 SUPPORTED_1000baseT_Full)
41 41
42/* Set phydev->irq to PHY_POLL if interrupts are not supported, 42/*
43 * Set phydev->irq to PHY_POLL if interrupts are not supported,
43 * or not desired for this PHY. Set to PHY_IGNORE_INTERRUPT if 44 * or not desired for this PHY. Set to PHY_IGNORE_INTERRUPT if
44 * the attached driver handles the interrupt 45 * the attached driver handles the interrupt
45 */ 46 */
@@ -63,8 +64,6 @@ typedef enum {
63 PHY_INTERFACE_MODE_RTBI 64 PHY_INTERFACE_MODE_RTBI
64} phy_interface_t; 65} phy_interface_t;
65 66
66#define MII_BUS_MAX 4
67
68 67
69#define PHY_INIT_TIMEOUT 100000 68#define PHY_INIT_TIMEOUT 100000
70#define PHY_STATE_TIME 1 69#define PHY_STATE_TIME 1
@@ -74,20 +73,30 @@ typedef enum {
74#define PHY_MAX_ADDR 32 73#define PHY_MAX_ADDR 32
75 74
76/* Used when trying to connect to a specific phy (mii bus id:phy device id) */ 75/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
77#define PHY_ID_FMT "%x:%02x" 76#define PHY_ID_FMT "%s:%02x"
78 77
79/* The Bus class for PHYs. Devices which provide access to 78/*
80 * PHYs should register using this structure */ 79 * Need to be a little smaller than phydev->dev.bus_id to leave room
80 * for the ":%02x"
81 */
82#define MII_BUS_ID_SIZE (BUS_ID_SIZE - 3)
83
84/*
85 * The Bus class for PHYs. Devices which provide access to
86 * PHYs should register using this structure
87 */
81struct mii_bus { 88struct mii_bus {
82 const char *name; 89 const char *name;
83 int id; 90 char id[MII_BUS_ID_SIZE];
84 void *priv; 91 void *priv;
85 int (*read)(struct mii_bus *bus, int phy_id, int regnum); 92 int (*read)(struct mii_bus *bus, int phy_id, int regnum);
86 int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val); 93 int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val);
87 int (*reset)(struct mii_bus *bus); 94 int (*reset)(struct mii_bus *bus);
88 95
89 /* A lock to ensure that only one thing can read/write 96 /*
90 * the MDIO bus at a time */ 97 * A lock to ensure that only one thing can read/write
98 * the MDIO bus at a time
99 */
91 struct mutex mdio_lock; 100 struct mutex mdio_lock;
92 101
93 struct device *dev; 102 struct device *dev;
@@ -98,8 +107,10 @@ struct mii_bus {
98 /* Phy addresses to be ignored when probing */ 107 /* Phy addresses to be ignored when probing */
99 u32 phy_mask; 108 u32 phy_mask;
100 109
101 /* Pointer to an array of interrupts, each PHY's 110 /*
102 * interrupt at the index matching its address */ 111 * Pointer to an array of interrupts, each PHY's
112 * interrupt at the index matching its address
113 */
103 int *irq; 114 int *irq;
104}; 115};
105 116
@@ -251,7 +262,8 @@ struct phy_device {
251 /* Bus address of the PHY (0-32) */ 262 /* Bus address of the PHY (0-32) */
252 int addr; 263 int addr;
253 264
254 /* forced speed & duplex (no autoneg) 265 /*
266 * forced speed & duplex (no autoneg)
255 * partner speed & duplex & pause (autoneg) 267 * partner speed & duplex & pause (autoneg)
256 */ 268 */
257 int speed; 269 int speed;
@@ -274,8 +286,10 @@ struct phy_device {
274 286
275 int link_timeout; 287 int link_timeout;
276 288
277 /* Interrupt number for this PHY 289 /*
278 * -1 means no interrupt */ 290 * Interrupt number for this PHY
291 * -1 means no interrupt
292 */
279 int irq; 293 int irq;
280 294
281 /* private data pointer */ 295 /* private data pointer */
@@ -325,22 +339,28 @@ struct phy_driver {
325 u32 features; 339 u32 features;
326 u32 flags; 340 u32 flags;
327 341
328 /* Called to initialize the PHY, 342 /*
329 * including after a reset */ 343 * Called to initialize the PHY,
344 * including after a reset
345 */
330 int (*config_init)(struct phy_device *phydev); 346 int (*config_init)(struct phy_device *phydev);
331 347
332 /* Called during discovery. Used to set 348 /*
333 * up device-specific structures, if any */ 349 * Called during discovery. Used to set
350 * up device-specific structures, if any
351 */
334 int (*probe)(struct phy_device *phydev); 352 int (*probe)(struct phy_device *phydev);
335 353
336 /* PHY Power Management */ 354 /* PHY Power Management */
337 int (*suspend)(struct phy_device *phydev); 355 int (*suspend)(struct phy_device *phydev);
338 int (*resume)(struct phy_device *phydev); 356 int (*resume)(struct phy_device *phydev);
339 357
340 /* Configures the advertisement and resets 358 /*
359 * Configures the advertisement and resets
341 * autonegotiation if phydev->autoneg is on, 360 * autonegotiation if phydev->autoneg is on,
342 * forces the speed to the current settings in phydev 361 * forces the speed to the current settings in phydev
343 * if phydev->autoneg is off */ 362 * if phydev->autoneg is off
363 */
344 int (*config_aneg)(struct phy_device *phydev); 364 int (*config_aneg)(struct phy_device *phydev);
345 365
346 /* Determines the negotiated speed and duplex */ 366 /* Determines the negotiated speed and duplex */
@@ -361,6 +381,7 @@ struct phy_driver {
361 381
362int phy_read(struct phy_device *phydev, u16 regnum); 382int phy_read(struct phy_device *phydev, u16 regnum);
363int phy_write(struct phy_device *phydev, u16 regnum, u16 val); 383int phy_write(struct phy_device *phydev, u16 regnum, u16 val);
384int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
364struct phy_device* get_phy_device(struct mii_bus *bus, int addr); 385struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
365int phy_clear_interrupt(struct phy_device *phydev); 386int phy_clear_interrupt(struct phy_device *phydev);
366int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); 387int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
diff --git a/include/linux/pim.h b/include/linux/pim.h
new file mode 100644
index 000000000000..236ffd317394
--- /dev/null
+++ b/include/linux/pim.h
@@ -0,0 +1,45 @@
1#ifndef __LINUX_PIM_H
2#define __LINUX_PIM_H
3
4#include <asm/byteorder.h>
5
6#ifndef __KERNEL__
7struct pim {
8#if defined(__LITTLE_ENDIAN_BITFIELD)
9 __u8 pim_type:4, /* PIM message type */
10 pim_ver:4; /* PIM version */
11#elif defined(__BIG_ENDIAN_BITFIELD)
12 __u8 pim_ver:4; /* PIM version */
13 pim_type:4; /* PIM message type */
14#endif
15 __u8 pim_rsv; /* Reserved */
16 __be16 pim_cksum; /* Checksum */
17};
18
19#define PIM_MINLEN 8
20#endif
21
22/* Message types - V1 */
23#define PIM_V1_VERSION __constant_htonl(0x10000000)
24#define PIM_V1_REGISTER 1
25
26/* Message types - V2 */
27#define PIM_VERSION 2
28#define PIM_REGISTER 1
29
30#if defined(__KERNEL__)
31#define PIM_NULL_REGISTER __constant_htonl(0x40000000)
32
33/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */
34struct pimreghdr
35{
36 __u8 type;
37 __u8 reserved;
38 __be16 csum;
39 __be32 flags;
40};
41
42struct sk_buff;
43extern int pim_rcv_v1(struct sk_buff *);
44#endif
45#endif
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 6e0393a5b2ea..eb560d031acd 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -160,14 +160,18 @@ enum {
160 160
161 161
162#ifdef __KERNEL__ 162#ifdef __KERNEL__
163#include <linux/spinlock.h> 163#include <linux/list.h>
164#include <linux/rwsem.h>
165#include <linux/mutex.h> 164#include <linux/mutex.h>
165#include <linux/rwsem.h>
166#include <linux/spinlock.h>
167#include <linux/wait.h>
166 168
167#include <linux/dqblk_xfs.h> 169#include <linux/dqblk_xfs.h>
168#include <linux/dqblk_v1.h> 170#include <linux/dqblk_v1.h>
169#include <linux/dqblk_v2.h> 171#include <linux/dqblk_v2.h>
170 172
173#include <asm/atomic.h>
174
171extern spinlock_t dq_data_lock; 175extern spinlock_t dq_data_lock;
172 176
173/* Maximal numbers of writes for quota operation (insert/delete/update) 177/* Maximal numbers of writes for quota operation (insert/delete/update)
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index a3d567a974e8..71fc81360048 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -213,6 +213,11 @@ int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, gfp_t,
213 sg_alloc_fn *); 213 sg_alloc_fn *);
214int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); 214int sg_alloc_table(struct sg_table *, unsigned int, gfp_t);
215 215
216size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents,
217 void *buf, size_t buflen);
218size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents,
219 void *buf, size_t buflen);
220
216/* 221/*
217 * Maximum number of entries that will be allocated in one piece, if 222 * Maximum number of entries that will be allocated in one piece, if
218 * a list larger than this is required then chaining will be utilized. 223 * a list larger than this is required then chaining will be utilized.
diff --git a/include/linux/security.h b/include/linux/security.h
index c673dfd4dffc..fea1f4aa4dd5 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -36,7 +36,11 @@
36 36
37extern unsigned securebits; 37extern unsigned securebits;
38 38
39/* Maximum number of letters for an LSM name string */
40#define SECURITY_NAME_MAX 10
41
39struct ctl_table; 42struct ctl_table;
43struct audit_krule;
40 44
41/* 45/*
42 * These functions are in security/capability.c and are used 46 * These functions are in security/capability.c and are used
@@ -136,6 +140,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
136/** 140/**
137 * struct security_operations - main security structure 141 * struct security_operations - main security structure
138 * 142 *
143 * Security module identifier.
144 *
145 * @name:
146 * A string that acts as a unique identifeir for the LSM with max number
147 * of characters = SECURITY_NAME_MAX.
148 *
139 * Security hooks for program execution operations. 149 * Security hooks for program execution operations.
140 * 150 *
141 * @bprm_alloc_security: 151 * @bprm_alloc_security:
@@ -468,6 +478,11 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
468 * @dentry is the dentry being changed. 478 * @dentry is the dentry being changed.
469 * Return 0 on success. If error is returned, then the operation 479 * Return 0 on success. If error is returned, then the operation
470 * causing setuid bit removal is failed. 480 * causing setuid bit removal is failed.
481 * @inode_getsecid:
482 * Get the secid associated with the node.
483 * @inode contains a pointer to the inode.
484 * @secid contains a pointer to the location where result will be saved.
485 * In case of failure, @secid will be set to zero.
471 * 486 *
472 * Security hooks for file operations 487 * Security hooks for file operations
473 * 488 *
@@ -636,6 +651,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
636 * @task_getsecid: 651 * @task_getsecid:
637 * Retrieve the security identifier of the process @p. 652 * Retrieve the security identifier of the process @p.
638 * @p contains the task_struct for the process and place is into @secid. 653 * @p contains the task_struct for the process and place is into @secid.
654 * In case of failure, @secid will be set to zero.
655 *
639 * @task_setgroups: 656 * @task_setgroups:
640 * Check permission before setting the supplementary group set of the 657 * Check permission before setting the supplementary group set of the
641 * current process. 658 * current process.
@@ -910,24 +927,24 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
910 * Security hooks for XFRM operations. 927 * Security hooks for XFRM operations.
911 * 928 *
912 * @xfrm_policy_alloc_security: 929 * @xfrm_policy_alloc_security:
913 * @xp contains the xfrm_policy being added to Security Policy Database 930 * @ctxp is a pointer to the xfrm_sec_ctx being added to Security Policy
914 * used by the XFRM system. 931 * Database used by the XFRM system.
915 * @sec_ctx contains the security context information being provided by 932 * @sec_ctx contains the security context information being provided by
916 * the user-level policy update program (e.g., setkey). 933 * the user-level policy update program (e.g., setkey).
917 * Allocate a security structure to the xp->security field; the security 934 * Allocate a security structure to the xp->security field; the security
918 * field is initialized to NULL when the xfrm_policy is allocated. 935 * field is initialized to NULL when the xfrm_policy is allocated.
919 * Return 0 if operation was successful (memory to allocate, legal context) 936 * Return 0 if operation was successful (memory to allocate, legal context)
920 * @xfrm_policy_clone_security: 937 * @xfrm_policy_clone_security:
921 * @old contains an existing xfrm_policy in the SPD. 938 * @old_ctx contains an existing xfrm_sec_ctx.
922 * @new contains a new xfrm_policy being cloned from old. 939 * @new_ctxp contains a new xfrm_sec_ctx being cloned from old.
923 * Allocate a security structure to the new->security field 940 * Allocate a security structure in new_ctxp that contains the
924 * that contains the information from the old->security field. 941 * information from the old_ctx structure.
925 * Return 0 if operation was successful (memory to allocate). 942 * Return 0 if operation was successful (memory to allocate).
926 * @xfrm_policy_free_security: 943 * @xfrm_policy_free_security:
927 * @xp contains the xfrm_policy 944 * @ctx contains the xfrm_sec_ctx
928 * Deallocate xp->security. 945 * Deallocate xp->security.
929 * @xfrm_policy_delete_security: 946 * @xfrm_policy_delete_security:
930 * @xp contains the xfrm_policy. 947 * @ctx contains the xfrm_sec_ctx.
931 * Authorize deletion of xp->security. 948 * Authorize deletion of xp->security.
932 * @xfrm_state_alloc_security: 949 * @xfrm_state_alloc_security:
933 * @x contains the xfrm_state being added to the Security Association 950 * @x contains the xfrm_state being added to the Security Association
@@ -947,7 +964,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
947 * @x contains the xfrm_state. 964 * @x contains the xfrm_state.
948 * Authorize deletion of x->security. 965 * Authorize deletion of x->security.
949 * @xfrm_policy_lookup: 966 * @xfrm_policy_lookup:
950 * @xp contains the xfrm_policy for which the access control is being 967 * @ctx contains the xfrm_sec_ctx for which the access control is being
951 * checked. 968 * checked.
952 * @fl_secid contains the flow security label that is used to authorize 969 * @fl_secid contains the flow security label that is used to authorize
953 * access to the policy xp. 970 * access to the policy xp.
@@ -997,6 +1014,11 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
997 * @ipcp contains the kernel IPC permission structure 1014 * @ipcp contains the kernel IPC permission structure
998 * @flag contains the desired (requested) permission set 1015 * @flag contains the desired (requested) permission set
999 * Return 0 if permission is granted. 1016 * Return 0 if permission is granted.
1017 * @ipc_getsecid:
1018 * Get the secid associated with the ipc object.
1019 * @ipcp contains the kernel IPC permission structure.
1020 * @secid contains a pointer to the location where result will be saved.
1021 * In case of failure, @secid will be set to zero.
1000 * 1022 *
1001 * Security hooks for individual messages held in System V IPC message queues 1023 * Security hooks for individual messages held in System V IPC message queues
1002 * @msg_msg_alloc_security: 1024 * @msg_msg_alloc_security:
@@ -1223,9 +1245,42 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1223 * @secdata contains the security context. 1245 * @secdata contains the security context.
1224 * @seclen contains the length of the security context. 1246 * @seclen contains the length of the security context.
1225 * 1247 *
1248 * Security hooks for Audit
1249 *
1250 * @audit_rule_init:
1251 * Allocate and initialize an LSM audit rule structure.
1252 * @field contains the required Audit action. Fields flags are defined in include/linux/audit.h
1253 * @op contains the operator the rule uses.
1254 * @rulestr contains the context where the rule will be applied to.
1255 * @lsmrule contains a pointer to receive the result.
1256 * Return 0 if @lsmrule has been successfully set,
1257 * -EINVAL in case of an invalid rule.
1258 *
1259 * @audit_rule_known:
1260 * Specifies whether given @rule contains any fields related to current LSM.
1261 * @rule contains the audit rule of interest.
1262 * Return 1 in case of relation found, 0 otherwise.
1263 *
1264 * @audit_rule_match:
1265 * Determine if given @secid matches a rule previously approved
1266 * by @audit_rule_known.
1267 * @secid contains the security id in question.
1268 * @field contains the field which relates to current LSM.
1269 * @op contains the operator that will be used for matching.
1270 * @rule points to the audit rule that will be checked against.
1271 * @actx points to the audit context associated with the check.
1272 * Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure.
1273 *
1274 * @audit_rule_free:
1275 * Deallocate the LSM audit rule structure previously allocated by
1276 * audit_rule_init.
1277 * @rule contains the allocated rule
1278 *
1226 * This is the main security structure. 1279 * This is the main security structure.
1227 */ 1280 */
1228struct security_operations { 1281struct security_operations {
1282 char name[SECURITY_NAME_MAX + 1];
1283
1229 int (*ptrace) (struct task_struct * parent, struct task_struct * child); 1284 int (*ptrace) (struct task_struct * parent, struct task_struct * child);
1230 int (*capget) (struct task_struct * target, 1285 int (*capget) (struct task_struct * target,
1231 kernel_cap_t * effective, 1286 kernel_cap_t * effective,
@@ -1317,6 +1372,7 @@ struct security_operations {
1317 int (*inode_getsecurity)(const struct inode *inode, const char *name, void **buffer, bool alloc); 1372 int (*inode_getsecurity)(const struct inode *inode, const char *name, void **buffer, bool alloc);
1318 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags); 1373 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags);
1319 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size); 1374 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size);
1375 void (*inode_getsecid)(const struct inode *inode, u32 *secid);
1320 1376
1321 int (*file_permission) (struct file * file, int mask); 1377 int (*file_permission) (struct file * file, int mask);
1322 int (*file_alloc_security) (struct file * file); 1378 int (*file_alloc_security) (struct file * file);
@@ -1369,6 +1425,7 @@ struct security_operations {
1369 void (*task_to_inode)(struct task_struct *p, struct inode *inode); 1425 void (*task_to_inode)(struct task_struct *p, struct inode *inode);
1370 1426
1371 int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag); 1427 int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag);
1428 void (*ipc_getsecid) (struct kern_ipc_perm *ipcp, u32 *secid);
1372 1429
1373 int (*msg_msg_alloc_security) (struct msg_msg * msg); 1430 int (*msg_msg_alloc_security) (struct msg_msg * msg);
1374 void (*msg_msg_free_security) (struct msg_msg * msg); 1431 void (*msg_msg_free_security) (struct msg_msg * msg);
@@ -1454,17 +1511,17 @@ struct security_operations {
1454#endif /* CONFIG_SECURITY_NETWORK */ 1511#endif /* CONFIG_SECURITY_NETWORK */
1455 1512
1456#ifdef CONFIG_SECURITY_NETWORK_XFRM 1513#ifdef CONFIG_SECURITY_NETWORK_XFRM
1457 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, 1514 int (*xfrm_policy_alloc_security) (struct xfrm_sec_ctx **ctxp,
1458 struct xfrm_user_sec_ctx *sec_ctx); 1515 struct xfrm_user_sec_ctx *sec_ctx);
1459 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); 1516 int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx);
1460 void (*xfrm_policy_free_security) (struct xfrm_policy *xp); 1517 void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx);
1461 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); 1518 int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx);
1462 int (*xfrm_state_alloc_security) (struct xfrm_state *x, 1519 int (*xfrm_state_alloc_security) (struct xfrm_state *x,
1463 struct xfrm_user_sec_ctx *sec_ctx, 1520 struct xfrm_user_sec_ctx *sec_ctx,
1464 u32 secid); 1521 u32 secid);
1465 void (*xfrm_state_free_security) (struct xfrm_state *x); 1522 void (*xfrm_state_free_security) (struct xfrm_state *x);
1466 int (*xfrm_state_delete_security) (struct xfrm_state *x); 1523 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1467 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir); 1524 int (*xfrm_policy_lookup)(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
1468 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, 1525 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
1469 struct xfrm_policy *xp, struct flowi *fl); 1526 struct xfrm_policy *xp, struct flowi *fl);
1470 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); 1527 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
@@ -1480,10 +1537,18 @@ struct security_operations {
1480 1537
1481#endif /* CONFIG_KEYS */ 1538#endif /* CONFIG_KEYS */
1482 1539
1540#ifdef CONFIG_AUDIT
1541 int (*audit_rule_init)(u32 field, u32 op, char *rulestr, void **lsmrule);
1542 int (*audit_rule_known)(struct audit_krule *krule);
1543 int (*audit_rule_match)(u32 secid, u32 field, u32 op, void *lsmrule,
1544 struct audit_context *actx);
1545 void (*audit_rule_free)(void *lsmrule);
1546#endif /* CONFIG_AUDIT */
1483}; 1547};
1484 1548
1485/* prototypes */ 1549/* prototypes */
1486extern int security_init (void); 1550extern int security_init (void);
1551extern int security_module_enable(struct security_operations *ops);
1487extern int register_security (struct security_operations *ops); 1552extern int register_security (struct security_operations *ops);
1488extern int mod_reg_security (const char *name, struct security_operations *ops); 1553extern int mod_reg_security (const char *name, struct security_operations *ops);
1489extern struct dentry *securityfs_create_file(const char *name, mode_t mode, 1554extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
@@ -1578,6 +1643,7 @@ int security_inode_killpriv(struct dentry *dentry);
1578int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc); 1643int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc);
1579int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags); 1644int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags);
1580int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size); 1645int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size);
1646void security_inode_getsecid(const struct inode *inode, u32 *secid);
1581int security_file_permission(struct file *file, int mask); 1647int security_file_permission(struct file *file, int mask);
1582int security_file_alloc(struct file *file); 1648int security_file_alloc(struct file *file);
1583void security_file_free(struct file *file); 1649void security_file_free(struct file *file);
@@ -1622,6 +1688,7 @@ int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
1622void security_task_reparent_to_init(struct task_struct *p); 1688void security_task_reparent_to_init(struct task_struct *p);
1623void security_task_to_inode(struct task_struct *p, struct inode *inode); 1689void security_task_to_inode(struct task_struct *p, struct inode *inode);
1624int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); 1690int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
1691void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid);
1625int security_msg_msg_alloc(struct msg_msg *msg); 1692int security_msg_msg_alloc(struct msg_msg *msg);
1626void security_msg_msg_free(struct msg_msg *msg); 1693void security_msg_msg_free(struct msg_msg *msg);
1627int security_msg_queue_alloc(struct msg_queue *msq); 1694int security_msg_queue_alloc(struct msg_queue *msq);
@@ -2022,6 +2089,11 @@ static inline int security_inode_listsecurity(struct inode *inode, char *buffer,
2022 return 0; 2089 return 0;
2023} 2090}
2024 2091
2092static inline void security_inode_getsecid(const struct inode *inode, u32 *secid)
2093{
2094 *secid = 0;
2095}
2096
2025static inline int security_file_permission (struct file *file, int mask) 2097static inline int security_file_permission (struct file *file, int mask)
2026{ 2098{
2027 return 0; 2099 return 0;
@@ -2137,7 +2209,9 @@ static inline int security_task_getsid (struct task_struct *p)
2137} 2209}
2138 2210
2139static inline void security_task_getsecid (struct task_struct *p, u32 *secid) 2211static inline void security_task_getsecid (struct task_struct *p, u32 *secid)
2140{ } 2212{
2213 *secid = 0;
2214}
2141 2215
2142static inline int security_task_setgroups (struct group_info *group_info) 2216static inline int security_task_setgroups (struct group_info *group_info)
2143{ 2217{
@@ -2216,6 +2290,11 @@ static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
2216 return 0; 2290 return 0;
2217} 2291}
2218 2292
2293static inline void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid)
2294{
2295 *secid = 0;
2296}
2297
2219static inline int security_msg_msg_alloc (struct msg_msg * msg) 2298static inline int security_msg_msg_alloc (struct msg_msg * msg)
2220{ 2299{
2221 return 0; 2300 return 0;
@@ -2562,16 +2641,16 @@ static inline void security_inet_conn_established(struct sock *sk,
2562 2641
2563#ifdef CONFIG_SECURITY_NETWORK_XFRM 2642#ifdef CONFIG_SECURITY_NETWORK_XFRM
2564 2643
2565int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); 2644int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx);
2566int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new); 2645int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp);
2567void security_xfrm_policy_free(struct xfrm_policy *xp); 2646void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx);
2568int security_xfrm_policy_delete(struct xfrm_policy *xp); 2647int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx);
2569int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); 2648int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
2570int security_xfrm_state_alloc_acquire(struct xfrm_state *x, 2649int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
2571 struct xfrm_sec_ctx *polsec, u32 secid); 2650 struct xfrm_sec_ctx *polsec, u32 secid);
2572int security_xfrm_state_delete(struct xfrm_state *x); 2651int security_xfrm_state_delete(struct xfrm_state *x);
2573void security_xfrm_state_free(struct xfrm_state *x); 2652void security_xfrm_state_free(struct xfrm_state *x);
2574int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir); 2653int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
2575int security_xfrm_state_pol_flow_match(struct xfrm_state *x, 2654int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
2576 struct xfrm_policy *xp, struct flowi *fl); 2655 struct xfrm_policy *xp, struct flowi *fl);
2577int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); 2656int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid);
@@ -2579,21 +2658,21 @@ void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl);
2579 2658
2580#else /* CONFIG_SECURITY_NETWORK_XFRM */ 2659#else /* CONFIG_SECURITY_NETWORK_XFRM */
2581 2660
2582static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) 2661static inline int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx)
2583{ 2662{
2584 return 0; 2663 return 0;
2585} 2664}
2586 2665
2587static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) 2666static inline int security_xfrm_policy_clone(struct xfrm_sec_ctx *old, struct xfrm_sec_ctx **new_ctxp)
2588{ 2667{
2589 return 0; 2668 return 0;
2590} 2669}
2591 2670
2592static inline void security_xfrm_policy_free(struct xfrm_policy *xp) 2671static inline void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx)
2593{ 2672{
2594} 2673}
2595 2674
2596static inline int security_xfrm_policy_delete(struct xfrm_policy *xp) 2675static inline int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
2597{ 2676{
2598 return 0; 2677 return 0;
2599} 2678}
@@ -2619,7 +2698,7 @@ static inline int security_xfrm_state_delete(struct xfrm_state *x)
2619 return 0; 2698 return 0;
2620} 2699}
2621 2700
2622static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir) 2701static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir)
2623{ 2702{
2624 return 0; 2703 return 0;
2625} 2704}
@@ -2672,5 +2751,38 @@ static inline int security_key_permission(key_ref_t key_ref,
2672#endif 2751#endif
2673#endif /* CONFIG_KEYS */ 2752#endif /* CONFIG_KEYS */
2674 2753
2754#ifdef CONFIG_AUDIT
2755#ifdef CONFIG_SECURITY
2756int security_audit_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule);
2757int security_audit_rule_known(struct audit_krule *krule);
2758int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule,
2759 struct audit_context *actx);
2760void security_audit_rule_free(void *lsmrule);
2761
2762#else
2763
2764static inline int security_audit_rule_init(u32 field, u32 op, char *rulestr,
2765 void **lsmrule)
2766{
2767 return 0;
2768}
2769
2770static inline int security_audit_rule_known(struct audit_krule *krule)
2771{
2772 return 0;
2773}
2774
2775static inline int security_audit_rule_match(u32 secid, u32 field, u32 op,
2776 void *lsmrule, struct audit_context *actx)
2777{
2778 return 0;
2779}
2780
2781static inline void security_audit_rule_free(void *lsmrule)
2782{ }
2783
2784#endif /* CONFIG_SECURITY */
2785#endif /* CONFIG_AUDIT */
2786
2675#endif /* ! __LINUX_SECURITY_H */ 2787#endif /* ! __LINUX_SECURITY_H */
2676 2788
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index 8c2cc4c02526..20f965d4b041 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -16,99 +16,11 @@
16 16
17struct selinux_audit_rule; 17struct selinux_audit_rule;
18struct audit_context; 18struct audit_context;
19struct inode;
20struct kern_ipc_perm; 19struct kern_ipc_perm;
21 20
22#ifdef CONFIG_SECURITY_SELINUX 21#ifdef CONFIG_SECURITY_SELINUX
23 22
24/** 23/**
25 * selinux_audit_rule_init - alloc/init an selinux audit rule structure.
26 * @field: the field this rule refers to
27 * @op: the operater the rule uses
28 * @rulestr: the text "target" of the rule
29 * @rule: pointer to the new rule structure returned via this
30 *
31 * Returns 0 if successful, -errno if not. On success, the rule structure
32 * will be allocated internally. The caller must free this structure with
33 * selinux_audit_rule_free() after use.
34 */
35int selinux_audit_rule_init(u32 field, u32 op, char *rulestr,
36 struct selinux_audit_rule **rule);
37
38/**
39 * selinux_audit_rule_free - free an selinux audit rule structure.
40 * @rule: pointer to the audit rule to be freed
41 *
42 * This will free all memory associated with the given rule.
43 * If @rule is NULL, no operation is performed.
44 */
45void selinux_audit_rule_free(struct selinux_audit_rule *rule);
46
47/**
48 * selinux_audit_rule_match - determine if a context ID matches a rule.
49 * @sid: the context ID to check
50 * @field: the field this rule refers to
51 * @op: the operater the rule uses
52 * @rule: pointer to the audit rule to check against
53 * @actx: the audit context (can be NULL) associated with the check
54 *
55 * Returns 1 if the context id matches the rule, 0 if it does not, and
56 * -errno on failure.
57 */
58int selinux_audit_rule_match(u32 sid, u32 field, u32 op,
59 struct selinux_audit_rule *rule,
60 struct audit_context *actx);
61
62/**
63 * selinux_audit_set_callback - set the callback for policy reloads.
64 * @callback: the function to call when the policy is reloaded
65 *
66 * This sets the function callback function that will update the rules
67 * upon policy reloads. This callback should rebuild all existing rules
68 * using selinux_audit_rule_init().
69 */
70void selinux_audit_set_callback(int (*callback)(void));
71
72/**
73 * selinux_sid_to_string - map a security context ID to a string
74 * @sid: security context ID to be converted.
75 * @ctx: address of context string to be returned
76 * @ctxlen: length of returned context string.
77 *
78 * Returns 0 if successful, -errno if not. On success, the context
79 * string will be allocated internally, and the caller must call
80 * kfree() on it after use.
81 */
82int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen);
83
84/**
85 * selinux_get_inode_sid - get the inode's security context ID
86 * @inode: inode structure to get the sid from.
87 * @sid: pointer to security context ID to be filled in.
88 *
89 * Returns nothing
90 */
91void selinux_get_inode_sid(const struct inode *inode, u32 *sid);
92
93/**
94 * selinux_get_ipc_sid - get the ipc security context ID
95 * @ipcp: ipc structure to get the sid from.
96 * @sid: pointer to security context ID to be filled in.
97 *
98 * Returns nothing
99 */
100void selinux_get_ipc_sid(const struct kern_ipc_perm *ipcp, u32 *sid);
101
102/**
103 * selinux_get_task_sid - return the SID of task
104 * @tsk: the task whose SID will be returned
105 * @sid: pointer to security context ID to be filled in.
106 *
107 * Returns nothing
108 */
109void selinux_get_task_sid(struct task_struct *tsk, u32 *sid);
110
111/**
112 * selinux_string_to_sid - map a security context string to a security ID 24 * selinux_string_to_sid - map a security context string to a security ID
113 * @str: the security context string to be mapped 25 * @str: the security context string to be mapped
114 * @sid: ID value returned via this. 26 * @sid: ID value returned via this.
@@ -151,52 +63,6 @@ void selinux_secmark_refcount_inc(void);
151void selinux_secmark_refcount_dec(void); 63void selinux_secmark_refcount_dec(void);
152#else 64#else
153 65
154static inline int selinux_audit_rule_init(u32 field, u32 op,
155 char *rulestr,
156 struct selinux_audit_rule **rule)
157{
158 return -EOPNOTSUPP;
159}
160
161static inline void selinux_audit_rule_free(struct selinux_audit_rule *rule)
162{
163 return;
164}
165
166static inline int selinux_audit_rule_match(u32 sid, u32 field, u32 op,
167 struct selinux_audit_rule *rule,
168 struct audit_context *actx)
169{
170 return 0;
171}
172
173static inline void selinux_audit_set_callback(int (*callback)(void))
174{
175 return;
176}
177
178static inline int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen)
179{
180 *ctx = NULL;
181 *ctxlen = 0;
182 return 0;
183}
184
185static inline void selinux_get_inode_sid(const struct inode *inode, u32 *sid)
186{
187 *sid = 0;
188}
189
190static inline void selinux_get_ipc_sid(const struct kern_ipc_perm *ipcp, u32 *sid)
191{
192 *sid = 0;
193}
194
195static inline void selinux_get_task_sid(struct task_struct *tsk, u32 *sid)
196{
197 *sid = 0;
198}
199
200static inline int selinux_string_to_sid(const char *str, u32 *sid) 66static inline int selinux_string_to_sid(const char *str, u32 *sid)
201{ 67{
202 *sid = 0; 68 *sid = 0;
diff --git a/include/linux/semaphore.h b/include/linux/semaphore.h
new file mode 100644
index 000000000000..9cae64b00d6b
--- /dev/null
+++ b/include/linux/semaphore.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (c) 2008 Intel Corporation
3 * Author: Matthew Wilcox <willy@linux.intel.com>
4 *
5 * Distributed under the terms of the GNU GPL, version 2
6 *
7 * Please see kernel/semaphore.c for documentation of these functions
8 */
9#ifndef __LINUX_SEMAPHORE_H
10#define __LINUX_SEMAPHORE_H
11
12#include <linux/list.h>
13#include <linux/spinlock.h>
14
15/* Please don't access any members of this structure directly */
16struct semaphore {
17 spinlock_t lock;
18 unsigned int count;
19 struct list_head wait_list;
20};
21
22#define __SEMAPHORE_INITIALIZER(name, n) \
23{ \
24 .lock = __SPIN_LOCK_UNLOCKED((name).lock), \
25 .count = n, \
26 .wait_list = LIST_HEAD_INIT((name).wait_list), \
27}
28
29#define __DECLARE_SEMAPHORE_GENERIC(name, count) \
30 struct semaphore name = __SEMAPHORE_INITIALIZER(name, count)
31
32#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1)
33
34static inline void sema_init(struct semaphore *sem, int val)
35{
36 static struct lock_class_key __key;
37 *sem = (struct semaphore) __SEMAPHORE_INITIALIZER(*sem, val);
38 lockdep_init_map(&sem->lock.dep_map, "semaphore->lock", &__key, 0);
39}
40
41#define init_MUTEX(sem) sema_init(sem, 1)
42#define init_MUTEX_LOCKED(sem) sema_init(sem, 0)
43
44extern void down(struct semaphore *sem);
45extern int __must_check down_interruptible(struct semaphore *sem);
46extern int __must_check down_killable(struct semaphore *sem);
47extern int __must_check down_trylock(struct semaphore *sem);
48extern int __must_check down_timeout(struct semaphore *sem, long jiffies);
49extern void up(struct semaphore *sem);
50
51#endif /* __LINUX_SEMAPHORE_H */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 67c2563961f3..1da1e6208a0a 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -62,18 +62,5 @@ extern struct list_head *seq_list_start_head(struct list_head *head,
62extern struct list_head *seq_list_next(void *v, struct list_head *head, 62extern struct list_head *seq_list_next(void *v, struct list_head *head,
63 loff_t *ppos); 63 loff_t *ppos);
64 64
65struct net;
66struct seq_net_private {
67 struct net *net;
68};
69
70int seq_open_net(struct inode *, struct file *,
71 const struct seq_operations *, int);
72int seq_release_net(struct inode *, struct file *);
73static inline struct net *seq_file_net(struct seq_file *seq)
74{
75 return ((struct seq_net_private *)seq->private)->net;
76}
77
78#endif 65#endif
79#endif 66#endif
diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h
new file mode 100644
index 000000000000..4ac52542a563
--- /dev/null
+++ b/include/linux/seq_file_net.h
@@ -0,0 +1,27 @@
1#ifndef __SEQ_FILE_NET_H__
2#define __SEQ_FILE_NET_H__
3
4#include <linux/seq_file.h>
5
6struct net;
7extern struct net init_net;
8
9struct seq_net_private {
10#ifdef CONFIG_NET_NS
11 struct net *net;
12#endif
13};
14
15int seq_open_net(struct inode *, struct file *,
16 const struct seq_operations *, int);
17int seq_release_net(struct inode *, struct file *);
18static inline struct net *seq_file_net(struct seq_file *seq)
19{
20#ifdef CONFIG_NET_NS
21 return ((struct seq_net_private *)seq->private)->net;
22#else
23 return &init_net;
24#endif
25}
26
27#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 289942fc6655..7cb094a82456 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -213,6 +213,10 @@ struct uart_ops {
213 void (*config_port)(struct uart_port *, int); 213 void (*config_port)(struct uart_port *, int);
214 int (*verify_port)(struct uart_port *, struct serial_struct *); 214 int (*verify_port)(struct uart_port *, struct serial_struct *);
215 int (*ioctl)(struct uart_port *, unsigned int, unsigned long); 215 int (*ioctl)(struct uart_port *, unsigned int, unsigned long);
216#ifdef CONFIG_CONSOLE_POLL
217 void (*poll_put_char)(struct uart_port *, unsigned char);
218 int (*poll_get_char)(struct uart_port *);
219#endif
216}; 220};
217 221
218#define UART_CONFIG_TYPE (1 << 0) 222#define UART_CONFIG_TYPE (1 << 0)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bbd8d0027e2f..11fd9f2c4093 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -256,7 +256,10 @@ struct sk_buff {
256 ktime_t tstamp; 256 ktime_t tstamp;
257 struct net_device *dev; 257 struct net_device *dev;
258 258
259 struct dst_entry *dst; 259 union {
260 struct dst_entry *dst;
261 struct rtable *rtable;
262 };
260 struct sec_path *sp; 263 struct sec_path *sp;
261 264
262 /* 265 /*
@@ -310,7 +313,10 @@ struct sk_buff {
310 __u16 tc_verd; /* traffic control verdict */ 313 __u16 tc_verd; /* traffic control verdict */
311#endif 314#endif
312#endif 315#endif
313 /* 2 byte hole */ 316#ifdef CONFIG_IPV6_NDISC_NODETYPE
317 __u8 ndisc_nodetype:2;
318#endif
319 /* 14 bit hole */
314 320
315#ifdef CONFIG_NET_DMA 321#ifdef CONFIG_NET_DMA
316 dma_cookie_t dma_cookie; 322 dma_cookie_t dma_cookie;
@@ -657,11 +663,21 @@ static inline void skb_queue_head_init_class(struct sk_buff_head *list,
657} 663}
658 664
659/* 665/*
660 * Insert an sk_buff at the start of a list. 666 * Insert an sk_buff on a list.
661 * 667 *
662 * The "__skb_xxxx()" functions are the non-atomic ones that 668 * The "__skb_xxxx()" functions are the non-atomic ones that
663 * can only be called with interrupts disabled. 669 * can only be called with interrupts disabled.
664 */ 670 */
671extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
672static inline void __skb_insert(struct sk_buff *newsk,
673 struct sk_buff *prev, struct sk_buff *next,
674 struct sk_buff_head *list)
675{
676 newsk->next = next;
677 newsk->prev = prev;
678 next->prev = prev->next = newsk;
679 list->qlen++;
680}
665 681
666/** 682/**
667 * __skb_queue_after - queue a buffer at the list head 683 * __skb_queue_after - queue a buffer at the list head
@@ -678,13 +694,17 @@ static inline void __skb_queue_after(struct sk_buff_head *list,
678 struct sk_buff *prev, 694 struct sk_buff *prev,
679 struct sk_buff *newsk) 695 struct sk_buff *newsk)
680{ 696{
681 struct sk_buff *next; 697 __skb_insert(newsk, prev, prev->next, list);
682 list->qlen++; 698}
683 699
684 next = prev->next; 700extern void skb_append(struct sk_buff *old, struct sk_buff *newsk,
685 newsk->next = next; 701 struct sk_buff_head *list);
686 newsk->prev = prev; 702
687 next->prev = prev->next = newsk; 703static inline void __skb_queue_before(struct sk_buff_head *list,
704 struct sk_buff *next,
705 struct sk_buff *newsk)
706{
707 __skb_insert(newsk, next->prev, next, list);
688} 708}
689 709
690/** 710/**
@@ -718,66 +738,7 @@ extern void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk);
718static inline void __skb_queue_tail(struct sk_buff_head *list, 738static inline void __skb_queue_tail(struct sk_buff_head *list,
719 struct sk_buff *newsk) 739 struct sk_buff *newsk)
720{ 740{
721 struct sk_buff *prev, *next; 741 __skb_queue_before(list, (struct sk_buff *)list, newsk);
722
723 list->qlen++;
724 next = (struct sk_buff *)list;
725 prev = next->prev;
726 newsk->next = next;
727 newsk->prev = prev;
728 next->prev = prev->next = newsk;
729}
730
731
732/**
733 * __skb_dequeue - remove from the head of the queue
734 * @list: list to dequeue from
735 *
736 * Remove the head of the list. This function does not take any locks
737 * so must be used with appropriate locks held only. The head item is
738 * returned or %NULL if the list is empty.
739 */
740extern struct sk_buff *skb_dequeue(struct sk_buff_head *list);
741static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
742{
743 struct sk_buff *next, *prev, *result;
744
745 prev = (struct sk_buff *) list;
746 next = prev->next;
747 result = NULL;
748 if (next != prev) {
749 result = next;
750 next = next->next;
751 list->qlen--;
752 next->prev = prev;
753 prev->next = next;
754 result->next = result->prev = NULL;
755 }
756 return result;
757}
758
759
760/*
761 * Insert a packet on a list.
762 */
763extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
764static inline void __skb_insert(struct sk_buff *newsk,
765 struct sk_buff *prev, struct sk_buff *next,
766 struct sk_buff_head *list)
767{
768 newsk->next = next;
769 newsk->prev = prev;
770 next->prev = prev->next = newsk;
771 list->qlen++;
772}
773
774/*
775 * Place a packet after a given packet in a list.
776 */
777extern void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
778static inline void __skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
779{
780 __skb_insert(newsk, old, old->next, list);
781} 742}
782 743
783/* 744/*
@@ -797,8 +758,22 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
797 prev->next = next; 758 prev->next = next;
798} 759}
799 760
800 761/**
801/* XXX: more streamlined implementation */ 762 * __skb_dequeue - remove from the head of the queue
763 * @list: list to dequeue from
764 *
765 * Remove the head of the list. This function does not take any locks
766 * so must be used with appropriate locks held only. The head item is
767 * returned or %NULL if the list is empty.
768 */
769extern struct sk_buff *skb_dequeue(struct sk_buff_head *list);
770static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
771{
772 struct sk_buff *skb = skb_peek(list);
773 if (skb)
774 __skb_unlink(skb, list);
775 return skb;
776}
802 777
803/** 778/**
804 * __skb_dequeue_tail - remove from the tail of the queue 779 * __skb_dequeue_tail - remove from the tail of the queue
@@ -889,6 +864,7 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
889/* 864/*
890 * Add data to an sk_buff 865 * Add data to an sk_buff
891 */ 866 */
867extern unsigned char *skb_put(struct sk_buff *skb, unsigned int len);
892static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) 868static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
893{ 869{
894 unsigned char *tmp = skb_tail_pointer(skb); 870 unsigned char *tmp = skb_tail_pointer(skb);
@@ -898,26 +874,7 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
898 return tmp; 874 return tmp;
899} 875}
900 876
901/** 877extern unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
902 * skb_put - add data to a buffer
903 * @skb: buffer to use
904 * @len: amount of data to add
905 *
906 * This function extends the used data area of the buffer. If this would
907 * exceed the total buffer size the kernel will panic. A pointer to the
908 * first byte of the extra data is returned.
909 */
910static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
911{
912 unsigned char *tmp = skb_tail_pointer(skb);
913 SKB_LINEAR_ASSERT(skb);
914 skb->tail += len;
915 skb->len += len;
916 if (unlikely(skb->tail > skb->end))
917 skb_over_panic(skb, len, current_text_addr());
918 return tmp;
919}
920
921static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) 878static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
922{ 879{
923 skb->data -= len; 880 skb->data -= len;
@@ -925,24 +882,7 @@ static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
925 return skb->data; 882 return skb->data;
926} 883}
927 884
928/** 885extern unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);
929 * skb_push - add data to the start of a buffer
930 * @skb: buffer to use
931 * @len: amount of data to add
932 *
933 * This function extends the used data area of the buffer at the buffer
934 * start. If this would exceed the total buffer headroom the kernel will
935 * panic. A pointer to the first byte of the extra data is returned.
936 */
937static inline unsigned char *skb_push(struct sk_buff *skb, unsigned int len)
938{
939 skb->data -= len;
940 skb->len += len;
941 if (unlikely(skb->data<skb->head))
942 skb_under_panic(skb, len, current_text_addr());
943 return skb->data;
944}
945
946static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) 886static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
947{ 887{
948 skb->len -= len; 888 skb->len -= len;
@@ -950,21 +890,6 @@ static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
950 return skb->data += len; 890 return skb->data += len;
951} 891}
952 892
953/**
954 * skb_pull - remove data from the start of a buffer
955 * @skb: buffer to use
956 * @len: amount of data to remove
957 *
958 * This function removes data from the start of a buffer, returning
959 * the memory to the headroom. A pointer to the next data in the buffer
960 * is returned. Once the data has been pulled future pushes will overwrite
961 * the old data.
962 */
963static inline unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
964{
965 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
966}
967
968extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); 893extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
969 894
970static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) 895static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
@@ -1205,21 +1130,7 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
1205 skb_set_tail_pointer(skb, len); 1130 skb_set_tail_pointer(skb, len);
1206} 1131}
1207 1132
1208/** 1133extern void skb_trim(struct sk_buff *skb, unsigned int len);
1209 * skb_trim - remove end from a buffer
1210 * @skb: buffer to alter
1211 * @len: new length
1212 *
1213 * Cut the length of a buffer down by removing data from the tail. If
1214 * the buffer is already under the length specified it is not modified.
1215 * The skb must be linear.
1216 */
1217static inline void skb_trim(struct sk_buff *skb, unsigned int len)
1218{
1219 if (skb->len > len)
1220 __skb_trim(skb, len);
1221}
1222
1223 1134
1224static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) 1135static inline int __pskb_trim(struct sk_buff *skb, unsigned int len)
1225{ 1136{
@@ -1302,22 +1213,7 @@ static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1302 return skb; 1213 return skb;
1303} 1214}
1304 1215
1305/** 1216extern struct sk_buff *dev_alloc_skb(unsigned int length);
1306 * dev_alloc_skb - allocate an skbuff for receiving
1307 * @length: length to allocate
1308 *
1309 * Allocate a new &sk_buff and assign it a usage count of one. The
1310 * buffer has unspecified headroom built in. Users should allocate
1311 * the headroom they think they need without accounting for the
1312 * built in space. The built in space is used for optimisations.
1313 *
1314 * %NULL is returned if there is no free memory. Although this function
1315 * allocates memory it can be called from an interrupt.
1316 */
1317static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1318{
1319 return __dev_alloc_skb(length, GFP_ATOMIC);
1320}
1321 1217
1322extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, 1218extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1323 unsigned int length, gfp_t gfp_mask); 1219 unsigned int length, gfp_t gfp_mask);
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index b00c1c73eb0a..79d59c937fac 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -45,9 +45,9 @@ struct kmem_cache_cpu {
45struct kmem_cache_node { 45struct kmem_cache_node {
46 spinlock_t list_lock; /* Protect partial list and nr_partial */ 46 spinlock_t list_lock; /* Protect partial list and nr_partial */
47 unsigned long nr_partial; 47 unsigned long nr_partial;
48 atomic_long_t nr_slabs;
49 struct list_head partial; 48 struct list_head partial;
50#ifdef CONFIG_SLUB_DEBUG 49#ifdef CONFIG_SLUB_DEBUG
50 atomic_long_t nr_slabs;
51 struct list_head full; 51 struct list_head full;
52#endif 52#endif
53}; 53};
diff --git a/include/linux/smc91x.h b/include/linux/smc91x.h
new file mode 100644
index 000000000000..8e0556b8781c
--- /dev/null
+++ b/include/linux/smc91x.h
@@ -0,0 +1,13 @@
1#ifndef __SMC91X_H__
2#define __SMC91X_H__
3
4#define SMC91X_USE_8BIT (1 << 0)
5#define SMC91X_USE_16BIT (1 << 1)
6#define SMC91X_USE_32BIT (1 << 2)
7
8struct smc91x_platdata {
9 unsigned long flags;
10 unsigned long irq_flags; /* IRQF_... */
11};
12
13#endif /* __SMC91X_H__ */
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 1129ee0a7180..d311a090fae7 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -296,43 +296,6 @@ do { \
296}) 296})
297 297
298/* 298/*
299 * Locks two spinlocks l1 and l2.
300 * l1_first indicates if spinlock l1 should be taken first.
301 */
302static inline void double_spin_lock(spinlock_t *l1, spinlock_t *l2,
303 bool l1_first)
304 __acquires(l1)
305 __acquires(l2)
306{
307 if (l1_first) {
308 spin_lock(l1);
309 spin_lock(l2);
310 } else {
311 spin_lock(l2);
312 spin_lock(l1);
313 }
314}
315
316/*
317 * Unlocks two spinlocks l1 and l2.
318 * l1_taken_first indicates if spinlock l1 was taken first and therefore
319 * should be released after spinlock l2.
320 */
321static inline void double_spin_unlock(spinlock_t *l1, spinlock_t *l2,
322 bool l1_taken_first)
323 __releases(l1)
324 __releases(l2)
325{
326 if (l1_taken_first) {
327 spin_unlock(l2);
328 spin_unlock(l1);
329 } else {
330 spin_unlock(l1);
331 spin_unlock(l2);
332 }
333}
334
335/*
336 * Pull the atomic_t declaration: 299 * Pull the atomic_t declaration:
337 * (asm-mips/atomic.h needs above definitions) 300 * (asm-mips/atomic.h needs above definitions)
338 */ 301 */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 20add65215af..50dfd0dc4093 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -72,10 +72,18 @@ struct ssb_device;
72/* Lowlevel read/write operations on the device MMIO. 72/* Lowlevel read/write operations on the device MMIO.
73 * Internal, don't use that outside of ssb. */ 73 * Internal, don't use that outside of ssb. */
74struct ssb_bus_ops { 74struct ssb_bus_ops {
75 u8 (*read8)(struct ssb_device *dev, u16 offset);
75 u16 (*read16)(struct ssb_device *dev, u16 offset); 76 u16 (*read16)(struct ssb_device *dev, u16 offset);
76 u32 (*read32)(struct ssb_device *dev, u16 offset); 77 u32 (*read32)(struct ssb_device *dev, u16 offset);
78 void (*write8)(struct ssb_device *dev, u16 offset, u8 value);
77 void (*write16)(struct ssb_device *dev, u16 offset, u16 value); 79 void (*write16)(struct ssb_device *dev, u16 offset, u16 value);
78 void (*write32)(struct ssb_device *dev, u16 offset, u32 value); 80 void (*write32)(struct ssb_device *dev, u16 offset, u32 value);
81#ifdef CONFIG_SSB_BLOCKIO
82 void (*block_read)(struct ssb_device *dev, void *buffer,
83 size_t count, u16 offset, u8 reg_width);
84 void (*block_write)(struct ssb_device *dev, const void *buffer,
85 size_t count, u16 offset, u8 reg_width);
86#endif
79}; 87};
80 88
81 89
@@ -129,6 +137,10 @@ struct ssb_device {
129 const struct ssb_bus_ops *ops; 137 const struct ssb_bus_ops *ops;
130 138
131 struct device *dev; 139 struct device *dev;
140 /* Pointer to the device that has to be used for
141 * any DMA related operation. */
142 struct device *dma_dev;
143
132 struct ssb_bus *bus; 144 struct ssb_bus *bus;
133 struct ssb_device_id id; 145 struct ssb_device_id id;
134 146
@@ -243,9 +255,9 @@ struct ssb_bus {
243 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ 255 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */
244 struct pcmcia_device *host_pcmcia; 256 struct pcmcia_device *host_pcmcia;
245 257
246#ifdef CONFIG_SSB_PCIHOST 258#ifdef CONFIG_SSB_SPROM
247 /* Mutex to protect the SPROM writing. */ 259 /* Mutex to protect the SPROM writing. */
248 struct mutex pci_sprom_mutex; 260 struct mutex sprom_mutex;
249#endif 261#endif
250 262
251 /* ID information about the Chip. */ 263 /* ID information about the Chip. */
@@ -258,9 +270,6 @@ struct ssb_bus {
258 struct ssb_device devices[SSB_MAX_NR_CORES]; 270 struct ssb_device devices[SSB_MAX_NR_CORES];
259 u8 nr_devices; 271 u8 nr_devices;
260 272
261 /* Reference count. Number of suspended devices. */
262 u8 suspend_cnt;
263
264 /* Software ID number for this bus. */ 273 /* Software ID number for this bus. */
265 unsigned int busnumber; 274 unsigned int busnumber;
266 275
@@ -332,6 +341,13 @@ extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
332 341
333extern void ssb_bus_unregister(struct ssb_bus *bus); 342extern void ssb_bus_unregister(struct ssb_bus *bus);
334 343
344/* Suspend a SSB bus.
345 * Call this from the parent bus suspend routine. */
346extern int ssb_bus_suspend(struct ssb_bus *bus);
347/* Resume a SSB bus.
348 * Call this from the parent bus resume routine. */
349extern int ssb_bus_resume(struct ssb_bus *bus);
350
335extern u32 ssb_clockspeed(struct ssb_bus *bus); 351extern u32 ssb_clockspeed(struct ssb_bus *bus);
336 352
337/* Is the device enabled in hardware? */ 353/* Is the device enabled in hardware? */
@@ -344,6 +360,10 @@ void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags);
344 360
345 361
346/* Device MMIO register read/write functions. */ 362/* Device MMIO register read/write functions. */
363static inline u8 ssb_read8(struct ssb_device *dev, u16 offset)
364{
365 return dev->ops->read8(dev, offset);
366}
347static inline u16 ssb_read16(struct ssb_device *dev, u16 offset) 367static inline u16 ssb_read16(struct ssb_device *dev, u16 offset)
348{ 368{
349 return dev->ops->read16(dev, offset); 369 return dev->ops->read16(dev, offset);
@@ -352,6 +372,10 @@ static inline u32 ssb_read32(struct ssb_device *dev, u16 offset)
352{ 372{
353 return dev->ops->read32(dev, offset); 373 return dev->ops->read32(dev, offset);
354} 374}
375static inline void ssb_write8(struct ssb_device *dev, u16 offset, u8 value)
376{
377 dev->ops->write8(dev, offset, value);
378}
355static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value) 379static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value)
356{ 380{
357 dev->ops->write16(dev, offset, value); 381 dev->ops->write16(dev, offset, value);
@@ -360,6 +384,19 @@ static inline void ssb_write32(struct ssb_device *dev, u16 offset, u32 value)
360{ 384{
361 dev->ops->write32(dev, offset, value); 385 dev->ops->write32(dev, offset, value);
362} 386}
387#ifdef CONFIG_SSB_BLOCKIO
388static inline void ssb_block_read(struct ssb_device *dev, void *buffer,
389 size_t count, u16 offset, u8 reg_width)
390{
391 dev->ops->block_read(dev, buffer, count, offset, reg_width);
392}
393
394static inline void ssb_block_write(struct ssb_device *dev, const void *buffer,
395 size_t count, u16 offset, u8 reg_width)
396{
397 dev->ops->block_write(dev, buffer, count, offset, reg_width);
398}
399#endif /* CONFIG_SSB_BLOCKIO */
363 400
364 401
365/* Translation (routing) bits that need to be ORed to DMA 402/* Translation (routing) bits that need to be ORed to DMA
@@ -412,5 +449,12 @@ extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl);
412extern u32 ssb_admatch_base(u32 adm); 449extern u32 ssb_admatch_base(u32 adm);
413extern u32 ssb_admatch_size(u32 adm); 450extern u32 ssb_admatch_size(u32 adm);
414 451
452/* PCI device mapping and fixup routines.
453 * Called from the architecture pcibios init code.
454 * These are only available on SSB_EMBEDDED configurations. */
455#ifdef CONFIG_SSB_EMBEDDED
456int ssb_pcibios_plat_dev_init(struct pci_dev *dev);
457int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
458#endif /* CONFIG_SSB_EMBEDDED */
415 459
416#endif /* LINUX_SSB_H_ */ 460#endif /* LINUX_SSB_H_ */
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index 536851b946f6..7d7e03dcf77c 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -367,8 +367,7 @@ static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
367 367
368extern void ssb_chipcommon_init(struct ssb_chipcommon *cc); 368extern void ssb_chipcommon_init(struct ssb_chipcommon *cc);
369 369
370#include <linux/pm.h> 370extern void ssb_chipco_suspend(struct ssb_chipcommon *cc);
371extern void ssb_chipco_suspend(struct ssb_chipcommon *cc, pm_message_t state);
372extern void ssb_chipco_resume(struct ssb_chipcommon *cc); 371extern void ssb_chipco_resume(struct ssb_chipcommon *cc);
373 372
374extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc, 373extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc,
@@ -390,6 +389,10 @@ extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
390extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, 389extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc,
391 u32 ticks); 390 u32 ticks);
392 391
392void ssb_chipco_irq_mask(struct ssb_chipcommon *cc, u32 mask, u32 value);
393
394u32 ssb_chipco_irq_status(struct ssb_chipcommon *cc, u32 mask);
395
393/* Chipcommon GPIO pin access. */ 396/* Chipcommon GPIO pin access. */
394u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask); 397u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask);
395u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value); 398u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
new file mode 100644
index 000000000000..01fbdf5fef22
--- /dev/null
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -0,0 +1,174 @@
1#ifndef LINUX_SSB_DRIVER_GIGE_H_
2#define LINUX_SSB_DRIVER_GIGE_H_
3
4#include <linux/ssb/ssb.h>
5#include <linux/pci.h>
6#include <linux/spinlock.h>
7
8
9#ifdef CONFIG_SSB_DRIVER_GIGE
10
11
12#define SSB_GIGE_PCIIO 0x0000 /* PCI I/O Registers (1024 bytes) */
13#define SSB_GIGE_RESERVED 0x0400 /* Reserved (1024 bytes) */
14#define SSB_GIGE_PCICFG 0x0800 /* PCI config space (256 bytes) */
15#define SSB_GIGE_SHIM_FLUSHSTAT 0x0C00 /* PCI to OCP: Flush status control (32bit) */
16#define SSB_GIGE_SHIM_FLUSHRDA 0x0C04 /* PCI to OCP: Flush read address (32bit) */
17#define SSB_GIGE_SHIM_FLUSHTO 0x0C08 /* PCI to OCP: Flush timeout counter (32bit) */
18#define SSB_GIGE_SHIM_BARRIER 0x0C0C /* PCI to OCP: Barrier register (32bit) */
19#define SSB_GIGE_SHIM_MAOCPSI 0x0C10 /* PCI to OCP: MaocpSI Control (32bit) */
20#define SSB_GIGE_SHIM_SIOCPMA 0x0C14 /* PCI to OCP: SiocpMa Control (32bit) */
21
22/* TM Status High flags */
23#define SSB_GIGE_TMSHIGH_RGMII 0x00010000 /* Have an RGMII PHY-bus */
24/* TM Status Low flags */
25#define SSB_GIGE_TMSLOW_TXBYPASS 0x00080000 /* TX bypass (no delay) */
26#define SSB_GIGE_TMSLOW_RXBYPASS 0x00100000 /* RX bypass (no delay) */
27#define SSB_GIGE_TMSLOW_DLLEN 0x01000000 /* Enable DLL controls */
28
29/* Boardflags (low) */
30#define SSB_GIGE_BFL_ROBOSWITCH 0x0010
31
32
33#define SSB_GIGE_MEM_RES_NAME "SSB Broadcom 47xx GigE memory"
34#define SSB_GIGE_IO_RES_NAME "SSB Broadcom 47xx GigE I/O"
35
36struct ssb_gige {
37 struct ssb_device *dev;
38
39 spinlock_t lock;
40
41 /* True, if the device has an RGMII bus.
42 * False, if the device has a GMII bus. */
43 bool has_rgmii;
44
45 /* The PCI controller device. */
46 struct pci_controller pci_controller;
47 struct pci_ops pci_ops;
48 struct resource mem_resource;
49 struct resource io_resource;
50};
51
52/* Check whether a PCI device is a SSB Gigabit Ethernet core. */
53extern bool pdev_is_ssb_gige_core(struct pci_dev *pdev);
54
55/* Convert a pci_dev pointer to a ssb_gige pointer. */
56static inline struct ssb_gige * pdev_to_ssb_gige(struct pci_dev *pdev)
57{
58 if (!pdev_is_ssb_gige_core(pdev))
59 return NULL;
60 return container_of(pdev->bus->ops, struct ssb_gige, pci_ops);
61}
62
63/* Returns whether the PHY is connected by an RGMII bus. */
64static inline bool ssb_gige_is_rgmii(struct pci_dev *pdev)
65{
66 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
67 return (dev ? dev->has_rgmii : 0);
68}
69
70/* Returns whether we have a Roboswitch. */
71static inline bool ssb_gige_have_roboswitch(struct pci_dev *pdev)
72{
73 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
74 if (dev)
75 return !!(dev->dev->bus->sprom.boardflags_lo &
76 SSB_GIGE_BFL_ROBOSWITCH);
77 return 0;
78}
79
80/* Returns whether we can only do one DMA at once. */
81static inline bool ssb_gige_one_dma_at_once(struct pci_dev *pdev)
82{
83 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
84 if (dev)
85 return ((dev->dev->bus->chip_id == 0x4785) &&
86 (dev->dev->bus->chip_rev < 2));
87 return 0;
88}
89
90/* Returns whether we must flush posted writes. */
91static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
92{
93 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
94 if (dev)
95 return (dev->dev->bus->chip_id == 0x4785);
96 return 0;
97}
98
99extern char * nvram_get(const char *name);
100/* Get the device MAC address */
101static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
102{
103#ifdef CONFIG_BCM947XX
104 char *res = nvram_get("et0macaddr");
105 if (res)
106 memcpy(macaddr, res, 6);
107#endif
108}
109
110extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
111 struct pci_dev *pdev);
112extern int ssb_gige_map_irq(struct ssb_device *sdev,
113 const struct pci_dev *pdev);
114
115/* The GigE driver is not a standalone module, because we don't have support
116 * for unregistering the driver. So we could not unload the module anyway. */
117extern int ssb_gige_init(void);
118static inline void ssb_gige_exit(void)
119{
120 /* Currently we can not unregister the GigE driver,
121 * because we can not unregister the PCI bridge. */
122 BUG();
123}
124
125
126#else /* CONFIG_SSB_DRIVER_GIGE */
127/* Gigabit Ethernet driver disabled */
128
129
130static inline int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
131 struct pci_dev *pdev)
132{
133 return -ENOSYS;
134}
135static inline int ssb_gige_map_irq(struct ssb_device *sdev,
136 const struct pci_dev *pdev)
137{
138 return -ENOSYS;
139}
140static inline int ssb_gige_init(void)
141{
142 return 0;
143}
144static inline void ssb_gige_exit(void)
145{
146}
147
148static inline bool pdev_is_ssb_gige_core(struct pci_dev *pdev)
149{
150 return 0;
151}
152static inline struct ssb_gige * pdev_to_ssb_gige(struct pci_dev *pdev)
153{
154 return NULL;
155}
156static inline bool ssb_gige_is_rgmii(struct pci_dev *pdev)
157{
158 return 0;
159}
160static inline bool ssb_gige_have_roboswitch(struct pci_dev *pdev)
161{
162 return 0;
163}
164static inline bool ssb_gige_one_dma_at_once(struct pci_dev *pdev)
165{
166 return 0;
167}
168static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
169{
170 return 0;
171}
172
173#endif /* CONFIG_SSB_DRIVER_GIGE */
174#endif /* LINUX_SSB_DRIVER_GIGE_H_ */
diff --git a/include/linux/ssb/ssb_driver_pci.h b/include/linux/ssb/ssb_driver_pci.h
index 5e25bac4ed31..41e330e51c2a 100644
--- a/include/linux/ssb/ssb_driver_pci.h
+++ b/include/linux/ssb/ssb_driver_pci.h
@@ -1,6 +1,11 @@
1#ifndef LINUX_SSB_PCICORE_H_ 1#ifndef LINUX_SSB_PCICORE_H_
2#define LINUX_SSB_PCICORE_H_ 2#define LINUX_SSB_PCICORE_H_
3 3
4#include <linux/types.h>
5
6struct pci_dev;
7
8
4#ifdef CONFIG_SSB_DRIVER_PCICORE 9#ifdef CONFIG_SSB_DRIVER_PCICORE
5 10
6/* PCI core registers. */ 11/* PCI core registers. */
@@ -88,6 +93,9 @@ extern void ssb_pcicore_init(struct ssb_pcicore *pc);
88extern int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc, 93extern int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
89 struct ssb_device *dev); 94 struct ssb_device *dev);
90 95
96int ssb_pcicore_plat_dev_init(struct pci_dev *d);
97int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
98
91 99
92#else /* CONFIG_SSB_DRIVER_PCICORE */ 100#else /* CONFIG_SSB_DRIVER_PCICORE */
93 101
@@ -107,5 +115,16 @@ int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
107 return 0; 115 return 0;
108} 116}
109 117
118static inline
119int ssb_pcicore_plat_dev_init(struct pci_dev *d)
120{
121 return -ENODEV;
122}
123static inline
124int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
125{
126 return -ENODEV;
127}
128
110#endif /* CONFIG_SSB_DRIVER_PCICORE */ 129#endif /* CONFIG_SSB_DRIVER_PCICORE */
111#endif /* LINUX_SSB_PCICORE_H_ */ 130#endif /* LINUX_SSB_PCICORE_H_ */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 08027f1d7f31..d96d9b122304 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -239,6 +239,11 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
239 return (struct tcp_request_sock *)req; 239 return (struct tcp_request_sock *)req;
240} 240}
241 241
242struct tcp_deferred_accept_info {
243 struct sock *listen_sk;
244 struct request_sock *request;
245};
246
242struct tcp_sock { 247struct tcp_sock {
243 /* inet_connection_sock has to be the first member of tcp_sock */ 248 /* inet_connection_sock has to be the first member of tcp_sock */
244 struct inet_connection_sock inet_conn; 249 struct inet_connection_sock inet_conn;
@@ -374,6 +379,8 @@ struct tcp_sock {
374 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 379 unsigned int keepalive_intvl; /* time interval between keep alive probes */
375 int linger2; 380 int linger2;
376 381
382 struct tcp_deferred_accept_info defer_tcp_accept;
383
377 unsigned long last_synq_overflow; 384 unsigned long last_synq_overflow;
378 385
379 u32 tso_deferred; 386 u32 tso_deferred;
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 818ca1cf0b6d..90c1c191ea69 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -50,7 +50,7 @@ struct thermal_cooling_device_ops {
50}; 50};
51 51
52#define THERMAL_TRIPS_NONE -1 52#define THERMAL_TRIPS_NONE -1
53#define THERMAL_MAX_TRIPS 10 53#define THERMAL_MAX_TRIPS 12
54#define THERMAL_NAME_LENGTH 20 54#define THERMAL_NAME_LENGTH 20
55struct thermal_cooling_device { 55struct thermal_cooling_device {
56 int id; 56 int id;
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 421323e5a2d6..accd7bad35b0 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -9,6 +9,9 @@
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11 11
12struct timespec;
13struct compat_timespec;
14
12/* 15/*
13 * System call restart block. 16 * System call restart block.
14 */ 17 */
@@ -26,6 +29,15 @@ struct restart_block {
26 u32 bitset; 29 u32 bitset;
27 u64 time; 30 u64 time;
28 } futex; 31 } futex;
32 /* For nanosleep */
33 struct {
34 clockid_t index;
35 struct timespec __user *rmtp;
36#ifdef CONFIG_COMPAT
37 struct compat_timespec __user *compat_rmtp;
38#endif
39 u64 expires;
40 } nanosleep;
29 }; 41 };
30}; 42};
31 43
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h
index 1d6cc22e5f42..6696cf79c4f7 100644
--- a/include/linux/transport_class.h
+++ b/include/linux/transport_class.h
@@ -86,9 +86,10 @@ static inline int transport_container_register(struct transport_container *tc)
86 return attribute_container_register(&tc->ac); 86 return attribute_container_register(&tc->ac);
87} 87}
88 88
89static inline int transport_container_unregister(struct transport_container *tc) 89static inline void transport_container_unregister(struct transport_container *tc)
90{ 90{
91 return attribute_container_unregister(&tc->ac); 91 if (unlikely(attribute_container_unregister(&tc->ac)))
92 BUG();
92} 93}
93 94
94int transport_class_register(struct transport_class *); 95int transport_class_register(struct transport_class *);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 85c95cd39bc3..21f69aca4505 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -125,6 +125,7 @@
125#include <linux/cdev.h> 125#include <linux/cdev.h>
126 126
127struct tty_struct; 127struct tty_struct;
128struct tty_driver;
128 129
129struct tty_operations { 130struct tty_operations {
130 int (*open)(struct tty_struct * tty, struct file * filp); 131 int (*open)(struct tty_struct * tty, struct file * filp);
@@ -157,6 +158,11 @@ struct tty_operations {
157 int (*tiocmget)(struct tty_struct *tty, struct file *file); 158 int (*tiocmget)(struct tty_struct *tty, struct file *file);
158 int (*tiocmset)(struct tty_struct *tty, struct file *file, 159 int (*tiocmset)(struct tty_struct *tty, struct file *file,
159 unsigned int set, unsigned int clear); 160 unsigned int set, unsigned int clear);
161#ifdef CONFIG_CONSOLE_POLL
162 int (*poll_init)(struct tty_driver *driver, int line, char *options);
163 int (*poll_get_char)(struct tty_driver *driver, int line);
164 void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
165#endif
160}; 166};
161 167
162struct tty_driver { 168struct tty_driver {
@@ -220,6 +226,11 @@ struct tty_driver {
220 int (*tiocmget)(struct tty_struct *tty, struct file *file); 226 int (*tiocmget)(struct tty_struct *tty, struct file *file);
221 int (*tiocmset)(struct tty_struct *tty, struct file *file, 227 int (*tiocmset)(struct tty_struct *tty, struct file *file,
222 unsigned int set, unsigned int clear); 228 unsigned int set, unsigned int clear);
229#ifdef CONFIG_CONSOLE_POLL
230 int (*poll_init)(struct tty_driver *driver, int line, char *options);
231 int (*poll_get_char)(struct tty_driver *driver, int line);
232 void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
233#endif
223 234
224 struct list_head tty_drivers; 235 struct list_head tty_drivers;
225}; 236};
@@ -230,6 +241,7 @@ struct tty_driver *alloc_tty_driver(int lines);
230void put_tty_driver(struct tty_driver *driver); 241void put_tty_driver(struct tty_driver *driver);
231void tty_set_operations(struct tty_driver *driver, 242void tty_set_operations(struct tty_driver *driver,
232 const struct tty_operations *op); 243 const struct tty_operations *op);
244extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
233 245
234/* tty driver magic number */ 246/* tty driver magic number */
235#define TTY_DRIVER_MAGIC 0x5402 247#define TTY_DRIVER_MAGIC 0x5402
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 975c963e5789..fec6decfb983 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -84,4 +84,26 @@ static inline unsigned long __copy_from_user_nocache(void *to,
84 ret; \ 84 ret; \
85 }) 85 })
86 86
87/*
88 * probe_kernel_read(): safely attempt to read from a location
89 * @dst: pointer to the buffer that shall take the data
90 * @src: address to read from
91 * @size: size of the data chunk
92 *
93 * Safely read from address @src to the buffer at @dst. If a kernel fault
94 * happens, handle that and return -EFAULT.
95 */
96extern long probe_kernel_read(void *dst, void *src, size_t size);
97
98/*
99 * probe_kernel_write(): safely attempt to write to a location
100 * @dst: address to write to
101 * @src: pointer to the data that shall be written
102 * @size: size of the data chunk
103 *
104 * Safely write to address @dst from the buffer at @src. If a kernel fault
105 * happens, handle that and return -EFAULT.
106 */
107extern long probe_kernel_write(void *dst, void *src, size_t size);
108
87#endif /* __LINUX_UACCESS_H__ */ 109#endif /* __LINUX_UACCESS_H__ */
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 8ec703f462da..581ca2c14c52 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -26,15 +26,6 @@ struct udphdr {
26 __sum16 check; 26 __sum16 check;
27}; 27};
28 28
29#ifdef __KERNEL__
30#include <linux/skbuff.h>
31
32static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
33{
34 return (struct udphdr *)skb_transport_header(skb);
35}
36#endif
37
38/* UDP socket options */ 29/* UDP socket options */
39#define UDP_CORK 1 /* Never send partially complete segments */ 30#define UDP_CORK 1 /* Never send partially complete segments */
40#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ 31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
@@ -45,9 +36,14 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
45#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ 36#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */
46 37
47#ifdef __KERNEL__ 38#ifdef __KERNEL__
48#include <linux/types.h>
49
50#include <net/inet_sock.h> 39#include <net/inet_sock.h>
40#include <linux/skbuff.h>
41
42static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
43{
44 return (struct udphdr *)skb_transport_header(skb);
45}
46
51#define UDP_HTABLE_SIZE 128 47#define UDP_HTABLE_SIZE 128
52 48
53struct udp_sock { 49struct udp_sock {
@@ -82,6 +78,7 @@ static inline struct udp_sock *udp_sk(const struct sock *sk)
82{ 78{
83 return (struct udp_sock *)sk; 79 return (struct udp_sock *)sk;
84} 80}
81
85#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag) 82#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag)
86 83
87#endif 84#endif
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 3160dfed73ca..2864b1699ecc 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -455,6 +455,7 @@
455#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ 455#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */
456#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ 456#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */
457#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ 457#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */
458#define IW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */
458 459
459/* Statistics flags (bitmask in updated) */ 460/* Statistics flags (bitmask in updated) */
460#define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */ 461#define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index e31b8c84f2c9..0c82c80b277f 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -113,7 +113,8 @@ enum
113{ 113{
114 XFRM_POLICY_TYPE_MAIN = 0, 114 XFRM_POLICY_TYPE_MAIN = 0,
115 XFRM_POLICY_TYPE_SUB = 1, 115 XFRM_POLICY_TYPE_SUB = 1,
116 XFRM_POLICY_TYPE_MAX = 2 116 XFRM_POLICY_TYPE_MAX = 2,
117 XFRM_POLICY_TYPE_ANY = 255
117}; 118};
118 119
119enum 120enum