Bug

[В начало]

Ошибка # 104

Показать/спрятать трассу ошибок
Error trace
Function bodies
Blocks
  • Others...
    Function bodies without model function calls
    Initialization function calls
    Initialization function bodies
    Entry point
    Entry point body
    Function calls
    Skipped function calls
    Formal parameter names
    Declarations
    Assumes
    Assume conditions
    Returns
    Return values
    DEG initialization
    DEG function calls
    Model function calls
    Model function bodies
    Model asserts
    Model state changes
    Model function function calls
    Model function function bodies
    Model returns
    Model others
    Identation
    Line numbers
    Expand signs
-__CPAchecker_initialize()
{
19 typedef signed char __s8;
20 typedef unsigned char __u8;
22 typedef short __s16;
23 typedef unsigned short __u16;
25 typedef int __s32;
26 typedef unsigned int __u32;
30 typedef unsigned long long __u64;
15 typedef signed char s8;
16 typedef unsigned char u8;
18 typedef short s16;
19 typedef unsigned short u16;
21 typedef int s32;
22 typedef unsigned int u32;
24 typedef long long s64;
25 typedef unsigned long long u64;
14 typedef long __kernel_long_t;
15 typedef unsigned long __kernel_ulong_t;
27 typedef int __kernel_pid_t;
48 typedef unsigned int __kernel_uid32_t;
49 typedef unsigned int __kernel_gid32_t;
71 typedef __kernel_ulong_t __kernel_size_t;
72 typedef __kernel_long_t __kernel_ssize_t;
87 typedef long long __kernel_loff_t;
88 typedef __kernel_long_t __kernel_time_t;
89 typedef __kernel_long_t __kernel_clock_t;
90 typedef int __kernel_timer_t;
91 typedef int __kernel_clockid_t;
32 typedef __u16 __le16;
33 typedef __u16 __be16;
34 typedef __u32 __le32;
35 typedef __u32 __be32;
40 typedef __u32 __wsum;
12 typedef __u32 __kernel_dev_t;
15 typedef __kernel_dev_t dev_t;
18 typedef unsigned short umode_t;
21 typedef __kernel_pid_t pid_t;
26 typedef __kernel_clockid_t clockid_t;
29 typedef _Bool bool;
31 typedef __kernel_uid32_t uid_t;
32 typedef __kernel_gid32_t gid_t;
45 typedef __kernel_loff_t loff_t;
54 typedef __kernel_size_t size_t;
59 typedef __kernel_ssize_t ssize_t;
69 typedef __kernel_time_t time_t;
83 typedef unsigned char u_char;
102 typedef __s32 int32_t;
106 typedef __u8 uint8_t;
108 typedef __u32 uint32_t;
111 typedef __u64 uint64_t;
133 typedef unsigned long sector_t;
134 typedef unsigned long blkcnt_t;
146 typedef u64 dma_addr_t;
157 typedef unsigned int gfp_t;
158 typedef unsigned int fmode_t;
159 typedef unsigned int oom_flags_t;
162 typedef u64 phys_addr_t;
167 typedef phys_addr_t resource_size_t;
177 struct __anonstruct_atomic_t_6 { int counter; } ;
177 typedef struct __anonstruct_atomic_t_6 atomic_t;
182 struct __anonstruct_atomic64_t_7 { long counter; } ;
182 typedef struct __anonstruct_atomic64_t_7 atomic64_t;
183 struct list_head { struct list_head *next; struct list_head *prev; } ;
188 struct hlist_node ;
188 struct hlist_head { struct hlist_node *first; } ;
192 struct hlist_node { struct hlist_node *next; struct hlist_node **pprev; } ;
203 struct callback_head { struct callback_head *next; void (*func)(struct callback_head *); } ;
213 enum dma_data_direction { DMA_BIDIRECTIONAL = 0, DMA_TO_DEVICE = 1, DMA_FROM_DEVICE = 2, DMA_NONE = 3 } ;
5 struct device ;
5 struct page ;
7 struct dma_attrs ;
99 struct kernel_symbol { unsigned long value; const char *name; } ;
33 struct module ;
65 struct pt_regs { unsigned long r15; unsigned long r14; unsigned long r13; unsigned long r12; unsigned long bp; unsigned long bx; unsigned long r11; unsigned long r10; unsigned long r9; unsigned long r8; unsigned long ax; unsigned long cx; unsigned long dx; unsigned long si; unsigned long di; unsigned long orig_ax; unsigned long ip; unsigned long cs; unsigned long flags; unsigned long sp; unsigned long ss; } ;
59 struct __anonstruct____missing_field_name_9 { unsigned int a; unsigned int b; } ;
59 struct __anonstruct____missing_field_name_10 { u16 limit0; u16 base0; unsigned char base1; unsigned char type; unsigned char s; unsigned char dpl; unsigned char p; unsigned char limit; unsigned char avl; unsigned char l; unsigned char d; unsigned char g; unsigned char base2; } ;
59 union __anonunion____missing_field_name_8 { struct __anonstruct____missing_field_name_9 __annonCompField4; struct __anonstruct____missing_field_name_10 __annonCompField5; } ;
59 struct desc_struct { union __anonunion____missing_field_name_8 __annonCompField6; } ;
15 typedef unsigned long pgdval_t;
16 typedef unsigned long pgprotval_t;
20 struct pgprot { pgprotval_t pgprot; } ;
243 typedef struct pgprot pgprot_t;
245 struct __anonstruct_pgd_t_12 { pgdval_t pgd; } ;
245 typedef struct __anonstruct_pgd_t_12 pgd_t;
333 typedef struct page *pgtable_t;
341 struct file ;
354 struct seq_file ;
389 struct thread_struct ;
391 struct mm_struct ;
392 struct task_struct ;
393 struct cpumask ;
394 struct paravirt_callee_save { void *func; } ;
196 struct pv_irq_ops { struct paravirt_callee_save save_fl; struct paravirt_callee_save restore_fl; struct paravirt_callee_save irq_disable; struct paravirt_callee_save irq_enable; void (*safe_halt)(); void (*halt)(); void (*adjust_exception_frame)(); } ;
327 struct arch_spinlock ;
18 typedef u16 __ticket_t;
19 typedef u32 __ticketpair_t;
20 struct __raw_tickets { __ticket_t head; __ticket_t tail; } ;
32 union __anonunion____missing_field_name_15 { __ticketpair_t head_tail; struct __raw_tickets tickets; } ;
32 struct arch_spinlock { union __anonunion____missing_field_name_15 __annonCompField7; } ;
33 typedef struct arch_spinlock arch_spinlock_t;
33 struct __anonstruct____missing_field_name_17 { u32 read; s32 write; } ;
33 union __anonunion_arch_rwlock_t_16 { s64 lock; struct __anonstruct____missing_field_name_17 __annonCompField8; } ;
33 typedef union __anonunion_arch_rwlock_t_16 arch_rwlock_t;
142 typedef void (*ctor_fn_t)();
54 struct net_device ;
376 struct file_operations ;
388 struct completion ;
416 struct pid ;
527 struct bug_entry { int bug_addr_disp; int file_disp; unsigned short line; unsigned short flags; } ;
102 struct timespec ;
127 struct kernel_vm86_regs { struct pt_regs pt; unsigned short es; unsigned short __esh; unsigned short ds; unsigned short __dsh; unsigned short fs; unsigned short __fsh; unsigned short gs; unsigned short __gsh; } ;
79 union __anonunion____missing_field_name_22 { struct pt_regs *regs; struct kernel_vm86_regs *vm86; } ;
79 struct math_emu_info { long ___orig_eip; union __anonunion____missing_field_name_22 __annonCompField10; } ;
306 struct cpumask { unsigned long bits[128U]; } ;
14 typedef struct cpumask cpumask_t;
663 typedef struct cpumask *cpumask_var_t;
195 struct static_key ;
162 struct seq_operations ;
294 struct i387_fsave_struct { u32 cwd; u32 swd; u32 twd; u32 fip; u32 fcs; u32 foo; u32 fos; u32 st_space[20U]; u32 status; } ;
312 struct __anonstruct____missing_field_name_27 { u64 rip; u64 rdp; } ;
312 struct __anonstruct____missing_field_name_28 { u32 fip; u32 fcs; u32 foo; u32 fos; } ;
312 union __anonunion____missing_field_name_26 { struct __anonstruct____missing_field_name_27 __annonCompField14; struct __anonstruct____missing_field_name_28 __annonCompField15; } ;
312 union __anonunion____missing_field_name_29 { u32 padding1[12U]; u32 sw_reserved[12U]; } ;
312 struct i387_fxsave_struct { u16 cwd; u16 swd; u16 twd; u16 fop; union __anonunion____missing_field_name_26 __annonCompField16; u32 mxcsr; u32 mxcsr_mask; u32 st_space[32U]; u32 xmm_space[64U]; u32 padding[12U]; union __anonunion____missing_field_name_29 __annonCompField17; } ;
346 struct i387_soft_struct { u32 cwd; u32 swd; u32 twd; u32 fip; u32 fcs; u32 foo; u32 fos; u32 st_space[20U]; u8 ftop; u8 changed; u8 lookahead; u8 no_update; u8 rm; u8 alimit; struct math_emu_info *info; u32 entry_eip; } ;
367 struct ymmh_struct { u32 ymmh_space[64U]; } ;
372 struct lwp_struct { u8 reserved[128U]; } ;
377 struct bndregs_struct { u64 bndregs[8U]; } ;
381 struct bndcsr_struct { u64 cfg_reg_u; u64 status_reg; } ;
386 struct xsave_hdr_struct { u64 xstate_bv; u64 reserved1[2U]; u64 reserved2[5U]; } ;
392 struct xsave_struct { struct i387_fxsave_struct i387; struct xsave_hdr_struct xsave_hdr; struct ymmh_struct ymmh; struct lwp_struct lwp; struct bndregs_struct bndregs; struct bndcsr_struct bndcsr; } ;
401 union thread_xstate { struct i387_fsave_struct fsave; struct i387_fxsave_struct fxsave; struct i387_soft_struct soft; struct xsave_struct xsave; } ;
409 struct fpu { unsigned int last_cpu; unsigned int has_fpu; union thread_xstate *state; } ;
456 struct kmem_cache ;
457 struct perf_event ;
458 struct thread_struct { struct desc_struct tls_array[3U]; unsigned long sp0; unsigned long sp; unsigned long usersp; unsigned short es; unsigned short ds; unsigned short fsindex; unsigned short gsindex; unsigned long fs; unsigned long gs; struct perf_event *ptrace_bps[4U]; unsigned long debugreg6; unsigned long ptrace_dr7; unsigned long cr2; unsigned long trap_nr; unsigned long error_code; struct fpu fpu; unsigned long *io_bitmap_ptr; unsigned long iopl; unsigned int io_bitmap_max; unsigned char fpu_counter; } ;
23 typedef atomic64_t atomic_long_t;
152 struct lockdep_map ;
55 struct stack_trace { unsigned int nr_entries; unsigned int max_entries; unsigned long *entries; int skip; } ;
26 struct lockdep_subclass_key { char __one_byte; } ;
53 struct lock_class_key { struct lockdep_subclass_key subkeys[8U]; } ;
59 struct lock_class { struct list_head hash_entry; struct list_head lock_entry; struct lockdep_subclass_key *key; unsigned int subclass; unsigned int dep_gen_id; unsigned long usage_mask; struct stack_trace usage_traces[13U]; struct list_head locks_after; struct list_head locks_before; unsigned int version; unsigned long ops; const char *name; int name_version; unsigned long contention_point[4U]; unsigned long contending_point[4U]; } ;
144 struct lockdep_map { struct lock_class_key *key; struct lock_class *class_cache[2U]; const char *name; int cpu; unsigned long ip; } ;
205 struct held_lock { u64 prev_chain_key; unsigned long acquire_ip; struct lockdep_map *instance; struct lockdep_map *nest_lock; u64 waittime_stamp; u64 holdtime_stamp; unsigned short class_idx; unsigned char irq_context; unsigned char trylock; unsigned char read; unsigned char check; unsigned char hardirqs_off; unsigned short references; } ;
537 struct raw_spinlock { arch_spinlock_t raw_lock; unsigned int magic; unsigned int owner_cpu; void *owner; struct lockdep_map dep_map; } ;
32 typedef struct raw_spinlock raw_spinlock_t;
33 struct __anonstruct____missing_field_name_33 { u8 __padding[24U]; struct lockdep_map dep_map; } ;
33 union __anonunion____missing_field_name_32 { struct raw_spinlock rlock; struct __anonstruct____missing_field_name_33 __annonCompField19; } ;
33 struct spinlock { union __anonunion____missing_field_name_32 __annonCompField20; } ;
76 typedef struct spinlock spinlock_t;
23 struct __anonstruct_rwlock_t_34 { arch_rwlock_t raw_lock; unsigned int magic; unsigned int owner_cpu; void *owner; struct lockdep_map dep_map; } ;
23 typedef struct __anonstruct_rwlock_t_34 rwlock_t;
59 struct static_key { atomic_t enabled; } ;
412 struct rb_node { unsigned long __rb_parent_color; struct rb_node *rb_right; struct rb_node *rb_left; } ;
40 struct rb_root { struct rb_node *rb_node; } ;
87 struct rw_semaphore ;
88 struct rw_semaphore { long count; raw_spinlock_t wait_lock; struct list_head wait_list; struct lockdep_map dep_map; } ;
12 struct __wait_queue ;
12 typedef struct __wait_queue wait_queue_t;
15 struct __wait_queue { unsigned int flags; void *private; int (*func)(wait_queue_t *, unsigned int, int, void *); struct list_head task_list; } ;
34 struct __wait_queue_head { spinlock_t lock; struct list_head task_list; } ;
39 typedef struct __wait_queue_head wait_queue_head_t;
919 struct completion { unsigned int done; wait_queue_head_t wait; } ;
113 struct vm_area_struct ;
114 struct inode ;
115 struct notifier_block ;
58 struct mutex { atomic_t count; spinlock_t wait_lock; struct list_head wait_list; struct task_struct *owner; const char *name; void *magic; struct lockdep_map dep_map; } ;
67 struct mutex_waiter { struct list_head list; struct task_struct *task; void *magic; } ;
177 struct seqcount { unsigned int sequence; struct lockdep_map dep_map; } ;
51 typedef struct seqcount seqcount_t;
259 struct __anonstruct_seqlock_t_35 { struct seqcount seqcount; spinlock_t lock; } ;
259 typedef struct __anonstruct_seqlock_t_35 seqlock_t;
1039 struct timespec { __kernel_time_t tv_sec; long tv_nsec; } ;
323 union ktime { s64 tv64; } ;
59 typedef union ktime ktime_t;
388 struct tvec_base ;
389 struct timer_list { struct list_head entry; unsigned long expires; struct tvec_base *base; void (*function)(unsigned long); unsigned long data; int slack; int start_pid; void *start_site; char start_comm[16U]; struct lockdep_map lockdep_map; } ;
254 struct hrtimer ;
255 enum hrtimer_restart ;
266 struct workqueue_struct ;
267 struct work_struct ;
54 struct work_struct { atomic_long_t data; struct list_head entry; void (*func)(struct work_struct *); struct lockdep_map lockdep_map; } ;
107 struct delayed_work { struct work_struct work; struct timer_list timer; struct workqueue_struct *wq; int cpu; } ;
51 struct notifier_block { int (*notifier_call)(struct notifier_block *, unsigned long, void *); struct notifier_block *next; int priority; } ;
63 struct blocking_notifier_head { struct rw_semaphore rwsem; struct notifier_block *head; } ;
45 struct arch_uprobe_task { unsigned long saved_scratch_register; unsigned int saved_trap_nr; unsigned int saved_tf; } ;
54 enum uprobe_task_state { UTASK_RUNNING = 0, UTASK_SSTEP = 1, UTASK_SSTEP_ACK = 2, UTASK_SSTEP_TRAPPED = 3 } ;
61 struct __anonstruct____missing_field_name_38 { struct arch_uprobe_task autask; unsigned long vaddr; } ;
61 struct __anonstruct____missing_field_name_39 { struct callback_head dup_xol_work; unsigned long dup_xol_addr; } ;
61 union __anonunion____missing_field_name_37 { struct __anonstruct____missing_field_name_38 __annonCompField22; struct __anonstruct____missing_field_name_39 __annonCompField23; } ;
61 struct uprobe ;
61 struct return_instance ;
61 struct uprobe_task { enum uprobe_task_state state; union __anonunion____missing_field_name_37 __annonCompField24; struct uprobe *active_uprobe; unsigned long xol_vaddr; struct return_instance *return_instances; unsigned int depth; } ;
93 struct xol_area ;
94 struct uprobes_state { struct xol_area *xol_area; } ;
22 struct __anonstruct_mm_context_t_40 { void *ldt; int size; unsigned short ia32_compat; struct mutex lock; void *vdso; } ;
22 typedef struct __anonstruct_mm_context_t_40 mm_context_t;
26 struct address_space ;
27 union __anonunion____missing_field_name_41 { struct address_space *mapping; void *s_mem; } ;
27 union __anonunion____missing_field_name_43 { unsigned long index; void *freelist; bool pfmemalloc; } ;
27 struct __anonstruct____missing_field_name_47 { unsigned short inuse; unsigned short objects; unsigned char frozen; } ;
27 union __anonunion____missing_field_name_46 { atomic_t _mapcount; struct __anonstruct____missing_field_name_47 __annonCompField27; int units; } ;
27 struct __anonstruct____missing_field_name_45 { union __anonunion____missing_field_name_46 __annonCompField28; atomic_t _count; } ;
27 union __anonunion____missing_field_name_44 { unsigned long counters; struct __anonstruct____missing_field_name_45 __annonCompField29; unsigned int active; } ;
27 struct __anonstruct____missing_field_name_42 { union __anonunion____missing_field_name_43 __annonCompField26; union __anonunion____missing_field_name_44 __annonCompField30; } ;
27 struct __anonstruct____missing_field_name_49 { struct page *next; int pages; int pobjects; } ;
27 struct slab ;
27 union __anonunion____missing_field_name_48 { struct list_head lru; struct __anonstruct____missing_field_name_49 __annonCompField32; struct list_head list; struct slab *slab_page; struct callback_head callback_head; pgtable_t pmd_huge_pte; } ;
27 union __anonunion____missing_field_name_50 { unsigned long private; spinlock_t *ptl; struct kmem_cache *slab_cache; struct page *first_page; } ;
27 struct page { unsigned long flags; union __anonunion____missing_field_name_41 __annonCompField25; struct __anonstruct____missing_field_name_42 __annonCompField31; union __anonunion____missing_field_name_48 __annonCompField33; union __anonunion____missing_field_name_50 __annonCompField34; unsigned long debug_flags; } ;
186 struct page_frag { struct page *page; __u32 offset; __u32 size; } ;
238 struct __anonstruct_linear_52 { struct rb_node rb; unsigned long rb_subtree_last; } ;
238 union __anonunion_shared_51 { struct __anonstruct_linear_52 linear; struct list_head nonlinear; } ;
238 struct anon_vma ;
238 struct vm_operations_struct ;
238 struct mempolicy ;
238 struct vm_area_struct { unsigned long vm_start; unsigned long vm_end; struct vm_area_struct *vm_next; struct vm_area_struct *vm_prev; struct rb_node vm_rb; unsigned long rb_subtree_gap; struct mm_struct *vm_mm; pgprot_t vm_page_prot; unsigned long vm_flags; union __anonunion_shared_51 shared; struct list_head anon_vma_chain; struct anon_vma *anon_vma; const struct vm_operations_struct *vm_ops; unsigned long vm_pgoff; struct file *vm_file; void *vm_private_data; struct mempolicy *vm_policy; } ;
310 struct core_thread { struct task_struct *task; struct core_thread *next; } ;
316 struct core_state { atomic_t nr_threads; struct core_thread dumper; struct completion startup; } ;
329 struct task_rss_stat { int events; int count[3U]; } ;
337 struct mm_rss_stat { atomic_long_t count[3U]; } ;
342 struct kioctx_table ;
343 struct linux_binfmt ;
343 struct mmu_notifier_mm ;
343 struct mm_struct { struct vm_area_struct *mmap; struct rb_root mm_rb; struct vm_area_struct *mmap_cache; unsigned long int (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); unsigned long mmap_base; unsigned long mmap_legacy_base; unsigned long task_size; unsigned long highest_vm_end; pgd_t *pgd; atomic_t mm_users; atomic_t mm_count; atomic_long_t nr_ptes; int map_count; spinlock_t page_table_lock; struct rw_semaphore mmap_sem; struct list_head mmlist; unsigned long hiwater_rss; unsigned long hiwater_vm; unsigned long total_vm; unsigned long locked_vm; unsigned long pinned_vm; unsigned long shared_vm; unsigned long exec_vm; unsigned long stack_vm; unsigned long def_flags; unsigned long start_code; unsigned long end_code; unsigned long start_data; unsigned long end_data; unsigned long start_brk; unsigned long brk; unsigned long start_stack; unsigned long arg_start; unsigned long arg_end; unsigned long env_start; unsigned long env_end; unsigned long saved_auxv[46U]; struct mm_rss_stat rss_stat; struct linux_binfmt *binfmt; cpumask_var_t cpu_vm_mask_var; mm_context_t context; unsigned long flags; struct core_state *core_state; spinlock_t ioctx_lock; struct kioctx_table *ioctx_table; struct task_struct *owner; struct file *exe_file; struct mmu_notifier_mm *mmu_notifier_mm; struct cpumask cpumask_allocation; unsigned long numa_next_scan; unsigned long numa_scan_offset; int numa_scan_seq; bool tlb_flush_pending; struct uprobes_state uprobes_state; } ;
186 struct iovec { void *iov_base; __kernel_size_t iov_len; } ;
11 typedef unsigned short __kernel_sa_family_t;
18 struct cred ;
23 typedef __kernel_sa_family_t sa_family_t;
24 struct sockaddr { sa_family_t sa_family; char sa_data[14U]; } ;
38 struct msghdr { void *msg_name; int msg_namelen; struct iovec *msg_iov; __kernel_size_t msg_iovlen; void *msg_control; __kernel_size_t msg_controllen; unsigned int msg_flags; } ;
331 enum ldv_11030 { SS_FREE = 0, SS_UNCONNECTED = 1, SS_CONNECTING = 2, SS_CONNECTED = 3, SS_DISCONNECTING = 4 } ;
53 typedef enum ldv_11030 socket_state;
54 struct poll_table_struct ;
55 struct pipe_inode_info ;
56 struct net ;
73 struct fasync_struct ;
73 struct socket_wq { wait_queue_head_t wait; struct fasync_struct *fasync_list; struct callback_head rcu; } ;
94 struct sock ;
94 struct proto_ops ;
94 struct socket { socket_state state; short type; unsigned long flags; struct socket_wq *wq; struct file *file; struct sock *sk; const struct proto_ops *ops; } ;
120 struct kiocb ;
121 struct proto_ops { int family; struct module *owner; int (*release)(struct socket *); int (*bind)(struct socket *, struct sockaddr *, int); int (*connect)(struct socket *, struct sockaddr *, int, int); int (*socketpair)(struct socket *, struct socket *); int (*accept)(struct socket *, struct socket *, int); int (*getname)(struct socket *, struct sockaddr *, int *, int); unsigned int (*poll)(struct file *, struct socket *, struct poll_table_struct *); int (*ioctl)(struct socket *, unsigned int, unsigned long); int (*compat_ioctl)(struct socket *, unsigned int, unsigned long); int (*listen)(struct socket *, int); int (*shutdown)(struct socket *, int); int (*setsockopt)(struct socket *, int, int, char *, unsigned int); int (*getsockopt)(struct socket *, int, int, char *, int *); int (*compat_setsockopt)(struct socket *, int, int, char *, unsigned int); int (*compat_getsockopt)(struct socket *, int, int, char *, int *); int (*sendmsg)(struct kiocb *, struct socket *, struct msghdr *, size_t ); int (*recvmsg)(struct kiocb *, struct socket *, struct msghdr *, size_t , int); int (*mmap)(struct file *, struct socket *, struct vm_area_struct *); ssize_t (*sendpage)(struct socket *, struct page *, int, size_t , int); ssize_t (*splice_read)(struct socket *, loff_t *, struct pipe_inode_info *, size_t , unsigned int); int (*set_peek_off)(struct sock *, int); } ;
98 struct __anonstruct_nodemask_t_53 { unsigned long bits[16U]; } ;
98 typedef struct __anonstruct_nodemask_t_53 nodemask_t;
891 struct ctl_table ;
72 struct resource { resource_size_t start; resource_size_t end; const char *name; unsigned long flags; struct resource *parent; struct resource *sibling; struct resource *child; } ;
172 struct pci_dev ;
58 struct pm_message { int event; } ;
64 typedef struct pm_message pm_message_t;
65 struct dev_pm_ops { int (*prepare)(struct device *); void (*complete)(struct device *); int (*suspend)(struct device *); int (*resume)(struct device *); int (*freeze)(struct device *); int (*thaw)(struct device *); int (*poweroff)(struct device *); int (*restore)(struct device *); int (*suspend_late)(struct device *); int (*resume_early)(struct device *); int (*freeze_late)(struct device *); int (*thaw_early)(struct device *); int (*poweroff_late)(struct device *); int (*restore_early)(struct device *); int (*suspend_noirq)(struct device *); int (*resume_noirq)(struct device *); int (*freeze_noirq)(struct device *); int (*thaw_noirq)(struct device *); int (*poweroff_noirq)(struct device *); int (*restore_noirq)(struct device *); int (*runtime_suspend)(struct device *); int (*runtime_resume)(struct device *); int (*runtime_idle)(struct device *); } ;
301 enum rpm_status { RPM_ACTIVE = 0, RPM_RESUMING = 1, RPM_SUSPENDED = 2, RPM_SUSPENDING = 3 } ;
308 enum rpm_request { RPM_REQ_NONE = 0, RPM_REQ_IDLE = 1, RPM_REQ_SUSPEND = 2, RPM_REQ_AUTOSUSPEND = 3, RPM_REQ_RESUME = 4 } ;
316 struct wakeup_source ;
527 struct pm_subsys_data { spinlock_t lock; unsigned int refcount; struct list_head clock_list; } ;
534 struct dev_pm_qos ;
534 struct dev_pm_info { pm_message_t power_state; unsigned char can_wakeup; unsigned char async_suspend; bool is_prepared; bool is_suspended; bool ignore_children; bool early_init; spinlock_t lock; struct list_head entry; struct completion completion; struct wakeup_source *wakeup; bool wakeup_path; bool syscore; struct timer_list suspend_timer; unsigned long timer_expires; struct work_struct work; wait_queue_head_t wait_queue; atomic_t usage_count; atomic_t child_count; unsigned char disable_depth; unsigned char idle_notification; unsigned char request_pending; unsigned char deferred_resume; unsigned char run_wake; unsigned char runtime_auto; unsigned char no_callbacks; unsigned char irq_safe; unsigned char use_autosuspend; unsigned char timer_autosuspends; unsigned char memalloc_noio; enum rpm_request request; enum rpm_status runtime_status; int runtime_error; int autosuspend_delay; unsigned long last_busy; unsigned long active_jiffies; unsigned long suspended_jiffies; unsigned long accounting_timestamp; struct pm_subsys_data *subsys_data; struct dev_pm_qos *qos; } ;
591 struct dev_pm_domain { struct dev_pm_ops ops; } ;
133 struct pci_bus ;
341 struct device_node ;
1276 struct llist_node ;
64 struct llist_node { struct llist_node *next; } ;
58 struct mem_cgroup ;
325 struct idr_layer { int prefix; unsigned long bitmap[4U]; struct idr_layer *ary[256U]; int count; int layer; struct callback_head callback_head; } ;
38 struct idr { struct idr_layer *hint; struct idr_layer *top; struct idr_layer *id_free; int layers; int id_free_cnt; int cur; spinlock_t lock; } ;
197 struct ida_bitmap { long nr_busy; unsigned long bitmap[15U]; } ;
213 struct ida { struct idr idr; struct ida_bitmap *free_bitmap; } ;
245 struct dentry ;
246 struct iattr ;
247 struct super_block ;
248 struct file_system_type ;
249 struct kernfs_open_node ;
250 struct kernfs_iattrs ;
266 struct kernfs_root ;
266 struct kernfs_elem_dir { unsigned long subdirs; struct rb_root children; struct kernfs_root *root; } ;
62 struct kernfs_node ;
62 struct kernfs_elem_symlink { struct kernfs_node *target_kn; } ;
66 struct kernfs_ops ;
66 struct kernfs_elem_attr { const struct kernfs_ops *ops; struct kernfs_open_node *open; loff_t size; } ;
72 union __anonunion_u_145 { struct completion *completion; struct kernfs_node *removed_list; } ;
72 union __anonunion____missing_field_name_146 { struct kernfs_elem_dir dir; struct kernfs_elem_symlink symlink; struct kernfs_elem_attr attr; } ;
72 struct kernfs_node { atomic_t count; atomic_t active; struct lockdep_map dep_map; struct kernfs_node *parent; const char *name; struct rb_node rb; union __anonunion_u_145 u; const void *ns; unsigned int hash; union __anonunion____missing_field_name_146 __annonCompField46; void *priv; unsigned short flags; umode_t mode; unsigned int ino; struct kernfs_iattrs *iattr; } ;
114 struct kernfs_dir_ops { int (*mkdir)(struct kernfs_node *, const char *, umode_t ); int (*rmdir)(struct kernfs_node *); int (*rename)(struct kernfs_node *, struct kernfs_node *, const char *); } ;
127 struct kernfs_root { struct kernfs_node *kn; struct ida ino_ida; struct kernfs_dir_ops *dir_ops; } ;
137 struct kernfs_open_file { struct kernfs_node *kn; struct file *file; struct mutex mutex; int event; struct list_head list; bool mmapped; const struct vm_operations_struct *vm_ops; } ;
151 struct kernfs_ops { int (*seq_show)(struct seq_file *, void *); void * (*seq_start)(struct seq_file *, loff_t *); void * (*seq_next)(struct seq_file *, void *, loff_t *); void (*seq_stop)(struct seq_file *, void *); ssize_t (*read)(struct kernfs_open_file *, char *, size_t , loff_t ); ssize_t (*write)(struct kernfs_open_file *, char *, size_t , loff_t ); int (*mmap)(struct kernfs_open_file *, struct vm_area_struct *); struct lock_class_key lockdep_key; } ;
376 struct kobject ;
377 enum kobj_ns_type { KOBJ_NS_TYPE_NONE = 0, KOBJ_NS_TYPE_NET = 1, KOBJ_NS_TYPES = 2 } ;
383 struct kobj_ns_type_operations { enum kobj_ns_type type; bool (*current_may_mount)(); void * (*grab_current_ns)(); const void * (*netlink_ns)(struct sock *); const void * (*initial_ns)(); void (*drop_ns)(void *); } ;
83 struct user_namespace ;
22 struct __anonstruct_kuid_t_147 { uid_t val; } ;
22 typedef struct __anonstruct_kuid_t_147 kuid_t;
27 struct __anonstruct_kgid_t_148 { gid_t val; } ;
27 typedef struct __anonstruct_kgid_t_148 kgid_t;
127 struct kstat { u64 ino; dev_t dev; umode_t mode; unsigned int nlink; kuid_t uid; kgid_t gid; dev_t rdev; loff_t size; struct timespec atime; struct timespec mtime; struct timespec ctime; unsigned long blksize; unsigned long long blocks; } ;
36 struct bin_attribute ;
37 struct attribute { const char *name; umode_t mode; bool ignore_lockdep; struct lock_class_key *key; struct lock_class_key skey; } ;
37 struct attribute_group { const char *name; umode_t (*is_visible)(struct kobject *, struct attribute *, int); struct attribute **attrs; struct bin_attribute **bin_attrs; } ;
67 struct bin_attribute { struct attribute attr; size_t size; void *private; ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t , size_t ); ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t , size_t ); int (*mmap)(struct file *, struct kobject *, struct bin_attribute *, struct vm_area_struct *); } ;
130 struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *, char *); ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t ); } ;
462 struct kref { atomic_t refcount; } ;
50 struct kset ;
50 struct kobj_type ;
50 struct kobject { const char *name; struct list_head entry; struct kobject *parent; struct kset *kset; struct kobj_type *ktype; struct kernfs_node *sd; struct kref kref; struct delayed_work release; unsigned char state_initialized; unsigned char state_in_sysfs; unsigned char state_add_uevent_sent; unsigned char state_remove_uevent_sent; unsigned char uevent_suppress; } ;
112 struct kobj_type { void (*release)(struct kobject *); const struct sysfs_ops *sysfs_ops; struct attribute **default_attrs; const struct kobj_ns_type_operations * (*child_ns_type)(struct kobject *); const void * (*namespace)(struct kobject *); } ;
120 struct kobj_uevent_env { char *envp[32U]; int envp_idx; char buf[2048U]; int buflen; } ;
127 struct kset_uevent_ops { const int (*filter)(struct kset *, struct kobject *); const const char * (*name)(struct kset *, struct kobject *); const int (*uevent)(struct kset *, struct kobject *, struct kobj_uevent_env *); } ;
144 struct kset { struct list_head list; spinlock_t list_lock; struct kobject kobj; const struct kset_uevent_ops *uevent_ops; } ;
249 struct kmem_cache_cpu { void **freelist; unsigned long tid; struct page *page; struct page *partial; unsigned int stat[26U]; } ;
48 struct kmem_cache_order_objects { unsigned long x; } ;
58 struct memcg_cache_params ;
58 struct kmem_cache_node ;
58 struct kmem_cache { struct kmem_cache_cpu *cpu_slab; unsigned long flags; unsigned long min_partial; int size; int object_size; int offset; int cpu_partial; struct kmem_cache_order_objects oo; struct kmem_cache_order_objects max; struct kmem_cache_order_objects min; gfp_t allocflags; int refcount; void (*ctor)(void *); int inuse; int align; int reserved; const char *name; struct list_head list; struct kobject kobj; struct memcg_cache_params *memcg_params; int max_attr_size; int remote_node_defrag_ratio; struct kmem_cache_node *node[1024U]; } ;
497 struct __anonstruct____missing_field_name_150 { struct callback_head callback_head; struct kmem_cache *memcg_caches[0U]; } ;
497 struct __anonstruct____missing_field_name_151 { struct mem_cgroup *memcg; struct list_head list; struct kmem_cache *root_cache; bool dead; atomic_t nr_pages; struct work_struct destroy; } ;
497 union __anonunion____missing_field_name_149 { struct __anonstruct____missing_field_name_150 __annonCompField47; struct __anonstruct____missing_field_name_151 __annonCompField48; } ;
497 struct memcg_cache_params { bool is_root_cache; union __anonunion____missing_field_name_149 __annonCompField49; } ;
62 struct exception_table_entry { int insn; int fixup; } ;
161 struct in6_addr ;
119 struct sk_buff ;
134 struct klist_node ;
37 struct klist_node { void *n_klist; struct list_head n_node; struct kref n_ref; } ;
67 struct path ;
68 struct seq_file { char *buf; size_t size; size_t from; size_t count; size_t pad_until; loff_t index; loff_t read_pos; u64 version; struct mutex lock; const struct seq_operations *op; int poll_event; struct user_namespace *user_ns; void *private; } ;
35 struct seq_operations { void * (*start)(struct seq_file *, loff_t *); void (*stop)(struct seq_file *, void *); void * (*next)(struct seq_file *, void *, loff_t *); int (*show)(struct seq_file *, void *); } ;
196 struct pinctrl ;
197 struct pinctrl_state ;
194 struct dev_pin_info { struct pinctrl *p; struct pinctrl_state *default_state; struct pinctrl_state *sleep_state; struct pinctrl_state *idle_state; } ;
42 struct dma_map_ops ;
42 struct dev_archdata { struct dma_map_ops *dma_ops; void *iommu; } ;
14 struct device_private ;
15 struct device_driver ;
16 struct driver_private ;
17 struct class ;
18 struct subsys_private ;
19 struct bus_type ;
20 struct iommu_ops ;
21 struct iommu_group ;
60 struct device_attribute ;
60 struct bus_type { const char *name; const char *dev_name; struct device *dev_root; struct device_attribute *dev_attrs; const struct attribute_group **bus_groups; const struct attribute_group **dev_groups; const struct attribute_group **drv_groups; int (*match)(struct device *, struct device_driver *); int (*uevent)(struct device *, struct kobj_uevent_env *); int (*probe)(struct device *); int (*remove)(struct device *); void (*shutdown)(struct device *); int (*online)(struct device *); int (*offline)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct dev_pm_ops *pm; struct iommu_ops *iommu_ops; struct subsys_private *p; struct lock_class_key lock_key; } ;
138 struct device_type ;
195 struct of_device_id ;
195 struct acpi_device_id ;
195 struct device_driver { const char *name; struct bus_type *bus; struct module *owner; const char *mod_name; bool suppress_bind_attrs; const struct of_device_id *of_match_table; const struct acpi_device_id *acpi_match_table; int (*probe)(struct device *); int (*remove)(struct device *); void (*shutdown)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct attribute_group **groups; const struct dev_pm_ops *pm; struct driver_private *p; } ;
260 struct driver_attribute { struct attribute attr; ssize_t (*show)(struct device_driver *, char *); ssize_t (*store)(struct device_driver *, const char *, size_t ); } ;
321 struct class_attribute ;
321 struct class { const char *name; struct module *owner; struct class_attribute *class_attrs; const struct attribute_group **dev_groups; struct kobject *dev_kobj; int (*dev_uevent)(struct device *, struct kobj_uevent_env *); char * (*devnode)(struct device *, umode_t *); void (*class_release)(struct class *); void (*dev_release)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct kobj_ns_type_operations *ns_type; const void * (*namespace)(struct device *); const struct dev_pm_ops *pm; struct subsys_private *p; } ;
414 struct class_attribute { struct attribute attr; ssize_t (*show)(struct class *, struct class_attribute *, char *); ssize_t (*store)(struct class *, struct class_attribute *, const char *, size_t ); } ;
482 struct device_type { const char *name; const struct attribute_group **groups; int (*uevent)(struct device *, struct kobj_uevent_env *); char * (*devnode)(struct device *, umode_t *, kuid_t *, kgid_t *); void (*release)(struct device *); const struct dev_pm_ops *pm; } ;
510 struct device_attribute { struct attribute attr; ssize_t (*show)(struct device *, struct device_attribute *, char *); ssize_t (*store)(struct device *, struct device_attribute *, const char *, size_t ); } ;
637 struct device_dma_parameters { unsigned int max_segment_size; unsigned long segment_boundary_mask; } ;
646 struct acpi_device ;
647 struct acpi_dev_node { struct acpi_device *companion; } ;
653 struct dma_coherent_mem ;
653 struct device { struct device *parent; struct device_private *p; struct kobject kobj; const char *init_name; const struct device_type *type; struct mutex mutex; struct bus_type *bus; struct device_driver *driver; void *platform_data; struct dev_pm_info power; struct dev_pm_domain *pm_domain; struct dev_pin_info *pins; int numa_node; u64 *dma_mask; u64 coherent_dma_mask; struct device_dma_parameters *dma_parms; struct list_head dma_pools; struct dma_coherent_mem *dma_mem; struct dev_archdata archdata; struct device_node *of_node; struct acpi_dev_node acpi_node; dev_t devt; u32 id; spinlock_t devres_lock; struct list_head devres_head; struct klist_node knode_class; struct class *class; const struct attribute_group **groups; void (*release)(struct device *); struct iommu_group *iommu_group; bool offline_disabled; bool offline; } ;
795 struct wakeup_source { const char *name; struct list_head entry; spinlock_t lock; struct timer_list timer; unsigned long timer_expires; ktime_t total_time; ktime_t max_time; ktime_t last_time; ktime_t start_prevent_time; ktime_t prevent_sleep_time; unsigned long event_count; unsigned long active_count; unsigned long relax_count; unsigned long expire_count; unsigned long wakeup_count; bool active; bool autosleep_enabled; } ;
93 struct shrink_control { gfp_t gfp_mask; unsigned long nr_to_scan; nodemask_t nodes_to_scan; int nid; } ;
26 struct shrinker { unsigned long int (*count_objects)(struct shrinker *, struct shrink_control *); unsigned long int (*scan_objects)(struct shrinker *, struct shrink_control *); int seeks; long batch; unsigned long flags; struct list_head list; atomic_long_t *nr_deferred; } ;
71 struct file_ra_state ;
72 struct user_struct ;
73 struct writeback_control ;
185 struct vm_fault { unsigned int flags; unsigned long pgoff; void *virtual_address; struct page *page; } ;
210 struct vm_operations_struct { void (*open)(struct vm_area_struct *); void (*close)(struct vm_area_struct *); int (*fault)(struct vm_area_struct *, struct vm_fault *); int (*page_mkwrite)(struct vm_area_struct *, struct vm_fault *); int (*access)(struct vm_area_struct *, unsigned long, void *, int, int); int (*set_policy)(struct vm_area_struct *, struct mempolicy *); struct mempolicy * (*get_policy)(struct vm_area_struct *, unsigned long); int (*migrate)(struct vm_area_struct *, const nodemask_t *, const nodemask_t *, unsigned long); int (*remap_pages)(struct vm_area_struct *, unsigned long, unsigned long, unsigned long); } ;
2071 struct scatterlist { unsigned long sg_magic; unsigned long page_link; unsigned int offset; unsigned int length; dma_addr_t dma_address; unsigned int dma_length; } ;
17 struct sg_table { struct scatterlist *sgl; unsigned int nents; unsigned int orig_nents; } ;
38 typedef s32 dma_cookie_t;
1156 struct timerqueue_node { struct rb_node node; ktime_t expires; } ;
12 struct timerqueue_head { struct rb_root head; struct timerqueue_node *next; } ;
50 struct hrtimer_clock_base ;
51 struct hrtimer_cpu_base ;
60 enum hrtimer_restart { HRTIMER_NORESTART = 0, HRTIMER_RESTART = 1 } ;
65 struct hrtimer { struct timerqueue_node node; ktime_t _softexpires; enum hrtimer_restart (*function)(struct hrtimer *); struct hrtimer_clock_base *base; unsigned long state; int start_pid; void *start_site; char start_comm[16U]; } ;
132 struct hrtimer_clock_base { struct hrtimer_cpu_base *cpu_base; int index; clockid_t clockid; struct timerqueue_head active; ktime_t resolution; ktime_t (*get_time)(); ktime_t softirq_time; ktime_t offset; } ;
163 struct hrtimer_cpu_base { raw_spinlock_t lock; unsigned int active_bases; unsigned int clock_was_set; ktime_t expires_next; int hres_active; int hang_detected; unsigned long nr_events; unsigned long nr_retries; unsigned long nr_hangs; ktime_t max_hang_time; struct hrtimer_clock_base clock_base[4U]; } ;
474 struct dma_attrs { unsigned long flags[1U]; } ;
70 struct dma_map_ops { void * (*alloc)(struct device *, size_t , dma_addr_t *, gfp_t , struct dma_attrs *); void (*free)(struct device *, size_t , void *, dma_addr_t , struct dma_attrs *); int (*mmap)(struct device *, struct vm_area_struct *, void *, dma_addr_t , size_t , struct dma_attrs *); int (*get_sgtable)(struct device *, struct sg_table *, void *, dma_addr_t , size_t , struct dma_attrs *); dma_addr_t (*map_page)(struct device *, struct page *, unsigned long, size_t , enum dma_data_direction , struct dma_attrs *); void (*unmap_page)(struct device *, dma_addr_t , size_t , enum dma_data_direction , struct dma_attrs *); int (*map_sg)(struct device *, struct scatterlist *, int, enum dma_data_direction , struct dma_attrs *); void (*unmap_sg)(struct device *, struct scatterlist *, int, enum dma_data_direction , struct dma_attrs *); void (*sync_single_for_cpu)(struct device *, dma_addr_t , size_t , enum dma_data_direction ); void (*sync_single_for_device)(struct device *, dma_addr_t , size_t , enum dma_data_direction ); void (*sync_sg_for_cpu)(struct device *, struct scatterlist *, int, enum dma_data_direction ); void (*sync_sg_for_device)(struct device *, struct scatterlist *, int, enum dma_data_direction ); int (*mapping_error)(struct device *, dma_addr_t ); int (*dma_supported)(struct device *, u64 ); int (*set_dma_mask)(struct device *, u64 ); int is_phys; } ;
15 typedef u64 netdev_features_t;
18 struct nf_conntrack { atomic_t use; } ;
136 struct nf_bridge_info { atomic_t use; unsigned int mask; struct net_device *physindev; struct net_device *physoutdev; unsigned long data[4U]; } ;
146 struct sk_buff_head { struct sk_buff *next; struct sk_buff *prev; __u32 qlen; spinlock_t lock; } ;
354 typedef unsigned int sk_buff_data_t;
355 struct sec_path ;
355 struct __anonstruct____missing_field_name_156 { __u16 csum_start; __u16 csum_offset; } ;
355 union __anonunion____missing_field_name_155 { __wsum csum; struct __anonstruct____missing_field_name_156 __annonCompField51; } ;
355 union __anonunion____missing_field_name_157 { unsigned int napi_id; dma_cookie_t dma_cookie; } ;
355 union __anonunion____missing_field_name_158 { __u32 mark; __u32 dropcount; __u32 reserved_tailroom; } ;
355 struct sk_buff { struct sk_buff *next; struct sk_buff *prev; ktime_t tstamp; struct sock *sk; struct net_device *dev; char cb[48U]; unsigned long _skb_refdst; struct sec_path *sp; unsigned int len; unsigned int data_len; __u16 mac_len; __u16 hdr_len; union __anonunion____missing_field_name_155 __annonCompField52; __u32 priority; unsigned char local_df; unsigned char cloned; unsigned char ip_summed; unsigned char nohdr; unsigned char nfctinfo; unsigned char pkt_type; unsigned char fclone; unsigned char ipvs_property; unsigned char peeked; unsigned char nf_trace; __be16 protocol; void (*destructor)(struct sk_buff *); struct nf_conntrack *nfct; struct nf_bridge_info *nf_bridge; int skb_iif; __u32 rxhash; __be16 vlan_proto; __u16 vlan_tci; __u16 tc_index; __u16 tc_verd; __u16 queue_mapping; unsigned char ndisc_nodetype; unsigned char pfmemalloc; unsigned char ooo_okay; unsigned char l4_rxhash; unsigned char wifi_acked_valid; unsigned char wifi_acked; unsigned char no_fcs; unsigned char head_frag; unsigned char encapsulation; union __anonunion____missing_field_name_157 __annonCompField53; __u32 secmark; union __anonunion____missing_field_name_158 __annonCompField54; __be16 inner_protocol; __u16 inner_transport_header; __u16 inner_network_header; __u16 inner_mac_header; __u16 transport_header; __u16 network_header; __u16 mac_header; sk_buff_data_t tail; sk_buff_data_t end; unsigned char *head; unsigned char *data; unsigned int truesize; atomic_t users; } ;
578 struct dst_entry ;
646 struct rtable ;
2939 struct plist_head { struct list_head node_list; } ;
84 struct plist_node { int prio; struct list_head prio_list; struct list_head node_list; } ;
83 struct pm_qos_request { struct plist_node node; int pm_qos_class; struct delayed_work work; } ;
45 struct pm_qos_flags_request { struct list_head node; s32 flags; } ;
50 enum dev_pm_qos_req_type { DEV_PM_QOS_LATENCY = 1, DEV_PM_QOS_FLAGS = 2 } ;
55 union __anonunion_data_159 { struct plist_node pnode; struct pm_qos_flags_request flr; } ;
55 struct dev_pm_qos_request { enum dev_pm_qos_req_type type; union __anonunion_data_159 data; struct device *dev; } ;
64 enum pm_qos_type { PM_QOS_UNITIALIZED = 0, PM_QOS_MAX = 1, PM_QOS_MIN = 2 } ;
70 struct pm_qos_constraints { struct plist_head list; s32 target_value; s32 default_value; enum pm_qos_type type; struct blocking_notifier_head *notifiers; } ;
83 struct pm_qos_flags { struct list_head list; s32 effective_flags; } ;
88 struct dev_pm_qos { struct pm_qos_constraints latency; struct pm_qos_flags flags; struct dev_pm_qos_request *latency_req; struct dev_pm_qos_request *flags_req; } ;
460 struct dql { unsigned int num_queued; unsigned int adj_limit; unsigned int last_obj_cnt; unsigned int limit; unsigned int num_completed; unsigned int prev_ovlimit; unsigned int prev_num_queued; unsigned int prev_last_obj_cnt; unsigned int lowest_slack; unsigned long slack_start_time; unsigned int max_limit; unsigned int min_limit; unsigned int slack_hold_time; } ;
25 struct sem_undo_list ;
25 struct sysv_sem { struct sem_undo_list *undo_list; } ;
43 struct __anonstruct_sync_serial_settings_160 { unsigned int clock_rate; unsigned int clock_type; unsigned short loopback; } ;
43 typedef struct __anonstruct_sync_serial_settings_160 sync_serial_settings;
50 struct __anonstruct_te1_settings_161 { unsigned int clock_rate; unsigned int clock_type; unsigned short loopback; unsigned int slot_map; } ;
50 typedef struct __anonstruct_te1_settings_161 te1_settings;
55 struct __anonstruct_raw_hdlc_proto_162 { unsigned short encoding; unsigned short parity; } ;
55 typedef struct __anonstruct_raw_hdlc_proto_162 raw_hdlc_proto;
65 struct __anonstruct_fr_proto_163 { unsigned int t391; unsigned int t392; unsigned int n391; unsigned int n392; unsigned int n393; unsigned short lmi; unsigned short dce; } ;
65 typedef struct __anonstruct_fr_proto_163 fr_proto;
69 struct __anonstruct_fr_proto_pvc_164 { unsigned int dlci; } ;
69 typedef struct __anonstruct_fr_proto_pvc_164 fr_proto_pvc;
74 struct __anonstruct_fr_proto_pvc_info_165 { unsigned int dlci; char master[16U]; } ;
74 typedef struct __anonstruct_fr_proto_pvc_info_165 fr_proto_pvc_info;
79 struct __anonstruct_cisco_proto_166 { unsigned int interval; unsigned int timeout; } ;
79 typedef struct __anonstruct_cisco_proto_166 cisco_proto;
95 struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; } ;
151 union __anonunion_ifs_ifsu_167 { raw_hdlc_proto *raw_hdlc; cisco_proto *cisco; fr_proto *fr; fr_proto_pvc *fr_pvc; fr_proto_pvc_info *fr_pvc_info; sync_serial_settings *sync; te1_settings *te1; } ;
151 struct if_settings { unsigned int type; unsigned int size; union __anonunion_ifs_ifsu_167 ifs_ifsu; } ;
169 union __anonunion_ifr_ifrn_168 { char ifrn_name[16U]; } ;
169 union __anonunion_ifr_ifru_169 { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[16U]; char ifru_newname[16U]; void *ifru_data; struct if_settings ifru_settings; } ;
169 struct ifreq { union __anonunion_ifr_ifrn_168 ifr_ifrn; union __anonunion_ifr_ifru_169 ifr_ifru; } ;
91 struct hlist_bl_node ;
91 struct hlist_bl_head { struct hlist_bl_node *first; } ;
36 struct hlist_bl_node { struct hlist_bl_node *next; struct hlist_bl_node **pprev; } ;
114 struct __anonstruct____missing_field_name_172 { spinlock_t lock; unsigned int count; } ;
114 union __anonunion____missing_field_name_171 { struct __anonstruct____missing_field_name_172 __annonCompField55; } ;
114 struct lockref { union __anonunion____missing_field_name_171 __annonCompField56; } ;
49 struct nameidata ;
50 struct vfsmount ;
51 struct __anonstruct____missing_field_name_174 { u32 hash; u32 len; } ;
51 union __anonunion____missing_field_name_173 { struct __anonstruct____missing_field_name_174 __annonCompField57; u64 hash_len; } ;
51 struct qstr { union __anonunion____missing_field_name_173 __annonCompField58; const unsigned char *name; } ;
90 struct dentry_operations ;
90 union __anonunion_d_u_175 { struct list_head d_child; struct callback_head d_rcu; } ;
90 struct dentry { unsigned int d_flags; seqcount_t d_seq; struct hlist_bl_node d_hash; struct dentry *d_parent; struct qstr d_name; struct inode *d_inode; unsigned char d_iname[32U]; struct lockref d_lockref; const struct dentry_operations *d_op; struct super_block *d_sb; unsigned long d_time; void *d_fsdata; struct list_head d_lru; union __anonunion_d_u_175 d_u; struct list_head d_subdirs; struct hlist_node d_alias; } ;
142 struct dentry_operations { int (*d_revalidate)(struct dentry *, unsigned int); int (*d_weak_revalidate)(struct dentry *, unsigned int); int (*d_hash)(const struct dentry *, struct qstr *); int (*d_compare)(const struct dentry *, const struct dentry *, unsigned int, const char *, const struct qstr *); int (*d_delete)(const struct dentry *); void (*d_release)(struct dentry *); void (*d_prune)(struct dentry *); void (*d_iput)(struct dentry *, struct inode *); char * (*d_dname)(struct dentry *, char *, int); struct vfsmount * (*d_automount)(struct path *); int (*d_manage)(struct dentry *, bool ); } ;
469 struct path { struct vfsmount *mnt; struct dentry *dentry; } ;
26 struct list_lru_node { spinlock_t lock; struct list_head list; long nr_items; } ;
28 struct list_lru { struct list_lru_node *node; nodemask_t active_nodes; } ;
58 struct radix_tree_node ;
58 struct radix_tree_root { unsigned int height; gfp_t gfp_mask; struct radix_tree_node *rnode; } ;
381 enum pid_type { PIDTYPE_PID = 0, PIDTYPE_PGID = 1, PIDTYPE_SID = 2, PIDTYPE_MAX = 3 } ;
388 struct pid_namespace ;
388 struct upid { int nr; struct pid_namespace *ns; struct hlist_node pid_chain; } ;
56 struct pid { atomic_t count; unsigned int level; struct hlist_head tasks[3U]; struct callback_head rcu; struct upid numbers[1U]; } ;
68 struct pid_link { struct hlist_node node; struct pid *pid; } ;
22 struct kernel_cap_struct { __u32 cap[2U]; } ;
25 typedef struct kernel_cap_struct kernel_cap_t;
45 struct fiemap_extent { __u64 fe_logical; __u64 fe_physical; __u64 fe_length; __u64 fe_reserved64[2U]; __u32 fe_flags; __u32 fe_reserved[3U]; } ;
38 enum migrate_mode { MIGRATE_ASYNC = 0, MIGRATE_SYNC_LIGHT = 1, MIGRATE_SYNC = 2 } ;
30 struct block_device ;
31 struct io_context ;
32 struct cgroup_subsys_state ;
56 struct export_operations ;
58 struct kstatfs ;
59 struct swap_info_struct ;
68 struct iattr { unsigned int ia_valid; umode_t ia_mode; kuid_t ia_uid; kgid_t ia_gid; loff_t ia_size; struct timespec ia_atime; struct timespec ia_mtime; struct timespec ia_ctime; struct file *ia_file; } ;
246 struct percpu_counter { raw_spinlock_t lock; s64 count; struct list_head list; s32 *counters; } ;
176 struct fs_disk_quota { __s8 d_version; __s8 d_flags; __u16 d_fieldmask; __u32 d_id; __u64 d_blk_hardlimit; __u64 d_blk_softlimit; __u64 d_ino_hardlimit; __u64 d_ino_softlimit; __u64 d_bcount; __u64 d_icount; __s32 d_itimer; __s32 d_btimer; __u16 d_iwarns; __u16 d_bwarns; __s32 d_padding2; __u64 d_rtb_hardlimit; __u64 d_rtb_softlimit; __u64 d_rtbcount; __s32 d_rtbtimer; __u16 d_rtbwarns; __s16 d_padding3; char d_padding4[8U]; } ;
76 struct fs_qfilestat { __u64 qfs_ino; __u64 qfs_nblks; __u32 qfs_nextents; } ;
151 typedef struct fs_qfilestat fs_qfilestat_t;
152 struct fs_quota_stat { __s8 qs_version; __u16 qs_flags; __s8 qs_pad; fs_qfilestat_t qs_uquota; fs_qfilestat_t qs_gquota; __u32 qs_incoredqs; __s32 qs_btimelimit; __s32 qs_itimelimit; __s32 qs_rtbtimelimit; __u16 qs_bwarnlimit; __u16 qs_iwarnlimit; } ;
166 struct fs_qfilestatv { __u64 qfs_ino; __u64 qfs_nblks; __u32 qfs_nextents; __u32 qfs_pad; } ;
196 struct fs_quota_statv { __s8 qs_version; __u8 qs_pad1; __u16 qs_flags; __u32 qs_incoredqs; struct fs_qfilestatv qs_uquota; struct fs_qfilestatv qs_gquota; struct fs_qfilestatv qs_pquota; __s32 qs_btimelimit; __s32 qs_itimelimit; __s32 qs_rtbtimelimit; __u16 qs_bwarnlimit; __u16 qs_iwarnlimit; __u64 qs_pad2[8U]; } ;
212 struct dquot ;
19 typedef __kernel_uid32_t projid_t;
23 struct __anonstruct_kprojid_t_177 { projid_t val; } ;
23 typedef struct __anonstruct_kprojid_t_177 kprojid_t;
119 struct if_dqinfo { __u64 dqi_bgrace; __u64 dqi_igrace; __u32 dqi_flags; __u32 dqi_valid; } ;
152 enum quota_type { USRQUOTA = 0, GRPQUOTA = 1, PRJQUOTA = 2 } ;
60 typedef long long qsize_t;
61 union __anonunion____missing_field_name_178 { kuid_t uid; kgid_t gid; kprojid_t projid; } ;
61 struct kqid { union __anonunion____missing_field_name_178 __annonCompField59; enum quota_type type; } ;
178 struct mem_dqblk { qsize_t dqb_bhardlimit; qsize_t dqb_bsoftlimit; qsize_t dqb_curspace; qsize_t dqb_rsvspace; qsize_t dqb_ihardlimit; qsize_t dqb_isoftlimit; qsize_t dqb_curinodes; time_t dqb_btime; time_t dqb_itime; } ;
200 struct quota_format_type ;
201 struct mem_dqinfo { struct quota_format_type *dqi_format; int dqi_fmt_id; struct list_head dqi_dirty_list; unsigned long dqi_flags; unsigned int dqi_bgrace; unsigned int dqi_igrace; qsize_t dqi_maxblimit; qsize_t dqi_maxilimit; void *dqi_priv; } ;
264 struct dquot { struct hlist_node dq_hash; struct list_head dq_inuse; struct list_head dq_free; struct list_head dq_dirty; struct mutex dq_lock; atomic_t dq_count; wait_queue_head_t dq_wait_unused; struct super_block *dq_sb; struct kqid dq_id; loff_t dq_off; unsigned long dq_flags; struct mem_dqblk dq_dqb; } ;
291 struct quota_format_ops { int (*check_quota_file)(struct super_block *, int); int (*read_file_info)(struct super_block *, int); int (*write_file_info)(struct super_block *, int); int (*free_file_info)(struct super_block *, int); int (*read_dqblk)(struct dquot *); int (*commit_dqblk)(struct dquot *); int (*release_dqblk)(struct dquot *); } ;
302 struct dquot_operations { int (*write_dquot)(struct dquot *); struct dquot * (*alloc_dquot)(struct super_block *, int); void (*destroy_dquot)(struct dquot *); int (*acquire_dquot)(struct dquot *); int (*release_dquot)(struct dquot *); int (*mark_dirty)(struct dquot *); int (*write_info)(struct super_block *, int); qsize_t * (*get_reserved_space)(struct inode *); } ;
316 struct quotactl_ops { int (*quota_on)(struct super_block *, int, int, struct path *); int (*quota_on_meta)(struct super_block *, int, int); int (*quota_off)(struct super_block *, int); int (*quota_sync)(struct super_block *, int); int (*get_info)(struct super_block *, int, struct if_dqinfo *); int (*set_info)(struct super_block *, int, struct if_dqinfo *); int (*get_dqblk)(struct super_block *, struct kqid , struct fs_disk_quota *); int (*set_dqblk)(struct super_block *, struct kqid , struct fs_disk_quota *); int (*get_xstate)(struct super_block *, struct fs_quota_stat *); int (*set_xstate)(struct super_block *, unsigned int, int); int (*get_xstatev)(struct super_block *, struct fs_quota_statv *); } ;
333 struct quota_format_type { int qf_fmt_id; const struct quota_format_ops *qf_ops; struct module *qf_owner; struct quota_format_type *qf_next; } ;
379 struct quota_info { unsigned int flags; struct mutex dqio_mutex; struct mutex dqonoff_mutex; struct rw_semaphore dqptr_sem; struct inode *files[2U]; struct mem_dqinfo info[2U]; const struct quota_format_ops *ops[2U]; } ;
345 union __anonunion_arg_180 { char *buf; void *data; } ;
345 struct __anonstruct_read_descriptor_t_179 { size_t written; size_t count; union __anonunion_arg_180 arg; int error; } ;
345 typedef struct __anonstruct_read_descriptor_t_179 read_descriptor_t;
348 struct address_space_operations { int (*writepage)(struct page *, struct writeback_control *); int (*readpage)(struct file *, struct page *); int (*writepages)(struct address_space *, struct writeback_control *); int (*set_page_dirty)(struct page *); int (*readpages)(struct file *, struct address_space *, struct list_head *, unsigned int); int (*write_begin)(struct file *, struct address_space *, loff_t , unsigned int, unsigned int, struct page **, void **); int (*write_end)(struct file *, struct address_space *, loff_t , unsigned int, unsigned int, struct page *, void *); sector_t (*bmap)(struct address_space *, sector_t ); void (*invalidatepage)(struct page *, unsigned int, unsigned int); int (*releasepage)(struct page *, gfp_t ); void (*freepage)(struct page *); ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *, loff_t , unsigned long); int (*get_xip_mem)(struct address_space *, unsigned long, int, void **, unsigned long *); int (*migratepage)(struct address_space *, struct page *, struct page *, enum migrate_mode ); int (*launder_page)(struct page *); int (*is_partially_uptodate)(struct page *, read_descriptor_t *, unsigned long); void (*is_dirty_writeback)(struct page *, bool *, bool *); int (*error_remove_page)(struct address_space *, struct page *); int (*swap_activate)(struct swap_info_struct *, struct file *, sector_t *); void (*swap_deactivate)(struct file *); } ;
408 struct backing_dev_info ;
409 struct address_space { struct inode *host; struct radix_tree_root page_tree; spinlock_t tree_lock; unsigned int i_mmap_writable; struct rb_root i_mmap; struct list_head i_mmap_nonlinear; struct mutex i_mmap_mutex; unsigned long nrpages; unsigned long writeback_index; const struct address_space_operations *a_ops; unsigned long flags; struct backing_dev_info *backing_dev_info; spinlock_t private_lock; struct list_head private_list; void *private_data; } ;
430 struct request_queue ;
431 struct hd_struct ;
431 struct gendisk ;
431 struct block_device { dev_t bd_dev; int bd_openers; struct inode *bd_inode; struct super_block *bd_super; struct mutex bd_mutex; struct list_head bd_inodes; void *bd_claiming; void *bd_holder; int bd_holders; bool bd_write_holder; struct list_head bd_holder_disks; struct block_device *bd_contains; unsigned int bd_block_size; struct hd_struct *bd_part; unsigned int bd_part_count; int bd_invalidated; struct gendisk *bd_disk; struct request_queue *bd_queue; struct list_head bd_list; unsigned long bd_private; int bd_fsfreeze_count; struct mutex bd_fsfreeze_mutex; } ;
503 struct posix_acl ;
504 struct inode_operations ;
504 union __anonunion____missing_field_name_181 { const unsigned int i_nlink; unsigned int __i_nlink; } ;
504 union __anonunion____missing_field_name_182 { struct hlist_head i_dentry; struct callback_head i_rcu; } ;
504 struct file_lock ;
504 struct cdev ;
504 union __anonunion____missing_field_name_183 { struct pipe_inode_info *i_pipe; struct block_device *i_bdev; struct cdev *i_cdev; } ;
504 struct inode { umode_t i_mode; unsigned short i_opflags; kuid_t i_uid; kgid_t i_gid; unsigned int i_flags; struct posix_acl *i_acl; struct posix_acl *i_default_acl; const struct inode_operations *i_op; struct super_block *i_sb; struct address_space *i_mapping; void *i_security; unsigned long i_ino; union __anonunion____missing_field_name_181 __annonCompField60; dev_t i_rdev; loff_t i_size; struct timespec i_atime; struct timespec i_mtime; struct timespec i_ctime; spinlock_t i_lock; unsigned short i_bytes; unsigned int i_blkbits; blkcnt_t i_blocks; unsigned long i_state; struct mutex i_mutex; unsigned long dirtied_when; struct hlist_node i_hash; struct list_head i_wb_list; struct list_head i_lru; struct list_head i_sb_list; union __anonunion____missing_field_name_182 __annonCompField61; u64 i_version; atomic_t i_count; atomic_t i_dio_count; atomic_t i_writecount; const struct file_operations *i_fop; struct file_lock *i_flock; struct address_space i_data; struct dquot *i_dquot[2U]; struct list_head i_devices; union __anonunion____missing_field_name_183 __annonCompField62; __u32 i_generation; __u32 i_fsnotify_mask; struct hlist_head i_fsnotify_marks; atomic_t i_readcount; void *i_private; } ;
740 struct fown_struct { rwlock_t lock; struct pid *pid; enum pid_type pid_type; kuid_t uid; kuid_t euid; int signum; } ;
748 struct file_ra_state { unsigned long start; unsigned int size; unsigned int async_size; unsigned int ra_pages; unsigned int mmap_miss; loff_t prev_pos; } ;
771 union __anonunion_f_u_184 { struct llist_node fu_llist; struct callback_head fu_rcuhead; } ;
771 struct file { union __anonunion_f_u_184 f_u; struct path f_path; struct inode *f_inode; const struct file_operations *f_op; spinlock_t f_lock; atomic_long_t f_count; unsigned int f_flags; fmode_t f_mode; struct mutex f_pos_lock; loff_t f_pos; struct fown_struct f_owner; const struct cred *f_cred; struct file_ra_state f_ra; u64 f_version; void *f_security; void *private_data; struct list_head f_ep_links; struct list_head f_tfile_llink; struct address_space *f_mapping; unsigned long f_mnt_write_state; } ;
909 struct files_struct ;
909 typedef struct files_struct *fl_owner_t;
910 struct file_lock_operations { void (*fl_copy_lock)(struct file_lock *, struct file_lock *); void (*fl_release_private)(struct file_lock *); } ;
915 struct lock_manager_operations { int (*lm_compare_owner)(struct file_lock *, struct file_lock *); unsigned long int (*lm_owner_key)(struct file_lock *); void (*lm_notify)(struct file_lock *); int (*lm_grant)(struct file_lock *, struct file_lock *, int); void (*lm_break)(struct file_lock *); int (*lm_change)(struct file_lock **, int); } ;
933 struct nlm_lockowner ;
934 struct nfs_lock_info { u32 state; struct nlm_lockowner *owner; struct list_head list; } ;
14 struct nfs4_lock_state ;
15 struct nfs4_lock_info { struct nfs4_lock_state *owner; } ;
19 struct __anonstruct_afs_186 { struct list_head link; int state; } ;
19 union __anonunion_fl_u_185 { struct nfs_lock_info nfs_fl; struct nfs4_lock_info nfs4_fl; struct __anonstruct_afs_186 afs; } ;
19 struct file_lock { struct file_lock *fl_next; struct hlist_node fl_link; struct list_head fl_block; fl_owner_t fl_owner; unsigned int fl_flags; unsigned char fl_type; unsigned int fl_pid; int fl_link_cpu; struct pid *fl_nspid; wait_queue_head_t fl_wait; struct file *fl_file; loff_t fl_start; loff_t fl_end; struct fasync_struct *fl_fasync; unsigned long fl_break_time; unsigned long fl_downgrade_time; const struct file_lock_operations *fl_ops; const struct lock_manager_operations *fl_lmops; union __anonunion_fl_u_185 fl_u; } ;
1036 struct fasync_struct { spinlock_t fa_lock; int magic; int fa_fd; struct fasync_struct *fa_next; struct file *fa_file; struct callback_head fa_rcu; } ;
1228 struct sb_writers { struct percpu_counter counter[3U]; wait_queue_head_t wait; int frozen; wait_queue_head_t wait_unfrozen; struct lockdep_map lock_map[3U]; } ;
1244 struct super_operations ;
1244 struct xattr_handler ;
1244 struct mtd_info ;
1244 struct super_block { struct list_head s_list; dev_t s_dev; unsigned char s_blocksize_bits; unsigned long s_blocksize; loff_t s_maxbytes; struct file_system_type *s_type; const struct super_operations *s_op; const struct dquot_operations *dq_op; const struct quotactl_ops *s_qcop; const struct export_operations *s_export_op; unsigned long s_flags; unsigned long s_magic; struct dentry *s_root; struct rw_semaphore s_umount; int s_count; atomic_t s_active; void *s_security; const struct xattr_handler **s_xattr; struct list_head s_inodes; struct hlist_bl_head s_anon; struct list_head s_mounts; struct block_device *s_bdev; struct backing_dev_info *s_bdi; struct mtd_info *s_mtd; struct hlist_node s_instances; struct quota_info s_dquot; struct sb_writers s_writers; char s_id[32U]; u8 s_uuid[16U]; void *s_fs_info; unsigned int s_max_links; fmode_t s_mode; u32 s_time_gran; struct mutex s_vfs_rename_mutex; char *s_subtype; char *s_options; const struct dentry_operations *s_d_op; int cleancache_poolid; struct shrinker s_shrink; atomic_long_t s_remove_count; int s_readonly_remount; struct workqueue_struct *s_dio_done_wq; struct list_lru s_dentry_lru; struct list_lru s_inode_lru; struct callback_head rcu; } ;
1474 struct fiemap_extent_info { unsigned int fi_flags; unsigned int fi_extents_mapped; unsigned int fi_extents_max; struct fiemap_extent *fi_extents_start; } ;
1512 struct dir_context { int (*actor)(void *, const char *, int, loff_t , u64 , unsigned int); loff_t pos; } ;
1517 struct file_operations { struct module *owner; loff_t (*llseek)(struct file *, loff_t , int); ssize_t (*read)(struct file *, char *, size_t , loff_t *); ssize_t (*write)(struct file *, const char *, size_t , loff_t *); ssize_t (*aio_read)(struct kiocb *, const struct iovec *, unsigned long, loff_t ); ssize_t (*aio_write)(struct kiocb *, const struct iovec *, unsigned long, loff_t ); int (*iterate)(struct file *, struct dir_context *); unsigned int (*poll)(struct file *, struct poll_table_struct *); long int (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); long int (*compat_ioctl)(struct file *, unsigned int, unsigned long); int (*mmap)(struct file *, struct vm_area_struct *); int (*open)(struct inode *, struct file *); int (*flush)(struct file *, fl_owner_t ); int (*release)(struct inode *, struct file *); int (*fsync)(struct file *, loff_t , loff_t , int); int (*aio_fsync)(struct kiocb *, int); int (*fasync)(int, struct file *, int); int (*lock)(struct file *, int, struct file_lock *); ssize_t (*sendpage)(struct file *, struct page *, int, size_t , loff_t *, int); unsigned long int (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); int (*check_flags)(int); int (*flock)(struct file *, int, struct file_lock *); ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t , unsigned int); ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t , unsigned int); int (*setlease)(struct file *, long, struct file_lock **); long int (*fallocate)(struct file *, int, loff_t , loff_t ); int (*show_fdinfo)(struct seq_file *, struct file *); } ;
1555 struct inode_operations { struct dentry * (*lookup)(struct inode *, struct dentry *, unsigned int); void * (*follow_link)(struct dentry *, struct nameidata *); int (*permission)(struct inode *, int); struct posix_acl * (*get_acl)(struct inode *, int); int (*readlink)(struct dentry *, char *, int); void (*put_link)(struct dentry *, struct nameidata *, void *); int (*create)(struct inode *, struct dentry *, umode_t , bool ); int (*link)(struct dentry *, struct inode *, struct dentry *); int (*unlink)(struct inode *, struct dentry *); int (*symlink)(struct inode *, struct dentry *, const char *); int (*mkdir)(struct inode *, struct dentry *, umode_t ); int (*rmdir)(struct inode *, struct dentry *); int (*mknod)(struct inode *, struct dentry *, umode_t , dev_t ); int (*rename)(struct inode *, struct dentry *, struct inode *, struct dentry *); int (*setattr)(struct dentry *, struct iattr *); int (*getattr)(struct vfsmount *, struct dentry *, struct kstat *); int (*setxattr)(struct dentry *, const char *, const void *, size_t , int); ssize_t (*getxattr)(struct dentry *, const char *, void *, size_t ); ssize_t (*listxattr)(struct dentry *, char *, size_t ); int (*removexattr)(struct dentry *, const char *); int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 , u64 ); int (*update_time)(struct inode *, struct timespec *, int); int (*atomic_open)(struct inode *, struct dentry *, struct file *, unsigned int, umode_t , int *); int (*tmpfile)(struct inode *, struct dentry *, umode_t ); int (*set_acl)(struct inode *, struct posix_acl *, int); } ;
1600 struct super_operations { struct inode * (*alloc_inode)(struct super_block *); void (*destroy_inode)(struct inode *); void (*dirty_inode)(struct inode *, int); int (*write_inode)(struct inode *, struct writeback_control *); int (*drop_inode)(struct inode *); void (*evict_inode)(struct inode *); void (*put_super)(struct super_block *); int (*sync_fs)(struct super_block *, int); int (*freeze_fs)(struct super_block *); int (*unfreeze_fs)(struct super_block *); int (*statfs)(struct dentry *, struct kstatfs *); int (*remount_fs)(struct super_block *, int *, char *); void (*umount_begin)(struct super_block *); int (*show_options)(struct seq_file *, struct dentry *); int (*show_devname)(struct seq_file *, struct dentry *); int (*show_path)(struct seq_file *, struct dentry *); int (*show_stats)(struct seq_file *, struct dentry *); ssize_t (*quota_read)(struct super_block *, int, char *, size_t , loff_t ); ssize_t (*quota_write)(struct super_block *, int, const char *, size_t , loff_t ); int (*bdev_try_to_free_page)(struct super_block *, struct page *, gfp_t ); long int (*nr_cached_objects)(struct super_block *, int); long int (*free_cached_objects)(struct super_block *, long, int); } ;
1814 struct file_system_type { const char *name; int fs_flags; struct dentry * (*mount)(struct file_system_type *, int, const char *, void *); void (*kill_sb)(struct super_block *); struct module *owner; struct file_system_type *next; struct hlist_head fs_supers; struct lock_class_key s_lock_key; struct lock_class_key s_umount_key; struct lock_class_key s_vfs_rename_key; struct lock_class_key s_writers_key[3U]; struct lock_class_key i_lock_key; struct lock_class_key i_mutex_key; struct lock_class_key i_mutex_dir_key; } ;
4 typedef unsigned long cputime_t;
24 struct __anonstruct_sigset_t_187 { unsigned long sig[1U]; } ;
24 typedef struct __anonstruct_sigset_t_187 sigset_t;
25 struct siginfo ;
17 typedef void __signalfn_t(int);
18 typedef __signalfn_t *__sighandler_t;
20 typedef void __restorefn_t();
21 typedef __restorefn_t *__sigrestore_t;
34 union sigval { int sival_int; void *sival_ptr; } ;
10 typedef union sigval sigval_t;
11 struct __anonstruct__kill_189 { __kernel_pid_t _pid; __kernel_uid32_t _uid; } ;
11 struct __anonstruct__timer_190 { __kernel_timer_t _tid; int _overrun; char _pad[0U]; sigval_t _sigval; int _sys_private; } ;
11 struct __anonstruct__rt_191 { __kernel_pid_t _pid; __kernel_uid32_t _uid; sigval_t _sigval; } ;
11 struct __anonstruct__sigchld_192 { __kernel_pid_t _pid; __kernel_uid32_t _uid; int _status; __kernel_clock_t _utime; __kernel_clock_t _stime; } ;
11 struct __anonstruct__sigfault_193 { void *_addr; short _addr_lsb; } ;
11 struct __anonstruct__sigpoll_194 { long _band; int _fd; } ;
11 struct __anonstruct__sigsys_195 { void *_call_addr; int _syscall; unsigned int _arch; } ;
11 union __anonunion__sifields_188 { int _pad[28U]; struct __anonstruct__kill_189 _kill; struct __anonstruct__timer_190 _timer; struct __anonstruct__rt_191 _rt; struct __anonstruct__sigchld_192 _sigchld; struct __anonstruct__sigfault_193 _sigfault; struct __anonstruct__sigpoll_194 _sigpoll; struct __anonstruct__sigsys_195 _sigsys; } ;
11 struct siginfo { int si_signo; int si_errno; int si_code; union __anonunion__sifields_188 _sifields; } ;
109 typedef struct siginfo siginfo_t;
21 struct sigpending { struct list_head list; sigset_t signal; } ;
251 struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; __sigrestore_t sa_restorer; sigset_t sa_mask; } ;
265 struct k_sigaction { struct sigaction sa; } ;
46 struct seccomp_filter ;
47 struct seccomp { int mode; struct seccomp_filter *filter; } ;
40 struct rt_mutex_waiter ;
41 struct rlimit { __kernel_ulong_t rlim_cur; __kernel_ulong_t rlim_max; } ;
11 struct task_io_accounting { u64 rchar; u64 wchar; u64 syscr; u64 syscw; u64 read_bytes; u64 write_bytes; u64 cancelled_write_bytes; } ;
45 struct latency_record { unsigned long backtrace[12U]; unsigned int count; unsigned long time; unsigned long max; } ;
835 struct nsproxy ;
836 struct ctl_table_root ;
837 struct ctl_table_header ;
838 struct ctl_dir ;
39 typedef int proc_handler(struct ctl_table *, int, void *, size_t *, loff_t *);
59 struct ctl_table_poll { atomic_t event; wait_queue_head_t wait; } ;
98 struct ctl_table { const char *procname; void *data; int maxlen; umode_t mode; struct ctl_table *child; proc_handler *proc_handler; struct ctl_table_poll *poll; void *extra1; void *extra2; } ;
119 struct ctl_node { struct rb_node node; struct ctl_table_header *header; } ;
124 struct __anonstruct____missing_field_name_199 { struct ctl_table *ctl_table; int used; int count; int nreg; } ;
124 union __anonunion____missing_field_name_198 { struct __anonstruct____missing_field_name_199 __annonCompField63; struct callback_head rcu; } ;
124 struct ctl_table_set ;
124 struct ctl_table_header { union __anonunion____missing_field_name_198 __annonCompField64; struct completion *unregistering; struct ctl_table *ctl_table_arg; struct ctl_table_root *root; struct ctl_table_set *set; struct ctl_dir *parent; struct ctl_node *node; } ;
145 struct ctl_dir { struct ctl_table_header header; struct rb_root root; } ;
151 struct ctl_table_set { int (*is_seen)(struct ctl_table_set *); struct ctl_dir dir; } ;
156 struct ctl_table_root { struct ctl_table_set default_set; struct ctl_table_set * (*lookup)(struct ctl_table_root *, struct nsproxy *); int (*permissions)(struct ctl_table_header *, struct ctl_table *); } ;
193 struct assoc_array_ptr ;
193 struct assoc_array { struct assoc_array_ptr *root; unsigned long nr_leaves_on_tree; } ;
31 typedef int32_t key_serial_t;
34 typedef uint32_t key_perm_t;
35 struct key ;
36 struct signal_struct ;
37 struct key_type ;
41 struct keyring_index_key { struct key_type *type; const char *description; size_t desc_len; } ;
123 union __anonunion____missing_field_name_200 { struct list_head graveyard_link; struct rb_node serial_node; } ;
123 struct key_user ;
123 union __anonunion____missing_field_name_201 { time_t expiry; time_t revoked_at; } ;
123 struct __anonstruct____missing_field_name_203 { struct key_type *type; char *description; } ;
123 union __anonunion____missing_field_name_202 { struct keyring_index_key index_key; struct __anonstruct____missing_field_name_203 __annonCompField67; } ;
123 union __anonunion_type_data_204 { struct list_head link; unsigned long x[2U]; void *p[2U]; int reject_error; } ;
123 union __anonunion_payload_206 { unsigned long value; void *rcudata; void *data; void *data2[2U]; } ;
123 union __anonunion____missing_field_name_205 { union __anonunion_payload_206 payload; struct assoc_array keys; } ;
123 struct key { atomic_t usage; key_serial_t serial; union __anonunion____missing_field_name_200 __annonCompField65; struct rw_semaphore sem; struct key_user *user; void *security; union __anonunion____missing_field_name_201 __annonCompField66; time_t last_used_at; kuid_t uid; kgid_t gid; key_perm_t perm; unsigned short quotalen; unsigned short datalen; unsigned long flags; union __anonunion____missing_field_name_202 __annonCompField68; union __anonunion_type_data_204 type_data; union __anonunion____missing_field_name_205 __annonCompField69; } ;
345 struct audit_context ;
27 struct group_info { atomic_t usage; int ngroups; int nblocks; kgid_t small_block[32U]; kgid_t *blocks[0U]; } ;
78 struct cred { atomic_t usage; atomic_t subscribers; void *put_addr; unsigned int magic; kuid_t uid; kgid_t gid; kuid_t suid; kgid_t sgid; kuid_t euid; kgid_t egid; kuid_t fsuid; kgid_t fsgid; unsigned int securebits; kernel_cap_t cap_inheritable; kernel_cap_t cap_permitted; kernel_cap_t cap_effective; kernel_cap_t cap_bset; unsigned char jit_keyring; struct key *session_keyring; struct key *process_keyring; struct key *thread_keyring; struct key *request_key_auth; void *security; struct user_struct *user; struct user_namespace *user_ns; struct group_info *group_info; struct callback_head rcu; } ;
123 struct futex_pi_state ;
124 struct robust_list_head ;
125 struct bio_list ;
126 struct fs_struct ;
127 struct perf_event_context ;
128 struct blk_plug ;
180 struct cfs_rq ;
181 struct task_group ;
421 struct sighand_struct { atomic_t count; struct k_sigaction action[64U]; spinlock_t siglock; wait_queue_head_t signalfd_wqh; } ;
460 struct pacct_struct { int ac_flag; long ac_exitcode; unsigned long ac_mem; cputime_t ac_utime; cputime_t ac_stime; unsigned long ac_minflt; unsigned long ac_majflt; } ;
468 struct cpu_itimer { cputime_t expires; cputime_t incr; u32 error; u32 incr_error; } ;
475 struct cputime { cputime_t utime; cputime_t stime; } ;
487 struct task_cputime { cputime_t utime; cputime_t stime; unsigned long long sum_exec_runtime; } ;
507 struct thread_group_cputimer { struct task_cputime cputime; int running; raw_spinlock_t lock; } ;
549 struct autogroup ;
550 struct tty_struct ;
550 struct taskstats ;
550 struct tty_audit_buf ;
550 struct signal_struct { atomic_t sigcnt; atomic_t live; int nr_threads; struct list_head thread_head; wait_queue_head_t wait_chldexit; struct task_struct *curr_target; struct sigpending shared_pending; int group_exit_code; int notify_count; struct task_struct *group_exit_task; int group_stop_count; unsigned int flags; unsigned char is_child_subreaper; unsigned char has_child_subreaper; int posix_timer_id; struct list_head posix_timers; struct hrtimer real_timer; struct pid *leader_pid; ktime_t it_real_incr; struct cpu_itimer it[2U]; struct thread_group_cputimer cputimer; struct task_cputime cputime_expires; struct list_head cpu_timers[3U]; struct pid *tty_old_pgrp; int leader; struct tty_struct *tty; struct autogroup *autogroup; cputime_t utime; cputime_t stime; cputime_t cutime; cputime_t cstime; cputime_t gtime; cputime_t cgtime; struct cputime prev_cputime; unsigned long nvcsw; unsigned long nivcsw; unsigned long cnvcsw; unsigned long cnivcsw; unsigned long min_flt; unsigned long maj_flt; unsigned long cmin_flt; unsigned long cmaj_flt; unsigned long inblock; unsigned long oublock; unsigned long cinblock; unsigned long coublock; unsigned long maxrss; unsigned long cmaxrss; struct task_io_accounting ioac; unsigned long long sum_sched_runtime; struct rlimit rlim[16U]; struct pacct_struct pacct; struct taskstats *stats; unsigned int audit_tty; unsigned int audit_tty_log_passwd; struct tty_audit_buf *tty_audit_buf; struct rw_semaphore group_rwsem; oom_flags_t oom_flags; short oom_score_adj; short oom_score_adj_min; struct mutex cred_guard_mutex; } ;
730 struct user_struct { atomic_t __count; atomic_t processes; atomic_t files; atomic_t sigpending; atomic_t inotify_watches; atomic_t inotify_devs; atomic_t fanotify_listeners; atomic_long_t epoll_watches; unsigned long mq_bytes; unsigned long locked_shm; struct key *uid_keyring; struct key *session_keyring; struct hlist_node uidhash_node; kuid_t uid; atomic_long_t locked_vm; } ;
774 struct reclaim_state ;
775 struct sched_info { unsigned long pcount; unsigned long long run_delay; unsigned long long last_arrival; unsigned long long last_queued; } ;
790 struct task_delay_info { spinlock_t lock; unsigned int flags; struct timespec blkio_start; struct timespec blkio_end; u64 blkio_delay; u64 swapin_delay; u32 blkio_count; u32 swapin_count; struct timespec freepages_start; struct timespec freepages_end; u64 freepages_delay; u32 freepages_count; } ;
1004 struct uts_namespace ;
1005 struct load_weight { unsigned long weight; u32 inv_weight; } ;
1013 struct sched_avg { u32 runnable_avg_sum; u32 runnable_avg_period; u64 last_runnable_update; s64 decay_count; unsigned long load_avg_contrib; } ;
1025 struct sched_statistics { u64 wait_start; u64 wait_max; u64 wait_count; u64 wait_sum; u64 iowait_count; u64 iowait_sum; u64 sleep_start; u64 sleep_max; s64 sum_sleep_runtime; u64 block_start; u64 block_max; u64 exec_max; u64 slice_max; u64 nr_migrations_cold; u64 nr_failed_migrations_affine; u64 nr_failed_migrations_running; u64 nr_failed_migrations_hot; u64 nr_forced_migrations; u64 nr_wakeups; u64 nr_wakeups_sync; u64 nr_wakeups_migrate; u64 nr_wakeups_local; u64 nr_wakeups_remote; u64 nr_wakeups_affine; u64 nr_wakeups_affine_attempts; u64 nr_wakeups_passive; u64 nr_wakeups_idle; } ;
1060 struct sched_entity { struct load_weight load; struct rb_node run_node; struct list_head group_node; unsigned int on_rq; u64 exec_start; u64 sum_exec_runtime; u64 vruntime; u64 prev_sum_exec_runtime; u64 nr_migrations; struct sched_statistics statistics; struct sched_entity *parent; struct cfs_rq *cfs_rq; struct cfs_rq *my_q; struct sched_avg avg; } ;
1091 struct rt_rq ;
1091 struct sched_rt_entity { struct list_head run_list; unsigned long timeout; unsigned long watchdog_stamp; unsigned int time_slice; struct sched_rt_entity *back; struct sched_rt_entity *parent; struct rt_rq *rt_rq; struct rt_rq *my_q; } ;
1107 struct sched_dl_entity { struct rb_node rb_node; u64 dl_runtime; u64 dl_deadline; u64 dl_period; u64 dl_bw; s64 runtime; u64 deadline; unsigned int flags; int dl_throttled; int dl_new; int dl_boosted; struct hrtimer dl_timer; } ;
1162 struct memcg_batch_info { int do_batch; struct mem_cgroup *memcg; unsigned long nr_pages; unsigned long memsw_nr_pages; } ;
1569 struct memcg_oom_info { struct mem_cgroup *memcg; gfp_t gfp_mask; int order; unsigned char may_oom; } ;
1576 struct sched_class ;
1576 struct css_set ;
1576 struct compat_robust_list_head ;
1576 struct numa_group ;
1576 struct task_struct { volatile long state; void *stack; atomic_t usage; unsigned int flags; unsigned int ptrace; struct llist_node wake_entry; int on_cpu; struct task_struct *last_wakee; unsigned long wakee_flips; unsigned long wakee_flip_decay_ts; int wake_cpu; int on_rq; int prio; int static_prio; int normal_prio; unsigned int rt_priority; const struct sched_class *sched_class; struct sched_entity se; struct sched_rt_entity rt; struct task_group *sched_task_group; struct sched_dl_entity dl; struct hlist_head preempt_notifiers; unsigned int policy; int nr_cpus_allowed; cpumask_t cpus_allowed; struct sched_info sched_info; struct list_head tasks; struct plist_node pushable_tasks; struct rb_node pushable_dl_tasks; struct mm_struct *mm; struct mm_struct *active_mm; unsigned char brk_randomized; struct task_rss_stat rss_stat; int exit_state; int exit_code; int exit_signal; int pdeath_signal; unsigned int jobctl; unsigned int personality; unsigned char in_execve; unsigned char in_iowait; unsigned char no_new_privs; unsigned char sched_reset_on_fork; unsigned char sched_contributes_to_load; pid_t pid; pid_t tgid; struct task_struct *real_parent; struct task_struct *parent; struct list_head children; struct list_head sibling; struct task_struct *group_leader; struct list_head ptraced; struct list_head ptrace_entry; struct pid_link pids[3U]; struct list_head thread_group; struct list_head thread_node; struct completion *vfork_done; int *set_child_tid; int *clear_child_tid; cputime_t utime; cputime_t stime; cputime_t utimescaled; cputime_t stimescaled; cputime_t gtime; struct cputime prev_cputime; unsigned long nvcsw; unsigned long nivcsw; struct timespec start_time; struct timespec real_start_time; unsigned long min_flt; unsigned long maj_flt; struct task_cputime cputime_expires; struct list_head cpu_timers[3U]; const struct cred *real_cred; const struct cred *cred; char comm[16U]; int link_count; int total_link_count; struct sysv_sem sysvsem; unsigned long last_switch_count; struct thread_struct thread; struct fs_struct *fs; struct files_struct *files; struct nsproxy *nsproxy; struct signal_struct *signal; struct sighand_struct *sighand; sigset_t blocked; sigset_t real_blocked; sigset_t saved_sigmask; struct sigpending pending; unsigned long sas_ss_sp; size_t sas_ss_size; int (*notifier)(void *); void *notifier_data; sigset_t *notifier_mask; struct callback_head *task_works; struct audit_context *audit_context; kuid_t loginuid; unsigned int sessionid; struct seccomp seccomp; u32 parent_exec_id; u32 self_exec_id; spinlock_t alloc_lock; raw_spinlock_t pi_lock; struct rb_root pi_waiters; struct rb_node *pi_waiters_leftmost; struct rt_mutex_waiter *pi_blocked_on; struct task_struct *pi_top_task; struct mutex_waiter *blocked_on; unsigned int irq_events; unsigned long hardirq_enable_ip; unsigned long hardirq_disable_ip; unsigned int hardirq_enable_event; unsigned int hardirq_disable_event; int hardirqs_enabled; int hardirq_context; unsigned long softirq_disable_ip; unsigned long softirq_enable_ip; unsigned int softirq_disable_event; unsigned int softirq_enable_event; int softirqs_enabled; int softirq_context; u64 curr_chain_key; int lockdep_depth; unsigned int lockdep_recursion; struct held_lock held_locks[48U]; gfp_t lockdep_reclaim_gfp; void *journal_info; struct bio_list *bio_list; struct blk_plug *plug; struct reclaim_state *reclaim_state; struct backing_dev_info *backing_dev_info; struct io_context *io_context; unsigned long ptrace_message; siginfo_t *last_siginfo; struct task_io_accounting ioac; u64 acct_rss_mem1; u64 acct_vm_mem1; cputime_t acct_timexpd; nodemask_t mems_allowed; seqcount_t mems_allowed_seq; int cpuset_mem_spread_rotor; int cpuset_slab_spread_rotor; struct css_set *cgroups; struct list_head cg_list; struct robust_list_head *robust_list; struct compat_robust_list_head *compat_robust_list; struct list_head pi_state_list; struct futex_pi_state *pi_state_cache; struct perf_event_context *perf_event_ctxp[2U]; struct mutex perf_event_mutex; struct list_head perf_event_list; struct mempolicy *mempolicy; short il_next; short pref_node_fork; int numa_scan_seq; unsigned int numa_scan_period; unsigned int numa_scan_period_max; int numa_preferred_nid; int numa_migrate_deferred; unsigned long numa_migrate_retry; u64 node_stamp; struct callback_head numa_work; struct list_head numa_entry; struct numa_group *numa_group; unsigned long *numa_faults; unsigned long total_numa_faults; unsigned long *numa_faults_buffer; unsigned long numa_faults_locality[2U]; unsigned long numa_pages_migrated; struct callback_head rcu; struct pipe_inode_info *splice_pipe; struct page_frag task_frag; struct task_delay_info *delays; int make_it_fail; int nr_dirtied; int nr_dirtied_pause; unsigned long dirty_paused_when; int latency_record_count; struct latency_record latency_record[32U]; unsigned long timer_slack_ns; unsigned long default_timer_slack_ns; unsigned long trace; unsigned long trace_recursion; struct memcg_batch_info memcg_batch; unsigned int memcg_kmem_skip_account; struct memcg_oom_info memcg_oom; struct uprobe_task *utask; unsigned int sequential_io; unsigned int sequential_io_avg; } ;
39 typedef s32 compat_long_t;
44 typedef u32 compat_uptr_t;
273 struct compat_robust_list { compat_uptr_t next; } ;
277 struct compat_robust_list_head { struct compat_robust_list list; compat_long_t futex_offset; compat_uptr_t list_op_pending; } ;
685 struct ethhdr { unsigned char h_dest[6U]; unsigned char h_source[6U]; __be16 h_proto; } ;
34 struct ethtool_cmd { __u32 cmd; __u32 supported; __u32 advertising; __u16 speed; __u8 duplex; __u8 port; __u8 phy_address; __u8 transceiver; __u8 autoneg; __u8 mdio_support; __u32 maxtxpkt; __u32 maxrxpkt; __u16 speed_hi; __u8 eth_tp_mdix; __u8 eth_tp_mdix_ctrl; __u32 lp_advertising; __u32 reserved[2U]; } ;
65 struct ethtool_drvinfo { __u32 cmd; char driver[32U]; char version[32U]; char fw_version[32U]; char bus_info[32U]; char reserved1[32U]; char reserved2[12U]; __u32 n_priv_flags; __u32 n_stats; __u32 testinfo_len; __u32 eedump_len; __u32 regdump_len; } ;
105 struct ethtool_wolinfo { __u32 cmd; __u32 supported; __u32 wolopts; __u8 sopass[6U]; } ;
120 struct ethtool_regs { __u32 cmd; __u32 version; __u32 len; __u8 data[0U]; } ;
128 struct ethtool_eeprom { __u32 cmd; __u32 magic; __u32 offset; __u32 len; __u8 data[0U]; } ;
137 struct ethtool_eee { __u32 cmd; __u32 supported; __u32 advertised; __u32 lp_advertised; __u32 eee_active; __u32 eee_enabled; __u32 tx_lpi_enabled; __u32 tx_lpi_timer; __u32 reserved[2U]; } ;
166 struct ethtool_modinfo { __u32 cmd; __u32 type; __u32 eeprom_len; __u32 reserved[8U]; } ;
183 struct ethtool_coalesce { __u32 cmd; __u32 rx_coalesce_usecs; __u32 rx_max_coalesced_frames; __u32 rx_coalesce_usecs_irq; __u32 rx_max_coalesced_frames_irq; __u32 tx_coalesce_usecs; __u32 tx_max_coalesced_frames; __u32 tx_coalesce_usecs_irq; __u32 tx_max_coalesced_frames_irq; __u32 stats_block_coalesce_usecs; __u32 use_adaptive_rx_coalesce; __u32 use_adaptive_tx_coalesce; __u32 pkt_rate_low; __u32 rx_coalesce_usecs_low; __u32 rx_max_coalesced_frames_low; __u32 tx_coalesce_usecs_low; __u32 tx_max_coalesced_frames_low; __u32 pkt_rate_high; __u32 rx_coalesce_usecs_high; __u32 rx_max_coalesced_frames_high; __u32 tx_coalesce_usecs_high; __u32 tx_max_coalesced_frames_high; __u32 rate_sample_interval; } ;
281 struct ethtool_ringparam { __u32 cmd; __u32 rx_max_pending; __u32 rx_mini_max_pending; __u32 rx_jumbo_max_pending; __u32 tx_max_pending; __u32 rx_pending; __u32 rx_mini_pending; __u32 rx_jumbo_pending; __u32 tx_pending; } ;
303 struct ethtool_channels { __u32 cmd; __u32 max_rx; __u32 max_tx; __u32 max_other; __u32 max_combined; __u32 rx_count; __u32 tx_count; __u32 other_count; __u32 combined_count; } ;
331 struct ethtool_pauseparam { __u32 cmd; __u32 autoneg; __u32 rx_pause; __u32 tx_pause; } ;
382 struct ethtool_test { __u32 cmd; __u32 flags; __u32 reserved; __u32 len; __u64 data[0U]; } ;
404 struct ethtool_stats { __u32 cmd; __u32 n_stats; __u64 data[0U]; } ;
425 struct ethtool_tcpip4_spec { __be32 ip4src; __be32 ip4dst; __be16 psrc; __be16 pdst; __u8 tos; } ;
458 struct ethtool_ah_espip4_spec { __be32 ip4src; __be32 ip4dst; __be32 spi; __u8 tos; } ;
474 struct ethtool_usrip4_spec { __be32 ip4src; __be32 ip4dst; __be32 l4_4_bytes; __u8 tos; __u8 ip_ver; __u8 proto; } ;
494 union ethtool_flow_union { struct ethtool_tcpip4_spec tcp_ip4_spec; struct ethtool_tcpip4_spec udp_ip4_spec; struct ethtool_tcpip4_spec sctp_ip4_spec; struct ethtool_ah_espip4_spec ah_ip4_spec; struct ethtool_ah_espip4_spec esp_ip4_spec; struct ethtool_usrip4_spec usr_ip4_spec; struct ethhdr ether_spec; __u8 hdata[52U]; } ;
505 struct ethtool_flow_ext { __u8 padding[2U]; unsigned char h_dest[6U]; __be16 vlan_etype; __be16 vlan_tci; __be32 data[2U]; } ;
524 struct ethtool_rx_flow_spec { __u32 flow_type; union ethtool_flow_union h_u; struct ethtool_flow_ext h_ext; union ethtool_flow_union m_u; struct ethtool_flow_ext m_ext; __u64 ring_cookie; __u32 location; } ;
550 struct ethtool_rxnfc { __u32 cmd; __u32 flow_type; __u64 data; struct ethtool_rx_flow_spec fs; __u32 rule_cnt; __u32 rule_locs[0U]; } ;
684 struct ethtool_flash { __u32 cmd; __u32 region; char data[128U]; } ;
692 struct ethtool_dump { __u32 cmd; __u32 version; __u32 flag; __u32 len; __u8 data[0U]; } ;
768 struct ethtool_ts_info { __u32 cmd; __u32 so_timestamping; __s32 phc_index; __u32 tx_types; __u32 tx_reserved[3U]; __u32 rx_filters; __u32 rx_reserved[3U]; } ;
44 enum ethtool_phys_id_state { ETHTOOL_ID_INACTIVE = 0, ETHTOOL_ID_ACTIVE = 1, ETHTOOL_ID_ON = 2, ETHTOOL_ID_OFF = 3 } ;
79 struct ethtool_ops { int (*get_settings)(struct net_device *, struct ethtool_cmd *); int (*set_settings)(struct net_device *, struct ethtool_cmd *); void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *); int (*get_regs_len)(struct net_device *); void (*get_regs)(struct net_device *, struct ethtool_regs *, void *); void (*get_wol)(struct net_device *, struct ethtool_wolinfo *); int (*set_wol)(struct net_device *, struct ethtool_wolinfo *); u32 (*get_msglevel)(struct net_device *); void (*set_msglevel)(struct net_device *, u32 ); int (*nway_reset)(struct net_device *); u32 (*get_link)(struct net_device *); int (*get_eeprom_len)(struct net_device *); int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *); int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *); int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); void (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam *); int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam *); void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); void (*get_strings)(struct net_device *, u32 , u8 *); int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state ); void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); int (*begin)(struct net_device *); void (*complete)(struct net_device *); u32 (*get_priv_flags)(struct net_device *); int (*set_priv_flags)(struct net_device *, u32 ); int (*get_sset_count)(struct net_device *, int); int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, u32 *); int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); int (*flash_device)(struct net_device *, struct ethtool_flash *); int (*reset)(struct net_device *, u32 *); u32 (*get_rxfh_indir_size)(struct net_device *); int (*get_rxfh_indir)(struct net_device *, u32 *); int (*set_rxfh_indir)(struct net_device *, const u32 *); void (*get_channels)(struct net_device *, struct ethtool_channels *); int (*set_channels)(struct net_device *, struct ethtool_channels *); int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); int (*get_dump_data)(struct net_device *, struct ethtool_dump *, void *); int (*set_dump)(struct net_device *, struct ethtool_dump *); int (*get_ts_info)(struct net_device *, struct ethtool_ts_info *); int (*get_module_info)(struct net_device *, struct ethtool_modinfo *); int (*get_module_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); int (*get_eee)(struct net_device *, struct ethtool_eee *); int (*set_eee)(struct net_device *, struct ethtool_eee *); } ;
249 struct prot_inuse ;
250 struct netns_core { struct ctl_table_header *sysctl_hdr; int sysctl_somaxconn; struct prot_inuse *inuse; } ;
38 struct u64_stats_sync { } ;
145 struct ipstats_mib { u64 mibs[36U]; struct u64_stats_sync syncp; } ;
61 struct icmp_mib { unsigned long mibs[28U]; } ;
67 struct icmpmsg_mib { atomic_long_t mibs[512U]; } ;
72 struct icmpv6_mib { unsigned long mibs[6U]; } ;
83 struct icmpv6msg_mib { atomic_long_t mibs[512U]; } ;
93 struct tcp_mib { unsigned long mibs[16U]; } ;
100 struct udp_mib { unsigned long mibs[8U]; } ;
106 struct linux_mib { unsigned long mibs[97U]; } ;
112 struct linux_xfrm_mib { unsigned long mibs[29U]; } ;
118 struct proc_dir_entry ;
118 struct netns_mib { struct tcp_mib *tcp_statistics[1U]; struct ipstats_mib *ip_statistics[1U]; struct linux_mib *net_statistics[1U]; struct udp_mib *udp_statistics[1U]; struct udp_mib *udplite_statistics[1U]; struct icmp_mib *icmp_statistics[1U]; struct icmpmsg_mib *icmpmsg_statistics; struct proc_dir_entry *proc_net_devsnmp6; struct udp_mib *udp_stats_in6[1U]; struct udp_mib *udplite_stats_in6[1U]; struct ipstats_mib *ipv6_statistics[1U]; struct icmpv6_mib *icmpv6_statistics[1U]; struct icmpv6msg_mib *icmpv6msg_statistics; struct linux_xfrm_mib *xfrm_statistics[1U]; } ;
26 struct netns_unix { int sysctl_max_dgram_qlen; struct ctl_table_header *ctl; } ;
12 struct netns_packet { struct mutex sklist_lock; struct hlist_head sklist; } ;
14 struct netns_frags { int nqueues; struct list_head lru_list; spinlock_t lru_lock; struct percpu_counter mem; int timeout; int high_thresh; int low_thresh; } ;
180 struct tcpm_hash_bucket ;
181 struct ipv4_devconf ;
182 struct fib_rules_ops ;
183 struct fib_table ;
184 struct local_ports { seqlock_t lock; int range[2U]; } ;
22 struct inet_peer_base ;
22 struct xt_table ;
22 struct netns_ipv4 { struct ctl_table_header *forw_hdr; struct ctl_table_header *frags_hdr; struct ctl_table_header *ipv4_hdr; struct ctl_table_header *route_hdr; struct ctl_table_header *xfrm4_hdr; struct ipv4_devconf *devconf_all; struct ipv4_devconf *devconf_dflt; struct fib_rules_ops *rules_ops; bool fib_has_custom_rules; struct fib_table *fib_local; struct fib_table *fib_main; struct fib_table *fib_default; int fib_num_tclassid_users; struct hlist_head *fib_table_hash; struct sock *fibnl; struct sock **icmp_sk; struct inet_peer_base *peers; struct tcpm_hash_bucket *tcp_metrics_hash; unsigned int tcp_metrics_hash_log; struct netns_frags frags; struct xt_table *iptable_filter; struct xt_table *iptable_mangle; struct xt_table *iptable_raw; struct xt_table *arptable_filter; struct xt_table *iptable_security; struct xt_table *nat_table; int sysctl_icmp_echo_ignore_all; int sysctl_icmp_echo_ignore_broadcasts; int sysctl_icmp_ignore_bogus_error_responses; int sysctl_icmp_ratelimit; int sysctl_icmp_ratemask; int sysctl_icmp_errors_use_inbound_ifaddr; struct local_ports sysctl_local_ports; int sysctl_tcp_ecn; int sysctl_ip_no_pmtu_disc; int sysctl_ip_fwd_use_pmtu; kgid_t sysctl_ping_group_range[2U]; atomic_t dev_addr_genid; struct list_head mr_tables; struct fib_rules_ops *mr_rules_ops; atomic_t rt_genid; } ;
90 struct neighbour ;
90 struct dst_ops { unsigned short family; __be16 protocol; unsigned int gc_thresh; int (*gc)(struct dst_ops *); struct dst_entry * (*check)(struct dst_entry *, __u32 ); unsigned int (*default_advmss)(const struct dst_entry *); unsigned int (*mtu)(const struct dst_entry *); u32 * (*cow_metrics)(struct dst_entry *, unsigned long); void (*destroy)(struct dst_entry *); void (*ifdown)(struct dst_entry *, struct net_device *, int); struct dst_entry * (*negative_advice)(struct dst_entry *); void (*link_failure)(struct sk_buff *); void (*update_pmtu)(struct dst_entry *, struct sock *, struct sk_buff *, u32 ); void (*redirect)(struct dst_entry *, struct sock *, struct sk_buff *); int (*local_out)(struct sk_buff *); struct neighbour * (*neigh_lookup)(const struct dst_entry *, struct sk_buff *, const void *); struct kmem_cache *kmem_cachep; struct percpu_counter pcpuc_entries; } ;
73 struct netns_sysctl_ipv6 { struct ctl_table_header *hdr; struct ctl_table_header *route_hdr; struct ctl_table_header *icmp_hdr; struct ctl_table_header *frags_hdr; struct ctl_table_header *xfrm6_hdr; int bindv6only; int flush_delay; int ip6_rt_max_size; int ip6_rt_gc_min_interval; int ip6_rt_gc_timeout; int ip6_rt_gc_interval; int ip6_rt_gc_elasticity; int ip6_rt_mtu_expires; int ip6_rt_min_advmss; int flowlabel_consistency; int icmpv6_time; int anycast_src_echo_reply; } ;
34 struct ipv6_devconf ;
34 struct rt6_info ;
34 struct rt6_statistics ;
34 struct fib6_table ;
34 struct netns_ipv6 { struct netns_sysctl_ipv6 sysctl; struct ipv6_devconf *devconf_all; struct ipv6_devconf *devconf_dflt; struct inet_peer_base *peers; struct netns_frags frags; struct xt_table *ip6table_filter; struct xt_table *ip6table_mangle; struct xt_table *ip6table_raw; struct xt_table *ip6table_security; struct xt_table *ip6table_nat; struct rt6_info *ip6_null_entry; struct rt6_statistics *rt6_stats; struct timer_list ip6_fib_timer; struct hlist_head *fib_table_hash; struct fib6_table *fib6_main_tbl; struct dst_ops ip6_dst_ops; unsigned int ip6_rt_gc_expire; unsigned long ip6_rt_last_gc; struct rt6_info *ip6_prohibit_entry; struct rt6_info *ip6_blk_hole_entry; struct fib6_table *fib6_local_tbl; struct fib_rules_ops *fib6_rules_ops; struct sock **icmp_sk; struct sock *ndisc_sk; struct sock *tcp_sk; struct sock *igmp_sk; struct list_head mr6_tables; struct fib_rules_ops *mr6_rules_ops; atomic_t dev_addr_genid; atomic_t rt_genid; } ;
79 struct netns_nf_frag { struct netns_sysctl_ipv6 sysctl; struct netns_frags frags; } ;
85 struct sctp_mib ;
86 struct netns_sctp { struct sctp_mib *sctp_statistics[1U]; struct proc_dir_entry *proc_net_sctp; struct ctl_table_header *sysctl_header; struct sock *ctl_sock; struct list_head local_addr_list; struct list_head addr_waitq; struct timer_list addr_wq_timer; struct list_head auto_asconf_splist; spinlock_t addr_wq_lock; spinlock_t local_addr_lock; unsigned int rto_initial; unsigned int rto_min; unsigned int rto_max; int rto_alpha; int rto_beta; int max_burst; int cookie_preserve_enable; char *sctp_hmac_alg; unsigned int valid_cookie_life; unsigned int sack_timeout; unsigned int hb_interval; int max_retrans_association; int max_retrans_path; int max_retrans_init; int pf_retrans; int sndbuf_policy; int rcvbuf_policy; int default_auto_asconf; int addip_enable; int addip_noauth; int prsctp_enable; int auth_enable; int scope_policy; int rwnd_upd_shift; unsigned long max_autoclose; } ;
133 struct netns_dccp { struct sock *v4_ctl_sk; struct sock *v6_ctl_sk; } ;
104 union __anonunion_in6_u_224 { __u8 u6_addr8[16U]; __be16 u6_addr16[8U]; __be32 u6_addr32[4U]; } ;
104 struct in6_addr { union __anonunion_in6_u_224 in6_u; } ;
324 struct nlattr ;
337 struct nf_logger ;
338 struct netns_nf { struct proc_dir_entry *proc_netfilter; const struct nf_logger *nf_loggers[13U]; struct ctl_table_header *nf_log_dir_header; } ;
17 struct ebt_table ;
18 struct netns_xt { struct list_head tables[13U]; bool notrack_deprecated_warning; struct ebt_table *broute_table; struct ebt_table *frame_filter; struct ebt_table *frame_nat; bool ulog_warn_deprecated; bool ebt_ulog_warn_deprecated; } ;
24 struct hlist_nulls_node ;
24 struct hlist_nulls_head { struct hlist_nulls_node *first; } ;
20 struct hlist_nulls_node { struct hlist_nulls_node *next; struct hlist_nulls_node **pprev; } ;
32 struct nf_proto_net { struct ctl_table_header *ctl_table_header; struct ctl_table *ctl_table; struct ctl_table_header *ctl_compat_header; struct ctl_table *ctl_compat_table; unsigned int users; } ;
23 struct nf_generic_net { struct nf_proto_net pn; unsigned int timeout; } ;
28 struct nf_tcp_net { struct nf_proto_net pn; unsigned int timeouts[14U]; unsigned int tcp_loose; unsigned int tcp_be_liberal; unsigned int tcp_max_retrans; } ;
42 struct nf_udp_net { struct nf_proto_net pn; unsigned int timeouts[2U]; } ;
47 struct nf_icmp_net { struct nf_proto_net pn; unsigned int timeout; } ;
52 struct nf_ip_net { struct nf_generic_net generic; struct nf_tcp_net tcp; struct nf_udp_net udp; struct nf_icmp_net icmp; struct nf_icmp_net icmpv6; struct ctl_table_header *ctl_table_header; struct ctl_table *ctl_table; } ;
63 struct ip_conntrack_stat ;
63 struct nf_ct_event_notifier ;
63 struct nf_exp_event_notifier ;
63 struct netns_ct { atomic_t count; unsigned int expect_count; struct ctl_table_header *sysctl_header; struct ctl_table_header *acct_sysctl_header; struct ctl_table_header *tstamp_sysctl_header; struct ctl_table_header *event_sysctl_header; struct ctl_table_header *helper_sysctl_header; char *slabname; unsigned int sysctl_log_invalid; unsigned int sysctl_events_retry_timeout; int sysctl_events; int sysctl_acct; int sysctl_auto_assign_helper; bool auto_assign_helper_warned; int sysctl_tstamp; int sysctl_checksum; unsigned int htable_size; struct kmem_cache *nf_conntrack_cachep; struct hlist_nulls_head *hash; struct hlist_head *expect_hash; struct hlist_nulls_head unconfirmed; struct hlist_nulls_head dying; struct hlist_nulls_head tmpl; struct ip_conntrack_stat *stat; struct nf_ct_event_notifier *nf_conntrack_event_cb; struct nf_exp_event_notifier *nf_expect_event_cb; struct nf_ip_net nf_ct_proto; unsigned int labels_used; u8 label_words; struct hlist_head *nat_bysource; unsigned int nat_htable_size; } ;
104 struct nft_af_info ;
105 struct netns_nftables { struct list_head af_info; struct list_head commit_list; struct nft_af_info *ipv4; struct nft_af_info *ipv6; struct nft_af_info *inet; struct nft_af_info *arp; struct nft_af_info *bridge; u8 gencursor; u8 genctr; } ;
489 struct xfrm_policy_hash { struct hlist_head *table; unsigned int hmask; } ;
16 struct netns_xfrm { struct list_head state_all; struct hlist_head *state_bydst; struct hlist_head *state_bysrc; struct hlist_head *state_byspi; unsigned int state_hmask; unsigned int state_num; struct work_struct state_hash_work; struct hlist_head state_gc_list; struct work_struct state_gc_work; struct list_head policy_all; struct hlist_head *policy_byidx; unsigned int policy_idx_hmask; struct hlist_head policy_inexact[6U]; struct xfrm_policy_hash policy_bydst[6U]; unsigned int policy_count[6U]; struct work_struct policy_hash_work; struct sock *nlsk; struct sock *nlsk_stash; u32 sysctl_aevent_etime; u32 sysctl_aevent_rseqth; int sysctl_larval_drop; u32 sysctl_acq_expires; struct ctl_table_header *sysctl_hdr; struct dst_ops xfrm4_dst_ops; struct dst_ops xfrm6_dst_ops; spinlock_t xfrm_state_lock; spinlock_t xfrm_policy_sk_bundle_lock; rwlock_t xfrm_policy_lock; struct mutex xfrm_cfg_mutex; } ;
65 struct net_generic ;
66 struct netns_ipvs ;
67 struct net { atomic_t passive; atomic_t count; spinlock_t rules_mod_lock; struct list_head list; struct list_head cleanup_list; struct list_head exit_list; struct user_namespace *user_ns; unsigned int proc_inum; struct proc_dir_entry *proc_net; struct proc_dir_entry *proc_net_stat; struct ctl_table_set sysctls; struct sock *rtnl; struct sock *genl_sock; struct list_head dev_base_head; struct hlist_head *dev_name_head; struct hlist_head *dev_index_head; unsigned int dev_base_seq; int ifindex; unsigned int dev_unreg_count; struct list_head rules_ops; struct net_device *loopback_dev; struct netns_core core; struct netns_mib mib; struct netns_packet packet; struct netns_unix unx; struct netns_ipv4 ipv4; struct netns_ipv6 ipv6; struct netns_sctp sctp; struct netns_dccp dccp; struct netns_nf nf; struct netns_xt xt; struct netns_ct ct; struct netns_nftables nft; struct netns_nf_frag nf_frag; struct sock *nfnl; struct sock *nfnl_stash; struct sk_buff_head wext_nlevents; struct net_generic *gen; struct netns_xfrm xfrm; struct netns_ipvs *ipvs; struct sock *diag_nlsk; atomic_t fnhe_genid; } ;
395 struct dsa_chip_data { struct device *mii_bus; int sw_addr; char *port_names[12U]; s8 *rtable; } ;
46 struct dsa_platform_data { struct device *netdev; int nr_chips; struct dsa_chip_data *chip; } ;
61 struct dsa_switch ;
61 struct dsa_switch_tree { struct dsa_platform_data *pd; struct net_device *master_netdev; __be16 tag_protocol; s8 cpu_switch; s8 cpu_port; int link_poll_needed; struct work_struct link_poll_work; struct timer_list link_poll_timer; struct dsa_switch *ds[4U]; } ;
94 struct dsa_switch_driver ;
94 struct mii_bus ;
94 struct dsa_switch { struct dsa_switch_tree *dst; int index; struct dsa_chip_data *pd; struct dsa_switch_driver *drv; struct mii_bus *master_mii_bus; u32 dsa_port_mask; u32 phys_port_mask; struct mii_bus *slave_mii_bus; struct net_device *ports[12U]; } ;
146 struct dsa_switch_driver { struct list_head list; __be16 tag_protocol; int priv_size; char * (*probe)(struct mii_bus *, int); int (*setup)(struct dsa_switch *); int (*set_addr)(struct dsa_switch *, u8 *); int (*phy_read)(struct dsa_switch *, int, int); int (*phy_write)(struct dsa_switch *, int, int, u16 ); void (*poll_link)(struct dsa_switch *); void (*get_strings)(struct dsa_switch *, int, uint8_t *); void (*get_ethtool_stats)(struct dsa_switch *, int, uint64_t *); int (*get_sset_count)(struct dsa_switch *); } ;
200 struct ieee_ets { __u8 willing; __u8 ets_cap; __u8 cbs; __u8 tc_tx_bw[8U]; __u8 tc_rx_bw[8U]; __u8 tc_tsa[8U]; __u8 prio_tc[8U]; __u8 tc_reco_bw[8U]; __u8 tc_reco_tsa[8U]; __u8 reco_prio_tc[8U]; } ;
69 struct ieee_maxrate { __u64 tc_maxrate[8U]; } ;
80 struct ieee_pfc { __u8 pfc_cap; __u8 pfc_en; __u8 mbc; __u16 delay; __u64 requests[8U]; __u64 indications[8U]; } ;
100 struct cee_pg { __u8 willing; __u8 error; __u8 pg_en; __u8 tcs_supported; __u8 pg_bw[8U]; __u8 prio_pg[8U]; } ;
123 struct cee_pfc { __u8 willing; __u8 error; __u8 pfc_en; __u8 tcs_supported; } ;
138 struct dcb_app { __u8 selector; __u8 priority; __u16 protocol; } ;
167 struct dcb_peer_app_info { __u8 willing; __u8 error; } ;
40 struct dcbnl_rtnl_ops { int (*ieee_getets)(struct net_device *, struct ieee_ets *); int (*ieee_setets)(struct net_device *, struct ieee_ets *); int (*ieee_getmaxrate)(struct net_device *, struct ieee_maxrate *); int (*ieee_setmaxrate)(struct net_device *, struct ieee_maxrate *); int (*ieee_getpfc)(struct net_device *, struct ieee_pfc *); int (*ieee_setpfc)(struct net_device *, struct ieee_pfc *); int (*ieee_getapp)(struct net_device *, struct dcb_app *); int (*ieee_setapp)(struct net_device *, struct dcb_app *); int (*ieee_delapp)(struct net_device *, struct dcb_app *); int (*ieee_peer_getets)(struct net_device *, struct ieee_ets *); int (*ieee_peer_getpfc)(struct net_device *, struct ieee_pfc *); u8 (*getstate)(struct net_device *); u8 (*setstate)(struct net_device *, u8 ); void (*getpermhwaddr)(struct net_device *, u8 *); void (*setpgtccfgtx)(struct net_device *, int, u8 , u8 , u8 , u8 ); void (*setpgbwgcfgtx)(struct net_device *, int, u8 ); void (*setpgtccfgrx)(struct net_device *, int, u8 , u8 , u8 , u8 ); void (*setpgbwgcfgrx)(struct net_device *, int, u8 ); void (*getpgtccfgtx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *); void (*getpgbwgcfgtx)(struct net_device *, int, u8 *); void (*getpgtccfgrx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *); void (*getpgbwgcfgrx)(struct net_device *, int, u8 *); void (*setpfccfg)(struct net_device *, int, u8 ); void (*getpfccfg)(struct net_device *, int, u8 *); u8 (*setall)(struct net_device *); u8 (*getcap)(struct net_device *, int, u8 *); int (*getnumtcs)(struct net_device *, int, u8 *); int (*setnumtcs)(struct net_device *, int, u8 ); u8 (*getpfcstate)(struct net_device *); void (*setpfcstate)(struct net_device *, u8 ); void (*getbcncfg)(struct net_device *, int, u32 *); void (*setbcncfg)(struct net_device *, int, u32 ); void (*getbcnrp)(struct net_device *, int, u8 *); void (*setbcnrp)(struct net_device *, int, u8 ); u8 (*setapp)(struct net_device *, u8 , u16 , u8 ); u8 (*getapp)(struct net_device *, u8 , u16 ); u8 (*getfeatcfg)(struct net_device *, int, u8 *); u8 (*setfeatcfg)(struct net_device *, int, u8 ); u8 (*getdcbx)(struct net_device *); u8 (*setdcbx)(struct net_device *, u8 ); int (*peer_getappinfo)(struct net_device *, struct dcb_peer_app_info *, u16 *); int (*peer_getapptable)(struct net_device *, struct dcb_app *); int (*cee_peer_getpg)(struct net_device *, struct cee_pg *); int (*cee_peer_getpfc)(struct net_device *, struct cee_pfc *); } ;
102 struct taskstats { __u16 version; __u32 ac_exitcode; __u8 ac_flag; __u8 ac_nice; __u64 cpu_count; __u64 cpu_delay_total; __u64 blkio_count; __u64 blkio_delay_total; __u64 swapin_count; __u64 swapin_delay_total; __u64 cpu_run_real_total; __u64 cpu_run_virtual_total; char ac_comm[32U]; __u8 ac_sched; __u8 ac_pad[3U]; __u32 ac_uid; __u32 ac_gid; __u32 ac_pid; __u32 ac_ppid; __u32 ac_btime; __u64 ac_etime; __u64 ac_utime; __u64 ac_stime; __u64 ac_minflt; __u64 ac_majflt; __u64 coremem; __u64 virtmem; __u64 hiwater_rss; __u64 hiwater_vm; __u64 read_char; __u64 write_char; __u64 read_syscalls; __u64 write_syscalls; __u64 read_bytes; __u64 write_bytes; __u64 cancelled_write_bytes; __u64 nvcsw; __u64 nivcsw; __u64 ac_utimescaled; __u64 ac_stimescaled; __u64 cpu_scaled_run_real_total; __u64 freepages_count; __u64 freepages_delay_total; } ;
55 struct xattr_handler { const char *prefix; int flags; size_t (*list)(struct dentry *, char *, size_t , const char *, size_t , int); int (*get)(struct dentry *, const char *, void *, size_t , int); int (*set)(struct dentry *, const char *, const void *, size_t , int, int); } ;
53 struct simple_xattrs { struct list_head head; spinlock_t lock; } ;
98 struct percpu_ref ;
54 typedef void percpu_ref_func_t(struct percpu_ref *);
55 struct percpu_ref { atomic_t count; unsigned int *pcpu_count; percpu_ref_func_t *release; percpu_ref_func_t *confirm_kill; struct callback_head rcu; } ;
173 struct cgroupfs_root ;
174 struct cgroup_subsys ;
175 struct cgroup ;
62 struct cgroup_subsys_state { struct cgroup *cgroup; struct cgroup_subsys *ss; struct percpu_ref refcnt; struct cgroup_subsys_state *parent; unsigned long flags; struct callback_head callback_head; struct work_struct destroy_work; } ;
142 struct cgroup_name { struct callback_head callback_head; char name[]; } ;
160 struct cgroup { unsigned long flags; int id; int nr_css; struct list_head sibling; struct list_head children; struct list_head files; struct cgroup *parent; struct dentry *dentry; u64 serial_nr; struct cgroup_name *name; struct cgroup_subsys_state *subsys[12U]; struct cgroupfs_root *root; struct list_head cset_links; struct list_head release_list; struct list_head pidlists; struct mutex pidlist_mutex; struct cgroup_subsys_state dummy_css; struct callback_head callback_head; struct work_struct destroy_work; struct simple_xattrs xattrs; } ;
252 struct cgroupfs_root { struct super_block *sb; unsigned long subsys_mask; int hierarchy_id; struct cgroup top_cgroup; int number_of_cgroups; struct list_head root_list; unsigned long flags; struct idr cgroup_idr; char release_agent_path[4096U]; char name[64U]; } ;
342 struct css_set { atomic_t refcount; struct hlist_node hlist; struct list_head tasks; struct list_head cgrp_links; struct cgroup_subsys_state *subsys[12U]; struct callback_head callback_head; } ;
392 struct cftype { char name[64U]; int private; umode_t mode; size_t max_write_len; unsigned int flags; struct cgroup_subsys *ss; u64 (*read_u64)(struct cgroup_subsys_state *, struct cftype *); s64 (*read_s64)(struct cgroup_subsys_state *, struct cftype *); int (*seq_show)(struct seq_file *, void *); void * (*seq_start)(struct seq_file *, loff_t *); void * (*seq_next)(struct seq_file *, void *, loff_t *); void (*seq_stop)(struct seq_file *, void *); int (*write_u64)(struct cgroup_subsys_state *, struct cftype *, u64 ); int (*write_s64)(struct cgroup_subsys_state *, struct cftype *, s64 ); int (*write_string)(struct cgroup_subsys_state *, struct cftype *, const char *); int (*trigger)(struct cgroup_subsys_state *, unsigned int); } ;
479 struct cftype_set { struct list_head node; struct cftype *cfts; } ;
546 struct cgroup_taskset ;
557 struct cgroup_subsys { struct cgroup_subsys_state * (*css_alloc)(struct cgroup_subsys_state *); int (*css_online)(struct cgroup_subsys_state *); void (*css_offline)(struct cgroup_subsys_state *); void (*css_free)(struct cgroup_subsys_state *); int (*can_attach)(struct cgroup_subsys_state *, struct cgroup_taskset *); void (*cancel_attach)(struct cgroup_subsys_state *, struct cgroup_taskset *); void (*attach)(struct cgroup_subsys_state *, struct cgroup_taskset *); void (*fork)(struct task_struct *); void (*exit)(struct cgroup_subsys_state *, struct cgroup_subsys_state *, struct task_struct *); void (*bind)(struct cgroup_subsys_state *); int subsys_id; int disabled; int early_init; bool broken_hierarchy; bool warned_broken_hierarchy; const char *name; struct cgroupfs_root *root; struct list_head cftsets; struct cftype *base_cftypes; struct cftype_set base_cftset; struct module *module; } ;
124 enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED = 1, IRQ_WAKE_THREAD = 2 } ;
16 typedef enum irqreturn irqreturn_t;
60 struct netprio_map { struct callback_head rcu; u32 priomap_len; u32 priomap[]; } ;
103 struct xfrm_policy ;
104 struct xfrm_state ;
124 struct request_sock ;
3157 struct mnt_namespace ;
3158 struct ipc_namespace ;
3159 struct nsproxy { atomic_t count; struct uts_namespace *uts_ns; struct ipc_namespace *ipc_ns; struct mnt_namespace *mnt_ns; struct pid_namespace *pid_ns_for_children; struct net *net_ns; } ;
41 struct nlmsghdr { __u32 nlmsg_len; __u16 nlmsg_type; __u16 nlmsg_flags; __u32 nlmsg_seq; __u32 nlmsg_pid; } ;
145 struct nlattr { __u16 nla_len; __u16 nla_type; } ;
102 struct netlink_callback { struct sk_buff *skb; const struct nlmsghdr *nlh; int (*dump)(struct sk_buff *, struct netlink_callback *); int (*done)(struct netlink_callback *); void *data; struct module *module; u16 family; u16 min_dump_alloc; unsigned int prev_seq; unsigned int seq; long args[6U]; } ;
171 struct ndmsg { __u8 ndm_family; __u8 ndm_pad1; __u16 ndm_pad2; __s32 ndm_ifindex; __u16 ndm_state; __u8 ndm_flags; __u8 ndm_type; } ;
39 struct rtnl_link_stats64 { __u64 rx_packets; __u64 tx_packets; __u64 rx_bytes; __u64 tx_bytes; __u64 rx_errors; __u64 tx_errors; __u64 rx_dropped; __u64 tx_dropped; __u64 multicast; __u64 collisions; __u64 rx_length_errors; __u64 rx_over_errors; __u64 rx_crc_errors; __u64 rx_frame_errors; __u64 rx_fifo_errors; __u64 rx_missed_errors; __u64 tx_aborted_errors; __u64 tx_carrier_errors; __u64 tx_fifo_errors; __u64 tx_heartbeat_errors; __u64 tx_window_errors; __u64 rx_compressed; __u64 tx_compressed; } ;
536 struct ifla_vf_info { __u32 vf; __u8 mac[32U]; __u32 vlan; __u32 qos; __u32 tx_rate; __u32 spoofchk; __u32 linkstate; } ;
27 struct netpoll_info ;
28 struct phy_device ;
29 struct wireless_dev ;
64 enum netdev_tx { __NETDEV_TX_MIN = -2147483648, NETDEV_TX_OK = 0, NETDEV_TX_BUSY = 16, NETDEV_TX_LOCKED = 32 } ;
116 typedef enum netdev_tx netdev_tx_t;
135 struct net_device_stats { unsigned long rx_packets; unsigned long tx_packets; unsigned long rx_bytes; unsigned long tx_bytes; unsigned long rx_errors; unsigned long tx_errors; unsigned long rx_dropped; unsigned long tx_dropped; unsigned long multicast; unsigned long collisions; unsigned long rx_length_errors; unsigned long rx_over_errors; unsigned long rx_crc_errors; unsigned long rx_frame_errors; unsigned long rx_fifo_errors; unsigned long rx_missed_errors; unsigned long tx_aborted_errors; unsigned long tx_carrier_errors; unsigned long tx_fifo_errors; unsigned long tx_heartbeat_errors; unsigned long tx_window_errors; unsigned long rx_compressed; unsigned long tx_compressed; } ;
196 struct neigh_parms ;
217 struct netdev_hw_addr_list { struct list_head list; int count; } ;
222 struct hh_cache { u16 hh_len; u16 __pad; seqlock_t hh_lock; unsigned long hh_data[16U]; } ;
251 struct header_ops { int (*create)(struct sk_buff *, struct net_device *, unsigned short, const void *, const void *, unsigned int); int (*parse)(const struct sk_buff *, unsigned char *); int (*rebuild)(struct sk_buff *); int (*cache)(const struct neighbour *, struct hh_cache *, __be16 ); void (*cache_update)(struct hh_cache *, const struct net_device *, const unsigned char *); } ;
302 struct napi_struct { struct list_head poll_list; unsigned long state; int weight; unsigned int gro_count; int (*poll)(struct napi_struct *, int); spinlock_t poll_lock; int poll_owner; struct net_device *dev; struct sk_buff *gro_list; struct sk_buff *skb; struct list_head dev_list; struct hlist_node napi_hash_node; unsigned int napi_id; } ;
346 enum rx_handler_result { RX_HANDLER_CONSUMED = 0, RX_HANDLER_ANOTHER = 1, RX_HANDLER_EXACT = 2, RX_HANDLER_PASS = 3 } ;
394 typedef enum rx_handler_result rx_handler_result_t;
395 typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **);
532 struct Qdisc ;
532 struct netdev_queue { struct net_device *dev; struct Qdisc *qdisc; struct Qdisc *qdisc_sleeping; struct kobject kobj; int numa_node; spinlock_t _xmit_lock; int xmit_lock_owner; unsigned long trans_start; unsigned long trans_timeout; unsigned long state; struct dql dql; } ;
594 struct rps_map { unsigned int len; struct callback_head rcu; u16 cpus[0U]; } ;
606 struct rps_dev_flow { u16 cpu; u16 filter; unsigned int last_qtail; } ;
618 struct rps_dev_flow_table { unsigned int mask; struct callback_head rcu; struct rps_dev_flow flows[0U]; } ;
669 struct netdev_rx_queue { struct rps_map *rps_map; struct rps_dev_flow_table *rps_flow_table; struct kobject kobj; struct net_device *dev; } ;
692 struct xps_map { unsigned int len; unsigned int alloc_len; struct callback_head rcu; u16 queues[0U]; } ;
705 struct xps_dev_maps { struct callback_head rcu; struct xps_map *cpu_map[0U]; } ;
716 struct netdev_tc_txq { u16 count; u16 offset; } ;
727 struct netdev_fcoe_hbainfo { char manufacturer[64U]; char serial_number[64U]; char hardware_version[64U]; char driver_version[64U]; char optionrom_version[64U]; char firmware_version[64U]; char model[256U]; char model_description[256U]; } ;
743 struct netdev_phys_port_id { unsigned char id[32U]; unsigned char id_len; } ;
756 struct net_device_ops { int (*ndo_init)(struct net_device *); void (*ndo_uninit)(struct net_device *); int (*ndo_open)(struct net_device *); int (*ndo_stop)(struct net_device *); netdev_tx_t (*ndo_start_xmit)(struct sk_buff *, struct net_device *); u16 (*ndo_select_queue)(struct net_device *, struct sk_buff *, void *, u16 (*)(struct net_device *, struct sk_buff *)); void (*ndo_change_rx_flags)(struct net_device *, int); void (*ndo_set_rx_mode)(struct net_device *); int (*ndo_set_mac_address)(struct net_device *, void *); int (*ndo_validate_addr)(struct net_device *); int (*ndo_do_ioctl)(struct net_device *, struct ifreq *, int); int (*ndo_set_config)(struct net_device *, struct ifmap *); int (*ndo_change_mtu)(struct net_device *, int); int (*ndo_neigh_setup)(struct net_device *, struct neigh_parms *); void (*ndo_tx_timeout)(struct net_device *); struct rtnl_link_stats64 * (*ndo_get_stats64)(struct net_device *, struct rtnl_link_stats64 *); struct net_device_stats * (*ndo_get_stats)(struct net_device *); int (*ndo_vlan_rx_add_vid)(struct net_device *, __be16 , u16 ); int (*ndo_vlan_rx_kill_vid)(struct net_device *, __be16 , u16 ); void (*ndo_poll_controller)(struct net_device *); int (*ndo_netpoll_setup)(struct net_device *, struct netpoll_info *, gfp_t ); void (*ndo_netpoll_cleanup)(struct net_device *); int (*ndo_busy_poll)(struct napi_struct *); int (*ndo_set_vf_mac)(struct net_device *, int, u8 *); int (*ndo_set_vf_vlan)(struct net_device *, int, u16 , u8 ); int (*ndo_set_vf_tx_rate)(struct net_device *, int, int); int (*ndo_set_vf_spoofchk)(struct net_device *, int, bool ); int (*ndo_get_vf_config)(struct net_device *, int, struct ifla_vf_info *); int (*ndo_set_vf_link_state)(struct net_device *, int, int); int (*ndo_set_vf_port)(struct net_device *, int, struct nlattr **); int (*ndo_get_vf_port)(struct net_device *, int, struct sk_buff *); int (*ndo_setup_tc)(struct net_device *, u8 ); int (*ndo_fcoe_enable)(struct net_device *); int (*ndo_fcoe_disable)(struct net_device *); int (*ndo_fcoe_ddp_setup)(struct net_device *, u16 , struct scatterlist *, unsigned int); int (*ndo_fcoe_ddp_done)(struct net_device *, u16 ); int (*ndo_fcoe_ddp_target)(struct net_device *, u16 , struct scatterlist *, unsigned int); int (*ndo_fcoe_get_hbainfo)(struct net_device *, struct netdev_fcoe_hbainfo *); int (*ndo_fcoe_get_wwn)(struct net_device *, u64 *, int); int (*ndo_rx_flow_steer)(struct net_device *, const struct sk_buff *, u16 , u32 ); int (*ndo_add_slave)(struct net_device *, struct net_device *); int (*ndo_del_slave)(struct net_device *, struct net_device *); netdev_features_t (*ndo_fix_features)(struct net_device *, netdev_features_t ); int (*ndo_set_features)(struct net_device *, netdev_features_t ); int (*ndo_neigh_construct)(struct neighbour *); void (*ndo_neigh_destroy)(struct neighbour *); int (*ndo_fdb_add)(struct ndmsg *, struct nlattr **, struct net_device *, const unsigned char *, u16 ); int (*ndo_fdb_del)(struct ndmsg *, struct nlattr **, struct net_device *, const unsigned char *); int (*ndo_fdb_dump)(struct sk_buff *, struct netlink_callback *, struct net_device *, int); int (*ndo_bridge_setlink)(struct net_device *, struct nlmsghdr *); int (*ndo_bridge_getlink)(struct sk_buff *, u32 , u32 , struct net_device *, u32 ); int (*ndo_bridge_dellink)(struct net_device *, struct nlmsghdr *); int (*ndo_change_carrier)(struct net_device *, bool ); int (*ndo_get_phys_port_id)(struct net_device *, struct netdev_phys_port_id *); void (*ndo_add_vxlan_port)(struct net_device *, sa_family_t , __be16 ); void (*ndo_del_vxlan_port)(struct net_device *, sa_family_t , __be16 ); void * (*ndo_dfwd_add_station)(struct net_device *, struct net_device *); void (*ndo_dfwd_del_station)(struct net_device *, void *); netdev_tx_t (*ndo_dfwd_start_xmit)(struct sk_buff *, struct net_device *, void *); } ;
1161 struct __anonstruct_adj_list_235 { struct list_head upper; struct list_head lower; } ;
1161 struct __anonstruct_all_adj_list_236 { struct list_head upper; struct list_head lower; } ;
1161 struct iw_handler_def ;
1161 struct iw_public_data ;
1161 struct forwarding_accel_ops ;
1161 struct vlan_info ;
1161 struct tipc_bearer ;
1161 struct in_device ;
1161 struct dn_dev ;
1161 struct inet6_dev ;
1161 struct cpu_rmap ;
1161 struct pcpu_lstats ;
1161 struct pcpu_sw_netstats ;
1161 struct pcpu_dstats ;
1161 struct pcpu_vstats ;
1161 union __anonunion____missing_field_name_237 { void *ml_priv; struct pcpu_lstats *lstats; struct pcpu_sw_netstats *tstats; struct pcpu_dstats *dstats; struct pcpu_vstats *vstats; } ;
1161 struct garp_port ;
1161 struct mrp_port ;
1161 struct rtnl_link_ops ;
1161 struct net_device { char name[16U]; struct hlist_node name_hlist; char *ifalias; unsigned long mem_end; unsigned long mem_start; unsigned long base_addr; int irq; unsigned long state; struct list_head dev_list; struct list_head napi_list; struct list_head unreg_list; struct list_head close_list; struct __anonstruct_adj_list_235 adj_list; struct __anonstruct_all_adj_list_236 all_adj_list; netdev_features_t features; netdev_features_t hw_features; netdev_features_t wanted_features; netdev_features_t vlan_features; netdev_features_t hw_enc_features; netdev_features_t mpls_features; int ifindex; int iflink; struct net_device_stats stats; atomic_long_t rx_dropped; const struct iw_handler_def *wireless_handlers; struct iw_public_data *wireless_data; const struct net_device_ops *netdev_ops; const struct ethtool_ops *ethtool_ops; const struct forwarding_accel_ops *fwd_ops; const struct header_ops *header_ops; unsigned int flags; unsigned int priv_flags; unsigned short gflags; unsigned short padded; unsigned char operstate; unsigned char link_mode; unsigned char if_port; unsigned char dma; unsigned int mtu; unsigned short type; unsigned short hard_header_len; unsigned short needed_headroom; unsigned short needed_tailroom; unsigned char perm_addr[32U]; unsigned char addr_assign_type; unsigned char addr_len; unsigned short neigh_priv_len; unsigned short dev_id; spinlock_t addr_list_lock; struct netdev_hw_addr_list uc; struct netdev_hw_addr_list mc; struct netdev_hw_addr_list dev_addrs; struct kset *queues_kset; bool uc_promisc; unsigned int promiscuity; unsigned int allmulti; struct vlan_info *vlan_info; struct dsa_switch_tree *dsa_ptr; struct tipc_bearer *tipc_ptr; void *atalk_ptr; struct in_device *ip_ptr; struct dn_dev *dn_ptr; struct inet6_dev *ip6_ptr; void *ax25_ptr; struct wireless_dev *ieee80211_ptr; unsigned long last_rx; unsigned char *dev_addr; struct netdev_rx_queue *_rx; unsigned int num_rx_queues; unsigned int real_num_rx_queues; rx_handler_func_t *rx_handler; void *rx_handler_data; struct netdev_queue *ingress_queue; unsigned char broadcast[32U]; struct netdev_queue *_tx; unsigned int num_tx_queues; unsigned int real_num_tx_queues; struct Qdisc *qdisc; unsigned long tx_queue_len; spinlock_t tx_global_lock; struct xps_dev_maps *xps_maps; struct cpu_rmap *rx_cpu_rmap; unsigned long trans_start; int watchdog_timeo; struct timer_list watchdog_timer; int *pcpu_refcnt; struct list_head todo_list; struct hlist_node index_hlist; struct list_head link_watch_list; unsigned char reg_state; bool dismantle; unsigned short rtnl_link_state; void (*destructor)(struct net_device *); struct netpoll_info *npinfo; struct net *nd_net; union __anonunion____missing_field_name_237 __annonCompField74; struct garp_port *garp_port; struct mrp_port *mrp_port; struct device dev; const struct attribute_group *sysfs_groups[4U]; const struct attribute_group *sysfs_rx_queue_group; const struct rtnl_link_ops *rtnl_link_ops; unsigned int gso_max_size; u16 gso_max_segs; const struct dcbnl_rtnl_ops *dcbnl_ops; u8 num_tc; struct netdev_tc_txq tc_to_txq[16U]; u8 prio_tc_map[16U]; unsigned int fcoe_ddp_xid; struct netprio_map *priomap; struct phy_device *phydev; struct lock_class_key *qdisc_tx_busylock; int group; struct pm_qos_request pm_qos_req; } ;
1722 struct pcpu_sw_netstats { u64 rx_packets; u64 rx_bytes; u64 tx_packets; u64 tx_bytes; struct u64_stats_sync syncp; } ;
2465 enum skb_free_reason { SKB_REASON_CONSUMED = 0, SKB_REASON_DROPPED = 1 } ;
15 typedef __u64 Elf64_Addr;
16 typedef __u16 Elf64_Half;
20 typedef __u32 Elf64_Word;
21 typedef __u64 Elf64_Xword;
190 struct elf64_sym { Elf64_Word st_name; unsigned char st_info; unsigned char st_other; Elf64_Half st_shndx; Elf64_Addr st_value; Elf64_Xword st_size; } ;
198 typedef struct elf64_sym Elf64_Sym;
48 struct kernel_param ;
53 struct kernel_param_ops { unsigned int flags; int (*set)(const char *, const struct kernel_param *); int (*get)(char *, const struct kernel_param *); void (*free)(void *); } ;
58 struct kparam_string ;
58 struct kparam_array ;
58 union __anonunion____missing_field_name_242 { void *arg; const struct kparam_string *str; const struct kparam_array *arr; } ;
58 struct kernel_param { const char *name; const struct kernel_param_ops *ops; u16 perm; s16 level; union __anonunion____missing_field_name_242 __annonCompField75; } ;
70 struct kparam_string { unsigned int maxlen; char *string; } ;
76 struct kparam_array { unsigned int max; unsigned int elemsize; unsigned int *num; const struct kernel_param_ops *ops; void *elem; } ;
463 struct tracepoint ;
464 struct tracepoint_func { void *func; void *data; } ;
29 struct tracepoint { const char *name; struct static_key key; void (*regfunc)(); void (*unregfunc)(); struct tracepoint_func *funcs; } ;
92 struct mod_arch_specific { } ;
36 struct module_param_attrs ;
36 struct module_kobject { struct kobject kobj; struct module *mod; struct kobject *drivers_dir; struct module_param_attrs *mp; struct completion *kobj_completion; } ;
46 struct module_attribute { struct attribute attr; ssize_t (*show)(struct module_attribute *, struct module_kobject *, char *); ssize_t (*store)(struct module_attribute *, struct module_kobject *, const char *, size_t ); void (*setup)(struct module *, const char *); int (*test)(struct module *); void (*free)(struct module *); } ;
208 enum module_state { MODULE_STATE_LIVE = 0, MODULE_STATE_COMING = 1, MODULE_STATE_GOING = 2, MODULE_STATE_UNFORMED = 3 } ;
215 struct module_ref { unsigned long incs; unsigned long decs; } ;
229 struct module_sect_attrs ;
229 struct module_notes_attrs ;
229 struct ftrace_event_call ;
229 struct module { enum module_state state; struct list_head list; char name[56U]; struct module_kobject mkobj; struct module_attribute *modinfo_attrs; const char *version; const char *srcversion; struct kobject *holders_dir; const struct kernel_symbol *syms; const unsigned long *crcs; unsigned int num_syms; struct kernel_param *kp; unsigned int num_kp; unsigned int num_gpl_syms; const struct kernel_symbol *gpl_syms; const unsigned long *gpl_crcs; const struct kernel_symbol *unused_syms; const unsigned long *unused_crcs; unsigned int num_unused_syms; unsigned int num_unused_gpl_syms; const struct kernel_symbol *unused_gpl_syms; const unsigned long *unused_gpl_crcs; bool sig_ok; const struct kernel_symbol *gpl_future_syms; const unsigned long *gpl_future_crcs; unsigned int num_gpl_future_syms; unsigned int num_exentries; struct exception_table_entry *extable; int (*init)(); void *module_init; void *module_core; unsigned int init_size; unsigned int core_size; unsigned int init_text_size; unsigned int core_text_size; unsigned int init_ro_size; unsigned int core_ro_size; struct mod_arch_specific arch; unsigned int taints; unsigned int num_bugs; struct list_head bug_list; struct bug_entry *bug_table; Elf64_Sym *symtab; Elf64_Sym *core_symtab; unsigned int num_symtab; unsigned int core_num_syms; char *strtab; char *core_strtab; struct module_sect_attrs *sect_attrs; struct module_notes_attrs *notes_attrs; char *args; void *percpu; unsigned int percpu_size; unsigned int num_tracepoints; const struct tracepoint **tracepoints_ptrs; unsigned int num_trace_bprintk_fmt; const char **trace_bprintk_fmt_start; struct ftrace_event_call **trace_events; unsigned int num_trace_events; struct list_head source_list; struct list_head target_list; void (*exit)(); struct module_ref *refptr; ctor_fn_t (**ctors)(); unsigned int num_ctors; } ;
13 typedef unsigned long kernel_ulong_t;
14 struct pci_device_id { __u32 vendor; __u32 device; __u32 subvendor; __u32 subdevice; __u32 class; __u32 class_mask; kernel_ulong_t driver_data; } ;
186 struct acpi_device_id { __u8 id[9U]; kernel_ulong_t driver_data; } ;
219 struct of_device_id { char name[32U]; char type[32U]; char compatible[128U]; const void *data; } ;
69 struct hotplug_slot ;
69 struct pci_slot { struct pci_bus *bus; struct list_head list; struct hotplug_slot *hotplug; unsigned char number; struct kobject kobj; } ;
110 typedef int pci_power_t;
137 typedef unsigned int pci_channel_state_t;
138 enum pci_channel_state { pci_channel_io_normal = 1, pci_channel_io_frozen = 2, pci_channel_io_perm_failure = 3 } ;
163 typedef unsigned short pci_dev_flags_t;
180 typedef unsigned short pci_bus_flags_t;
237 struct pcie_link_state ;
238 struct pci_vpd ;
239 struct pci_sriov ;
240 struct pci_ats ;
241 struct pci_driver ;
241 union __anonunion____missing_field_name_246 { struct pci_sriov *sriov; struct pci_dev *physfn; } ;
241 struct pci_dev { struct list_head bus_list; struct pci_bus *bus; struct pci_bus *subordinate; void *sysdata; struct proc_dir_entry *procent; struct pci_slot *slot; unsigned int devfn; unsigned short vendor; unsigned short device; unsigned short subsystem_vendor; unsigned short subsystem_device; unsigned int class; u8 revision; u8 hdr_type; u8 pcie_cap; u8 msi_cap; u8 msix_cap; unsigned char pcie_mpss; u8 rom_base_reg; u8 pin; u16 pcie_flags_reg; struct pci_driver *driver; u64 dma_mask; struct device_dma_parameters dma_parms; pci_power_t current_state; u8 pm_cap; unsigned char pme_support; unsigned char pme_interrupt; unsigned char pme_poll; unsigned char d1_support; unsigned char d2_support; unsigned char no_d1d2; unsigned char no_d3cold; unsigned char d3cold_allowed; unsigned char mmio_always_on; unsigned char wakeup_prepared; unsigned char runtime_d3cold; unsigned int d3_delay; unsigned int d3cold_delay; struct pcie_link_state *link_state; pci_channel_state_t error_state; struct device dev; int cfg_size; unsigned int irq; struct resource resource[17U]; bool match_driver; unsigned char transparent; unsigned char multifunction; unsigned char is_added; unsigned char is_busmaster; unsigned char no_msi; unsigned char block_cfg_access; unsigned char broken_parity_status; unsigned char irq_reroute_variant; unsigned char msi_enabled; unsigned char msix_enabled; unsigned char ari_enabled; unsigned char is_managed; unsigned char needs_freset; unsigned char state_saved; unsigned char is_physfn; unsigned char is_virtfn; unsigned char reset_fn; unsigned char is_hotplug_bridge; unsigned char __aer_firmware_first_valid; unsigned char __aer_firmware_first; unsigned char broken_intx_masking; unsigned char io_window_1k; pci_dev_flags_t dev_flags; atomic_t enable_cnt; u32 saved_config_space[16U]; struct hlist_head saved_cap_space; struct bin_attribute *rom_attr; int rom_attr_enabled; struct bin_attribute *res_attr[17U]; struct bin_attribute *res_attr_wc[17U]; struct list_head msi_list; const struct attribute_group **msi_irq_groups; struct pci_vpd *vpd; union __anonunion____missing_field_name_246 __annonCompField76; struct pci_ats *ats; phys_addr_t rom; size_t romlen; } ;
429 struct pci_ops ;
429 struct msi_chip ;
429 struct pci_bus { struct list_head node; struct pci_bus *parent; struct list_head children; struct list_head devices; struct pci_dev *self; struct list_head slots; struct resource *resource[4U]; struct list_head resources; struct resource busn_res; struct pci_ops *ops; struct msi_chip *msi; void *sysdata; struct proc_dir_entry *procdir; unsigned char number; unsigned char primary; unsigned char max_bus_speed; unsigned char cur_bus_speed; char name[48U]; unsigned short bridge_ctl; pci_bus_flags_t bus_flags; struct device *bridge; struct device dev; struct bin_attribute *legacy_io; struct bin_attribute *legacy_mem; unsigned char is_added; } ;
534 struct pci_ops { int (*read)(struct pci_bus *, unsigned int, int, int, u32 *); int (*write)(struct pci_bus *, unsigned int, int, int, u32 ); } ;
555 struct pci_dynids { spinlock_t lock; struct list_head list; } ;
569 typedef unsigned int pci_ers_result_t;
579 struct pci_error_handlers { pci_ers_result_t (*error_detected)(struct pci_dev *, enum pci_channel_state ); pci_ers_result_t (*mmio_enabled)(struct pci_dev *); pci_ers_result_t (*link_reset)(struct pci_dev *); pci_ers_result_t (*slot_reset)(struct pci_dev *); void (*resume)(struct pci_dev *); } ;
609 struct pci_driver { struct list_head node; const char *name; const struct pci_device_id *id_table; int (*probe)(struct pci_dev *, const struct pci_device_id *); void (*remove)(struct pci_dev *); int (*suspend)(struct pci_dev *, pm_message_t ); int (*suspend_late)(struct pci_dev *, pm_message_t ); int (*resume_early)(struct pci_dev *); int (*resume)(struct pci_dev *); void (*shutdown)(struct pci_dev *); int (*sriov_configure)(struct pci_dev *, int); const struct pci_error_handlers *err_handler; struct device_driver driver; struct pci_dynids dynids; } ;
615 struct res_counter { unsigned long long usage; unsigned long long max_usage; unsigned long long limit; unsigned long long soft_limit; unsigned long long failcnt; spinlock_t lock; struct res_counter *parent; } ;
226 struct kioctx ;
30 typedef int kiocb_cancel_fn(struct kiocb *);
31 union __anonunion_ki_obj_247 { void *user; struct task_struct *tsk; } ;
31 struct eventfd_ctx ;
31 struct kiocb { struct file *ki_filp; struct kioctx *ki_ctx; kiocb_cancel_fn *ki_cancel; void *private; union __anonunion_ki_obj_247 ki_obj; __u64 ki_user_data; loff_t ki_pos; size_t ki_nbytes; struct list_head ki_list; struct eventfd_ctx *ki_eventfd; } ;
100 struct sock_filter { __u16 code; __u8 jt; __u8 jf; __u32 k; } ;
20 union __anonunion____missing_field_name_248 { struct sock_filter insns[0U]; struct work_struct work; } ;
20 struct sk_filter { atomic_t refcnt; unsigned int len; struct callback_head rcu; unsigned int (*bpf_func)(const struct sk_buff *, const struct sock_filter *); union __anonunion____missing_field_name_248 __annonCompField77; } ;
32 struct poll_table_struct { void (*_qproc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); unsigned long _key; } ;
108 struct nla_policy { u16 type; u16 len; } ;
25 struct rtnl_link_ops { struct list_head list; const char *kind; size_t priv_size; void (*setup)(struct net_device *); int maxtype; const struct nla_policy *policy; int (*validate)(struct nlattr **, struct nlattr **); int (*newlink)(struct net *, struct net_device *, struct nlattr **, struct nlattr **); int (*changelink)(struct net_device *, struct nlattr **, struct nlattr **); void (*dellink)(struct net_device *, struct list_head *); size_t (*get_size)(const struct net_device *); int (*fill_info)(struct sk_buff *, const struct net_device *); size_t (*get_xstats_size)(const struct net_device *); int (*fill_xstats)(struct sk_buff *, const struct net_device *); unsigned int (*get_num_tx_queues)(); unsigned int (*get_num_rx_queues)(); int slave_maxtype; const struct nla_policy *slave_policy; int (*slave_validate)(struct nlattr **, struct nlattr **); int (*slave_changelink)(struct net_device *, struct net_device *, struct nlattr **, struct nlattr **); size_t (*get_slave_size)(const struct net_device *, const struct net_device *); int (*fill_slave_info)(struct sk_buff *, const struct net_device *, const struct net_device *); } ;
167 struct neigh_table ;
167 struct neigh_parms { struct net *net; struct net_device *dev; struct neigh_parms *next; int (*neigh_setup)(struct neighbour *); void (*neigh_cleanup)(struct neighbour *); struct neigh_table *tbl; void *sysctl_table; int dead; atomic_t refcnt; struct callback_head callback_head; int reachable_time; int data[12U]; unsigned long data_state[1U]; } ;
111 struct neigh_statistics { unsigned long allocs; unsigned long destroys; unsigned long hash_grows; unsigned long res_failed; unsigned long lookups; unsigned long hits; unsigned long rcv_probes_mcast; unsigned long rcv_probes_ucast; unsigned long periodic_gc_runs; unsigned long forced_gc_runs; unsigned long unres_discards; } ;
130 struct neigh_ops ;
130 struct neighbour { struct neighbour *next; struct neigh_table *tbl; struct neigh_parms *parms; unsigned long confirmed; unsigned long updated; rwlock_t lock; atomic_t refcnt; struct sk_buff_head arp_queue; unsigned int arp_queue_len_bytes; struct timer_list timer; unsigned long used; atomic_t probes; __u8 flags; __u8 nud_state; __u8 type; __u8 dead; seqlock_t ha_lock; unsigned char ha[32U]; struct hh_cache hh; int (*output)(struct neighbour *, struct sk_buff *); const struct neigh_ops *ops; struct callback_head rcu; struct net_device *dev; u8 primary_key[0U]; } ;
159 struct neigh_ops { int family; void (*solicit)(struct neighbour *, struct sk_buff *); void (*error_report)(struct neighbour *, struct sk_buff *); int (*output)(struct neighbour *, struct sk_buff *); int (*connected_output)(struct neighbour *, struct sk_buff *); } ;
167 struct pneigh_entry { struct pneigh_entry *next; struct net *net; struct net_device *dev; u8 flags; u8 key[0U]; } ;
177 struct neigh_hash_table { struct neighbour **hash_buckets; unsigned int hash_shift; __u32 hash_rnd[4U]; struct callback_head rcu; } ;
190 struct neigh_table { struct neigh_table *next; int family; int entry_size; int key_len; __u32 (*hash)(const void *, const struct net_device *, __u32 *); int (*constructor)(struct neighbour *); int (*pconstructor)(struct pneigh_entry *); void (*pdestructor)(struct pneigh_entry *); void (*proxy_redo)(struct sk_buff *); char *id; struct neigh_parms parms; int gc_interval; int gc_thresh1; int gc_thresh2; int gc_thresh3; unsigned long last_flush; struct delayed_work gc_work; struct timer_list proxy_timer; struct sk_buff_head proxy_queue; atomic_t entries; rwlock_t lock; unsigned long last_rand; struct neigh_statistics *stats; struct neigh_hash_table *nht; struct pneigh_entry **phash_buckets; } ;
462 struct dn_route ;
462 union __anonunion____missing_field_name_253 { struct dst_entry *next; struct rtable *rt_next; struct rt6_info *rt6_next; struct dn_route *dn_next; } ;
462 struct dst_entry { struct callback_head callback_head; struct dst_entry *child; struct net_device *dev; struct dst_ops *ops; unsigned long _metrics; unsigned long expires; struct dst_entry *path; struct dst_entry *from; struct xfrm_state *xfrm; int (*input)(struct sk_buff *); int (*output)(struct sk_buff *); unsigned short flags; unsigned short pending_confirm; short error; short obsolete; unsigned short header_len; unsigned short trailer_len; __u32 tclassid; long __pad_to_align_refcnt[2U]; atomic_t __refcnt; int __use; unsigned long lastuse; union __anonunion____missing_field_name_253 __annonCompField78; } ;
123 struct __anonstruct_socket_lock_t_254 { spinlock_t slock; int owned; wait_queue_head_t wq; struct lockdep_map dep_map; } ;
123 typedef struct __anonstruct_socket_lock_t_254 socket_lock_t;
123 struct proto ;
129 typedef __u32 __portpair;
130 typedef __u64 __addrpair;
131 struct __anonstruct____missing_field_name_256 { __be32 skc_daddr; __be32 skc_rcv_saddr; } ;
131 union __anonunion____missing_field_name_255 { __addrpair skc_addrpair; struct __anonstruct____missing_field_name_256 __annonCompField79; } ;
131 union __anonunion____missing_field_name_257 { unsigned int skc_hash; __u16 skc_u16hashes[2U]; } ;
131 struct __anonstruct____missing_field_name_259 { __be16 skc_dport; __u16 skc_num; } ;
131 union __anonunion____missing_field_name_258 { __portpair skc_portpair; struct __anonstruct____missing_field_name_259 __annonCompField82; } ;
131 union __anonunion____missing_field_name_260 { struct hlist_node skc_bind_node; struct hlist_nulls_node skc_portaddr_node; } ;
131 union __anonunion____missing_field_name_261 { struct hlist_node skc_node; struct hlist_nulls_node skc_nulls_node; } ;
131 struct sock_common { union __anonunion____missing_field_name_255 __annonCompField80; union __anonunion____missing_field_name_257 __annonCompField81; union __anonunion____missing_field_name_258 __annonCompField83; unsigned short skc_family; volatile unsigned char skc_state; unsigned char skc_reuse; unsigned char skc_reuseport; int skc_bound_dev_if; union __anonunion____missing_field_name_260 __annonCompField84; struct proto *skc_prot; struct net *skc_net; struct in6_addr skc_v6_daddr; struct in6_addr skc_v6_rcv_saddr; int skc_dontcopy_begin[0U]; union __anonunion____missing_field_name_261 __annonCompField85; int skc_tx_queue_mapping; atomic_t skc_refcnt; int skc_dontcopy_end[0U]; } ;
216 struct cg_proto ;
217 struct __anonstruct_sk_backlog_262 { atomic_t rmem_alloc; int len; struct sk_buff *head; struct sk_buff *tail; } ;
217 struct sock { struct sock_common __sk_common; socket_lock_t sk_lock; struct sk_buff_head sk_receive_queue; struct __anonstruct_sk_backlog_262 sk_backlog; int sk_forward_alloc; __u32 sk_rxhash; unsigned int sk_napi_id; unsigned int sk_ll_usec; atomic_t sk_drops; int sk_rcvbuf; struct sk_filter *sk_filter; struct socket_wq *sk_wq; struct xfrm_policy *sk_policy[2U]; unsigned long sk_flags; struct dst_entry *sk_rx_dst; struct dst_entry *sk_dst_cache; spinlock_t sk_dst_lock; atomic_t sk_wmem_alloc; atomic_t sk_omem_alloc; int sk_sndbuf; struct sk_buff_head sk_write_queue; unsigned char sk_shutdown; unsigned char sk_no_check; unsigned char sk_userlocks; unsigned char sk_protocol; unsigned short sk_type; int sk_wmem_queued; gfp_t sk_allocation; u32 sk_pacing_rate; u32 sk_max_pacing_rate; netdev_features_t sk_route_caps; netdev_features_t sk_route_nocaps; int sk_gso_type; unsigned int sk_gso_max_size; u16 sk_gso_max_segs; int sk_rcvlowat; unsigned long sk_lingertime; struct sk_buff_head sk_error_queue; struct proto *sk_prot_creator; rwlock_t sk_callback_lock; int sk_err; int sk_err_soft; unsigned short sk_ack_backlog; unsigned short sk_max_ack_backlog; __u32 sk_priority; __u32 sk_cgrp_prioidx; struct pid *sk_peer_pid; const struct cred *sk_peer_cred; long sk_rcvtimeo; long sk_sndtimeo; void *sk_protinfo; struct timer_list sk_timer; ktime_t sk_stamp; struct socket *sk_socket; void *sk_user_data; struct page_frag sk_frag; struct sk_buff *sk_send_head; __s32 sk_peek_off; int sk_write_pending; void *sk_security; __u32 sk_mark; u32 sk_classid; struct cg_proto *sk_cgrp; void (*sk_state_change)(struct sock *); void (*sk_data_ready)(struct sock *, int); void (*sk_write_space)(struct sock *); void (*sk_error_report)(struct sock *); int (*sk_backlog_rcv)(struct sock *, struct sk_buff *); void (*sk_destruct)(struct sock *); } ;
901 struct request_sock_ops ;
902 struct timewait_sock_ops ;
903 struct inet_hashinfo ;
904 struct raw_hashinfo ;
919 struct udp_table ;
919 union __anonunion_h_263 { struct inet_hashinfo *hashinfo; struct udp_table *udp_table; struct raw_hashinfo *raw_hash; } ;
919 struct proto { void (*close)(struct sock *, long); int (*connect)(struct sock *, struct sockaddr *, int); int (*disconnect)(struct sock *, int); struct sock * (*accept)(struct sock *, int, int *); int (*ioctl)(struct sock *, int, unsigned long); int (*init)(struct sock *); void (*destroy)(struct sock *); void (*shutdown)(struct sock *, int); int (*setsockopt)(struct sock *, int, int, char *, unsigned int); int (*getsockopt)(struct sock *, int, int, char *, int *); int (*compat_setsockopt)(struct sock *, int, int, char *, unsigned int); int (*compat_getsockopt)(struct sock *, int, int, char *, int *); int (*compat_ioctl)(struct sock *, unsigned int, unsigned long); int (*sendmsg)(struct kiocb *, struct sock *, struct msghdr *, size_t ); int (*recvmsg)(struct kiocb *, struct sock *, struct msghdr *, size_t , int, int, int *); int (*sendpage)(struct sock *, struct page *, int, size_t , int); int (*bind)(struct sock *, struct sockaddr *, int); int (*backlog_rcv)(struct sock *, struct sk_buff *); void (*release_cb)(struct sock *); void (*mtu_reduced)(struct sock *); void (*hash)(struct sock *); void (*unhash)(struct sock *); void (*rehash)(struct sock *); int (*get_port)(struct sock *, unsigned short); void (*clear_sk)(struct sock *, int); unsigned int inuse_idx; bool (*stream_memory_free)(const struct sock *); void (*enter_memory_pressure)(struct sock *); atomic_long_t *memory_allocated; struct percpu_counter *sockets_allocated; int *memory_pressure; long *sysctl_mem; int *sysctl_wmem; int *sysctl_rmem; int max_header; bool no_autobind; struct kmem_cache *slab; unsigned int obj_size; int slab_flags; struct percpu_counter *orphan_count; struct request_sock_ops *rsk_prot; struct timewait_sock_ops *twsk_prot; union __anonunion_h_263 h; struct module *owner; char name[32U]; struct list_head node; int (*init_cgroup)(struct mem_cgroup *, struct cgroup_subsys *); void (*destroy_cgroup)(struct mem_cgroup *); struct cg_proto * (*proto_cgroup)(struct mem_cgroup *); } ;
1044 struct cg_proto { struct res_counter memory_allocated; struct percpu_counter sockets_allocated; int memory_pressure; long sysctl_mem[3U]; unsigned long flags; struct mem_cgroup *memcg; } ;
169 struct request_sock_ops { int family; int obj_size; struct kmem_cache *slab; char *slab_name; int (*rtx_syn_ack)(struct sock *, struct request_sock *); void (*send_ack)(struct sock *, struct sk_buff *, struct request_sock *); void (*send_reset)(struct sock *, struct sk_buff *); void (*destructor)(struct request_sock *); void (*syn_ack_timeout)(struct sock *, struct request_sock *); } ;
47 struct request_sock { struct sock_common __req_common; struct request_sock *dl_next; u16 mss; u8 num_retrans; unsigned char cookie_ts; unsigned char num_timeout; u32 window_clamp; u32 rcv_wnd; u32 ts_recent; unsigned long expires; const struct request_sock_ops *rsk_ops; struct sock *sk; u32 secid; u32 peer_secid; } ;
372 struct timewait_sock_ops { struct kmem_cache *twsk_slab; char *twsk_slab_name; unsigned int twsk_obj_size; int (*twsk_unique)(struct sock *, struct sock *, void *); void (*twsk_destructor)(struct sock *); } ;
393 struct firmware { size_t size; const u8 *data; struct page **pages; void *priv; } ;
162 typedef u64 acpi_io_address;
419 typedef void *acpi_handle;
615 typedef u32 acpi_object_type;
865 struct __anonstruct_integer_270 { acpi_object_type type; u64 value; } ;
865 struct __anonstruct_string_271 { acpi_object_type type; u32 length; char *pointer; } ;
865 struct __anonstruct_buffer_272 { acpi_object_type type; u32 length; u8 *pointer; } ;
865 struct __anonstruct_package_273 { acpi_object_type type; u32 count; union acpi_object *elements; } ;
865 struct __anonstruct_reference_274 { acpi_object_type type; acpi_object_type actual_type; acpi_handle handle; } ;
865 struct __anonstruct_processor_275 { acpi_object_type type; u32 proc_id; acpi_io_address pblk_address; u32 pblk_length; } ;
865 struct __anonstruct_power_resource_276 { acpi_object_type type; u32 system_level; u32 resource_order; } ;
865 union acpi_object { acpi_object_type type; struct __anonstruct_integer_270 integer; struct __anonstruct_string_271 string; struct __anonstruct_buffer_272 buffer; struct __anonstruct_package_273 package; struct __anonstruct_reference_274 reference; struct __anonstruct_processor_275 processor; struct __anonstruct_power_resource_276 power_resource; } ;
109 struct acpi_driver ;
110 struct acpi_hotplug_profile { struct kobject kobj; int (*scan_dependent)(struct acpi_device *); bool enabled; bool demand_offline; } ;
131 struct acpi_scan_handler { const struct acpi_device_id *ids; struct list_head list_node; int (*attach)(struct acpi_device *, const struct acpi_device_id *); void (*detach)(struct acpi_device *); struct acpi_hotplug_profile hotplug; } ;
147 struct acpi_device_ops { int (*add)(struct acpi_device *); int (*remove)(struct acpi_device *); void (*notify)(struct acpi_device *, u32 ); } ;
153 struct acpi_driver { char name[80U]; char class[80U]; const struct acpi_device_id *ids; unsigned int flags; struct acpi_device_ops ops; struct device_driver drv; struct module *owner; } ;
165 struct acpi_device_status { unsigned char present; unsigned char enabled; unsigned char show_in_ui; unsigned char functional; unsigned char battery_present; unsigned int reserved; } ;
181 struct acpi_device_flags { unsigned char dynamic_status; unsigned char removable; unsigned char ejectable; unsigned char power_manageable; unsigned char match_driver; unsigned char initialized; unsigned char visited; unsigned char no_hotplug; unsigned int reserved; } ;
195 struct acpi_device_dir { struct proc_dir_entry *entry; } ;
206 typedef char acpi_bus_id[8U];
207 typedef unsigned long acpi_bus_address;
208 typedef char acpi_device_name[40U];
209 typedef char acpi_device_class[20U];
215 struct acpi_pnp_type { unsigned char hardware_id; unsigned char bus_address; unsigned int reserved; } ;
221 struct acpi_device_pnp { acpi_bus_id bus_id; struct acpi_pnp_type type; acpi_bus_address bus_address; char *unique_id; struct list_head ids; acpi_device_name device_name; acpi_device_class device_class; union acpi_object *str_obj; unsigned long sun; } ;
237 struct acpi_device_power_flags { unsigned char explicit_get; unsigned char power_resources; unsigned char inrush_current; unsigned char power_removed; unsigned char ignore_parent; unsigned int reserved; } ;
250 struct __anonstruct_flags_277 { unsigned char valid; unsigned char os_accessible; unsigned char explicit_set; unsigned char reserved; } ;
250 struct acpi_device_power_state { struct __anonstruct_flags_277 flags; int power; int latency; struct list_head resources; } ;
262 struct acpi_device_power { int state; struct acpi_device_power_flags flags; struct acpi_device_power_state states[5U]; } ;
268 struct acpi_device_perf_flags { u8 reserved; } ;
274 struct __anonstruct_flags_278 { unsigned char valid; unsigned char reserved; } ;
274 struct acpi_device_perf_state { struct __anonstruct_flags_278 flags; u8 power; u8 performance; int latency; } ;
284 struct acpi_device_perf { int state; struct acpi_device_perf_flags flags; int state_count; struct acpi_device_perf_state *states; } ;
291 struct acpi_device_wakeup_flags { unsigned char valid; unsigned char run_wake; unsigned char notifier_present; } ;
298 struct acpi_device_wakeup { acpi_handle gpe_device; u64 gpe_number; u64 sleep_state; struct list_head resources; struct acpi_device_wakeup_flags flags; int prepare_count; } ;
314 struct acpi_device { int device_type; acpi_handle handle; struct acpi_device *parent; struct list_head children; struct list_head node; struct list_head wakeup_list; struct list_head del_list; struct acpi_device_status status; struct acpi_device_flags flags; struct acpi_device_pnp pnp; struct acpi_device_power power; struct acpi_device_wakeup wakeup; struct acpi_device_perf performance; struct acpi_device_dir dir; struct acpi_scan_handler *handler; struct acpi_driver *driver; void *driver_data; struct device dev; unsigned int physical_node_count; struct list_head physical_node_list; struct mutex physical_node_lock; void (*remove)(struct acpi_device *); } ;
1119 struct ieee80211_mcs_info { u8 rx_mask[10U]; __le16 rx_highest; u8 tx_params; u8 reserved[3U]; } ;
1144 struct ieee80211_ht_cap { __le16 cap_info; u8 ampdu_params_info; struct ieee80211_mcs_info mcs; __le16 extended_ht_cap_info; __le32 tx_BF_cap_info; u8 antenna_selection_info; } ;
1254 struct ieee80211_vht_mcs_info { __le16 rx_mcs_map; __le16 rx_highest; __le16 tx_mcs_map; __le16 tx_highest; } ;
1335 struct ieee80211_vht_cap { __le32 vht_cap_info; struct ieee80211_vht_mcs_info supp_mcs; } ;
42 struct lib80211_crypto_ops { const char *name; struct list_head list; void * (*init)(int); void (*deinit)(void *); int (*encrypt_mpdu)(struct sk_buff *, int, void *); int (*decrypt_mpdu)(struct sk_buff *, int, void *); int (*encrypt_msdu)(struct sk_buff *, int, void *); int (*decrypt_msdu)(struct sk_buff *, int, int, void *); int (*set_key)(void *, int, u8 *, void *); int (*get_key)(void *, int, u8 *, void *); void (*print_stats)(struct seq_file *, void *); unsigned long int (*get_flags)(void *); unsigned long int (*set_flags)(unsigned long, void *); int extra_mpdu_prefix_len; int extra_mpdu_postfix_len; int extra_msdu_prefix_len; int extra_msdu_postfix_len; struct module *owner; } ;
96 struct lib80211_crypt_data { struct list_head list; struct lib80211_crypto_ops *ops; void *priv; atomic_t refcnt; } ;
103 struct lib80211_crypt_info { char *name; spinlock_t *lock; struct lib80211_crypt_data *crypt[4U]; int tx_keyidx; struct list_head crypt_deinit_list; struct timer_list crypt_deinit_timer; int crypt_quiesced; } ;
405 struct tasklet_struct { struct tasklet_struct *next; unsigned long state; atomic_t count; void (*func)(unsigned long); unsigned long data; } ;
386 struct iw_param { __s32 value; __u8 fixed; __u8 disabled; __u16 flags; } ;
680 struct iw_point { void *pointer; __u16 length; __u16 flags; } ;
691 struct iw_freq { __s32 m; __s16 e; __u8 i; __u8 flags; } ;
708 struct iw_quality { __u8 qual; __u8 level; __u8 noise; __u8 updated; } ;
720 struct iw_discarded { __u32 nwid; __u32 code; __u32 fragment; __u32 retries; __u32 misc; } ;
736 struct iw_missed { __u32 beacon; } ;
842 struct iw_mlme { __u16 cmd; __u16 reason_code; struct sockaddr addr; } ;
882 struct iw_statistics { __u16 status; struct iw_quality qual; struct iw_discarded discard; struct iw_missed miss; } ;
897 union iwreq_data { char name[16U]; struct iw_point essid; struct iw_param nwid; struct iw_freq freq; struct iw_param sens; struct iw_param bitrate; struct iw_param txpower; struct iw_param rts; struct iw_param frag; __u32 mode; struct iw_param retry; struct iw_point encoding; struct iw_param power; struct iw_quality qual; struct sockaddr ap_addr; struct sockaddr addr; struct iw_param param; struct iw_point data; } ;
957 struct iw_range { __u32 throughput; __u32 min_nwid; __u32 max_nwid; __u16 old_num_channels; __u8 old_num_frequency; __u8 scan_capa; __u32 event_capa[6U]; __s32 sensitivity; struct iw_quality max_qual; struct iw_quality avg_qual; __u8 num_bitrates; __s32 bitrate[32U]; __s32 min_rts; __s32 max_rts; __s32 min_frag; __s32 max_frag; __s32 min_pmp; __s32 max_pmp; __s32 min_pmt; __s32 max_pmt; __u16 pmp_flags; __u16 pmt_flags; __u16 pm_capa; __u16 encoding_size[8U]; __u8 num_encoding_sizes; __u8 max_encoding_tokens; __u8 encoding_login_index; __u16 txpower_capa; __u8 num_txpower; __s32 txpower[8U]; __u8 we_version_compiled; __u8 we_version_source; __u16 retry_capa; __u16 retry_flags; __u16 r_time_flags; __s32 min_retry; __s32 max_retry; __s32 min_r_time; __s32 max_r_time; __u16 num_channels; __u8 num_frequency; struct iw_freq freq[32U]; __u32 enc_capa; } ;
1068 struct iw_priv_args { __u32 cmd; __u16 set_args; __u16 get_args; char name[16U]; } ;
30 struct iw_request_info { __u16 cmd; __u16 flags; } ;
314 typedef int (*iw_handler)(struct net_device *, struct iw_request_info *, union iwreq_data *, char *);
315 struct iw_handler_def { const iw_handler (**standard)(struct net_device *, struct iw_request_info *, union iwreq_data *, char *); __u16 num_standard; __u16 num_private; __u16 num_private_args; const iw_handler (**private)(struct net_device *, struct iw_request_info *, union iwreq_data *, char *); const struct iw_priv_args *private_args; struct iw_statistics * (*get_wireless_stats)(struct net_device *); } ;
381 struct iw_spy_data { int spy_number; u_char spy_address[8U][6U]; struct iw_quality spy_stat[8U]; struct iw_quality spy_thr_low; struct iw_quality spy_thr_high; u_char spy_thr_under[8U]; } ;
405 struct libipw_device ;
406 struct iw_public_data { struct iw_spy_data *spy_data; struct libipw_device *libipw; } ;
574 struct ieee80211_radiotap_header { u8 it_version; u8 it_pad; __le16 it_len; __le32 it_present; } ;
423 enum nl80211_iftype { NL80211_IFTYPE_UNSPECIFIED = 0, NL80211_IFTYPE_ADHOC = 1, NL80211_IFTYPE_STATION = 2, NL80211_IFTYPE_AP = 3, NL80211_IFTYPE_AP_VLAN = 4, NL80211_IFTYPE_WDS = 5, NL80211_IFTYPE_MONITOR = 6, NL80211_IFTYPE_MESH_POINT = 7, NL80211_IFTYPE_P2P_CLIENT = 8, NL80211_IFTYPE_P2P_GO = 9, NL80211_IFTYPE_P2P_DEVICE = 10, NUM_NL80211_IFTYPES = 11, NL80211_IFTYPE_MAX = 10 } ;
2157 enum nl80211_reg_initiator { NL80211_REGDOM_SET_BY_CORE = 0, NL80211_REGDOM_SET_BY_USER = 1, NL80211_REGDOM_SET_BY_DRIVER = 2, NL80211_REGDOM_SET_BY_COUNTRY_IE = 3 } ;
2203 enum nl80211_dfs_regions { NL80211_DFS_UNSET = 0, NL80211_DFS_FCC = 1, NL80211_DFS_ETSI = 2, NL80211_DFS_JP = 3 } ;
2210 enum nl80211_user_reg_hint_type { NL80211_USER_REG_HINT_USER = 0, NL80211_USER_REG_HINT_CELL_BASE = 1 } ;
2324 enum nl80211_chan_width { NL80211_CHAN_WIDTH_20_NOHT = 0, NL80211_CHAN_WIDTH_20 = 1, NL80211_CHAN_WIDTH_40 = 2, NL80211_CHAN_WIDTH_80 = 3, NL80211_CHAN_WIDTH_80P80 = 4, NL80211_CHAN_WIDTH_160 = 5, NL80211_CHAN_WIDTH_5 = 6, NL80211_CHAN_WIDTH_10 = 7 } ;
2365 enum nl80211_auth_type { NL80211_AUTHTYPE_OPEN_SYSTEM = 0, NL80211_AUTHTYPE_SHARED_KEY = 1, NL80211_AUTHTYPE_FT = 2, NL80211_AUTHTYPE_NETWORK_EAP = 3, NL80211_AUTHTYPE_SAE = 4, __NL80211_AUTHTYPE_NUM = 5, NL80211_AUTHTYPE_MAX = 4, NL80211_AUTHTYPE_AUTOMATIC = 5 } ;
2383 enum nl80211_mfp { NL80211_MFP_NO = 0, NL80211_MFP_REQUIRED = 1 } ;
3324 struct nl80211_wowlan_tcp_data_seq { __u32 start; __u32 offset; __u32 len; } ;
3437 struct nl80211_wowlan_tcp_data_token { __u32 offset; __u32 len; __u8 token_stream[]; } ;
3449 struct nl80211_wowlan_tcp_data_token_feature { __u32 min_len; __u32 max_len; __u32 bufsize; } ;
3667 enum nl80211_dfs_state { NL80211_DFS_USABLE = 0, NL80211_DFS_UNAVAILABLE = 1, NL80211_DFS_AVAILABLE = 2 } ;
3689 struct nl80211_vendor_cmd_info { __u32 vendor_id; __u32 subcmd; } ;
4039 enum environment_cap { ENVIRON_ANY = 0, ENVIRON_INDOOR = 1, ENVIRON_OUTDOOR = 2 } ;
4045 struct regulatory_request { struct callback_head callback_head; int wiphy_idx; enum nl80211_reg_initiator initiator; enum nl80211_user_reg_hint_type user_reg_hint_type; char alpha2[2U]; enum nl80211_dfs_regions dfs_region; bool intersect; bool processed; enum environment_cap country_ie_env; struct list_head list; } ;
96 struct ieee80211_freq_range { u32 start_freq_khz; u32 end_freq_khz; u32 max_bandwidth_khz; } ;
148 struct ieee80211_power_rule { u32 max_antenna_gain; u32 max_eirp; } ;
153 struct ieee80211_reg_rule { struct ieee80211_freq_range freq_range; struct ieee80211_power_rule power_rule; u32 flags; } ;
159 struct ieee80211_regdomain { struct callback_head callback_head; u32 n_reg_rules; char alpha2[2U]; enum nl80211_dfs_regions dfs_region; struct ieee80211_reg_rule reg_rules[]; } ;
167 struct wiphy ;
168 enum ieee80211_band { IEEE80211_BAND_2GHZ = 0, IEEE80211_BAND_5GHZ = 1, IEEE80211_BAND_60GHZ = 2, IEEE80211_NUM_BANDS = 3 } ;
186 struct ieee80211_channel { enum ieee80211_band band; u16 center_freq; u16 hw_value; u32 flags; int max_antenna_gain; int max_power; int max_reg_power; bool beacon_found; u32 orig_flags; int orig_mag; int orig_mpwr; enum nl80211_dfs_state dfs_state; unsigned long dfs_state_entered; } ;
179 struct ieee80211_rate { u32 flags; u16 bitrate; u16 hw_value; u16 hw_value_short; } ;
222 struct ieee80211_sta_ht_cap { u16 cap; bool ht_supported; u8 ampdu_factor; u8 ampdu_density; struct ieee80211_mcs_info mcs; } ;
242 struct ieee80211_sta_vht_cap { bool vht_supported; u32 cap; struct ieee80211_vht_mcs_info vht_mcs; } ;
258 struct ieee80211_supported_band { struct ieee80211_channel *channels; struct ieee80211_rate *bitrates; enum ieee80211_band band; int n_channels; int n_bitrates; struct ieee80211_sta_ht_cap ht_cap; struct ieee80211_sta_vht_cap vht_cap; } ;
337 struct cfg80211_chan_def { struct ieee80211_channel *chan; enum nl80211_chan_width width; u32 center_freq1; u32 center_freq2; } ;
550 struct cfg80211_crypto_settings { u32 wpa_versions; u32 cipher_group; int n_ciphers_pairwise; u32 ciphers_pairwise[5U]; int n_akm_suites; u32 akm_suites[2U]; bool control_port; __be16 control_port_ethertype; bool control_port_no_encrypt; } ;
613 struct mac_address { u8 addr[6U]; } ;
1446 enum cfg80211_signal_type { CFG80211_SIGNAL_TYPE_NONE = 0, CFG80211_SIGNAL_TYPE_MBM = 1, CFG80211_SIGNAL_TYPE_UNSPEC = 2 } ;
1647 struct cfg80211_ibss_params { u8 *ssid; u8 *bssid; struct cfg80211_chan_def chandef; u8 *ie; u8 ssid_len; u8 ie_len; u16 beacon_interval; u32 basic_rates; bool channel_fixed; bool privacy; bool control_port; bool userspace_handles_dfs; int mcast_rate[3U]; struct ieee80211_ht_cap ht_capa; struct ieee80211_ht_cap ht_capa_mask; } ;
1695 struct cfg80211_connect_params { struct ieee80211_channel *channel; u8 *bssid; u8 *ssid; size_t ssid_len; enum nl80211_auth_type auth_type; u8 *ie; size_t ie_len; bool privacy; enum nl80211_mfp mfp; struct cfg80211_crypto_settings crypto; const u8 *key; u8 key_len; u8 key_idx; u32 flags; int bg_scan_period; struct ieee80211_ht_cap ht_capa; struct ieee80211_ht_cap ht_capa_mask; struct ieee80211_vht_cap vht_capa; struct ieee80211_vht_cap vht_capa_mask; } ;
1786 struct cfg80211_pkt_pattern { u8 *mask; u8 *pattern; int pattern_len; int pkt_offset; } ;
1803 struct cfg80211_wowlan_tcp { struct socket *sock; __be32 src; __be32 dst; u16 src_port; u16 dst_port; u8 dst_mac[6U]; int payload_len; const u8 *payload; struct nl80211_wowlan_tcp_data_seq payload_seq; u32 data_interval; u32 wake_len; const u8 *wake_data; const u8 *wake_mask; u32 tokens_size; struct nl80211_wowlan_tcp_data_token payload_tok; } ;
1838 struct cfg80211_wowlan { bool any; bool disconnect; bool magic_pkt; bool gtk_rekey_failure; bool eap_identity_req; bool four_way_handshake; bool rfkill_release; struct cfg80211_pkt_pattern *patterns; struct cfg80211_wowlan_tcp *tcp; int n_patterns; } ;
2527 struct ieee80211_iface_limit { u16 max; u16 types; } ;
2588 struct ieee80211_iface_combination { const struct ieee80211_iface_limit *limits; u32 num_different_channels; u16 max_interfaces; u8 n_limits; bool beacon_int_infra_match; u8 radar_detect_widths; } ;
2654 struct ieee80211_txrx_stypes { u16 tx; u16 rx; } ;
2669 struct wiphy_wowlan_tcp_support { const struct nl80211_wowlan_tcp_data_token_feature *tok; u32 data_payload_max; u32 data_interval_max; u32 wake_payload_max; bool seq; } ;
2693 struct wiphy_wowlan_support { u32 flags; int n_patterns; int pattern_max_len; int pattern_min_len; int max_pkt_offset; const struct wiphy_wowlan_tcp_support *tcp; } ;
2712 struct wiphy_coalesce_support { int n_rules; int max_delay; int n_patterns; int pattern_max_len; int pattern_min_len; int max_pkt_offset; } ;
2737 struct wiphy_vendor_command { struct nl80211_vendor_cmd_info info; u32 flags; int (*doit)(struct wiphy *, struct wireless_dev *, const void *, int); } ;
2758 struct wiphy { u8 perm_addr[6U]; u8 addr_mask[6U]; struct mac_address *addresses; const struct ieee80211_txrx_stypes *mgmt_stypes; const struct ieee80211_iface_combination *iface_combinations; int n_iface_combinations; u16 software_iftypes; u16 n_addresses; u16 interface_modes; u16 max_acl_mac_addrs; u32 flags; u32 regulatory_flags; u32 features; u32 ap_sme_capa; enum cfg80211_signal_type signal_type; int bss_priv_size; u8 max_scan_ssids; u8 max_sched_scan_ssids; u8 max_match_sets; u16 max_scan_ie_len; u16 max_sched_scan_ie_len; int n_cipher_suites; const u32 *cipher_suites; u8 retry_short; u8 retry_long; u32 frag_threshold; u32 rts_threshold; u8 coverage_class; char fw_version[32U]; u32 hw_version; const struct wiphy_wowlan_support *wowlan; struct cfg80211_wowlan *wowlan_config; u16 max_remain_on_channel_duration; u8 max_num_pmkids; u32 available_antennas_tx; u32 available_antennas_rx; u32 probe_resp_offload; const u8 *extended_capabilities; const u8 *extended_capabilities_mask; u8 extended_capabilities_len; const void *privid; struct ieee80211_supported_band *bands[3U]; void (*reg_notifier)(struct wiphy *, struct regulatory_request *); const struct ieee80211_regdomain *regd; struct device dev; bool registered; struct dentry *debugfsdir; const struct ieee80211_ht_cap *ht_capa_mod_mask; const struct ieee80211_vht_cap *vht_capa_mod_mask; struct net *_net; const struct iw_handler_def *wext; const struct wiphy_coalesce_support *coalesce; const struct wiphy_vendor_command *vendor_commands; const struct nl80211_vendor_cmd_info *vendor_events; int n_vendor_commands; int n_vendor_events; char priv[0U]; } ;
3103 struct cfg80211_conn ;
3104 struct cfg80211_internal_bss ;
3105 struct cfg80211_cached_keys ;
3106 struct __anonstruct_wext_317 { struct cfg80211_ibss_params ibss; struct cfg80211_connect_params connect; struct cfg80211_cached_keys *keys; u8 *ie; size_t ie_len; u8 bssid[6U]; u8 prev_bssid[6U]; u8 ssid[32U]; s8 default_key; s8 default_mgmt_key; bool prev_bssid_valid; } ;
3106 struct wireless_dev { struct wiphy *wiphy; enum nl80211_iftype iftype; struct list_head list; struct net_device *netdev; u32 identifier; struct list_head mgmt_registrations; spinlock_t mgmt_registrations_lock; struct mutex mtx; bool use_4addr; bool p2p_started; u8 address[6U]; u8 ssid[32U]; u8 ssid_len; u8 mesh_id_len; u8 mesh_id_up_len; struct cfg80211_conn *conn; struct cfg80211_cached_keys *connect_keys; struct list_head event_list; spinlock_t event_lock; struct cfg80211_internal_bss *current_bss; struct cfg80211_chan_def preset_chandef; struct ieee80211_channel *channel; bool ibss_fixed; bool ibss_dfs_possible; bool ps; int ps_timeout; int beacon_interval; u32 ap_unexpected_nlportid; bool cac_started; unsigned long cac_start_time; struct __anonstruct_wext_317 wext; } ;
149 struct libipw_rx_stats { u32 mac_time; s8 rssi; u8 signal; u8 noise; u16 rate; u8 received_channel; u8 control; u8 mask; u8 freq; u16 len; u64 tsf; u32 beacon_time; } ;
241 struct libipw_frag_entry { unsigned long first_frag_time; unsigned int seq; unsigned int last_frag; struct sk_buff *skb; u8 src_addr[6U]; u8 dst_addr[6U]; } ;
256 struct libipw_stats { unsigned int tx_unicast_frames; unsigned int tx_multicast_frames; unsigned int tx_fragments; unsigned int tx_unicast_octets; unsigned int tx_multicast_octets; unsigned int tx_deferred_transmissions; unsigned int tx_single_retry_frames; unsigned int tx_multiple_retry_frames; unsigned int tx_retry_limit_exceeded; unsigned int tx_discards; unsigned int rx_unicast_frames; unsigned int rx_multicast_frames; unsigned int rx_fragments; unsigned int rx_unicast_octets; unsigned int rx_multicast_octets; unsigned int rx_fcs_errors; unsigned int rx_discards_no_buffer; unsigned int tx_discards_wrong_sa; unsigned int rx_discards_undecryptable; unsigned int rx_message_in_msg_fragments; unsigned int rx_message_in_bad_msg_fragments; } ;
280 struct libipw_security { unsigned char active_key; unsigned char enabled; unsigned char unicast_uses_group; unsigned char encrypt; u8 auth_mode; u8 encode_alg[4U]; u8 key_sizes[4U]; u8 keys[4U][32U]; u8 level; u16 flags; } ;
351 struct libipw_hdr_3addr { __le16 frame_ctl; __le16 duration_id; u8 addr1[6U]; u8 addr2[6U]; u8 addr3[6U]; __le16 seq_ctl; u8 payload[0U]; } ;
361 struct libipw_hdr_4addr { __le16 frame_ctl; __le16 duration_id; u8 addr1[6U]; u8 addr2[6U]; u8 addr3[6U]; __le16 seq_ctl; u8 addr4[6U]; u8 payload[0U]; } ;
383 struct libipw_info_element { u8 id; u8 len; u8 data[0U]; } ;
389 struct libipw_auth { struct libipw_hdr_3addr header; __le16 algorithm; __le16 transaction; __le16 status; struct libipw_info_element info_element[0U]; } ;
415 struct libipw_channel_switch { u8 id; u8 len; u8 mode; u8 channel; u8 count; } ;
423 struct libipw_action_exchange { u8 token; struct libipw_info_element info_element[0U]; } ;
433 union __anonunion_format_318 { struct libipw_action_exchange exchange; struct libipw_channel_switch channel_switch; } ;
433 struct libipw_action { struct libipw_hdr_3addr header; u8 category; u8 action; union __anonunion_format_318 format; } ;
437 struct libipw_disassoc { struct libipw_hdr_3addr header; __le16 reason; } ;
442 struct libipw_probe_request { struct libipw_hdr_3addr header; struct libipw_info_element info_element[0U]; } ;
451 struct libipw_probe_response { struct libipw_hdr_3addr header; __le32 time_stamp[2U]; __le16 beacon_interval; __le16 capability; struct libipw_info_element info_element[0U]; } ;
472 struct libipw_reassoc_request { struct libipw_hdr_3addr header; __le16 capability; __le16 listen_interval; u8 current_ap[6U]; struct libipw_info_element info_element[0U]; } ;
480 struct libipw_assoc_response { struct libipw_hdr_3addr header; __le16 capability; __le16 status; __le16 aid; struct libipw_info_element info_element[0U]; } ;
489 struct libipw_txb { u8 nr_frags; u8 encrypted; u8 rts_included; u8 reserved; u16 frag_size; u16 payload_size; struct sk_buff *fragments[0U]; } ;
563 struct libipw_qos_parameters { __le16 cw_min[4U]; __le16 cw_max[4U]; u8 aifs[4U]; u8 flag[4U]; __le16 tx_op_limit[4U]; } ;
571 struct libipw_qos_data { struct libipw_qos_parameters parameters; int active; int supported; u8 param_count; u8 old_param_count; } ;
579 struct libipw_tim_parameters { u8 tim_count; u8 tim_period; } ;
584 struct libipw_tpc_report { u8 transmit_power; u8 link_margin; } ;
591 struct libipw_channel_map { u8 channel; u8 map; } ;
596 struct libipw_ibss_dfs { struct libipw_info_element ie; u8 owner[6U]; u8 recovery_interval; struct libipw_channel_map channel_map[0U]; } ;
603 struct libipw_csa { u8 mode; u8 channel; u8 count; } ;
609 struct libipw_quiet { u8 count; u8 period; u8 duration; u8 offset; } ;
616 struct libipw_network { u8 bssid[6U]; u8 channel; u8 ssid[33U]; u8 ssid_len; struct libipw_qos_data qos_data; struct libipw_rx_stats stats; u16 capability; u8 rates[12U]; u8 rates_len; u8 rates_ex[16U]; u8 rates_ex_len; unsigned long last_scanned; u8 mode; u32 flags; u32 last_associate; u32 time_stamp[2U]; u16 beacon_interval; u16 listen_interval; u16 atim_window; u8 erp_value; u8 wpa_ie[64U]; size_t wpa_ie_len; u8 rsn_ie[64U]; size_t rsn_ie_len; struct libipw_tim_parameters tim; u8 power_constraint; struct libipw_tpc_report tpc_report; struct libipw_ibss_dfs *ibss_dfs; struct libipw_csa csa; struct libipw_quiet quiet; struct list_head list; } ;
669 enum libipw_state { LIBIPW_UNINITIALIZED = 0, LIBIPW_INITIALIZED = 1, LIBIPW_ASSOCIATING = 2, LIBIPW_ASSOCIATED = 3, LIBIPW_AUTHENTICATING = 4, LIBIPW_AUTHENTICATED = 5, LIBIPW_SHUTDOWN = 6 } ;
689 struct libipw_channel { u32 freq; u8 channel; u8 flags; u8 max_power; } ;
713 struct libipw_geo { u8 name[4U]; u8 bg_channels; u8 a_channels; struct libipw_channel bg[14U]; struct libipw_channel a[132U]; } ;
721 struct libipw_device { struct net_device *dev; struct wireless_dev wdev; struct libipw_security sec; struct libipw_stats ieee_stats; struct libipw_geo geo; struct ieee80211_supported_band bg_band; struct ieee80211_supported_band a_band; struct list_head network_free_list; struct list_head network_list; struct libipw_network *networks[128U]; int scans; int scan_age; int iw_mode; struct iw_spy_data spy_data; spinlock_t lock; int tx_headroom; u32 config; int open_wep; int host_encrypt; int host_encrypt_msdu; int host_decrypt; int host_mc_decrypt; int host_strip_iv_icv; int host_open_frag; int ieee802_1x; int wpa_enabled; int drop_unencrypted; int privacy_invoked; size_t wpa_ie_len; u8 *wpa_ie; struct lib80211_crypt_info crypt_info; int bcrx_sta_key; struct libipw_frag_entry frag_cache[4U]; unsigned int frag_next_idx; u16 fts; u16 rts; u8 bssid[6U]; enum libipw_state state; int mode; int modulation; int freq_band; int abg_true; int perfect_rssi; int worst_rssi; u16 prev_seq_ctl; void (*set_security)(struct net_device *, struct libipw_security *); netdev_tx_t (*hard_start_xmit)(struct libipw_txb *, struct net_device *, int); int (*is_queue_full)(struct net_device *, int); int (*handle_management)(struct net_device *, struct libipw_network *, u16 ); int (*is_qos_active)(struct net_device *, struct sk_buff *); int (*handle_auth)(struct net_device *, struct libipw_auth *); int (*handle_deauth)(struct net_device *, struct libipw_disassoc *); int (*handle_action)(struct net_device *, struct libipw_action *, struct libipw_rx_stats *); int (*handle_disassoc)(struct net_device *, struct libipw_disassoc *); int (*handle_beacon)(struct net_device *, struct libipw_probe_response *, struct libipw_network *); int (*handle_probe_response)(struct net_device *, struct libipw_probe_response *, struct libipw_network *); int (*handle_probe_request)(struct net_device *, struct libipw_probe_request *, struct libipw_rx_stats *); int (*handle_assoc_response)(struct net_device *, struct libipw_assoc_response *, struct libipw_network *); int (*handle_assoc_request)(struct net_device *); int (*handle_reassoc_request)(struct net_device *, struct libipw_reassoc_request *); u8 priv[0U]; } ;
1012 struct ipw2100_priv ;
1013 struct ipw2100_tx_packet ;
1014 struct ipw2100_rx_packet ;
140 struct __anonstruct_fields_320 { unsigned char nlf; unsigned char txType; unsigned char intEnabled; unsigned char reserved; } ;
140 union __anonunion_info_319 { struct __anonstruct_fields_320 fields; u8 field; } ;
140 struct bd_status { union __anonunion_info_319 info; } ;
159 struct ipw2100_bd { u32 host_addr; u32 buf_length; struct bd_status status; u8 num_fragments; u8 reserved[6U]; } ;
169 struct ipw2100_bd_queue { struct ipw2100_bd *drv; dma_addr_t nic; u32 size; u32 entries; u32 available; u32 oldest; u32 next; } ;
202 struct ipw2100_status { u32 frame_size; u16 status_fields; u8 flags; u8 rssi; } ;
227 struct ipw2100_status_queue { struct ipw2100_status *drv; dma_addr_t nic; u32 size; } ;
238 struct __anonstruct_fixed_ies_321 { u16 capab_info; u16 listen_interval; u8 current_ap[6U]; } ;
238 struct ipw2100_wpa_assoc_frame { u16 fixed_ie_mask; struct __anonstruct_fixed_ies_321 fixed_ies; u32 var_ie_len; u8 var_ie[384U]; } ;
258 struct ipw2100_cmd_header { u32 host_command_reg; u32 host_command_reg1; u32 sequence; u32 host_command_len_reg; u32 host_command_params_reg[100U]; u32 cmd_status_reg; u32 cmd_status_params_reg[3U]; u32 rxq_base_ptr; u32 rxq_next_ptr; u32 rxq_host_ptr; u32 txq_base_ptr; u32 txq_next_ptr; u32 txq_host_ptr; u32 tx_status_reg; u32 reserved; u32 status_change_reg; u32 reserved1[3U]; u32 *ordinal1_ptr; u32 *ordinal2_ptr; } ;
288 struct ipw2100_data_header { u32 host_command_reg; u32 host_command_reg1; u8 encrypted; u8 needs_encryption; u8 wep_index; u8 key_size; u8 key[16U]; u8 reserved[10U]; u8 src_addr[6U]; u8 dst_addr[6U]; u16 fragment_size; } ;
302 struct host_command { u32 host_command; u32 host_command1; u32 host_command_sequence; u32 host_command_length; u32 host_command_parameters[100U]; } ;
325 struct __anonstruct_c_struct_323 { struct ipw2100_cmd_header *cmd; dma_addr_t cmd_phys; } ;
325 struct __anonstruct_d_struct_324 { struct ipw2100_data_header *data; dma_addr_t data_phys; struct libipw_txb *txb; } ;
325 union __anonunion_info_322 { struct __anonstruct_c_struct_323 c_struct; struct __anonstruct_d_struct_324 d_struct; } ;
325 struct ipw2100_tx_packet { int type; int index; union __anonunion_info_322 info; int jiffy_start; struct list_head list; } ;
344 struct ipw2100_rx ;
344 struct ipw2100_rx_packet { struct ipw2100_rx *rxp; dma_addr_t dma_addr; int jiffy_start; struct sk_buff *skb; struct list_head list; } ;
352 struct ipw2100_ordinals { u32 table1_addr; u32 table2_addr; u32 table1_size; u32 table2_size; } ;
369 struct ipw2100_notification { u32 hnhdr_subtype; u32 hnhdr_size; } ;
375 struct statistic { int value; int hi; int lo; } ;
406 struct ipw2100_priv { void *ioaddr; int stop_hang_check; int stop_rf_kill; struct libipw_device *ieee; unsigned long status; unsigned long config; unsigned long capability; int resets; int reset_backoff; u8 essid[32U]; u8 essid_len; u8 bssid[6U]; u8 channel; int last_mode; unsigned long connect_start; unsigned long last_reset; u32 channel_mask; u32 fatal_error; u32 fatal_errors[5U]; u32 fatal_index; int eeprom_version; int firmware_version; unsigned long hw_features; int hangs; u32 last_rtc; int dump_raw; u8 *snapshot[48U]; u8 mandatory_bssid_mac[6U]; u8 mac_addr[6U]; int power_mode; int messages_sent; int short_retry_limit; int long_retry_limit; u32 rts_threshold; u32 frag_threshold; int in_isr; u32 tx_rates; int tx_power; u32 beacon_interval; char nick[33U]; struct ipw2100_status_queue status_queue; struct statistic txq_stat; struct statistic rxq_stat; struct ipw2100_bd_queue rx_queue; struct ipw2100_bd_queue tx_queue; struct ipw2100_rx_packet *rx_buffers; struct statistic fw_pend_stat; struct list_head fw_pend_list; struct statistic msg_free_stat; struct statistic msg_pend_stat; struct list_head msg_free_list; struct list_head msg_pend_list; struct ipw2100_tx_packet *msg_buffers; struct statistic tx_free_stat; struct statistic tx_pend_stat; struct list_head tx_free_list; struct list_head tx_pend_list; struct ipw2100_tx_packet *tx_buffers; struct ipw2100_ordinals ordinals; struct pci_dev *pci_dev; struct proc_dir_entry *dir_dev; struct net_device *net_dev; struct iw_statistics wstats; struct iw_public_data wireless_data; struct tasklet_struct irq_tasklet; struct delayed_work reset_work; struct delayed_work security_work; struct delayed_work wx_event_work; struct delayed_work hang_check; struct delayed_work rf_kill; struct delayed_work scan_event; int user_requested_scan; unsigned long suspend_at; unsigned long suspend_time; u32 interrupts; int tx_interrupts; int rx_interrupts; int inta_other; spinlock_t low_lock; struct mutex action_mutex; struct mutex adapter_mutex; wait_queue_head_t wait_command_queue; } ;
599 union __anonunion_rx_data_325 { unsigned char payload[2340U]; struct libipw_hdr_4addr header; u32 status; struct ipw2100_notification notification; struct ipw2100_cmd_header command; } ;
599 struct ipw2100_rx { union __anonunion_rx_data_325 rx_data; } ;
1141 struct ipw2100_fw_chunk_set { const void *data; unsigned long size; } ;
1146 struct ipw2100_fw { int version; struct ipw2100_fw_chunk_set fw; struct ipw2100_fw_chunk_set uc; const struct firmware *fw_entry; } ;
2212 struct ipw2100_status_indicator { int status; void (*cb)(struct ipw2100_priv *, u32 ); char *name; } ;
2547 struct ipw_rt_hdr { struct ieee80211_radiotap_header rt_hdr; s8 rt_dbmsignal; } ;
3574 struct __anonstruct_hw_data_330 { u32 addr; const char *name; } ;
3584 struct __anonstruct_nic_data_331 { u32 addr; const char *name; size_t size; } ;
3592 struct __anonstruct_ord_data_332 { u8 index; const char *name; const char *desc; } ;
5173 struct security_info_params { u32 allowed_ciphers; u16 version; u8 auth_mode; u8 replay_counters_number; u8 unicast_using_group; } ;
5370 struct ipw2100_wep_key { u8 idx; u8 len; u8 key[13U]; } ;
8345 struct ipw2100_fw_header { short version; short mode; unsigned int fw_size; unsigned int uc_size; } ;
8529 struct symbol_alive_response { u8 cmd_id; u8 seq_num; u8 ucode_rev; u8 eeprom_valid; u16 valid_flags; u8 IEEE_addr[6U]; u16 flags; u16 pcb_rev; u16 clock_settle_time; u16 powerup_settle_time; u16 hop_settle_time; u8 date[3U]; u8 time[2U]; u8 ucode_valid; } ;
38 typedef int Set;
1 long int __builtin_expect(long, long);
1 void * __builtin_memcpy(void *, const void *, unsigned long);
7 dma_addr_t ldv_dma_map_single_attrs(struct device *dev, void *ptr, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs);
33 extern struct module __this_module;
358 extern struct pv_irq_ops pv_irq_ops;
71 void set_bit(long nr, volatile unsigned long *addr);
109 void clear_bit(long nr, volatile unsigned long *addr);
206 int test_and_set_bit(long nr, volatile unsigned long *addr);
252 int test_and_clear_bit(long nr, volatile unsigned long *addr);
310 int constant_test_bit(long nr, const volatile unsigned long *addr);
132 int printk(const char *, ...);
253 int kstrtoull(const char *, unsigned int, unsigned long long *);
272 int kstrtoul(const char *s, unsigned int base, unsigned long *res);
314 int kstrtouint(const char *, unsigned int, unsigned int *);
327 int kstrtou32(const char *s, unsigned int base, u32 *res);
388 int sprintf(char *, const char *, ...);
391 int snprintf(char *, size_t , const char *, ...);
24 void INIT_LIST_HEAD(struct list_head *list);
47 void __list_add(struct list_head *, struct list_head *, struct list_head *);
74 void list_add_tail(struct list_head *new, struct list_head *head);
112 void list_del(struct list_head *);
186 int list_empty(const struct list_head *head);
88 void __bad_percpu_size();
71 void warn_slowpath_null(const char *, const int);
34 void * __memcpy(void *, const void *, size_t );
55 void * memset(void *, int, size_t );
58 void * memmove(void *, const void *, size_t );
60 int memcmp(const void *, const void *, size_t );
61 size_t strlen(const char *);
62 char * strcpy(char *, const char *);
26 size_t strlcpy(char *, const char *, size_t );
80 __kernel_size_t strnlen(const char *, __kernel_size_t );
117 void * kmemdup(const void *, size_t , gfp_t );
802 unsigned long int arch_local_save_flags();
155 int arch_irqs_disabled_flags(unsigned long flags);
8 extern int __preempt_count;
20 int preempt_count();
279 void lockdep_init_map(struct lockdep_map *, const char *, struct lock_class_key *, int);
93 void __raw_spin_lock_init(raw_spinlock_t *, const char *, struct lock_class_key *);
22 void _raw_spin_lock(raw_spinlock_t *);
32 unsigned long int _raw_spin_lock_irqsave(raw_spinlock_t *);
39 void _raw_spin_unlock(raw_spinlock_t *);
43 void _raw_spin_unlock_irqrestore(raw_spinlock_t *, unsigned long);
290 raw_spinlock_t * spinlock_check(spinlock_t *lock);
301 void spin_lock(spinlock_t *lock);
341 void spin_unlock(spinlock_t *lock);
356 void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags);
68 void __init_waitqueue_head(wait_queue_head_t *, const char *, struct lock_class_key *);
144 void __wake_up(wait_queue_head_t *, unsigned int, int, void *);
822 long int prepare_to_wait_event(wait_queue_head_t *, wait_queue_t *, int);
823 void finish_wait(wait_queue_head_t *, wait_queue_t *);
119 void __mutex_init(struct mutex *, const char *, struct lock_class_key *);
138 void mutex_lock_nested(struct mutex *, unsigned int);
174 void mutex_unlock(struct mutex *);
132 unsigned long int get_seconds();
77 extern volatile unsigned long jiffies;
303 unsigned long int msecs_to_jiffies(const unsigned int);
94 void init_timer_key(struct timer_list *, unsigned int, const char *, struct lock_class_key *);
260 unsigned long int round_jiffies_relative(unsigned long);
20 void delayed_work_timer_fn(unsigned long);
192 void __init_work(struct work_struct *, int);
375 extern struct workqueue_struct *system_wq;
466 bool queue_delayed_work_on(int, struct workqueue_struct *, struct delayed_work *, unsigned long);
468 bool mod_delayed_work_on(int, struct workqueue_struct *, struct delayed_work *, unsigned long);
483 bool cancel_delayed_work(struct delayed_work *);
484 bool cancel_delayed_work_sync(struct delayed_work *);
518 bool queue_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork, unsigned long delay);
533 bool mod_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork, unsigned long delay);
591 bool schedule_delayed_work(struct delayed_work *dwork, unsigned long delay);
55 unsigned int readl(const volatile void *addr);
28 unsigned int ioread8(void *);
29 unsigned int ioread16(void *);
31 unsigned int ioread32(void *);
34 void iowrite8(u8 , void *);
35 void iowrite16(u16 , void *);
37 void iowrite32(u32 , void *);
72 void pci_iounmap(struct pci_dev *, void *);
17 void * pci_iomap(struct pci_dev *, int, unsigned long);
142 void kfree(const void *);
302 void * __kmalloc(size_t , gfp_t );
222 int sysfs_create_group(struct kobject *, const struct attribute_group *);
228 void sysfs_remove_group(struct kobject *, const struct attribute_group *);
84 const char * kobject_name(const struct kobject *kobj);
441 void * kmalloc(size_t size, gfp_t flags);
560 void * kmalloc_array(size_t n, size_t size, gfp_t flags);
573 void * kcalloc(size_t n, size_t size, gfp_t flags);
280 int driver_create_file(struct device_driver *, const struct driver_attribute *);
282 void driver_remove_file(struct device_driver *, const struct driver_attribute *);
798 const char * dev_name(const struct device *dev);
913 void * dev_get_drvdata(const struct device *);
914 int dev_set_drvdata(struct device *, void *);
63 int valid_dma_direction(int dma_direction);
70 int is_device_dma_capable(struct device *dev);
44 void debug_dma_unmap_page(struct device *, dma_addr_t , size_t , int, bool );
53 void debug_dma_alloc_coherent(struct device *, size_t , dma_addr_t , void *);
56 void debug_dma_free_coherent(struct device *, size_t , void *, dma_addr_t );
59 void debug_dma_sync_single_for_cpu(struct device *, dma_addr_t , size_t , int);
63 void debug_dma_sync_single_for_device(struct device *, dma_addr_t , size_t , int);
27 extern struct device x86_dma_fallback_dev;
30 extern struct dma_map_ops *dma_ops;
32 struct dma_map_ops * get_dma_ops(struct device *dev);
32 dma_addr_t ldv_dma_map_single_attrs_2(struct device *dev, void *ptr, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs);
33 void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs);
109 void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir);
121 void dma_sync_single_for_device(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir);
65 int dma_set_mask(struct device *, u64 );
107 unsigned long int dma_alloc_coherent_mask(struct device *dev, gfp_t gfp);
119 gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp);
135 void * dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs);
164 void dma_free_attrs(struct device *dev, size_t size, void *vaddr, dma_addr_t bus, struct dma_attrs *attrs);
654 void consume_skb(struct sk_buff *);
1369 bool skb_is_nonlinear(const struct sk_buff *skb);
1494 unsigned char * skb_put(struct sk_buff *, unsigned int);
1567 int skb_tailroom(const struct sk_buff *skb);
1933 struct sk_buff * __netdev_alloc_skb(struct net_device *, unsigned int, gfp_t );
1949 struct sk_buff * netdev_alloc_skb(struct net_device *dev, unsigned int length);
1963 struct sk_buff * dev_alloc_skb(unsigned int length);
2504 void skb_copy_from_linear_data(const struct sk_buff *skb, void *to, const unsigned int len);
113 void pm_qos_add_request(struct pm_qos_request *, int, s32 );
115 void pm_qos_update_request(struct pm_qos_request *, s32 );
119 void pm_qos_remove_request(struct pm_qos_request *);
10 void __const_udelay(unsigned long);
372 long int schedule_timeout(long);
375 long int schedule_timeout_uninterruptible(long);
1537 struct netdev_queue * netdev_get_tx_queue(const struct net_device *dev, unsigned int index);
1603 void * netdev_priv(const struct net_device *dev);
1888 int netpoll_trap();
2050 void __netif_schedule(struct Qdisc *);
2066 void netif_tx_start_queue(struct netdev_queue *dev_queue);
2077 void netif_start_queue(struct net_device *dev);
2092 void netif_tx_wake_queue(struct netdev_queue *dev_queue);
2111 void netif_wake_queue(struct net_device *dev);
2126 void netif_tx_stop_queue(struct netdev_queue *dev_queue);
2142 void netif_stop_queue(struct net_device *dev);
2307 bool netif_running(const struct net_device *dev);
2472 void __dev_kfree_skb_any(struct sk_buff *, enum skb_free_reason );
2503 void dev_kfree_skb_any(struct sk_buff *skb);
2610 void netif_carrier_on(struct net_device *);
2612 void netif_carrier_off(struct net_device *);
2680 void netif_device_detach(struct net_device *);
2682 void netif_device_attach(struct net_device *);
2903 int register_netdev(struct net_device *);
2904 void unregister_netdev(struct net_device *);
824 int pci_bus_read_config_dword(struct pci_bus *, unsigned int, int, u32 *);
830 int pci_bus_write_config_dword(struct pci_bus *, unsigned int, int, u32 );
842 int pci_read_config_dword(const struct pci_dev *dev, int where, u32 *val);
855 int pci_write_config_dword(const struct pci_dev *dev, int where, u32 val);
902 int pci_enable_device(struct pci_dev *);
919 void pci_disable_device(struct pci_dev *);
922 void pci_set_master(struct pci_dev *);
975 int pci_save_state(struct pci_dev *);
976 void pci_restore_state(struct pci_dev *);
987 int pci_set_power_state(struct pci_dev *, pci_power_t );
1040 int pci_request_regions(struct pci_dev *, const char *);
1042 void pci_release_regions(struct pci_dev *);
1085 int __pci_register_driver(struct pci_driver *, struct module *, const char *);
1094 void pci_unregister_driver(struct pci_driver *);
16 void * pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle);
23 void pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle);
30 dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction);
36 void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction);
71 void pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction);
78 void pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction);
105 int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
1407 void * pci_get_drvdata(struct pci_dev *pdev);
1412 void pci_set_drvdata(struct pci_dev *pdev, void *data);
1420 const char * pci_name(const struct pci_dev *pdev);
42 int request_firmware(const struct firmware **, const char *, struct device *);
49 void release_firmware(const struct firmware *);
18 extern const unsigned char _ctype[];
38 unsigned char __tolower(unsigned char c);
37 const char * print_ssid(char *, const char *, u8 );
123 int request_threaded_irq(unsigned int, irqreturn_t (*)(int, void *), irqreturn_t (*)(int, void *), unsigned long, const char *, void *);
128 int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *), unsigned long flags, const char *name, void *dev);
142 void free_irq(unsigned int, void *);
469 void __tasklet_schedule(struct tasklet_struct *);
471 void tasklet_schedule(struct tasklet_struct *t);
527 void tasklet_init(struct tasklet_struct *, void (*)(unsigned long), unsigned long);
47 int eth_validate_addr(struct net_device *);
89 bool is_zero_ether_addr(const u8 *addr);
107 bool is_multicast_ether_addr(const u8 *addr);
131 bool is_broadcast_ether_addr(const u8 *addr);
160 bool is_valid_ether_addr(const u8 *addr);
440 void wireless_send_event(struct net_device *, unsigned int, union iwreq_data *, const char *);
3036 void set_wiphy_dev(struct wiphy *wiphy, struct device *dev);
3084 int wiphy_register(struct wiphy *);
3095 void wiphy_unregister(struct wiphy *);
3925 void wiphy_rfkill_set_hw_state(struct wiphy *, bool );
849 void * libipw_priv(struct net_device *dev);
953 void free_libipw(struct net_device *, int);
954 struct net_device * alloc_libipw(int, int);
955 int libipw_change_mtu(struct net_device *, int);
957 void libipw_networks_age(struct libipw_device *, unsigned long);
962 netdev_tx_t libipw_xmit(struct sk_buff *, struct net_device *);
963 void libipw_txb_free(struct libipw_txb *);
968 int libipw_rx(struct libipw_device *, struct sk_buff *, struct libipw_rx_stats *);
971 void libipw_rx_mgt(struct libipw_device *, struct libipw_hdr_4addr *, struct libipw_rx_stats *);
976 const struct libipw_geo * libipw_get_geo(struct libipw_device *);
977 void libipw_set_geo(struct libipw_device *, const struct libipw_geo *);
988 int libipw_wx_get_scan(struct libipw_device *, struct iw_request_info *, union iwreq_data *, char *);
990 int libipw_wx_set_encode(struct libipw_device *, struct iw_request_info *, union iwreq_data *, char *);
993 int libipw_wx_get_encode(struct libipw_device *, struct iw_request_info *, union iwreq_data *, char *);
996 int libipw_wx_set_encodeext(struct libipw_device *, struct iw_request_info *, union iwreq_data *, char *);
999 int libipw_wx_get_encodeext(struct libipw_device *, struct iw_request_info *, union iwreq_data *, char *);
16 const u32 ipw_cipher_suites[4U] = { 1027073U, 1027077U, 1027074U, 1027076U };
179 struct pm_qos_request ipw2100_pm_qos_req = { };
191 int debug = 0;
192 int network_mode = 0;
193 int channel = 0;
194 int associate = 0;
195 int disable = 0;
197 struct ipw2100_fw ipw2100_firmware = { };
213 unsigned int ipw2100_debug_level = 0U;
229 const char *command_types[70U] = { "undefined", "unused", "HOST_COMPLETE", "unused", "unused", "unused", "SYSTEM_CONFIG", "unused", "SSID", "MANDATORY_BSSID", "AUTHENTICATION_TYPE", "ADAPTER_ADDRESS", "PORT_TYPE", "INTERNATIONAL_MODE", "CHANNEL", "RTS_THRESHOLD", "FRAG_THRESHOLD", "POWER_MODE", "TX_RATES", "BASIC_TX_RATES", "WEP_KEY_INFO", "unused", "unused", "unused", "unused", "WEP_KEY_INDEX", "WEP_FLAGS", "ADD_MULTICAST", "CLEAR_ALL_MULTICAST", "BEACON_INTERVAL", "ATIM_WINDOW", "CLEAR_STATISTICS", "undefined", "undefined", "undefined", "undefined", "TX_POWER_INDEX", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "BROADCAST_SCAN", "CARD_DISABLE", "PREFERRED_BSSID", "SET_SCAN_OPTIONS", "SCAN_DWELL_TIME", "SWEEP_TABLE", "AP_OR_STATION_TABLE", "GROUP_ORDINALS", "SHORT_RETRY_LIMIT", "LONG_RETRY_LIMIT", "unused", "unused", "undefined", "undefined", "undefined", "HOST_PRE_POWER_DOWN", "unused", "undefined", "CARD_DISABLE_PHY_OFF", "MSDU_TX_RATES", "undefined", "SET_STATION_STAT_BITS", "CLEAR_STATIONS_STAT_BITS", "LEAP_ROGUE_MODE", "SET_SECURITY_INFORMATION", "DISASSOCIATION_BSSID", "SET_WPA_ASS_IE" };
303 const long ipw2100_frequencies[14U] = { 2412L, 2417L, 2422L, 2427L, 2432L, 2437L, 2442L, 2447L, 2452L, 2457L, 2462L, 2467L, 2472L, 2484L };
312 struct ieee80211_rate ipw2100_bg_rates[4U] = { { 0U, 10U, (unsigned short)0, (unsigned short)0 }, { 1U, 20U, (unsigned short)0, (unsigned short)0 }, { 1U, 55U, (unsigned short)0, (unsigned short)0 }, { 1U, 110U, (unsigned short)0, (unsigned short)0 } };
322 void ipw2100_tx_send_commands(struct ipw2100_priv *priv);
323 void ipw2100_tx_send_data(struct ipw2100_priv *priv);
324 int ipw2100_adapter_setup(struct ipw2100_priv *priv);
326 void ipw2100_queues_initialize(struct ipw2100_priv *priv);
327 void ipw2100_queues_free(struct ipw2100_priv *priv);
328 int ipw2100_queues_allocate(struct ipw2100_priv *priv);
330 int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw);
332 int ipw2100_get_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw);
334 int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, size_t max);
336 int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, size_t max);
338 void ipw2100_release_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw);
340 int ipw2100_ucode_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw);
342 void ipw2100_wx_event_work(struct work_struct *work);
343 struct iw_statistics * ipw2100_wx_wireless_stats(struct net_device *dev);
344 struct iw_handler_def ipw2100_wx_handler_def;
346 void read_register(struct net_device *dev, u32 reg, u32 *val);
354 void write_register(struct net_device *dev, u32 reg, u32 val);
362 void read_register_word(struct net_device *dev, u32 reg, u16 *val);
371 void read_register_byte(struct net_device *dev, u32 reg, u8 *val);
379 void write_register_word(struct net_device *dev, u32 reg, u16 val);
387 void write_register_byte(struct net_device *dev, u32 reg, u8 val);
395 void read_nic_dword(struct net_device *dev, u32 addr, u32 *val);
402 void write_nic_dword(struct net_device *dev, u32 addr, u32 val);
409 void read_nic_word(struct net_device *dev, u32 addr, u16 *val);
416 void write_nic_word(struct net_device *dev, u32 addr, u16 val);
423 void read_nic_byte(struct net_device *dev, u32 addr, u8 *val);
430 void write_nic_byte(struct net_device *dev, u32 addr, u8 val);
448 void write_nic_memory(struct net_device *dev, u32 addr, u32 len, const u8 *buf);
486 void read_nic_memory(struct net_device *dev, u32 addr, u32 len, u8 *buf);
523 bool ipw2100_hw_is_adapter_in_system(struct net_device *dev);
532 int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, void *val, u32 *len);
611 int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val, u32 *len);
641 char * snprint_line(char *buf, size_t count, const u8 *data, u32 len, u32 ofs);
676 void printk_buf(int level, const u8 *data, u32 len);
694 void schedule_reset(struct ipw2100_priv *priv);
730 int ipw2100_hw_send_command(struct ipw2100_priv *priv, struct host_command *cmd);
848 int ipw2100_verify(struct ipw2100_priv *priv);
892 int ipw2100_wait_for_card_state(struct ipw2100_priv *priv, int state);
935 int sw_reset_and_clock(struct ipw2100_priv *priv);
994 int ipw2100_download_firmware(struct ipw2100_priv *priv);
1117 void ipw2100_enable_interrupts(struct ipw2100_priv *priv);
1125 void ipw2100_disable_interrupts(struct ipw2100_priv *priv);
1133 void ipw2100_initialize_ordinals(struct ipw2100_priv *priv);
1155 void ipw2100_hw_set_gpio(struct ipw2100_priv *priv);
1167 int rf_kill_active(struct ipw2100_priv *priv);
1199 int ipw2100_get_hw_features(struct ipw2100_priv *priv);
1247 int ipw2100_start_adapter(struct ipw2100_priv *priv);
1347 void ipw2100_reset_fatalerror(struct ipw2100_priv *priv);
1358 int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv);
1411 int ipw2100_hw_phy_off(struct ipw2100_priv *priv);
1445 int ipw2100_enable_adapter(struct ipw2100_priv *priv);
1489 int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv);
1595 int ipw2100_disable_adapter(struct ipw2100_priv *priv);
1640 int ipw2100_set_scan_options(struct ipw2100_priv *priv);
1672 int ipw2100_start_scan(struct ipw2100_priv *priv);
1713 const struct libipw_geo ipw_geos[1U] = { { { '-', '-', '-', '\x0' }, 14U, 0U, { { 2412U, 1U, 0U, 0U }, { 2417U, 2U, 0U, 0U }, { 2422U, 3U, 0U, 0U }, { 2427U, 4U, 0U, 0U }, { 2432U, 5U, 0U, 0U }, { 2437U, 6U, 0U, 0U }, { 2442U, 7U, 0U, 0U }, { 2447U, 8U, 0U, 0U }, { 2452U, 9U, 0U, 0U }, { 2457U, 10U, 0U, 0U }, { 2462U, 11U, 0U, 0U }, { 2467U, 12U, 0U, 0U }, { 2472U, 13U, 0U, 0U }, { 2484U, 14U, 0U, 0U } }, { { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U }, { 0U, 0U, 0U, 0U } } } };
1725 int ipw2100_up(struct ipw2100_priv *priv, int deferred);
1851 void ipw2100_down(struct ipw2100_priv *priv);
1904 int ipw2100_wdev_init(struct net_device *dev);
1961 void ipw2100_reset_adapter(struct work_struct *work);
1998 void isr_indicate_associated(struct ipw2100_priv *priv, u32 status);
2089 int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, int length, int batch_mode);
2140 void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status);
2171 void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status);
2185 void ipw2100_scan_event(struct work_struct *work);
2196 void isr_scan_complete(struct ipw2100_priv *priv, u32 status);
2228 void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status);
2234 const struct ipw2100_status_indicator status_handlers[13U] = { { 1, (void (*)(struct ipw2100_priv *, u32 ))0, (char *)"IPW_STATE_INITIALIZED" }, { 2, (void (*)(struct ipw2100_priv *, u32 ))0, (char *)"IPW_STATE_COUNTRY_FOUND" }, { 4, &isr_indicate_associated, (char *)"IPW_STATE_ASSOCIATED" }, { 8, &isr_indicate_association_lost, (char *)"IPW_STATE_ASSN_LOST" }, { 16, (void (*)(struct ipw2100_priv *, u32 ))0, (char *)"IPW_STATE_ASSN_CHANGED" }, { 32, &isr_scan_complete, (char *)"IPW_STATE_SCAN_COMPLETE" }, { 64, (void (*)(struct ipw2100_priv *, u32 ))0, (char *)"IPW_STATE_ENTERED_PSP" }, { 128, (void (*)(struct ipw2100_priv *, u32 ))0, (char *)"IPW_STATE_LEFT_PSP" }, { 256, &isr_indicate_rf_kill, (char *)"IPW_STATE_RF_KILL" }, { 512, (void (*)(struct ipw2100_priv *, u32 ))0, (char *)"IPW_STATE_DISABLED" }, { 1024, (void (*)(struct ipw2100_priv *, u32 ))0, (char *)"IPW_STATE_POWER_DOWN" }, { 2048, &isr_indicate_scanning, (char *)"IPW_STATE_SCANNING" }, { -1, (void (*)(struct ipw2100_priv *, u32 ))0, (char *)"-1" } };
2250 void isr_status_change(struct ipw2100_priv *priv, int status);
2278 void isr_rx_complete_command(struct ipw2100_priv *priv, struct ipw2100_cmd_header *cmd);
2300 const char *frame_types[5U] = { "COMMAND_STATUS_VAL", "STATUS_CHANGE_VAL", "P80211_DATA_VAL", "P8023_DATA_VAL", "HOST_NOTIFICATION_VAL" };
2309 int ipw2100_alloc_skb(struct ipw2100_priv *priv, struct ipw2100_rx_packet *packet);
2333 void ipw2100_snapshot_free(struct ipw2100_priv *priv);
2419 u8 packet_data[2340U] = { };
2422 void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i);
2467 void isr_rx(struct ipw2100_priv *priv, int i, struct libipw_rx_stats *stats);
2541 void isr_rx_monitor(struct ipw2100_priv *priv, int i, struct libipw_rx_stats *stats);
2623 int ipw2100_corruption_check(struct ipw2100_priv *priv, int i);
2679 void __ipw2100_rx_process(struct ipw2100_priv *priv);
2824 int __ipw2100_tx_process(struct ipw2100_priv *priv);
3000 void __ipw2100_tx_complete(struct ipw2100_priv *priv);
3222 void ipw2100_irq_tasklet(struct ipw2100_priv *priv);
3343 irqreturn_t ipw2100_interrupt(int irq, void *data);
3393 netdev_tx_t ipw2100_tx(struct libipw_txb *txb, struct net_device *dev, int pri);
3440 int ipw2100_msg_allocate(struct ipw2100_priv *priv);
3488 int ipw2100_msg_initialize(struct ipw2100_priv *priv);
3502 void ipw2100_msg_free(struct ipw2100_priv *priv);
3521 ssize_t show_pci(struct device *d, struct device_attribute *attr, char *buf);
3541 struct device_attribute dev_attr_pci = { { "pci", 292U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_pci, (ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t ))0 };
3543 ssize_t show_cfg(struct device *d, struct device_attribute *attr, char *buf);
3550 struct device_attribute dev_attr_cfg = { { "cfg", 292U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_cfg, (ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t ))0 };
3552 ssize_t show_status(struct device *d, struct device_attribute *attr, char *buf);
3559 struct device_attribute dev_attr_status = { { "status", 292U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_status, (ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t ))0 };
3561 ssize_t show_capability(struct device *d, struct device_attribute *attr, char *buf);
3568 struct device_attribute dev_attr_capability = { { "capability", 292U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_capability, (ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t ))0 };
3574 const struct __anonstruct_hw_data_330 hw_data[5U] = { { 36U, "REG_GP_CNTRL" }, { 48U, "REG_GPIO" }, { 8U, "REG_INTA" }, { 12U, "REG_INTA_MASK" }, { 32U, "REG_RESET_REG" } };
3584 const struct __anonstruct_nic_data_331 nic_data[3U] = { { 2228224U, "IPW2100_CONTROL_REG", 2UL }, { 2162708U, "0x210014", 1UL }, { 2162688U, "0x210000", 1UL } };
3592 const struct __anonstruct_ord_data_332 ord_data[147U] = { { 1U, "STAT_TX_HOST_REQUESTS", "requested Host Tx\'s (MSDU)" }, { 2U, "STAT_TX_HOST_COMPLETE", "successful Host Tx\'s (MSDU)" }, { 3U, "STAT_TX_DIR_DATA", "successful Directed Tx\'s (MSDU)" }, { 4U, "STAT_TX_DIR_DATA1", "successful Directed Tx\'s (MSDU) @ 1MB" }, { 5U, "STAT_TX_DIR_DATA2", "successful Directed Tx\'s (MSDU) @ 2MB" }, { 6U, "STAT_TX_DIR_DATA5_5", "successful Directed Tx\'s (MSDU) @ 5_5MB" }, { 7U, "STAT_TX_DIR_DATA11", "successful Directed Tx\'s (MSDU) @ 11MB" }, { 13U, "STAT_TX_NODIR_DATA1", "successful Non_Directed Tx\'s (MSDU) @ 1MB" }, { 14U, "STAT_TX_NODIR_DATA2", "successful Non_Directed Tx\'s (MSDU) @ 2MB" }, { 15U, "STAT_TX_NODIR_DATA5_5", "successful Non_Directed Tx\'s (MSDU) @ 5.5MB" }, { 16U, "STAT_TX_NODIR_DATA11", "successful Non_Directed Tx\'s (MSDU) @ 11MB" }, { 21U, "STAT_NULL_DATA", "successful NULL data Tx\'s" }, { 22U, "STAT_TX_RTS", "successful Tx RTS" }, { 23U, "STAT_TX_CTS", "successful Tx CTS" }, { 24U, "STAT_TX_ACK", "successful Tx ACK" }, { 25U, "STAT_TX_ASSN", "successful Association Tx\'s" }, { 26U, "STAT_TX_ASSN_RESP", "successful Association response Tx\'s" }, { 27U, "STAT_TX_REASSN", "successful Reassociation Tx\'s" }, { 28U, "STAT_TX_REASSN_RESP", "successful Reassociation response Tx\'s" }, { 29U, "STAT_TX_PROBE", "probes successfully transmitted" }, { 30U, "STAT_TX_PROBE_RESP", "probe responses successfully transmitted" }, { 31U, "STAT_TX_BEACON", "tx beacon" }, { 32U, "STAT_TX_ATIM", "Tx ATIM" }, { 33U, "STAT_TX_DISASSN", "successful Disassociation TX" }, { 34U, "STAT_TX_AUTH", "successful Authentication Tx" }, { 35U, "STAT_TX_DEAUTH", "successful Deauthentication TX" }, { 41U, "STAT_TX_TOTAL_BYTES", "Total successful Tx data bytes" }, { 42U, "STAT_TX_RETRIES", "Tx retries" }, { 43U, "STAT_TX_RETRY1", "Tx retries at 1MBPS" }, { 44U, "STAT_TX_RETRY2", "Tx retries at 2MBPS" }, { 45U, "STAT_TX_RETRY5_5", "Tx retries at 5.5MBPS" }, { 46U, "STAT_TX_RETRY11", "Tx retries at 11MBPS" }, { 51U, "STAT_TX_FAILURES", "Tx Failures" }, { 53U, "STAT_TX_MAX_TRIES_IN_HOP", "times max tries in a hop failed" }, { 56U, "STAT_TX_DISASSN_FAIL", "times disassociation failed" }, { 57U, "STAT_TX_ERR_CTS", "missed/bad CTS frames" }, { 59U, "STAT_TX_ERR_ACK", "tx err due to acks" }, { 61U, "STAT_RX_HOST", "packets passed to host" }, { 62U, "STAT_RX_DIR_DATA", "directed packets" }, { 63U, "STAT_RX_DIR_DATA1", "directed packets at 1MB" }, { 64U, "STAT_RX_DIR_DATA2", "directed packets at 2MB" }, { 65U, "STAT_RX_DIR_DATA5_5", "directed packets at 5.5MB" }, { 66U, "STAT_RX_DIR_DATA11", "directed packets at 11MB" }, { 71U, "STAT_RX_NODIR_DATA", "nondirected packets" }, { 72U, "STAT_RX_NODIR_DATA1", "nondirected packets at 1MB" }, { 73U, "STAT_RX_NODIR_DATA2", "nondirected packets at 2MB" }, { 74U, "STAT_RX_NODIR_DATA5_5", "nondirected packets at 5.5MB" }, { 75U, "STAT_RX_NODIR_DATA11", "nondirected packets at 11MB" }, { 80U, "STAT_RX_NULL_DATA", "null data rx\'s" }, { 82U, "STAT_RX_RTS", "Rx RTS" }, { 83U, "STAT_RX_CTS", "Rx CTS" }, { 84U, "STAT_RX_ACK", "Rx ACK" }, { 85U, "STAT_RX_CFEND", "Rx CF End" }, { 86U, "STAT_RX_CFEND_ACK", "Rx CF End + CF Ack" }, { 87U, "STAT_RX_ASSN", "Association Rx\'s" }, { 88U, "STAT_RX_ASSN_RESP", "Association response Rx\'s" }, { 89U, "STAT_RX_REASSN", "Reassociation Rx\'s" }, { 90U, "STAT_RX_REASSN_RESP", "Reassociation response Rx\'s" }, { 91U, "STAT_RX_PROBE", "probe Rx\'s" }, { 92U, "STAT_RX_PROBE_RESP", "probe response Rx\'s" }, { 93U, "STAT_RX_BEACON", "Rx beacon" }, { 94U, "STAT_RX_ATIM", "Rx ATIM" }, { 95U, "STAT_RX_DISASSN", "disassociation Rx" }, { 96U, "STAT_RX_AUTH", "authentication Rx" }, { 97U, "STAT_RX_DEAUTH", "deauthentication Rx" }, { 101U, "STAT_RX_TOTAL_BYTES", "Total rx data bytes received" }, { 102U, "STAT_RX_ERR_CRC", "packets with Rx CRC error" }, { 103U, "STAT_RX_ERR_CRC1", "Rx CRC errors at 1MB" }, { 104U, "STAT_RX_ERR_CRC2", "Rx CRC errors at 2MB" }, { 105U, "STAT_RX_ERR_CRC5_5", "Rx CRC errors at 5.5MB" }, { 106U, "STAT_RX_ERR_CRC11", "Rx CRC errors at 11MB" }, { 112U, "STAT_RX_DUPLICATE1", "duplicate rx packets at 1MB" }, { 113U, "STAT_RX_DUPLICATE2", "duplicate rx packets at 2MB" }, { 114U, "STAT_RX_DUPLICATE5_5", "duplicate rx packets at 5.5MB" }, { 115U, "STAT_RX_DUPLICATE11", "duplicate rx packets at 11MB" }, { 119U, "STAT_RX_DUPLICATE", "duplicate rx packets" }, { 120U, "PERS_DB_LOCK", "locking fw permanent db" }, { 121U, "PERS_DB_SIZE", "size of fw permanent db" }, { 122U, "PERS_DB_ADDR", "address of fw permanent db" }, { 123U, "STAT_RX_INVALID_PROTOCOL", "rx frames with invalid protocol" }, { 124U, "SYS_BOOT_TIME", "Boot time" }, { 125U, "STAT_RX_NO_BUFFER", "rx frames rejected due to no buffer" }, { 128U, "STAT_RX_MISSING_FRAG", "rx frames dropped due to missing fragment" }, { 129U, "STAT_RX_ORPHAN_FRAG", "rx frames dropped due to non-sequential fragment" }, { 130U, "STAT_RX_ORPHAN_FRAME", "rx frames dropped due to unmatched 1st frame" }, { 131U, "STAT_RX_FRAG_AGEOUT", "rx frames dropped due to uncompleted frame" }, { 133U, "STAT_RX_ICV_ERRORS", "ICV errors during decryption" }, { 137U, "STAT_PSP_SUSPENSION", "times adapter suspended" }, { 138U, "STAT_PSP_BCN_TIMEOUT", "beacon timeout" }, { 139U, "STAT_PSP_POLL_TIMEOUT", "poll response timeouts" }, { 140U, "STAT_PSP_NONDIR_TIMEOUT", "timeouts waiting for last {broad,multi}cast pkt" }, { 141U, "STAT_PSP_RX_DTIMS", "PSP DTIMs received" }, { 142U, "STAT_PSP_RX_TIMS", "PSP TIMs received" }, { 143U, "STAT_PSP_STATION_ID", "PSP Station ID" }, { 147U, "LAST_ASSN_TIME", "RTC time of last association" }, { 148U, "STAT_PERCENT_MISSED_BCNS", "current calculation of % missed beacons" }, { 149U, "STAT_PERCENT_RETRIES", "current calculation of % missed tx retries" }, { 150U, "ASSOCIATED_AP_PTR", "0 if not associated, else pointer to AP table entry" }, { 151U, "AVAILABLE_AP_CNT", "AP\'s decsribed in the AP table" }, { 152U, "AP_LIST_PTR", "Ptr to list of available APs" }, { 153U, "STAT_AP_ASSNS", "associations" }, { 154U, "STAT_ASSN_FAIL", "association failures" }, { 155U, "STAT_ASSN_RESP_FAIL", "failures due to response fail" }, { 156U, "STAT_FULL_SCANS", "full scans" }, { 157U, "CARD_DISABLED", "Card Disabled" }, { 158U, "STAT_ROAM_INHIBIT", "times roaming was inhibited due to activity" }, { 160U, "RSSI_AT_ASSN", "RSSI of associated AP at time of association" }, { 161U, "STAT_ASSN_CAUSE1", "reassociation: no probe response or TX on hop" }, { 162U, "STAT_ASSN_CAUSE2", "reassociation: poor tx/rx quality" }, { 163U, "STAT_ASSN_CAUSE3", "reassociation: tx/rx quality (excessive AP load" }, { 164U, "STAT_ASSN_CAUSE4", "reassociation: AP RSSI level" }, { 165U, "STAT_ASSN_CAUSE5", "reassociations due to load leveling" }, { 170U, "STAT_AUTH_FAIL", "times authentication failed" }, { 171U, "STAT_AUTH_RESP_FAIL", "times authentication response failed" }, { 172U, "STATION_TABLE_CNT", "entries in association table" }, { 173U, "RSSI_AVG_CURR", "Current avg RSSI" }, { 177U, "POWER_MGMT_MODE", "Power mode - 0=CAM, 1=PSP" }, { 179U, "COUNTRY_CODE", "IEEE country code as recv\'d from beacon" }, { 180U, "COUNTRY_CHANNELS", "channels supported by country" }, { 181U, "RESET_CNT", "adapter resets (warm)" }, { 182U, "BEACON_INTERVAL", "Beacon interval" }, { 185U, "ANTENNA_DIVERSITY", "TRUE if antenna diversity is disabled" }, { 188U, "DTIM_PERIOD", "beacon intervals between DTIMs" }, { 189U, "OUR_FREQ", "current radio freq lower digits - channel ID" }, { 190U, "RTC_TIME", "current RTC time" }, { 191U, "PORT_TYPE", "operating mode" }, { 192U, "CURRENT_TX_RATE", "current tx rate" }, { 193U, "SUPPORTED_RATES", "supported tx rates" }, { 194U, "ATIM_WINDOW", "current ATIM Window" }, { 195U, "BASIC_RATES", "basic tx rates" }, { 196U, "NIC_HIGHEST_RATE", "NIC highest tx rate" }, { 197U, "AP_HIGHEST_RATE", "AP highest tx rate" }, { 198U, "CAPABILITIES", "Management frame capability field" }, { 199U, "AUTH_TYPE", "Type of authentication" }, { 200U, "RADIO_TYPE", "Adapter card platform type" }, { 201U, "RTS_THRESHOLD", "Min packet length for RTS handshaking" }, { 202U, "INT_MODE", "International mode" }, { 203U, "FRAGMENTATION_THRESHOLD", "protocol frag threshold" }, { 204U, "EEPROM_SRAM_DB_BLOCK_START_ADDRESS", "EEPROM offset in SRAM" }, { 205U, "EEPROM_SRAM_DB_BLOCK_SIZE", "EEPROM size in SRAM" }, { 206U, "EEPROM_SKU_CAPABILITY", "EEPROM SKU Capability" }, { 207U, "EEPROM_IBSS_11B_CHANNELS", "EEPROM IBSS 11b channel set" }, { 209U, "MAC_VERSION", "MAC Version" }, { 210U, "MAC_REVISION", "MAC Revision" }, { 211U, "RADIO_VERSION", "Radio Version" }, { 212U, "NIC_MANF_DATE_TIME", "MANF Date/Time STAMP" }, { 213U, "UCODE_VERSION", "Ucode Version" } };
3805 ssize_t show_registers(struct device *d, struct device_attribute *attr, char *buf);
3825 struct device_attribute dev_attr_registers = { { "registers", 292U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_registers, (ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t ))0 };
3827 ssize_t show_hardware(struct device *d, struct device_attribute *attr, char *buf);
3866 struct device_attribute dev_attr_hardware = { { "hardware", 292U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_hardware, (ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t ))0 };
3868 ssize_t show_memory(struct device *d, struct device_attribute *attr, char *buf);
3925 ssize_t store_memory(struct device *d, struct device_attribute *attr, const char *buf, size_t count);
3960 struct device_attribute dev_attr_memory = { { "memory", 420U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_memory, &store_memory };
3962 ssize_t show_ordinals(struct device *d, struct device_attribute *attr, char *buf);
3996 struct device_attribute dev_attr_ordinals = { { "ordinals", 292U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_ordinals, (ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t ))0 };
3998 ssize_t show_stats(struct device *d, struct device_attribute *attr, char *buf);
4017 struct device_attribute dev_attr_stats = { { "stats", 292U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_stats, (ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t ))0 };
4019 int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode);
4063 ssize_t show_internals(struct device *d, struct device_attribute *attr, char *buf);
4115 struct device_attribute dev_attr_internals = { { "internals", 292U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_internals, (ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t ))0 };
4117 ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, char *buf);
4160 struct device_attribute dev_attr_bssinfo = { { "bssinfo", 292U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_bssinfo, (ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t ))0 };
4163 ssize_t show_debug_level(struct device_driver *d, char *buf);
4168 ssize_t store_debug_level(struct device_driver *d, const char *buf, size_t count);
4184 struct driver_attribute driver_attr_debug_level = { { "debug_level", 420U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_debug_level, &store_debug_level };
4187 ssize_t show_fatal_error(struct device *d, struct device_attribute *attr, char *buf);
4212 ssize_t store_fatal_error(struct device *d, struct device_attribute *attr, const char *buf, size_t count);
4222 struct device_attribute dev_attr_fatal_error = { { "fatal_error", 420U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_fatal_error, &store_fatal_error };
4224 ssize_t show_scan_age(struct device *d, struct device_attribute *attr, char *buf);
4231 ssize_t store_scan_age(struct device *d, struct device_attribute *attr, const char *buf, size_t count);
4255 struct device_attribute dev_attr_scan_age = { { "scan_age", 420U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_scan_age, &store_scan_age };
4257 ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, char *buf);
4270 int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio);
4301 ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, const char *buf, size_t count);
4309 struct device_attribute dev_attr_rf_kill = { { "rf_kill", 420U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &show_rf_kill, &store_rf_kill };
4311 struct attribute *ipw2100_sysfs_entries[15U] = { &(dev_attr_hardware.attr), &(dev_attr_registers.attr), &(dev_attr_ordinals.attr), &(dev_attr_pci.attr), &(dev_attr_stats.attr), &(dev_attr_internals.attr), &(dev_attr_bssinfo.attr), &(dev_attr_memory.attr), &(dev_attr_scan_age.attr), &(dev_attr_fatal_error.attr), &(dev_attr_rf_kill.attr), &(dev_attr_cfg.attr), &(dev_attr_status.attr), &(dev_attr_capability.attr), (struct attribute *)0 };
4329 struct attribute_group ipw2100_attribute_group = { 0, 0, (struct attribute **)(&ipw2100_sysfs_entries), 0 };
4333 int status_queue_allocate(struct ipw2100_priv *priv, int entries);
4355 void status_queue_free(struct ipw2100_priv *priv);
4369 int bd_queue_allocate(struct ipw2100_priv *priv, struct ipw2100_bd_queue *q, int entries);
4391 void bd_queue_free(struct ipw2100_priv *priv, struct ipw2100_bd_queue *q);
4406 void bd_queue_initialize(struct ipw2100_priv *priv, struct ipw2100_bd_queue *q, u32 base, u32 size, u32 r, u32 w);
4423 void ipw2100_kill_works(struct ipw2100_priv *priv);
4435 int ipw2100_tx_allocate(struct ipw2100_priv *priv);
4494 void ipw2100_tx_initialize(struct ipw2100_priv *priv);
4544 void ipw2100_tx_free(struct ipw2100_priv *priv);
4576 int ipw2100_rx_allocate(struct ipw2100_priv *priv);
4646 void ipw2100_rx_initialize(struct ipw2100_priv *priv);
4670 void ipw2100_rx_free(struct ipw2100_priv *priv);
4698 int ipw2100_read_mac_address(struct ipw2100_priv *priv);
4723 int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode);
4749 int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type, int batch_mode);
4790 int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel___0, int batch_mode);
4840 int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode);
4901 int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate, int batch_mode);
4941 int ipw2100_set_power_mode(struct ipw2100_priv *priv, int power_level);
4976 int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold);
5040 int ipw2100_set_short_retry(struct ipw2100_priv *priv, u32 retry);
5060 int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry);
5080 int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid, int batch_mode);
5114 int ipw2100_disassociate_bssid(struct ipw2100_priv *priv);
5138 int ipw2100_set_wpa_ie(struct ipw2100_priv *priv, struct ipw2100_wpa_assoc_frame *wpa_frame, int batch_mode);
5182 int ipw2100_set_security_information(struct ipw2100_priv *priv, int auth_mode, int security_level, int unicast_using_group, int batch_mode);
5248 int ipw2100_set_tx_power(struct ipw2100_priv *priv, u32 tx_power);
5272 int ipw2100_set_ibss_beacon_interval(struct ipw2100_priv *priv, u32 interval, int batch_mode);
5338 int ipw2100_set_wep_flags(struct ipw2100_priv *priv, u32 flags, int batch_mode);
5398 int ipw2100_set_key(struct ipw2100_priv *priv, int idx, char *key, int len, int batch_mode);
5461 int ipw2100_set_key_index(struct ipw2100_priv *priv, int idx, int batch_mode);
5496 int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode);
5574 void ipw2100_security_work(struct work_struct *work);
5587 void shim__set_security(struct net_device *dev, struct libipw_security *sec);
5781 int ipw2100_set_address(struct net_device *dev, void *p);
5809 int ipw2100_open(struct net_device *dev);
5825 int ipw2100_close(struct net_device *dev);
5864 void ipw2100_tx_timeout(struct net_device *dev);
5880 int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value);
5888 int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value);
5917 void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, char *wpa_ie, int wpa_ie_len);
5934 void ipw_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
5953 u32 ipw2100_ethtool_get_link(struct net_device *dev);
5959 const struct ethtool_ops ipw2100_ethtool_ops = { 0, 0, &ipw_ethtool_get_drvinfo, 0, 0, 0, 0, 0, 0, 0, &ipw2100_ethtool_get_link, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
5964 void ipw2100_hang_check(struct work_struct *work);
6007 void ipw2100_rf_kill(struct work_struct *work);
6039 const struct net_device_ops ipw2100_netdev_ops = { 0, 0, &ipw2100_open, &ipw2100_close, &libipw_xmit, 0, 0, 0, &ipw2100_set_address, ð_validate_addr, 0, 0, &libipw_change_mtu, 0, &ipw2100_tx_timeout, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
6051 struct net_device * ipw2100_alloc_device(struct pci_dev *pci_dev, void *ioaddr);
6176 int ipw2100_pci_init_one(struct pci_dev *pci_dev, const struct pci_device_id *ent);
6375 void ipw2100_pci_remove_one(struct pci_dev *pci_dev);
6426 int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state);
6453 int ipw2100_resume(struct pci_dev *pci_dev);
6503 void ipw2100_shutdown(struct pci_dev *pci_dev);
6515 const struct pci_device_id ipw2100_pci_id_table[41U] = { { 32902U, 4163U, 32902U, 9504U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9505U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9508U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9509U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9510U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9506U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9507U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9511U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9512U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9513U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9515U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9516U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9517U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9552U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9553U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9555U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9556U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9557U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9568U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9570U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9571U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9569U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9573U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9574U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9575U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9584U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9600U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9602U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9603U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9601U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9605U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9606U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9607U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9616U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9618U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9617U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9619U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9622U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9624U, 0U, 0U, 0UL }, { 32902U, 4163U, 32902U, 9632U, 0U, 0U, 0UL }, { 0U, 0U, 0U, 0U, 0U, 0U, 0UL } };
6565 const struct pci_device_id __mod_pci_device_table = { };
6567 struct pci_driver ipw2100_pci_driver = { { 0, 0 }, "ipw2100", (const struct pci_device_id *)(&ipw2100_pci_id_table), &ipw2100_pci_init_one, &ipw2100_pci_remove_one, &ipw2100_suspend, 0, 0, &ipw2100_resume, &ipw2100_shutdown, 0, 0, { 0, 0, 0, 0, (_Bool)0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 } } };
6588 int ipw2100_init();
6615 void ipw2100_exit();
6629 int ipw2100_wx_get_name(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
6647 int ipw2100_wx_set_freq(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
6693 int ipw2100_wx_get_freq(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
6718 int ipw2100_wx_set_mode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
6757 int ipw2100_wx_get_mode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
6776 const s32 timeout_duration[5U] = { 350000, 250000, 75000, 37000, 25000 };
6784 const s32 period_duration[5U] = { 400000, 700000, 1000000, 1000000, 1000000 };
6792 int ipw2100_wx_get_range(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
6917 int ipw2100_wx_set_wap(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
6955 int ipw2100_wx_get_wap(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
6977 int ipw2100_wx_set_essid(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7028 int ipw2100_wx_get_essid(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7056 int ipw2100_wx_set_nick(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7078 int ipw2100_wx_get_nick(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7097 int ipw2100_wx_set_rate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7137 int ipw2100_wx_get_rate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7189 int ipw2100_wx_set_rts(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7224 int ipw2100_wx_get_rts(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7245 int ipw2100_wx_set_txpow(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7286 int ipw2100_wx_get_txpow(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7313 int ipw2100_wx_set_frag(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7343 int ipw2100_wx_get_frag(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7361 int ipw2100_wx_set_retry(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7405 int ipw2100_wx_get_retry(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7437 int ipw2100_wx_set_scan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7465 int ipw2100_wx_get_scan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7480 int ipw2100_wx_set_encode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *key);
7492 int ipw2100_wx_get_encode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *key);
7504 int ipw2100_wx_set_power(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7549 int ipw2100_wx_get_power(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7576 int ipw2100_wx_set_genie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7612 int ipw2100_wx_get_genie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7634 int ipw2100_wx_set_auth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7727 int ipw2100_wx_get_auth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7789 int ipw2100_wx_set_encodeext(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7798 int ipw2100_wx_get_encodeext(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7807 int ipw2100_wx_set_mlme(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7838 int ipw2100_wx_set_promisc(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7869 int ipw2100_wx_reset(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7881 int ipw2100_wx_set_powermode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7905 int ipw2100_wx_get_powermode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7945 int ipw2100_wx_set_preamble(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7974 int ipw2100_wx_get_preamble(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
7993 int ipw2100_wx_set_crc_check(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
8021 int ipw2100_wx_get_crc_check(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
8040 iw_handler ipw2100_wx_handlers[54U] = { 0, &ipw2100_wx_get_name, 0, 0, &ipw2100_wx_set_freq, &ipw2100_wx_get_freq, &ipw2100_wx_set_mode, &ipw2100_wx_get_mode, 0, 0, 0, &ipw2100_wx_get_range, 0, 0, 0, 0, 0, 0, 0, 0, &ipw2100_wx_set_wap, &ipw2100_wx_get_wap, &ipw2100_wx_set_mlme, 0, &ipw2100_wx_set_scan, &ipw2100_wx_get_scan, &ipw2100_wx_set_essid, &ipw2100_wx_get_essid, &ipw2100_wx_set_nick, &ipw2100_wx_get_nick, 0, 0, &ipw2100_wx_set_rate, &ipw2100_wx_get_rate, &ipw2100_wx_set_rts, &ipw2100_wx_get_rts, &ipw2100_wx_set_frag, &ipw2100_wx_get_frag, &ipw2100_wx_set_txpow, &ipw2100_wx_get_txpow, &ipw2100_wx_set_retry, &ipw2100_wx_get_retry, &ipw2100_wx_set_encode, &ipw2100_wx_get_encode, &ipw2100_wx_set_power, &ipw2100_wx_get_power, 0, 0, &ipw2100_wx_set_genie, &ipw2100_wx_get_genie, &ipw2100_wx_set_auth, &ipw2100_wx_get_auth, &ipw2100_wx_set_encodeext, &ipw2100_wx_get_encodeext };
8087 const struct iw_priv_args ipw2100_private_args[8U] = { { 35808U, 18434U, 0U, { 'm', 'o', 'n', 'i', 't', 'o', 'r', '\x0' } }, { 35809U, 18432U, 0U, { 'r', 'e', 's', 'e', 't', '\x0' } }, { 35810U, 18433U, 0U, { 's', 'e', 't', '_', 'p', 'o', 'w', 'e', 'r', '\x0' } }, { 35811U, 0U, 10320U, { 'g', 'e', 't', '_', 'p', 'o', 'w', 'e', 'r', '\x0' } }, { 35812U, 18433U, 0U, { 's', 'e', 't', '_', 'p', 'r', 'e', 'a', 'm', 'b', 'l', 'e', '\x0' } }, { 35813U, 0U, 10256U, { 'g', 'e', 't', '_', 'p', 'r', 'e', 'a', 'm', 'b', 'l', 'e', '\x0' } }, { 35814U, 18433U, 0U, { 's', 'e', 't', '_', 'c', 'r', 'c', '_', 'c', 'h', 'e', 'c', 'k', '\x0' } }, { 35815U, 0U, 10256U, { 'g', 'e', 't', '_', 'c', 'r', 'c', '_', 'c', 'h', 'e', 'c', 'k', '\x0' } } };
8121 iw_handler ipw2100_private_handler[8U] = { &ipw2100_wx_set_promisc, &ipw2100_wx_reset, &ipw2100_wx_set_powermode, &ipw2100_wx_get_powermode, &ipw2100_wx_set_preamble, &ipw2100_wx_get_preamble, &ipw2100_wx_set_crc_check, &ipw2100_wx_get_crc_check };
8285 struct iw_handler_def ipw2100_wx_handler_def = { (const iw_handler (**)(struct net_device *, struct iw_request_info *, union iwreq_data *, char *))(&ipw2100_wx_handlers), 54U, 8U, 8U, (const iw_handler (**)(struct net_device *, struct iw_request_info *, union iwreq_data *, char *))(&ipw2100_private_handler), (const struct iw_priv_args *)(&ipw2100_private_args), &ipw2100_wx_wireless_stats };
8381 int ipw2100_mod_firmware_load(struct ipw2100_fw *fw);
8672 void ldv_check_final_state();
8675 void ldv_check_return_value(int);
8678 void ldv_check_return_value_probe(int);
8681 void ldv_initialize();
8684 void ldv_handler_precall();
8687 int nondet_int();
8690 int LDV_IN_INTERRUPT = 0;
8693 void ldv_main0_sequence_infinite_withcheck_stateful();
10 void ldv_error();
25 int ldv_undef_int();
26 void * ldv_undef_ptr();
8 int LDV_DMA_MAP_CALLS = 0;
11 dma_addr_t ldv_dma_map_page(struct device *dev, struct page *page, size_t offset, size_t size, enum dma_data_direction dir);
25 int ldv_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
41 dma_addr_t ldv_dma_map_single(struct device *dev, void *cpu_addr, size_t size, enum dma_data_direction dir);
return ;
}
-entry_point
{
8695 struct net_device *var_group1;
8696 struct ethtool_drvinfo *var_group2;
8697 int res_ipw2100_open_136;
8698 int res_ipw2100_close_137;
8699 void *var_ipw2100_set_address_135_p1;
8700 struct pci_dev *var_group3;
8701 const struct pci_device_id *var_ipw2100_pci_init_one_147_p1;
8702 int res_ipw2100_pci_init_one_147;
8703 struct pm_message var_ipw2100_suspend_149_p1;
8704 int var_ipw2100_interrupt_69_p0;
8705 void *var_ipw2100_interrupt_69_p1;
8706 int ldv_s_ipw2100_netdev_ops_net_device_ops;
8707 int ldv_s_ipw2100_pci_driver_pci_driver;
8708 int tmp;
8709 int tmp___0;
8710 int tmp___1;
11141 ldv_s_ipw2100_netdev_ops_net_device_ops = 0;
11144 ldv_s_ipw2100_pci_driver_pci_driver = 0;
10954 LDV_IN_INTERRUPT = 1;
10963 -ldv_initialize()
{
71 LDV_DMA_MAP_CALLS = 0;
72 return ;;
}
11091 ldv_handler_precall() { /* Function call is skipped due to function is undefined */}
11092 -ipw2100_init()
{
6590 int ret;
6592 printk("\016ipw2100: %s, %s\n", (char *)"Intel(R) PRO/Wireless 2100 Network Driver", (char *)"git-1.2.2") { /* Function call is skipped due to function is undefined */}
6593 printk("\016ipw2100: %s\n", (char *)"Copyright(c) 2003-2006 Intel Corporation") { /* Function call is skipped due to function is undefined */}
6595 pm_qos_add_request(&ipw2100_pm_qos_req, 1, -1) { /* Function call is skipped due to function is undefined */}
6598 ret = __pci_register_driver(&ipw2100_pci_driver, &__this_module, "ipw2100") { /* Function call is skipped due to function is undefined */}
6599 assume(!(ret != 0));
6603 ipw2100_debug_level = (u32 )debug;
6604 ret = driver_create_file(&(ipw2100_pci_driver.driver), (const struct driver_attribute *)(&driver_attr_debug_level)) { /* Function call is skipped due to function is undefined */}
6605 out:;
6609 return ret;;
}
11092 assume(!(tmp != 0));
11152 goto ldv_57553;
11152 tmp___1 = nondet_int() { /* Function call is skipped due to function is undefined */}
11152 assume(tmp___1 != 0);
11156 goto ldv_57552;
11153 ldv_57552:;
11157 tmp___0 = nondet_int() { /* Function call is skipped due to function is undefined */}
11157 switch (tmp___0)
11158 assume(!(tmp___0 == 0));
11345 assume(!(tmp___0 == 1));
11531 assume(!(tmp___0 == 2));
11720 assume(!(tmp___0 == 3));
11909 assume(!(tmp___0 == 4));
12093 assume(!(tmp___0 == 5));
12279 assume(!(tmp___0 == 6));
12468 assume(!(tmp___0 == 7));
12652 assume(!(tmp___0 == 8));
12838 assume(!(tmp___0 == 9));
13024 assume(tmp___0 == 10);
13151 ldv_handler_precall() { /* Function call is skipped due to function is undefined */}
13152 -ipw2100_shutdown(var_group3)
{
6505 struct ipw2100_priv *priv;
6506 void *tmp;
6505 -pci_get_drvdata(pci_dev)
{
1409 void *tmp;
1409 tmp = dev_get_drvdata((const struct device *)(&(pdev->dev))) { /* Function call is skipped due to function is undefined */}
1409 return tmp;;
}
6505 priv = (struct ipw2100_priv *)tmp;
6508 -ipw2100_down(priv)
{
1853 unsigned long flags;
1854 union iwreq_data wrqu;
1855 int associated;
1856 raw_spinlock_t *tmp;
1857 int tmp___0;
1858 raw_spinlock_t *tmp___1;
1854 wrqu.ap_addr.sa_family = 1U;
1854 (wrqu.ap_addr.sa_data)[0] = 0;
1854 (wrqu.ap_addr.sa_data)[1] = 0;
1854 (wrqu.ap_addr.sa_data)[2] = 0;
1854 (wrqu.ap_addr.sa_data)[3] = 0;
1854 (wrqu.ap_addr.sa_data)[4] = 0;
1854 (wrqu.ap_addr.sa_data)[5] = 0;
1854 (wrqu.ap_addr.sa_data)[6] = 0;
1854 (wrqu.ap_addr.sa_data)[7] = 0;
1854 (wrqu.ap_addr.sa_data)[8] = 0;
1854 (wrqu.ap_addr.sa_data)[9] = 0;
1854 (wrqu.ap_addr.sa_data)[10] = 0;
1854 (wrqu.ap_addr.sa_data)[11] = 0;
1854 (wrqu.ap_addr.sa_data)[12] = 0;
1854 (wrqu.ap_addr.sa_data)[13] = 0;
1858 int __CPAchecker_TMP_0 = (int)(priv->status);
1858 associated = __CPAchecker_TMP_0 & 1024;
1861 assume(!((priv->stop_rf_kill) == 0));
1867 assume(!((priv->stop_hang_check) == 0));
1873 assume(((priv->status) & 536870912UL) != 0UL);
1874 cancel_delayed_work(&(priv->reset_work)) { /* Function call is skipped due to function is undefined */}
1878 -spinlock_check(&(priv->low_lock))
{
292 return &(lock->__annonCompField20.rlock);;
}
1878 flags = _raw_spin_lock_irqsave(tmp) { /* Function call is skipped due to function is undefined */}
1879 -ipw2100_enable_interrupts(priv)
{
1119 assume(!(((priv->status) & 2048UL) != 0UL));
1121 priv->status = (priv->status) | 2048UL;
1122 -write_register(priv->net_dev, 12U, 3238068243U)
{
356 struct ipw2100_priv *priv;
357 void *tmp;
358 int tmp___0;
356 -libipw_priv(dev)
{
851 void *tmp;
851 -netdev_priv((const struct net_device *)dev)
{
1605 return ((void *)dev) + 3200U;;
}
851 return (void *)(&(((struct libipw_device *)tmp)->priv));;
}
356 priv = (struct ipw2100_priv *)tmp;
358 iowrite32(val, (priv->ioaddr) + ((unsigned long)reg)) { /* Function call is skipped due to function is undefined */}
359 assume(!((ipw2100_debug_level & 67108864U) != 0U));
361 return ;;
}
1123 return ;;
}
1880 -spin_unlock_irqrestore(&(priv->low_lock), flags)
{
358 _raw_spin_unlock_irqrestore(&(lock->__annonCompField20.rlock), flags) { /* Function call is skipped due to function is undefined */}
359 return ;;
}
1882 -ipw2100_hw_stop_adapter(priv)
{
1491 struct host_command cmd;
1492 int err;
1493 int i;
1494 unsigned int reg;
1495 int tmp;
1496 unsigned long tmp___0;
1493 cmd.host_command = 58U;
1493 cmd.host_command1 = 0U;
1493 cmd.host_command_sequence = 0U;
1493 cmd.host_command_length = 0U;
1493 (cmd.host_command_parameters)[0] = 0U;
1493 (cmd.host_command_parameters)[1] = 0U;
1493 (cmd.host_command_parameters)[2] = 0U;
1493 (cmd.host_command_parameters)[3] = 0U;
1493 (cmd.host_command_parameters)[4] = 0U;
1493 (cmd.host_command_parameters)[5] = 0U;
1493 (cmd.host_command_parameters)[6] = 0U;
1493 (cmd.host_command_parameters)[7] = 0U;
1493 (cmd.host_command_parameters)[8] = 0U;
1493 (cmd.host_command_parameters)[9] = 0U;
1493 (cmd.host_command_parameters)[10] = 0U;
1493 (cmd.host_command_parameters)[11] = 0U;
1493 (cmd.host_command_parameters)[12] = 0U;
1493 (cmd.host_command_parameters)[13] = 0U;
1493 (cmd.host_command_parameters)[14] = 0U;
1493 (cmd.host_command_parameters)[15] = 0U;
1493 (cmd.host_command_parameters)[16] = 0U;
1493 (cmd.host_command_parameters)[17] = 0U;
1493 (cmd.host_command_parameters)[18] = 0U;
1493 (cmd.host_command_parameters)[19] = 0U;
1493 (cmd.host_command_parameters)[20] = 0U;
1493 (cmd.host_command_parameters)[21] = 0U;
1493 (cmd.host_command_parameters)[22] = 0U;
1493 (cmd.host_command_parameters)[23] = 0U;
1493 (cmd.host_command_parameters)[24] = 0U;
1493 (cmd.host_command_parameters)[25] = 0U;
1493 (cmd.host_command_parameters)[26] = 0U;
1493 (cmd.host_command_parameters)[27] = 0U;
1493 (cmd.host_command_parameters)[28] = 0U;
1493 (cmd.host_command_parameters)[29] = 0U;
1493 (cmd.host_command_parameters)[30] = 0U;
1493 (cmd.host_command_parameters)[31] = 0U;
1493 (cmd.host_command_parameters)[32] = 0U;
1493 (cmd.host_command_parameters)[33] = 0U;
1493 (cmd.host_command_parameters)[34] = 0U;
1493 (cmd.host_command_parameters)[35] = 0U;
1493 (cmd.host_command_parameters)[36] = 0U;
1493 (cmd.host_command_parameters)[37] = 0U;
1493 (cmd.host_command_parameters)[38] = 0U;
1493 (cmd.host_command_parameters)[39] = 0U;
1493 (cmd.host_command_parameters)[40] = 0U;
1493 (cmd.host_command_parameters)[41] = 0U;
1493 (cmd.host_command_parameters)[42] = 0U;
1493 (cmd.host_command_parameters)[43] = 0U;
1493 (cmd.host_command_parameters)[44] = 0U;
1493 (cmd.host_command_parameters)[45] = 0U;
1493 (cmd.host_command_parameters)[46] = 0U;
1493 (cmd.host_command_parameters)[47] = 0U;
1493 (cmd.host_command_parameters)[48] = 0U;
1493 (cmd.host_command_parameters)[49] = 0U;
1493 (cmd.host_command_parameters)[50] = 0U;
1493 (cmd.host_command_parameters)[51] = 0U;
1493 (cmd.host_command_parameters)[52] = 0U;
1493 (cmd.host_command_parameters)[53] = 0U;
1493 (cmd.host_command_parameters)[54] = 0U;
1493 (cmd.host_command_parameters)[55] = 0U;
1493 (cmd.host_command_parameters)[56] = 0U;
1493 (cmd.host_command_parameters)[57] = 0U;
1493 (cmd.host_command_parameters)[58] = 0U;
1493 (cmd.host_command_parameters)[59] = 0U;
1493 (cmd.host_command_parameters)[60] = 0U;
1493 (cmd.host_command_parameters)[61] = 0U;
1493 (cmd.host_command_parameters)[62] = 0U;
1493 (cmd.host_command_parameters)[63] = 0U;
1493 (cmd.host_command_parameters)[64] = 0U;
1493 (cmd.host_command_parameters)[65] = 0U;
1493 (cmd.host_command_parameters)[66] = 0U;
1493 (cmd.host_command_parameters)[67] = 0U;
1493 (cmd.host_command_parameters)[68] = 0U;
1493 (cmd.host_command_parameters)[69] = 0U;
1493 (cmd.host_command_parameters)[70] = 0U;
1493 (cmd.host_command_parameters)[71] = 0U;
1493 (cmd.host_command_parameters)[72] = 0U;
1493 (cmd.host_command_parameters)[73] = 0U;
1493 (cmd.host_command_parameters)[74] = 0U;
1493 (cmd.host_command_parameters)[75] = 0U;
1493 (cmd.host_command_parameters)[76] = 0U;
1493 (cmd.host_command_parameters)[77] = 0U;
1493 (cmd.host_command_parameters)[78] = 0U;
1493 (cmd.host_command_parameters)[79] = 0U;
1493 (cmd.host_command_parameters)[80] = 0U;
1493 (cmd.host_command_parameters)[81] = 0U;
1493 (cmd.host_command_parameters)[82] = 0U;
1493 (cmd.host_command_parameters)[83] = 0U;
1493 (cmd.host_command_parameters)[84] = 0U;
1493 (cmd.host_command_parameters)[85] = 0U;
1493 (cmd.host_command_parameters)[86] = 0U;
1493 (cmd.host_command_parameters)[87] = 0U;
1493 (cmd.host_command_parameters)[88] = 0U;
1493 (cmd.host_command_parameters)[89] = 0U;
1493 (cmd.host_command_parameters)[90] = 0U;
1493 (cmd.host_command_parameters)[91] = 0U;
1493 (cmd.host_command_parameters)[92] = 0U;
1493 (cmd.host_command_parameters)[93] = 0U;
1493 (cmd.host_command_parameters)[94] = 0U;
1493 (cmd.host_command_parameters)[95] = 0U;
1493 (cmd.host_command_parameters)[96] = 0U;
1493 (cmd.host_command_parameters)[97] = 0U;
1493 (cmd.host_command_parameters)[98] = 0U;
1493 (cmd.host_command_parameters)[99] = 0U;
1501 assume(!(((priv->status) & 4UL) == 0UL));
1504 priv->status = (priv->status) | 16UL;
1509 assume((priv->fatal_error) == 0U);
1512 -ipw2100_enable_adapter(priv)
{
1447 struct host_command cmd;
1448 int err;
1449 int tmp;
1450 int tmp___0;
1451 int tmp___1;
1452 int tmp___2;
1453 int tmp___3;
1447 cmd.host_command = 2U;
1447 cmd.host_command1 = 0U;
1447 cmd.host_command_sequence = 0U;
1447 cmd.host_command_length = 0U;
1447 (cmd.host_command_parameters)[0] = 0U;
1447 (cmd.host_command_parameters)[1] = 0U;
1447 (cmd.host_command_parameters)[2] = 0U;
1447 (cmd.host_command_parameters)[3] = 0U;
1447 (cmd.host_command_parameters)[4] = 0U;
1447 (cmd.host_command_parameters)[5] = 0U;
1447 (cmd.host_command_parameters)[6] = 0U;
1447 (cmd.host_command_parameters)[7] = 0U;
1447 (cmd.host_command_parameters)[8] = 0U;
1447 (cmd.host_command_parameters)[9] = 0U;
1447 (cmd.host_command_parameters)[10] = 0U;
1447 (cmd.host_command_parameters)[11] = 0U;
1447 (cmd.host_command_parameters)[12] = 0U;
1447 (cmd.host_command_parameters)[13] = 0U;
1447 (cmd.host_command_parameters)[14] = 0U;
1447 (cmd.host_command_parameters)[15] = 0U;
1447 (cmd.host_command_parameters)[16] = 0U;
1447 (cmd.host_command_parameters)[17] = 0U;
1447 (cmd.host_command_parameters)[18] = 0U;
1447 (cmd.host_command_parameters)[19] = 0U;
1447 (cmd.host_command_parameters)[20] = 0U;
1447 (cmd.host_command_parameters)[21] = 0U;
1447 (cmd.host_command_parameters)[22] = 0U;
1447 (cmd.host_command_parameters)[23] = 0U;
1447 (cmd.host_command_parameters)[24] = 0U;
1447 (cmd.host_command_parameters)[25] = 0U;
1447 (cmd.host_command_parameters)[26] = 0U;
1447 (cmd.host_command_parameters)[27] = 0U;
1447 (cmd.host_command_parameters)[28] = 0U;
1447 (cmd.host_command_parameters)[29] = 0U;
1447 (cmd.host_command_parameters)[30] = 0U;
1447 (cmd.host_command_parameters)[31] = 0U;
1447 (cmd.host_command_parameters)[32] = 0U;
1447 (cmd.host_command_parameters)[33] = 0U;
1447 (cmd.host_command_parameters)[34] = 0U;
1447 (cmd.host_command_parameters)[35] = 0U;
1447 (cmd.host_command_parameters)[36] = 0U;
1447 (cmd.host_command_parameters)[37] = 0U;
1447 (cmd.host_command_parameters)[38] = 0U;
1447 (cmd.host_command_parameters)[39] = 0U;
1447 (cmd.host_command_parameters)[40] = 0U;
1447 (cmd.host_command_parameters)[41] = 0U;
1447 (cmd.host_command_parameters)[42] = 0U;
1447 (cmd.host_command_parameters)[43] = 0U;
1447 (cmd.host_command_parameters)[44] = 0U;
1447 (cmd.host_command_parameters)[45] = 0U;
1447 (cmd.host_command_parameters)[46] = 0U;
1447 (cmd.host_command_parameters)[47] = 0U;
1447 (cmd.host_command_parameters)[48] = 0U;
1447 (cmd.host_command_parameters)[49] = 0U;
1447 (cmd.host_command_parameters)[50] = 0U;
1447 (cmd.host_command_parameters)[51] = 0U;
1447 (cmd.host_command_parameters)[52] = 0U;
1447 (cmd.host_command_parameters)[53] = 0U;
1447 (cmd.host_command_parameters)[54] = 0U;
1447 (cmd.host_command_parameters)[55] = 0U;
1447 (cmd.host_command_parameters)[56] = 0U;
1447 (cmd.host_command_parameters)[57] = 0U;
1447 (cmd.host_command_parameters)[58] = 0U;
1447 (cmd.host_command_parameters)[59] = 0U;
1447 (cmd.host_command_parameters)[60] = 0U;
1447 (cmd.host_command_parameters)[61] = 0U;
1447 (cmd.host_command_parameters)[62] = 0U;
1447 (cmd.host_command_parameters)[63] = 0U;
1447 (cmd.host_command_parameters)[64] = 0U;
1447 (cmd.host_command_parameters)[65] = 0U;
1447 (cmd.host_command_parameters)[66] = 0U;
1447 (cmd.host_command_parameters)[67] = 0U;
1447 (cmd.host_command_parameters)[68] = 0U;
1447 (cmd.host_command_parameters)[69] = 0U;
1447 (cmd.host_command_parameters)[70] = 0U;
1447 (cmd.host_command_parameters)[71] = 0U;
1447 (cmd.host_command_parameters)[72] = 0U;
1447 (cmd.host_command_parameters)[73] = 0U;
1447 (cmd.host_command_parameters)[74] = 0U;
1447 (cmd.host_command_parameters)[75] = 0U;
1447 (cmd.host_command_parameters)[76] = 0U;
1447 (cmd.host_command_parameters)[77] = 0U;
1447 (cmd.host_command_parameters)[78] = 0U;
1447 (cmd.host_command_parameters)[79] = 0U;
1447 (cmd.host_command_parameters)[80] = 0U;
1447 (cmd.host_command_parameters)[81] = 0U;
1447 (cmd.host_command_parameters)[82] = 0U;
1447 (cmd.host_command_parameters)[83] = 0U;
1447 (cmd.host_command_parameters)[84] = 0U;
1447 (cmd.host_command_parameters)[85] = 0U;
1447 (cmd.host_command_parameters)[86] = 0U;
1447 (cmd.host_command_parameters)[87] = 0U;
1447 (cmd.host_command_parameters)[88] = 0U;
1447 (cmd.host_command_parameters)[89] = 0U;
1447 (cmd.host_command_parameters)[90] = 0U;
1447 (cmd.host_command_parameters)[91] = 0U;
1447 (cmd.host_command_parameters)[92] = 0U;
1447 (cmd.host_command_parameters)[93] = 0U;
1447 (cmd.host_command_parameters)[94] = 0U;
1447 (cmd.host_command_parameters)[95] = 0U;
1447 (cmd.host_command_parameters)[96] = 0U;
1447 (cmd.host_command_parameters)[97] = 0U;
1447 (cmd.host_command_parameters)[98] = 0U;
1447 (cmd.host_command_parameters)[99] = 0U;
1452 err = 0;
1454 assume(!((ipw2100_debug_level & 32U) != 0U));
1456 assume(!(((priv->status) & 8UL) != 0UL));
1459 mutex_lock_nested(&(priv->adapter_mutex), 0U) { /* Function call is skipped due to function is undefined */}
1461 -rf_kill_active(priv)
{
1169 unsigned short value;
1170 unsigned int reg;
1171 int i;
1172 value = 0U;
1173 reg = 0U;
1176 assume(((priv->hw_features) & 1UL) == 0UL);
1177 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, 0) { /* Function call is skipped due to function is undefined */}
1178 priv->status = (priv->status) & 18446744073709547519UL;
1179 return 0;;
}
1461 assume(!(tmp___1 != 0));
1466 -ipw2100_hw_send_command(priv, &cmd)
{
732 struct list_head *element;
733 struct ipw2100_tx_packet *packet;
734 unsigned long flags;
735 int err;
736 int tmp;
737 raw_spinlock_t *tmp___0;
738 int tmp___1;
739 int tmp___2;
740 int tmp___3;
741 int tmp___4;
742 int tmp___5;
743 const struct list_head *__mptr;
744 unsigned long __len;
745 void *__ret;
746 long __ret___0;
747 struct __wait_queue __wait;
748 long __ret___1;
749 long __int;
750 long tmp___6;
751 _Bool __cond;
752 _Bool __cond___0;
753 int tmp___7;
754 unsigned long tmp___8;
736 err = 0;
738 assume(!((ipw2100_debug_level & 32U) != 0U));
741 -printk_buf(32, (const u8 *)(&(cmd->host_command_parameters)), cmd->host_command_length)
{
678 char line[81U];
679 unsigned int ofs;
680 unsigned int _min1;
681 unsigned int _min2;
682 char *tmp;
683 unsigned int _min1___0;
684 unsigned int _min2___0;
679 ofs = 0U;
680 assume((ipw2100_debug_level & ((u32 )level)) == 0U);
681 return ;;
}
744 -spinlock_check(&(priv->low_lock))
{
292 return &(lock->__annonCompField20.rlock);;
}
744 flags = _raw_spin_lock_irqsave(tmp___0) { /* Function call is skipped due to function is undefined */}
746 assume(!((priv->fatal_error) != 0U));
753 assume(!(((priv->status) & 4UL) == 0UL));
760 assume(!(((priv->status) & 2UL) != 0UL));
767 -list_empty((const struct list_head *)(&(priv->msg_free_list)))
{
188 const struct list_head *__CPAchecker_TMP_0 = (const struct list_head *)(head->next);
188 return ((unsigned long)__CPAchecker_TMP_0) == ((unsigned long)head);;
}
767 assume(!(tmp___5 != 0));
772 priv->status = (priv->status) | 2UL;
773 priv->messages_sent = (priv->messages_sent) + 1;
775 element = priv->msg_free_list.next;
777 __mptr = (const struct list_head *)element;
777 packet = ((struct ipw2100_tx_packet *)__mptr) + 18446744073709551576UL;
778 packet->jiffy_start = (int)jiffies;
781 packet->info.c_struct.cmd->host_command_reg = cmd->host_command;
782 packet->info.c_struct.cmd->host_command_reg1 = cmd->host_command1;
783 packet->info.c_struct.cmd->host_command_len_reg = cmd->host_command_length;
785 packet->info.c_struct.cmd->sequence = cmd->host_command_sequence;
787 __len = 400UL;
787 assume(__len > 63UL);
787 __ret = __memcpy((void *)(&(packet->info.c_struct.cmd->host_command_params_reg)), (const void *)(&(cmd->host_command_parameters)), __len) { /* Function call is skipped due to function is undefined */}
791 list_del(element) { /* Function call is skipped due to function is undefined */}
792 priv->msg_free_stat.value = (priv->msg_free_stat.value) - 1;
792 assume((priv->msg_free_stat.value) < (priv->msg_free_stat.lo));
792 priv->msg_free_stat.lo = priv->msg_free_stat.value;
794 -list_add_tail(element, &(priv->msg_pend_list))
{
76 __list_add(new, head->prev, head) { /* Function call is skipped due to function is undefined */}
77 return ;;
}
795 priv->msg_pend_stat.value = (priv->msg_pend_stat.value) + 1;
795 assume(!((priv->msg_pend_stat.value) > (priv->msg_pend_stat.hi)));
797 -ipw2100_tx_send_commands(priv)
{
3016 struct list_head *element;
3017 struct ipw2100_tx_packet *packet;
3018 struct ipw2100_bd_queue *txq;
3019 struct ipw2100_bd *tbd;
3020 int next;
3021 int tmp;
3022 const struct list_head *__mptr;
3023 int tmp___0;
3024 int tmp___1;
3018 txq = &(priv->tx_queue);
3020 int __CPAchecker_TMP_0 = (int)(txq->next);
3020 next = __CPAchecker_TMP_0;
3022 goto ldv_55977;
3022 -list_empty((const struct list_head *)(&(priv->msg_pend_list)))
{
188 const struct list_head *__CPAchecker_TMP_0 = (const struct list_head *)(head->next);
188 return ((unsigned long)__CPAchecker_TMP_0) == ((unsigned long)head);;
}
3022 assume(tmp___1 == 0);
3024 goto ldv_55976;
3023 ldv_55976:;
3029 assume((txq->available) <= 3U);
3030 assume(!((ipw2100_debug_level & 8388608U) != 0U));
3031 goto ldv_55973;
3069 assume(!((txq->next) != ((u32 )next)));
3077 return ;;
}
798 -ipw2100_tx_send_data(priv)
{
3085 struct list_head *element;
3086 struct ipw2100_tx_packet *packet;
3087 struct ipw2100_bd_queue *txq;
3088 struct ipw2100_bd *tbd;
3089 int next;
3090 int i;
3091 struct ipw2100_data_header *ipw_hdr;
3092 struct libipw_hdr_3addr *hdr;
3093 const struct list_head *__mptr;
3094 int tmp;
3095 long tmp___0;
3096 int tmp___1;
3097 unsigned long __len;
3098 void *__ret;
3099 unsigned long __len___0;
3100 void *__ret___0;
3101 unsigned long __len___1;
3102 void *__ret___1;
3103 unsigned long __len___2;
3104 void *__ret___2;
3105 int tmp___2;
3106 int tmp___3;
3107 unsigned long long tmp___4;
3108 int tmp___5;
3109 int tmp___6;
3087 txq = &(priv->tx_queue);
3089 int __CPAchecker_TMP_0 = (int)(txq->next);
3089 next = __CPAchecker_TMP_0;
3090 i = 0;
3094 goto ldv_56009;
3094 -list_empty((const struct list_head *)(&(priv->tx_pend_list)))
{
188 const struct list_head *__CPAchecker_TMP_0 = (const struct list_head *)(head->next);
188 return ((unsigned long)__CPAchecker_TMP_0) == ((unsigned long)head);;
}
3094 assume(tmp___6 == 0);
3096 goto ldv_56008;
3095 ldv_56008:;
3101 element = priv->tx_pend_list.next;
3102 __mptr = (const struct list_head *)element;
3102 packet = ((struct ipw2100_tx_packet *)__mptr) + 18446744073709551576UL;
3104 int __CPAchecker_TMP_1 = (int)(packet->info.d_struct.txb->nr_frags);
3104 tmp___0 = __builtin_expect((__CPAchecker_TMP_1 + 1) > 6, 0L) { /* Function call is skipped due to function is undefined */}
3104 assume(!(tmp___0 != 0L));
3113 int __CPAchecker_TMP_3 = (int)(packet->info.d_struct.txb->nr_frags);
3113 assume(!((txq->available) <= ((u32 )(__CPAchecker_TMP_3 + 3))));
3118 list_del(element) { /* Function call is skipped due to function is undefined */}
3119 priv->tx_pend_stat.value = (priv->tx_pend_stat.value) - 1;
3119 assume(!((priv->tx_pend_stat.value) < (priv->tx_pend_stat.lo)));
3121 unsigned long __CPAchecker_TMP_5 = (unsigned long)(txq->next);
3121 tbd = (txq->drv) + __CPAchecker_TMP_5;
3123 int __CPAchecker_TMP_6 = (int)(txq->next);
3123 packet->index = __CPAchecker_TMP_6;
3125 ipw_hdr = packet->info.d_struct.data;
3126 struct libipw_hdr_3addr *__CPAchecker_TMP_7 = (struct libipw_hdr_3addr *)(((packet->info.d_struct.txb->fragments)[0])->data);
3126 hdr = __CPAchecker_TMP_7;
3129 assume(!((priv->ieee->iw_mode) == 2));
3134 assume(!((priv->ieee->iw_mode) == 1));
3141 ipw_hdr->host_command_reg = 33U;
3142 ipw_hdr->host_command_reg1 = 0U;
3145 ipw_hdr->needs_encryption = 0U;
3146 ipw_hdr->encrypted = packet->info.d_struct.txb->encrypted;
3147 unsigned int __CPAchecker_TMP_8 = (unsigned int)(packet->info.d_struct.txb->nr_frags);
3147 assume(!(__CPAchecker_TMP_8 > 1U));
3152 ipw_hdr->fragment_size = 0U;
3154 tbd->host_addr = (u32 )(packet->info.d_struct.data_phys);
3155 tbd->buf_length = 52U;
3156 unsigned int __CPAchecker_TMP_10 = (unsigned int)(packet->info.d_struct.txb->nr_frags);
3156 tbd->num_fragments = __CPAchecker_TMP_10 + 1U;
3157 tbd->status.info.field = 1U;
3160 txq->next = (txq->next) + 1U;
3161 txq->next = (txq->next) % (txq->entries);
3163 assume(!((ipw2100_debug_level & 8388608U) != 0U));
3166 unsigned int __CPAchecker_TMP_12 = (unsigned int)(packet->info.d_struct.txb->nr_frags);
3166 assume(__CPAchecker_TMP_12 > 1U);
3167 assume(!((ipw2100_debug_level & 2097152U) != 0U));
3171 i = 0;
3171 goto ldv_56006;
3171 int __CPAchecker_TMP_22 = (int)(packet->info.d_struct.txb->nr_frags);
3171 assume(__CPAchecker_TMP_22 > i);
3173 goto ldv_56005;
3172 ldv_56005:;
3172 unsigned long __CPAchecker_TMP_15 = (unsigned long)(txq->next);
3172 tbd = (txq->drv) + __CPAchecker_TMP_15;
3173 int __CPAchecker_TMP_16 = (int)(packet->info.d_struct.txb->nr_frags);
3173 assume(!((__CPAchecker_TMP_16 + -1) == i));
3178 tbd->status.info.field = 1U;
3182 tbd->buf_length = (((packet->info.d_struct.txb->fragments)[i])->len) - 24U;
3185 void *__CPAchecker_TMP_17 = (void *)(((packet->info.d_struct.txb->fragments)[i])->data);
3185 size_t __CPAchecker_TMP_18 = (size_t )(tbd->buf_length);
3185 -pci_map_single(priv->pci_dev, __CPAchecker_TMP_17 + 24U, __CPAchecker_TMP_18, 1)
{
33 unsigned long long tmp;
32 struct device *__CPAchecker_TMP_0;
32 assume(((unsigned long)hwdev) != ((unsigned long)((struct pci_dev *)0)));
32 __CPAchecker_TMP_0 = &(hwdev->dev);
32 -ldv_dma_map_single_attrs_2(__CPAchecker_TMP_0, ptr, size, (enum dma_data_direction )direction, (struct dma_attrs *)0)
{
20 unsigned long long tmp;
19 -ldv_dma_map_single_attrs(dev, ptr, size, dir, attrs)
{
58 unsigned long long nonedetermined;
59 void *tmp;
58 tmp = ldv_undef_ptr() { /* Function call is skipped due to function is undefined */}
58 nonedetermined = (dma_addr_t )tmp;
61 assume(!(LDV_DMA_MAP_CALLS != 0));
63 LDV_DMA_MAP_CALLS = LDV_DMA_MAP_CALLS + 1;
65 return nonedetermined;;
}
19 return tmp;;
}
32 return tmp;;
}
3185 tbd->host_addr = (u32 )tmp___4;
3193 assume(!((ipw2100_debug_level & 8388608U) != 0U));
3197 dma_addr_t __CPAchecker_TMP_20 = (dma_addr_t )(tbd->host_addr);
3197 size_t __CPAchecker_TMP_21 = (size_t )(tbd->buf_length);
3197 -pci_dma_sync_single_for_device(priv->pci_dev, __CPAchecker_TMP_20, __CPAchecker_TMP_21, 1)
{
81 struct device *__CPAchecker_TMP_0;
81 assume(((unsigned long)hwdev) != ((unsigned long)((struct pci_dev *)0)));
81 __CPAchecker_TMP_0 = &(hwdev->dev);
81 -dma_sync_single_for_device(__CPAchecker_TMP_0, dma_handle, size, (enum dma_data_direction )direction)
{
124 struct dma_map_ops *ops;
125 struct dma_map_ops *tmp;
126 int tmp___0;
127 long tmp___1;
125 -get_dma_ops(dev)
{
34 long tmp;
37 tmp = __builtin_expect(((unsigned long)dev) == ((unsigned long)((struct device *)0)), 0L) { /* Function call is skipped due to function is undefined */}
37 assume(!(tmp != 0L));
37 assume(!(((unsigned long)(dev->archdata.dma_ops)) == ((unsigned long)((struct dma_map_ops *)0))));
40 return dev->archdata.dma_ops;;
}
125 ops = tmp;
127 -valid_dma_direction((int)dir)
{
65 int __CPAchecker_TMP_0;
65 assume(!(dma_direction == 0));
65 assume(dma_direction == 1);
__CPAchecker_TMP_0 = 1;
65 return __CPAchecker_TMP_0;;
}
127 tmp___1 = __builtin_expect(tmp___0 == 0, 0L) { /* Function call is skipped due to function is undefined */}
127 assume(!(tmp___1 != 0L));
128 unsigned long __CPAchecker_TMP_0 = (unsigned long)(ops->sync_single_for_device);
128 assume(__CPAchecker_TMP_0 != ((unsigned long)((void (*)(struct device *, dma_addr_t , size_t , enum dma_data_direction ))0)));
129 (*(ops->sync_single_for_device))(dev, addr, size, dir);
130 debug_dma_sync_single_for_device(dev, addr, size, (int)dir) { /* Function call is skipped due to function is undefined */}
131 return ;;
}
82 return ;;
}
3202 txq->next = (txq->next) + 1U;
3203 txq->next = (txq->next) % (txq->entries);
3171 i = i + 1;
3172 ldv_56006:;
3171 int __CPAchecker_TMP_22 = (int)(packet->info.d_struct.txb->nr_frags);
3171 assume(__CPAchecker_TMP_22 > i);
3173 goto ldv_56005;
3172 ldv_56005:;
3172 unsigned long __CPAchecker_TMP_15 = (unsigned long)(txq->next);
3172 tbd = (txq->drv) + __CPAchecker_TMP_15;
3173 int __CPAchecker_TMP_16 = (int)(packet->info.d_struct.txb->nr_frags);
3173 assume(!((__CPAchecker_TMP_16 + -1) == i));
3178 tbd->status.info.field = 1U;
3182 tbd->buf_length = (((packet->info.d_struct.txb->fragments)[i])->len) - 24U;
3185 void *__CPAchecker_TMP_17 = (void *)(((packet->info.d_struct.txb->fragments)[i])->data);
3185 size_t __CPAchecker_TMP_18 = (size_t )(tbd->buf_length);
3185 -pci_map_single(priv->pci_dev, __CPAchecker_TMP_17 + 24U, __CPAchecker_TMP_18, 1)
{
33 unsigned long long tmp;
32 struct device *__CPAchecker_TMP_0;
32 assume(((unsigned long)hwdev) != ((unsigned long)((struct pci_dev *)0)));
32 __CPAchecker_TMP_0 = &(hwdev->dev);
32 -ldv_dma_map_single_attrs_2(__CPAchecker_TMP_0, ptr, size, (enum dma_data_direction )direction, (struct dma_attrs *)0)
{
20 unsigned long long tmp;
19 -ldv_dma_map_single_attrs(dev, ptr, size, dir, attrs)
{
58 unsigned long long nonedetermined;
59 void *tmp;
58 tmp = ldv_undef_ptr() { /* Function call is skipped due to function is undefined */}
58 nonedetermined = (dma_addr_t )tmp;
61 assume(LDV_DMA_MAP_CALLS != 0);
61 -ldv_error()
{
15 LDV_ERROR:;
}
}
}
}
}
}
}
}
}
}
}
Source code
1 2 /****************************************************************************** 3 4 Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved. 5 6 This program is free software; you can redistribute it and/or modify it 7 under the terms of version 2 of the GNU General Public License as 8 published by the Free Software Foundation. 9 10 This program is distributed in the hope that it will be useful, but WITHOUT 11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 more details. 14 15 You should have received a copy of the GNU General Public License along with 16 this program; if not, write to the Free Software Foundation, Inc., 59 17 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 The full GNU General Public License is included in this distribution in the 20 file called LICENSE. 21 22 Contact Information: 23 Intel Linux Wireless <ilw@linux.intel.com> 24 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 25 26 Portions of this file are based on the sample_* files provided by Wireless 27 Extensions 0.26 package and copyright (c) 1997-2003 Jean Tourrilhes 28 <jt@hpl.hp.com> 29 30 Portions of this file are based on the Host AP project, 31 Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen 32 <j@w1.fi> 33 Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi> 34 35 Portions of ipw2100_mod_firmware_load, ipw2100_do_mod_firmware_load, and 36 ipw2100_fw_load are loosely based on drivers/sound/sound_firmware.c 37 available in the 2.4.25 kernel sources, and are copyright (c) Alan Cox 38 39 ******************************************************************************/ 40 /* 41 42 Initial driver on which this is based was developed by Janusz Gorycki, 43 Maciej Urbaniak, and Maciej Sosnowski. 44 45 Promiscuous mode support added by Jacek Wysoczynski and Maciej Urbaniak. 46 47 Theory of Operation 48 49 Tx - Commands and Data 50 51 Firmware and host share a circular queue of Transmit Buffer Descriptors (TBDs) 52 Each TBD contains a pointer to the physical (dma_addr_t) address of data being 53 sent to the firmware as well as the length of the data. 54 55 The host writes to the TBD queue at the WRITE index. The WRITE index points 56 to the _next_ packet to be written and is advanced when after the TBD has been 57 filled. 58 59 The firmware pulls from the TBD queue at the READ index. The READ index points 60 to the currently being read entry, and is advanced once the firmware is 61 done with a packet. 62 63 When data is sent to the firmware, the first TBD is used to indicate to the 64 firmware if a Command or Data is being sent. If it is Command, all of the 65 command information is contained within the physical address referred to by the 66 TBD. If it is Data, the first TBD indicates the type of data packet, number 67 of fragments, etc. The next TBD then refers to the actual packet location. 68 69 The Tx flow cycle is as follows: 70 71 1) ipw2100_tx() is called by kernel with SKB to transmit 72 2) Packet is move from the tx_free_list and appended to the transmit pending 73 list (tx_pend_list) 74 3) work is scheduled to move pending packets into the shared circular queue. 75 4) when placing packet in the circular queue, the incoming SKB is DMA mapped 76 to a physical address. That address is entered into a TBD. Two TBDs are 77 filled out. The first indicating a data packet, the second referring to the 78 actual payload data. 79 5) the packet is removed from tx_pend_list and placed on the end of the 80 firmware pending list (fw_pend_list) 81 6) firmware is notified that the WRITE index has 82 7) Once the firmware has processed the TBD, INTA is triggered. 83 8) For each Tx interrupt received from the firmware, the READ index is checked 84 to see which TBDs are done being processed. 85 9) For each TBD that has been processed, the ISR pulls the oldest packet 86 from the fw_pend_list. 87 10)The packet structure contained in the fw_pend_list is then used 88 to unmap the DMA address and to free the SKB originally passed to the driver 89 from the kernel. 90 11)The packet structure is placed onto the tx_free_list 91 92 The above steps are the same for commands, only the msg_free_list/msg_pend_list 93 are used instead of tx_free_list/tx_pend_list 94 95 ... 96 97 Critical Sections / Locking : 98 99 There are two locks utilized. The first is the low level lock (priv->low_lock) 100 that protects the following: 101 102 - Access to the Tx/Rx queue lists via priv->low_lock. The lists are as follows: 103 104 tx_free_list : Holds pre-allocated Tx buffers. 105 TAIL modified in __ipw2100_tx_process() 106 HEAD modified in ipw2100_tx() 107 108 tx_pend_list : Holds used Tx buffers waiting to go into the TBD ring 109 TAIL modified ipw2100_tx() 110 HEAD modified by ipw2100_tx_send_data() 111 112 msg_free_list : Holds pre-allocated Msg (Command) buffers 113 TAIL modified in __ipw2100_tx_process() 114 HEAD modified in ipw2100_hw_send_command() 115 116 msg_pend_list : Holds used Msg buffers waiting to go into the TBD ring 117 TAIL modified in ipw2100_hw_send_command() 118 HEAD modified in ipw2100_tx_send_commands() 119 120 The flow of data on the TX side is as follows: 121 122 MSG_FREE_LIST + COMMAND => MSG_PEND_LIST => TBD => MSG_FREE_LIST 123 TX_FREE_LIST + DATA => TX_PEND_LIST => TBD => TX_FREE_LIST 124 125 The methods that work on the TBD ring are protected via priv->low_lock. 126 127 - The internal data state of the device itself 128 - Access to the firmware read/write indexes for the BD queues 129 and associated logic 130 131 All external entry functions are locked with the priv->action_lock to ensure 132 that only one external action is invoked at a time. 133 134 135 */ 136 137 #include <linux/compiler.h> 138 #include <linux/errno.h> 139 #include <linux/if_arp.h> 140 #include <linux/in6.h> 141 #include <linux/in.h> 142 #include <linux/ip.h> 143 #include <linux/kernel.h> 144 #include <linux/kmod.h> 145 #include <linux/module.h> 146 #include <linux/netdevice.h> 147 #include <linux/ethtool.h> 148 #include <linux/pci.h> 149 #include <linux/dma-mapping.h> 150 #include <linux/proc_fs.h> 151 #include <linux/skbuff.h> 152 #include <asm/uaccess.h> 153 #include <asm/io.h> 154 #include <linux/fs.h> 155 #include <linux/mm.h> 156 #include <linux/slab.h> 157 #include <linux/unistd.h> 158 #include <linux/stringify.h> 159 #include <linux/tcp.h> 160 #include <linux/types.h> 161 #include <linux/time.h> 162 #include <linux/firmware.h> 163 #include <linux/acpi.h> 164 #include <linux/ctype.h> 165 #include <linux/pm_qos.h> 166 167 #include <net/lib80211.h> 168 169 #include "ipw2100.h" 170 #include "ipw.h" 171 172 #define IPW2100_VERSION "git-1.2.2" 173 174 #define DRV_NAME "ipw2100" 175 #define DRV_VERSION IPW2100_VERSION 176 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 177 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 178 179 static struct pm_qos_request ipw2100_pm_qos_req; 180 181 /* Debugging stuff */ 182 #ifdef CONFIG_IPW2100_DEBUG 183 #define IPW2100_RX_DEBUG /* Reception debugging */ 184 #endif 185 186 MODULE_DESCRIPTION(DRV_DESCRIPTION); 187 MODULE_VERSION(DRV_VERSION); 188 MODULE_AUTHOR(DRV_COPYRIGHT); 189 MODULE_LICENSE("GPL"); 190 191 static int debug = 0; 192 static int network_mode = 0; 193 static int channel = 0; 194 static int associate = 0; 195 static int disable = 0; 196 #ifdef CONFIG_PM 197 static struct ipw2100_fw ipw2100_firmware; 198 #endif 199 200 #include <linux/moduleparam.h> 201 module_param(debug, int, 0444); 202 module_param_named(mode, network_mode, int, 0444); 203 module_param(channel, int, 0444); 204 module_param(associate, int, 0444); 205 module_param(disable, int, 0444); 206 207 MODULE_PARM_DESC(debug, "debug level"); 208 MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS,2=Monitor)"); 209 MODULE_PARM_DESC(channel, "channel"); 210 MODULE_PARM_DESC(associate, "auto associate when scanning (default off)"); 211 MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); 212 213 static u32 ipw2100_debug_level = IPW_DL_NONE; 214 215 #ifdef CONFIG_IPW2100_DEBUG 216 #define IPW_DEBUG(level, message...) \ 217 do { \ 218 if (ipw2100_debug_level & (level)) { \ 219 printk(KERN_DEBUG "ipw2100: %c %s ", \ 220 in_interrupt() ? 'I' : 'U', __func__); \ 221 printk(message); \ 222 } \ 223 } while (0) 224 #else 225 #define IPW_DEBUG(level, message...) do {} while (0) 226 #endif /* CONFIG_IPW2100_DEBUG */ 227 228 #ifdef CONFIG_IPW2100_DEBUG 229 static const char *command_types[] = { 230 "undefined", 231 "unused", /* HOST_ATTENTION */ 232 "HOST_COMPLETE", 233 "unused", /* SLEEP */ 234 "unused", /* HOST_POWER_DOWN */ 235 "unused", 236 "SYSTEM_CONFIG", 237 "unused", /* SET_IMR */ 238 "SSID", 239 "MANDATORY_BSSID", 240 "AUTHENTICATION_TYPE", 241 "ADAPTER_ADDRESS", 242 "PORT_TYPE", 243 "INTERNATIONAL_MODE", 244 "CHANNEL", 245 "RTS_THRESHOLD", 246 "FRAG_THRESHOLD", 247 "POWER_MODE", 248 "TX_RATES", 249 "BASIC_TX_RATES", 250 "WEP_KEY_INFO", 251 "unused", 252 "unused", 253 "unused", 254 "unused", 255 "WEP_KEY_INDEX", 256 "WEP_FLAGS", 257 "ADD_MULTICAST", 258 "CLEAR_ALL_MULTICAST", 259 "BEACON_INTERVAL", 260 "ATIM_WINDOW", 261 "CLEAR_STATISTICS", 262 "undefined", 263 "undefined", 264 "undefined", 265 "undefined", 266 "TX_POWER_INDEX", 267 "undefined", 268 "undefined", 269 "undefined", 270 "undefined", 271 "undefined", 272 "undefined", 273 "BROADCAST_SCAN", 274 "CARD_DISABLE", 275 "PREFERRED_BSSID", 276 "SET_SCAN_OPTIONS", 277 "SCAN_DWELL_TIME", 278 "SWEEP_TABLE", 279 "AP_OR_STATION_TABLE", 280 "GROUP_ORDINALS", 281 "SHORT_RETRY_LIMIT", 282 "LONG_RETRY_LIMIT", 283 "unused", /* SAVE_CALIBRATION */ 284 "unused", /* RESTORE_CALIBRATION */ 285 "undefined", 286 "undefined", 287 "undefined", 288 "HOST_PRE_POWER_DOWN", 289 "unused", /* HOST_INTERRUPT_COALESCING */ 290 "undefined", 291 "CARD_DISABLE_PHY_OFF", 292 "MSDU_TX_RATES", 293 "undefined", 294 "SET_STATION_STAT_BITS", 295 "CLEAR_STATIONS_STAT_BITS", 296 "LEAP_ROGUE_MODE", 297 "SET_SECURITY_INFORMATION", 298 "DISASSOCIATION_BSSID", 299 "SET_WPA_ASS_IE" 300 }; 301 #endif 302 303 static const long ipw2100_frequencies[] = { 304 2412, 2417, 2422, 2427, 305 2432, 2437, 2442, 2447, 306 2452, 2457, 2462, 2467, 307 2472, 2484 308 }; 309 310 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 311 312 static struct ieee80211_rate ipw2100_bg_rates[] = { 313 { .bitrate = 10 }, 314 { .bitrate = 20, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, 315 { .bitrate = 55, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, 316 { .bitrate = 110, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, 317 }; 318 319 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 320 321 /* Pre-decl until we get the code solid and then we can clean it up */ 322 static void ipw2100_tx_send_commands(struct ipw2100_priv *priv); 323 static void ipw2100_tx_send_data(struct ipw2100_priv *priv); 324 static int ipw2100_adapter_setup(struct ipw2100_priv *priv); 325 326 static void ipw2100_queues_initialize(struct ipw2100_priv *priv); 327 static void ipw2100_queues_free(struct ipw2100_priv *priv); 328 static int ipw2100_queues_allocate(struct ipw2100_priv *priv); 329 330 static int ipw2100_fw_download(struct ipw2100_priv *priv, 331 struct ipw2100_fw *fw); 332 static int ipw2100_get_firmware(struct ipw2100_priv *priv, 333 struct ipw2100_fw *fw); 334 static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, 335 size_t max); 336 static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, 337 size_t max); 338 static void ipw2100_release_firmware(struct ipw2100_priv *priv, 339 struct ipw2100_fw *fw); 340 static int ipw2100_ucode_download(struct ipw2100_priv *priv, 341 struct ipw2100_fw *fw); 342 static void ipw2100_wx_event_work(struct work_struct *work); 343 static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev); 344 static struct iw_handler_def ipw2100_wx_handler_def; 345 346 static inline void read_register(struct net_device *dev, u32 reg, u32 * val) 347 { 348 struct ipw2100_priv *priv = libipw_priv(dev); 349 350 *val = ioread32(priv->ioaddr + reg); 351 IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val); 352 } 353 354 static inline void write_register(struct net_device *dev, u32 reg, u32 val) 355 { 356 struct ipw2100_priv *priv = libipw_priv(dev); 357 358 iowrite32(val, priv->ioaddr + reg); 359 IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val); 360 } 361 362 static inline void read_register_word(struct net_device *dev, u32 reg, 363 u16 * val) 364 { 365 struct ipw2100_priv *priv = libipw_priv(dev); 366 367 *val = ioread16(priv->ioaddr + reg); 368 IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val); 369 } 370 371 static inline void read_register_byte(struct net_device *dev, u32 reg, u8 * val) 372 { 373 struct ipw2100_priv *priv = libipw_priv(dev); 374 375 *val = ioread8(priv->ioaddr + reg); 376 IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val); 377 } 378 379 static inline void write_register_word(struct net_device *dev, u32 reg, u16 val) 380 { 381 struct ipw2100_priv *priv = libipw_priv(dev); 382 383 iowrite16(val, priv->ioaddr + reg); 384 IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val); 385 } 386 387 static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val) 388 { 389 struct ipw2100_priv *priv = libipw_priv(dev); 390 391 iowrite8(val, priv->ioaddr + reg); 392 IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val); 393 } 394 395 static inline void read_nic_dword(struct net_device *dev, u32 addr, u32 * val) 396 { 397 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 398 addr & IPW_REG_INDIRECT_ADDR_MASK); 399 read_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 400 } 401 402 static inline void write_nic_dword(struct net_device *dev, u32 addr, u32 val) 403 { 404 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 405 addr & IPW_REG_INDIRECT_ADDR_MASK); 406 write_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 407 } 408 409 static inline void read_nic_word(struct net_device *dev, u32 addr, u16 * val) 410 { 411 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 412 addr & IPW_REG_INDIRECT_ADDR_MASK); 413 read_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 414 } 415 416 static inline void write_nic_word(struct net_device *dev, u32 addr, u16 val) 417 { 418 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 419 addr & IPW_REG_INDIRECT_ADDR_MASK); 420 write_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 421 } 422 423 static inline void read_nic_byte(struct net_device *dev, u32 addr, u8 * val) 424 { 425 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 426 addr & IPW_REG_INDIRECT_ADDR_MASK); 427 read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 428 } 429 430 static inline void write_nic_byte(struct net_device *dev, u32 addr, u8 val) 431 { 432 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 433 addr & IPW_REG_INDIRECT_ADDR_MASK); 434 write_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 435 } 436 437 static inline void write_nic_auto_inc_address(struct net_device *dev, u32 addr) 438 { 439 write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, 440 addr & IPW_REG_INDIRECT_ADDR_MASK); 441 } 442 443 static inline void write_nic_dword_auto_inc(struct net_device *dev, u32 val) 444 { 445 write_register(dev, IPW_REG_AUTOINCREMENT_DATA, val); 446 } 447 448 static void write_nic_memory(struct net_device *dev, u32 addr, u32 len, 449 const u8 * buf) 450 { 451 u32 aligned_addr; 452 u32 aligned_len; 453 u32 dif_len; 454 u32 i; 455 456 /* read first nibble byte by byte */ 457 aligned_addr = addr & (~0x3); 458 dif_len = addr - aligned_addr; 459 if (dif_len) { 460 /* Start reading at aligned_addr + dif_len */ 461 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 462 aligned_addr); 463 for (i = dif_len; i < 4; i++, buf++) 464 write_register_byte(dev, 465 IPW_REG_INDIRECT_ACCESS_DATA + i, 466 *buf); 467 468 len -= dif_len; 469 aligned_addr += 4; 470 } 471 472 /* read DWs through autoincrement registers */ 473 write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr); 474 aligned_len = len & (~0x3); 475 for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) 476 write_register(dev, IPW_REG_AUTOINCREMENT_DATA, *(u32 *) buf); 477 478 /* copy the last nibble */ 479 dif_len = len - aligned_len; 480 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); 481 for (i = 0; i < dif_len; i++, buf++) 482 write_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, 483 *buf); 484 } 485 486 static void read_nic_memory(struct net_device *dev, u32 addr, u32 len, 487 u8 * buf) 488 { 489 u32 aligned_addr; 490 u32 aligned_len; 491 u32 dif_len; 492 u32 i; 493 494 /* read first nibble byte by byte */ 495 aligned_addr = addr & (~0x3); 496 dif_len = addr - aligned_addr; 497 if (dif_len) { 498 /* Start reading at aligned_addr + dif_len */ 499 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 500 aligned_addr); 501 for (i = dif_len; i < 4; i++, buf++) 502 read_register_byte(dev, 503 IPW_REG_INDIRECT_ACCESS_DATA + i, 504 buf); 505 506 len -= dif_len; 507 aligned_addr += 4; 508 } 509 510 /* read DWs through autoincrement registers */ 511 write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr); 512 aligned_len = len & (~0x3); 513 for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) 514 read_register(dev, IPW_REG_AUTOINCREMENT_DATA, (u32 *) buf); 515 516 /* copy the last nibble */ 517 dif_len = len - aligned_len; 518 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); 519 for (i = 0; i < dif_len; i++, buf++) 520 read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf); 521 } 522 523 static bool ipw2100_hw_is_adapter_in_system(struct net_device *dev) 524 { 525 u32 dbg; 526 527 read_register(dev, IPW_REG_DOA_DEBUG_AREA_START, &dbg); 528 529 return dbg == IPW_DATA_DOA_DEBUG_VALUE; 530 } 531 532 static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, 533 void *val, u32 * len) 534 { 535 struct ipw2100_ordinals *ordinals = &priv->ordinals; 536 u32 addr; 537 u32 field_info; 538 u16 field_len; 539 u16 field_count; 540 u32 total_length; 541 542 if (ordinals->table1_addr == 0) { 543 printk(KERN_WARNING DRV_NAME ": attempt to use fw ordinals " 544 "before they have been loaded.\n"); 545 return -EINVAL; 546 } 547 548 if (IS_ORDINAL_TABLE_ONE(ordinals, ord)) { 549 if (*len < IPW_ORD_TAB_1_ENTRY_SIZE) { 550 *len = IPW_ORD_TAB_1_ENTRY_SIZE; 551 552 printk(KERN_WARNING DRV_NAME 553 ": ordinal buffer length too small, need %zd\n", 554 IPW_ORD_TAB_1_ENTRY_SIZE); 555 556 return -EINVAL; 557 } 558 559 read_nic_dword(priv->net_dev, 560 ordinals->table1_addr + (ord << 2), &addr); 561 read_nic_dword(priv->net_dev, addr, val); 562 563 *len = IPW_ORD_TAB_1_ENTRY_SIZE; 564 565 return 0; 566 } 567 568 if (IS_ORDINAL_TABLE_TWO(ordinals, ord)) { 569 570 ord -= IPW_START_ORD_TAB_2; 571 572 /* get the address of statistic */ 573 read_nic_dword(priv->net_dev, 574 ordinals->table2_addr + (ord << 3), &addr); 575 576 /* get the second DW of statistics ; 577 * two 16-bit words - first is length, second is count */ 578 read_nic_dword(priv->net_dev, 579 ordinals->table2_addr + (ord << 3) + sizeof(u32), 580 &field_info); 581 582 /* get each entry length */ 583 field_len = *((u16 *) & field_info); 584 585 /* get number of entries */ 586 field_count = *(((u16 *) & field_info) + 1); 587 588 /* abort if no enough memory */ 589 total_length = field_len * field_count; 590 if (total_length > *len) { 591 *len = total_length; 592 return -EINVAL; 593 } 594 595 *len = total_length; 596 if (!total_length) 597 return 0; 598 599 /* read the ordinal data from the SRAM */ 600 read_nic_memory(priv->net_dev, addr, total_length, val); 601 602 return 0; 603 } 604 605 printk(KERN_WARNING DRV_NAME ": ordinal %d neither in table 1 nor " 606 "in table 2\n", ord); 607 608 return -EINVAL; 609 } 610 611 static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 * val, 612 u32 * len) 613 { 614 struct ipw2100_ordinals *ordinals = &priv->ordinals; 615 u32 addr; 616 617 if (IS_ORDINAL_TABLE_ONE(ordinals, ord)) { 618 if (*len != IPW_ORD_TAB_1_ENTRY_SIZE) { 619 *len = IPW_ORD_TAB_1_ENTRY_SIZE; 620 IPW_DEBUG_INFO("wrong size\n"); 621 return -EINVAL; 622 } 623 624 read_nic_dword(priv->net_dev, 625 ordinals->table1_addr + (ord << 2), &addr); 626 627 write_nic_dword(priv->net_dev, addr, *val); 628 629 *len = IPW_ORD_TAB_1_ENTRY_SIZE; 630 631 return 0; 632 } 633 634 IPW_DEBUG_INFO("wrong table\n"); 635 if (IS_ORDINAL_TABLE_TWO(ordinals, ord)) 636 return -EINVAL; 637 638 return -EINVAL; 639 } 640 641 static char *snprint_line(char *buf, size_t count, 642 const u8 * data, u32 len, u32 ofs) 643 { 644 int out, i, j, l; 645 char c; 646 647 out = snprintf(buf, count, "%08X", ofs); 648 649 for (l = 0, i = 0; i < 2; i++) { 650 out += snprintf(buf + out, count - out, " "); 651 for (j = 0; j < 8 && l < len; j++, l++) 652 out += snprintf(buf + out, count - out, "%02X ", 653 data[(i * 8 + j)]); 654 for (; j < 8; j++) 655 out += snprintf(buf + out, count - out, " "); 656 } 657 658 out += snprintf(buf + out, count - out, " "); 659 for (l = 0, i = 0; i < 2; i++) { 660 out += snprintf(buf + out, count - out, " "); 661 for (j = 0; j < 8 && l < len; j++, l++) { 662 c = data[(i * 8 + j)]; 663 if (!isascii(c) || !isprint(c)) 664 c = '.'; 665 666 out += snprintf(buf + out, count - out, "%c", c); 667 } 668 669 for (; j < 8; j++) 670 out += snprintf(buf + out, count - out, " "); 671 } 672 673 return buf; 674 } 675 676 static void printk_buf(int level, const u8 * data, u32 len) 677 { 678 char line[81]; 679 u32 ofs = 0; 680 if (!(ipw2100_debug_level & level)) 681 return; 682 683 while (len) { 684 printk(KERN_DEBUG "%s\n", 685 snprint_line(line, sizeof(line), &data[ofs], 686 min(len, 16U), ofs)); 687 ofs += 16; 688 len -= min(len, 16U); 689 } 690 } 691 692 #define MAX_RESET_BACKOFF 10 693 694 static void schedule_reset(struct ipw2100_priv *priv) 695 { 696 unsigned long now = get_seconds(); 697 698 /* If we haven't received a reset request within the backoff period, 699 * then we can reset the backoff interval so this reset occurs 700 * immediately */ 701 if (priv->reset_backoff && 702 (now - priv->last_reset > priv->reset_backoff)) 703 priv->reset_backoff = 0; 704 705 priv->last_reset = get_seconds(); 706 707 if (!(priv->status & STATUS_RESET_PENDING)) { 708 IPW_DEBUG_INFO("%s: Scheduling firmware restart (%ds).\n", 709 priv->net_dev->name, priv->reset_backoff); 710 netif_carrier_off(priv->net_dev); 711 netif_stop_queue(priv->net_dev); 712 priv->status |= STATUS_RESET_PENDING; 713 if (priv->reset_backoff) 714 schedule_delayed_work(&priv->reset_work, 715 priv->reset_backoff * HZ); 716 else 717 schedule_delayed_work(&priv->reset_work, 0); 718 719 if (priv->reset_backoff < MAX_RESET_BACKOFF) 720 priv->reset_backoff++; 721 722 wake_up_interruptible(&priv->wait_command_queue); 723 } else 724 IPW_DEBUG_INFO("%s: Firmware restart already in progress.\n", 725 priv->net_dev->name); 726 727 } 728 729 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 730 static int ipw2100_hw_send_command(struct ipw2100_priv *priv, 731 struct host_command *cmd) 732 { 733 struct list_head *element; 734 struct ipw2100_tx_packet *packet; 735 unsigned long flags; 736 int err = 0; 737 738 IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", 739 command_types[cmd->host_command], cmd->host_command, 740 cmd->host_command_length); 741 printk_buf(IPW_DL_HC, (u8 *) cmd->host_command_parameters, 742 cmd->host_command_length); 743 744 spin_lock_irqsave(&priv->low_lock, flags); 745 746 if (priv->fatal_error) { 747 IPW_DEBUG_INFO 748 ("Attempt to send command while hardware in fatal error condition.\n"); 749 err = -EIO; 750 goto fail_unlock; 751 } 752 753 if (!(priv->status & STATUS_RUNNING)) { 754 IPW_DEBUG_INFO 755 ("Attempt to send command while hardware is not running.\n"); 756 err = -EIO; 757 goto fail_unlock; 758 } 759 760 if (priv->status & STATUS_CMD_ACTIVE) { 761 IPW_DEBUG_INFO 762 ("Attempt to send command while another command is pending.\n"); 763 err = -EBUSY; 764 goto fail_unlock; 765 } 766 767 if (list_empty(&priv->msg_free_list)) { 768 IPW_DEBUG_INFO("no available msg buffers\n"); 769 goto fail_unlock; 770 } 771 772 priv->status |= STATUS_CMD_ACTIVE; 773 priv->messages_sent++; 774 775 element = priv->msg_free_list.next; 776 777 packet = list_entry(element, struct ipw2100_tx_packet, list); 778 packet->jiffy_start = jiffies; 779 780 /* initialize the firmware command packet */ 781 packet->info.c_struct.cmd->host_command_reg = cmd->host_command; 782 packet->info.c_struct.cmd->host_command_reg1 = cmd->host_command1; 783 packet->info.c_struct.cmd->host_command_len_reg = 784 cmd->host_command_length; 785 packet->info.c_struct.cmd->sequence = cmd->host_command_sequence; 786 787 memcpy(packet->info.c_struct.cmd->host_command_params_reg, 788 cmd->host_command_parameters, 789 sizeof(packet->info.c_struct.cmd->host_command_params_reg)); 790 791 list_del(element); 792 DEC_STAT(&priv->msg_free_stat); 793 794 list_add_tail(element, &priv->msg_pend_list); 795 INC_STAT(&priv->msg_pend_stat); 796 797 ipw2100_tx_send_commands(priv); 798 ipw2100_tx_send_data(priv); 799 800 spin_unlock_irqrestore(&priv->low_lock, flags); 801 802 /* 803 * We must wait for this command to complete before another 804 * command can be sent... but if we wait more than 3 seconds 805 * then there is a problem. 806 */ 807 808 err = 809 wait_event_interruptible_timeout(priv->wait_command_queue, 810 !(priv-> 811 status & STATUS_CMD_ACTIVE), 812 HOST_COMPLETE_TIMEOUT); 813 814 if (err == 0) { 815 IPW_DEBUG_INFO("Command completion failed out after %dms.\n", 816 1000 * (HOST_COMPLETE_TIMEOUT / HZ)); 817 priv->fatal_error = IPW2100_ERR_MSG_TIMEOUT; 818 priv->status &= ~STATUS_CMD_ACTIVE; 819 schedule_reset(priv); 820 return -EIO; 821 } 822 823 if (priv->fatal_error) { 824 printk(KERN_WARNING DRV_NAME ": %s: firmware fatal error\n", 825 priv->net_dev->name); 826 return -EIO; 827 } 828 829 /* !!!!! HACK TEST !!!!! 830 * When lots of debug trace statements are enabled, the driver 831 * doesn't seem to have as many firmware restart cycles... 832 * 833 * As a test, we're sticking in a 1/100s delay here */ 834 schedule_timeout_uninterruptible(msecs_to_jiffies(10)); 835 836 return 0; 837 838 fail_unlock: 839 spin_unlock_irqrestore(&priv->low_lock, flags); 840 841 return err; 842 } 843 844 /* 845 * Verify the values and data access of the hardware 846 * No locks needed or used. No functions called. 847 */ 848 static int ipw2100_verify(struct ipw2100_priv *priv) 849 { 850 u32 data1, data2; 851 u32 address; 852 853 u32 val1 = 0x76543210; 854 u32 val2 = 0xFEDCBA98; 855 856 /* Domain 0 check - all values should be DOA_DEBUG */ 857 for (address = IPW_REG_DOA_DEBUG_AREA_START; 858 address < IPW_REG_DOA_DEBUG_AREA_END; address += sizeof(u32)) { 859 read_register(priv->net_dev, address, &data1); 860 if (data1 != IPW_DATA_DOA_DEBUG_VALUE) 861 return -EIO; 862 } 863 864 /* Domain 1 check - use arbitrary read/write compare */ 865 for (address = 0; address < 5; address++) { 866 /* The memory area is not used now */ 867 write_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x32, 868 val1); 869 write_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x36, 870 val2); 871 read_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x32, 872 &data1); 873 read_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x36, 874 &data2); 875 if (val1 == data1 && val2 == data2) 876 return 0; 877 } 878 879 return -EIO; 880 } 881 882 /* 883 * 884 * Loop until the CARD_DISABLED bit is the same value as the 885 * supplied parameter 886 * 887 * TODO: See if it would be more efficient to do a wait/wake 888 * cycle and have the completion event trigger the wakeup 889 * 890 */ 891 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 // 100 milli 892 static int ipw2100_wait_for_card_state(struct ipw2100_priv *priv, int state) 893 { 894 int i; 895 u32 card_state; 896 u32 len = sizeof(card_state); 897 int err; 898 899 for (i = 0; i <= IPW_CARD_DISABLE_COMPLETE_WAIT * 1000; i += 50) { 900 err = ipw2100_get_ordinal(priv, IPW_ORD_CARD_DISABLED, 901 &card_state, &len); 902 if (err) { 903 IPW_DEBUG_INFO("Query of CARD_DISABLED ordinal " 904 "failed.\n"); 905 return 0; 906 } 907 908 /* We'll break out if either the HW state says it is 909 * in the state we want, or if HOST_COMPLETE command 910 * finishes */ 911 if ((card_state == state) || 912 ((priv->status & STATUS_ENABLED) ? 913 IPW_HW_STATE_ENABLED : IPW_HW_STATE_DISABLED) == state) { 914 if (state == IPW_HW_STATE_ENABLED) 915 priv->status |= STATUS_ENABLED; 916 else 917 priv->status &= ~STATUS_ENABLED; 918 919 return 0; 920 } 921 922 udelay(50); 923 } 924 925 IPW_DEBUG_INFO("ipw2100_wait_for_card_state to %s state timed out\n", 926 state ? "DISABLED" : "ENABLED"); 927 return -EIO; 928 } 929 930 /********************************************************************* 931 Procedure : sw_reset_and_clock 932 Purpose : Asserts s/w reset, asserts clock initialization 933 and waits for clock stabilization 934 ********************************************************************/ 935 static int sw_reset_and_clock(struct ipw2100_priv *priv) 936 { 937 int i; 938 u32 r; 939 940 // assert s/w reset 941 write_register(priv->net_dev, IPW_REG_RESET_REG, 942 IPW_AUX_HOST_RESET_REG_SW_RESET); 943 944 // wait for clock stabilization 945 for (i = 0; i < 1000; i++) { 946 udelay(IPW_WAIT_RESET_ARC_COMPLETE_DELAY); 947 948 // check clock ready bit 949 read_register(priv->net_dev, IPW_REG_RESET_REG, &r); 950 if (r & IPW_AUX_HOST_RESET_REG_PRINCETON_RESET) 951 break; 952 } 953 954 if (i == 1000) 955 return -EIO; // TODO: better error value 956 957 /* set "initialization complete" bit to move adapter to 958 * D0 state */ 959 write_register(priv->net_dev, IPW_REG_GP_CNTRL, 960 IPW_AUX_HOST_GP_CNTRL_BIT_INIT_DONE); 961 962 /* wait for clock stabilization */ 963 for (i = 0; i < 10000; i++) { 964 udelay(IPW_WAIT_CLOCK_STABILIZATION_DELAY * 4); 965 966 /* check clock ready bit */ 967 read_register(priv->net_dev, IPW_REG_GP_CNTRL, &r); 968 if (r & IPW_AUX_HOST_GP_CNTRL_BIT_CLOCK_READY) 969 break; 970 } 971 972 if (i == 10000) 973 return -EIO; /* TODO: better error value */ 974 975 /* set D0 standby bit */ 976 read_register(priv->net_dev, IPW_REG_GP_CNTRL, &r); 977 write_register(priv->net_dev, IPW_REG_GP_CNTRL, 978 r | IPW_AUX_HOST_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); 979 980 return 0; 981 } 982 983 /********************************************************************* 984 Procedure : ipw2100_download_firmware 985 Purpose : Initiaze adapter after power on. 986 The sequence is: 987 1. assert s/w reset first! 988 2. awake clocks & wait for clock stabilization 989 3. hold ARC (don't ask me why...) 990 4. load Dino ucode and reset/clock init again 991 5. zero-out shared mem 992 6. download f/w 993 *******************************************************************/ 994 static int ipw2100_download_firmware(struct ipw2100_priv *priv) 995 { 996 u32 address; 997 int err; 998 999 #ifndef CONFIG_PM 1000 /* Fetch the firmware and microcode */ 1001 struct ipw2100_fw ipw2100_firmware; 1002 #endif 1003 1004 if (priv->fatal_error) { 1005 IPW_DEBUG_ERROR("%s: ipw2100_download_firmware called after " 1006 "fatal error %d. Interface must be brought down.\n", 1007 priv->net_dev->name, priv->fatal_error); 1008 return -EINVAL; 1009 } 1010 #ifdef CONFIG_PM 1011 if (!ipw2100_firmware.version) { 1012 err = ipw2100_get_firmware(priv, &ipw2100_firmware); 1013 if (err) { 1014 IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", 1015 priv->net_dev->name, err); 1016 priv->fatal_error = IPW2100_ERR_FW_LOAD; 1017 goto fail; 1018 } 1019 } 1020 #else 1021 err = ipw2100_get_firmware(priv, &ipw2100_firmware); 1022 if (err) { 1023 IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", 1024 priv->net_dev->name, err); 1025 priv->fatal_error = IPW2100_ERR_FW_LOAD; 1026 goto fail; 1027 } 1028 #endif 1029 priv->firmware_version = ipw2100_firmware.version; 1030 1031 /* s/w reset and clock stabilization */ 1032 err = sw_reset_and_clock(priv); 1033 if (err) { 1034 IPW_DEBUG_ERROR("%s: sw_reset_and_clock failed: %d\n", 1035 priv->net_dev->name, err); 1036 goto fail; 1037 } 1038 1039 err = ipw2100_verify(priv); 1040 if (err) { 1041 IPW_DEBUG_ERROR("%s: ipw2100_verify failed: %d\n", 1042 priv->net_dev->name, err); 1043 goto fail; 1044 } 1045 1046 /* Hold ARC */ 1047 write_nic_dword(priv->net_dev, 1048 IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x80000000); 1049 1050 /* allow ARC to run */ 1051 write_register(priv->net_dev, IPW_REG_RESET_REG, 0); 1052 1053 /* load microcode */ 1054 err = ipw2100_ucode_download(priv, &ipw2100_firmware); 1055 if (err) { 1056 printk(KERN_ERR DRV_NAME ": %s: Error loading microcode: %d\n", 1057 priv->net_dev->name, err); 1058 goto fail; 1059 } 1060 1061 /* release ARC */ 1062 write_nic_dword(priv->net_dev, 1063 IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x00000000); 1064 1065 /* s/w reset and clock stabilization (again!!!) */ 1066 err = sw_reset_and_clock(priv); 1067 if (err) { 1068 printk(KERN_ERR DRV_NAME 1069 ": %s: sw_reset_and_clock failed: %d\n", 1070 priv->net_dev->name, err); 1071 goto fail; 1072 } 1073 1074 /* load f/w */ 1075 err = ipw2100_fw_download(priv, &ipw2100_firmware); 1076 if (err) { 1077 IPW_DEBUG_ERROR("%s: Error loading firmware: %d\n", 1078 priv->net_dev->name, err); 1079 goto fail; 1080 } 1081 #ifndef CONFIG_PM 1082 /* 1083 * When the .resume method of the driver is called, the other 1084 * part of the system, i.e. the ide driver could still stay in 1085 * the suspend stage. This prevents us from loading the firmware 1086 * from the disk. --YZ 1087 */ 1088 1089 /* free any storage allocated for firmware image */ 1090 ipw2100_release_firmware(priv, &ipw2100_firmware); 1091 #endif 1092 1093 /* zero out Domain 1 area indirectly (Si requirement) */ 1094 for (address = IPW_HOST_FW_SHARED_AREA0; 1095 address < IPW_HOST_FW_SHARED_AREA0_END; address += 4) 1096 write_nic_dword(priv->net_dev, address, 0); 1097 for (address = IPW_HOST_FW_SHARED_AREA1; 1098 address < IPW_HOST_FW_SHARED_AREA1_END; address += 4) 1099 write_nic_dword(priv->net_dev, address, 0); 1100 for (address = IPW_HOST_FW_SHARED_AREA2; 1101 address < IPW_HOST_FW_SHARED_AREA2_END; address += 4) 1102 write_nic_dword(priv->net_dev, address, 0); 1103 for (address = IPW_HOST_FW_SHARED_AREA3; 1104 address < IPW_HOST_FW_SHARED_AREA3_END; address += 4) 1105 write_nic_dword(priv->net_dev, address, 0); 1106 for (address = IPW_HOST_FW_INTERRUPT_AREA; 1107 address < IPW_HOST_FW_INTERRUPT_AREA_END; address += 4) 1108 write_nic_dword(priv->net_dev, address, 0); 1109 1110 return 0; 1111 1112 fail: 1113 ipw2100_release_firmware(priv, &ipw2100_firmware); 1114 return err; 1115 } 1116 1117 static inline void ipw2100_enable_interrupts(struct ipw2100_priv *priv) 1118 { 1119 if (priv->status & STATUS_INT_ENABLED) 1120 return; 1121 priv->status |= STATUS_INT_ENABLED; 1122 write_register(priv->net_dev, IPW_REG_INTA_MASK, IPW_INTERRUPT_MASK); 1123 } 1124 1125 static inline void ipw2100_disable_interrupts(struct ipw2100_priv *priv) 1126 { 1127 if (!(priv->status & STATUS_INT_ENABLED)) 1128 return; 1129 priv->status &= ~STATUS_INT_ENABLED; 1130 write_register(priv->net_dev, IPW_REG_INTA_MASK, 0x0); 1131 } 1132 1133 static void ipw2100_initialize_ordinals(struct ipw2100_priv *priv) 1134 { 1135 struct ipw2100_ordinals *ord = &priv->ordinals; 1136 1137 IPW_DEBUG_INFO("enter\n"); 1138 1139 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_ORDINALS_TABLE_1, 1140 &ord->table1_addr); 1141 1142 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_ORDINALS_TABLE_2, 1143 &ord->table2_addr); 1144 1145 read_nic_dword(priv->net_dev, ord->table1_addr, &ord->table1_size); 1146 read_nic_dword(priv->net_dev, ord->table2_addr, &ord->table2_size); 1147 1148 ord->table2_size &= 0x0000FFFF; 1149 1150 IPW_DEBUG_INFO("table 1 size: %d\n", ord->table1_size); 1151 IPW_DEBUG_INFO("table 2 size: %d\n", ord->table2_size); 1152 IPW_DEBUG_INFO("exit\n"); 1153 } 1154 1155 static inline void ipw2100_hw_set_gpio(struct ipw2100_priv *priv) 1156 { 1157 u32 reg = 0; 1158 /* 1159 * Set GPIO 3 writable by FW; GPIO 1 writable 1160 * by driver and enable clock 1161 */ 1162 reg = (IPW_BIT_GPIO_GPIO3_MASK | IPW_BIT_GPIO_GPIO1_ENABLE | 1163 IPW_BIT_GPIO_LED_OFF); 1164 write_register(priv->net_dev, IPW_REG_GPIO, reg); 1165 } 1166 1167 static int rf_kill_active(struct ipw2100_priv *priv) 1168 { 1169 #define MAX_RF_KILL_CHECKS 5 1170 #define RF_KILL_CHECK_DELAY 40 1171 1172 unsigned short value = 0; 1173 u32 reg = 0; 1174 int i; 1175 1176 if (!(priv->hw_features & HW_FEATURE_RFKILL)) { 1177 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, false); 1178 priv->status &= ~STATUS_RF_KILL_HW; 1179 return 0; 1180 } 1181 1182 for (i = 0; i < MAX_RF_KILL_CHECKS; i++) { 1183 udelay(RF_KILL_CHECK_DELAY); 1184 read_register(priv->net_dev, IPW_REG_GPIO, &reg); 1185 value = (value << 1) | ((reg & IPW_BIT_GPIO_RF_KILL) ? 0 : 1); 1186 } 1187 1188 if (value == 0) { 1189 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, true); 1190 priv->status |= STATUS_RF_KILL_HW; 1191 } else { 1192 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, false); 1193 priv->status &= ~STATUS_RF_KILL_HW; 1194 } 1195 1196 return (value == 0); 1197 } 1198 1199 static int ipw2100_get_hw_features(struct ipw2100_priv *priv) 1200 { 1201 u32 addr, len; 1202 u32 val; 1203 1204 /* 1205 * EEPROM_SRAM_DB_START_ADDRESS using ordinal in ordinal table 1 1206 */ 1207 len = sizeof(addr); 1208 if (ipw2100_get_ordinal 1209 (priv, IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, &addr, &len)) { 1210 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 1211 __LINE__); 1212 return -EIO; 1213 } 1214 1215 IPW_DEBUG_INFO("EEPROM address: %08X\n", addr); 1216 1217 /* 1218 * EEPROM version is the byte at offset 0xfd in firmware 1219 * We read 4 bytes, then shift out the byte we actually want */ 1220 read_nic_dword(priv->net_dev, addr + 0xFC, &val); 1221 priv->eeprom_version = (val >> 24) & 0xFF; 1222 IPW_DEBUG_INFO("EEPROM version: %d\n", priv->eeprom_version); 1223 1224 /* 1225 * HW RF Kill enable is bit 0 in byte at offset 0x21 in firmware 1226 * 1227 * notice that the EEPROM bit is reverse polarity, i.e. 1228 * bit = 0 signifies HW RF kill switch is supported 1229 * bit = 1 signifies HW RF kill switch is NOT supported 1230 */ 1231 read_nic_dword(priv->net_dev, addr + 0x20, &val); 1232 if (!((val >> 24) & 0x01)) 1233 priv->hw_features |= HW_FEATURE_RFKILL; 1234 1235 IPW_DEBUG_INFO("HW RF Kill: %ssupported.\n", 1236 (priv->hw_features & HW_FEATURE_RFKILL) ? "" : "not "); 1237 1238 return 0; 1239 } 1240 1241 /* 1242 * Start firmware execution after power on and intialization 1243 * The sequence is: 1244 * 1. Release ARC 1245 * 2. Wait for f/w initialization completes; 1246 */ 1247 static int ipw2100_start_adapter(struct ipw2100_priv *priv) 1248 { 1249 int i; 1250 u32 inta, inta_mask, gpio; 1251 1252 IPW_DEBUG_INFO("enter\n"); 1253 1254 if (priv->status & STATUS_RUNNING) 1255 return 0; 1256 1257 /* 1258 * Initialize the hw - drive adapter to DO state by setting 1259 * init_done bit. Wait for clk_ready bit and Download 1260 * fw & dino ucode 1261 */ 1262 if (ipw2100_download_firmware(priv)) { 1263 printk(KERN_ERR DRV_NAME 1264 ": %s: Failed to power on the adapter.\n", 1265 priv->net_dev->name); 1266 return -EIO; 1267 } 1268 1269 /* Clear the Tx, Rx and Msg queues and the r/w indexes 1270 * in the firmware RBD and TBD ring queue */ 1271 ipw2100_queues_initialize(priv); 1272 1273 ipw2100_hw_set_gpio(priv); 1274 1275 /* TODO -- Look at disabling interrupts here to make sure none 1276 * get fired during FW initialization */ 1277 1278 /* Release ARC - clear reset bit */ 1279 write_register(priv->net_dev, IPW_REG_RESET_REG, 0); 1280 1281 /* wait for f/w intialization complete */ 1282 IPW_DEBUG_FW("Waiting for f/w initialization to complete...\n"); 1283 i = 5000; 1284 do { 1285 schedule_timeout_uninterruptible(msecs_to_jiffies(40)); 1286 /* Todo... wait for sync command ... */ 1287 1288 read_register(priv->net_dev, IPW_REG_INTA, &inta); 1289 1290 /* check "init done" bit */ 1291 if (inta & IPW2100_INTA_FW_INIT_DONE) { 1292 /* reset "init done" bit */ 1293 write_register(priv->net_dev, IPW_REG_INTA, 1294 IPW2100_INTA_FW_INIT_DONE); 1295 break; 1296 } 1297 1298 /* check error conditions : we check these after the firmware 1299 * check so that if there is an error, the interrupt handler 1300 * will see it and the adapter will be reset */ 1301 if (inta & 1302 (IPW2100_INTA_FATAL_ERROR | IPW2100_INTA_PARITY_ERROR)) { 1303 /* clear error conditions */ 1304 write_register(priv->net_dev, IPW_REG_INTA, 1305 IPW2100_INTA_FATAL_ERROR | 1306 IPW2100_INTA_PARITY_ERROR); 1307 } 1308 } while (--i); 1309 1310 /* Clear out any pending INTAs since we aren't supposed to have 1311 * interrupts enabled at this point... */ 1312 read_register(priv->net_dev, IPW_REG_INTA, &inta); 1313 read_register(priv->net_dev, IPW_REG_INTA_MASK, &inta_mask); 1314 inta &= IPW_INTERRUPT_MASK; 1315 /* Clear out any pending interrupts */ 1316 if (inta & inta_mask) 1317 write_register(priv->net_dev, IPW_REG_INTA, inta); 1318 1319 IPW_DEBUG_FW("f/w initialization complete: %s\n", 1320 i ? "SUCCESS" : "FAILED"); 1321 1322 if (!i) { 1323 printk(KERN_WARNING DRV_NAME 1324 ": %s: Firmware did not initialize.\n", 1325 priv->net_dev->name); 1326 return -EIO; 1327 } 1328 1329 /* allow firmware to write to GPIO1 & GPIO3 */ 1330 read_register(priv->net_dev, IPW_REG_GPIO, &gpio); 1331 1332 gpio |= (IPW_BIT_GPIO_GPIO1_MASK | IPW_BIT_GPIO_GPIO3_MASK); 1333 1334 write_register(priv->net_dev, IPW_REG_GPIO, gpio); 1335 1336 /* Ready to receive commands */ 1337 priv->status |= STATUS_RUNNING; 1338 1339 /* The adapter has been reset; we are not associated */ 1340 priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED); 1341 1342 IPW_DEBUG_INFO("exit\n"); 1343 1344 return 0; 1345 } 1346 1347 static inline void ipw2100_reset_fatalerror(struct ipw2100_priv *priv) 1348 { 1349 if (!priv->fatal_error) 1350 return; 1351 1352 priv->fatal_errors[priv->fatal_index++] = priv->fatal_error; 1353 priv->fatal_index %= IPW2100_ERROR_QUEUE; 1354 priv->fatal_error = 0; 1355 } 1356 1357 /* NOTE: Our interrupt is disabled when this method is called */ 1358 static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) 1359 { 1360 u32 reg; 1361 int i; 1362 1363 IPW_DEBUG_INFO("Power cycling the hardware.\n"); 1364 1365 ipw2100_hw_set_gpio(priv); 1366 1367 /* Step 1. Stop Master Assert */ 1368 write_register(priv->net_dev, IPW_REG_RESET_REG, 1369 IPW_AUX_HOST_RESET_REG_STOP_MASTER); 1370 1371 /* Step 2. Wait for stop Master Assert 1372 * (not more than 50us, otherwise ret error */ 1373 i = 5; 1374 do { 1375 udelay(IPW_WAIT_RESET_MASTER_ASSERT_COMPLETE_DELAY); 1376 read_register(priv->net_dev, IPW_REG_RESET_REG, &reg); 1377 1378 if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) 1379 break; 1380 } while (--i); 1381 1382 priv->status &= ~STATUS_RESET_PENDING; 1383 1384 if (!i) { 1385 IPW_DEBUG_INFO 1386 ("exit - waited too long for master assert stop\n"); 1387 return -EIO; 1388 } 1389 1390 write_register(priv->net_dev, IPW_REG_RESET_REG, 1391 IPW_AUX_HOST_RESET_REG_SW_RESET); 1392 1393 /* Reset any fatal_error conditions */ 1394 ipw2100_reset_fatalerror(priv); 1395 1396 /* At this point, the adapter is now stopped and disabled */ 1397 priv->status &= ~(STATUS_RUNNING | STATUS_ASSOCIATING | 1398 STATUS_ASSOCIATED | STATUS_ENABLED); 1399 1400 return 0; 1401 } 1402 1403 /* 1404 * Send the CARD_DISABLE_PHY_OFF command to the card to disable it 1405 * 1406 * After disabling, if the card was associated, a STATUS_ASSN_LOST will be sent. 1407 * 1408 * STATUS_CARD_DISABLE_NOTIFICATION will be sent regardless of 1409 * if STATUS_ASSN_LOST is sent. 1410 */ 1411 static int ipw2100_hw_phy_off(struct ipw2100_priv *priv) 1412 { 1413 1414 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 1415 1416 struct host_command cmd = { 1417 .host_command = CARD_DISABLE_PHY_OFF, 1418 .host_command_sequence = 0, 1419 .host_command_length = 0, 1420 }; 1421 int err, i; 1422 u32 val1, val2; 1423 1424 IPW_DEBUG_HC("CARD_DISABLE_PHY_OFF\n"); 1425 1426 /* Turn off the radio */ 1427 err = ipw2100_hw_send_command(priv, &cmd); 1428 if (err) 1429 return err; 1430 1431 for (i = 0; i < 2500; i++) { 1432 read_nic_dword(priv->net_dev, IPW2100_CONTROL_REG, &val1); 1433 read_nic_dword(priv->net_dev, IPW2100_COMMAND, &val2); 1434 1435 if ((val1 & IPW2100_CONTROL_PHY_OFF) && 1436 (val2 & IPW2100_COMMAND_PHY_OFF)) 1437 return 0; 1438 1439 schedule_timeout_uninterruptible(HW_PHY_OFF_LOOP_DELAY); 1440 } 1441 1442 return -EIO; 1443 } 1444 1445 static int ipw2100_enable_adapter(struct ipw2100_priv *priv) 1446 { 1447 struct host_command cmd = { 1448 .host_command = HOST_COMPLETE, 1449 .host_command_sequence = 0, 1450 .host_command_length = 0 1451 }; 1452 int err = 0; 1453 1454 IPW_DEBUG_HC("HOST_COMPLETE\n"); 1455 1456 if (priv->status & STATUS_ENABLED) 1457 return 0; 1458 1459 mutex_lock(&priv->adapter_mutex); 1460 1461 if (rf_kill_active(priv)) { 1462 IPW_DEBUG_HC("Command aborted due to RF kill active.\n"); 1463 goto fail_up; 1464 } 1465 1466 err = ipw2100_hw_send_command(priv, &cmd); 1467 if (err) { 1468 IPW_DEBUG_INFO("Failed to send HOST_COMPLETE command\n"); 1469 goto fail_up; 1470 } 1471 1472 err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_ENABLED); 1473 if (err) { 1474 IPW_DEBUG_INFO("%s: card not responding to init command.\n", 1475 priv->net_dev->name); 1476 goto fail_up; 1477 } 1478 1479 if (priv->stop_hang_check) { 1480 priv->stop_hang_check = 0; 1481 schedule_delayed_work(&priv->hang_check, HZ / 2); 1482 } 1483 1484 fail_up: 1485 mutex_unlock(&priv->adapter_mutex); 1486 return err; 1487 } 1488 1489 static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) 1490 { 1491 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 1492 1493 struct host_command cmd = { 1494 .host_command = HOST_PRE_POWER_DOWN, 1495 .host_command_sequence = 0, 1496 .host_command_length = 0, 1497 }; 1498 int err, i; 1499 u32 reg; 1500 1501 if (!(priv->status & STATUS_RUNNING)) 1502 return 0; 1503 1504 priv->status |= STATUS_STOPPING; 1505 1506 /* We can only shut down the card if the firmware is operational. So, 1507 * if we haven't reset since a fatal_error, then we can not send the 1508 * shutdown commands. */ 1509 if (!priv->fatal_error) { 1510 /* First, make sure the adapter is enabled so that the PHY_OFF 1511 * command can shut it down */ 1512 ipw2100_enable_adapter(priv); 1513 1514 err = ipw2100_hw_phy_off(priv); 1515 if (err) 1516 printk(KERN_WARNING DRV_NAME 1517 ": Error disabling radio %d\n", err); 1518 1519 /* 1520 * If in D0-standby mode going directly to D3 may cause a 1521 * PCI bus violation. Therefore we must change out of the D0 1522 * state. 1523 * 1524 * Sending the PREPARE_FOR_POWER_DOWN will restrict the 1525 * hardware from going into standby mode and will transition 1526 * out of D0-standby if it is already in that state. 1527 * 1528 * STATUS_PREPARE_POWER_DOWN_COMPLETE will be sent by the 1529 * driver upon completion. Once received, the driver can 1530 * proceed to the D3 state. 1531 * 1532 * Prepare for power down command to fw. This command would 1533 * take HW out of D0-standby and prepare it for D3 state. 1534 * 1535 * Currently FW does not support event notification for this 1536 * event. Therefore, skip waiting for it. Just wait a fixed 1537 * 100ms 1538 */ 1539 IPW_DEBUG_HC("HOST_PRE_POWER_DOWN\n"); 1540 1541 err = ipw2100_hw_send_command(priv, &cmd); 1542 if (err) 1543 printk(KERN_WARNING DRV_NAME ": " 1544 "%s: Power down command failed: Error %d\n", 1545 priv->net_dev->name, err); 1546 else 1547 schedule_timeout_uninterruptible(HW_POWER_DOWN_DELAY); 1548 } 1549 1550 priv->status &= ~STATUS_ENABLED; 1551 1552 /* 1553 * Set GPIO 3 writable by FW; GPIO 1 writable 1554 * by driver and enable clock 1555 */ 1556 ipw2100_hw_set_gpio(priv); 1557 1558 /* 1559 * Power down adapter. Sequence: 1560 * 1. Stop master assert (RESET_REG[9]=1) 1561 * 2. Wait for stop master (RESET_REG[8]==1) 1562 * 3. S/w reset assert (RESET_REG[7] = 1) 1563 */ 1564 1565 /* Stop master assert */ 1566 write_register(priv->net_dev, IPW_REG_RESET_REG, 1567 IPW_AUX_HOST_RESET_REG_STOP_MASTER); 1568 1569 /* wait stop master not more than 50 usec. 1570 * Otherwise return error. */ 1571 for (i = 5; i > 0; i--) { 1572 udelay(10); 1573 1574 /* Check master stop bit */ 1575 read_register(priv->net_dev, IPW_REG_RESET_REG, &reg); 1576 1577 if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) 1578 break; 1579 } 1580 1581 if (i == 0) 1582 printk(KERN_WARNING DRV_NAME 1583 ": %s: Could now power down adapter.\n", 1584 priv->net_dev->name); 1585 1586 /* assert s/w reset */ 1587 write_register(priv->net_dev, IPW_REG_RESET_REG, 1588 IPW_AUX_HOST_RESET_REG_SW_RESET); 1589 1590 priv->status &= ~(STATUS_RUNNING | STATUS_STOPPING); 1591 1592 return 0; 1593 } 1594 1595 static int ipw2100_disable_adapter(struct ipw2100_priv *priv) 1596 { 1597 struct host_command cmd = { 1598 .host_command = CARD_DISABLE, 1599 .host_command_sequence = 0, 1600 .host_command_length = 0 1601 }; 1602 int err = 0; 1603 1604 IPW_DEBUG_HC("CARD_DISABLE\n"); 1605 1606 if (!(priv->status & STATUS_ENABLED)) 1607 return 0; 1608 1609 /* Make sure we clear the associated state */ 1610 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); 1611 1612 if (!priv->stop_hang_check) { 1613 priv->stop_hang_check = 1; 1614 cancel_delayed_work(&priv->hang_check); 1615 } 1616 1617 mutex_lock(&priv->adapter_mutex); 1618 1619 err = ipw2100_hw_send_command(priv, &cmd); 1620 if (err) { 1621 printk(KERN_WARNING DRV_NAME 1622 ": exit - failed to send CARD_DISABLE command\n"); 1623 goto fail_up; 1624 } 1625 1626 err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_DISABLED); 1627 if (err) { 1628 printk(KERN_WARNING DRV_NAME 1629 ": exit - card failed to change to DISABLED\n"); 1630 goto fail_up; 1631 } 1632 1633 IPW_DEBUG_INFO("TODO: implement scan state machine\n"); 1634 1635 fail_up: 1636 mutex_unlock(&priv->adapter_mutex); 1637 return err; 1638 } 1639 1640 static int ipw2100_set_scan_options(struct ipw2100_priv *priv) 1641 { 1642 struct host_command cmd = { 1643 .host_command = SET_SCAN_OPTIONS, 1644 .host_command_sequence = 0, 1645 .host_command_length = 8 1646 }; 1647 int err; 1648 1649 IPW_DEBUG_INFO("enter\n"); 1650 1651 IPW_DEBUG_SCAN("setting scan options\n"); 1652 1653 cmd.host_command_parameters[0] = 0; 1654 1655 if (!(priv->config & CFG_ASSOCIATE)) 1656 cmd.host_command_parameters[0] |= IPW_SCAN_NOASSOCIATE; 1657 if ((priv->ieee->sec.flags & SEC_ENABLED) && priv->ieee->sec.enabled) 1658 cmd.host_command_parameters[0] |= IPW_SCAN_MIXED_CELL; 1659 if (priv->config & CFG_PASSIVE_SCAN) 1660 cmd.host_command_parameters[0] |= IPW_SCAN_PASSIVE; 1661 1662 cmd.host_command_parameters[1] = priv->channel_mask; 1663 1664 err = ipw2100_hw_send_command(priv, &cmd); 1665 1666 IPW_DEBUG_HC("SET_SCAN_OPTIONS 0x%04X\n", 1667 cmd.host_command_parameters[0]); 1668 1669 return err; 1670 } 1671 1672 static int ipw2100_start_scan(struct ipw2100_priv *priv) 1673 { 1674 struct host_command cmd = { 1675 .host_command = BROADCAST_SCAN, 1676 .host_command_sequence = 0, 1677 .host_command_length = 4 1678 }; 1679 int err; 1680 1681 IPW_DEBUG_HC("START_SCAN\n"); 1682 1683 cmd.host_command_parameters[0] = 0; 1684 1685 /* No scanning if in monitor mode */ 1686 if (priv->ieee->iw_mode == IW_MODE_MONITOR) 1687 return 1; 1688 1689 if (priv->status & STATUS_SCANNING) { 1690 IPW_DEBUG_SCAN("Scan requested while already in scan...\n"); 1691 return 0; 1692 } 1693 1694 IPW_DEBUG_INFO("enter\n"); 1695 1696 /* Not clearing here; doing so makes iwlist always return nothing... 1697 * 1698 * We should modify the table logic to use aging tables vs. clearing 1699 * the table on each scan start. 1700 */ 1701 IPW_DEBUG_SCAN("starting scan\n"); 1702 1703 priv->status |= STATUS_SCANNING; 1704 err = ipw2100_hw_send_command(priv, &cmd); 1705 if (err) 1706 priv->status &= ~STATUS_SCANNING; 1707 1708 IPW_DEBUG_INFO("exit\n"); 1709 1710 return err; 1711 } 1712 1713 static const struct libipw_geo ipw_geos[] = { 1714 { /* Restricted */ 1715 "---", 1716 .bg_channels = 14, 1717 .bg = {{2412, 1}, {2417, 2}, {2422, 3}, 1718 {2427, 4}, {2432, 5}, {2437, 6}, 1719 {2442, 7}, {2447, 8}, {2452, 9}, 1720 {2457, 10}, {2462, 11}, {2467, 12}, 1721 {2472, 13}, {2484, 14}}, 1722 }, 1723 }; 1724 1725 static int ipw2100_up(struct ipw2100_priv *priv, int deferred) 1726 { 1727 unsigned long flags; 1728 int rc = 0; 1729 u32 lock; 1730 u32 ord_len = sizeof(lock); 1731 1732 /* Age scan list entries found before suspend */ 1733 if (priv->suspend_time) { 1734 libipw_networks_age(priv->ieee, priv->suspend_time); 1735 priv->suspend_time = 0; 1736 } 1737 1738 /* Quiet if manually disabled. */ 1739 if (priv->status & STATUS_RF_KILL_SW) { 1740 IPW_DEBUG_INFO("%s: Radio is disabled by Manual Disable " 1741 "switch\n", priv->net_dev->name); 1742 return 0; 1743 } 1744 1745 /* the ipw2100 hardware really doesn't want power management delays 1746 * longer than 175usec 1747 */ 1748 pm_qos_update_request(&ipw2100_pm_qos_req, 175); 1749 1750 /* If the interrupt is enabled, turn it off... */ 1751 spin_lock_irqsave(&priv->low_lock, flags); 1752 ipw2100_disable_interrupts(priv); 1753 1754 /* Reset any fatal_error conditions */ 1755 ipw2100_reset_fatalerror(priv); 1756 spin_unlock_irqrestore(&priv->low_lock, flags); 1757 1758 if (priv->status & STATUS_POWERED || 1759 (priv->status & STATUS_RESET_PENDING)) { 1760 /* Power cycle the card ... */ 1761 if (ipw2100_power_cycle_adapter(priv)) { 1762 printk(KERN_WARNING DRV_NAME 1763 ": %s: Could not cycle adapter.\n", 1764 priv->net_dev->name); 1765 rc = 1; 1766 goto exit; 1767 } 1768 } else 1769 priv->status |= STATUS_POWERED; 1770 1771 /* Load the firmware, start the clocks, etc. */ 1772 if (ipw2100_start_adapter(priv)) { 1773 printk(KERN_ERR DRV_NAME 1774 ": %s: Failed to start the firmware.\n", 1775 priv->net_dev->name); 1776 rc = 1; 1777 goto exit; 1778 } 1779 1780 ipw2100_initialize_ordinals(priv); 1781 1782 /* Determine capabilities of this particular HW configuration */ 1783 if (ipw2100_get_hw_features(priv)) { 1784 printk(KERN_ERR DRV_NAME 1785 ": %s: Failed to determine HW features.\n", 1786 priv->net_dev->name); 1787 rc = 1; 1788 goto exit; 1789 } 1790 1791 /* Initialize the geo */ 1792 libipw_set_geo(priv->ieee, &ipw_geos[0]); 1793 priv->ieee->freq_band = LIBIPW_24GHZ_BAND; 1794 1795 lock = LOCK_NONE; 1796 if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) { 1797 printk(KERN_ERR DRV_NAME 1798 ": %s: Failed to clear ordinal lock.\n", 1799 priv->net_dev->name); 1800 rc = 1; 1801 goto exit; 1802 } 1803 1804 priv->status &= ~STATUS_SCANNING; 1805 1806 if (rf_kill_active(priv)) { 1807 printk(KERN_INFO "%s: Radio is disabled by RF switch.\n", 1808 priv->net_dev->name); 1809 1810 if (priv->stop_rf_kill) { 1811 priv->stop_rf_kill = 0; 1812 schedule_delayed_work(&priv->rf_kill, 1813 round_jiffies_relative(HZ)); 1814 } 1815 1816 deferred = 1; 1817 } 1818 1819 /* Turn on the interrupt so that commands can be processed */ 1820 ipw2100_enable_interrupts(priv); 1821 1822 /* Send all of the commands that must be sent prior to 1823 * HOST_COMPLETE */ 1824 if (ipw2100_adapter_setup(priv)) { 1825 printk(KERN_ERR DRV_NAME ": %s: Failed to start the card.\n", 1826 priv->net_dev->name); 1827 rc = 1; 1828 goto exit; 1829 } 1830 1831 if (!deferred) { 1832 /* Enable the adapter - sends HOST_COMPLETE */ 1833 if (ipw2100_enable_adapter(priv)) { 1834 printk(KERN_ERR DRV_NAME ": " 1835 "%s: failed in call to enable adapter.\n", 1836 priv->net_dev->name); 1837 ipw2100_hw_stop_adapter(priv); 1838 rc = 1; 1839 goto exit; 1840 } 1841 1842 /* Start a scan . . . */ 1843 ipw2100_set_scan_options(priv); 1844 ipw2100_start_scan(priv); 1845 } 1846 1847 exit: 1848 return rc; 1849 } 1850 1851 static void ipw2100_down(struct ipw2100_priv *priv) 1852 { 1853 unsigned long flags; 1854 union iwreq_data wrqu = { 1855 .ap_addr = { 1856 .sa_family = ARPHRD_ETHER} 1857 }; 1858 int associated = priv->status & STATUS_ASSOCIATED; 1859 1860 /* Kill the RF switch timer */ 1861 if (!priv->stop_rf_kill) { 1862 priv->stop_rf_kill = 1; 1863 cancel_delayed_work(&priv->rf_kill); 1864 } 1865 1866 /* Kill the firmware hang check timer */ 1867 if (!priv->stop_hang_check) { 1868 priv->stop_hang_check = 1; 1869 cancel_delayed_work(&priv->hang_check); 1870 } 1871 1872 /* Kill any pending resets */ 1873 if (priv->status & STATUS_RESET_PENDING) 1874 cancel_delayed_work(&priv->reset_work); 1875 1876 /* Make sure the interrupt is on so that FW commands will be 1877 * processed correctly */ 1878 spin_lock_irqsave(&priv->low_lock, flags); 1879 ipw2100_enable_interrupts(priv); 1880 spin_unlock_irqrestore(&priv->low_lock, flags); 1881 1882 if (ipw2100_hw_stop_adapter(priv)) 1883 printk(KERN_ERR DRV_NAME ": %s: Error stopping adapter.\n", 1884 priv->net_dev->name); 1885 1886 /* Do not disable the interrupt until _after_ we disable 1887 * the adaptor. Otherwise the CARD_DISABLE command will never 1888 * be ack'd by the firmware */ 1889 spin_lock_irqsave(&priv->low_lock, flags); 1890 ipw2100_disable_interrupts(priv); 1891 spin_unlock_irqrestore(&priv->low_lock, flags); 1892 1893 pm_qos_update_request(&ipw2100_pm_qos_req, PM_QOS_DEFAULT_VALUE); 1894 1895 /* We have to signal any supplicant if we are disassociating */ 1896 if (associated) 1897 wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); 1898 1899 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); 1900 netif_carrier_off(priv->net_dev); 1901 netif_stop_queue(priv->net_dev); 1902 } 1903 1904 static int ipw2100_wdev_init(struct net_device *dev) 1905 { 1906 struct ipw2100_priv *priv = libipw_priv(dev); 1907 const struct libipw_geo *geo = libipw_get_geo(priv->ieee); 1908 struct wireless_dev *wdev = &priv->ieee->wdev; 1909 int i; 1910 1911 memcpy(wdev->wiphy->perm_addr, priv->mac_addr, ETH_ALEN); 1912 1913 /* fill-out priv->ieee->bg_band */ 1914 if (geo->bg_channels) { 1915 struct ieee80211_supported_band *bg_band = &priv->ieee->bg_band; 1916 1917 bg_band->band = IEEE80211_BAND_2GHZ; 1918 bg_band->n_channels = geo->bg_channels; 1919 bg_band->channels = kcalloc(geo->bg_channels, 1920 sizeof(struct ieee80211_channel), 1921 GFP_KERNEL); 1922 if (!bg_band->channels) { 1923 ipw2100_down(priv); 1924 return -ENOMEM; 1925 } 1926 /* translate geo->bg to bg_band.channels */ 1927 for (i = 0; i < geo->bg_channels; i++) { 1928 bg_band->channels[i].band = IEEE80211_BAND_2GHZ; 1929 bg_band->channels[i].center_freq = geo->bg[i].freq; 1930 bg_band->channels[i].hw_value = geo->bg[i].channel; 1931 bg_band->channels[i].max_power = geo->bg[i].max_power; 1932 if (geo->bg[i].flags & LIBIPW_CH_PASSIVE_ONLY) 1933 bg_band->channels[i].flags |= 1934 IEEE80211_CHAN_NO_IR; 1935 if (geo->bg[i].flags & LIBIPW_CH_NO_IBSS) 1936 bg_band->channels[i].flags |= 1937 IEEE80211_CHAN_NO_IR; 1938 if (geo->bg[i].flags & LIBIPW_CH_RADAR_DETECT) 1939 bg_band->channels[i].flags |= 1940 IEEE80211_CHAN_RADAR; 1941 /* No equivalent for LIBIPW_CH_80211H_RULES, 1942 LIBIPW_CH_UNIFORM_SPREADING, or 1943 LIBIPW_CH_B_ONLY... */ 1944 } 1945 /* point at bitrate info */ 1946 bg_band->bitrates = ipw2100_bg_rates; 1947 bg_band->n_bitrates = RATE_COUNT; 1948 1949 wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = bg_band; 1950 } 1951 1952 wdev->wiphy->cipher_suites = ipw_cipher_suites; 1953 wdev->wiphy->n_cipher_suites = ARRAY_SIZE(ipw_cipher_suites); 1954 1955 set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev); 1956 if (wiphy_register(wdev->wiphy)) 1957 return -EIO; 1958 return 0; 1959 } 1960 1961 static void ipw2100_reset_adapter(struct work_struct *work) 1962 { 1963 struct ipw2100_priv *priv = 1964 container_of(work, struct ipw2100_priv, reset_work.work); 1965 unsigned long flags; 1966 union iwreq_data wrqu = { 1967 .ap_addr = { 1968 .sa_family = ARPHRD_ETHER} 1969 }; 1970 int associated = priv->status & STATUS_ASSOCIATED; 1971 1972 spin_lock_irqsave(&priv->low_lock, flags); 1973 IPW_DEBUG_INFO(": %s: Restarting adapter.\n", priv->net_dev->name); 1974 priv->resets++; 1975 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); 1976 priv->status |= STATUS_SECURITY_UPDATED; 1977 1978 /* Force a power cycle even if interface hasn't been opened 1979 * yet */ 1980 cancel_delayed_work(&priv->reset_work); 1981 priv->status |= STATUS_RESET_PENDING; 1982 spin_unlock_irqrestore(&priv->low_lock, flags); 1983 1984 mutex_lock(&priv->action_mutex); 1985 /* stop timed checks so that they don't interfere with reset */ 1986 priv->stop_hang_check = 1; 1987 cancel_delayed_work(&priv->hang_check); 1988 1989 /* We have to signal any supplicant if we are disassociating */ 1990 if (associated) 1991 wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); 1992 1993 ipw2100_up(priv, 0); 1994 mutex_unlock(&priv->action_mutex); 1995 1996 } 1997 1998 static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) 1999 { 2000 2001 #define MAC_ASSOCIATION_READ_DELAY (HZ) 2002 int ret; 2003 unsigned int len, essid_len; 2004 char essid[IW_ESSID_MAX_SIZE]; 2005 u32 txrate; 2006 u32 chan; 2007 char *txratename; 2008 u8 bssid[ETH_ALEN]; 2009 DECLARE_SSID_BUF(ssid); 2010 2011 /* 2012 * TBD: BSSID is usually 00:00:00:00:00:00 here and not 2013 * an actual MAC of the AP. Seems like FW sets this 2014 * address too late. Read it later and expose through 2015 * /proc or schedule a later task to query and update 2016 */ 2017 2018 essid_len = IW_ESSID_MAX_SIZE; 2019 ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_SSID, 2020 essid, &essid_len); 2021 if (ret) { 2022 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 2023 __LINE__); 2024 return; 2025 } 2026 2027 len = sizeof(u32); 2028 ret = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &txrate, &len); 2029 if (ret) { 2030 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 2031 __LINE__); 2032 return; 2033 } 2034 2035 len = sizeof(u32); 2036 ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &len); 2037 if (ret) { 2038 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 2039 __LINE__); 2040 return; 2041 } 2042 len = ETH_ALEN; 2043 ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, bssid, 2044 &len); 2045 if (ret) { 2046 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 2047 __LINE__); 2048 return; 2049 } 2050 memcpy(priv->ieee->bssid, bssid, ETH_ALEN); 2051 2052 switch (txrate) { 2053 case TX_RATE_1_MBIT: 2054 txratename = "1Mbps"; 2055 break; 2056 case TX_RATE_2_MBIT: 2057 txratename = "2Mbsp"; 2058 break; 2059 case TX_RATE_5_5_MBIT: 2060 txratename = "5.5Mbps"; 2061 break; 2062 case TX_RATE_11_MBIT: 2063 txratename = "11Mbps"; 2064 break; 2065 default: 2066 IPW_DEBUG_INFO("Unknown rate: %d\n", txrate); 2067 txratename = "unknown rate"; 2068 break; 2069 } 2070 2071 IPW_DEBUG_INFO("%s: Associated with '%s' at %s, channel %d (BSSID=%pM)\n", 2072 priv->net_dev->name, print_ssid(ssid, essid, essid_len), 2073 txratename, chan, bssid); 2074 2075 /* now we copy read ssid into dev */ 2076 if (!(priv->config & CFG_STATIC_ESSID)) { 2077 priv->essid_len = min((u8) essid_len, (u8) IW_ESSID_MAX_SIZE); 2078 memcpy(priv->essid, essid, priv->essid_len); 2079 } 2080 priv->channel = chan; 2081 memcpy(priv->bssid, bssid, ETH_ALEN); 2082 2083 priv->status |= STATUS_ASSOCIATING; 2084 priv->connect_start = get_seconds(); 2085 2086 schedule_delayed_work(&priv->wx_event_work, HZ / 10); 2087 } 2088 2089 static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, 2090 int length, int batch_mode) 2091 { 2092 int ssid_len = min(length, IW_ESSID_MAX_SIZE); 2093 struct host_command cmd = { 2094 .host_command = SSID, 2095 .host_command_sequence = 0, 2096 .host_command_length = ssid_len 2097 }; 2098 int err; 2099 DECLARE_SSID_BUF(ssid); 2100 2101 IPW_DEBUG_HC("SSID: '%s'\n", print_ssid(ssid, essid, ssid_len)); 2102 2103 if (ssid_len) 2104 memcpy(cmd.host_command_parameters, essid, ssid_len); 2105 2106 if (!batch_mode) { 2107 err = ipw2100_disable_adapter(priv); 2108 if (err) 2109 return err; 2110 } 2111 2112 /* Bug in FW currently doesn't honor bit 0 in SET_SCAN_OPTIONS to 2113 * disable auto association -- so we cheat by setting a bogus SSID */ 2114 if (!ssid_len && !(priv->config & CFG_ASSOCIATE)) { 2115 int i; 2116 u8 *bogus = (u8 *) cmd.host_command_parameters; 2117 for (i = 0; i < IW_ESSID_MAX_SIZE; i++) 2118 bogus[i] = 0x18 + i; 2119 cmd.host_command_length = IW_ESSID_MAX_SIZE; 2120 } 2121 2122 /* NOTE: We always send the SSID command even if the provided ESSID is 2123 * the same as what we currently think is set. */ 2124 2125 err = ipw2100_hw_send_command(priv, &cmd); 2126 if (!err) { 2127 memset(priv->essid + ssid_len, 0, IW_ESSID_MAX_SIZE - ssid_len); 2128 memcpy(priv->essid, essid, ssid_len); 2129 priv->essid_len = ssid_len; 2130 } 2131 2132 if (!batch_mode) { 2133 if (ipw2100_enable_adapter(priv)) 2134 err = -EIO; 2135 } 2136 2137 return err; 2138 } 2139 2140 static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status) 2141 { 2142 DECLARE_SSID_BUF(ssid); 2143 2144 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, 2145 "disassociated: '%s' %pM\n", 2146 print_ssid(ssid, priv->essid, priv->essid_len), 2147 priv->bssid); 2148 2149 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); 2150 2151 if (priv->status & STATUS_STOPPING) { 2152 IPW_DEBUG_INFO("Card is stopping itself, discard ASSN_LOST.\n"); 2153 return; 2154 } 2155 2156 memset(priv->bssid, 0, ETH_ALEN); 2157 memset(priv->ieee->bssid, 0, ETH_ALEN); 2158 2159 netif_carrier_off(priv->net_dev); 2160 netif_stop_queue(priv->net_dev); 2161 2162 if (!(priv->status & STATUS_RUNNING)) 2163 return; 2164 2165 if (priv->status & STATUS_SECURITY_UPDATED) 2166 schedule_delayed_work(&priv->security_work, 0); 2167 2168 schedule_delayed_work(&priv->wx_event_work, 0); 2169 } 2170 2171 static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) 2172 { 2173 IPW_DEBUG_INFO("%s: RF Kill state changed to radio OFF.\n", 2174 priv->net_dev->name); 2175 2176 /* RF_KILL is now enabled (else we wouldn't be here) */ 2177 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, true); 2178 priv->status |= STATUS_RF_KILL_HW; 2179 2180 /* Make sure the RF Kill check timer is running */ 2181 priv->stop_rf_kill = 0; 2182 mod_delayed_work(system_wq, &priv->rf_kill, round_jiffies_relative(HZ)); 2183 } 2184 2185 static void ipw2100_scan_event(struct work_struct *work) 2186 { 2187 struct ipw2100_priv *priv = container_of(work, struct ipw2100_priv, 2188 scan_event.work); 2189 union iwreq_data wrqu; 2190 2191 wrqu.data.length = 0; 2192 wrqu.data.flags = 0; 2193 wireless_send_event(priv->net_dev, SIOCGIWSCAN, &wrqu, NULL); 2194 } 2195 2196 static void isr_scan_complete(struct ipw2100_priv *priv, u32 status) 2197 { 2198 IPW_DEBUG_SCAN("scan complete\n"); 2199 /* Age the scan results... */ 2200 priv->ieee->scans++; 2201 priv->status &= ~STATUS_SCANNING; 2202 2203 /* Only userspace-requested scan completion events go out immediately */ 2204 if (!priv->user_requested_scan) { 2205 schedule_delayed_work(&priv->scan_event, 2206 round_jiffies_relative(msecs_to_jiffies(4000))); 2207 } else { 2208 priv->user_requested_scan = 0; 2209 mod_delayed_work(system_wq, &priv->scan_event, 0); 2210 } 2211 } 2212 2213 #ifdef CONFIG_IPW2100_DEBUG 2214 #define IPW2100_HANDLER(v, f) { v, f, # v } 2215 struct ipw2100_status_indicator { 2216 int status; 2217 void (*cb) (struct ipw2100_priv * priv, u32 status); 2218 char *name; 2219 }; 2220 #else 2221 #define IPW2100_HANDLER(v, f) { v, f } 2222 struct ipw2100_status_indicator { 2223 int status; 2224 void (*cb) (struct ipw2100_priv * priv, u32 status); 2225 }; 2226 #endif /* CONFIG_IPW2100_DEBUG */ 2227 2228 static void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status) 2229 { 2230 IPW_DEBUG_SCAN("Scanning...\n"); 2231 priv->status |= STATUS_SCANNING; 2232 } 2233 2234 static const struct ipw2100_status_indicator status_handlers[] = { 2235 IPW2100_HANDLER(IPW_STATE_INITIALIZED, NULL), 2236 IPW2100_HANDLER(IPW_STATE_COUNTRY_FOUND, NULL), 2237 IPW2100_HANDLER(IPW_STATE_ASSOCIATED, isr_indicate_associated), 2238 IPW2100_HANDLER(IPW_STATE_ASSN_LOST, isr_indicate_association_lost), 2239 IPW2100_HANDLER(IPW_STATE_ASSN_CHANGED, NULL), 2240 IPW2100_HANDLER(IPW_STATE_SCAN_COMPLETE, isr_scan_complete), 2241 IPW2100_HANDLER(IPW_STATE_ENTERED_PSP, NULL), 2242 IPW2100_HANDLER(IPW_STATE_LEFT_PSP, NULL), 2243 IPW2100_HANDLER(IPW_STATE_RF_KILL, isr_indicate_rf_kill), 2244 IPW2100_HANDLER(IPW_STATE_DISABLED, NULL), 2245 IPW2100_HANDLER(IPW_STATE_POWER_DOWN, NULL), 2246 IPW2100_HANDLER(IPW_STATE_SCANNING, isr_indicate_scanning), 2247 IPW2100_HANDLER(-1, NULL) 2248 }; 2249 2250 static void isr_status_change(struct ipw2100_priv *priv, int status) 2251 { 2252 int i; 2253 2254 if (status == IPW_STATE_SCANNING && 2255 priv->status & STATUS_ASSOCIATED && 2256 !(priv->status & STATUS_SCANNING)) { 2257 IPW_DEBUG_INFO("Scan detected while associated, with " 2258 "no scan request. Restarting firmware.\n"); 2259 2260 /* Wake up any sleeping jobs */ 2261 schedule_reset(priv); 2262 } 2263 2264 for (i = 0; status_handlers[i].status != -1; i++) { 2265 if (status == status_handlers[i].status) { 2266 IPW_DEBUG_NOTIF("Status change: %s\n", 2267 status_handlers[i].name); 2268 if (status_handlers[i].cb) 2269 status_handlers[i].cb(priv, status); 2270 priv->wstats.status = status; 2271 return; 2272 } 2273 } 2274 2275 IPW_DEBUG_NOTIF("unknown status received: %04x\n", status); 2276 } 2277 2278 static void isr_rx_complete_command(struct ipw2100_priv *priv, 2279 struct ipw2100_cmd_header *cmd) 2280 { 2281 #ifdef CONFIG_IPW2100_DEBUG 2282 if (cmd->host_command_reg < ARRAY_SIZE(command_types)) { 2283 IPW_DEBUG_HC("Command completed '%s (%d)'\n", 2284 command_types[cmd->host_command_reg], 2285 cmd->host_command_reg); 2286 } 2287 #endif 2288 if (cmd->host_command_reg == HOST_COMPLETE) 2289 priv->status |= STATUS_ENABLED; 2290 2291 if (cmd->host_command_reg == CARD_DISABLE) 2292 priv->status &= ~STATUS_ENABLED; 2293 2294 priv->status &= ~STATUS_CMD_ACTIVE; 2295 2296 wake_up_interruptible(&priv->wait_command_queue); 2297 } 2298 2299 #ifdef CONFIG_IPW2100_DEBUG 2300 static const char *frame_types[] = { 2301 "COMMAND_STATUS_VAL", 2302 "STATUS_CHANGE_VAL", 2303 "P80211_DATA_VAL", 2304 "P8023_DATA_VAL", 2305 "HOST_NOTIFICATION_VAL" 2306 }; 2307 #endif 2308 2309 static int ipw2100_alloc_skb(struct ipw2100_priv *priv, 2310 struct ipw2100_rx_packet *packet) 2311 { 2312 packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx)); 2313 if (!packet->skb) 2314 return -ENOMEM; 2315 2316 packet->rxp = (struct ipw2100_rx *)packet->skb->data; 2317 packet->dma_addr = pci_map_single(priv->pci_dev, packet->skb->data, 2318 sizeof(struct ipw2100_rx), 2319 PCI_DMA_FROMDEVICE); 2320 /* NOTE: pci_map_single does not return an error code, and 0 is a valid 2321 * dma_addr */ 2322 2323 return 0; 2324 } 2325 2326 #define SEARCH_ERROR 0xffffffff 2327 #define SEARCH_FAIL 0xfffffffe 2328 #define SEARCH_SUCCESS 0xfffffff0 2329 #define SEARCH_DISCARD 0 2330 #define SEARCH_SNAPSHOT 1 2331 2332 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 2333 static void ipw2100_snapshot_free(struct ipw2100_priv *priv) 2334 { 2335 int i; 2336 if (!priv->snapshot[0]) 2337 return; 2338 for (i = 0; i < 0x30; i++) 2339 kfree(priv->snapshot[i]); 2340 priv->snapshot[0] = NULL; 2341 } 2342 2343 #ifdef IPW2100_DEBUG_C3 2344 static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) 2345 { 2346 int i; 2347 if (priv->snapshot[0]) 2348 return 1; 2349 for (i = 0; i < 0x30; i++) { 2350 priv->snapshot[i] = kmalloc(0x1000, GFP_ATOMIC); 2351 if (!priv->snapshot[i]) { 2352 IPW_DEBUG_INFO("%s: Error allocating snapshot " 2353 "buffer %d\n", priv->net_dev->name, i); 2354 while (i > 0) 2355 kfree(priv->snapshot[--i]); 2356 priv->snapshot[0] = NULL; 2357 return 0; 2358 } 2359 } 2360 2361 return 1; 2362 } 2363 2364 static u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, 2365 size_t len, int mode) 2366 { 2367 u32 i, j; 2368 u32 tmp; 2369 u8 *s, *d; 2370 u32 ret; 2371 2372 s = in_buf; 2373 if (mode == SEARCH_SNAPSHOT) { 2374 if (!ipw2100_snapshot_alloc(priv)) 2375 mode = SEARCH_DISCARD; 2376 } 2377 2378 for (ret = SEARCH_FAIL, i = 0; i < 0x30000; i += 4) { 2379 read_nic_dword(priv->net_dev, i, &tmp); 2380 if (mode == SEARCH_SNAPSHOT) 2381 *(u32 *) SNAPSHOT_ADDR(i) = tmp; 2382 if (ret == SEARCH_FAIL) { 2383 d = (u8 *) & tmp; 2384 for (j = 0; j < 4; j++) { 2385 if (*s != *d) { 2386 s = in_buf; 2387 continue; 2388 } 2389 2390 s++; 2391 d++; 2392 2393 if ((s - in_buf) == len) 2394 ret = (i + j) - len + 1; 2395 } 2396 } else if (mode == SEARCH_DISCARD) 2397 return ret; 2398 } 2399 2400 return ret; 2401 } 2402 #endif 2403 2404 /* 2405 * 2406 * 0) Disconnect the SKB from the firmware (just unmap) 2407 * 1) Pack the ETH header into the SKB 2408 * 2) Pass the SKB to the network stack 2409 * 2410 * When packet is provided by the firmware, it contains the following: 2411 * 2412 * . libipw_hdr 2413 * . libipw_snap_hdr 2414 * 2415 * The size of the constructed ethernet 2416 * 2417 */ 2418 #ifdef IPW2100_RX_DEBUG 2419 static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; 2420 #endif 2421 2422 static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) 2423 { 2424 #ifdef IPW2100_DEBUG_C3 2425 struct ipw2100_status *status = &priv->status_queue.drv[i]; 2426 u32 match, reg; 2427 int j; 2428 #endif 2429 2430 IPW_DEBUG_INFO(": PCI latency error detected at 0x%04zX.\n", 2431 i * sizeof(struct ipw2100_status)); 2432 2433 #ifdef IPW2100_DEBUG_C3 2434 /* Halt the firmware so we can get a good image */ 2435 write_register(priv->net_dev, IPW_REG_RESET_REG, 2436 IPW_AUX_HOST_RESET_REG_STOP_MASTER); 2437 j = 5; 2438 do { 2439 udelay(IPW_WAIT_RESET_MASTER_ASSERT_COMPLETE_DELAY); 2440 read_register(priv->net_dev, IPW_REG_RESET_REG, &reg); 2441 2442 if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) 2443 break; 2444 } while (j--); 2445 2446 match = ipw2100_match_buf(priv, (u8 *) status, 2447 sizeof(struct ipw2100_status), 2448 SEARCH_SNAPSHOT); 2449 if (match < SEARCH_SUCCESS) 2450 IPW_DEBUG_INFO("%s: DMA status match in Firmware at " 2451 "offset 0x%06X, length %d:\n", 2452 priv->net_dev->name, match, 2453 sizeof(struct ipw2100_status)); 2454 else 2455 IPW_DEBUG_INFO("%s: No DMA status match in " 2456 "Firmware.\n", priv->net_dev->name); 2457 2458 printk_buf((u8 *) priv->status_queue.drv, 2459 sizeof(struct ipw2100_status) * RX_QUEUE_LENGTH); 2460 #endif 2461 2462 priv->fatal_error = IPW2100_ERR_C3_CORRUPTION; 2463 priv->net_dev->stats.rx_errors++; 2464 schedule_reset(priv); 2465 } 2466 2467 static void isr_rx(struct ipw2100_priv *priv, int i, 2468 struct libipw_rx_stats *stats) 2469 { 2470 struct net_device *dev = priv->net_dev; 2471 struct ipw2100_status *status = &priv->status_queue.drv[i]; 2472 struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; 2473 2474 IPW_DEBUG_RX("Handler...\n"); 2475 2476 if (unlikely(status->frame_size > skb_tailroom(packet->skb))) { 2477 IPW_DEBUG_INFO("%s: frame_size (%u) > skb_tailroom (%u)!" 2478 " Dropping.\n", 2479 dev->name, 2480 status->frame_size, skb_tailroom(packet->skb)); 2481 dev->stats.rx_errors++; 2482 return; 2483 } 2484 2485 if (unlikely(!netif_running(dev))) { 2486 dev->stats.rx_errors++; 2487 priv->wstats.discard.misc++; 2488 IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); 2489 return; 2490 } 2491 2492 if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && 2493 !(priv->status & STATUS_ASSOCIATED))) { 2494 IPW_DEBUG_DROP("Dropping packet while not associated.\n"); 2495 priv->wstats.discard.misc++; 2496 return; 2497 } 2498 2499 pci_unmap_single(priv->pci_dev, 2500 packet->dma_addr, 2501 sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE); 2502 2503 skb_put(packet->skb, status->frame_size); 2504 2505 #ifdef IPW2100_RX_DEBUG 2506 /* Make a copy of the frame so we can dump it to the logs if 2507 * libipw_rx fails */ 2508 skb_copy_from_linear_data(packet->skb, packet_data, 2509 min_t(u32, status->frame_size, 2510 IPW_RX_NIC_BUFFER_LENGTH)); 2511 #endif 2512 2513 if (!libipw_rx(priv->ieee, packet->skb, stats)) { 2514 #ifdef IPW2100_RX_DEBUG 2515 IPW_DEBUG_DROP("%s: Non consumed packet:\n", 2516 dev->name); 2517 printk_buf(IPW_DL_DROP, packet_data, status->frame_size); 2518 #endif 2519 dev->stats.rx_errors++; 2520 2521 /* libipw_rx failed, so it didn't free the SKB */ 2522 dev_kfree_skb_any(packet->skb); 2523 packet->skb = NULL; 2524 } 2525 2526 /* We need to allocate a new SKB and attach it to the RDB. */ 2527 if (unlikely(ipw2100_alloc_skb(priv, packet))) { 2528 printk(KERN_WARNING DRV_NAME ": " 2529 "%s: Unable to allocate SKB onto RBD ring - disabling " 2530 "adapter.\n", dev->name); 2531 /* TODO: schedule adapter shutdown */ 2532 IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); 2533 } 2534 2535 /* Update the RDB entry */ 2536 priv->rx_queue.drv[i].host_addr = packet->dma_addr; 2537 } 2538 2539 #ifdef CONFIG_IPW2100_MONITOR 2540 2541 static void isr_rx_monitor(struct ipw2100_priv *priv, int i, 2542 struct libipw_rx_stats *stats) 2543 { 2544 struct net_device *dev = priv->net_dev; 2545 struct ipw2100_status *status = &priv->status_queue.drv[i]; 2546 struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; 2547 2548 /* Magic struct that slots into the radiotap header -- no reason 2549 * to build this manually element by element, we can write it much 2550 * more efficiently than we can parse it. ORDER MATTERS HERE */ 2551 struct ipw_rt_hdr { 2552 struct ieee80211_radiotap_header rt_hdr; 2553 s8 rt_dbmsignal; /* signal in dbM, kluged to signed */ 2554 } *ipw_rt; 2555 2556 IPW_DEBUG_RX("Handler...\n"); 2557 2558 if (unlikely(status->frame_size > skb_tailroom(packet->skb) - 2559 sizeof(struct ipw_rt_hdr))) { 2560 IPW_DEBUG_INFO("%s: frame_size (%u) > skb_tailroom (%u)!" 2561 " Dropping.\n", 2562 dev->name, 2563 status->frame_size, 2564 skb_tailroom(packet->skb)); 2565 dev->stats.rx_errors++; 2566 return; 2567 } 2568 2569 if (unlikely(!netif_running(dev))) { 2570 dev->stats.rx_errors++; 2571 priv->wstats.discard.misc++; 2572 IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); 2573 return; 2574 } 2575 2576 if (unlikely(priv->config & CFG_CRC_CHECK && 2577 status->flags & IPW_STATUS_FLAG_CRC_ERROR)) { 2578 IPW_DEBUG_RX("CRC error in packet. Dropping.\n"); 2579 dev->stats.rx_errors++; 2580 return; 2581 } 2582 2583 pci_unmap_single(priv->pci_dev, packet->dma_addr, 2584 sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE); 2585 memmove(packet->skb->data + sizeof(struct ipw_rt_hdr), 2586 packet->skb->data, status->frame_size); 2587 2588 ipw_rt = (struct ipw_rt_hdr *) packet->skb->data; 2589 2590 ipw_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; 2591 ipw_rt->rt_hdr.it_pad = 0; /* always good to zero */ 2592 ipw_rt->rt_hdr.it_len = cpu_to_le16(sizeof(struct ipw_rt_hdr)); /* total hdr+data */ 2593 2594 ipw_rt->rt_hdr.it_present = cpu_to_le32(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL); 2595 2596 ipw_rt->rt_dbmsignal = status->rssi + IPW2100_RSSI_TO_DBM; 2597 2598 skb_put(packet->skb, status->frame_size + sizeof(struct ipw_rt_hdr)); 2599 2600 if (!libipw_rx(priv->ieee, packet->skb, stats)) { 2601 dev->stats.rx_errors++; 2602 2603 /* libipw_rx failed, so it didn't free the SKB */ 2604 dev_kfree_skb_any(packet->skb); 2605 packet->skb = NULL; 2606 } 2607 2608 /* We need to allocate a new SKB and attach it to the RDB. */ 2609 if (unlikely(ipw2100_alloc_skb(priv, packet))) { 2610 IPW_DEBUG_WARNING( 2611 "%s: Unable to allocate SKB onto RBD ring - disabling " 2612 "adapter.\n", dev->name); 2613 /* TODO: schedule adapter shutdown */ 2614 IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); 2615 } 2616 2617 /* Update the RDB entry */ 2618 priv->rx_queue.drv[i].host_addr = packet->dma_addr; 2619 } 2620 2621 #endif 2622 2623 static int ipw2100_corruption_check(struct ipw2100_priv *priv, int i) 2624 { 2625 struct ipw2100_status *status = &priv->status_queue.drv[i]; 2626 struct ipw2100_rx *u = priv->rx_buffers[i].rxp; 2627 u16 frame_type = status->status_fields & STATUS_TYPE_MASK; 2628 2629 switch (frame_type) { 2630 case COMMAND_STATUS_VAL: 2631 return (status->frame_size != sizeof(u->rx_data.command)); 2632 case STATUS_CHANGE_VAL: 2633 return (status->frame_size != sizeof(u->rx_data.status)); 2634 case HOST_NOTIFICATION_VAL: 2635 return (status->frame_size < sizeof(u->rx_data.notification)); 2636 case P80211_DATA_VAL: 2637 case P8023_DATA_VAL: 2638 #ifdef CONFIG_IPW2100_MONITOR 2639 return 0; 2640 #else 2641 switch (WLAN_FC_GET_TYPE(le16_to_cpu(u->rx_data.header.frame_ctl))) { 2642 case IEEE80211_FTYPE_MGMT: 2643 case IEEE80211_FTYPE_CTL: 2644 return 0; 2645 case IEEE80211_FTYPE_DATA: 2646 return (status->frame_size > 2647 IPW_MAX_802_11_PAYLOAD_LENGTH); 2648 } 2649 #endif 2650 } 2651 2652 return 1; 2653 } 2654 2655 /* 2656 * ipw2100 interrupts are disabled at this point, and the ISR 2657 * is the only code that calls this method. So, we do not need 2658 * to play with any locks. 2659 * 2660 * RX Queue works as follows: 2661 * 2662 * Read index - firmware places packet in entry identified by the 2663 * Read index and advances Read index. In this manner, 2664 * Read index will always point to the next packet to 2665 * be filled--but not yet valid. 2666 * 2667 * Write index - driver fills this entry with an unused RBD entry. 2668 * This entry has not filled by the firmware yet. 2669 * 2670 * In between the W and R indexes are the RBDs that have been received 2671 * but not yet processed. 2672 * 2673 * The process of handling packets will start at WRITE + 1 and advance 2674 * until it reaches the READ index. 2675 * 2676 * The WRITE index is cached in the variable 'priv->rx_queue.next'. 2677 * 2678 */ 2679 static void __ipw2100_rx_process(struct ipw2100_priv *priv) 2680 { 2681 struct ipw2100_bd_queue *rxq = &priv->rx_queue; 2682 struct ipw2100_status_queue *sq = &priv->status_queue; 2683 struct ipw2100_rx_packet *packet; 2684 u16 frame_type; 2685 u32 r, w, i, s; 2686 struct ipw2100_rx *u; 2687 struct libipw_rx_stats stats = { 2688 .mac_time = jiffies, 2689 }; 2690 2691 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_RX_READ_INDEX, &r); 2692 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, &w); 2693 2694 if (r >= rxq->entries) { 2695 IPW_DEBUG_RX("exit - bad read index\n"); 2696 return; 2697 } 2698 2699 i = (rxq->next + 1) % rxq->entries; 2700 s = i; 2701 while (i != r) { 2702 /* IPW_DEBUG_RX("r = %d : w = %d : processing = %d\n", 2703 r, rxq->next, i); */ 2704 2705 packet = &priv->rx_buffers[i]; 2706 2707 /* Sync the DMA for the RX buffer so CPU is sure to get 2708 * the correct values */ 2709 pci_dma_sync_single_for_cpu(priv->pci_dev, packet->dma_addr, 2710 sizeof(struct ipw2100_rx), 2711 PCI_DMA_FROMDEVICE); 2712 2713 if (unlikely(ipw2100_corruption_check(priv, i))) { 2714 ipw2100_corruption_detected(priv, i); 2715 goto increment; 2716 } 2717 2718 u = packet->rxp; 2719 frame_type = sq->drv[i].status_fields & STATUS_TYPE_MASK; 2720 stats.rssi = sq->drv[i].rssi + IPW2100_RSSI_TO_DBM; 2721 stats.len = sq->drv[i].frame_size; 2722 2723 stats.mask = 0; 2724 if (stats.rssi != 0) 2725 stats.mask |= LIBIPW_STATMASK_RSSI; 2726 stats.freq = LIBIPW_24GHZ_BAND; 2727 2728 IPW_DEBUG_RX("%s: '%s' frame type received (%d).\n", 2729 priv->net_dev->name, frame_types[frame_type], 2730 stats.len); 2731 2732 switch (frame_type) { 2733 case COMMAND_STATUS_VAL: 2734 /* Reset Rx watchdog */ 2735 isr_rx_complete_command(priv, &u->rx_data.command); 2736 break; 2737 2738 case STATUS_CHANGE_VAL: 2739 isr_status_change(priv, u->rx_data.status); 2740 break; 2741 2742 case P80211_DATA_VAL: 2743 case P8023_DATA_VAL: 2744 #ifdef CONFIG_IPW2100_MONITOR 2745 if (priv->ieee->iw_mode == IW_MODE_MONITOR) { 2746 isr_rx_monitor(priv, i, &stats); 2747 break; 2748 } 2749 #endif 2750 if (stats.len < sizeof(struct libipw_hdr_3addr)) 2751 break; 2752 switch (WLAN_FC_GET_TYPE(le16_to_cpu(u->rx_data.header.frame_ctl))) { 2753 case IEEE80211_FTYPE_MGMT: 2754 libipw_rx_mgt(priv->ieee, 2755 &u->rx_data.header, &stats); 2756 break; 2757 2758 case IEEE80211_FTYPE_CTL: 2759 break; 2760 2761 case IEEE80211_FTYPE_DATA: 2762 isr_rx(priv, i, &stats); 2763 break; 2764 2765 } 2766 break; 2767 } 2768 2769 increment: 2770 /* clear status field associated with this RBD */ 2771 rxq->drv[i].status.info.field = 0; 2772 2773 i = (i + 1) % rxq->entries; 2774 } 2775 2776 if (i != s) { 2777 /* backtrack one entry, wrapping to end if at 0 */ 2778 rxq->next = (i ? i : rxq->entries) - 1; 2779 2780 write_register(priv->net_dev, 2781 IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, rxq->next); 2782 } 2783 } 2784 2785 /* 2786 * __ipw2100_tx_process 2787 * 2788 * This routine will determine whether the next packet on 2789 * the fw_pend_list has been processed by the firmware yet. 2790 * 2791 * If not, then it does nothing and returns. 2792 * 2793 * If so, then it removes the item from the fw_pend_list, frees 2794 * any associated storage, and places the item back on the 2795 * free list of its source (either msg_free_list or tx_free_list) 2796 * 2797 * TX Queue works as follows: 2798 * 2799 * Read index - points to the next TBD that the firmware will 2800 * process. The firmware will read the data, and once 2801 * done processing, it will advance the Read index. 2802 * 2803 * Write index - driver fills this entry with an constructed TBD 2804 * entry. The Write index is not advanced until the 2805 * packet has been configured. 2806 * 2807 * In between the W and R indexes are the TBDs that have NOT been 2808 * processed. Lagging behind the R index are packets that have 2809 * been processed but have not been freed by the driver. 2810 * 2811 * In order to free old storage, an internal index will be maintained 2812 * that points to the next packet to be freed. When all used 2813 * packets have been freed, the oldest index will be the same as the 2814 * firmware's read index. 2815 * 2816 * The OLDEST index is cached in the variable 'priv->tx_queue.oldest' 2817 * 2818 * Because the TBD structure can not contain arbitrary data, the 2819 * driver must keep an internal queue of cached allocations such that 2820 * it can put that data back into the tx_free_list and msg_free_list 2821 * for use by future command and data packets. 2822 * 2823 */ 2824 static int __ipw2100_tx_process(struct ipw2100_priv *priv) 2825 { 2826 struct ipw2100_bd_queue *txq = &priv->tx_queue; 2827 struct ipw2100_bd *tbd; 2828 struct list_head *element; 2829 struct ipw2100_tx_packet *packet; 2830 int descriptors_used; 2831 int e, i; 2832 u32 r, w, frag_num = 0; 2833 2834 if (list_empty(&priv->fw_pend_list)) 2835 return 0; 2836 2837 element = priv->fw_pend_list.next; 2838 2839 packet = list_entry(element, struct ipw2100_tx_packet, list); 2840 tbd = &txq->drv[packet->index]; 2841 2842 /* Determine how many TBD entries must be finished... */ 2843 switch (packet->type) { 2844 case COMMAND: 2845 /* COMMAND uses only one slot; don't advance */ 2846 descriptors_used = 1; 2847 e = txq->oldest; 2848 break; 2849 2850 case DATA: 2851 /* DATA uses two slots; advance and loop position. */ 2852 descriptors_used = tbd->num_fragments; 2853 frag_num = tbd->num_fragments - 1; 2854 e = txq->oldest + frag_num; 2855 e %= txq->entries; 2856 break; 2857 2858 default: 2859 printk(KERN_WARNING DRV_NAME ": %s: Bad fw_pend_list entry!\n", 2860 priv->net_dev->name); 2861 return 0; 2862 } 2863 2864 /* if the last TBD is not done by NIC yet, then packet is 2865 * not ready to be released. 2866 * 2867 */ 2868 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_TX_QUEUE_READ_INDEX, 2869 &r); 2870 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, 2871 &w); 2872 if (w != txq->next) 2873 printk(KERN_WARNING DRV_NAME ": %s: write index mismatch\n", 2874 priv->net_dev->name); 2875 2876 /* 2877 * txq->next is the index of the last packet written txq->oldest is 2878 * the index of the r is the index of the next packet to be read by 2879 * firmware 2880 */ 2881 2882 /* 2883 * Quick graphic to help you visualize the following 2884 * if / else statement 2885 * 2886 * ===>| s---->|=============== 2887 * e>| 2888 * | a | b | c | d | e | f | g | h | i | j | k | l 2889 * r---->| 2890 * w 2891 * 2892 * w - updated by driver 2893 * r - updated by firmware 2894 * s - start of oldest BD entry (txq->oldest) 2895 * e - end of oldest BD entry 2896 * 2897 */ 2898 if (!((r <= w && (e < r || e >= w)) || (e < r && e >= w))) { 2899 IPW_DEBUG_TX("exit - no processed packets ready to release.\n"); 2900 return 0; 2901 } 2902 2903 list_del(element); 2904 DEC_STAT(&priv->fw_pend_stat); 2905 2906 #ifdef CONFIG_IPW2100_DEBUG 2907 { 2908 i = txq->oldest; 2909 IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, 2910 &txq->drv[i], 2911 (u32) (txq->nic + i * sizeof(struct ipw2100_bd)), 2912 txq->drv[i].host_addr, txq->drv[i].buf_length); 2913 2914 if (packet->type == DATA) { 2915 i = (i + 1) % txq->entries; 2916 2917 IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, 2918 &txq->drv[i], 2919 (u32) (txq->nic + i * 2920 sizeof(struct ipw2100_bd)), 2921 (u32) txq->drv[i].host_addr, 2922 txq->drv[i].buf_length); 2923 } 2924 } 2925 #endif 2926 2927 switch (packet->type) { 2928 case DATA: 2929 if (txq->drv[txq->oldest].status.info.fields.txType != 0) 2930 printk(KERN_WARNING DRV_NAME ": %s: Queue mismatch. " 2931 "Expecting DATA TBD but pulled " 2932 "something else: ids %d=%d.\n", 2933 priv->net_dev->name, txq->oldest, packet->index); 2934 2935 /* DATA packet; we have to unmap and free the SKB */ 2936 for (i = 0; i < frag_num; i++) { 2937 tbd = &txq->drv[(packet->index + 1 + i) % txq->entries]; 2938 2939 IPW_DEBUG_TX("TX%d P=%08x L=%d\n", 2940 (packet->index + 1 + i) % txq->entries, 2941 tbd->host_addr, tbd->buf_length); 2942 2943 pci_unmap_single(priv->pci_dev, 2944 tbd->host_addr, 2945 tbd->buf_length, PCI_DMA_TODEVICE); 2946 } 2947 2948 libipw_txb_free(packet->info.d_struct.txb); 2949 packet->info.d_struct.txb = NULL; 2950 2951 list_add_tail(element, &priv->tx_free_list); 2952 INC_STAT(&priv->tx_free_stat); 2953 2954 /* We have a free slot in the Tx queue, so wake up the 2955 * transmit layer if it is stopped. */ 2956 if (priv->status & STATUS_ASSOCIATED) 2957 netif_wake_queue(priv->net_dev); 2958 2959 /* A packet was processed by the hardware, so update the 2960 * watchdog */ 2961 priv->net_dev->trans_start = jiffies; 2962 2963 break; 2964 2965 case COMMAND: 2966 if (txq->drv[txq->oldest].status.info.fields.txType != 1) 2967 printk(KERN_WARNING DRV_NAME ": %s: Queue mismatch. " 2968 "Expecting COMMAND TBD but pulled " 2969 "something else: ids %d=%d.\n", 2970 priv->net_dev->name, txq->oldest, packet->index); 2971 2972 #ifdef CONFIG_IPW2100_DEBUG 2973 if (packet->info.c_struct.cmd->host_command_reg < 2974 ARRAY_SIZE(command_types)) 2975 IPW_DEBUG_TX("Command '%s (%d)' processed: %d.\n", 2976 command_types[packet->info.c_struct.cmd-> 2977 host_command_reg], 2978 packet->info.c_struct.cmd-> 2979 host_command_reg, 2980 packet->info.c_struct.cmd->cmd_status_reg); 2981 #endif 2982 2983 list_add_tail(element, &priv->msg_free_list); 2984 INC_STAT(&priv->msg_free_stat); 2985 break; 2986 } 2987 2988 /* advance oldest used TBD pointer to start of next entry */ 2989 txq->oldest = (e + 1) % txq->entries; 2990 /* increase available TBDs number */ 2991 txq->available += descriptors_used; 2992 SET_STAT(&priv->txq_stat, txq->available); 2993 2994 IPW_DEBUG_TX("packet latency (send to process) %ld jiffies\n", 2995 jiffies - packet->jiffy_start); 2996 2997 return (!list_empty(&priv->fw_pend_list)); 2998 } 2999 3000 static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv) 3001 { 3002 int i = 0; 3003 3004 while (__ipw2100_tx_process(priv) && i < 200) 3005 i++; 3006 3007 if (i == 200) { 3008 printk(KERN_WARNING DRV_NAME ": " 3009 "%s: Driver is running slow (%d iters).\n", 3010 priv->net_dev->name, i); 3011 } 3012 } 3013 3014 static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) 3015 { 3016 struct list_head *element; 3017 struct ipw2100_tx_packet *packet; 3018 struct ipw2100_bd_queue *txq = &priv->tx_queue; 3019 struct ipw2100_bd *tbd; 3020 int next = txq->next; 3021 3022 while (!list_empty(&priv->msg_pend_list)) { 3023 /* if there isn't enough space in TBD queue, then 3024 * don't stuff a new one in. 3025 * NOTE: 3 are needed as a command will take one, 3026 * and there is a minimum of 2 that must be 3027 * maintained between the r and w indexes 3028 */ 3029 if (txq->available <= 3) { 3030 IPW_DEBUG_TX("no room in tx_queue\n"); 3031 break; 3032 } 3033 3034 element = priv->msg_pend_list.next; 3035 list_del(element); 3036 DEC_STAT(&priv->msg_pend_stat); 3037 3038 packet = list_entry(element, struct ipw2100_tx_packet, list); 3039 3040 IPW_DEBUG_TX("using TBD at virt=%p, phys=%04X\n", 3041 &txq->drv[txq->next], 3042 (u32) (txq->nic + txq->next * 3043 sizeof(struct ipw2100_bd))); 3044 3045 packet->index = txq->next; 3046 3047 tbd = &txq->drv[txq->next]; 3048 3049 /* initialize TBD */ 3050 tbd->host_addr = packet->info.c_struct.cmd_phys; 3051 tbd->buf_length = sizeof(struct ipw2100_cmd_header); 3052 /* not marking number of fragments causes problems 3053 * with f/w debug version */ 3054 tbd->num_fragments = 1; 3055 tbd->status.info.field = 3056 IPW_BD_STATUS_TX_FRAME_COMMAND | 3057 IPW_BD_STATUS_TX_INTERRUPT_ENABLE; 3058 3059 /* update TBD queue counters */ 3060 txq->next++; 3061 txq->next %= txq->entries; 3062 txq->available--; 3063 DEC_STAT(&priv->txq_stat); 3064 3065 list_add_tail(element, &priv->fw_pend_list); 3066 INC_STAT(&priv->fw_pend_stat); 3067 } 3068 3069 if (txq->next != next) { 3070 /* kick off the DMA by notifying firmware the 3071 * write index has moved; make sure TBD stores are sync'd */ 3072 wmb(); 3073 write_register(priv->net_dev, 3074 IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, 3075 txq->next); 3076 } 3077 } 3078 3079 /* 3080 * ipw2100_tx_send_data 3081 * 3082 */ 3083 static void ipw2100_tx_send_data(struct ipw2100_priv *priv) 3084 { 3085 struct list_head *element; 3086 struct ipw2100_tx_packet *packet; 3087 struct ipw2100_bd_queue *txq = &priv->tx_queue; 3088 struct ipw2100_bd *tbd; 3089 int next = txq->next; 3090 int i = 0; 3091 struct ipw2100_data_header *ipw_hdr; 3092 struct libipw_hdr_3addr *hdr; 3093 3094 while (!list_empty(&priv->tx_pend_list)) { 3095 /* if there isn't enough space in TBD queue, then 3096 * don't stuff a new one in. 3097 * NOTE: 4 are needed as a data will take two, 3098 * and there is a minimum of 2 that must be 3099 * maintained between the r and w indexes 3100 */ 3101 element = priv->tx_pend_list.next; 3102 packet = list_entry(element, struct ipw2100_tx_packet, list); 3103 3104 if (unlikely(1 + packet->info.d_struct.txb->nr_frags > 3105 IPW_MAX_BDS)) { 3106 /* TODO: Support merging buffers if more than 3107 * IPW_MAX_BDS are used */ 3108 IPW_DEBUG_INFO("%s: Maximum BD threshold exceeded. " 3109 "Increase fragmentation level.\n", 3110 priv->net_dev->name); 3111 } 3112 3113 if (txq->available <= 3 + packet->info.d_struct.txb->nr_frags) { 3114 IPW_DEBUG_TX("no room in tx_queue\n"); 3115 break; 3116 } 3117 3118 list_del(element); 3119 DEC_STAT(&priv->tx_pend_stat); 3120 3121 tbd = &txq->drv[txq->next]; 3122 3123 packet->index = txq->next; 3124 3125 ipw_hdr = packet->info.d_struct.data; 3126 hdr = (struct libipw_hdr_3addr *)packet->info.d_struct.txb-> 3127 fragments[0]->data; 3128 3129 if (priv->ieee->iw_mode == IW_MODE_INFRA) { 3130 /* To DS: Addr1 = BSSID, Addr2 = SA, 3131 Addr3 = DA */ 3132 memcpy(ipw_hdr->src_addr, hdr->addr2, ETH_ALEN); 3133 memcpy(ipw_hdr->dst_addr, hdr->addr3, ETH_ALEN); 3134 } else if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 3135 /* not From/To DS: Addr1 = DA, Addr2 = SA, 3136 Addr3 = BSSID */ 3137 memcpy(ipw_hdr->src_addr, hdr->addr2, ETH_ALEN); 3138 memcpy(ipw_hdr->dst_addr, hdr->addr1, ETH_ALEN); 3139 } 3140 3141 ipw_hdr->host_command_reg = SEND; 3142 ipw_hdr->host_command_reg1 = 0; 3143 3144 /* For now we only support host based encryption */ 3145 ipw_hdr->needs_encryption = 0; 3146 ipw_hdr->encrypted = packet->info.d_struct.txb->encrypted; 3147 if (packet->info.d_struct.txb->nr_frags > 1) 3148 ipw_hdr->fragment_size = 3149 packet->info.d_struct.txb->frag_size - 3150 LIBIPW_3ADDR_LEN; 3151 else 3152 ipw_hdr->fragment_size = 0; 3153 3154 tbd->host_addr = packet->info.d_struct.data_phys; 3155 tbd->buf_length = sizeof(struct ipw2100_data_header); 3156 tbd->num_fragments = 1 + packet->info.d_struct.txb->nr_frags; 3157 tbd->status.info.field = 3158 IPW_BD_STATUS_TX_FRAME_802_3 | 3159 IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; 3160 txq->next++; 3161 txq->next %= txq->entries; 3162 3163 IPW_DEBUG_TX("data header tbd TX%d P=%08x L=%d\n", 3164 packet->index, tbd->host_addr, tbd->buf_length); 3165 #ifdef CONFIG_IPW2100_DEBUG 3166 if (packet->info.d_struct.txb->nr_frags > 1) 3167 IPW_DEBUG_FRAG("fragment Tx: %d frames\n", 3168 packet->info.d_struct.txb->nr_frags); 3169 #endif 3170 3171 for (i = 0; i < packet->info.d_struct.txb->nr_frags; i++) { 3172 tbd = &txq->drv[txq->next]; 3173 if (i == packet->info.d_struct.txb->nr_frags - 1) 3174 tbd->status.info.field = 3175 IPW_BD_STATUS_TX_FRAME_802_3 | 3176 IPW_BD_STATUS_TX_INTERRUPT_ENABLE; 3177 else 3178 tbd->status.info.field = 3179 IPW_BD_STATUS_TX_FRAME_802_3 | 3180 IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; 3181 3182 tbd->buf_length = packet->info.d_struct.txb-> 3183 fragments[i]->len - LIBIPW_3ADDR_LEN; 3184 3185 tbd->host_addr = pci_map_single(priv->pci_dev, 3186 packet->info.d_struct. 3187 txb->fragments[i]-> 3188 data + 3189 LIBIPW_3ADDR_LEN, 3190 tbd->buf_length, 3191 PCI_DMA_TODEVICE); 3192 3193 IPW_DEBUG_TX("data frag tbd TX%d P=%08x L=%d\n", 3194 txq->next, tbd->host_addr, 3195 tbd->buf_length); 3196 3197 pci_dma_sync_single_for_device(priv->pci_dev, 3198 tbd->host_addr, 3199 tbd->buf_length, 3200 PCI_DMA_TODEVICE); 3201 3202 txq->next++; 3203 txq->next %= txq->entries; 3204 } 3205 3206 txq->available -= 1 + packet->info.d_struct.txb->nr_frags; 3207 SET_STAT(&priv->txq_stat, txq->available); 3208 3209 list_add_tail(element, &priv->fw_pend_list); 3210 INC_STAT(&priv->fw_pend_stat); 3211 } 3212 3213 if (txq->next != next) { 3214 /* kick off the DMA by notifying firmware the 3215 * write index has moved; make sure TBD stores are sync'd */ 3216 write_register(priv->net_dev, 3217 IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, 3218 txq->next); 3219 } 3220 } 3221 3222 static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) 3223 { 3224 struct net_device *dev = priv->net_dev; 3225 unsigned long flags; 3226 u32 inta, tmp; 3227 3228 spin_lock_irqsave(&priv->low_lock, flags); 3229 ipw2100_disable_interrupts(priv); 3230 3231 read_register(dev, IPW_REG_INTA, &inta); 3232 3233 IPW_DEBUG_ISR("enter - INTA: 0x%08lX\n", 3234 (unsigned long)inta & IPW_INTERRUPT_MASK); 3235 3236 priv->in_isr++; 3237 priv->interrupts++; 3238 3239 /* We do not loop and keep polling for more interrupts as this 3240 * is frowned upon and doesn't play nicely with other potentially 3241 * chained IRQs */ 3242 IPW_DEBUG_ISR("INTA: 0x%08lX\n", 3243 (unsigned long)inta & IPW_INTERRUPT_MASK); 3244 3245 if (inta & IPW2100_INTA_FATAL_ERROR) { 3246 printk(KERN_WARNING DRV_NAME 3247 ": Fatal interrupt. Scheduling firmware restart.\n"); 3248 priv->inta_other++; 3249 write_register(dev, IPW_REG_INTA, IPW2100_INTA_FATAL_ERROR); 3250 3251 read_nic_dword(dev, IPW_NIC_FATAL_ERROR, &priv->fatal_error); 3252 IPW_DEBUG_INFO("%s: Fatal error value: 0x%08X\n", 3253 priv->net_dev->name, priv->fatal_error); 3254 3255 read_nic_dword(dev, IPW_ERROR_ADDR(priv->fatal_error), &tmp); 3256 IPW_DEBUG_INFO("%s: Fatal error address value: 0x%08X\n", 3257 priv->net_dev->name, tmp); 3258 3259 /* Wake up any sleeping jobs */ 3260 schedule_reset(priv); 3261 } 3262 3263 if (inta & IPW2100_INTA_PARITY_ERROR) { 3264 printk(KERN_ERR DRV_NAME 3265 ": ***** PARITY ERROR INTERRUPT !!!!\n"); 3266 priv->inta_other++; 3267 write_register(dev, IPW_REG_INTA, IPW2100_INTA_PARITY_ERROR); 3268 } 3269 3270 if (inta & IPW2100_INTA_RX_TRANSFER) { 3271 IPW_DEBUG_ISR("RX interrupt\n"); 3272 3273 priv->rx_interrupts++; 3274 3275 write_register(dev, IPW_REG_INTA, IPW2100_INTA_RX_TRANSFER); 3276 3277 __ipw2100_rx_process(priv); 3278 __ipw2100_tx_complete(priv); 3279 } 3280 3281 if (inta & IPW2100_INTA_TX_TRANSFER) { 3282 IPW_DEBUG_ISR("TX interrupt\n"); 3283 3284 priv->tx_interrupts++; 3285 3286 write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_TRANSFER); 3287 3288 __ipw2100_tx_complete(priv); 3289 ipw2100_tx_send_commands(priv); 3290 ipw2100_tx_send_data(priv); 3291 } 3292 3293 if (inta & IPW2100_INTA_TX_COMPLETE) { 3294 IPW_DEBUG_ISR("TX complete\n"); 3295 priv->inta_other++; 3296 write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_COMPLETE); 3297 3298 __ipw2100_tx_complete(priv); 3299 } 3300 3301 if (inta & IPW2100_INTA_EVENT_INTERRUPT) { 3302 /* ipw2100_handle_event(dev); */ 3303 priv->inta_other++; 3304 write_register(dev, IPW_REG_INTA, IPW2100_INTA_EVENT_INTERRUPT); 3305 } 3306 3307 if (inta & IPW2100_INTA_FW_INIT_DONE) { 3308 IPW_DEBUG_ISR("FW init done interrupt\n"); 3309 priv->inta_other++; 3310 3311 read_register(dev, IPW_REG_INTA, &tmp); 3312 if (tmp & (IPW2100_INTA_FATAL_ERROR | 3313 IPW2100_INTA_PARITY_ERROR)) { 3314 write_register(dev, IPW_REG_INTA, 3315 IPW2100_INTA_FATAL_ERROR | 3316 IPW2100_INTA_PARITY_ERROR); 3317 } 3318 3319 write_register(dev, IPW_REG_INTA, IPW2100_INTA_FW_INIT_DONE); 3320 } 3321 3322 if (inta & IPW2100_INTA_STATUS_CHANGE) { 3323 IPW_DEBUG_ISR("Status change interrupt\n"); 3324 priv->inta_other++; 3325 write_register(dev, IPW_REG_INTA, IPW2100_INTA_STATUS_CHANGE); 3326 } 3327 3328 if (inta & IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE) { 3329 IPW_DEBUG_ISR("slave host mode interrupt\n"); 3330 priv->inta_other++; 3331 write_register(dev, IPW_REG_INTA, 3332 IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE); 3333 } 3334 3335 priv->in_isr--; 3336 ipw2100_enable_interrupts(priv); 3337 3338 spin_unlock_irqrestore(&priv->low_lock, flags); 3339 3340 IPW_DEBUG_ISR("exit\n"); 3341 } 3342 3343 static irqreturn_t ipw2100_interrupt(int irq, void *data) 3344 { 3345 struct ipw2100_priv *priv = data; 3346 u32 inta, inta_mask; 3347 3348 if (!data) 3349 return IRQ_NONE; 3350 3351 spin_lock(&priv->low_lock); 3352 3353 /* We check to see if we should be ignoring interrupts before 3354 * we touch the hardware. During ucode load if we try and handle 3355 * an interrupt we can cause keyboard problems as well as cause 3356 * the ucode to fail to initialize */ 3357 if (!(priv->status & STATUS_INT_ENABLED)) { 3358 /* Shared IRQ */ 3359 goto none; 3360 } 3361 3362 read_register(priv->net_dev, IPW_REG_INTA_MASK, &inta_mask); 3363 read_register(priv->net_dev, IPW_REG_INTA, &inta); 3364 3365 if (inta == 0xFFFFFFFF) { 3366 /* Hardware disappeared */ 3367 printk(KERN_WARNING DRV_NAME ": IRQ INTA == 0xFFFFFFFF\n"); 3368 goto none; 3369 } 3370 3371 inta &= IPW_INTERRUPT_MASK; 3372 3373 if (!(inta & inta_mask)) { 3374 /* Shared interrupt */ 3375 goto none; 3376 } 3377 3378 /* We disable the hardware interrupt here just to prevent unneeded 3379 * calls to be made. We disable this again within the actual 3380 * work tasklet, so if another part of the code re-enables the 3381 * interrupt, that is fine */ 3382 ipw2100_disable_interrupts(priv); 3383 3384 tasklet_schedule(&priv->irq_tasklet); 3385 spin_unlock(&priv->low_lock); 3386 3387 return IRQ_HANDLED; 3388 none: 3389 spin_unlock(&priv->low_lock); 3390 return IRQ_NONE; 3391 } 3392 3393 static netdev_tx_t ipw2100_tx(struct libipw_txb *txb, 3394 struct net_device *dev, int pri) 3395 { 3396 struct ipw2100_priv *priv = libipw_priv(dev); 3397 struct list_head *element; 3398 struct ipw2100_tx_packet *packet; 3399 unsigned long flags; 3400 3401 spin_lock_irqsave(&priv->low_lock, flags); 3402 3403 if (!(priv->status & STATUS_ASSOCIATED)) { 3404 IPW_DEBUG_INFO("Can not transmit when not connected.\n"); 3405 priv->net_dev->stats.tx_carrier_errors++; 3406 netif_stop_queue(dev); 3407 goto fail_unlock; 3408 } 3409 3410 if (list_empty(&priv->tx_free_list)) 3411 goto fail_unlock; 3412 3413 element = priv->tx_free_list.next; 3414 packet = list_entry(element, struct ipw2100_tx_packet, list); 3415 3416 packet->info.d_struct.txb = txb; 3417 3418 IPW_DEBUG_TX("Sending fragment (%d bytes):\n", txb->fragments[0]->len); 3419 printk_buf(IPW_DL_TX, txb->fragments[0]->data, txb->fragments[0]->len); 3420 3421 packet->jiffy_start = jiffies; 3422 3423 list_del(element); 3424 DEC_STAT(&priv->tx_free_stat); 3425 3426 list_add_tail(element, &priv->tx_pend_list); 3427 INC_STAT(&priv->tx_pend_stat); 3428 3429 ipw2100_tx_send_data(priv); 3430 3431 spin_unlock_irqrestore(&priv->low_lock, flags); 3432 return NETDEV_TX_OK; 3433 3434 fail_unlock: 3435 netif_stop_queue(dev); 3436 spin_unlock_irqrestore(&priv->low_lock, flags); 3437 return NETDEV_TX_BUSY; 3438 } 3439 3440 static int ipw2100_msg_allocate(struct ipw2100_priv *priv) 3441 { 3442 int i, j, err = -EINVAL; 3443 void *v; 3444 dma_addr_t p; 3445 3446 priv->msg_buffers = 3447 kmalloc(IPW_COMMAND_POOL_SIZE * sizeof(struct ipw2100_tx_packet), 3448 GFP_KERNEL); 3449 if (!priv->msg_buffers) 3450 return -ENOMEM; 3451 3452 for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { 3453 v = pci_alloc_consistent(priv->pci_dev, 3454 sizeof(struct ipw2100_cmd_header), &p); 3455 if (!v) { 3456 printk(KERN_ERR DRV_NAME ": " 3457 "%s: PCI alloc failed for msg " 3458 "buffers.\n", priv->net_dev->name); 3459 err = -ENOMEM; 3460 break; 3461 } 3462 3463 memset(v, 0, sizeof(struct ipw2100_cmd_header)); 3464 3465 priv->msg_buffers[i].type = COMMAND; 3466 priv->msg_buffers[i].info.c_struct.cmd = 3467 (struct ipw2100_cmd_header *)v; 3468 priv->msg_buffers[i].info.c_struct.cmd_phys = p; 3469 } 3470 3471 if (i == IPW_COMMAND_POOL_SIZE) 3472 return 0; 3473 3474 for (j = 0; j < i; j++) { 3475 pci_free_consistent(priv->pci_dev, 3476 sizeof(struct ipw2100_cmd_header), 3477 priv->msg_buffers[j].info.c_struct.cmd, 3478 priv->msg_buffers[j].info.c_struct. 3479 cmd_phys); 3480 } 3481 3482 kfree(priv->msg_buffers); 3483 priv->msg_buffers = NULL; 3484 3485 return err; 3486 } 3487 3488 static int ipw2100_msg_initialize(struct ipw2100_priv *priv) 3489 { 3490 int i; 3491 3492 INIT_LIST_HEAD(&priv->msg_free_list); 3493 INIT_LIST_HEAD(&priv->msg_pend_list); 3494 3495 for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) 3496 list_add_tail(&priv->msg_buffers[i].list, &priv->msg_free_list); 3497 SET_STAT(&priv->msg_free_stat, i); 3498 3499 return 0; 3500 } 3501 3502 static void ipw2100_msg_free(struct ipw2100_priv *priv) 3503 { 3504 int i; 3505 3506 if (!priv->msg_buffers) 3507 return; 3508 3509 for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { 3510 pci_free_consistent(priv->pci_dev, 3511 sizeof(struct ipw2100_cmd_header), 3512 priv->msg_buffers[i].info.c_struct.cmd, 3513 priv->msg_buffers[i].info.c_struct. 3514 cmd_phys); 3515 } 3516 3517 kfree(priv->msg_buffers); 3518 priv->msg_buffers = NULL; 3519 } 3520 3521 static ssize_t show_pci(struct device *d, struct device_attribute *attr, 3522 char *buf) 3523 { 3524 struct pci_dev *pci_dev = container_of(d, struct pci_dev, dev); 3525 char *out = buf; 3526 int i, j; 3527 u32 val; 3528 3529 for (i = 0; i < 16; i++) { 3530 out += sprintf(out, "[%08X] ", i * 16); 3531 for (j = 0; j < 16; j += 4) { 3532 pci_read_config_dword(pci_dev, i * 16 + j, &val); 3533 out += sprintf(out, "%08X ", val); 3534 } 3535 out += sprintf(out, "\n"); 3536 } 3537 3538 return out - buf; 3539 } 3540 3541 static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL); 3542 3543 static ssize_t show_cfg(struct device *d, struct device_attribute *attr, 3544 char *buf) 3545 { 3546 struct ipw2100_priv *p = dev_get_drvdata(d); 3547 return sprintf(buf, "0x%08x\n", (int)p->config); 3548 } 3549 3550 static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); 3551 3552 static ssize_t show_status(struct device *d, struct device_attribute *attr, 3553 char *buf) 3554 { 3555 struct ipw2100_priv *p = dev_get_drvdata(d); 3556 return sprintf(buf, "0x%08x\n", (int)p->status); 3557 } 3558 3559 static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); 3560 3561 static ssize_t show_capability(struct device *d, struct device_attribute *attr, 3562 char *buf) 3563 { 3564 struct ipw2100_priv *p = dev_get_drvdata(d); 3565 return sprintf(buf, "0x%08x\n", (int)p->capability); 3566 } 3567 3568 static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL); 3569 3570 #define IPW2100_REG(x) { IPW_ ##x, #x } 3571 static const struct { 3572 u32 addr; 3573 const char *name; 3574 } hw_data[] = { 3575 IPW2100_REG(REG_GP_CNTRL), 3576 IPW2100_REG(REG_GPIO), 3577 IPW2100_REG(REG_INTA), 3578 IPW2100_REG(REG_INTA_MASK), IPW2100_REG(REG_RESET_REG),}; 3579 #define IPW2100_NIC(x, s) { x, #x, s } 3580 static const struct { 3581 u32 addr; 3582 const char *name; 3583 size_t size; 3584 } nic_data[] = { 3585 IPW2100_NIC(IPW2100_CONTROL_REG, 2), 3586 IPW2100_NIC(0x210014, 1), IPW2100_NIC(0x210000, 1),}; 3587 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 3588 static const struct { 3589 u8 index; 3590 const char *name; 3591 const char *desc; 3592 } ord_data[] = { 3593 IPW2100_ORD(STAT_TX_HOST_REQUESTS, "requested Host Tx's (MSDU)"), 3594 IPW2100_ORD(STAT_TX_HOST_COMPLETE, 3595 "successful Host Tx's (MSDU)"), 3596 IPW2100_ORD(STAT_TX_DIR_DATA, 3597 "successful Directed Tx's (MSDU)"), 3598 IPW2100_ORD(STAT_TX_DIR_DATA1, 3599 "successful Directed Tx's (MSDU) @ 1MB"), 3600 IPW2100_ORD(STAT_TX_DIR_DATA2, 3601 "successful Directed Tx's (MSDU) @ 2MB"), 3602 IPW2100_ORD(STAT_TX_DIR_DATA5_5, 3603 "successful Directed Tx's (MSDU) @ 5_5MB"), 3604 IPW2100_ORD(STAT_TX_DIR_DATA11, 3605 "successful Directed Tx's (MSDU) @ 11MB"), 3606 IPW2100_ORD(STAT_TX_NODIR_DATA1, 3607 "successful Non_Directed Tx's (MSDU) @ 1MB"), 3608 IPW2100_ORD(STAT_TX_NODIR_DATA2, 3609 "successful Non_Directed Tx's (MSDU) @ 2MB"), 3610 IPW2100_ORD(STAT_TX_NODIR_DATA5_5, 3611 "successful Non_Directed Tx's (MSDU) @ 5.5MB"), 3612 IPW2100_ORD(STAT_TX_NODIR_DATA11, 3613 "successful Non_Directed Tx's (MSDU) @ 11MB"), 3614 IPW2100_ORD(STAT_NULL_DATA, "successful NULL data Tx's"), 3615 IPW2100_ORD(STAT_TX_RTS, "successful Tx RTS"), 3616 IPW2100_ORD(STAT_TX_CTS, "successful Tx CTS"), 3617 IPW2100_ORD(STAT_TX_ACK, "successful Tx ACK"), 3618 IPW2100_ORD(STAT_TX_ASSN, "successful Association Tx's"), 3619 IPW2100_ORD(STAT_TX_ASSN_RESP, 3620 "successful Association response Tx's"), 3621 IPW2100_ORD(STAT_TX_REASSN, 3622 "successful Reassociation Tx's"), 3623 IPW2100_ORD(STAT_TX_REASSN_RESP, 3624 "successful Reassociation response Tx's"), 3625 IPW2100_ORD(STAT_TX_PROBE, 3626 "probes successfully transmitted"), 3627 IPW2100_ORD(STAT_TX_PROBE_RESP, 3628 "probe responses successfully transmitted"), 3629 IPW2100_ORD(STAT_TX_BEACON, "tx beacon"), 3630 IPW2100_ORD(STAT_TX_ATIM, "Tx ATIM"), 3631 IPW2100_ORD(STAT_TX_DISASSN, 3632 "successful Disassociation TX"), 3633 IPW2100_ORD(STAT_TX_AUTH, "successful Authentication Tx"), 3634 IPW2100_ORD(STAT_TX_DEAUTH, 3635 "successful Deauthentication TX"), 3636 IPW2100_ORD(STAT_TX_TOTAL_BYTES, 3637 "Total successful Tx data bytes"), 3638 IPW2100_ORD(STAT_TX_RETRIES, "Tx retries"), 3639 IPW2100_ORD(STAT_TX_RETRY1, "Tx retries at 1MBPS"), 3640 IPW2100_ORD(STAT_TX_RETRY2, "Tx retries at 2MBPS"), 3641 IPW2100_ORD(STAT_TX_RETRY5_5, "Tx retries at 5.5MBPS"), 3642 IPW2100_ORD(STAT_TX_RETRY11, "Tx retries at 11MBPS"), 3643 IPW2100_ORD(STAT_TX_FAILURES, "Tx Failures"), 3644 IPW2100_ORD(STAT_TX_MAX_TRIES_IN_HOP, 3645 "times max tries in a hop failed"), 3646 IPW2100_ORD(STAT_TX_DISASSN_FAIL, 3647 "times disassociation failed"), 3648 IPW2100_ORD(STAT_TX_ERR_CTS, "missed/bad CTS frames"), 3649 IPW2100_ORD(STAT_TX_ERR_ACK, "tx err due to acks"), 3650 IPW2100_ORD(STAT_RX_HOST, "packets passed to host"), 3651 IPW2100_ORD(STAT_RX_DIR_DATA, "directed packets"), 3652 IPW2100_ORD(STAT_RX_DIR_DATA1, "directed packets at 1MB"), 3653 IPW2100_ORD(STAT_RX_DIR_DATA2, "directed packets at 2MB"), 3654 IPW2100_ORD(STAT_RX_DIR_DATA5_5, 3655 "directed packets at 5.5MB"), 3656 IPW2100_ORD(STAT_RX_DIR_DATA11, "directed packets at 11MB"), 3657 IPW2100_ORD(STAT_RX_NODIR_DATA, "nondirected packets"), 3658 IPW2100_ORD(STAT_RX_NODIR_DATA1, 3659 "nondirected packets at 1MB"), 3660 IPW2100_ORD(STAT_RX_NODIR_DATA2, 3661 "nondirected packets at 2MB"), 3662 IPW2100_ORD(STAT_RX_NODIR_DATA5_5, 3663 "nondirected packets at 5.5MB"), 3664 IPW2100_ORD(STAT_RX_NODIR_DATA11, 3665 "nondirected packets at 11MB"), 3666 IPW2100_ORD(STAT_RX_NULL_DATA, "null data rx's"), 3667 IPW2100_ORD(STAT_RX_RTS, "Rx RTS"), IPW2100_ORD(STAT_RX_CTS, 3668 "Rx CTS"), 3669 IPW2100_ORD(STAT_RX_ACK, "Rx ACK"), 3670 IPW2100_ORD(STAT_RX_CFEND, "Rx CF End"), 3671 IPW2100_ORD(STAT_RX_CFEND_ACK, "Rx CF End + CF Ack"), 3672 IPW2100_ORD(STAT_RX_ASSN, "Association Rx's"), 3673 IPW2100_ORD(STAT_RX_ASSN_RESP, "Association response Rx's"), 3674 IPW2100_ORD(STAT_RX_REASSN, "Reassociation Rx's"), 3675 IPW2100_ORD(STAT_RX_REASSN_RESP, 3676 "Reassociation response Rx's"), 3677 IPW2100_ORD(STAT_RX_PROBE, "probe Rx's"), 3678 IPW2100_ORD(STAT_RX_PROBE_RESP, "probe response Rx's"), 3679 IPW2100_ORD(STAT_RX_BEACON, "Rx beacon"), 3680 IPW2100_ORD(STAT_RX_ATIM, "Rx ATIM"), 3681 IPW2100_ORD(STAT_RX_DISASSN, "disassociation Rx"), 3682 IPW2100_ORD(STAT_RX_AUTH, "authentication Rx"), 3683 IPW2100_ORD(STAT_RX_DEAUTH, "deauthentication Rx"), 3684 IPW2100_ORD(STAT_RX_TOTAL_BYTES, 3685 "Total rx data bytes received"), 3686 IPW2100_ORD(STAT_RX_ERR_CRC, "packets with Rx CRC error"), 3687 IPW2100_ORD(STAT_RX_ERR_CRC1, "Rx CRC errors at 1MB"), 3688 IPW2100_ORD(STAT_RX_ERR_CRC2, "Rx CRC errors at 2MB"), 3689 IPW2100_ORD(STAT_RX_ERR_CRC5_5, "Rx CRC errors at 5.5MB"), 3690 IPW2100_ORD(STAT_RX_ERR_CRC11, "Rx CRC errors at 11MB"), 3691 IPW2100_ORD(STAT_RX_DUPLICATE1, 3692 "duplicate rx packets at 1MB"), 3693 IPW2100_ORD(STAT_RX_DUPLICATE2, 3694 "duplicate rx packets at 2MB"), 3695 IPW2100_ORD(STAT_RX_DUPLICATE5_5, 3696 "duplicate rx packets at 5.5MB"), 3697 IPW2100_ORD(STAT_RX_DUPLICATE11, 3698 "duplicate rx packets at 11MB"), 3699 IPW2100_ORD(STAT_RX_DUPLICATE, "duplicate rx packets"), 3700 IPW2100_ORD(PERS_DB_LOCK, "locking fw permanent db"), 3701 IPW2100_ORD(PERS_DB_SIZE, "size of fw permanent db"), 3702 IPW2100_ORD(PERS_DB_ADDR, "address of fw permanent db"), 3703 IPW2100_ORD(STAT_RX_INVALID_PROTOCOL, 3704 "rx frames with invalid protocol"), 3705 IPW2100_ORD(SYS_BOOT_TIME, "Boot time"), 3706 IPW2100_ORD(STAT_RX_NO_BUFFER, 3707 "rx frames rejected due to no buffer"), 3708 IPW2100_ORD(STAT_RX_MISSING_FRAG, 3709 "rx frames dropped due to missing fragment"), 3710 IPW2100_ORD(STAT_RX_ORPHAN_FRAG, 3711 "rx frames dropped due to non-sequential fragment"), 3712 IPW2100_ORD(STAT_RX_ORPHAN_FRAME, 3713 "rx frames dropped due to unmatched 1st frame"), 3714 IPW2100_ORD(STAT_RX_FRAG_AGEOUT, 3715 "rx frames dropped due to uncompleted frame"), 3716 IPW2100_ORD(STAT_RX_ICV_ERRORS, 3717 "ICV errors during decryption"), 3718 IPW2100_ORD(STAT_PSP_SUSPENSION, "times adapter suspended"), 3719 IPW2100_ORD(STAT_PSP_BCN_TIMEOUT, "beacon timeout"), 3720 IPW2100_ORD(STAT_PSP_POLL_TIMEOUT, 3721 "poll response timeouts"), 3722 IPW2100_ORD(STAT_PSP_NONDIR_TIMEOUT, 3723 "timeouts waiting for last {broad,multi}cast pkt"), 3724 IPW2100_ORD(STAT_PSP_RX_DTIMS, "PSP DTIMs received"), 3725 IPW2100_ORD(STAT_PSP_RX_TIMS, "PSP TIMs received"), 3726 IPW2100_ORD(STAT_PSP_STATION_ID, "PSP Station ID"), 3727 IPW2100_ORD(LAST_ASSN_TIME, "RTC time of last association"), 3728 IPW2100_ORD(STAT_PERCENT_MISSED_BCNS, 3729 "current calculation of % missed beacons"), 3730 IPW2100_ORD(STAT_PERCENT_RETRIES, 3731 "current calculation of % missed tx retries"), 3732 IPW2100_ORD(ASSOCIATED_AP_PTR, 3733 "0 if not associated, else pointer to AP table entry"), 3734 IPW2100_ORD(AVAILABLE_AP_CNT, 3735 "AP's decsribed in the AP table"), 3736 IPW2100_ORD(AP_LIST_PTR, "Ptr to list of available APs"), 3737 IPW2100_ORD(STAT_AP_ASSNS, "associations"), 3738 IPW2100_ORD(STAT_ASSN_FAIL, "association failures"), 3739 IPW2100_ORD(STAT_ASSN_RESP_FAIL, 3740 "failures due to response fail"), 3741 IPW2100_ORD(STAT_FULL_SCANS, "full scans"), 3742 IPW2100_ORD(CARD_DISABLED, "Card Disabled"), 3743 IPW2100_ORD(STAT_ROAM_INHIBIT, 3744 "times roaming was inhibited due to activity"), 3745 IPW2100_ORD(RSSI_AT_ASSN, 3746 "RSSI of associated AP at time of association"), 3747 IPW2100_ORD(STAT_ASSN_CAUSE1, 3748 "reassociation: no probe response or TX on hop"), 3749 IPW2100_ORD(STAT_ASSN_CAUSE2, 3750 "reassociation: poor tx/rx quality"), 3751 IPW2100_ORD(STAT_ASSN_CAUSE3, 3752 "reassociation: tx/rx quality (excessive AP load"), 3753 IPW2100_ORD(STAT_ASSN_CAUSE4, 3754 "reassociation: AP RSSI level"), 3755 IPW2100_ORD(STAT_ASSN_CAUSE5, 3756 "reassociations due to load leveling"), 3757 IPW2100_ORD(STAT_AUTH_FAIL, "times authentication failed"), 3758 IPW2100_ORD(STAT_AUTH_RESP_FAIL, 3759 "times authentication response failed"), 3760 IPW2100_ORD(STATION_TABLE_CNT, 3761 "entries in association table"), 3762 IPW2100_ORD(RSSI_AVG_CURR, "Current avg RSSI"), 3763 IPW2100_ORD(POWER_MGMT_MODE, "Power mode - 0=CAM, 1=PSP"), 3764 IPW2100_ORD(COUNTRY_CODE, 3765 "IEEE country code as recv'd from beacon"), 3766 IPW2100_ORD(COUNTRY_CHANNELS, 3767 "channels supported by country"), 3768 IPW2100_ORD(RESET_CNT, "adapter resets (warm)"), 3769 IPW2100_ORD(BEACON_INTERVAL, "Beacon interval"), 3770 IPW2100_ORD(ANTENNA_DIVERSITY, 3771 "TRUE if antenna diversity is disabled"), 3772 IPW2100_ORD(DTIM_PERIOD, "beacon intervals between DTIMs"), 3773 IPW2100_ORD(OUR_FREQ, 3774 "current radio freq lower digits - channel ID"), 3775 IPW2100_ORD(RTC_TIME, "current RTC time"), 3776 IPW2100_ORD(PORT_TYPE, "operating mode"), 3777 IPW2100_ORD(CURRENT_TX_RATE, "current tx rate"), 3778 IPW2100_ORD(SUPPORTED_RATES, "supported tx rates"), 3779 IPW2100_ORD(ATIM_WINDOW, "current ATIM Window"), 3780 IPW2100_ORD(BASIC_RATES, "basic tx rates"), 3781 IPW2100_ORD(NIC_HIGHEST_RATE, "NIC highest tx rate"), 3782 IPW2100_ORD(AP_HIGHEST_RATE, "AP highest tx rate"), 3783 IPW2100_ORD(CAPABILITIES, 3784 "Management frame capability field"), 3785 IPW2100_ORD(AUTH_TYPE, "Type of authentication"), 3786 IPW2100_ORD(RADIO_TYPE, "Adapter card platform type"), 3787 IPW2100_ORD(RTS_THRESHOLD, 3788 "Min packet length for RTS handshaking"), 3789 IPW2100_ORD(INT_MODE, "International mode"), 3790 IPW2100_ORD(FRAGMENTATION_THRESHOLD, 3791 "protocol frag threshold"), 3792 IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_START_ADDRESS, 3793 "EEPROM offset in SRAM"), 3794 IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_SIZE, 3795 "EEPROM size in SRAM"), 3796 IPW2100_ORD(EEPROM_SKU_CAPABILITY, "EEPROM SKU Capability"), 3797 IPW2100_ORD(EEPROM_IBSS_11B_CHANNELS, 3798 "EEPROM IBSS 11b channel set"), 3799 IPW2100_ORD(MAC_VERSION, "MAC Version"), 3800 IPW2100_ORD(MAC_REVISION, "MAC Revision"), 3801 IPW2100_ORD(RADIO_VERSION, "Radio Version"), 3802 IPW2100_ORD(NIC_MANF_DATE_TIME, "MANF Date/Time STAMP"), 3803 IPW2100_ORD(UCODE_VERSION, "Ucode Version"),}; 3804 3805 static ssize_t show_registers(struct device *d, struct device_attribute *attr, 3806 char *buf) 3807 { 3808 int i; 3809 struct ipw2100_priv *priv = dev_get_drvdata(d); 3810 struct net_device *dev = priv->net_dev; 3811 char *out = buf; 3812 u32 val = 0; 3813 3814 out += sprintf(out, "%30s [Address ] : Hex\n", "Register"); 3815 3816 for (i = 0; i < ARRAY_SIZE(hw_data); i++) { 3817 read_register(dev, hw_data[i].addr, &val); 3818 out += sprintf(out, "%30s [%08X] : %08X\n", 3819 hw_data[i].name, hw_data[i].addr, val); 3820 } 3821 3822 return out - buf; 3823 } 3824 3825 static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL); 3826 3827 static ssize_t show_hardware(struct device *d, struct device_attribute *attr, 3828 char *buf) 3829 { 3830 struct ipw2100_priv *priv = dev_get_drvdata(d); 3831 struct net_device *dev = priv->net_dev; 3832 char *out = buf; 3833 int i; 3834 3835 out += sprintf(out, "%30s [Address ] : Hex\n", "NIC entry"); 3836 3837 for (i = 0; i < ARRAY_SIZE(nic_data); i++) { 3838 u8 tmp8; 3839 u16 tmp16; 3840 u32 tmp32; 3841 3842 switch (nic_data[i].size) { 3843 case 1: 3844 read_nic_byte(dev, nic_data[i].addr, &tmp8); 3845 out += sprintf(out, "%30s [%08X] : %02X\n", 3846 nic_data[i].name, nic_data[i].addr, 3847 tmp8); 3848 break; 3849 case 2: 3850 read_nic_word(dev, nic_data[i].addr, &tmp16); 3851 out += sprintf(out, "%30s [%08X] : %04X\n", 3852 nic_data[i].name, nic_data[i].addr, 3853 tmp16); 3854 break; 3855 case 4: 3856 read_nic_dword(dev, nic_data[i].addr, &tmp32); 3857 out += sprintf(out, "%30s [%08X] : %08X\n", 3858 nic_data[i].name, nic_data[i].addr, 3859 tmp32); 3860 break; 3861 } 3862 } 3863 return out - buf; 3864 } 3865 3866 static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL); 3867 3868 static ssize_t show_memory(struct device *d, struct device_attribute *attr, 3869 char *buf) 3870 { 3871 struct ipw2100_priv *priv = dev_get_drvdata(d); 3872 struct net_device *dev = priv->net_dev; 3873 static unsigned long loop = 0; 3874 int len = 0; 3875 u32 buffer[4]; 3876 int i; 3877 char line[81]; 3878 3879 if (loop >= 0x30000) 3880 loop = 0; 3881 3882 /* sysfs provides us PAGE_SIZE buffer */ 3883 while (len < PAGE_SIZE - 128 && loop < 0x30000) { 3884 3885 if (priv->snapshot[0]) 3886 for (i = 0; i < 4; i++) 3887 buffer[i] = 3888 *(u32 *) SNAPSHOT_ADDR(loop + i * 4); 3889 else 3890 for (i = 0; i < 4; i++) 3891 read_nic_dword(dev, loop + i * 4, &buffer[i]); 3892 3893 if (priv->dump_raw) 3894 len += sprintf(buf + len, 3895 "%c%c%c%c" 3896 "%c%c%c%c" 3897 "%c%c%c%c" 3898 "%c%c%c%c", 3899 ((u8 *) buffer)[0x0], 3900 ((u8 *) buffer)[0x1], 3901 ((u8 *) buffer)[0x2], 3902 ((u8 *) buffer)[0x3], 3903 ((u8 *) buffer)[0x4], 3904 ((u8 *) buffer)[0x5], 3905 ((u8 *) buffer)[0x6], 3906 ((u8 *) buffer)[0x7], 3907 ((u8 *) buffer)[0x8], 3908 ((u8 *) buffer)[0x9], 3909 ((u8 *) buffer)[0xa], 3910 ((u8 *) buffer)[0xb], 3911 ((u8 *) buffer)[0xc], 3912 ((u8 *) buffer)[0xd], 3913 ((u8 *) buffer)[0xe], 3914 ((u8 *) buffer)[0xf]); 3915 else 3916 len += sprintf(buf + len, "%s\n", 3917 snprint_line(line, sizeof(line), 3918 (u8 *) buffer, 16, loop)); 3919 loop += 16; 3920 } 3921 3922 return len; 3923 } 3924 3925 static ssize_t store_memory(struct device *d, struct device_attribute *attr, 3926 const char *buf, size_t count) 3927 { 3928 struct ipw2100_priv *priv = dev_get_drvdata(d); 3929 struct net_device *dev = priv->net_dev; 3930 const char *p = buf; 3931 3932 (void)dev; /* kill unused-var warning for debug-only code */ 3933 3934 if (count < 1) 3935 return count; 3936 3937 if (p[0] == '1' || 3938 (count >= 2 && tolower(p[0]) == 'o' && tolower(p[1]) == 'n')) { 3939 IPW_DEBUG_INFO("%s: Setting memory dump to RAW mode.\n", 3940 dev->name); 3941 priv->dump_raw = 1; 3942 3943 } else if (p[0] == '0' || (count >= 2 && tolower(p[0]) == 'o' && 3944 tolower(p[1]) == 'f')) { 3945 IPW_DEBUG_INFO("%s: Setting memory dump to HEX mode.\n", 3946 dev->name); 3947 priv->dump_raw = 0; 3948 3949 } else if (tolower(p[0]) == 'r') { 3950 IPW_DEBUG_INFO("%s: Resetting firmware snapshot.\n", dev->name); 3951 ipw2100_snapshot_free(priv); 3952 3953 } else 3954 IPW_DEBUG_INFO("%s: Usage: 0|on = HEX, 1|off = RAW, " 3955 "reset = clear memory snapshot\n", dev->name); 3956 3957 return count; 3958 } 3959 3960 static DEVICE_ATTR(memory, S_IWUSR | S_IRUGO, show_memory, store_memory); 3961 3962 static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, 3963 char *buf) 3964 { 3965 struct ipw2100_priv *priv = dev_get_drvdata(d); 3966 u32 val = 0; 3967 int len = 0; 3968 u32 val_len; 3969 static int loop = 0; 3970 3971 if (priv->status & STATUS_RF_KILL_MASK) 3972 return 0; 3973 3974 if (loop >= ARRAY_SIZE(ord_data)) 3975 loop = 0; 3976 3977 /* sysfs provides us PAGE_SIZE buffer */ 3978 while (len < PAGE_SIZE - 128 && loop < ARRAY_SIZE(ord_data)) { 3979 val_len = sizeof(u32); 3980 3981 if (ipw2100_get_ordinal(priv, ord_data[loop].index, &val, 3982 &val_len)) 3983 len += sprintf(buf + len, "[0x%02X] = ERROR %s\n", 3984 ord_data[loop].index, 3985 ord_data[loop].desc); 3986 else 3987 len += sprintf(buf + len, "[0x%02X] = 0x%08X %s\n", 3988 ord_data[loop].index, val, 3989 ord_data[loop].desc); 3990 loop++; 3991 } 3992 3993 return len; 3994 } 3995 3996 static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL); 3997 3998 static ssize_t show_stats(struct device *d, struct device_attribute *attr, 3999 char *buf) 4000 { 4001 struct ipw2100_priv *priv = dev_get_drvdata(d); 4002 char *out = buf; 4003 4004 out += sprintf(out, "interrupts: %d {tx: %d, rx: %d, other: %d}\n", 4005 priv->interrupts, priv->tx_interrupts, 4006 priv->rx_interrupts, priv->inta_other); 4007 out += sprintf(out, "firmware resets: %d\n", priv->resets); 4008 out += sprintf(out, "firmware hangs: %d\n", priv->hangs); 4009 #ifdef CONFIG_IPW2100_DEBUG 4010 out += sprintf(out, "packet mismatch image: %s\n", 4011 priv->snapshot[0] ? "YES" : "NO"); 4012 #endif 4013 4014 return out - buf; 4015 } 4016 4017 static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); 4018 4019 static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) 4020 { 4021 int err; 4022 4023 if (mode == priv->ieee->iw_mode) 4024 return 0; 4025 4026 err = ipw2100_disable_adapter(priv); 4027 if (err) { 4028 printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", 4029 priv->net_dev->name, err); 4030 return err; 4031 } 4032 4033 switch (mode) { 4034 case IW_MODE_INFRA: 4035 priv->net_dev->type = ARPHRD_ETHER; 4036 break; 4037 case IW_MODE_ADHOC: 4038 priv->net_dev->type = ARPHRD_ETHER; 4039 break; 4040 #ifdef CONFIG_IPW2100_MONITOR 4041 case IW_MODE_MONITOR: 4042 priv->last_mode = priv->ieee->iw_mode; 4043 priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; 4044 break; 4045 #endif /* CONFIG_IPW2100_MONITOR */ 4046 } 4047 4048 priv->ieee->iw_mode = mode; 4049 4050 #ifdef CONFIG_PM 4051 /* Indicate ipw2100_download_firmware download firmware 4052 * from disk instead of memory. */ 4053 ipw2100_firmware.version = 0; 4054 #endif 4055 4056 printk(KERN_INFO "%s: Resetting on mode change.\n", priv->net_dev->name); 4057 priv->reset_backoff = 0; 4058 schedule_reset(priv); 4059 4060 return 0; 4061 } 4062 4063 static ssize_t show_internals(struct device *d, struct device_attribute *attr, 4064 char *buf) 4065 { 4066 struct ipw2100_priv *priv = dev_get_drvdata(d); 4067 int len = 0; 4068 4069 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 4070 4071 if (priv->status & STATUS_ASSOCIATED) 4072 len += sprintf(buf + len, "connected: %lu\n", 4073 get_seconds() - priv->connect_start); 4074 else 4075 len += sprintf(buf + len, "not connected\n"); 4076 4077 DUMP_VAR(ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx], "p"); 4078 DUMP_VAR(status, "08lx"); 4079 DUMP_VAR(config, "08lx"); 4080 DUMP_VAR(capability, "08lx"); 4081 4082 len += 4083 sprintf(buf + len, "last_rtc: %lu\n", 4084 (unsigned long)priv->last_rtc); 4085 4086 DUMP_VAR(fatal_error, "d"); 4087 DUMP_VAR(stop_hang_check, "d"); 4088 DUMP_VAR(stop_rf_kill, "d"); 4089 DUMP_VAR(messages_sent, "d"); 4090 4091 DUMP_VAR(tx_pend_stat.value, "d"); 4092 DUMP_VAR(tx_pend_stat.hi, "d"); 4093 4094 DUMP_VAR(tx_free_stat.value, "d"); 4095 DUMP_VAR(tx_free_stat.lo, "d"); 4096 4097 DUMP_VAR(msg_free_stat.value, "d"); 4098 DUMP_VAR(msg_free_stat.lo, "d"); 4099 4100 DUMP_VAR(msg_pend_stat.value, "d"); 4101 DUMP_VAR(msg_pend_stat.hi, "d"); 4102 4103 DUMP_VAR(fw_pend_stat.value, "d"); 4104 DUMP_VAR(fw_pend_stat.hi, "d"); 4105 4106 DUMP_VAR(txq_stat.value, "d"); 4107 DUMP_VAR(txq_stat.lo, "d"); 4108 4109 DUMP_VAR(ieee->scans, "d"); 4110 DUMP_VAR(reset_backoff, "d"); 4111 4112 return len; 4113 } 4114 4115 static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL); 4116 4117 static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, 4118 char *buf) 4119 { 4120 struct ipw2100_priv *priv = dev_get_drvdata(d); 4121 char essid[IW_ESSID_MAX_SIZE + 1]; 4122 u8 bssid[ETH_ALEN]; 4123 u32 chan = 0; 4124 char *out = buf; 4125 unsigned int length; 4126 int ret; 4127 4128 if (priv->status & STATUS_RF_KILL_MASK) 4129 return 0; 4130 4131 memset(essid, 0, sizeof(essid)); 4132 memset(bssid, 0, sizeof(bssid)); 4133 4134 length = IW_ESSID_MAX_SIZE; 4135 ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_SSID, essid, &length); 4136 if (ret) 4137 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 4138 __LINE__); 4139 4140 length = sizeof(bssid); 4141 ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, 4142 bssid, &length); 4143 if (ret) 4144 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 4145 __LINE__); 4146 4147 length = sizeof(u32); 4148 ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &length); 4149 if (ret) 4150 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 4151 __LINE__); 4152 4153 out += sprintf(out, "ESSID: %s\n", essid); 4154 out += sprintf(out, "BSSID: %pM\n", bssid); 4155 out += sprintf(out, "Channel: %d\n", chan); 4156 4157 return out - buf; 4158 } 4159 4160 static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL); 4161 4162 #ifdef CONFIG_IPW2100_DEBUG 4163 static ssize_t show_debug_level(struct device_driver *d, char *buf) 4164 { 4165 return sprintf(buf, "0x%08X\n", ipw2100_debug_level); 4166 } 4167 4168 static ssize_t store_debug_level(struct device_driver *d, 4169 const char *buf, size_t count) 4170 { 4171 u32 val; 4172 int ret; 4173 4174 ret = kstrtou32(buf, 0, &val); 4175 if (ret) 4176 IPW_DEBUG_INFO(": %s is not in hex or decimal form.\n", buf); 4177 else 4178 ipw2100_debug_level = val; 4179 4180 return strnlen(buf, count); 4181 } 4182 4183 static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, 4184 store_debug_level); 4185 #endif /* CONFIG_IPW2100_DEBUG */ 4186 4187 static ssize_t show_fatal_error(struct device *d, 4188 struct device_attribute *attr, char *buf) 4189 { 4190 struct ipw2100_priv *priv = dev_get_drvdata(d); 4191 char *out = buf; 4192 int i; 4193 4194 if (priv->fatal_error) 4195 out += sprintf(out, "0x%08X\n", priv->fatal_error); 4196 else 4197 out += sprintf(out, "0\n"); 4198 4199 for (i = 1; i <= IPW2100_ERROR_QUEUE; i++) { 4200 if (!priv->fatal_errors[(priv->fatal_index - i) % 4201 IPW2100_ERROR_QUEUE]) 4202 continue; 4203 4204 out += sprintf(out, "%d. 0x%08X\n", i, 4205 priv->fatal_errors[(priv->fatal_index - i) % 4206 IPW2100_ERROR_QUEUE]); 4207 } 4208 4209 return out - buf; 4210 } 4211 4212 static ssize_t store_fatal_error(struct device *d, 4213 struct device_attribute *attr, const char *buf, 4214 size_t count) 4215 { 4216 struct ipw2100_priv *priv = dev_get_drvdata(d); 4217 schedule_reset(priv); 4218 return count; 4219 } 4220 4221 static DEVICE_ATTR(fatal_error, S_IWUSR | S_IRUGO, show_fatal_error, 4222 store_fatal_error); 4223 4224 static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, 4225 char *buf) 4226 { 4227 struct ipw2100_priv *priv = dev_get_drvdata(d); 4228 return sprintf(buf, "%d\n", priv->ieee->scan_age); 4229 } 4230 4231 static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, 4232 const char *buf, size_t count) 4233 { 4234 struct ipw2100_priv *priv = dev_get_drvdata(d); 4235 struct net_device *dev = priv->net_dev; 4236 unsigned long val; 4237 int ret; 4238 4239 (void)dev; /* kill unused-var warning for debug-only code */ 4240 4241 IPW_DEBUG_INFO("enter\n"); 4242 4243 ret = kstrtoul(buf, 0, &val); 4244 if (ret) { 4245 IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name); 4246 } else { 4247 priv->ieee->scan_age = val; 4248 IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); 4249 } 4250 4251 IPW_DEBUG_INFO("exit\n"); 4252 return strnlen(buf, count); 4253 } 4254 4255 static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); 4256 4257 static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, 4258 char *buf) 4259 { 4260 /* 0 - RF kill not enabled 4261 1 - SW based RF kill active (sysfs) 4262 2 - HW based RF kill active 4263 3 - Both HW and SW baed RF kill active */ 4264 struct ipw2100_priv *priv = dev_get_drvdata(d); 4265 int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | 4266 (rf_kill_active(priv) ? 0x2 : 0x0); 4267 return sprintf(buf, "%i\n", val); 4268 } 4269 4270 static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) 4271 { 4272 if ((disable_radio ? 1 : 0) == 4273 (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) 4274 return 0; 4275 4276 IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", 4277 disable_radio ? "OFF" : "ON"); 4278 4279 mutex_lock(&priv->action_mutex); 4280 4281 if (disable_radio) { 4282 priv->status |= STATUS_RF_KILL_SW; 4283 ipw2100_down(priv); 4284 } else { 4285 priv->status &= ~STATUS_RF_KILL_SW; 4286 if (rf_kill_active(priv)) { 4287 IPW_DEBUG_RF_KILL("Can not turn radio back on - " 4288 "disabled by HW switch\n"); 4289 /* Make sure the RF_KILL check timer is running */ 4290 priv->stop_rf_kill = 0; 4291 mod_delayed_work(system_wq, &priv->rf_kill, 4292 round_jiffies_relative(HZ)); 4293 } else 4294 schedule_reset(priv); 4295 } 4296 4297 mutex_unlock(&priv->action_mutex); 4298 return 1; 4299 } 4300 4301 static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, 4302 const char *buf, size_t count) 4303 { 4304 struct ipw2100_priv *priv = dev_get_drvdata(d); 4305 ipw_radio_kill_sw(priv, buf[0] == '1'); 4306 return count; 4307 } 4308 4309 static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); 4310 4311 static struct attribute *ipw2100_sysfs_entries[] = { 4312 &dev_attr_hardware.attr, 4313 &dev_attr_registers.attr, 4314 &dev_attr_ordinals.attr, 4315 &dev_attr_pci.attr, 4316 &dev_attr_stats.attr, 4317 &dev_attr_internals.attr, 4318 &dev_attr_bssinfo.attr, 4319 &dev_attr_memory.attr, 4320 &dev_attr_scan_age.attr, 4321 &dev_attr_fatal_error.attr, 4322 &dev_attr_rf_kill.attr, 4323 &dev_attr_cfg.attr, 4324 &dev_attr_status.attr, 4325 &dev_attr_capability.attr, 4326 NULL, 4327 }; 4328 4329 static struct attribute_group ipw2100_attribute_group = { 4330 .attrs = ipw2100_sysfs_entries, 4331 }; 4332 4333 static int status_queue_allocate(struct ipw2100_priv *priv, int entries) 4334 { 4335 struct ipw2100_status_queue *q = &priv->status_queue; 4336 4337 IPW_DEBUG_INFO("enter\n"); 4338 4339 q->size = entries * sizeof(struct ipw2100_status); 4340 q->drv = 4341 (struct ipw2100_status *)pci_alloc_consistent(priv->pci_dev, 4342 q->size, &q->nic); 4343 if (!q->drv) { 4344 IPW_DEBUG_WARNING("Can not allocate status queue.\n"); 4345 return -ENOMEM; 4346 } 4347 4348 memset(q->drv, 0, q->size); 4349 4350 IPW_DEBUG_INFO("exit\n"); 4351 4352 return 0; 4353 } 4354 4355 static void status_queue_free(struct ipw2100_priv *priv) 4356 { 4357 IPW_DEBUG_INFO("enter\n"); 4358 4359 if (priv->status_queue.drv) { 4360 pci_free_consistent(priv->pci_dev, priv->status_queue.size, 4361 priv->status_queue.drv, 4362 priv->status_queue.nic); 4363 priv->status_queue.drv = NULL; 4364 } 4365 4366 IPW_DEBUG_INFO("exit\n"); 4367 } 4368 4369 static int bd_queue_allocate(struct ipw2100_priv *priv, 4370 struct ipw2100_bd_queue *q, int entries) 4371 { 4372 IPW_DEBUG_INFO("enter\n"); 4373 4374 memset(q, 0, sizeof(struct ipw2100_bd_queue)); 4375 4376 q->entries = entries; 4377 q->size = entries * sizeof(struct ipw2100_bd); 4378 q->drv = pci_alloc_consistent(priv->pci_dev, q->size, &q->nic); 4379 if (!q->drv) { 4380 IPW_DEBUG_INFO 4381 ("can't allocate shared memory for buffer descriptors\n"); 4382 return -ENOMEM; 4383 } 4384 memset(q->drv, 0, q->size); 4385 4386 IPW_DEBUG_INFO("exit\n"); 4387 4388 return 0; 4389 } 4390 4391 static void bd_queue_free(struct ipw2100_priv *priv, struct ipw2100_bd_queue *q) 4392 { 4393 IPW_DEBUG_INFO("enter\n"); 4394 4395 if (!q) 4396 return; 4397 4398 if (q->drv) { 4399 pci_free_consistent(priv->pci_dev, q->size, q->drv, q->nic); 4400 q->drv = NULL; 4401 } 4402 4403 IPW_DEBUG_INFO("exit\n"); 4404 } 4405 4406 static void bd_queue_initialize(struct ipw2100_priv *priv, 4407 struct ipw2100_bd_queue *q, u32 base, u32 size, 4408 u32 r, u32 w) 4409 { 4410 IPW_DEBUG_INFO("enter\n"); 4411 4412 IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, 4413 (u32) q->nic); 4414 4415 write_register(priv->net_dev, base, q->nic); 4416 write_register(priv->net_dev, size, q->entries); 4417 write_register(priv->net_dev, r, q->oldest); 4418 write_register(priv->net_dev, w, q->next); 4419 4420 IPW_DEBUG_INFO("exit\n"); 4421 } 4422 4423 static void ipw2100_kill_works(struct ipw2100_priv *priv) 4424 { 4425 priv->stop_rf_kill = 1; 4426 priv->stop_hang_check = 1; 4427 cancel_delayed_work_sync(&priv->reset_work); 4428 cancel_delayed_work_sync(&priv->security_work); 4429 cancel_delayed_work_sync(&priv->wx_event_work); 4430 cancel_delayed_work_sync(&priv->hang_check); 4431 cancel_delayed_work_sync(&priv->rf_kill); 4432 cancel_delayed_work_sync(&priv->scan_event); 4433 } 4434 4435 static int ipw2100_tx_allocate(struct ipw2100_priv *priv) 4436 { 4437 int i, j, err = -EINVAL; 4438 void *v; 4439 dma_addr_t p; 4440 4441 IPW_DEBUG_INFO("enter\n"); 4442 4443 err = bd_queue_allocate(priv, &priv->tx_queue, TX_QUEUE_LENGTH); 4444 if (err) { 4445 IPW_DEBUG_ERROR("%s: failed bd_queue_allocate\n", 4446 priv->net_dev->name); 4447 return err; 4448 } 4449 4450 priv->tx_buffers = kmalloc_array(TX_PENDED_QUEUE_LENGTH, 4451 sizeof(struct ipw2100_tx_packet), 4452 GFP_ATOMIC); 4453 if (!priv->tx_buffers) { 4454 bd_queue_free(priv, &priv->tx_queue); 4455 return -ENOMEM; 4456 } 4457 4458 for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { 4459 v = pci_alloc_consistent(priv->pci_dev, 4460 sizeof(struct ipw2100_data_header), 4461 &p); 4462 if (!v) { 4463 printk(KERN_ERR DRV_NAME 4464 ": %s: PCI alloc failed for tx " "buffers.\n", 4465 priv->net_dev->name); 4466 err = -ENOMEM; 4467 break; 4468 } 4469 4470 priv->tx_buffers[i].type = DATA; 4471 priv->tx_buffers[i].info.d_struct.data = 4472 (struct ipw2100_data_header *)v; 4473 priv->tx_buffers[i].info.d_struct.data_phys = p; 4474 priv->tx_buffers[i].info.d_struct.txb = NULL; 4475 } 4476 4477 if (i == TX_PENDED_QUEUE_LENGTH) 4478 return 0; 4479 4480 for (j = 0; j < i; j++) { 4481 pci_free_consistent(priv->pci_dev, 4482 sizeof(struct ipw2100_data_header), 4483 priv->tx_buffers[j].info.d_struct.data, 4484 priv->tx_buffers[j].info.d_struct. 4485 data_phys); 4486 } 4487 4488 kfree(priv->tx_buffers); 4489 priv->tx_buffers = NULL; 4490 4491 return err; 4492 } 4493 4494 static void ipw2100_tx_initialize(struct ipw2100_priv *priv) 4495 { 4496 int i; 4497 4498 IPW_DEBUG_INFO("enter\n"); 4499 4500 /* 4501 * reinitialize packet info lists 4502 */ 4503 INIT_LIST_HEAD(&priv->fw_pend_list); 4504 INIT_STAT(&priv->fw_pend_stat); 4505 4506 /* 4507 * reinitialize lists 4508 */ 4509 INIT_LIST_HEAD(&priv->tx_pend_list); 4510 INIT_LIST_HEAD(&priv->tx_free_list); 4511 INIT_STAT(&priv->tx_pend_stat); 4512 INIT_STAT(&priv->tx_free_stat); 4513 4514 for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { 4515 /* We simply drop any SKBs that have been queued for 4516 * transmit */ 4517 if (priv->tx_buffers[i].info.d_struct.txb) { 4518 libipw_txb_free(priv->tx_buffers[i].info.d_struct. 4519 txb); 4520 priv->tx_buffers[i].info.d_struct.txb = NULL; 4521 } 4522 4523 list_add_tail(&priv->tx_buffers[i].list, &priv->tx_free_list); 4524 } 4525 4526 SET_STAT(&priv->tx_free_stat, i); 4527 4528 priv->tx_queue.oldest = 0; 4529 priv->tx_queue.available = priv->tx_queue.entries; 4530 priv->tx_queue.next = 0; 4531 INIT_STAT(&priv->txq_stat); 4532 SET_STAT(&priv->txq_stat, priv->tx_queue.available); 4533 4534 bd_queue_initialize(priv, &priv->tx_queue, 4535 IPW_MEM_HOST_SHARED_TX_QUEUE_BD_BASE, 4536 IPW_MEM_HOST_SHARED_TX_QUEUE_BD_SIZE, 4537 IPW_MEM_HOST_SHARED_TX_QUEUE_READ_INDEX, 4538 IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX); 4539 4540 IPW_DEBUG_INFO("exit\n"); 4541 4542 } 4543 4544 static void ipw2100_tx_free(struct ipw2100_priv *priv) 4545 { 4546 int i; 4547 4548 IPW_DEBUG_INFO("enter\n"); 4549 4550 bd_queue_free(priv, &priv->tx_queue); 4551 4552 if (!priv->tx_buffers) 4553 return; 4554 4555 for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { 4556 if (priv->tx_buffers[i].info.d_struct.txb) { 4557 libipw_txb_free(priv->tx_buffers[i].info.d_struct. 4558 txb); 4559 priv->tx_buffers[i].info.d_struct.txb = NULL; 4560 } 4561 if (priv->tx_buffers[i].info.d_struct.data) 4562 pci_free_consistent(priv->pci_dev, 4563 sizeof(struct ipw2100_data_header), 4564 priv->tx_buffers[i].info.d_struct. 4565 data, 4566 priv->tx_buffers[i].info.d_struct. 4567 data_phys); 4568 } 4569 4570 kfree(priv->tx_buffers); 4571 priv->tx_buffers = NULL; 4572 4573 IPW_DEBUG_INFO("exit\n"); 4574 } 4575 4576 static int ipw2100_rx_allocate(struct ipw2100_priv *priv) 4577 { 4578 int i, j, err = -EINVAL; 4579 4580 IPW_DEBUG_INFO("enter\n"); 4581 4582 err = bd_queue_allocate(priv, &priv->rx_queue, RX_QUEUE_LENGTH); 4583 if (err) { 4584 IPW_DEBUG_INFO("failed bd_queue_allocate\n"); 4585 return err; 4586 } 4587 4588 err = status_queue_allocate(priv, RX_QUEUE_LENGTH); 4589 if (err) { 4590 IPW_DEBUG_INFO("failed status_queue_allocate\n"); 4591 bd_queue_free(priv, &priv->rx_queue); 4592 return err; 4593 } 4594 4595 /* 4596 * allocate packets 4597 */ 4598 priv->rx_buffers = kmalloc(RX_QUEUE_LENGTH * 4599 sizeof(struct ipw2100_rx_packet), 4600 GFP_KERNEL); 4601 if (!priv->rx_buffers) { 4602 IPW_DEBUG_INFO("can't allocate rx packet buffer table\n"); 4603 4604 bd_queue_free(priv, &priv->rx_queue); 4605 4606 status_queue_free(priv); 4607 4608 return -ENOMEM; 4609 } 4610 4611 for (i = 0; i < RX_QUEUE_LENGTH; i++) { 4612 struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; 4613 4614 err = ipw2100_alloc_skb(priv, packet); 4615 if (unlikely(err)) { 4616 err = -ENOMEM; 4617 break; 4618 } 4619 4620 /* The BD holds the cache aligned address */ 4621 priv->rx_queue.drv[i].host_addr = packet->dma_addr; 4622 priv->rx_queue.drv[i].buf_length = IPW_RX_NIC_BUFFER_LENGTH; 4623 priv->status_queue.drv[i].status_fields = 0; 4624 } 4625 4626 if (i == RX_QUEUE_LENGTH) 4627 return 0; 4628 4629 for (j = 0; j < i; j++) { 4630 pci_unmap_single(priv->pci_dev, priv->rx_buffers[j].dma_addr, 4631 sizeof(struct ipw2100_rx_packet), 4632 PCI_DMA_FROMDEVICE); 4633 dev_kfree_skb(priv->rx_buffers[j].skb); 4634 } 4635 4636 kfree(priv->rx_buffers); 4637 priv->rx_buffers = NULL; 4638 4639 bd_queue_free(priv, &priv->rx_queue); 4640 4641 status_queue_free(priv); 4642 4643 return err; 4644 } 4645 4646 static void ipw2100_rx_initialize(struct ipw2100_priv *priv) 4647 { 4648 IPW_DEBUG_INFO("enter\n"); 4649 4650 priv->rx_queue.oldest = 0; 4651 priv->rx_queue.available = priv->rx_queue.entries - 1; 4652 priv->rx_queue.next = priv->rx_queue.entries - 1; 4653 4654 INIT_STAT(&priv->rxq_stat); 4655 SET_STAT(&priv->rxq_stat, priv->rx_queue.available); 4656 4657 bd_queue_initialize(priv, &priv->rx_queue, 4658 IPW_MEM_HOST_SHARED_RX_BD_BASE, 4659 IPW_MEM_HOST_SHARED_RX_BD_SIZE, 4660 IPW_MEM_HOST_SHARED_RX_READ_INDEX, 4661 IPW_MEM_HOST_SHARED_RX_WRITE_INDEX); 4662 4663 /* set up the status queue */ 4664 write_register(priv->net_dev, IPW_MEM_HOST_SHARED_RX_STATUS_BASE, 4665 priv->status_queue.nic); 4666 4667 IPW_DEBUG_INFO("exit\n"); 4668 } 4669 4670 static void ipw2100_rx_free(struct ipw2100_priv *priv) 4671 { 4672 int i; 4673 4674 IPW_DEBUG_INFO("enter\n"); 4675 4676 bd_queue_free(priv, &priv->rx_queue); 4677 status_queue_free(priv); 4678 4679 if (!priv->rx_buffers) 4680 return; 4681 4682 for (i = 0; i < RX_QUEUE_LENGTH; i++) { 4683 if (priv->rx_buffers[i].rxp) { 4684 pci_unmap_single(priv->pci_dev, 4685 priv->rx_buffers[i].dma_addr, 4686 sizeof(struct ipw2100_rx), 4687 PCI_DMA_FROMDEVICE); 4688 dev_kfree_skb(priv->rx_buffers[i].skb); 4689 } 4690 } 4691 4692 kfree(priv->rx_buffers); 4693 priv->rx_buffers = NULL; 4694 4695 IPW_DEBUG_INFO("exit\n"); 4696 } 4697 4698 static int ipw2100_read_mac_address(struct ipw2100_priv *priv) 4699 { 4700 u32 length = ETH_ALEN; 4701 u8 addr[ETH_ALEN]; 4702 4703 int err; 4704 4705 err = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ADAPTER_MAC, addr, &length); 4706 if (err) { 4707 IPW_DEBUG_INFO("MAC address read failed\n"); 4708 return -EIO; 4709 } 4710 4711 memcpy(priv->net_dev->dev_addr, addr, ETH_ALEN); 4712 IPW_DEBUG_INFO("card MAC is %pM\n", priv->net_dev->dev_addr); 4713 4714 return 0; 4715 } 4716 4717 /******************************************************************** 4718 * 4719 * Firmware Commands 4720 * 4721 ********************************************************************/ 4722 4723 static int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode) 4724 { 4725 struct host_command cmd = { 4726 .host_command = ADAPTER_ADDRESS, 4727 .host_command_sequence = 0, 4728 .host_command_length = ETH_ALEN 4729 }; 4730 int err; 4731 4732 IPW_DEBUG_HC("SET_MAC_ADDRESS\n"); 4733 4734 IPW_DEBUG_INFO("enter\n"); 4735 4736 if (priv->config & CFG_CUSTOM_MAC) { 4737 memcpy(cmd.host_command_parameters, priv->mac_addr, ETH_ALEN); 4738 memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); 4739 } else 4740 memcpy(cmd.host_command_parameters, priv->net_dev->dev_addr, 4741 ETH_ALEN); 4742 4743 err = ipw2100_hw_send_command(priv, &cmd); 4744 4745 IPW_DEBUG_INFO("exit\n"); 4746 return err; 4747 } 4748 4749 static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type, 4750 int batch_mode) 4751 { 4752 struct host_command cmd = { 4753 .host_command = PORT_TYPE, 4754 .host_command_sequence = 0, 4755 .host_command_length = sizeof(u32) 4756 }; 4757 int err; 4758 4759 switch (port_type) { 4760 case IW_MODE_INFRA: 4761 cmd.host_command_parameters[0] = IPW_BSS; 4762 break; 4763 case IW_MODE_ADHOC: 4764 cmd.host_command_parameters[0] = IPW_IBSS; 4765 break; 4766 } 4767 4768 IPW_DEBUG_HC("PORT_TYPE: %s\n", 4769 port_type == IPW_IBSS ? "Ad-Hoc" : "Managed"); 4770 4771 if (!batch_mode) { 4772 err = ipw2100_disable_adapter(priv); 4773 if (err) { 4774 printk(KERN_ERR DRV_NAME 4775 ": %s: Could not disable adapter %d\n", 4776 priv->net_dev->name, err); 4777 return err; 4778 } 4779 } 4780 4781 /* send cmd to firmware */ 4782 err = ipw2100_hw_send_command(priv, &cmd); 4783 4784 if (!batch_mode) 4785 ipw2100_enable_adapter(priv); 4786 4787 return err; 4788 } 4789 4790 static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, 4791 int batch_mode) 4792 { 4793 struct host_command cmd = { 4794 .host_command = CHANNEL, 4795 .host_command_sequence = 0, 4796 .host_command_length = sizeof(u32) 4797 }; 4798 int err; 4799 4800 cmd.host_command_parameters[0] = channel; 4801 4802 IPW_DEBUG_HC("CHANNEL: %d\n", channel); 4803 4804 /* If BSS then we don't support channel selection */ 4805 if (priv->ieee->iw_mode == IW_MODE_INFRA) 4806 return 0; 4807 4808 if ((channel != 0) && 4809 ((channel < REG_MIN_CHANNEL) || (channel > REG_MAX_CHANNEL))) 4810 return -EINVAL; 4811 4812 if (!batch_mode) { 4813 err = ipw2100_disable_adapter(priv); 4814 if (err) 4815 return err; 4816 } 4817 4818 err = ipw2100_hw_send_command(priv, &cmd); 4819 if (err) { 4820 IPW_DEBUG_INFO("Failed to set channel to %d", channel); 4821 return err; 4822 } 4823 4824 if (channel) 4825 priv->config |= CFG_STATIC_CHANNEL; 4826 else 4827 priv->config &= ~CFG_STATIC_CHANNEL; 4828 4829 priv->channel = channel; 4830 4831 if (!batch_mode) { 4832 err = ipw2100_enable_adapter(priv); 4833 if (err) 4834 return err; 4835 } 4836 4837 return 0; 4838 } 4839 4840 static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode) 4841 { 4842 struct host_command cmd = { 4843 .host_command = SYSTEM_CONFIG, 4844 .host_command_sequence = 0, 4845 .host_command_length = 12, 4846 }; 4847 u32 ibss_mask, len = sizeof(u32); 4848 int err; 4849 4850 /* Set system configuration */ 4851 4852 if (!batch_mode) { 4853 err = ipw2100_disable_adapter(priv); 4854 if (err) 4855 return err; 4856 } 4857 4858 if (priv->ieee->iw_mode == IW_MODE_ADHOC) 4859 cmd.host_command_parameters[0] |= IPW_CFG_IBSS_AUTO_START; 4860 4861 cmd.host_command_parameters[0] |= IPW_CFG_IBSS_MASK | 4862 IPW_CFG_BSS_MASK | IPW_CFG_802_1x_ENABLE; 4863 4864 if (!(priv->config & CFG_LONG_PREAMBLE)) 4865 cmd.host_command_parameters[0] |= IPW_CFG_PREAMBLE_AUTO; 4866 4867 err = ipw2100_get_ordinal(priv, 4868 IPW_ORD_EEPROM_IBSS_11B_CHANNELS, 4869 &ibss_mask, &len); 4870 if (err) 4871 ibss_mask = IPW_IBSS_11B_DEFAULT_MASK; 4872 4873 cmd.host_command_parameters[1] = REG_CHANNEL_MASK; 4874 cmd.host_command_parameters[2] = REG_CHANNEL_MASK & ibss_mask; 4875 4876 /* 11b only */ 4877 /*cmd.host_command_parameters[0] |= DIVERSITY_ANTENNA_A; */ 4878 4879 err = ipw2100_hw_send_command(priv, &cmd); 4880 if (err) 4881 return err; 4882 4883 /* If IPv6 is configured in the kernel then we don't want to filter out all 4884 * of the multicast packets as IPv6 needs some. */ 4885 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 4886 cmd.host_command = ADD_MULTICAST; 4887 cmd.host_command_sequence = 0; 4888 cmd.host_command_length = 0; 4889 4890 ipw2100_hw_send_command(priv, &cmd); 4891 #endif 4892 if (!batch_mode) { 4893 err = ipw2100_enable_adapter(priv); 4894 if (err) 4895 return err; 4896 } 4897 4898 return 0; 4899 } 4900 4901 static int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate, 4902 int batch_mode) 4903 { 4904 struct host_command cmd = { 4905 .host_command = BASIC_TX_RATES, 4906 .host_command_sequence = 0, 4907 .host_command_length = 4 4908 }; 4909 int err; 4910 4911 cmd.host_command_parameters[0] = rate & TX_RATE_MASK; 4912 4913 if (!batch_mode) { 4914 err = ipw2100_disable_adapter(priv); 4915 if (err) 4916 return err; 4917 } 4918 4919 /* Set BASIC TX Rate first */ 4920 ipw2100_hw_send_command(priv, &cmd); 4921 4922 /* Set TX Rate */ 4923 cmd.host_command = TX_RATES; 4924 ipw2100_hw_send_command(priv, &cmd); 4925 4926 /* Set MSDU TX Rate */ 4927 cmd.host_command = MSDU_TX_RATES; 4928 ipw2100_hw_send_command(priv, &cmd); 4929 4930 if (!batch_mode) { 4931 err = ipw2100_enable_adapter(priv); 4932 if (err) 4933 return err; 4934 } 4935 4936 priv->tx_rates = rate; 4937 4938 return 0; 4939 } 4940 4941 static int ipw2100_set_power_mode(struct ipw2100_priv *priv, int power_level) 4942 { 4943 struct host_command cmd = { 4944 .host_command = POWER_MODE, 4945 .host_command_sequence = 0, 4946 .host_command_length = 4 4947 }; 4948 int err; 4949 4950 cmd.host_command_parameters[0] = power_level; 4951 4952 err = ipw2100_hw_send_command(priv, &cmd); 4953 if (err) 4954 return err; 4955 4956 if (power_level == IPW_POWER_MODE_CAM) 4957 priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); 4958 else 4959 priv->power_mode = IPW_POWER_ENABLED | power_level; 4960 4961 #ifdef IPW2100_TX_POWER 4962 if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) { 4963 /* Set beacon interval */ 4964 cmd.host_command = TX_POWER_INDEX; 4965 cmd.host_command_parameters[0] = (u32) priv->adhoc_power; 4966 4967 err = ipw2100_hw_send_command(priv, &cmd); 4968 if (err) 4969 return err; 4970 } 4971 #endif 4972 4973 return 0; 4974 } 4975 4976 static int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold) 4977 { 4978 struct host_command cmd = { 4979 .host_command = RTS_THRESHOLD, 4980 .host_command_sequence = 0, 4981 .host_command_length = 4 4982 }; 4983 int err; 4984 4985 if (threshold & RTS_DISABLED) 4986 cmd.host_command_parameters[0] = MAX_RTS_THRESHOLD; 4987 else 4988 cmd.host_command_parameters[0] = threshold & ~RTS_DISABLED; 4989 4990 err = ipw2100_hw_send_command(priv, &cmd); 4991 if (err) 4992 return err; 4993 4994 priv->rts_threshold = threshold; 4995 4996 return 0; 4997 } 4998 4999 #if 0 5000 int ipw2100_set_fragmentation_threshold(struct ipw2100_priv *priv, 5001 u32 threshold, int batch_mode) 5002 { 5003 struct host_command cmd = { 5004 .host_command = FRAG_THRESHOLD, 5005 .host_command_sequence = 0, 5006 .host_command_length = 4, 5007 .host_command_parameters[0] = 0, 5008 }; 5009 int err; 5010 5011 if (!batch_mode) { 5012 err = ipw2100_disable_adapter(priv); 5013 if (err) 5014 return err; 5015 } 5016 5017 if (threshold == 0) 5018 threshold = DEFAULT_FRAG_THRESHOLD; 5019 else { 5020 threshold = max(threshold, MIN_FRAG_THRESHOLD); 5021 threshold = min(threshold, MAX_FRAG_THRESHOLD); 5022 } 5023 5024 cmd.host_command_parameters[0] = threshold; 5025 5026 IPW_DEBUG_HC("FRAG_THRESHOLD: %u\n", threshold); 5027 5028 err = ipw2100_hw_send_command(priv, &cmd); 5029 5030 if (!batch_mode) 5031 ipw2100_enable_adapter(priv); 5032 5033 if (!err) 5034 priv->frag_threshold = threshold; 5035 5036 return err; 5037 } 5038 #endif 5039 5040 static int ipw2100_set_short_retry(struct ipw2100_priv *priv, u32 retry) 5041 { 5042 struct host_command cmd = { 5043 .host_command = SHORT_RETRY_LIMIT, 5044 .host_command_sequence = 0, 5045 .host_command_length = 4 5046 }; 5047 int err; 5048 5049 cmd.host_command_parameters[0] = retry; 5050 5051 err = ipw2100_hw_send_command(priv, &cmd); 5052 if (err) 5053 return err; 5054 5055 priv->short_retry_limit = retry; 5056 5057 return 0; 5058 } 5059 5060 static int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry) 5061 { 5062 struct host_command cmd = { 5063 .host_command = LONG_RETRY_LIMIT, 5064 .host_command_sequence = 0, 5065 .host_command_length = 4 5066 }; 5067 int err; 5068 5069 cmd.host_command_parameters[0] = retry; 5070 5071 err = ipw2100_hw_send_command(priv, &cmd); 5072 if (err) 5073 return err; 5074 5075 priv->long_retry_limit = retry; 5076 5077 return 0; 5078 } 5079 5080 static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 * bssid, 5081 int batch_mode) 5082 { 5083 struct host_command cmd = { 5084 .host_command = MANDATORY_BSSID, 5085 .host_command_sequence = 0, 5086 .host_command_length = (bssid == NULL) ? 0 : ETH_ALEN 5087 }; 5088 int err; 5089 5090 #ifdef CONFIG_IPW2100_DEBUG 5091 if (bssid != NULL) 5092 IPW_DEBUG_HC("MANDATORY_BSSID: %pM\n", bssid); 5093 else 5094 IPW_DEBUG_HC("MANDATORY_BSSID: <clear>\n"); 5095 #endif 5096 /* if BSSID is empty then we disable mandatory bssid mode */ 5097 if (bssid != NULL) 5098 memcpy(cmd.host_command_parameters, bssid, ETH_ALEN); 5099 5100 if (!batch_mode) { 5101 err = ipw2100_disable_adapter(priv); 5102 if (err) 5103 return err; 5104 } 5105 5106 err = ipw2100_hw_send_command(priv, &cmd); 5107 5108 if (!batch_mode) 5109 ipw2100_enable_adapter(priv); 5110 5111 return err; 5112 } 5113 5114 static int ipw2100_disassociate_bssid(struct ipw2100_priv *priv) 5115 { 5116 struct host_command cmd = { 5117 .host_command = DISASSOCIATION_BSSID, 5118 .host_command_sequence = 0, 5119 .host_command_length = ETH_ALEN 5120 }; 5121 int err; 5122 int len; 5123 5124 IPW_DEBUG_HC("DISASSOCIATION_BSSID\n"); 5125 5126 len = ETH_ALEN; 5127 /* The Firmware currently ignores the BSSID and just disassociates from 5128 * the currently associated AP -- but in the off chance that a future 5129 * firmware does use the BSSID provided here, we go ahead and try and 5130 * set it to the currently associated AP's BSSID */ 5131 memcpy(cmd.host_command_parameters, priv->bssid, ETH_ALEN); 5132 5133 err = ipw2100_hw_send_command(priv, &cmd); 5134 5135 return err; 5136 } 5137 5138 static int ipw2100_set_wpa_ie(struct ipw2100_priv *, 5139 struct ipw2100_wpa_assoc_frame *, int) 5140 __attribute__ ((unused)); 5141 5142 static int ipw2100_set_wpa_ie(struct ipw2100_priv *priv, 5143 struct ipw2100_wpa_assoc_frame *wpa_frame, 5144 int batch_mode) 5145 { 5146 struct host_command cmd = { 5147 .host_command = SET_WPA_IE, 5148 .host_command_sequence = 0, 5149 .host_command_length = sizeof(struct ipw2100_wpa_assoc_frame), 5150 }; 5151 int err; 5152 5153 IPW_DEBUG_HC("SET_WPA_IE\n"); 5154 5155 if (!batch_mode) { 5156 err = ipw2100_disable_adapter(priv); 5157 if (err) 5158 return err; 5159 } 5160 5161 memcpy(cmd.host_command_parameters, wpa_frame, 5162 sizeof(struct ipw2100_wpa_assoc_frame)); 5163 5164 err = ipw2100_hw_send_command(priv, &cmd); 5165 5166 if (!batch_mode) { 5167 if (ipw2100_enable_adapter(priv)) 5168 err = -EIO; 5169 } 5170 5171 return err; 5172 } 5173 5174 struct security_info_params { 5175 u32 allowed_ciphers; 5176 u16 version; 5177 u8 auth_mode; 5178 u8 replay_counters_number; 5179 u8 unicast_using_group; 5180 } __packed; 5181 5182 static int ipw2100_set_security_information(struct ipw2100_priv *priv, 5183 int auth_mode, 5184 int security_level, 5185 int unicast_using_group, 5186 int batch_mode) 5187 { 5188 struct host_command cmd = { 5189 .host_command = SET_SECURITY_INFORMATION, 5190 .host_command_sequence = 0, 5191 .host_command_length = sizeof(struct security_info_params) 5192 }; 5193 struct security_info_params *security = 5194 (struct security_info_params *)&cmd.host_command_parameters; 5195 int err; 5196 memset(security, 0, sizeof(*security)); 5197 5198 /* If shared key AP authentication is turned on, then we need to 5199 * configure the firmware to try and use it. 5200 * 5201 * Actual data encryption/decryption is handled by the host. */ 5202 security->auth_mode = auth_mode; 5203 security->unicast_using_group = unicast_using_group; 5204 5205 switch (security_level) { 5206 default: 5207 case SEC_LEVEL_0: 5208 security->allowed_ciphers = IPW_NONE_CIPHER; 5209 break; 5210 case SEC_LEVEL_1: 5211 security->allowed_ciphers = IPW_WEP40_CIPHER | 5212 IPW_WEP104_CIPHER; 5213 break; 5214 case SEC_LEVEL_2: 5215 security->allowed_ciphers = IPW_WEP40_CIPHER | 5216 IPW_WEP104_CIPHER | IPW_TKIP_CIPHER; 5217 break; 5218 case SEC_LEVEL_2_CKIP: 5219 security->allowed_ciphers = IPW_WEP40_CIPHER | 5220 IPW_WEP104_CIPHER | IPW_CKIP_CIPHER; 5221 break; 5222 case SEC_LEVEL_3: 5223 security->allowed_ciphers = IPW_WEP40_CIPHER | 5224 IPW_WEP104_CIPHER | IPW_TKIP_CIPHER | IPW_CCMP_CIPHER; 5225 break; 5226 } 5227 5228 IPW_DEBUG_HC 5229 ("SET_SECURITY_INFORMATION: auth:%d cipher:0x%02X (level %d)\n", 5230 security->auth_mode, security->allowed_ciphers, security_level); 5231 5232 security->replay_counters_number = 0; 5233 5234 if (!batch_mode) { 5235 err = ipw2100_disable_adapter(priv); 5236 if (err) 5237 return err; 5238 } 5239 5240 err = ipw2100_hw_send_command(priv, &cmd); 5241 5242 if (!batch_mode) 5243 ipw2100_enable_adapter(priv); 5244 5245 return err; 5246 } 5247 5248 static int ipw2100_set_tx_power(struct ipw2100_priv *priv, u32 tx_power) 5249 { 5250 struct host_command cmd = { 5251 .host_command = TX_POWER_INDEX, 5252 .host_command_sequence = 0, 5253 .host_command_length = 4 5254 }; 5255 int err = 0; 5256 u32 tmp = tx_power; 5257 5258 if (tx_power != IPW_TX_POWER_DEFAULT) 5259 tmp = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / 5260 (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); 5261 5262 cmd.host_command_parameters[0] = tmp; 5263 5264 if (priv->ieee->iw_mode == IW_MODE_ADHOC) 5265 err = ipw2100_hw_send_command(priv, &cmd); 5266 if (!err) 5267 priv->tx_power = tx_power; 5268 5269 return 0; 5270 } 5271 5272 static int ipw2100_set_ibss_beacon_interval(struct ipw2100_priv *priv, 5273 u32 interval, int batch_mode) 5274 { 5275 struct host_command cmd = { 5276 .host_command = BEACON_INTERVAL, 5277 .host_command_sequence = 0, 5278 .host_command_length = 4 5279 }; 5280 int err; 5281 5282 cmd.host_command_parameters[0] = interval; 5283 5284 IPW_DEBUG_INFO("enter\n"); 5285 5286 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 5287 if (!batch_mode) { 5288 err = ipw2100_disable_adapter(priv); 5289 if (err) 5290 return err; 5291 } 5292 5293 ipw2100_hw_send_command(priv, &cmd); 5294 5295 if (!batch_mode) { 5296 err = ipw2100_enable_adapter(priv); 5297 if (err) 5298 return err; 5299 } 5300 } 5301 5302 IPW_DEBUG_INFO("exit\n"); 5303 5304 return 0; 5305 } 5306 5307 static void ipw2100_queues_initialize(struct ipw2100_priv *priv) 5308 { 5309 ipw2100_tx_initialize(priv); 5310 ipw2100_rx_initialize(priv); 5311 ipw2100_msg_initialize(priv); 5312 } 5313 5314 static void ipw2100_queues_free(struct ipw2100_priv *priv) 5315 { 5316 ipw2100_tx_free(priv); 5317 ipw2100_rx_free(priv); 5318 ipw2100_msg_free(priv); 5319 } 5320 5321 static int ipw2100_queues_allocate(struct ipw2100_priv *priv) 5322 { 5323 if (ipw2100_tx_allocate(priv) || 5324 ipw2100_rx_allocate(priv) || ipw2100_msg_allocate(priv)) 5325 goto fail; 5326 5327 return 0; 5328 5329 fail: 5330 ipw2100_tx_free(priv); 5331 ipw2100_rx_free(priv); 5332 ipw2100_msg_free(priv); 5333 return -ENOMEM; 5334 } 5335 5336 #define IPW_PRIVACY_CAPABLE 0x0008 5337 5338 static int ipw2100_set_wep_flags(struct ipw2100_priv *priv, u32 flags, 5339 int batch_mode) 5340 { 5341 struct host_command cmd = { 5342 .host_command = WEP_FLAGS, 5343 .host_command_sequence = 0, 5344 .host_command_length = 4 5345 }; 5346 int err; 5347 5348 cmd.host_command_parameters[0] = flags; 5349 5350 IPW_DEBUG_HC("WEP_FLAGS: flags = 0x%08X\n", flags); 5351 5352 if (!batch_mode) { 5353 err = ipw2100_disable_adapter(priv); 5354 if (err) { 5355 printk(KERN_ERR DRV_NAME 5356 ": %s: Could not disable adapter %d\n", 5357 priv->net_dev->name, err); 5358 return err; 5359 } 5360 } 5361 5362 /* send cmd to firmware */ 5363 err = ipw2100_hw_send_command(priv, &cmd); 5364 5365 if (!batch_mode) 5366 ipw2100_enable_adapter(priv); 5367 5368 return err; 5369 } 5370 5371 struct ipw2100_wep_key { 5372 u8 idx; 5373 u8 len; 5374 u8 key[13]; 5375 }; 5376 5377 /* Macros to ease up priting WEP keys */ 5378 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 5379 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 5380 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 5381 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 5382 5383 /** 5384 * Set a the wep key 5385 * 5386 * @priv: struct to work on 5387 * @idx: index of the key we want to set 5388 * @key: ptr to the key data to set 5389 * @len: length of the buffer at @key 5390 * @batch_mode: FIXME perform the operation in batch mode, not 5391 * disabling the device. 5392 * 5393 * @returns 0 if OK, < 0 errno code on error. 5394 * 5395 * Fill out a command structure with the new wep key, length an 5396 * index and send it down the wire. 5397 */ 5398 static int ipw2100_set_key(struct ipw2100_priv *priv, 5399 int idx, char *key, int len, int batch_mode) 5400 { 5401 int keylen = len ? (len <= 5 ? 5 : 13) : 0; 5402 struct host_command cmd = { 5403 .host_command = WEP_KEY_INFO, 5404 .host_command_sequence = 0, 5405 .host_command_length = sizeof(struct ipw2100_wep_key), 5406 }; 5407 struct ipw2100_wep_key *wep_key = (void *)cmd.host_command_parameters; 5408 int err; 5409 5410 IPW_DEBUG_HC("WEP_KEY_INFO: index = %d, len = %d/%d\n", 5411 idx, keylen, len); 5412 5413 /* NOTE: We don't check cached values in case the firmware was reset 5414 * or some other problem is occurring. If the user is setting the key, 5415 * then we push the change */ 5416 5417 wep_key->idx = idx; 5418 wep_key->len = keylen; 5419 5420 if (keylen) { 5421 memcpy(wep_key->key, key, len); 5422 memset(wep_key->key + len, 0, keylen - len); 5423 } 5424 5425 /* Will be optimized out on debug not being configured in */ 5426 if (keylen == 0) 5427 IPW_DEBUG_WEP("%s: Clearing key %d\n", 5428 priv->net_dev->name, wep_key->idx); 5429 else if (keylen == 5) 5430 IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_64 "\n", 5431 priv->net_dev->name, wep_key->idx, wep_key->len, 5432 WEP_STR_64(wep_key->key)); 5433 else 5434 IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_128 5435 "\n", 5436 priv->net_dev->name, wep_key->idx, wep_key->len, 5437 WEP_STR_128(wep_key->key)); 5438 5439 if (!batch_mode) { 5440 err = ipw2100_disable_adapter(priv); 5441 /* FIXME: IPG: shouldn't this prink be in _disable_adapter()? */ 5442 if (err) { 5443 printk(KERN_ERR DRV_NAME 5444 ": %s: Could not disable adapter %d\n", 5445 priv->net_dev->name, err); 5446 return err; 5447 } 5448 } 5449 5450 /* send cmd to firmware */ 5451 err = ipw2100_hw_send_command(priv, &cmd); 5452 5453 if (!batch_mode) { 5454 int err2 = ipw2100_enable_adapter(priv); 5455 if (err == 0) 5456 err = err2; 5457 } 5458 return err; 5459 } 5460 5461 static int ipw2100_set_key_index(struct ipw2100_priv *priv, 5462 int idx, int batch_mode) 5463 { 5464 struct host_command cmd = { 5465 .host_command = WEP_KEY_INDEX, 5466 .host_command_sequence = 0, 5467 .host_command_length = 4, 5468 .host_command_parameters = {idx}, 5469 }; 5470 int err; 5471 5472 IPW_DEBUG_HC("WEP_KEY_INDEX: index = %d\n", idx); 5473 5474 if (idx < 0 || idx > 3) 5475 return -EINVAL; 5476 5477 if (!batch_mode) { 5478 err = ipw2100_disable_adapter(priv); 5479 if (err) { 5480 printk(KERN_ERR DRV_NAME 5481 ": %s: Could not disable adapter %d\n", 5482 priv->net_dev->name, err); 5483 return err; 5484 } 5485 } 5486 5487 /* send cmd to firmware */ 5488 err = ipw2100_hw_send_command(priv, &cmd); 5489 5490 if (!batch_mode) 5491 ipw2100_enable_adapter(priv); 5492 5493 return err; 5494 } 5495 5496 static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode) 5497 { 5498 int i, err, auth_mode, sec_level, use_group; 5499 5500 if (!(priv->status & STATUS_RUNNING)) 5501 return 0; 5502 5503 if (!batch_mode) { 5504 err = ipw2100_disable_adapter(priv); 5505 if (err) 5506 return err; 5507 } 5508 5509 if (!priv->ieee->sec.enabled) { 5510 err = 5511 ipw2100_set_security_information(priv, IPW_AUTH_OPEN, 5512 SEC_LEVEL_0, 0, 1); 5513 } else { 5514 auth_mode = IPW_AUTH_OPEN; 5515 if (priv->ieee->sec.flags & SEC_AUTH_MODE) { 5516 if (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY) 5517 auth_mode = IPW_AUTH_SHARED; 5518 else if (priv->ieee->sec.auth_mode == WLAN_AUTH_LEAP) 5519 auth_mode = IPW_AUTH_LEAP_CISCO_ID; 5520 } 5521 5522 sec_level = SEC_LEVEL_0; 5523 if (priv->ieee->sec.flags & SEC_LEVEL) 5524 sec_level = priv->ieee->sec.level; 5525 5526 use_group = 0; 5527 if (priv->ieee->sec.flags & SEC_UNICAST_GROUP) 5528 use_group = priv->ieee->sec.unicast_uses_group; 5529 5530 err = 5531 ipw2100_set_security_information(priv, auth_mode, sec_level, 5532 use_group, 1); 5533 } 5534 5535 if (err) 5536 goto exit; 5537 5538 if (priv->ieee->sec.enabled) { 5539 for (i = 0; i < 4; i++) { 5540 if (!(priv->ieee->sec.flags & (1 << i))) { 5541 memset(priv->ieee->sec.keys[i], 0, WEP_KEY_LEN); 5542 priv->ieee->sec.key_sizes[i] = 0; 5543 } else { 5544 err = ipw2100_set_key(priv, i, 5545 priv->ieee->sec.keys[i], 5546 priv->ieee->sec. 5547 key_sizes[i], 1); 5548 if (err) 5549 goto exit; 5550 } 5551 } 5552 5553 ipw2100_set_key_index(priv, priv->ieee->crypt_info.tx_keyidx, 1); 5554 } 5555 5556 /* Always enable privacy so the Host can filter WEP packets if 5557 * encrypted data is sent up */ 5558 err = 5559 ipw2100_set_wep_flags(priv, 5560 priv->ieee->sec. 5561 enabled ? IPW_PRIVACY_CAPABLE : 0, 1); 5562 if (err) 5563 goto exit; 5564 5565 priv->status &= ~STATUS_SECURITY_UPDATED; 5566 5567 exit: 5568 if (!batch_mode) 5569 ipw2100_enable_adapter(priv); 5570 5571 return err; 5572 } 5573 5574 static void ipw2100_security_work(struct work_struct *work) 5575 { 5576 struct ipw2100_priv *priv = 5577 container_of(work, struct ipw2100_priv, security_work.work); 5578 5579 /* If we happen to have reconnected before we get a chance to 5580 * process this, then update the security settings--which causes 5581 * a disassociation to occur */ 5582 if (!(priv->status & STATUS_ASSOCIATED) && 5583 priv->status & STATUS_SECURITY_UPDATED) 5584 ipw2100_configure_security(priv, 0); 5585 } 5586 5587 static void shim__set_security(struct net_device *dev, 5588 struct libipw_security *sec) 5589 { 5590 struct ipw2100_priv *priv = libipw_priv(dev); 5591 int i, force_update = 0; 5592 5593 mutex_lock(&priv->action_mutex); 5594 if (!(priv->status & STATUS_INITIALIZED)) 5595 goto done; 5596 5597 for (i = 0; i < 4; i++) { 5598 if (sec->flags & (1 << i)) { 5599 priv->ieee->sec.key_sizes[i] = sec->key_sizes[i]; 5600 if (sec->key_sizes[i] == 0) 5601 priv->ieee->sec.flags &= ~(1 << i); 5602 else 5603 memcpy(priv->ieee->sec.keys[i], sec->keys[i], 5604 sec->key_sizes[i]); 5605 if (sec->level == SEC_LEVEL_1) { 5606 priv->ieee->sec.flags |= (1 << i); 5607 priv->status |= STATUS_SECURITY_UPDATED; 5608 } else 5609 priv->ieee->sec.flags &= ~(1 << i); 5610 } 5611 } 5612 5613 if ((sec->flags & SEC_ACTIVE_KEY) && 5614 priv->ieee->sec.active_key != sec->active_key) { 5615 if (sec->active_key <= 3) { 5616 priv->ieee->sec.active_key = sec->active_key; 5617 priv->ieee->sec.flags |= SEC_ACTIVE_KEY; 5618 } else 5619 priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; 5620 5621 priv->status |= STATUS_SECURITY_UPDATED; 5622 } 5623 5624 if ((sec->flags & SEC_AUTH_MODE) && 5625 (priv->ieee->sec.auth_mode != sec->auth_mode)) { 5626 priv->ieee->sec.auth_mode = sec->auth_mode; 5627 priv->ieee->sec.flags |= SEC_AUTH_MODE; 5628 priv->status |= STATUS_SECURITY_UPDATED; 5629 } 5630 5631 if (sec->flags & SEC_ENABLED && priv->ieee->sec.enabled != sec->enabled) { 5632 priv->ieee->sec.flags |= SEC_ENABLED; 5633 priv->ieee->sec.enabled = sec->enabled; 5634 priv->status |= STATUS_SECURITY_UPDATED; 5635 force_update = 1; 5636 } 5637 5638 if (sec->flags & SEC_ENCRYPT) 5639 priv->ieee->sec.encrypt = sec->encrypt; 5640 5641 if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) { 5642 priv->ieee->sec.level = sec->level; 5643 priv->ieee->sec.flags |= SEC_LEVEL; 5644 priv->status |= STATUS_SECURITY_UPDATED; 5645 } 5646 5647 IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n", 5648 priv->ieee->sec.flags & (1 << 8) ? '1' : '0', 5649 priv->ieee->sec.flags & (1 << 7) ? '1' : '0', 5650 priv->ieee->sec.flags & (1 << 6) ? '1' : '0', 5651 priv->ieee->sec.flags & (1 << 5) ? '1' : '0', 5652 priv->ieee->sec.flags & (1 << 4) ? '1' : '0', 5653 priv->ieee->sec.flags & (1 << 3) ? '1' : '0', 5654 priv->ieee->sec.flags & (1 << 2) ? '1' : '0', 5655 priv->ieee->sec.flags & (1 << 1) ? '1' : '0', 5656 priv->ieee->sec.flags & (1 << 0) ? '1' : '0'); 5657 5658 /* As a temporary work around to enable WPA until we figure out why 5659 * wpa_supplicant toggles the security capability of the driver, which 5660 * forces a disassocation with force_update... 5661 * 5662 * if (force_update || !(priv->status & STATUS_ASSOCIATED))*/ 5663 if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) 5664 ipw2100_configure_security(priv, 0); 5665 done: 5666 mutex_unlock(&priv->action_mutex); 5667 } 5668 5669 static int ipw2100_adapter_setup(struct ipw2100_priv *priv) 5670 { 5671 int err; 5672 int batch_mode = 1; 5673 u8 *bssid; 5674 5675 IPW_DEBUG_INFO("enter\n"); 5676 5677 err = ipw2100_disable_adapter(priv); 5678 if (err) 5679 return err; 5680 #ifdef CONFIG_IPW2100_MONITOR 5681 if (priv->ieee->iw_mode == IW_MODE_MONITOR) { 5682 err = ipw2100_set_channel(priv, priv->channel, batch_mode); 5683 if (err) 5684 return err; 5685 5686 IPW_DEBUG_INFO("exit\n"); 5687 5688 return 0; 5689 } 5690 #endif /* CONFIG_IPW2100_MONITOR */ 5691 5692 err = ipw2100_read_mac_address(priv); 5693 if (err) 5694 return -EIO; 5695 5696 err = ipw2100_set_mac_address(priv, batch_mode); 5697 if (err) 5698 return err; 5699 5700 err = ipw2100_set_port_type(priv, priv->ieee->iw_mode, batch_mode); 5701 if (err) 5702 return err; 5703 5704 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 5705 err = ipw2100_set_channel(priv, priv->channel, batch_mode); 5706 if (err) 5707 return err; 5708 } 5709 5710 err = ipw2100_system_config(priv, batch_mode); 5711 if (err) 5712 return err; 5713 5714 err = ipw2100_set_tx_rates(priv, priv->tx_rates, batch_mode); 5715 if (err) 5716 return err; 5717 5718 /* Default to power mode OFF */ 5719 err = ipw2100_set_power_mode(priv, IPW_POWER_MODE_CAM); 5720 if (err) 5721 return err; 5722 5723 err = ipw2100_set_rts_threshold(priv, priv->rts_threshold); 5724 if (err) 5725 return err; 5726 5727 if (priv->config & CFG_STATIC_BSSID) 5728 bssid = priv->bssid; 5729 else 5730 bssid = NULL; 5731 err = ipw2100_set_mandatory_bssid(priv, bssid, batch_mode); 5732 if (err) 5733 return err; 5734 5735 if (priv->config & CFG_STATIC_ESSID) 5736 err = ipw2100_set_essid(priv, priv->essid, priv->essid_len, 5737 batch_mode); 5738 else 5739 err = ipw2100_set_essid(priv, NULL, 0, batch_mode); 5740 if (err) 5741 return err; 5742 5743 err = ipw2100_configure_security(priv, batch_mode); 5744 if (err) 5745 return err; 5746 5747 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 5748 err = 5749 ipw2100_set_ibss_beacon_interval(priv, 5750 priv->beacon_interval, 5751 batch_mode); 5752 if (err) 5753 return err; 5754 5755 err = ipw2100_set_tx_power(priv, priv->tx_power); 5756 if (err) 5757 return err; 5758 } 5759 5760 /* 5761 err = ipw2100_set_fragmentation_threshold( 5762 priv, priv->frag_threshold, batch_mode); 5763 if (err) 5764 return err; 5765 */ 5766 5767 IPW_DEBUG_INFO("exit\n"); 5768 5769 return 0; 5770 } 5771 5772 /************************************************************************* 5773 * 5774 * EXTERNALLY CALLED METHODS 5775 * 5776 *************************************************************************/ 5777 5778 /* This method is called by the network layer -- not to be confused with 5779 * ipw2100_set_mac_address() declared above called by this driver (and this 5780 * method as well) to talk to the firmware */ 5781 static int ipw2100_set_address(struct net_device *dev, void *p) 5782 { 5783 struct ipw2100_priv *priv = libipw_priv(dev); 5784 struct sockaddr *addr = p; 5785 int err = 0; 5786 5787 if (!is_valid_ether_addr(addr->sa_data)) 5788 return -EADDRNOTAVAIL; 5789 5790 mutex_lock(&priv->action_mutex); 5791 5792 priv->config |= CFG_CUSTOM_MAC; 5793 memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); 5794 5795 err = ipw2100_set_mac_address(priv, 0); 5796 if (err) 5797 goto done; 5798 5799 priv->reset_backoff = 0; 5800 mutex_unlock(&priv->action_mutex); 5801 ipw2100_reset_adapter(&priv->reset_work.work); 5802 return 0; 5803 5804 done: 5805 mutex_unlock(&priv->action_mutex); 5806 return err; 5807 } 5808 5809 static int ipw2100_open(struct net_device *dev) 5810 { 5811 struct ipw2100_priv *priv = libipw_priv(dev); 5812 unsigned long flags; 5813 IPW_DEBUG_INFO("dev->open\n"); 5814 5815 spin_lock_irqsave(&priv->low_lock, flags); 5816 if (priv->status & STATUS_ASSOCIATED) { 5817 netif_carrier_on(dev); 5818 netif_start_queue(dev); 5819 } 5820 spin_unlock_irqrestore(&priv->low_lock, flags); 5821 5822 return 0; 5823 } 5824 5825 static int ipw2100_close(struct net_device *dev) 5826 { 5827 struct ipw2100_priv *priv = libipw_priv(dev); 5828 unsigned long flags; 5829 struct list_head *element; 5830 struct ipw2100_tx_packet *packet; 5831 5832 IPW_DEBUG_INFO("enter\n"); 5833 5834 spin_lock_irqsave(&priv->low_lock, flags); 5835 5836 if (priv->status & STATUS_ASSOCIATED) 5837 netif_carrier_off(dev); 5838 netif_stop_queue(dev); 5839 5840 /* Flush the TX queue ... */ 5841 while (!list_empty(&priv->tx_pend_list)) { 5842 element = priv->tx_pend_list.next; 5843 packet = list_entry(element, struct ipw2100_tx_packet, list); 5844 5845 list_del(element); 5846 DEC_STAT(&priv->tx_pend_stat); 5847 5848 libipw_txb_free(packet->info.d_struct.txb); 5849 packet->info.d_struct.txb = NULL; 5850 5851 list_add_tail(element, &priv->tx_free_list); 5852 INC_STAT(&priv->tx_free_stat); 5853 } 5854 spin_unlock_irqrestore(&priv->low_lock, flags); 5855 5856 IPW_DEBUG_INFO("exit\n"); 5857 5858 return 0; 5859 } 5860 5861 /* 5862 * TODO: Fix this function... its just wrong 5863 */ 5864 static void ipw2100_tx_timeout(struct net_device *dev) 5865 { 5866 struct ipw2100_priv *priv = libipw_priv(dev); 5867 5868 dev->stats.tx_errors++; 5869 5870 #ifdef CONFIG_IPW2100_MONITOR 5871 if (priv->ieee->iw_mode == IW_MODE_MONITOR) 5872 return; 5873 #endif 5874 5875 IPW_DEBUG_INFO("%s: TX timed out. Scheduling firmware restart.\n", 5876 dev->name); 5877 schedule_reset(priv); 5878 } 5879 5880 static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value) 5881 { 5882 /* This is called when wpa_supplicant loads and closes the driver 5883 * interface. */ 5884 priv->ieee->wpa_enabled = value; 5885 return 0; 5886 } 5887 5888 static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) 5889 { 5890 5891 struct libipw_device *ieee = priv->ieee; 5892 struct libipw_security sec = { 5893 .flags = SEC_AUTH_MODE, 5894 }; 5895 int ret = 0; 5896 5897 if (value & IW_AUTH_ALG_SHARED_KEY) { 5898 sec.auth_mode = WLAN_AUTH_SHARED_KEY; 5899 ieee->open_wep = 0; 5900 } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { 5901 sec.auth_mode = WLAN_AUTH_OPEN; 5902 ieee->open_wep = 1; 5903 } else if (value & IW_AUTH_ALG_LEAP) { 5904 sec.auth_mode = WLAN_AUTH_LEAP; 5905 ieee->open_wep = 1; 5906 } else 5907 return -EINVAL; 5908 5909 if (ieee->set_security) 5910 ieee->set_security(ieee->dev, &sec); 5911 else 5912 ret = -EOPNOTSUPP; 5913 5914 return ret; 5915 } 5916 5917 static void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, 5918 char *wpa_ie, int wpa_ie_len) 5919 { 5920 5921 struct ipw2100_wpa_assoc_frame frame; 5922 5923 frame.fixed_ie_mask = 0; 5924 5925 /* copy WPA IE */ 5926 memcpy(frame.var_ie, wpa_ie, wpa_ie_len); 5927 frame.var_ie_len = wpa_ie_len; 5928 5929 /* make sure WPA is enabled */ 5930 ipw2100_wpa_enable(priv, 1); 5931 ipw2100_set_wpa_ie(priv, &frame, 0); 5932 } 5933 5934 static void ipw_ethtool_get_drvinfo(struct net_device *dev, 5935 struct ethtool_drvinfo *info) 5936 { 5937 struct ipw2100_priv *priv = libipw_priv(dev); 5938 char fw_ver[64], ucode_ver[64]; 5939 5940 strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); 5941 strlcpy(info->version, DRV_VERSION, sizeof(info->version)); 5942 5943 ipw2100_get_fwversion(priv, fw_ver, sizeof(fw_ver)); 5944 ipw2100_get_ucodeversion(priv, ucode_ver, sizeof(ucode_ver)); 5945 5946 snprintf(info->fw_version, sizeof(info->fw_version), "%s:%d:%s", 5947 fw_ver, priv->eeprom_version, ucode_ver); 5948 5949 strlcpy(info->bus_info, pci_name(priv->pci_dev), 5950 sizeof(info->bus_info)); 5951 } 5952 5953 static u32 ipw2100_ethtool_get_link(struct net_device *dev) 5954 { 5955 struct ipw2100_priv *priv = libipw_priv(dev); 5956 return (priv->status & STATUS_ASSOCIATED) ? 1 : 0; 5957 } 5958 5959 static const struct ethtool_ops ipw2100_ethtool_ops = { 5960 .get_link = ipw2100_ethtool_get_link, 5961 .get_drvinfo = ipw_ethtool_get_drvinfo, 5962 }; 5963 5964 static void ipw2100_hang_check(struct work_struct *work) 5965 { 5966 struct ipw2100_priv *priv = 5967 container_of(work, struct ipw2100_priv, hang_check.work); 5968 unsigned long flags; 5969 u32 rtc = 0xa5a5a5a5; 5970 u32 len = sizeof(rtc); 5971 int restart = 0; 5972 5973 spin_lock_irqsave(&priv->low_lock, flags); 5974 5975 if (priv->fatal_error != 0) { 5976 /* If fatal_error is set then we need to restart */ 5977 IPW_DEBUG_INFO("%s: Hardware fatal error detected.\n", 5978 priv->net_dev->name); 5979 5980 restart = 1; 5981 } else if (ipw2100_get_ordinal(priv, IPW_ORD_RTC_TIME, &rtc, &len) || 5982 (rtc == priv->last_rtc)) { 5983 /* Check if firmware is hung */ 5984 IPW_DEBUG_INFO("%s: Firmware RTC stalled.\n", 5985 priv->net_dev->name); 5986 5987 restart = 1; 5988 } 5989 5990 if (restart) { 5991 /* Kill timer */ 5992 priv->stop_hang_check = 1; 5993 priv->hangs++; 5994 5995 /* Restart the NIC */ 5996 schedule_reset(priv); 5997 } 5998 5999 priv->last_rtc = rtc; 6000 6001 if (!priv->stop_hang_check) 6002 schedule_delayed_work(&priv->hang_check, HZ / 2); 6003 6004 spin_unlock_irqrestore(&priv->low_lock, flags); 6005 } 6006 6007 static void ipw2100_rf_kill(struct work_struct *work) 6008 { 6009 struct ipw2100_priv *priv = 6010 container_of(work, struct ipw2100_priv, rf_kill.work); 6011 unsigned long flags; 6012 6013 spin_lock_irqsave(&priv->low_lock, flags); 6014 6015 if (rf_kill_active(priv)) { 6016 IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n"); 6017 if (!priv->stop_rf_kill) 6018 schedule_delayed_work(&priv->rf_kill, 6019 round_jiffies_relative(HZ)); 6020 goto exit_unlock; 6021 } 6022 6023 /* RF Kill is now disabled, so bring the device back up */ 6024 6025 if (!(priv->status & STATUS_RF_KILL_MASK)) { 6026 IPW_DEBUG_RF_KILL("HW RF Kill no longer active, restarting " 6027 "device\n"); 6028 schedule_reset(priv); 6029 } else 6030 IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " 6031 "enabled\n"); 6032 6033 exit_unlock: 6034 spin_unlock_irqrestore(&priv->low_lock, flags); 6035 } 6036 6037 static void ipw2100_irq_tasklet(struct ipw2100_priv *priv); 6038 6039 static const struct net_device_ops ipw2100_netdev_ops = { 6040 .ndo_open = ipw2100_open, 6041 .ndo_stop = ipw2100_close, 6042 .ndo_start_xmit = libipw_xmit, 6043 .ndo_change_mtu = libipw_change_mtu, 6044 .ndo_tx_timeout = ipw2100_tx_timeout, 6045 .ndo_set_mac_address = ipw2100_set_address, 6046 .ndo_validate_addr = eth_validate_addr, 6047 }; 6048 6049 /* Look into using netdev destructor to shutdown libipw? */ 6050 6051 static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, 6052 void __iomem * ioaddr) 6053 { 6054 struct ipw2100_priv *priv; 6055 struct net_device *dev; 6056 6057 dev = alloc_libipw(sizeof(struct ipw2100_priv), 0); 6058 if (!dev) 6059 return NULL; 6060 priv = libipw_priv(dev); 6061 priv->ieee = netdev_priv(dev); 6062 priv->pci_dev = pci_dev; 6063 priv->net_dev = dev; 6064 priv->ioaddr = ioaddr; 6065 6066 priv->ieee->hard_start_xmit = ipw2100_tx; 6067 priv->ieee->set_security = shim__set_security; 6068 6069 priv->ieee->perfect_rssi = -20; 6070 priv->ieee->worst_rssi = -85; 6071 6072 dev->netdev_ops = &ipw2100_netdev_ops; 6073 dev->ethtool_ops = &ipw2100_ethtool_ops; 6074 dev->wireless_handlers = &ipw2100_wx_handler_def; 6075 priv->wireless_data.libipw = priv->ieee; 6076 dev->wireless_data = &priv->wireless_data; 6077 dev->watchdog_timeo = 3 * HZ; 6078 dev->irq = 0; 6079 6080 /* NOTE: We don't use the wireless_handlers hook 6081 * in dev as the system will start throwing WX requests 6082 * to us before we're actually initialized and it just 6083 * ends up causing problems. So, we just handle 6084 * the WX extensions through the ipw2100_ioctl interface */ 6085 6086 /* memset() puts everything to 0, so we only have explicitly set 6087 * those values that need to be something else */ 6088 6089 /* If power management is turned on, default to AUTO mode */ 6090 priv->power_mode = IPW_POWER_AUTO; 6091 6092 #ifdef CONFIG_IPW2100_MONITOR 6093 priv->config |= CFG_CRC_CHECK; 6094 #endif 6095 priv->ieee->wpa_enabled = 0; 6096 priv->ieee->drop_unencrypted = 0; 6097 priv->ieee->privacy_invoked = 0; 6098 priv->ieee->ieee802_1x = 1; 6099 6100 /* Set module parameters */ 6101 switch (network_mode) { 6102 case 1: 6103 priv->ieee->iw_mode = IW_MODE_ADHOC; 6104 break; 6105 #ifdef CONFIG_IPW2100_MONITOR 6106 case 2: 6107 priv->ieee->iw_mode = IW_MODE_MONITOR; 6108 break; 6109 #endif 6110 default: 6111 case 0: 6112 priv->ieee->iw_mode = IW_MODE_INFRA; 6113 break; 6114 } 6115 6116 if (disable == 1) 6117 priv->status |= STATUS_RF_KILL_SW; 6118 6119 if (channel != 0 && 6120 ((channel >= REG_MIN_CHANNEL) && (channel <= REG_MAX_CHANNEL))) { 6121 priv->config |= CFG_STATIC_CHANNEL; 6122 priv->channel = channel; 6123 } 6124 6125 if (associate) 6126 priv->config |= CFG_ASSOCIATE; 6127 6128 priv->beacon_interval = DEFAULT_BEACON_INTERVAL; 6129 priv->short_retry_limit = DEFAULT_SHORT_RETRY_LIMIT; 6130 priv->long_retry_limit = DEFAULT_LONG_RETRY_LIMIT; 6131 priv->rts_threshold = DEFAULT_RTS_THRESHOLD | RTS_DISABLED; 6132 priv->frag_threshold = DEFAULT_FTS | FRAG_DISABLED; 6133 priv->tx_power = IPW_TX_POWER_DEFAULT; 6134 priv->tx_rates = DEFAULT_TX_RATES; 6135 6136 strcpy(priv->nick, "ipw2100"); 6137 6138 spin_lock_init(&priv->low_lock); 6139 mutex_init(&priv->action_mutex); 6140 mutex_init(&priv->adapter_mutex); 6141 6142 init_waitqueue_head(&priv->wait_command_queue); 6143 6144 netif_carrier_off(dev); 6145 6146 INIT_LIST_HEAD(&priv->msg_free_list); 6147 INIT_LIST_HEAD(&priv->msg_pend_list); 6148 INIT_STAT(&priv->msg_free_stat); 6149 INIT_STAT(&priv->msg_pend_stat); 6150 6151 INIT_LIST_HEAD(&priv->tx_free_list); 6152 INIT_LIST_HEAD(&priv->tx_pend_list); 6153 INIT_STAT(&priv->tx_free_stat); 6154 INIT_STAT(&priv->tx_pend_stat); 6155 6156 INIT_LIST_HEAD(&priv->fw_pend_list); 6157 INIT_STAT(&priv->fw_pend_stat); 6158 6159 INIT_DELAYED_WORK(&priv->reset_work, ipw2100_reset_adapter); 6160 INIT_DELAYED_WORK(&priv->security_work, ipw2100_security_work); 6161 INIT_DELAYED_WORK(&priv->wx_event_work, ipw2100_wx_event_work); 6162 INIT_DELAYED_WORK(&priv->hang_check, ipw2100_hang_check); 6163 INIT_DELAYED_WORK(&priv->rf_kill, ipw2100_rf_kill); 6164 INIT_DELAYED_WORK(&priv->scan_event, ipw2100_scan_event); 6165 6166 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 6167 ipw2100_irq_tasklet, (unsigned long)priv); 6168 6169 /* NOTE: We do not start the deferred work for status checks yet */ 6170 priv->stop_rf_kill = 1; 6171 priv->stop_hang_check = 1; 6172 6173 return dev; 6174 } 6175 6176 static int ipw2100_pci_init_one(struct pci_dev *pci_dev, 6177 const struct pci_device_id *ent) 6178 { 6179 void __iomem *ioaddr; 6180 struct net_device *dev = NULL; 6181 struct ipw2100_priv *priv = NULL; 6182 int err = 0; 6183 int registered = 0; 6184 u32 val; 6185 6186 IPW_DEBUG_INFO("enter\n"); 6187 6188 if (!(pci_resource_flags(pci_dev, 0) & IORESOURCE_MEM)) { 6189 IPW_DEBUG_INFO("weird - resource type is not memory\n"); 6190 err = -ENODEV; 6191 goto out; 6192 } 6193 6194 ioaddr = pci_iomap(pci_dev, 0, 0); 6195 if (!ioaddr) { 6196 printk(KERN_WARNING DRV_NAME 6197 "Error calling ioremap_nocache.\n"); 6198 err = -EIO; 6199 goto fail; 6200 } 6201 6202 /* allocate and initialize our net_device */ 6203 dev = ipw2100_alloc_device(pci_dev, ioaddr); 6204 if (!dev) { 6205 printk(KERN_WARNING DRV_NAME 6206 "Error calling ipw2100_alloc_device.\n"); 6207 err = -ENOMEM; 6208 goto fail; 6209 } 6210 6211 /* set up PCI mappings for device */ 6212 err = pci_enable_device(pci_dev); 6213 if (err) { 6214 printk(KERN_WARNING DRV_NAME 6215 "Error calling pci_enable_device.\n"); 6216 return err; 6217 } 6218 6219 priv = libipw_priv(dev); 6220 6221 pci_set_master(pci_dev); 6222 pci_set_drvdata(pci_dev, priv); 6223 6224 err = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)); 6225 if (err) { 6226 printk(KERN_WARNING DRV_NAME 6227 "Error calling pci_set_dma_mask.\n"); 6228 pci_disable_device(pci_dev); 6229 return err; 6230 } 6231 6232 err = pci_request_regions(pci_dev, DRV_NAME); 6233 if (err) { 6234 printk(KERN_WARNING DRV_NAME 6235 "Error calling pci_request_regions.\n"); 6236 pci_disable_device(pci_dev); 6237 return err; 6238 } 6239 6240 /* We disable the RETRY_TIMEOUT register (0x41) to keep 6241 * PCI Tx retries from interfering with C3 CPU state */ 6242 pci_read_config_dword(pci_dev, 0x40, &val); 6243 if ((val & 0x0000ff00) != 0) 6244 pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff); 6245 6246 if (!ipw2100_hw_is_adapter_in_system(dev)) { 6247 printk(KERN_WARNING DRV_NAME 6248 "Device not found via register read.\n"); 6249 err = -ENODEV; 6250 goto fail; 6251 } 6252 6253 SET_NETDEV_DEV(dev, &pci_dev->dev); 6254 6255 /* Force interrupts to be shut off on the device */ 6256 priv->status |= STATUS_INT_ENABLED; 6257 ipw2100_disable_interrupts(priv); 6258 6259 /* Allocate and initialize the Tx/Rx queues and lists */ 6260 if (ipw2100_queues_allocate(priv)) { 6261 printk(KERN_WARNING DRV_NAME 6262 "Error calling ipw2100_queues_allocate.\n"); 6263 err = -ENOMEM; 6264 goto fail; 6265 } 6266 ipw2100_queues_initialize(priv); 6267 6268 err = request_irq(pci_dev->irq, 6269 ipw2100_interrupt, IRQF_SHARED, dev->name, priv); 6270 if (err) { 6271 printk(KERN_WARNING DRV_NAME 6272 "Error calling request_irq: %d.\n", pci_dev->irq); 6273 goto fail; 6274 } 6275 dev->irq = pci_dev->irq; 6276 6277 IPW_DEBUG_INFO("Attempting to register device...\n"); 6278 6279 printk(KERN_INFO DRV_NAME 6280 ": Detected Intel PRO/Wireless 2100 Network Connection\n"); 6281 6282 err = ipw2100_up(priv, 1); 6283 if (err) 6284 goto fail; 6285 6286 err = ipw2100_wdev_init(dev); 6287 if (err) 6288 goto fail; 6289 registered = 1; 6290 6291 /* Bring up the interface. Pre 0.46, after we registered the 6292 * network device we would call ipw2100_up. This introduced a race 6293 * condition with newer hotplug configurations (network was coming 6294 * up and making calls before the device was initialized). 6295 */ 6296 err = register_netdev(dev); 6297 if (err) { 6298 printk(KERN_WARNING DRV_NAME 6299 "Error calling register_netdev.\n"); 6300 goto fail; 6301 } 6302 registered = 2; 6303 6304 mutex_lock(&priv->action_mutex); 6305 6306 IPW_DEBUG_INFO("%s: Bound to %s\n", dev->name, pci_name(pci_dev)); 6307 6308 /* perform this after register_netdev so that dev->name is set */ 6309 err = sysfs_create_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); 6310 if (err) 6311 goto fail_unlock; 6312 6313 /* If the RF Kill switch is disabled, go ahead and complete the 6314 * startup sequence */ 6315 if (!(priv->status & STATUS_RF_KILL_MASK)) { 6316 /* Enable the adapter - sends HOST_COMPLETE */ 6317 if (ipw2100_enable_adapter(priv)) { 6318 printk(KERN_WARNING DRV_NAME 6319 ": %s: failed in call to enable adapter.\n", 6320 priv->net_dev->name); 6321 ipw2100_hw_stop_adapter(priv); 6322 err = -EIO; 6323 goto fail_unlock; 6324 } 6325 6326 /* Start a scan . . . */ 6327 ipw2100_set_scan_options(priv); 6328 ipw2100_start_scan(priv); 6329 } 6330 6331 IPW_DEBUG_INFO("exit\n"); 6332 6333 priv->status |= STATUS_INITIALIZED; 6334 6335 mutex_unlock(&priv->action_mutex); 6336 out: 6337 return err; 6338 6339 fail_unlock: 6340 mutex_unlock(&priv->action_mutex); 6341 fail: 6342 if (dev) { 6343 if (registered >= 2) 6344 unregister_netdev(dev); 6345 6346 if (registered) { 6347 wiphy_unregister(priv->ieee->wdev.wiphy); 6348 kfree(priv->ieee->bg_band.channels); 6349 } 6350 6351 ipw2100_hw_stop_adapter(priv); 6352 6353 ipw2100_disable_interrupts(priv); 6354 6355 if (dev->irq) 6356 free_irq(dev->irq, priv); 6357 6358 ipw2100_kill_works(priv); 6359 6360 /* These are safe to call even if they weren't allocated */ 6361 ipw2100_queues_free(priv); 6362 sysfs_remove_group(&pci_dev->dev.kobj, 6363 &ipw2100_attribute_group); 6364 6365 free_libipw(dev, 0); 6366 } 6367 6368 pci_iounmap(pci_dev, ioaddr); 6369 6370 pci_release_regions(pci_dev); 6371 pci_disable_device(pci_dev); 6372 goto out; 6373 } 6374 6375 static void ipw2100_pci_remove_one(struct pci_dev *pci_dev) 6376 { 6377 struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); 6378 struct net_device *dev = priv->net_dev; 6379 6380 mutex_lock(&priv->action_mutex); 6381 6382 priv->status &= ~STATUS_INITIALIZED; 6383 6384 sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); 6385 6386 #ifdef CONFIG_PM 6387 if (ipw2100_firmware.version) 6388 ipw2100_release_firmware(priv, &ipw2100_firmware); 6389 #endif 6390 /* Take down the hardware */ 6391 ipw2100_down(priv); 6392 6393 /* Release the mutex so that the network subsystem can 6394 * complete any needed calls into the driver... */ 6395 mutex_unlock(&priv->action_mutex); 6396 6397 /* Unregister the device first - this results in close() 6398 * being called if the device is open. If we free storage 6399 * first, then close() will crash. 6400 * FIXME: remove the comment above. */ 6401 unregister_netdev(dev); 6402 6403 ipw2100_kill_works(priv); 6404 6405 ipw2100_queues_free(priv); 6406 6407 /* Free potential debugging firmware snapshot */ 6408 ipw2100_snapshot_free(priv); 6409 6410 free_irq(dev->irq, priv); 6411 6412 pci_iounmap(pci_dev, priv->ioaddr); 6413 6414 /* wiphy_unregister needs to be here, before free_libipw */ 6415 wiphy_unregister(priv->ieee->wdev.wiphy); 6416 kfree(priv->ieee->bg_band.channels); 6417 free_libipw(dev, 0); 6418 6419 pci_release_regions(pci_dev); 6420 pci_disable_device(pci_dev); 6421 6422 IPW_DEBUG_INFO("exit\n"); 6423 } 6424 6425 #ifdef CONFIG_PM 6426 static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) 6427 { 6428 struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); 6429 struct net_device *dev = priv->net_dev; 6430 6431 IPW_DEBUG_INFO("%s: Going into suspend...\n", dev->name); 6432 6433 mutex_lock(&priv->action_mutex); 6434 if (priv->status & STATUS_INITIALIZED) { 6435 /* Take down the device; powers it off, etc. */ 6436 ipw2100_down(priv); 6437 } 6438 6439 /* Remove the PRESENT state of the device */ 6440 netif_device_detach(dev); 6441 6442 pci_save_state(pci_dev); 6443 pci_disable_device(pci_dev); 6444 pci_set_power_state(pci_dev, PCI_D3hot); 6445 6446 priv->suspend_at = get_seconds(); 6447 6448 mutex_unlock(&priv->action_mutex); 6449 6450 return 0; 6451 } 6452 6453 static int ipw2100_resume(struct pci_dev *pci_dev) 6454 { 6455 struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); 6456 struct net_device *dev = priv->net_dev; 6457 int err; 6458 u32 val; 6459 6460 if (IPW2100_PM_DISABLED) 6461 return 0; 6462 6463 mutex_lock(&priv->action_mutex); 6464 6465 IPW_DEBUG_INFO("%s: Coming out of suspend...\n", dev->name); 6466 6467 pci_set_power_state(pci_dev, PCI_D0); 6468 err = pci_enable_device(pci_dev); 6469 if (err) { 6470 printk(KERN_ERR "%s: pci_enable_device failed on resume\n", 6471 dev->name); 6472 mutex_unlock(&priv->action_mutex); 6473 return err; 6474 } 6475 pci_restore_state(pci_dev); 6476 6477 /* 6478 * Suspend/Resume resets the PCI configuration space, so we have to 6479 * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries 6480 * from interfering with C3 CPU state. pci_restore_state won't help 6481 * here since it only restores the first 64 bytes pci config header. 6482 */ 6483 pci_read_config_dword(pci_dev, 0x40, &val); 6484 if ((val & 0x0000ff00) != 0) 6485 pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff); 6486 6487 /* Set the device back into the PRESENT state; this will also wake 6488 * the queue of needed */ 6489 netif_device_attach(dev); 6490 6491 priv->suspend_time = get_seconds() - priv->suspend_at; 6492 6493 /* Bring the device back up */ 6494 if (!(priv->status & STATUS_RF_KILL_SW)) 6495 ipw2100_up(priv, 0); 6496 6497 mutex_unlock(&priv->action_mutex); 6498 6499 return 0; 6500 } 6501 #endif 6502 6503 static void ipw2100_shutdown(struct pci_dev *pci_dev) 6504 { 6505 struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); 6506 6507 /* Take down the device; powers it off, etc. */ 6508 ipw2100_down(priv); 6509 6510 pci_disable_device(pci_dev); 6511 } 6512 6513 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 6514 6515 static DEFINE_PCI_DEVICE_TABLE(ipw2100_pci_id_table) = { 6516 IPW2100_DEV_ID(0x2520), /* IN 2100A mPCI 3A */ 6517 IPW2100_DEV_ID(0x2521), /* IN 2100A mPCI 3B */ 6518 IPW2100_DEV_ID(0x2524), /* IN 2100A mPCI 3B */ 6519 IPW2100_DEV_ID(0x2525), /* IN 2100A mPCI 3B */ 6520 IPW2100_DEV_ID(0x2526), /* IN 2100A mPCI Gen A3 */ 6521 IPW2100_DEV_ID(0x2522), /* IN 2100 mPCI 3B */ 6522 IPW2100_DEV_ID(0x2523), /* IN 2100 mPCI 3A */ 6523 IPW2100_DEV_ID(0x2527), /* IN 2100 mPCI 3B */ 6524 IPW2100_DEV_ID(0x2528), /* IN 2100 mPCI 3B */ 6525 IPW2100_DEV_ID(0x2529), /* IN 2100 mPCI 3B */ 6526 IPW2100_DEV_ID(0x252B), /* IN 2100 mPCI 3A */ 6527 IPW2100_DEV_ID(0x252C), /* IN 2100 mPCI 3A */ 6528 IPW2100_DEV_ID(0x252D), /* IN 2100 mPCI 3A */ 6529 6530 IPW2100_DEV_ID(0x2550), /* IB 2100A mPCI 3B */ 6531 IPW2100_DEV_ID(0x2551), /* IB 2100 mPCI 3B */ 6532 IPW2100_DEV_ID(0x2553), /* IB 2100 mPCI 3B */ 6533 IPW2100_DEV_ID(0x2554), /* IB 2100 mPCI 3B */ 6534 IPW2100_DEV_ID(0x2555), /* IB 2100 mPCI 3B */ 6535 6536 IPW2100_DEV_ID(0x2560), /* DE 2100A mPCI 3A */ 6537 IPW2100_DEV_ID(0x2562), /* DE 2100A mPCI 3A */ 6538 IPW2100_DEV_ID(0x2563), /* DE 2100A mPCI 3A */ 6539 IPW2100_DEV_ID(0x2561), /* DE 2100 mPCI 3A */ 6540 IPW2100_DEV_ID(0x2565), /* DE 2100 mPCI 3A */ 6541 IPW2100_DEV_ID(0x2566), /* DE 2100 mPCI 3A */ 6542 IPW2100_DEV_ID(0x2567), /* DE 2100 mPCI 3A */ 6543 6544 IPW2100_DEV_ID(0x2570), /* GA 2100 mPCI 3B */ 6545 6546 IPW2100_DEV_ID(0x2580), /* TO 2100A mPCI 3B */ 6547 IPW2100_DEV_ID(0x2582), /* TO 2100A mPCI 3B */ 6548 IPW2100_DEV_ID(0x2583), /* TO 2100A mPCI 3B */ 6549 IPW2100_DEV_ID(0x2581), /* TO 2100 mPCI 3B */ 6550 IPW2100_DEV_ID(0x2585), /* TO 2100 mPCI 3B */ 6551 IPW2100_DEV_ID(0x2586), /* TO 2100 mPCI 3B */ 6552 IPW2100_DEV_ID(0x2587), /* TO 2100 mPCI 3B */ 6553 6554 IPW2100_DEV_ID(0x2590), /* SO 2100A mPCI 3B */ 6555 IPW2100_DEV_ID(0x2592), /* SO 2100A mPCI 3B */ 6556 IPW2100_DEV_ID(0x2591), /* SO 2100 mPCI 3B */ 6557 IPW2100_DEV_ID(0x2593), /* SO 2100 mPCI 3B */ 6558 IPW2100_DEV_ID(0x2596), /* SO 2100 mPCI 3B */ 6559 IPW2100_DEV_ID(0x2598), /* SO 2100 mPCI 3B */ 6560 6561 IPW2100_DEV_ID(0x25A0), /* HP 2100 mPCI 3B */ 6562 {0,}, 6563 }; 6564 6565 MODULE_DEVICE_TABLE(pci, ipw2100_pci_id_table); 6566 6567 static struct pci_driver ipw2100_pci_driver = { 6568 .name = DRV_NAME, 6569 .id_table = ipw2100_pci_id_table, 6570 .probe = ipw2100_pci_init_one, 6571 .remove = ipw2100_pci_remove_one, 6572 #ifdef CONFIG_PM 6573 .suspend = ipw2100_suspend, 6574 .resume = ipw2100_resume, 6575 #endif 6576 .shutdown = ipw2100_shutdown, 6577 }; 6578 6579 /** 6580 * Initialize the ipw2100 driver/module 6581 * 6582 * @returns 0 if ok, < 0 errno node con error. 6583 * 6584 * Note: we cannot init the /proc stuff until the PCI driver is there, 6585 * or we risk an unlikely race condition on someone accessing 6586 * uninitialized data in the PCI dev struct through /proc. 6587 */ 6588 static int __init ipw2100_init(void) 6589 { 6590 int ret; 6591 6592 printk(KERN_INFO DRV_NAME ": %s, %s\n", DRV_DESCRIPTION, DRV_VERSION); 6593 printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT); 6594 6595 pm_qos_add_request(&ipw2100_pm_qos_req, PM_QOS_CPU_DMA_LATENCY, 6596 PM_QOS_DEFAULT_VALUE); 6597 6598 ret = pci_register_driver(&ipw2100_pci_driver); 6599 if (ret) 6600 goto out; 6601 6602 #ifdef CONFIG_IPW2100_DEBUG 6603 ipw2100_debug_level = debug; 6604 ret = driver_create_file(&ipw2100_pci_driver.driver, 6605 &driver_attr_debug_level); 6606 #endif 6607 6608 out: 6609 return ret; 6610 } 6611 6612 /** 6613 * Cleanup ipw2100 driver registration 6614 */ 6615 static void __exit ipw2100_exit(void) 6616 { 6617 /* FIXME: IPG: check that we have no instances of the devices open */ 6618 #ifdef CONFIG_IPW2100_DEBUG 6619 driver_remove_file(&ipw2100_pci_driver.driver, 6620 &driver_attr_debug_level); 6621 #endif 6622 pci_unregister_driver(&ipw2100_pci_driver); 6623 pm_qos_remove_request(&ipw2100_pm_qos_req); 6624 } 6625 6626 module_init(ipw2100_init); 6627 module_exit(ipw2100_exit); 6628 6629 static int ipw2100_wx_get_name(struct net_device *dev, 6630 struct iw_request_info *info, 6631 union iwreq_data *wrqu, char *extra) 6632 { 6633 /* 6634 * This can be called at any time. No action lock required 6635 */ 6636 6637 struct ipw2100_priv *priv = libipw_priv(dev); 6638 if (!(priv->status & STATUS_ASSOCIATED)) 6639 strcpy(wrqu->name, "unassociated"); 6640 else 6641 snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11b"); 6642 6643 IPW_DEBUG_WX("Name: %s\n", wrqu->name); 6644 return 0; 6645 } 6646 6647 static int ipw2100_wx_set_freq(struct net_device *dev, 6648 struct iw_request_info *info, 6649 union iwreq_data *wrqu, char *extra) 6650 { 6651 struct ipw2100_priv *priv = libipw_priv(dev); 6652 struct iw_freq *fwrq = &wrqu->freq; 6653 int err = 0; 6654 6655 if (priv->ieee->iw_mode == IW_MODE_INFRA) 6656 return -EOPNOTSUPP; 6657 6658 mutex_lock(&priv->action_mutex); 6659 if (!(priv->status & STATUS_INITIALIZED)) { 6660 err = -EIO; 6661 goto done; 6662 } 6663 6664 /* if setting by freq convert to channel */ 6665 if (fwrq->e == 1) { 6666 if ((fwrq->m >= (int)2.412e8 && fwrq->m <= (int)2.487e8)) { 6667 int f = fwrq->m / 100000; 6668 int c = 0; 6669 6670 while ((c < REG_MAX_CHANNEL) && 6671 (f != ipw2100_frequencies[c])) 6672 c++; 6673 6674 /* hack to fall through */ 6675 fwrq->e = 0; 6676 fwrq->m = c + 1; 6677 } 6678 } 6679 6680 if (fwrq->e > 0 || fwrq->m > 1000) { 6681 err = -EOPNOTSUPP; 6682 goto done; 6683 } else { /* Set the channel */ 6684 IPW_DEBUG_WX("SET Freq/Channel -> %d\n", fwrq->m); 6685 err = ipw2100_set_channel(priv, fwrq->m, 0); 6686 } 6687 6688 done: 6689 mutex_unlock(&priv->action_mutex); 6690 return err; 6691 } 6692 6693 static int ipw2100_wx_get_freq(struct net_device *dev, 6694 struct iw_request_info *info, 6695 union iwreq_data *wrqu, char *extra) 6696 { 6697 /* 6698 * This can be called at any time. No action lock required 6699 */ 6700 6701 struct ipw2100_priv *priv = libipw_priv(dev); 6702 6703 wrqu->freq.e = 0; 6704 6705 /* If we are associated, trying to associate, or have a statically 6706 * configured CHANNEL then return that; otherwise return ANY */ 6707 if (priv->config & CFG_STATIC_CHANNEL || 6708 priv->status & STATUS_ASSOCIATED) 6709 wrqu->freq.m = priv->channel; 6710 else 6711 wrqu->freq.m = 0; 6712 6713 IPW_DEBUG_WX("GET Freq/Channel -> %d\n", priv->channel); 6714 return 0; 6715 6716 } 6717 6718 static int ipw2100_wx_set_mode(struct net_device *dev, 6719 struct iw_request_info *info, 6720 union iwreq_data *wrqu, char *extra) 6721 { 6722 struct ipw2100_priv *priv = libipw_priv(dev); 6723 int err = 0; 6724 6725 IPW_DEBUG_WX("SET Mode -> %d\n", wrqu->mode); 6726 6727 if (wrqu->mode == priv->ieee->iw_mode) 6728 return 0; 6729 6730 mutex_lock(&priv->action_mutex); 6731 if (!(priv->status & STATUS_INITIALIZED)) { 6732 err = -EIO; 6733 goto done; 6734 } 6735 6736 switch (wrqu->mode) { 6737 #ifdef CONFIG_IPW2100_MONITOR 6738 case IW_MODE_MONITOR: 6739 err = ipw2100_switch_mode(priv, IW_MODE_MONITOR); 6740 break; 6741 #endif /* CONFIG_IPW2100_MONITOR */ 6742 case IW_MODE_ADHOC: 6743 err = ipw2100_switch_mode(priv, IW_MODE_ADHOC); 6744 break; 6745 case IW_MODE_INFRA: 6746 case IW_MODE_AUTO: 6747 default: 6748 err = ipw2100_switch_mode(priv, IW_MODE_INFRA); 6749 break; 6750 } 6751 6752 done: 6753 mutex_unlock(&priv->action_mutex); 6754 return err; 6755 } 6756 6757 static int ipw2100_wx_get_mode(struct net_device *dev, 6758 struct iw_request_info *info, 6759 union iwreq_data *wrqu, char *extra) 6760 { 6761 /* 6762 * This can be called at any time. No action lock required 6763 */ 6764 6765 struct ipw2100_priv *priv = libipw_priv(dev); 6766 6767 wrqu->mode = priv->ieee->iw_mode; 6768 IPW_DEBUG_WX("GET Mode -> %d\n", wrqu->mode); 6769 6770 return 0; 6771 } 6772 6773 #define POWER_MODES 5 6774 6775 /* Values are in microsecond */ 6776 static const s32 timeout_duration[POWER_MODES] = { 6777 350000, 6778 250000, 6779 75000, 6780 37000, 6781 25000, 6782 }; 6783 6784 static const s32 period_duration[POWER_MODES] = { 6785 400000, 6786 700000, 6787 1000000, 6788 1000000, 6789 1000000 6790 }; 6791 6792 static int ipw2100_wx_get_range(struct net_device *dev, 6793 struct iw_request_info *info, 6794 union iwreq_data *wrqu, char *extra) 6795 { 6796 /* 6797 * This can be called at any time. No action lock required 6798 */ 6799 6800 struct ipw2100_priv *priv = libipw_priv(dev); 6801 struct iw_range *range = (struct iw_range *)extra; 6802 u16 val; 6803 int i, level; 6804 6805 wrqu->data.length = sizeof(*range); 6806 memset(range, 0, sizeof(*range)); 6807 6808 /* Let's try to keep this struct in the same order as in 6809 * linux/include/wireless.h 6810 */ 6811 6812 /* TODO: See what values we can set, and remove the ones we can't 6813 * set, or fill them with some default data. 6814 */ 6815 6816 /* ~5 Mb/s real (802.11b) */ 6817 range->throughput = 5 * 1000 * 1000; 6818 6819 // range->sensitivity; /* signal level threshold range */ 6820 6821 range->max_qual.qual = 100; 6822 /* TODO: Find real max RSSI and stick here */ 6823 range->max_qual.level = 0; 6824 range->max_qual.noise = 0; 6825 range->max_qual.updated = 7; /* Updated all three */ 6826 6827 range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */ 6828 /* TODO: Find real 'good' to 'bad' threshold value for RSSI */ 6829 range->avg_qual.level = 20 + IPW2100_RSSI_TO_DBM; 6830 range->avg_qual.noise = 0; 6831 range->avg_qual.updated = 7; /* Updated all three */ 6832 6833 range->num_bitrates = RATE_COUNT; 6834 6835 for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) { 6836 range->bitrate[i] = ipw2100_bg_rates[i].bitrate * 100 * 1000; 6837 } 6838 6839 range->min_rts = MIN_RTS_THRESHOLD; 6840 range->max_rts = MAX_RTS_THRESHOLD; 6841 range->min_frag = MIN_FRAG_THRESHOLD; 6842 range->max_frag = MAX_FRAG_THRESHOLD; 6843 6844 range->min_pmp = period_duration[0]; /* Minimal PM period */ 6845 range->max_pmp = period_duration[POWER_MODES - 1]; /* Maximal PM period */ 6846 range->min_pmt = timeout_duration[POWER_MODES - 1]; /* Minimal PM timeout */ 6847 range->max_pmt = timeout_duration[0]; /* Maximal PM timeout */ 6848 6849 /* How to decode max/min PM period */ 6850 range->pmp_flags = IW_POWER_PERIOD; 6851 /* How to decode max/min PM period */ 6852 range->pmt_flags = IW_POWER_TIMEOUT; 6853 /* What PM options are supported */ 6854 range->pm_capa = IW_POWER_TIMEOUT | IW_POWER_PERIOD; 6855 6856 range->encoding_size[0] = 5; 6857 range->encoding_size[1] = 13; /* Different token sizes */ 6858 range->num_encoding_sizes = 2; /* Number of entry in the list */ 6859 range->max_encoding_tokens = WEP_KEYS; /* Max number of tokens */ 6860 // range->encoding_login_index; /* token index for login token */ 6861 6862 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 6863 range->txpower_capa = IW_TXPOW_DBM; 6864 range->num_txpower = IW_MAX_TXPOWER; 6865 for (i = 0, level = (IPW_TX_POWER_MAX_DBM * 16); 6866 i < IW_MAX_TXPOWER; 6867 i++, level -= 6868 ((IPW_TX_POWER_MAX_DBM - 6869 IPW_TX_POWER_MIN_DBM) * 16) / (IW_MAX_TXPOWER - 1)) 6870 range->txpower[i] = level / 16; 6871 } else { 6872 range->txpower_capa = 0; 6873 range->num_txpower = 0; 6874 } 6875 6876 /* Set the Wireless Extension versions */ 6877 range->we_version_compiled = WIRELESS_EXT; 6878 range->we_version_source = 18; 6879 6880 // range->retry_capa; /* What retry options are supported */ 6881 // range->retry_flags; /* How to decode max/min retry limit */ 6882 // range->r_time_flags; /* How to decode max/min retry life */ 6883 // range->min_retry; /* Minimal number of retries */ 6884 // range->max_retry; /* Maximal number of retries */ 6885 // range->min_r_time; /* Minimal retry lifetime */ 6886 // range->max_r_time; /* Maximal retry lifetime */ 6887 6888 range->num_channels = FREQ_COUNT; 6889 6890 val = 0; 6891 for (i = 0; i < FREQ_COUNT; i++) { 6892 // TODO: Include only legal frequencies for some countries 6893 // if (local->channel_mask & (1 << i)) { 6894 range->freq[val].i = i + 1; 6895 range->freq[val].m = ipw2100_frequencies[i] * 100000; 6896 range->freq[val].e = 1; 6897 val++; 6898 // } 6899 if (val == IW_MAX_FREQUENCIES) 6900 break; 6901 } 6902 range->num_frequency = val; 6903 6904 /* Event capability (kernel + driver) */ 6905 range->event_capa[0] = (IW_EVENT_CAPA_K_0 | 6906 IW_EVENT_CAPA_MASK(SIOCGIWAP)); 6907 range->event_capa[1] = IW_EVENT_CAPA_K_1; 6908 6909 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | 6910 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; 6911 6912 IPW_DEBUG_WX("GET Range\n"); 6913 6914 return 0; 6915 } 6916 6917 static int ipw2100_wx_set_wap(struct net_device *dev, 6918 struct iw_request_info *info, 6919 union iwreq_data *wrqu, char *extra) 6920 { 6921 struct ipw2100_priv *priv = libipw_priv(dev); 6922 int err = 0; 6923 6924 // sanity checks 6925 if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) 6926 return -EINVAL; 6927 6928 mutex_lock(&priv->action_mutex); 6929 if (!(priv->status & STATUS_INITIALIZED)) { 6930 err = -EIO; 6931 goto done; 6932 } 6933 6934 if (is_broadcast_ether_addr(wrqu->ap_addr.sa_data) || 6935 is_zero_ether_addr(wrqu->ap_addr.sa_data)) { 6936 /* we disable mandatory BSSID association */ 6937 IPW_DEBUG_WX("exit - disable mandatory BSSID\n"); 6938 priv->config &= ~CFG_STATIC_BSSID; 6939 err = ipw2100_set_mandatory_bssid(priv, NULL, 0); 6940 goto done; 6941 } 6942 6943 priv->config |= CFG_STATIC_BSSID; 6944 memcpy(priv->mandatory_bssid_mac, wrqu->ap_addr.sa_data, ETH_ALEN); 6945 6946 err = ipw2100_set_mandatory_bssid(priv, wrqu->ap_addr.sa_data, 0); 6947 6948 IPW_DEBUG_WX("SET BSSID -> %pM\n", wrqu->ap_addr.sa_data); 6949 6950 done: 6951 mutex_unlock(&priv->action_mutex); 6952 return err; 6953 } 6954 6955 static int ipw2100_wx_get_wap(struct net_device *dev, 6956 struct iw_request_info *info, 6957 union iwreq_data *wrqu, char *extra) 6958 { 6959 /* 6960 * This can be called at any time. No action lock required 6961 */ 6962 6963 struct ipw2100_priv *priv = libipw_priv(dev); 6964 6965 /* If we are associated, trying to associate, or have a statically 6966 * configured BSSID then return that; otherwise return ANY */ 6967 if (priv->config & CFG_STATIC_BSSID || priv->status & STATUS_ASSOCIATED) { 6968 wrqu->ap_addr.sa_family = ARPHRD_ETHER; 6969 memcpy(wrqu->ap_addr.sa_data, priv->bssid, ETH_ALEN); 6970 } else 6971 memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); 6972 6973 IPW_DEBUG_WX("Getting WAP BSSID: %pM\n", wrqu->ap_addr.sa_data); 6974 return 0; 6975 } 6976 6977 static int ipw2100_wx_set_essid(struct net_device *dev, 6978 struct iw_request_info *info, 6979 union iwreq_data *wrqu, char *extra) 6980 { 6981 struct ipw2100_priv *priv = libipw_priv(dev); 6982 char *essid = ""; /* ANY */ 6983 int length = 0; 6984 int err = 0; 6985 DECLARE_SSID_BUF(ssid); 6986 6987 mutex_lock(&priv->action_mutex); 6988 if (!(priv->status & STATUS_INITIALIZED)) { 6989 err = -EIO; 6990 goto done; 6991 } 6992 6993 if (wrqu->essid.flags && wrqu->essid.length) { 6994 length = wrqu->essid.length; 6995 essid = extra; 6996 } 6997 6998 if (length == 0) { 6999 IPW_DEBUG_WX("Setting ESSID to ANY\n"); 7000 priv->config &= ~CFG_STATIC_ESSID; 7001 err = ipw2100_set_essid(priv, NULL, 0, 0); 7002 goto done; 7003 } 7004 7005 length = min(length, IW_ESSID_MAX_SIZE); 7006 7007 priv->config |= CFG_STATIC_ESSID; 7008 7009 if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { 7010 IPW_DEBUG_WX("ESSID set to current ESSID.\n"); 7011 err = 0; 7012 goto done; 7013 } 7014 7015 IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", 7016 print_ssid(ssid, essid, length), length); 7017 7018 priv->essid_len = length; 7019 memcpy(priv->essid, essid, priv->essid_len); 7020 7021 err = ipw2100_set_essid(priv, essid, length, 0); 7022 7023 done: 7024 mutex_unlock(&priv->action_mutex); 7025 return err; 7026 } 7027 7028 static int ipw2100_wx_get_essid(struct net_device *dev, 7029 struct iw_request_info *info, 7030 union iwreq_data *wrqu, char *extra) 7031 { 7032 /* 7033 * This can be called at any time. No action lock required 7034 */ 7035 7036 struct ipw2100_priv *priv = libipw_priv(dev); 7037 DECLARE_SSID_BUF(ssid); 7038 7039 /* If we are associated, trying to associate, or have a statically 7040 * configured ESSID then return that; otherwise return ANY */ 7041 if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) { 7042 IPW_DEBUG_WX("Getting essid: '%s'\n", 7043 print_ssid(ssid, priv->essid, priv->essid_len)); 7044 memcpy(extra, priv->essid, priv->essid_len); 7045 wrqu->essid.length = priv->essid_len; 7046 wrqu->essid.flags = 1; /* active */ 7047 } else { 7048 IPW_DEBUG_WX("Getting essid: ANY\n"); 7049 wrqu->essid.length = 0; 7050 wrqu->essid.flags = 0; /* active */ 7051 } 7052 7053 return 0; 7054 } 7055 7056 static int ipw2100_wx_set_nick(struct net_device *dev, 7057 struct iw_request_info *info, 7058 union iwreq_data *wrqu, char *extra) 7059 { 7060 /* 7061 * This can be called at any time. No action lock required 7062 */ 7063 7064 struct ipw2100_priv *priv = libipw_priv(dev); 7065 7066 if (wrqu->data.length > IW_ESSID_MAX_SIZE) 7067 return -E2BIG; 7068 7069 wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); 7070 memset(priv->nick, 0, sizeof(priv->nick)); 7071 memcpy(priv->nick, extra, wrqu->data.length); 7072 7073 IPW_DEBUG_WX("SET Nickname -> %s\n", priv->nick); 7074 7075 return 0; 7076 } 7077 7078 static int ipw2100_wx_get_nick(struct net_device *dev, 7079 struct iw_request_info *info, 7080 union iwreq_data *wrqu, char *extra) 7081 { 7082 /* 7083 * This can be called at any time. No action lock required 7084 */ 7085 7086 struct ipw2100_priv *priv = libipw_priv(dev); 7087 7088 wrqu->data.length = strlen(priv->nick); 7089 memcpy(extra, priv->nick, wrqu->data.length); 7090 wrqu->data.flags = 1; /* active */ 7091 7092 IPW_DEBUG_WX("GET Nickname -> %s\n", extra); 7093 7094 return 0; 7095 } 7096 7097 static int ipw2100_wx_set_rate(struct net_device *dev, 7098 struct iw_request_info *info, 7099 union iwreq_data *wrqu, char *extra) 7100 { 7101 struct ipw2100_priv *priv = libipw_priv(dev); 7102 u32 target_rate = wrqu->bitrate.value; 7103 u32 rate; 7104 int err = 0; 7105 7106 mutex_lock(&priv->action_mutex); 7107 if (!(priv->status & STATUS_INITIALIZED)) { 7108 err = -EIO; 7109 goto done; 7110 } 7111 7112 rate = 0; 7113 7114 if (target_rate == 1000000 || 7115 (!wrqu->bitrate.fixed && target_rate > 1000000)) 7116 rate |= TX_RATE_1_MBIT; 7117 if (target_rate == 2000000 || 7118 (!wrqu->bitrate.fixed && target_rate > 2000000)) 7119 rate |= TX_RATE_2_MBIT; 7120 if (target_rate == 5500000 || 7121 (!wrqu->bitrate.fixed && target_rate > 5500000)) 7122 rate |= TX_RATE_5_5_MBIT; 7123 if (target_rate == 11000000 || 7124 (!wrqu->bitrate.fixed && target_rate > 11000000)) 7125 rate |= TX_RATE_11_MBIT; 7126 if (rate == 0) 7127 rate = DEFAULT_TX_RATES; 7128 7129 err = ipw2100_set_tx_rates(priv, rate, 0); 7130 7131 IPW_DEBUG_WX("SET Rate -> %04X\n", rate); 7132 done: 7133 mutex_unlock(&priv->action_mutex); 7134 return err; 7135 } 7136 7137 static int ipw2100_wx_get_rate(struct net_device *dev, 7138 struct iw_request_info *info, 7139 union iwreq_data *wrqu, char *extra) 7140 { 7141 struct ipw2100_priv *priv = libipw_priv(dev); 7142 int val; 7143 unsigned int len = sizeof(val); 7144 int err = 0; 7145 7146 if (!(priv->status & STATUS_ENABLED) || 7147 priv->status & STATUS_RF_KILL_MASK || 7148 !(priv->status & STATUS_ASSOCIATED)) { 7149 wrqu->bitrate.value = 0; 7150 return 0; 7151 } 7152 7153 mutex_lock(&priv->action_mutex); 7154 if (!(priv->status & STATUS_INITIALIZED)) { 7155 err = -EIO; 7156 goto done; 7157 } 7158 7159 err = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &val, &len); 7160 if (err) { 7161 IPW_DEBUG_WX("failed querying ordinals.\n"); 7162 goto done; 7163 } 7164 7165 switch (val & TX_RATE_MASK) { 7166 case TX_RATE_1_MBIT: 7167 wrqu->bitrate.value = 1000000; 7168 break; 7169 case TX_RATE_2_MBIT: 7170 wrqu->bitrate.value = 2000000; 7171 break; 7172 case TX_RATE_5_5_MBIT: 7173 wrqu->bitrate.value = 5500000; 7174 break; 7175 case TX_RATE_11_MBIT: 7176 wrqu->bitrate.value = 11000000; 7177 break; 7178 default: 7179 wrqu->bitrate.value = 0; 7180 } 7181 7182 IPW_DEBUG_WX("GET Rate -> %d\n", wrqu->bitrate.value); 7183 7184 done: 7185 mutex_unlock(&priv->action_mutex); 7186 return err; 7187 } 7188 7189 static int ipw2100_wx_set_rts(struct net_device *dev, 7190 struct iw_request_info *info, 7191 union iwreq_data *wrqu, char *extra) 7192 { 7193 struct ipw2100_priv *priv = libipw_priv(dev); 7194 int value, err; 7195 7196 /* Auto RTS not yet supported */ 7197 if (wrqu->rts.fixed == 0) 7198 return -EINVAL; 7199 7200 mutex_lock(&priv->action_mutex); 7201 if (!(priv->status & STATUS_INITIALIZED)) { 7202 err = -EIO; 7203 goto done; 7204 } 7205 7206 if (wrqu->rts.disabled) 7207 value = priv->rts_threshold | RTS_DISABLED; 7208 else { 7209 if (wrqu->rts.value < 1 || wrqu->rts.value > 2304) { 7210 err = -EINVAL; 7211 goto done; 7212 } 7213 value = wrqu->rts.value; 7214 } 7215 7216 err = ipw2100_set_rts_threshold(priv, value); 7217 7218 IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X\n", value); 7219 done: 7220 mutex_unlock(&priv->action_mutex); 7221 return err; 7222 } 7223 7224 static int ipw2100_wx_get_rts(struct net_device *dev, 7225 struct iw_request_info *info, 7226 union iwreq_data *wrqu, char *extra) 7227 { 7228 /* 7229 * This can be called at any time. No action lock required 7230 */ 7231 7232 struct ipw2100_priv *priv = libipw_priv(dev); 7233 7234 wrqu->rts.value = priv->rts_threshold & ~RTS_DISABLED; 7235 wrqu->rts.fixed = 1; /* no auto select */ 7236 7237 /* If RTS is set to the default value, then it is disabled */ 7238 wrqu->rts.disabled = (priv->rts_threshold & RTS_DISABLED) ? 1 : 0; 7239 7240 IPW_DEBUG_WX("GET RTS Threshold -> 0x%08X\n", wrqu->rts.value); 7241 7242 return 0; 7243 } 7244 7245 static int ipw2100_wx_set_txpow(struct net_device *dev, 7246 struct iw_request_info *info, 7247 union iwreq_data *wrqu, char *extra) 7248 { 7249 struct ipw2100_priv *priv = libipw_priv(dev); 7250 int err = 0, value; 7251 7252 if (ipw_radio_kill_sw(priv, wrqu->txpower.disabled)) 7253 return -EINPROGRESS; 7254 7255 if (priv->ieee->iw_mode != IW_MODE_ADHOC) 7256 return 0; 7257 7258 if ((wrqu->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) 7259 return -EINVAL; 7260 7261 if (wrqu->txpower.fixed == 0) 7262 value = IPW_TX_POWER_DEFAULT; 7263 else { 7264 if (wrqu->txpower.value < IPW_TX_POWER_MIN_DBM || 7265 wrqu->txpower.value > IPW_TX_POWER_MAX_DBM) 7266 return -EINVAL; 7267 7268 value = wrqu->txpower.value; 7269 } 7270 7271 mutex_lock(&priv->action_mutex); 7272 if (!(priv->status & STATUS_INITIALIZED)) { 7273 err = -EIO; 7274 goto done; 7275 } 7276 7277 err = ipw2100_set_tx_power(priv, value); 7278 7279 IPW_DEBUG_WX("SET TX Power -> %d\n", value); 7280 7281 done: 7282 mutex_unlock(&priv->action_mutex); 7283 return err; 7284 } 7285 7286 static int ipw2100_wx_get_txpow(struct net_device *dev, 7287 struct iw_request_info *info, 7288 union iwreq_data *wrqu, char *extra) 7289 { 7290 /* 7291 * This can be called at any time. No action lock required 7292 */ 7293 7294 struct ipw2100_priv *priv = libipw_priv(dev); 7295 7296 wrqu->txpower.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; 7297 7298 if (priv->tx_power == IPW_TX_POWER_DEFAULT) { 7299 wrqu->txpower.fixed = 0; 7300 wrqu->txpower.value = IPW_TX_POWER_MAX_DBM; 7301 } else { 7302 wrqu->txpower.fixed = 1; 7303 wrqu->txpower.value = priv->tx_power; 7304 } 7305 7306 wrqu->txpower.flags = IW_TXPOW_DBM; 7307 7308 IPW_DEBUG_WX("GET TX Power -> %d\n", wrqu->txpower.value); 7309 7310 return 0; 7311 } 7312 7313 static int ipw2100_wx_set_frag(struct net_device *dev, 7314 struct iw_request_info *info, 7315 union iwreq_data *wrqu, char *extra) 7316 { 7317 /* 7318 * This can be called at any time. No action lock required 7319 */ 7320 7321 struct ipw2100_priv *priv = libipw_priv(dev); 7322 7323 if (!wrqu->frag.fixed) 7324 return -EINVAL; 7325 7326 if (wrqu->frag.disabled) { 7327 priv->frag_threshold |= FRAG_DISABLED; 7328 priv->ieee->fts = DEFAULT_FTS; 7329 } else { 7330 if (wrqu->frag.value < MIN_FRAG_THRESHOLD || 7331 wrqu->frag.value > MAX_FRAG_THRESHOLD) 7332 return -EINVAL; 7333 7334 priv->ieee->fts = wrqu->frag.value & ~0x1; 7335 priv->frag_threshold = priv->ieee->fts; 7336 } 7337 7338 IPW_DEBUG_WX("SET Frag Threshold -> %d\n", priv->ieee->fts); 7339 7340 return 0; 7341 } 7342 7343 static int ipw2100_wx_get_frag(struct net_device *dev, 7344 struct iw_request_info *info, 7345 union iwreq_data *wrqu, char *extra) 7346 { 7347 /* 7348 * This can be called at any time. No action lock required 7349 */ 7350 7351 struct ipw2100_priv *priv = libipw_priv(dev); 7352 wrqu->frag.value = priv->frag_threshold & ~FRAG_DISABLED; 7353 wrqu->frag.fixed = 0; /* no auto select */ 7354 wrqu->frag.disabled = (priv->frag_threshold & FRAG_DISABLED) ? 1 : 0; 7355 7356 IPW_DEBUG_WX("GET Frag Threshold -> %d\n", wrqu->frag.value); 7357 7358 return 0; 7359 } 7360 7361 static int ipw2100_wx_set_retry(struct net_device *dev, 7362 struct iw_request_info *info, 7363 union iwreq_data *wrqu, char *extra) 7364 { 7365 struct ipw2100_priv *priv = libipw_priv(dev); 7366 int err = 0; 7367 7368 if (wrqu->retry.flags & IW_RETRY_LIFETIME || wrqu->retry.disabled) 7369 return -EINVAL; 7370 7371 if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) 7372 return 0; 7373 7374 mutex_lock(&priv->action_mutex); 7375 if (!(priv->status & STATUS_INITIALIZED)) { 7376 err = -EIO; 7377 goto done; 7378 } 7379 7380 if (wrqu->retry.flags & IW_RETRY_SHORT) { 7381 err = ipw2100_set_short_retry(priv, wrqu->retry.value); 7382 IPW_DEBUG_WX("SET Short Retry Limit -> %d\n", 7383 wrqu->retry.value); 7384 goto done; 7385 } 7386 7387 if (wrqu->retry.flags & IW_RETRY_LONG) { 7388 err = ipw2100_set_long_retry(priv, wrqu->retry.value); 7389 IPW_DEBUG_WX("SET Long Retry Limit -> %d\n", 7390 wrqu->retry.value); 7391 goto done; 7392 } 7393 7394 err = ipw2100_set_short_retry(priv, wrqu->retry.value); 7395 if (!err) 7396 err = ipw2100_set_long_retry(priv, wrqu->retry.value); 7397 7398 IPW_DEBUG_WX("SET Both Retry Limits -> %d\n", wrqu->retry.value); 7399 7400 done: 7401 mutex_unlock(&priv->action_mutex); 7402 return err; 7403 } 7404 7405 static int ipw2100_wx_get_retry(struct net_device *dev, 7406 struct iw_request_info *info, 7407 union iwreq_data *wrqu, char *extra) 7408 { 7409 /* 7410 * This can be called at any time. No action lock required 7411 */ 7412 7413 struct ipw2100_priv *priv = libipw_priv(dev); 7414 7415 wrqu->retry.disabled = 0; /* can't be disabled */ 7416 7417 if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) 7418 return -EINVAL; 7419 7420 if (wrqu->retry.flags & IW_RETRY_LONG) { 7421 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; 7422 wrqu->retry.value = priv->long_retry_limit; 7423 } else { 7424 wrqu->retry.flags = 7425 (priv->short_retry_limit != 7426 priv->long_retry_limit) ? 7427 IW_RETRY_LIMIT | IW_RETRY_SHORT : IW_RETRY_LIMIT; 7428 7429 wrqu->retry.value = priv->short_retry_limit; 7430 } 7431 7432 IPW_DEBUG_WX("GET Retry -> %d\n", wrqu->retry.value); 7433 7434 return 0; 7435 } 7436 7437 static int ipw2100_wx_set_scan(struct net_device *dev, 7438 struct iw_request_info *info, 7439 union iwreq_data *wrqu, char *extra) 7440 { 7441 struct ipw2100_priv *priv = libipw_priv(dev); 7442 int err = 0; 7443 7444 mutex_lock(&priv->action_mutex); 7445 if (!(priv->status & STATUS_INITIALIZED)) { 7446 err = -EIO; 7447 goto done; 7448 } 7449 7450 IPW_DEBUG_WX("Initiating scan...\n"); 7451 7452 priv->user_requested_scan = 1; 7453 if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) { 7454 IPW_DEBUG_WX("Start scan failed.\n"); 7455 7456 /* TODO: Mark a scan as pending so when hardware initialized 7457 * a scan starts */ 7458 } 7459 7460 done: 7461 mutex_unlock(&priv->action_mutex); 7462 return err; 7463 } 7464 7465 static int ipw2100_wx_get_scan(struct net_device *dev, 7466 struct iw_request_info *info, 7467 union iwreq_data *wrqu, char *extra) 7468 { 7469 /* 7470 * This can be called at any time. No action lock required 7471 */ 7472 7473 struct ipw2100_priv *priv = libipw_priv(dev); 7474 return libipw_wx_get_scan(priv->ieee, info, wrqu, extra); 7475 } 7476 7477 /* 7478 * Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c 7479 */ 7480 static int ipw2100_wx_set_encode(struct net_device *dev, 7481 struct iw_request_info *info, 7482 union iwreq_data *wrqu, char *key) 7483 { 7484 /* 7485 * No check of STATUS_INITIALIZED required 7486 */ 7487 7488 struct ipw2100_priv *priv = libipw_priv(dev); 7489 return libipw_wx_set_encode(priv->ieee, info, wrqu, key); 7490 } 7491 7492 static int ipw2100_wx_get_encode(struct net_device *dev, 7493 struct iw_request_info *info, 7494 union iwreq_data *wrqu, char *key) 7495 { 7496 /* 7497 * This can be called at any time. No action lock required 7498 */ 7499 7500 struct ipw2100_priv *priv = libipw_priv(dev); 7501 return libipw_wx_get_encode(priv->ieee, info, wrqu, key); 7502 } 7503 7504 static int ipw2100_wx_set_power(struct net_device *dev, 7505 struct iw_request_info *info, 7506 union iwreq_data *wrqu, char *extra) 7507 { 7508 struct ipw2100_priv *priv = libipw_priv(dev); 7509 int err = 0; 7510 7511 mutex_lock(&priv->action_mutex); 7512 if (!(priv->status & STATUS_INITIALIZED)) { 7513 err = -EIO; 7514 goto done; 7515 } 7516 7517 if (wrqu->power.disabled) { 7518 priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); 7519 err = ipw2100_set_power_mode(priv, IPW_POWER_MODE_CAM); 7520 IPW_DEBUG_WX("SET Power Management Mode -> off\n"); 7521 goto done; 7522 } 7523 7524 switch (wrqu->power.flags & IW_POWER_MODE) { 7525 case IW_POWER_ON: /* If not specified */ 7526 case IW_POWER_MODE: /* If set all mask */ 7527 case IW_POWER_ALL_R: /* If explicitly state all */ 7528 break; 7529 default: /* Otherwise we don't support it */ 7530 IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", 7531 wrqu->power.flags); 7532 err = -EOPNOTSUPP; 7533 goto done; 7534 } 7535 7536 /* If the user hasn't specified a power management mode yet, default 7537 * to BATTERY */ 7538 priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; 7539 err = ipw2100_set_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); 7540 7541 IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); 7542 7543 done: 7544 mutex_unlock(&priv->action_mutex); 7545 return err; 7546 7547 } 7548 7549 static int ipw2100_wx_get_power(struct net_device *dev, 7550 struct iw_request_info *info, 7551 union iwreq_data *wrqu, char *extra) 7552 { 7553 /* 7554 * This can be called at any time. No action lock required 7555 */ 7556 7557 struct ipw2100_priv *priv = libipw_priv(dev); 7558 7559 if (!(priv->power_mode & IPW_POWER_ENABLED)) 7560 wrqu->power.disabled = 1; 7561 else { 7562 wrqu->power.disabled = 0; 7563 wrqu->power.flags = 0; 7564 } 7565 7566 IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); 7567 7568 return 0; 7569 } 7570 7571 /* 7572 * WE-18 WPA support 7573 */ 7574 7575 /* SIOCSIWGENIE */ 7576 static int ipw2100_wx_set_genie(struct net_device *dev, 7577 struct iw_request_info *info, 7578 union iwreq_data *wrqu, char *extra) 7579 { 7580 7581 struct ipw2100_priv *priv = libipw_priv(dev); 7582 struct libipw_device *ieee = priv->ieee; 7583 u8 *buf; 7584 7585 if (!ieee->wpa_enabled) 7586 return -EOPNOTSUPP; 7587 7588 if (wrqu->data.length > MAX_WPA_IE_LEN || 7589 (wrqu->data.length && extra == NULL)) 7590 return -EINVAL; 7591 7592 if (wrqu->data.length) { 7593 buf = kmemdup(extra, wrqu->data.length, GFP_KERNEL); 7594 if (buf == NULL) 7595 return -ENOMEM; 7596 7597 kfree(ieee->wpa_ie); 7598 ieee->wpa_ie = buf; 7599 ieee->wpa_ie_len = wrqu->data.length; 7600 } else { 7601 kfree(ieee->wpa_ie); 7602 ieee->wpa_ie = NULL; 7603 ieee->wpa_ie_len = 0; 7604 } 7605 7606 ipw2100_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); 7607 7608 return 0; 7609 } 7610 7611 /* SIOCGIWGENIE */ 7612 static int ipw2100_wx_get_genie(struct net_device *dev, 7613 struct iw_request_info *info, 7614 union iwreq_data *wrqu, char *extra) 7615 { 7616 struct ipw2100_priv *priv = libipw_priv(dev); 7617 struct libipw_device *ieee = priv->ieee; 7618 7619 if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { 7620 wrqu->data.length = 0; 7621 return 0; 7622 } 7623 7624 if (wrqu->data.length < ieee->wpa_ie_len) 7625 return -E2BIG; 7626 7627 wrqu->data.length = ieee->wpa_ie_len; 7628 memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); 7629 7630 return 0; 7631 } 7632 7633 /* SIOCSIWAUTH */ 7634 static int ipw2100_wx_set_auth(struct net_device *dev, 7635 struct iw_request_info *info, 7636 union iwreq_data *wrqu, char *extra) 7637 { 7638 struct ipw2100_priv *priv = libipw_priv(dev); 7639 struct libipw_device *ieee = priv->ieee; 7640 struct iw_param *param = &wrqu->param; 7641 struct lib80211_crypt_data *crypt; 7642 unsigned long flags; 7643 int ret = 0; 7644 7645 switch (param->flags & IW_AUTH_INDEX) { 7646 case IW_AUTH_WPA_VERSION: 7647 case IW_AUTH_CIPHER_PAIRWISE: 7648 case IW_AUTH_CIPHER_GROUP: 7649 case IW_AUTH_KEY_MGMT: 7650 /* 7651 * ipw2200 does not use these parameters 7652 */ 7653 break; 7654 7655 case IW_AUTH_TKIP_COUNTERMEASURES: 7656 crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx]; 7657 if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) 7658 break; 7659 7660 flags = crypt->ops->get_flags(crypt->priv); 7661 7662 if (param->value) 7663 flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; 7664 else 7665 flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; 7666 7667 crypt->ops->set_flags(flags, crypt->priv); 7668 7669 break; 7670 7671 case IW_AUTH_DROP_UNENCRYPTED:{ 7672 /* HACK: 7673 * 7674 * wpa_supplicant calls set_wpa_enabled when the driver 7675 * is loaded and unloaded, regardless of if WPA is being 7676 * used. No other calls are made which can be used to 7677 * determine if encryption will be used or not prior to 7678 * association being expected. If encryption is not being 7679 * used, drop_unencrypted is set to false, else true -- we 7680 * can use this to determine if the CAP_PRIVACY_ON bit should 7681 * be set. 7682 */ 7683 struct libipw_security sec = { 7684 .flags = SEC_ENABLED, 7685 .enabled = param->value, 7686 }; 7687 priv->ieee->drop_unencrypted = param->value; 7688 /* We only change SEC_LEVEL for open mode. Others 7689 * are set by ipw_wpa_set_encryption. 7690 */ 7691 if (!param->value) { 7692 sec.flags |= SEC_LEVEL; 7693 sec.level = SEC_LEVEL_0; 7694 } else { 7695 sec.flags |= SEC_LEVEL; 7696 sec.level = SEC_LEVEL_1; 7697 } 7698 if (priv->ieee->set_security) 7699 priv->ieee->set_security(priv->ieee->dev, &sec); 7700 break; 7701 } 7702 7703 case IW_AUTH_80211_AUTH_ALG: 7704 ret = ipw2100_wpa_set_auth_algs(priv, param->value); 7705 break; 7706 7707 case IW_AUTH_WPA_ENABLED: 7708 ret = ipw2100_wpa_enable(priv, param->value); 7709 break; 7710 7711 case IW_AUTH_RX_UNENCRYPTED_EAPOL: 7712 ieee->ieee802_1x = param->value; 7713 break; 7714 7715 //case IW_AUTH_ROAMING_CONTROL: 7716 case IW_AUTH_PRIVACY_INVOKED: 7717 ieee->privacy_invoked = param->value; 7718 break; 7719 7720 default: 7721 return -EOPNOTSUPP; 7722 } 7723 return ret; 7724 } 7725 7726 /* SIOCGIWAUTH */ 7727 static int ipw2100_wx_get_auth(struct net_device *dev, 7728 struct iw_request_info *info, 7729 union iwreq_data *wrqu, char *extra) 7730 { 7731 struct ipw2100_priv *priv = libipw_priv(dev); 7732 struct libipw_device *ieee = priv->ieee; 7733 struct lib80211_crypt_data *crypt; 7734 struct iw_param *param = &wrqu->param; 7735 int ret = 0; 7736 7737 switch (param->flags & IW_AUTH_INDEX) { 7738 case IW_AUTH_WPA_VERSION: 7739 case IW_AUTH_CIPHER_PAIRWISE: 7740 case IW_AUTH_CIPHER_GROUP: 7741 case IW_AUTH_KEY_MGMT: 7742 /* 7743 * wpa_supplicant will control these internally 7744 */ 7745 ret = -EOPNOTSUPP; 7746 break; 7747 7748 case IW_AUTH_TKIP_COUNTERMEASURES: 7749 crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx]; 7750 if (!crypt || !crypt->ops->get_flags) { 7751 IPW_DEBUG_WARNING("Can't get TKIP countermeasures: " 7752 "crypt not set!\n"); 7753 break; 7754 } 7755 7756 param->value = (crypt->ops->get_flags(crypt->priv) & 7757 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) ? 1 : 0; 7758 7759 break; 7760 7761 case IW_AUTH_DROP_UNENCRYPTED: 7762 param->value = ieee->drop_unencrypted; 7763 break; 7764 7765 case IW_AUTH_80211_AUTH_ALG: 7766 param->value = priv->ieee->sec.auth_mode; 7767 break; 7768 7769 case IW_AUTH_WPA_ENABLED: 7770 param->value = ieee->wpa_enabled; 7771 break; 7772 7773 case IW_AUTH_RX_UNENCRYPTED_EAPOL: 7774 param->value = ieee->ieee802_1x; 7775 break; 7776 7777 case IW_AUTH_ROAMING_CONTROL: 7778 case IW_AUTH_PRIVACY_INVOKED: 7779 param->value = ieee->privacy_invoked; 7780 break; 7781 7782 default: 7783 return -EOPNOTSUPP; 7784 } 7785 return 0; 7786 } 7787 7788 /* SIOCSIWENCODEEXT */ 7789 static int ipw2100_wx_set_encodeext(struct net_device *dev, 7790 struct iw_request_info *info, 7791 union iwreq_data *wrqu, char *extra) 7792 { 7793 struct ipw2100_priv *priv = libipw_priv(dev); 7794 return libipw_wx_set_encodeext(priv->ieee, info, wrqu, extra); 7795 } 7796 7797 /* SIOCGIWENCODEEXT */ 7798 static int ipw2100_wx_get_encodeext(struct net_device *dev, 7799 struct iw_request_info *info, 7800 union iwreq_data *wrqu, char *extra) 7801 { 7802 struct ipw2100_priv *priv = libipw_priv(dev); 7803 return libipw_wx_get_encodeext(priv->ieee, info, wrqu, extra); 7804 } 7805 7806 /* SIOCSIWMLME */ 7807 static int ipw2100_wx_set_mlme(struct net_device *dev, 7808 struct iw_request_info *info, 7809 union iwreq_data *wrqu, char *extra) 7810 { 7811 struct ipw2100_priv *priv = libipw_priv(dev); 7812 struct iw_mlme *mlme = (struct iw_mlme *)extra; 7813 __le16 reason; 7814 7815 reason = cpu_to_le16(mlme->reason_code); 7816 7817 switch (mlme->cmd) { 7818 case IW_MLME_DEAUTH: 7819 // silently ignore 7820 break; 7821 7822 case IW_MLME_DISASSOC: 7823 ipw2100_disassociate_bssid(priv); 7824 break; 7825 7826 default: 7827 return -EOPNOTSUPP; 7828 } 7829 return 0; 7830 } 7831 7832 /* 7833 * 7834 * IWPRIV handlers 7835 * 7836 */ 7837 #ifdef CONFIG_IPW2100_MONITOR 7838 static int ipw2100_wx_set_promisc(struct net_device *dev, 7839 struct iw_request_info *info, 7840 union iwreq_data *wrqu, char *extra) 7841 { 7842 struct ipw2100_priv *priv = libipw_priv(dev); 7843 int *parms = (int *)extra; 7844 int enable = (parms[0] > 0); 7845 int err = 0; 7846 7847 mutex_lock(&priv->action_mutex); 7848 if (!(priv->status & STATUS_INITIALIZED)) { 7849 err = -EIO; 7850 goto done; 7851 } 7852 7853 if (enable) { 7854 if (priv->ieee->iw_mode == IW_MODE_MONITOR) { 7855 err = ipw2100_set_channel(priv, parms[1], 0); 7856 goto done; 7857 } 7858 priv->channel = parms[1]; 7859 err = ipw2100_switch_mode(priv, IW_MODE_MONITOR); 7860 } else { 7861 if (priv->ieee->iw_mode == IW_MODE_MONITOR) 7862 err = ipw2100_switch_mode(priv, priv->last_mode); 7863 } 7864 done: 7865 mutex_unlock(&priv->action_mutex); 7866 return err; 7867 } 7868 7869 static int ipw2100_wx_reset(struct net_device *dev, 7870 struct iw_request_info *info, 7871 union iwreq_data *wrqu, char *extra) 7872 { 7873 struct ipw2100_priv *priv = libipw_priv(dev); 7874 if (priv->status & STATUS_INITIALIZED) 7875 schedule_reset(priv); 7876 return 0; 7877 } 7878 7879 #endif 7880 7881 static int ipw2100_wx_set_powermode(struct net_device *dev, 7882 struct iw_request_info *info, 7883 union iwreq_data *wrqu, char *extra) 7884 { 7885 struct ipw2100_priv *priv = libipw_priv(dev); 7886 int err = 0, mode = *(int *)extra; 7887 7888 mutex_lock(&priv->action_mutex); 7889 if (!(priv->status & STATUS_INITIALIZED)) { 7890 err = -EIO; 7891 goto done; 7892 } 7893 7894 if ((mode < 0) || (mode > POWER_MODES)) 7895 mode = IPW_POWER_AUTO; 7896 7897 if (IPW_POWER_LEVEL(priv->power_mode) != mode) 7898 err = ipw2100_set_power_mode(priv, mode); 7899 done: 7900 mutex_unlock(&priv->action_mutex); 7901 return err; 7902 } 7903 7904 #define MAX_POWER_STRING 80 7905 static int ipw2100_wx_get_powermode(struct net_device *dev, 7906 struct iw_request_info *info, 7907 union iwreq_data *wrqu, char *extra) 7908 { 7909 /* 7910 * This can be called at any time. No action lock required 7911 */ 7912 7913 struct ipw2100_priv *priv = libipw_priv(dev); 7914 int level = IPW_POWER_LEVEL(priv->power_mode); 7915 s32 timeout, period; 7916 7917 if (!(priv->power_mode & IPW_POWER_ENABLED)) { 7918 snprintf(extra, MAX_POWER_STRING, 7919 "Power save level: %d (Off)", level); 7920 } else { 7921 switch (level) { 7922 case IPW_POWER_MODE_CAM: 7923 snprintf(extra, MAX_POWER_STRING, 7924 "Power save level: %d (None)", level); 7925 break; 7926 case IPW_POWER_AUTO: 7927 snprintf(extra, MAX_POWER_STRING, 7928 "Power save level: %d (Auto)", level); 7929 break; 7930 default: 7931 timeout = timeout_duration[level - 1] / 1000; 7932 period = period_duration[level - 1] / 1000; 7933 snprintf(extra, MAX_POWER_STRING, 7934 "Power save level: %d " 7935 "(Timeout %dms, Period %dms)", 7936 level, timeout, period); 7937 } 7938 } 7939 7940 wrqu->data.length = strlen(extra) + 1; 7941 7942 return 0; 7943 } 7944 7945 static int ipw2100_wx_set_preamble(struct net_device *dev, 7946 struct iw_request_info *info, 7947 union iwreq_data *wrqu, char *extra) 7948 { 7949 struct ipw2100_priv *priv = libipw_priv(dev); 7950 int err, mode = *(int *)extra; 7951 7952 mutex_lock(&priv->action_mutex); 7953 if (!(priv->status & STATUS_INITIALIZED)) { 7954 err = -EIO; 7955 goto done; 7956 } 7957 7958 if (mode == 1) 7959 priv->config |= CFG_LONG_PREAMBLE; 7960 else if (mode == 0) 7961 priv->config &= ~CFG_LONG_PREAMBLE; 7962 else { 7963 err = -EINVAL; 7964 goto done; 7965 } 7966 7967 err = ipw2100_system_config(priv, 0); 7968 7969 done: 7970 mutex_unlock(&priv->action_mutex); 7971 return err; 7972 } 7973 7974 static int ipw2100_wx_get_preamble(struct net_device *dev, 7975 struct iw_request_info *info, 7976 union iwreq_data *wrqu, char *extra) 7977 { 7978 /* 7979 * This can be called at any time. No action lock required 7980 */ 7981 7982 struct ipw2100_priv *priv = libipw_priv(dev); 7983 7984 if (priv->config & CFG_LONG_PREAMBLE) 7985 snprintf(wrqu->name, IFNAMSIZ, "long (1)"); 7986 else 7987 snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); 7988 7989 return 0; 7990 } 7991 7992 #ifdef CONFIG_IPW2100_MONITOR 7993 static int ipw2100_wx_set_crc_check(struct net_device *dev, 7994 struct iw_request_info *info, 7995 union iwreq_data *wrqu, char *extra) 7996 { 7997 struct ipw2100_priv *priv = libipw_priv(dev); 7998 int err, mode = *(int *)extra; 7999 8000 mutex_lock(&priv->action_mutex); 8001 if (!(priv->status & STATUS_INITIALIZED)) { 8002 err = -EIO; 8003 goto done; 8004 } 8005 8006 if (mode == 1) 8007 priv->config |= CFG_CRC_CHECK; 8008 else if (mode == 0) 8009 priv->config &= ~CFG_CRC_CHECK; 8010 else { 8011 err = -EINVAL; 8012 goto done; 8013 } 8014 err = 0; 8015 8016 done: 8017 mutex_unlock(&priv->action_mutex); 8018 return err; 8019 } 8020 8021 static int ipw2100_wx_get_crc_check(struct net_device *dev, 8022 struct iw_request_info *info, 8023 union iwreq_data *wrqu, char *extra) 8024 { 8025 /* 8026 * This can be called at any time. No action lock required 8027 */ 8028 8029 struct ipw2100_priv *priv = libipw_priv(dev); 8030 8031 if (priv->config & CFG_CRC_CHECK) 8032 snprintf(wrqu->name, IFNAMSIZ, "CRC checked (1)"); 8033 else 8034 snprintf(wrqu->name, IFNAMSIZ, "CRC ignored (0)"); 8035 8036 return 0; 8037 } 8038 #endif /* CONFIG_IPW2100_MONITOR */ 8039 8040 static iw_handler ipw2100_wx_handlers[] = { 8041 IW_HANDLER(SIOCGIWNAME, ipw2100_wx_get_name), 8042 IW_HANDLER(SIOCSIWFREQ, ipw2100_wx_set_freq), 8043 IW_HANDLER(SIOCGIWFREQ, ipw2100_wx_get_freq), 8044 IW_HANDLER(SIOCSIWMODE, ipw2100_wx_set_mode), 8045 IW_HANDLER(SIOCGIWMODE, ipw2100_wx_get_mode), 8046 IW_HANDLER(SIOCGIWRANGE, ipw2100_wx_get_range), 8047 IW_HANDLER(SIOCSIWAP, ipw2100_wx_set_wap), 8048 IW_HANDLER(SIOCGIWAP, ipw2100_wx_get_wap), 8049 IW_HANDLER(SIOCSIWMLME, ipw2100_wx_set_mlme), 8050 IW_HANDLER(SIOCSIWSCAN, ipw2100_wx_set_scan), 8051 IW_HANDLER(SIOCGIWSCAN, ipw2100_wx_get_scan), 8052 IW_HANDLER(SIOCSIWESSID, ipw2100_wx_set_essid), 8053 IW_HANDLER(SIOCGIWESSID, ipw2100_wx_get_essid), 8054 IW_HANDLER(SIOCSIWNICKN, ipw2100_wx_set_nick), 8055 IW_HANDLER(SIOCGIWNICKN, ipw2100_wx_get_nick), 8056 IW_HANDLER(SIOCSIWRATE, ipw2100_wx_set_rate), 8057 IW_HANDLER(SIOCGIWRATE, ipw2100_wx_get_rate), 8058 IW_HANDLER(SIOCSIWRTS, ipw2100_wx_set_rts), 8059 IW_HANDLER(SIOCGIWRTS, ipw2100_wx_get_rts), 8060 IW_HANDLER(SIOCSIWFRAG, ipw2100_wx_set_frag), 8061 IW_HANDLER(SIOCGIWFRAG, ipw2100_wx_get_frag), 8062 IW_HANDLER(SIOCSIWTXPOW, ipw2100_wx_set_txpow), 8063 IW_HANDLER(SIOCGIWTXPOW, ipw2100_wx_get_txpow), 8064 IW_HANDLER(SIOCSIWRETRY, ipw2100_wx_set_retry), 8065 IW_HANDLER(SIOCGIWRETRY, ipw2100_wx_get_retry), 8066 IW_HANDLER(SIOCSIWENCODE, ipw2100_wx_set_encode), 8067 IW_HANDLER(SIOCGIWENCODE, ipw2100_wx_get_encode), 8068 IW_HANDLER(SIOCSIWPOWER, ipw2100_wx_set_power), 8069 IW_HANDLER(SIOCGIWPOWER, ipw2100_wx_get_power), 8070 IW_HANDLER(SIOCSIWGENIE, ipw2100_wx_set_genie), 8071 IW_HANDLER(SIOCGIWGENIE, ipw2100_wx_get_genie), 8072 IW_HANDLER(SIOCSIWAUTH, ipw2100_wx_set_auth), 8073 IW_HANDLER(SIOCGIWAUTH, ipw2100_wx_get_auth), 8074 IW_HANDLER(SIOCSIWENCODEEXT, ipw2100_wx_set_encodeext), 8075 IW_HANDLER(SIOCGIWENCODEEXT, ipw2100_wx_get_encodeext), 8076 }; 8077 8078 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 8079 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 8080 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 8081 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 8082 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 8083 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 8084 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 8085 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 8086 8087 static const struct iw_priv_args ipw2100_private_args[] = { 8088 8089 #ifdef CONFIG_IPW2100_MONITOR 8090 { 8091 IPW2100_PRIV_SET_MONITOR, 8092 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, 8093 { 8094 IPW2100_PRIV_RESET, 8095 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, 8096 #endif /* CONFIG_IPW2100_MONITOR */ 8097 8098 { 8099 IPW2100_PRIV_SET_POWER, 8100 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_power"}, 8101 { 8102 IPW2100_PRIV_GET_POWER, 8103 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_POWER_STRING, 8104 "get_power"}, 8105 { 8106 IPW2100_PRIV_SET_LONGPREAMBLE, 8107 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble"}, 8108 { 8109 IPW2100_PRIV_GET_LONGPREAMBLE, 8110 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_preamble"}, 8111 #ifdef CONFIG_IPW2100_MONITOR 8112 { 8113 IPW2100_PRIV_SET_CRC_CHECK, 8114 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_crc_check"}, 8115 { 8116 IPW2100_PRIV_GET_CRC_CHECK, 8117 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_crc_check"}, 8118 #endif /* CONFIG_IPW2100_MONITOR */ 8119 }; 8120 8121 static iw_handler ipw2100_private_handler[] = { 8122 #ifdef CONFIG_IPW2100_MONITOR 8123 ipw2100_wx_set_promisc, 8124 ipw2100_wx_reset, 8125 #else /* CONFIG_IPW2100_MONITOR */ 8126 NULL, 8127 NULL, 8128 #endif /* CONFIG_IPW2100_MONITOR */ 8129 ipw2100_wx_set_powermode, 8130 ipw2100_wx_get_powermode, 8131 ipw2100_wx_set_preamble, 8132 ipw2100_wx_get_preamble, 8133 #ifdef CONFIG_IPW2100_MONITOR 8134 ipw2100_wx_set_crc_check, 8135 ipw2100_wx_get_crc_check, 8136 #else /* CONFIG_IPW2100_MONITOR */ 8137 NULL, 8138 NULL, 8139 #endif /* CONFIG_IPW2100_MONITOR */ 8140 }; 8141 8142 /* 8143 * Get wireless statistics. 8144 * Called by /proc/net/wireless 8145 * Also called by SIOCGIWSTATS 8146 */ 8147 static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev) 8148 { 8149 enum { 8150 POOR = 30, 8151 FAIR = 60, 8152 GOOD = 80, 8153 VERY_GOOD = 90, 8154 EXCELLENT = 95, 8155 PERFECT = 100 8156 }; 8157 int rssi_qual; 8158 int tx_qual; 8159 int beacon_qual; 8160 int quality; 8161 8162 struct ipw2100_priv *priv = libipw_priv(dev); 8163 struct iw_statistics *wstats; 8164 u32 rssi, tx_retries, missed_beacons, tx_failures; 8165 u32 ord_len = sizeof(u32); 8166 8167 if (!priv) 8168 return (struct iw_statistics *)NULL; 8169 8170 wstats = &priv->wstats; 8171 8172 /* if hw is disabled, then ipw2100_get_ordinal() can't be called. 8173 * ipw2100_wx_wireless_stats seems to be called before fw is 8174 * initialized. STATUS_ASSOCIATED will only be set if the hw is up 8175 * and associated; if not associcated, the values are all meaningless 8176 * anyway, so set them all to NULL and INVALID */ 8177 if (!(priv->status & STATUS_ASSOCIATED)) { 8178 wstats->miss.beacon = 0; 8179 wstats->discard.retries = 0; 8180 wstats->qual.qual = 0; 8181 wstats->qual.level = 0; 8182 wstats->qual.noise = 0; 8183 wstats->qual.updated = 7; 8184 wstats->qual.updated |= IW_QUAL_NOISE_INVALID | 8185 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; 8186 return wstats; 8187 } 8188 8189 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_MISSED_BCNS, 8190 &missed_beacons, &ord_len)) 8191 goto fail_get_ordinal; 8192 8193 /* If we don't have a connection the quality and level is 0 */ 8194 if (!(priv->status & STATUS_ASSOCIATED)) { 8195 wstats->qual.qual = 0; 8196 wstats->qual.level = 0; 8197 } else { 8198 if (ipw2100_get_ordinal(priv, IPW_ORD_RSSI_AVG_CURR, 8199 &rssi, &ord_len)) 8200 goto fail_get_ordinal; 8201 wstats->qual.level = rssi + IPW2100_RSSI_TO_DBM; 8202 if (rssi < 10) 8203 rssi_qual = rssi * POOR / 10; 8204 else if (rssi < 15) 8205 rssi_qual = (rssi - 10) * (FAIR - POOR) / 5 + POOR; 8206 else if (rssi < 20) 8207 rssi_qual = (rssi - 15) * (GOOD - FAIR) / 5 + FAIR; 8208 else if (rssi < 30) 8209 rssi_qual = (rssi - 20) * (VERY_GOOD - GOOD) / 8210 10 + GOOD; 8211 else 8212 rssi_qual = (rssi - 30) * (PERFECT - VERY_GOOD) / 8213 10 + VERY_GOOD; 8214 8215 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_RETRIES, 8216 &tx_retries, &ord_len)) 8217 goto fail_get_ordinal; 8218 8219 if (tx_retries > 75) 8220 tx_qual = (90 - tx_retries) * POOR / 15; 8221 else if (tx_retries > 70) 8222 tx_qual = (75 - tx_retries) * (FAIR - POOR) / 5 + POOR; 8223 else if (tx_retries > 65) 8224 tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR; 8225 else if (tx_retries > 50) 8226 tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) / 8227 15 + GOOD; 8228 else 8229 tx_qual = (50 - tx_retries) * 8230 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; 8231 8232 if (missed_beacons > 50) 8233 beacon_qual = (60 - missed_beacons) * POOR / 10; 8234 else if (missed_beacons > 40) 8235 beacon_qual = (50 - missed_beacons) * (FAIR - POOR) / 8236 10 + POOR; 8237 else if (missed_beacons > 32) 8238 beacon_qual = (40 - missed_beacons) * (GOOD - FAIR) / 8239 18 + FAIR; 8240 else if (missed_beacons > 20) 8241 beacon_qual = (32 - missed_beacons) * 8242 (VERY_GOOD - GOOD) / 20 + GOOD; 8243 else 8244 beacon_qual = (20 - missed_beacons) * 8245 (PERFECT - VERY_GOOD) / 20 + VERY_GOOD; 8246 8247 quality = min(tx_qual, rssi_qual); 8248 quality = min(beacon_qual, quality); 8249 8250 #ifdef CONFIG_IPW2100_DEBUG 8251 if (beacon_qual == quality) 8252 IPW_DEBUG_WX("Quality clamped by Missed Beacons\n"); 8253 else if (tx_qual == quality) 8254 IPW_DEBUG_WX("Quality clamped by Tx Retries\n"); 8255 else if (quality != 100) 8256 IPW_DEBUG_WX("Quality clamped by Signal Strength\n"); 8257 else 8258 IPW_DEBUG_WX("Quality not clamped.\n"); 8259 #endif 8260 8261 wstats->qual.qual = quality; 8262 wstats->qual.level = rssi + IPW2100_RSSI_TO_DBM; 8263 } 8264 8265 wstats->qual.noise = 0; 8266 wstats->qual.updated = 7; 8267 wstats->qual.updated |= IW_QUAL_NOISE_INVALID; 8268 8269 /* FIXME: this is percent and not a # */ 8270 wstats->miss.beacon = missed_beacons; 8271 8272 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURES, 8273 &tx_failures, &ord_len)) 8274 goto fail_get_ordinal; 8275 wstats->discard.retries = tx_failures; 8276 8277 return wstats; 8278 8279 fail_get_ordinal: 8280 IPW_DEBUG_WX("failed querying ordinals.\n"); 8281 8282 return (struct iw_statistics *)NULL; 8283 } 8284 8285 static struct iw_handler_def ipw2100_wx_handler_def = { 8286 .standard = ipw2100_wx_handlers, 8287 .num_standard = ARRAY_SIZE(ipw2100_wx_handlers), 8288 .num_private = ARRAY_SIZE(ipw2100_private_handler), 8289 .num_private_args = ARRAY_SIZE(ipw2100_private_args), 8290 .private = (iw_handler *) ipw2100_private_handler, 8291 .private_args = (struct iw_priv_args *)ipw2100_private_args, 8292 .get_wireless_stats = ipw2100_wx_wireless_stats, 8293 }; 8294 8295 static void ipw2100_wx_event_work(struct work_struct *work) 8296 { 8297 struct ipw2100_priv *priv = 8298 container_of(work, struct ipw2100_priv, wx_event_work.work); 8299 union iwreq_data wrqu; 8300 unsigned int len = ETH_ALEN; 8301 8302 if (priv->status & STATUS_STOPPING) 8303 return; 8304 8305 mutex_lock(&priv->action_mutex); 8306 8307 IPW_DEBUG_WX("enter\n"); 8308 8309 mutex_unlock(&priv->action_mutex); 8310 8311 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 8312 8313 /* Fetch BSSID from the hardware */ 8314 if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) || 8315 priv->status & STATUS_RF_KILL_MASK || 8316 ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, 8317 &priv->bssid, &len)) { 8318 memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); 8319 } else { 8320 /* We now have the BSSID, so can finish setting to the full 8321 * associated state */ 8322 memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); 8323 memcpy(priv->ieee->bssid, priv->bssid, ETH_ALEN); 8324 priv->status &= ~STATUS_ASSOCIATING; 8325 priv->status |= STATUS_ASSOCIATED; 8326 netif_carrier_on(priv->net_dev); 8327 netif_wake_queue(priv->net_dev); 8328 } 8329 8330 if (!(priv->status & STATUS_ASSOCIATED)) { 8331 IPW_DEBUG_WX("Configuring ESSID\n"); 8332 mutex_lock(&priv->action_mutex); 8333 /* This is a disassociation event, so kick the firmware to 8334 * look for another AP */ 8335 if (priv->config & CFG_STATIC_ESSID) 8336 ipw2100_set_essid(priv, priv->essid, priv->essid_len, 8337 0); 8338 else 8339 ipw2100_set_essid(priv, NULL, 0, 0); 8340 mutex_unlock(&priv->action_mutex); 8341 } 8342 8343 wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); 8344 } 8345 8346 #define IPW2100_FW_MAJOR_VERSION 1 8347 #define IPW2100_FW_MINOR_VERSION 3 8348 8349 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 8350 #define IPW2100_FW_MAJOR(x) (x & 0xff) 8351 8352 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 8353 IPW2100_FW_MAJOR_VERSION) 8354 8355 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 8356 "." __stringify(IPW2100_FW_MINOR_VERSION) 8357 8358 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 8359 8360 /* 8361 8362 BINARY FIRMWARE HEADER FORMAT 8363 8364 offset length desc 8365 0 2 version 8366 2 2 mode == 0:BSS,1:IBSS,2:MONITOR 8367 4 4 fw_len 8368 8 4 uc_len 8369 C fw_len firmware data 8370 12 + fw_len uc_len microcode data 8371 8372 */ 8373 8374 struct ipw2100_fw_header { 8375 short version; 8376 short mode; 8377 unsigned int fw_size; 8378 unsigned int uc_size; 8379 } __packed; 8380 8381 static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw) 8382 { 8383 struct ipw2100_fw_header *h = 8384 (struct ipw2100_fw_header *)fw->fw_entry->data; 8385 8386 if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) { 8387 printk(KERN_WARNING DRV_NAME ": Firmware image not compatible " 8388 "(detected version id of %u). " 8389 "See Documentation/networking/README.ipw2100\n", 8390 h->version); 8391 return 1; 8392 } 8393 8394 fw->version = h->version; 8395 fw->fw.data = fw->fw_entry->data + sizeof(struct ipw2100_fw_header); 8396 fw->fw.size = h->fw_size; 8397 fw->uc.data = fw->fw.data + h->fw_size; 8398 fw->uc.size = h->uc_size; 8399 8400 return 0; 8401 } 8402 8403 static int ipw2100_get_firmware(struct ipw2100_priv *priv, 8404 struct ipw2100_fw *fw) 8405 { 8406 char *fw_name; 8407 int rc; 8408 8409 IPW_DEBUG_INFO("%s: Using hotplug firmware load.\n", 8410 priv->net_dev->name); 8411 8412 switch (priv->ieee->iw_mode) { 8413 case IW_MODE_ADHOC: 8414 fw_name = IPW2100_FW_NAME("-i"); 8415 break; 8416 #ifdef CONFIG_IPW2100_MONITOR 8417 case IW_MODE_MONITOR: 8418 fw_name = IPW2100_FW_NAME("-p"); 8419 break; 8420 #endif 8421 case IW_MODE_INFRA: 8422 default: 8423 fw_name = IPW2100_FW_NAME(""); 8424 break; 8425 } 8426 8427 rc = request_firmware(&fw->fw_entry, fw_name, &priv->pci_dev->dev); 8428 8429 if (rc < 0) { 8430 printk(KERN_ERR DRV_NAME ": " 8431 "%s: Firmware '%s' not available or load failed.\n", 8432 priv->net_dev->name, fw_name); 8433 return rc; 8434 } 8435 IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data, 8436 fw->fw_entry->size); 8437 8438 ipw2100_mod_firmware_load(fw); 8439 8440 return 0; 8441 } 8442 8443 MODULE_FIRMWARE(IPW2100_FW_NAME("-i")); 8444 #ifdef CONFIG_IPW2100_MONITOR 8445 MODULE_FIRMWARE(IPW2100_FW_NAME("-p")); 8446 #endif 8447 MODULE_FIRMWARE(IPW2100_FW_NAME("")); 8448 8449 static void ipw2100_release_firmware(struct ipw2100_priv *priv, 8450 struct ipw2100_fw *fw) 8451 { 8452 fw->version = 0; 8453 release_firmware(fw->fw_entry); 8454 fw->fw_entry = NULL; 8455 } 8456 8457 static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, 8458 size_t max) 8459 { 8460 char ver[MAX_FW_VERSION_LEN]; 8461 u32 len = MAX_FW_VERSION_LEN; 8462 u32 tmp; 8463 int i; 8464 /* firmware version is an ascii string (max len of 14) */ 8465 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_FW_VER_NUM, ver, &len)) 8466 return -EIO; 8467 tmp = max; 8468 if (len >= max) 8469 len = max - 1; 8470 for (i = 0; i < len; i++) 8471 buf[i] = ver[i]; 8472 buf[i] = '\0'; 8473 return tmp; 8474 } 8475 8476 static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, 8477 size_t max) 8478 { 8479 u32 ver; 8480 u32 len = sizeof(ver); 8481 /* microcode version is a 32 bit integer */ 8482 if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, &ver, &len)) 8483 return -EIO; 8484 return snprintf(buf, max, "%08X", ver); 8485 } 8486 8487 /* 8488 * On exit, the firmware will have been freed from the fw list 8489 */ 8490 static int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw) 8491 { 8492 /* firmware is constructed of N contiguous entries, each entry is 8493 * structured as: 8494 * 8495 * offset sie desc 8496 * 0 4 address to write to 8497 * 4 2 length of data run 8498 * 6 length data 8499 */ 8500 unsigned int addr; 8501 unsigned short len; 8502 8503 const unsigned char *firmware_data = fw->fw.data; 8504 unsigned int firmware_data_left = fw->fw.size; 8505 8506 while (firmware_data_left > 0) { 8507 addr = *(u32 *) (firmware_data); 8508 firmware_data += 4; 8509 firmware_data_left -= 4; 8510 8511 len = *(u16 *) (firmware_data); 8512 firmware_data += 2; 8513 firmware_data_left -= 2; 8514 8515 if (len > 32) { 8516 printk(KERN_ERR DRV_NAME ": " 8517 "Invalid firmware run-length of %d bytes\n", 8518 len); 8519 return -EINVAL; 8520 } 8521 8522 write_nic_memory(priv->net_dev, addr, len, firmware_data); 8523 firmware_data += len; 8524 firmware_data_left -= len; 8525 } 8526 8527 return 0; 8528 } 8529 8530 struct symbol_alive_response { 8531 u8 cmd_id; 8532 u8 seq_num; 8533 u8 ucode_rev; 8534 u8 eeprom_valid; 8535 u16 valid_flags; 8536 u8 IEEE_addr[6]; 8537 u16 flags; 8538 u16 pcb_rev; 8539 u16 clock_settle_time; // 1us LSB 8540 u16 powerup_settle_time; // 1us LSB 8541 u16 hop_settle_time; // 1us LSB 8542 u8 date[3]; // month, day, year 8543 u8 time[2]; // hours, minutes 8544 u8 ucode_valid; 8545 }; 8546 8547 static int ipw2100_ucode_download(struct ipw2100_priv *priv, 8548 struct ipw2100_fw *fw) 8549 { 8550 struct net_device *dev = priv->net_dev; 8551 const unsigned char *microcode_data = fw->uc.data; 8552 unsigned int microcode_data_left = fw->uc.size; 8553 void __iomem *reg = priv->ioaddr; 8554 8555 struct symbol_alive_response response; 8556 int i, j; 8557 u8 data; 8558 8559 /* Symbol control */ 8560 write_nic_word(dev, IPW2100_CONTROL_REG, 0x703); 8561 readl(reg); 8562 write_nic_word(dev, IPW2100_CONTROL_REG, 0x707); 8563 readl(reg); 8564 8565 /* HW config */ 8566 write_nic_byte(dev, 0x210014, 0x72); /* fifo width =16 */ 8567 readl(reg); 8568 write_nic_byte(dev, 0x210014, 0x72); /* fifo width =16 */ 8569 readl(reg); 8570 8571 /* EN_CS_ACCESS bit to reset control store pointer */ 8572 write_nic_byte(dev, 0x210000, 0x40); 8573 readl(reg); 8574 write_nic_byte(dev, 0x210000, 0x0); 8575 readl(reg); 8576 write_nic_byte(dev, 0x210000, 0x40); 8577 readl(reg); 8578 8579 /* copy microcode from buffer into Symbol */ 8580 8581 while (microcode_data_left > 0) { 8582 write_nic_byte(dev, 0x210010, *microcode_data++); 8583 write_nic_byte(dev, 0x210010, *microcode_data++); 8584 microcode_data_left -= 2; 8585 } 8586 8587 /* EN_CS_ACCESS bit to reset the control store pointer */ 8588 write_nic_byte(dev, 0x210000, 0x0); 8589 readl(reg); 8590 8591 /* Enable System (Reg 0) 8592 * first enable causes garbage in RX FIFO */ 8593 write_nic_byte(dev, 0x210000, 0x0); 8594 readl(reg); 8595 write_nic_byte(dev, 0x210000, 0x80); 8596 readl(reg); 8597 8598 /* Reset External Baseband Reg */ 8599 write_nic_word(dev, IPW2100_CONTROL_REG, 0x703); 8600 readl(reg); 8601 write_nic_word(dev, IPW2100_CONTROL_REG, 0x707); 8602 readl(reg); 8603 8604 /* HW Config (Reg 5) */ 8605 write_nic_byte(dev, 0x210014, 0x72); // fifo width =16 8606 readl(reg); 8607 write_nic_byte(dev, 0x210014, 0x72); // fifo width =16 8608 readl(reg); 8609 8610 /* Enable System (Reg 0) 8611 * second enable should be OK */ 8612 write_nic_byte(dev, 0x210000, 0x00); // clear enable system 8613 readl(reg); 8614 write_nic_byte(dev, 0x210000, 0x80); // set enable system 8615 8616 /* check Symbol is enabled - upped this from 5 as it wasn't always 8617 * catching the update */ 8618 for (i = 0; i < 10; i++) { 8619 udelay(10); 8620 8621 /* check Dino is enabled bit */ 8622 read_nic_byte(dev, 0x210000, &data); 8623 if (data & 0x1) 8624 break; 8625 } 8626 8627 if (i == 10) { 8628 printk(KERN_ERR DRV_NAME ": %s: Error initializing Symbol\n", 8629 dev->name); 8630 return -EIO; 8631 } 8632 8633 /* Get Symbol alive response */ 8634 for (i = 0; i < 30; i++) { 8635 /* Read alive response structure */ 8636 for (j = 0; 8637 j < (sizeof(struct symbol_alive_response) >> 1); j++) 8638 read_nic_word(dev, 0x210004, ((u16 *) & response) + j); 8639 8640 if ((response.cmd_id == 1) && (response.ucode_valid == 0x1)) 8641 break; 8642 udelay(10); 8643 } 8644 8645 if (i == 30) { 8646 printk(KERN_ERR DRV_NAME 8647 ": %s: No response from Symbol - hw not alive\n", 8648 dev->name); 8649 printk_buf(IPW_DL_ERROR, (u8 *) & response, sizeof(response)); 8650 return -EIO; 8651 } 8652 8653 return 0; 8654 } 8655 8656 8657 8658 8659 8660 /* LDV_COMMENT_BEGIN_MAIN */ 8661 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 8662 8663 /*###########################################################################*/ 8664 8665 /*############## Driver Environment Generator 0.2 output ####################*/ 8666 8667 /*###########################################################################*/ 8668 8669 8670 8671 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test if all kernel resources are correctly released by driver before driver will be unloaded. */ 8672 void ldv_check_final_state(void); 8673 8674 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 8675 void ldv_check_return_value(int res); 8676 8677 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 8678 void ldv_check_return_value_probe(int res); 8679 8680 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 8681 void ldv_initialize(void); 8682 8683 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 8684 void ldv_handler_precall(void); 8685 8686 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 8687 int nondet_int(void); 8688 8689 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 8690 int LDV_IN_INTERRUPT; 8691 8692 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 8693 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 8694 8695 8696 8697 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 8698 /*============================= VARIABLE DECLARATION PART =============================*/ 8699 /** STRUCT: struct type: ethtool_ops, struct name: ipw2100_ethtool_ops **/ 8700 /* content: static u32 ipw2100_ethtool_get_link(struct net_device *dev)*/ 8701 /* LDV_COMMENT_BEGIN_PREP */ 8702 #define IPW2100_VERSION "git-1.2.2" 8703 #define DRV_NAME "ipw2100" 8704 #define DRV_VERSION IPW2100_VERSION 8705 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 8706 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 8707 #ifdef CONFIG_IPW2100_DEBUG 8708 #define IPW2100_RX_DEBUG 8709 #endif 8710 #ifdef CONFIG_PM 8711 #endif 8712 #ifdef CONFIG_IPW2100_DEBUG 8713 #define IPW_DEBUG(level, message...) \ 8714 do { \ 8715 if (ipw2100_debug_level & (level)) { \ 8716 printk(KERN_DEBUG "ipw2100: %c %s ", \ 8717 in_interrupt() ? 'I' : 'U', __func__); \ 8718 printk(message); \ 8719 } \ 8720 } while (0) 8721 #else 8722 #define IPW_DEBUG(level, message...) do {} while (0) 8723 #endif 8724 #ifdef CONFIG_IPW2100_DEBUG 8725 #endif 8726 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 8727 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 8728 #define MAX_RESET_BACKOFF 10 8729 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 8730 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 8731 #ifndef CONFIG_PM 8732 #endif 8733 #ifdef CONFIG_PM 8734 #else 8735 #endif 8736 #ifndef CONFIG_PM 8737 #endif 8738 #define MAX_RF_KILL_CHECKS 5 8739 #define RF_KILL_CHECK_DELAY 40 8740 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 8741 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 8742 #define MAC_ASSOCIATION_READ_DELAY (HZ) 8743 #ifdef CONFIG_IPW2100_DEBUG 8744 #define IPW2100_HANDLER(v, f) { v, f, # v } 8745 #else 8746 #define IPW2100_HANDLER(v, f) { v, f } 8747 #endif 8748 #ifdef CONFIG_IPW2100_DEBUG 8749 #endif 8750 #ifdef CONFIG_IPW2100_DEBUG 8751 #endif 8752 #define SEARCH_ERROR 0xffffffff 8753 #define SEARCH_FAIL 0xfffffffe 8754 #define SEARCH_SUCCESS 0xfffffff0 8755 #define SEARCH_DISCARD 0 8756 #define SEARCH_SNAPSHOT 1 8757 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 8758 #ifdef IPW2100_DEBUG_C3 8759 #endif 8760 #ifdef IPW2100_RX_DEBUG 8761 #endif 8762 #ifdef IPW2100_DEBUG_C3 8763 #endif 8764 #ifdef IPW2100_DEBUG_C3 8765 #endif 8766 #ifdef IPW2100_RX_DEBUG 8767 #endif 8768 #ifdef IPW2100_RX_DEBUG 8769 #endif 8770 #ifdef CONFIG_IPW2100_MONITOR 8771 #endif 8772 #ifdef CONFIG_IPW2100_MONITOR 8773 #else 8774 #endif 8775 #ifdef CONFIG_IPW2100_MONITOR 8776 #endif 8777 #ifdef CONFIG_IPW2100_DEBUG 8778 #endif 8779 #ifdef CONFIG_IPW2100_DEBUG 8780 #endif 8781 #ifdef CONFIG_IPW2100_DEBUG 8782 #endif 8783 #define IPW2100_REG(x) { IPW_ ##x, #x } 8784 #define IPW2100_NIC(x, s) { x, #x, s } 8785 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 8786 #ifdef CONFIG_IPW2100_DEBUG 8787 #endif 8788 #ifdef CONFIG_IPW2100_MONITOR 8789 #endif 8790 #ifdef CONFIG_PM 8791 #endif 8792 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 8793 #ifdef CONFIG_IPW2100_DEBUG 8794 #endif 8795 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 8796 #endif 8797 #ifdef IPW2100_TX_POWER 8798 #endif 8799 #if 0 8800 #endif 8801 #ifdef CONFIG_IPW2100_DEBUG 8802 #endif 8803 #define IPW_PRIVACY_CAPABLE 0x0008 8804 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 8805 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 8806 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 8807 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 8808 #ifdef CONFIG_IPW2100_MONITOR 8809 #endif 8810 #ifdef CONFIG_IPW2100_MONITOR 8811 #endif 8812 /* LDV_COMMENT_END_PREP */ 8813 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_ethtool_get_link" */ 8814 struct net_device * var_group1; 8815 /* LDV_COMMENT_BEGIN_PREP */ 8816 #ifdef CONFIG_IPW2100_MONITOR 8817 #endif 8818 #ifdef CONFIG_IPW2100_MONITOR 8819 #endif 8820 #ifdef CONFIG_PM 8821 #endif 8822 #ifdef CONFIG_PM 8823 #endif 8824 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 8825 #ifdef CONFIG_PM 8826 #endif 8827 #ifdef CONFIG_IPW2100_DEBUG 8828 #endif 8829 #ifdef CONFIG_IPW2100_DEBUG 8830 #endif 8831 #ifdef CONFIG_IPW2100_MONITOR 8832 #endif 8833 #define POWER_MODES 5 8834 #ifdef CONFIG_IPW2100_MONITOR 8835 #endif 8836 #define MAX_POWER_STRING 80 8837 #ifdef CONFIG_IPW2100_MONITOR 8838 #endif 8839 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 8840 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 8841 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 8842 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 8843 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 8844 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 8845 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 8846 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 8847 #ifdef CONFIG_IPW2100_MONITOR 8848 #endif 8849 #ifdef CONFIG_IPW2100_MONITOR 8850 #endif 8851 #ifdef CONFIG_IPW2100_MONITOR 8852 #else 8853 #endif 8854 #ifdef CONFIG_IPW2100_MONITOR 8855 #else 8856 #endif 8857 #ifdef CONFIG_IPW2100_DEBUG 8858 #endif 8859 #define IPW2100_FW_MAJOR_VERSION 1 8860 #define IPW2100_FW_MINOR_VERSION 3 8861 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 8862 #define IPW2100_FW_MAJOR(x) (x & 0xff) 8863 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 8864 IPW2100_FW_MAJOR_VERSION) 8865 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 8866 "." __stringify(IPW2100_FW_MINOR_VERSION) 8867 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 8868 #ifdef CONFIG_IPW2100_MONITOR 8869 #endif 8870 #ifdef CONFIG_IPW2100_MONITOR 8871 #endif 8872 /* LDV_COMMENT_END_PREP */ 8873 /* content: static void ipw_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)*/ 8874 /* LDV_COMMENT_BEGIN_PREP */ 8875 #define IPW2100_VERSION "git-1.2.2" 8876 #define DRV_NAME "ipw2100" 8877 #define DRV_VERSION IPW2100_VERSION 8878 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 8879 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 8880 #ifdef CONFIG_IPW2100_DEBUG 8881 #define IPW2100_RX_DEBUG 8882 #endif 8883 #ifdef CONFIG_PM 8884 #endif 8885 #ifdef CONFIG_IPW2100_DEBUG 8886 #define IPW_DEBUG(level, message...) \ 8887 do { \ 8888 if (ipw2100_debug_level & (level)) { \ 8889 printk(KERN_DEBUG "ipw2100: %c %s ", \ 8890 in_interrupt() ? 'I' : 'U', __func__); \ 8891 printk(message); \ 8892 } \ 8893 } while (0) 8894 #else 8895 #define IPW_DEBUG(level, message...) do {} while (0) 8896 #endif 8897 #ifdef CONFIG_IPW2100_DEBUG 8898 #endif 8899 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 8900 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 8901 #define MAX_RESET_BACKOFF 10 8902 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 8903 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 8904 #ifndef CONFIG_PM 8905 #endif 8906 #ifdef CONFIG_PM 8907 #else 8908 #endif 8909 #ifndef CONFIG_PM 8910 #endif 8911 #define MAX_RF_KILL_CHECKS 5 8912 #define RF_KILL_CHECK_DELAY 40 8913 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 8914 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 8915 #define MAC_ASSOCIATION_READ_DELAY (HZ) 8916 #ifdef CONFIG_IPW2100_DEBUG 8917 #define IPW2100_HANDLER(v, f) { v, f, # v } 8918 #else 8919 #define IPW2100_HANDLER(v, f) { v, f } 8920 #endif 8921 #ifdef CONFIG_IPW2100_DEBUG 8922 #endif 8923 #ifdef CONFIG_IPW2100_DEBUG 8924 #endif 8925 #define SEARCH_ERROR 0xffffffff 8926 #define SEARCH_FAIL 0xfffffffe 8927 #define SEARCH_SUCCESS 0xfffffff0 8928 #define SEARCH_DISCARD 0 8929 #define SEARCH_SNAPSHOT 1 8930 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 8931 #ifdef IPW2100_DEBUG_C3 8932 #endif 8933 #ifdef IPW2100_RX_DEBUG 8934 #endif 8935 #ifdef IPW2100_DEBUG_C3 8936 #endif 8937 #ifdef IPW2100_DEBUG_C3 8938 #endif 8939 #ifdef IPW2100_RX_DEBUG 8940 #endif 8941 #ifdef IPW2100_RX_DEBUG 8942 #endif 8943 #ifdef CONFIG_IPW2100_MONITOR 8944 #endif 8945 #ifdef CONFIG_IPW2100_MONITOR 8946 #else 8947 #endif 8948 #ifdef CONFIG_IPW2100_MONITOR 8949 #endif 8950 #ifdef CONFIG_IPW2100_DEBUG 8951 #endif 8952 #ifdef CONFIG_IPW2100_DEBUG 8953 #endif 8954 #ifdef CONFIG_IPW2100_DEBUG 8955 #endif 8956 #define IPW2100_REG(x) { IPW_ ##x, #x } 8957 #define IPW2100_NIC(x, s) { x, #x, s } 8958 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 8959 #ifdef CONFIG_IPW2100_DEBUG 8960 #endif 8961 #ifdef CONFIG_IPW2100_MONITOR 8962 #endif 8963 #ifdef CONFIG_PM 8964 #endif 8965 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 8966 #ifdef CONFIG_IPW2100_DEBUG 8967 #endif 8968 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 8969 #endif 8970 #ifdef IPW2100_TX_POWER 8971 #endif 8972 #if 0 8973 #endif 8974 #ifdef CONFIG_IPW2100_DEBUG 8975 #endif 8976 #define IPW_PRIVACY_CAPABLE 0x0008 8977 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 8978 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 8979 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 8980 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 8981 #ifdef CONFIG_IPW2100_MONITOR 8982 #endif 8983 #ifdef CONFIG_IPW2100_MONITOR 8984 #endif 8985 /* LDV_COMMENT_END_PREP */ 8986 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw_ethtool_get_drvinfo" */ 8987 struct ethtool_drvinfo * var_group2; 8988 /* LDV_COMMENT_BEGIN_PREP */ 8989 #ifdef CONFIG_IPW2100_MONITOR 8990 #endif 8991 #ifdef CONFIG_IPW2100_MONITOR 8992 #endif 8993 #ifdef CONFIG_PM 8994 #endif 8995 #ifdef CONFIG_PM 8996 #endif 8997 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 8998 #ifdef CONFIG_PM 8999 #endif 9000 #ifdef CONFIG_IPW2100_DEBUG 9001 #endif 9002 #ifdef CONFIG_IPW2100_DEBUG 9003 #endif 9004 #ifdef CONFIG_IPW2100_MONITOR 9005 #endif 9006 #define POWER_MODES 5 9007 #ifdef CONFIG_IPW2100_MONITOR 9008 #endif 9009 #define MAX_POWER_STRING 80 9010 #ifdef CONFIG_IPW2100_MONITOR 9011 #endif 9012 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 9013 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 9014 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 9015 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 9016 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 9017 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 9018 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 9019 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 9020 #ifdef CONFIG_IPW2100_MONITOR 9021 #endif 9022 #ifdef CONFIG_IPW2100_MONITOR 9023 #endif 9024 #ifdef CONFIG_IPW2100_MONITOR 9025 #else 9026 #endif 9027 #ifdef CONFIG_IPW2100_MONITOR 9028 #else 9029 #endif 9030 #ifdef CONFIG_IPW2100_DEBUG 9031 #endif 9032 #define IPW2100_FW_MAJOR_VERSION 1 9033 #define IPW2100_FW_MINOR_VERSION 3 9034 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 9035 #define IPW2100_FW_MAJOR(x) (x & 0xff) 9036 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 9037 IPW2100_FW_MAJOR_VERSION) 9038 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 9039 "." __stringify(IPW2100_FW_MINOR_VERSION) 9040 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 9041 #ifdef CONFIG_IPW2100_MONITOR 9042 #endif 9043 #ifdef CONFIG_IPW2100_MONITOR 9044 #endif 9045 /* LDV_COMMENT_END_PREP */ 9046 9047 /** STRUCT: struct type: net_device_ops, struct name: ipw2100_netdev_ops **/ 9048 /* content: static int ipw2100_open(struct net_device *dev)*/ 9049 /* LDV_COMMENT_BEGIN_PREP */ 9050 #define IPW2100_VERSION "git-1.2.2" 9051 #define DRV_NAME "ipw2100" 9052 #define DRV_VERSION IPW2100_VERSION 9053 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 9054 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 9055 #ifdef CONFIG_IPW2100_DEBUG 9056 #define IPW2100_RX_DEBUG 9057 #endif 9058 #ifdef CONFIG_PM 9059 #endif 9060 #ifdef CONFIG_IPW2100_DEBUG 9061 #define IPW_DEBUG(level, message...) \ 9062 do { \ 9063 if (ipw2100_debug_level & (level)) { \ 9064 printk(KERN_DEBUG "ipw2100: %c %s ", \ 9065 in_interrupt() ? 'I' : 'U', __func__); \ 9066 printk(message); \ 9067 } \ 9068 } while (0) 9069 #else 9070 #define IPW_DEBUG(level, message...) do {} while (0) 9071 #endif 9072 #ifdef CONFIG_IPW2100_DEBUG 9073 #endif 9074 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 9075 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 9076 #define MAX_RESET_BACKOFF 10 9077 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 9078 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 9079 #ifndef CONFIG_PM 9080 #endif 9081 #ifdef CONFIG_PM 9082 #else 9083 #endif 9084 #ifndef CONFIG_PM 9085 #endif 9086 #define MAX_RF_KILL_CHECKS 5 9087 #define RF_KILL_CHECK_DELAY 40 9088 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 9089 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 9090 #define MAC_ASSOCIATION_READ_DELAY (HZ) 9091 #ifdef CONFIG_IPW2100_DEBUG 9092 #define IPW2100_HANDLER(v, f) { v, f, # v } 9093 #else 9094 #define IPW2100_HANDLER(v, f) { v, f } 9095 #endif 9096 #ifdef CONFIG_IPW2100_DEBUG 9097 #endif 9098 #ifdef CONFIG_IPW2100_DEBUG 9099 #endif 9100 #define SEARCH_ERROR 0xffffffff 9101 #define SEARCH_FAIL 0xfffffffe 9102 #define SEARCH_SUCCESS 0xfffffff0 9103 #define SEARCH_DISCARD 0 9104 #define SEARCH_SNAPSHOT 1 9105 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 9106 #ifdef IPW2100_DEBUG_C3 9107 #endif 9108 #ifdef IPW2100_RX_DEBUG 9109 #endif 9110 #ifdef IPW2100_DEBUG_C3 9111 #endif 9112 #ifdef IPW2100_DEBUG_C3 9113 #endif 9114 #ifdef IPW2100_RX_DEBUG 9115 #endif 9116 #ifdef IPW2100_RX_DEBUG 9117 #endif 9118 #ifdef CONFIG_IPW2100_MONITOR 9119 #endif 9120 #ifdef CONFIG_IPW2100_MONITOR 9121 #else 9122 #endif 9123 #ifdef CONFIG_IPW2100_MONITOR 9124 #endif 9125 #ifdef CONFIG_IPW2100_DEBUG 9126 #endif 9127 #ifdef CONFIG_IPW2100_DEBUG 9128 #endif 9129 #ifdef CONFIG_IPW2100_DEBUG 9130 #endif 9131 #define IPW2100_REG(x) { IPW_ ##x, #x } 9132 #define IPW2100_NIC(x, s) { x, #x, s } 9133 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 9134 #ifdef CONFIG_IPW2100_DEBUG 9135 #endif 9136 #ifdef CONFIG_IPW2100_MONITOR 9137 #endif 9138 #ifdef CONFIG_PM 9139 #endif 9140 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 9141 #ifdef CONFIG_IPW2100_DEBUG 9142 #endif 9143 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 9144 #endif 9145 #ifdef IPW2100_TX_POWER 9146 #endif 9147 #if 0 9148 #endif 9149 #ifdef CONFIG_IPW2100_DEBUG 9150 #endif 9151 #define IPW_PRIVACY_CAPABLE 0x0008 9152 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 9153 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 9154 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 9155 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 9156 #ifdef CONFIG_IPW2100_MONITOR 9157 #endif 9158 /* LDV_COMMENT_END_PREP */ 9159 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "ipw2100_open" */ 9160 static int res_ipw2100_open_136; 9161 /* LDV_COMMENT_BEGIN_PREP */ 9162 #ifdef CONFIG_IPW2100_MONITOR 9163 #endif 9164 #ifdef CONFIG_IPW2100_MONITOR 9165 #endif 9166 #ifdef CONFIG_IPW2100_MONITOR 9167 #endif 9168 #ifdef CONFIG_PM 9169 #endif 9170 #ifdef CONFIG_PM 9171 #endif 9172 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 9173 #ifdef CONFIG_PM 9174 #endif 9175 #ifdef CONFIG_IPW2100_DEBUG 9176 #endif 9177 #ifdef CONFIG_IPW2100_DEBUG 9178 #endif 9179 #ifdef CONFIG_IPW2100_MONITOR 9180 #endif 9181 #define POWER_MODES 5 9182 #ifdef CONFIG_IPW2100_MONITOR 9183 #endif 9184 #define MAX_POWER_STRING 80 9185 #ifdef CONFIG_IPW2100_MONITOR 9186 #endif 9187 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 9188 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 9189 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 9190 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 9191 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 9192 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 9193 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 9194 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 9195 #ifdef CONFIG_IPW2100_MONITOR 9196 #endif 9197 #ifdef CONFIG_IPW2100_MONITOR 9198 #endif 9199 #ifdef CONFIG_IPW2100_MONITOR 9200 #else 9201 #endif 9202 #ifdef CONFIG_IPW2100_MONITOR 9203 #else 9204 #endif 9205 #ifdef CONFIG_IPW2100_DEBUG 9206 #endif 9207 #define IPW2100_FW_MAJOR_VERSION 1 9208 #define IPW2100_FW_MINOR_VERSION 3 9209 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 9210 #define IPW2100_FW_MAJOR(x) (x & 0xff) 9211 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 9212 IPW2100_FW_MAJOR_VERSION) 9213 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 9214 "." __stringify(IPW2100_FW_MINOR_VERSION) 9215 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 9216 #ifdef CONFIG_IPW2100_MONITOR 9217 #endif 9218 #ifdef CONFIG_IPW2100_MONITOR 9219 #endif 9220 /* LDV_COMMENT_END_PREP */ 9221 /* content: static int ipw2100_close(struct net_device *dev)*/ 9222 /* LDV_COMMENT_BEGIN_PREP */ 9223 #define IPW2100_VERSION "git-1.2.2" 9224 #define DRV_NAME "ipw2100" 9225 #define DRV_VERSION IPW2100_VERSION 9226 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 9227 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 9228 #ifdef CONFIG_IPW2100_DEBUG 9229 #define IPW2100_RX_DEBUG 9230 #endif 9231 #ifdef CONFIG_PM 9232 #endif 9233 #ifdef CONFIG_IPW2100_DEBUG 9234 #define IPW_DEBUG(level, message...) \ 9235 do { \ 9236 if (ipw2100_debug_level & (level)) { \ 9237 printk(KERN_DEBUG "ipw2100: %c %s ", \ 9238 in_interrupt() ? 'I' : 'U', __func__); \ 9239 printk(message); \ 9240 } \ 9241 } while (0) 9242 #else 9243 #define IPW_DEBUG(level, message...) do {} while (0) 9244 #endif 9245 #ifdef CONFIG_IPW2100_DEBUG 9246 #endif 9247 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 9248 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 9249 #define MAX_RESET_BACKOFF 10 9250 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 9251 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 9252 #ifndef CONFIG_PM 9253 #endif 9254 #ifdef CONFIG_PM 9255 #else 9256 #endif 9257 #ifndef CONFIG_PM 9258 #endif 9259 #define MAX_RF_KILL_CHECKS 5 9260 #define RF_KILL_CHECK_DELAY 40 9261 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 9262 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 9263 #define MAC_ASSOCIATION_READ_DELAY (HZ) 9264 #ifdef CONFIG_IPW2100_DEBUG 9265 #define IPW2100_HANDLER(v, f) { v, f, # v } 9266 #else 9267 #define IPW2100_HANDLER(v, f) { v, f } 9268 #endif 9269 #ifdef CONFIG_IPW2100_DEBUG 9270 #endif 9271 #ifdef CONFIG_IPW2100_DEBUG 9272 #endif 9273 #define SEARCH_ERROR 0xffffffff 9274 #define SEARCH_FAIL 0xfffffffe 9275 #define SEARCH_SUCCESS 0xfffffff0 9276 #define SEARCH_DISCARD 0 9277 #define SEARCH_SNAPSHOT 1 9278 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 9279 #ifdef IPW2100_DEBUG_C3 9280 #endif 9281 #ifdef IPW2100_RX_DEBUG 9282 #endif 9283 #ifdef IPW2100_DEBUG_C3 9284 #endif 9285 #ifdef IPW2100_DEBUG_C3 9286 #endif 9287 #ifdef IPW2100_RX_DEBUG 9288 #endif 9289 #ifdef IPW2100_RX_DEBUG 9290 #endif 9291 #ifdef CONFIG_IPW2100_MONITOR 9292 #endif 9293 #ifdef CONFIG_IPW2100_MONITOR 9294 #else 9295 #endif 9296 #ifdef CONFIG_IPW2100_MONITOR 9297 #endif 9298 #ifdef CONFIG_IPW2100_DEBUG 9299 #endif 9300 #ifdef CONFIG_IPW2100_DEBUG 9301 #endif 9302 #ifdef CONFIG_IPW2100_DEBUG 9303 #endif 9304 #define IPW2100_REG(x) { IPW_ ##x, #x } 9305 #define IPW2100_NIC(x, s) { x, #x, s } 9306 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 9307 #ifdef CONFIG_IPW2100_DEBUG 9308 #endif 9309 #ifdef CONFIG_IPW2100_MONITOR 9310 #endif 9311 #ifdef CONFIG_PM 9312 #endif 9313 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 9314 #ifdef CONFIG_IPW2100_DEBUG 9315 #endif 9316 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 9317 #endif 9318 #ifdef IPW2100_TX_POWER 9319 #endif 9320 #if 0 9321 #endif 9322 #ifdef CONFIG_IPW2100_DEBUG 9323 #endif 9324 #define IPW_PRIVACY_CAPABLE 0x0008 9325 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 9326 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 9327 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 9328 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 9329 #ifdef CONFIG_IPW2100_MONITOR 9330 #endif 9331 /* LDV_COMMENT_END_PREP */ 9332 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "ipw2100_close" */ 9333 static int res_ipw2100_close_137; 9334 /* LDV_COMMENT_BEGIN_PREP */ 9335 #ifdef CONFIG_IPW2100_MONITOR 9336 #endif 9337 #ifdef CONFIG_IPW2100_MONITOR 9338 #endif 9339 #ifdef CONFIG_IPW2100_MONITOR 9340 #endif 9341 #ifdef CONFIG_PM 9342 #endif 9343 #ifdef CONFIG_PM 9344 #endif 9345 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 9346 #ifdef CONFIG_PM 9347 #endif 9348 #ifdef CONFIG_IPW2100_DEBUG 9349 #endif 9350 #ifdef CONFIG_IPW2100_DEBUG 9351 #endif 9352 #ifdef CONFIG_IPW2100_MONITOR 9353 #endif 9354 #define POWER_MODES 5 9355 #ifdef CONFIG_IPW2100_MONITOR 9356 #endif 9357 #define MAX_POWER_STRING 80 9358 #ifdef CONFIG_IPW2100_MONITOR 9359 #endif 9360 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 9361 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 9362 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 9363 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 9364 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 9365 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 9366 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 9367 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 9368 #ifdef CONFIG_IPW2100_MONITOR 9369 #endif 9370 #ifdef CONFIG_IPW2100_MONITOR 9371 #endif 9372 #ifdef CONFIG_IPW2100_MONITOR 9373 #else 9374 #endif 9375 #ifdef CONFIG_IPW2100_MONITOR 9376 #else 9377 #endif 9378 #ifdef CONFIG_IPW2100_DEBUG 9379 #endif 9380 #define IPW2100_FW_MAJOR_VERSION 1 9381 #define IPW2100_FW_MINOR_VERSION 3 9382 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 9383 #define IPW2100_FW_MAJOR(x) (x & 0xff) 9384 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 9385 IPW2100_FW_MAJOR_VERSION) 9386 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 9387 "." __stringify(IPW2100_FW_MINOR_VERSION) 9388 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 9389 #ifdef CONFIG_IPW2100_MONITOR 9390 #endif 9391 #ifdef CONFIG_IPW2100_MONITOR 9392 #endif 9393 /* LDV_COMMENT_END_PREP */ 9394 /* content: static void ipw2100_tx_timeout(struct net_device *dev)*/ 9395 /* LDV_COMMENT_BEGIN_PREP */ 9396 #define IPW2100_VERSION "git-1.2.2" 9397 #define DRV_NAME "ipw2100" 9398 #define DRV_VERSION IPW2100_VERSION 9399 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 9400 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 9401 #ifdef CONFIG_IPW2100_DEBUG 9402 #define IPW2100_RX_DEBUG 9403 #endif 9404 #ifdef CONFIG_PM 9405 #endif 9406 #ifdef CONFIG_IPW2100_DEBUG 9407 #define IPW_DEBUG(level, message...) \ 9408 do { \ 9409 if (ipw2100_debug_level & (level)) { \ 9410 printk(KERN_DEBUG "ipw2100: %c %s ", \ 9411 in_interrupt() ? 'I' : 'U', __func__); \ 9412 printk(message); \ 9413 } \ 9414 } while (0) 9415 #else 9416 #define IPW_DEBUG(level, message...) do {} while (0) 9417 #endif 9418 #ifdef CONFIG_IPW2100_DEBUG 9419 #endif 9420 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 9421 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 9422 #define MAX_RESET_BACKOFF 10 9423 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 9424 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 9425 #ifndef CONFIG_PM 9426 #endif 9427 #ifdef CONFIG_PM 9428 #else 9429 #endif 9430 #ifndef CONFIG_PM 9431 #endif 9432 #define MAX_RF_KILL_CHECKS 5 9433 #define RF_KILL_CHECK_DELAY 40 9434 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 9435 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 9436 #define MAC_ASSOCIATION_READ_DELAY (HZ) 9437 #ifdef CONFIG_IPW2100_DEBUG 9438 #define IPW2100_HANDLER(v, f) { v, f, # v } 9439 #else 9440 #define IPW2100_HANDLER(v, f) { v, f } 9441 #endif 9442 #ifdef CONFIG_IPW2100_DEBUG 9443 #endif 9444 #ifdef CONFIG_IPW2100_DEBUG 9445 #endif 9446 #define SEARCH_ERROR 0xffffffff 9447 #define SEARCH_FAIL 0xfffffffe 9448 #define SEARCH_SUCCESS 0xfffffff0 9449 #define SEARCH_DISCARD 0 9450 #define SEARCH_SNAPSHOT 1 9451 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 9452 #ifdef IPW2100_DEBUG_C3 9453 #endif 9454 #ifdef IPW2100_RX_DEBUG 9455 #endif 9456 #ifdef IPW2100_DEBUG_C3 9457 #endif 9458 #ifdef IPW2100_DEBUG_C3 9459 #endif 9460 #ifdef IPW2100_RX_DEBUG 9461 #endif 9462 #ifdef IPW2100_RX_DEBUG 9463 #endif 9464 #ifdef CONFIG_IPW2100_MONITOR 9465 #endif 9466 #ifdef CONFIG_IPW2100_MONITOR 9467 #else 9468 #endif 9469 #ifdef CONFIG_IPW2100_MONITOR 9470 #endif 9471 #ifdef CONFIG_IPW2100_DEBUG 9472 #endif 9473 #ifdef CONFIG_IPW2100_DEBUG 9474 #endif 9475 #ifdef CONFIG_IPW2100_DEBUG 9476 #endif 9477 #define IPW2100_REG(x) { IPW_ ##x, #x } 9478 #define IPW2100_NIC(x, s) { x, #x, s } 9479 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 9480 #ifdef CONFIG_IPW2100_DEBUG 9481 #endif 9482 #ifdef CONFIG_IPW2100_MONITOR 9483 #endif 9484 #ifdef CONFIG_PM 9485 #endif 9486 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 9487 #ifdef CONFIG_IPW2100_DEBUG 9488 #endif 9489 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 9490 #endif 9491 #ifdef IPW2100_TX_POWER 9492 #endif 9493 #if 0 9494 #endif 9495 #ifdef CONFIG_IPW2100_DEBUG 9496 #endif 9497 #define IPW_PRIVACY_CAPABLE 0x0008 9498 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 9499 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 9500 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 9501 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 9502 #ifdef CONFIG_IPW2100_MONITOR 9503 #endif 9504 /* LDV_COMMENT_END_PREP */ 9505 /* LDV_COMMENT_BEGIN_PREP */ 9506 #ifdef CONFIG_IPW2100_MONITOR 9507 #endif 9508 #ifdef CONFIG_IPW2100_MONITOR 9509 #endif 9510 #ifdef CONFIG_PM 9511 #endif 9512 #ifdef CONFIG_PM 9513 #endif 9514 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 9515 #ifdef CONFIG_PM 9516 #endif 9517 #ifdef CONFIG_IPW2100_DEBUG 9518 #endif 9519 #ifdef CONFIG_IPW2100_DEBUG 9520 #endif 9521 #ifdef CONFIG_IPW2100_MONITOR 9522 #endif 9523 #define POWER_MODES 5 9524 #ifdef CONFIG_IPW2100_MONITOR 9525 #endif 9526 #define MAX_POWER_STRING 80 9527 #ifdef CONFIG_IPW2100_MONITOR 9528 #endif 9529 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 9530 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 9531 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 9532 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 9533 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 9534 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 9535 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 9536 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 9537 #ifdef CONFIG_IPW2100_MONITOR 9538 #endif 9539 #ifdef CONFIG_IPW2100_MONITOR 9540 #endif 9541 #ifdef CONFIG_IPW2100_MONITOR 9542 #else 9543 #endif 9544 #ifdef CONFIG_IPW2100_MONITOR 9545 #else 9546 #endif 9547 #ifdef CONFIG_IPW2100_DEBUG 9548 #endif 9549 #define IPW2100_FW_MAJOR_VERSION 1 9550 #define IPW2100_FW_MINOR_VERSION 3 9551 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 9552 #define IPW2100_FW_MAJOR(x) (x & 0xff) 9553 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 9554 IPW2100_FW_MAJOR_VERSION) 9555 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 9556 "." __stringify(IPW2100_FW_MINOR_VERSION) 9557 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 9558 #ifdef CONFIG_IPW2100_MONITOR 9559 #endif 9560 #ifdef CONFIG_IPW2100_MONITOR 9561 #endif 9562 /* LDV_COMMENT_END_PREP */ 9563 /* content: static int ipw2100_set_address(struct net_device *dev, void *p)*/ 9564 /* LDV_COMMENT_BEGIN_PREP */ 9565 #define IPW2100_VERSION "git-1.2.2" 9566 #define DRV_NAME "ipw2100" 9567 #define DRV_VERSION IPW2100_VERSION 9568 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 9569 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 9570 #ifdef CONFIG_IPW2100_DEBUG 9571 #define IPW2100_RX_DEBUG 9572 #endif 9573 #ifdef CONFIG_PM 9574 #endif 9575 #ifdef CONFIG_IPW2100_DEBUG 9576 #define IPW_DEBUG(level, message...) \ 9577 do { \ 9578 if (ipw2100_debug_level & (level)) { \ 9579 printk(KERN_DEBUG "ipw2100: %c %s ", \ 9580 in_interrupt() ? 'I' : 'U', __func__); \ 9581 printk(message); \ 9582 } \ 9583 } while (0) 9584 #else 9585 #define IPW_DEBUG(level, message...) do {} while (0) 9586 #endif 9587 #ifdef CONFIG_IPW2100_DEBUG 9588 #endif 9589 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 9590 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 9591 #define MAX_RESET_BACKOFF 10 9592 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 9593 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 9594 #ifndef CONFIG_PM 9595 #endif 9596 #ifdef CONFIG_PM 9597 #else 9598 #endif 9599 #ifndef CONFIG_PM 9600 #endif 9601 #define MAX_RF_KILL_CHECKS 5 9602 #define RF_KILL_CHECK_DELAY 40 9603 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 9604 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 9605 #define MAC_ASSOCIATION_READ_DELAY (HZ) 9606 #ifdef CONFIG_IPW2100_DEBUG 9607 #define IPW2100_HANDLER(v, f) { v, f, # v } 9608 #else 9609 #define IPW2100_HANDLER(v, f) { v, f } 9610 #endif 9611 #ifdef CONFIG_IPW2100_DEBUG 9612 #endif 9613 #ifdef CONFIG_IPW2100_DEBUG 9614 #endif 9615 #define SEARCH_ERROR 0xffffffff 9616 #define SEARCH_FAIL 0xfffffffe 9617 #define SEARCH_SUCCESS 0xfffffff0 9618 #define SEARCH_DISCARD 0 9619 #define SEARCH_SNAPSHOT 1 9620 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 9621 #ifdef IPW2100_DEBUG_C3 9622 #endif 9623 #ifdef IPW2100_RX_DEBUG 9624 #endif 9625 #ifdef IPW2100_DEBUG_C3 9626 #endif 9627 #ifdef IPW2100_DEBUG_C3 9628 #endif 9629 #ifdef IPW2100_RX_DEBUG 9630 #endif 9631 #ifdef IPW2100_RX_DEBUG 9632 #endif 9633 #ifdef CONFIG_IPW2100_MONITOR 9634 #endif 9635 #ifdef CONFIG_IPW2100_MONITOR 9636 #else 9637 #endif 9638 #ifdef CONFIG_IPW2100_MONITOR 9639 #endif 9640 #ifdef CONFIG_IPW2100_DEBUG 9641 #endif 9642 #ifdef CONFIG_IPW2100_DEBUG 9643 #endif 9644 #ifdef CONFIG_IPW2100_DEBUG 9645 #endif 9646 #define IPW2100_REG(x) { IPW_ ##x, #x } 9647 #define IPW2100_NIC(x, s) { x, #x, s } 9648 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 9649 #ifdef CONFIG_IPW2100_DEBUG 9650 #endif 9651 #ifdef CONFIG_IPW2100_MONITOR 9652 #endif 9653 #ifdef CONFIG_PM 9654 #endif 9655 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 9656 #ifdef CONFIG_IPW2100_DEBUG 9657 #endif 9658 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 9659 #endif 9660 #ifdef IPW2100_TX_POWER 9661 #endif 9662 #if 0 9663 #endif 9664 #ifdef CONFIG_IPW2100_DEBUG 9665 #endif 9666 #define IPW_PRIVACY_CAPABLE 0x0008 9667 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 9668 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 9669 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 9670 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 9671 #ifdef CONFIG_IPW2100_MONITOR 9672 #endif 9673 /* LDV_COMMENT_END_PREP */ 9674 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_set_address" */ 9675 void * var_ipw2100_set_address_135_p1; 9676 /* LDV_COMMENT_BEGIN_PREP */ 9677 #ifdef CONFIG_IPW2100_MONITOR 9678 #endif 9679 #ifdef CONFIG_IPW2100_MONITOR 9680 #endif 9681 #ifdef CONFIG_IPW2100_MONITOR 9682 #endif 9683 #ifdef CONFIG_PM 9684 #endif 9685 #ifdef CONFIG_PM 9686 #endif 9687 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 9688 #ifdef CONFIG_PM 9689 #endif 9690 #ifdef CONFIG_IPW2100_DEBUG 9691 #endif 9692 #ifdef CONFIG_IPW2100_DEBUG 9693 #endif 9694 #ifdef CONFIG_IPW2100_MONITOR 9695 #endif 9696 #define POWER_MODES 5 9697 #ifdef CONFIG_IPW2100_MONITOR 9698 #endif 9699 #define MAX_POWER_STRING 80 9700 #ifdef CONFIG_IPW2100_MONITOR 9701 #endif 9702 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 9703 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 9704 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 9705 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 9706 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 9707 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 9708 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 9709 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 9710 #ifdef CONFIG_IPW2100_MONITOR 9711 #endif 9712 #ifdef CONFIG_IPW2100_MONITOR 9713 #endif 9714 #ifdef CONFIG_IPW2100_MONITOR 9715 #else 9716 #endif 9717 #ifdef CONFIG_IPW2100_MONITOR 9718 #else 9719 #endif 9720 #ifdef CONFIG_IPW2100_DEBUG 9721 #endif 9722 #define IPW2100_FW_MAJOR_VERSION 1 9723 #define IPW2100_FW_MINOR_VERSION 3 9724 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 9725 #define IPW2100_FW_MAJOR(x) (x & 0xff) 9726 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 9727 IPW2100_FW_MAJOR_VERSION) 9728 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 9729 "." __stringify(IPW2100_FW_MINOR_VERSION) 9730 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 9731 #ifdef CONFIG_IPW2100_MONITOR 9732 #endif 9733 #ifdef CONFIG_IPW2100_MONITOR 9734 #endif 9735 /* LDV_COMMENT_END_PREP */ 9736 9737 /** STRUCT: struct type: pci_driver, struct name: ipw2100_pci_driver **/ 9738 /* content: static int ipw2100_pci_init_one(struct pci_dev *pci_dev, const struct pci_device_id *ent)*/ 9739 /* LDV_COMMENT_BEGIN_PREP */ 9740 #define IPW2100_VERSION "git-1.2.2" 9741 #define DRV_NAME "ipw2100" 9742 #define DRV_VERSION IPW2100_VERSION 9743 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 9744 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 9745 #ifdef CONFIG_IPW2100_DEBUG 9746 #define IPW2100_RX_DEBUG 9747 #endif 9748 #ifdef CONFIG_PM 9749 #endif 9750 #ifdef CONFIG_IPW2100_DEBUG 9751 #define IPW_DEBUG(level, message...) \ 9752 do { \ 9753 if (ipw2100_debug_level & (level)) { \ 9754 printk(KERN_DEBUG "ipw2100: %c %s ", \ 9755 in_interrupt() ? 'I' : 'U', __func__); \ 9756 printk(message); \ 9757 } \ 9758 } while (0) 9759 #else 9760 #define IPW_DEBUG(level, message...) do {} while (0) 9761 #endif 9762 #ifdef CONFIG_IPW2100_DEBUG 9763 #endif 9764 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 9765 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 9766 #define MAX_RESET_BACKOFF 10 9767 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 9768 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 9769 #ifndef CONFIG_PM 9770 #endif 9771 #ifdef CONFIG_PM 9772 #else 9773 #endif 9774 #ifndef CONFIG_PM 9775 #endif 9776 #define MAX_RF_KILL_CHECKS 5 9777 #define RF_KILL_CHECK_DELAY 40 9778 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 9779 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 9780 #define MAC_ASSOCIATION_READ_DELAY (HZ) 9781 #ifdef CONFIG_IPW2100_DEBUG 9782 #define IPW2100_HANDLER(v, f) { v, f, # v } 9783 #else 9784 #define IPW2100_HANDLER(v, f) { v, f } 9785 #endif 9786 #ifdef CONFIG_IPW2100_DEBUG 9787 #endif 9788 #ifdef CONFIG_IPW2100_DEBUG 9789 #endif 9790 #define SEARCH_ERROR 0xffffffff 9791 #define SEARCH_FAIL 0xfffffffe 9792 #define SEARCH_SUCCESS 0xfffffff0 9793 #define SEARCH_DISCARD 0 9794 #define SEARCH_SNAPSHOT 1 9795 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 9796 #ifdef IPW2100_DEBUG_C3 9797 #endif 9798 #ifdef IPW2100_RX_DEBUG 9799 #endif 9800 #ifdef IPW2100_DEBUG_C3 9801 #endif 9802 #ifdef IPW2100_DEBUG_C3 9803 #endif 9804 #ifdef IPW2100_RX_DEBUG 9805 #endif 9806 #ifdef IPW2100_RX_DEBUG 9807 #endif 9808 #ifdef CONFIG_IPW2100_MONITOR 9809 #endif 9810 #ifdef CONFIG_IPW2100_MONITOR 9811 #else 9812 #endif 9813 #ifdef CONFIG_IPW2100_MONITOR 9814 #endif 9815 #ifdef CONFIG_IPW2100_DEBUG 9816 #endif 9817 #ifdef CONFIG_IPW2100_DEBUG 9818 #endif 9819 #ifdef CONFIG_IPW2100_DEBUG 9820 #endif 9821 #define IPW2100_REG(x) { IPW_ ##x, #x } 9822 #define IPW2100_NIC(x, s) { x, #x, s } 9823 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 9824 #ifdef CONFIG_IPW2100_DEBUG 9825 #endif 9826 #ifdef CONFIG_IPW2100_MONITOR 9827 #endif 9828 #ifdef CONFIG_PM 9829 #endif 9830 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 9831 #ifdef CONFIG_IPW2100_DEBUG 9832 #endif 9833 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 9834 #endif 9835 #ifdef IPW2100_TX_POWER 9836 #endif 9837 #if 0 9838 #endif 9839 #ifdef CONFIG_IPW2100_DEBUG 9840 #endif 9841 #define IPW_PRIVACY_CAPABLE 0x0008 9842 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 9843 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 9844 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 9845 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 9846 #ifdef CONFIG_IPW2100_MONITOR 9847 #endif 9848 #ifdef CONFIG_IPW2100_MONITOR 9849 #endif 9850 #ifdef CONFIG_IPW2100_MONITOR 9851 #endif 9852 #ifdef CONFIG_IPW2100_MONITOR 9853 #endif 9854 /* LDV_COMMENT_END_PREP */ 9855 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_pci_init_one" */ 9856 struct pci_dev * var_group3; 9857 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_pci_init_one" */ 9858 const struct pci_device_id * var_ipw2100_pci_init_one_147_p1; 9859 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "ipw2100_pci_init_one" */ 9860 static int res_ipw2100_pci_init_one_147; 9861 /* LDV_COMMENT_BEGIN_PREP */ 9862 #ifdef CONFIG_PM 9863 #endif 9864 #ifdef CONFIG_PM 9865 #endif 9866 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 9867 #ifdef CONFIG_PM 9868 #endif 9869 #ifdef CONFIG_IPW2100_DEBUG 9870 #endif 9871 #ifdef CONFIG_IPW2100_DEBUG 9872 #endif 9873 #ifdef CONFIG_IPW2100_MONITOR 9874 #endif 9875 #define POWER_MODES 5 9876 #ifdef CONFIG_IPW2100_MONITOR 9877 #endif 9878 #define MAX_POWER_STRING 80 9879 #ifdef CONFIG_IPW2100_MONITOR 9880 #endif 9881 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 9882 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 9883 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 9884 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 9885 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 9886 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 9887 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 9888 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 9889 #ifdef CONFIG_IPW2100_MONITOR 9890 #endif 9891 #ifdef CONFIG_IPW2100_MONITOR 9892 #endif 9893 #ifdef CONFIG_IPW2100_MONITOR 9894 #else 9895 #endif 9896 #ifdef CONFIG_IPW2100_MONITOR 9897 #else 9898 #endif 9899 #ifdef CONFIG_IPW2100_DEBUG 9900 #endif 9901 #define IPW2100_FW_MAJOR_VERSION 1 9902 #define IPW2100_FW_MINOR_VERSION 3 9903 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 9904 #define IPW2100_FW_MAJOR(x) (x & 0xff) 9905 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 9906 IPW2100_FW_MAJOR_VERSION) 9907 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 9908 "." __stringify(IPW2100_FW_MINOR_VERSION) 9909 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 9910 #ifdef CONFIG_IPW2100_MONITOR 9911 #endif 9912 #ifdef CONFIG_IPW2100_MONITOR 9913 #endif 9914 /* LDV_COMMENT_END_PREP */ 9915 /* content: static void ipw2100_pci_remove_one(struct pci_dev *pci_dev)*/ 9916 /* LDV_COMMENT_BEGIN_PREP */ 9917 #define IPW2100_VERSION "git-1.2.2" 9918 #define DRV_NAME "ipw2100" 9919 #define DRV_VERSION IPW2100_VERSION 9920 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 9921 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 9922 #ifdef CONFIG_IPW2100_DEBUG 9923 #define IPW2100_RX_DEBUG 9924 #endif 9925 #ifdef CONFIG_PM 9926 #endif 9927 #ifdef CONFIG_IPW2100_DEBUG 9928 #define IPW_DEBUG(level, message...) \ 9929 do { \ 9930 if (ipw2100_debug_level & (level)) { \ 9931 printk(KERN_DEBUG "ipw2100: %c %s ", \ 9932 in_interrupt() ? 'I' : 'U', __func__); \ 9933 printk(message); \ 9934 } \ 9935 } while (0) 9936 #else 9937 #define IPW_DEBUG(level, message...) do {} while (0) 9938 #endif 9939 #ifdef CONFIG_IPW2100_DEBUG 9940 #endif 9941 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 9942 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 9943 #define MAX_RESET_BACKOFF 10 9944 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 9945 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 9946 #ifndef CONFIG_PM 9947 #endif 9948 #ifdef CONFIG_PM 9949 #else 9950 #endif 9951 #ifndef CONFIG_PM 9952 #endif 9953 #define MAX_RF_KILL_CHECKS 5 9954 #define RF_KILL_CHECK_DELAY 40 9955 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 9956 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 9957 #define MAC_ASSOCIATION_READ_DELAY (HZ) 9958 #ifdef CONFIG_IPW2100_DEBUG 9959 #define IPW2100_HANDLER(v, f) { v, f, # v } 9960 #else 9961 #define IPW2100_HANDLER(v, f) { v, f } 9962 #endif 9963 #ifdef CONFIG_IPW2100_DEBUG 9964 #endif 9965 #ifdef CONFIG_IPW2100_DEBUG 9966 #endif 9967 #define SEARCH_ERROR 0xffffffff 9968 #define SEARCH_FAIL 0xfffffffe 9969 #define SEARCH_SUCCESS 0xfffffff0 9970 #define SEARCH_DISCARD 0 9971 #define SEARCH_SNAPSHOT 1 9972 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 9973 #ifdef IPW2100_DEBUG_C3 9974 #endif 9975 #ifdef IPW2100_RX_DEBUG 9976 #endif 9977 #ifdef IPW2100_DEBUG_C3 9978 #endif 9979 #ifdef IPW2100_DEBUG_C3 9980 #endif 9981 #ifdef IPW2100_RX_DEBUG 9982 #endif 9983 #ifdef IPW2100_RX_DEBUG 9984 #endif 9985 #ifdef CONFIG_IPW2100_MONITOR 9986 #endif 9987 #ifdef CONFIG_IPW2100_MONITOR 9988 #else 9989 #endif 9990 #ifdef CONFIG_IPW2100_MONITOR 9991 #endif 9992 #ifdef CONFIG_IPW2100_DEBUG 9993 #endif 9994 #ifdef CONFIG_IPW2100_DEBUG 9995 #endif 9996 #ifdef CONFIG_IPW2100_DEBUG 9997 #endif 9998 #define IPW2100_REG(x) { IPW_ ##x, #x } 9999 #define IPW2100_NIC(x, s) { x, #x, s } 10000 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 10001 #ifdef CONFIG_IPW2100_DEBUG 10002 #endif 10003 #ifdef CONFIG_IPW2100_MONITOR 10004 #endif 10005 #ifdef CONFIG_PM 10006 #endif 10007 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 10008 #ifdef CONFIG_IPW2100_DEBUG 10009 #endif 10010 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 10011 #endif 10012 #ifdef IPW2100_TX_POWER 10013 #endif 10014 #if 0 10015 #endif 10016 #ifdef CONFIG_IPW2100_DEBUG 10017 #endif 10018 #define IPW_PRIVACY_CAPABLE 0x0008 10019 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 10020 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 10021 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 10022 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 10023 #ifdef CONFIG_IPW2100_MONITOR 10024 #endif 10025 #ifdef CONFIG_IPW2100_MONITOR 10026 #endif 10027 #ifdef CONFIG_IPW2100_MONITOR 10028 #endif 10029 #ifdef CONFIG_IPW2100_MONITOR 10030 #endif 10031 /* LDV_COMMENT_END_PREP */ 10032 /* LDV_COMMENT_BEGIN_PREP */ 10033 #ifdef CONFIG_PM 10034 #endif 10035 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 10036 #ifdef CONFIG_PM 10037 #endif 10038 #ifdef CONFIG_IPW2100_DEBUG 10039 #endif 10040 #ifdef CONFIG_IPW2100_DEBUG 10041 #endif 10042 #ifdef CONFIG_IPW2100_MONITOR 10043 #endif 10044 #define POWER_MODES 5 10045 #ifdef CONFIG_IPW2100_MONITOR 10046 #endif 10047 #define MAX_POWER_STRING 80 10048 #ifdef CONFIG_IPW2100_MONITOR 10049 #endif 10050 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 10051 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 10052 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 10053 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 10054 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 10055 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 10056 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 10057 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 10058 #ifdef CONFIG_IPW2100_MONITOR 10059 #endif 10060 #ifdef CONFIG_IPW2100_MONITOR 10061 #endif 10062 #ifdef CONFIG_IPW2100_MONITOR 10063 #else 10064 #endif 10065 #ifdef CONFIG_IPW2100_MONITOR 10066 #else 10067 #endif 10068 #ifdef CONFIG_IPW2100_DEBUG 10069 #endif 10070 #define IPW2100_FW_MAJOR_VERSION 1 10071 #define IPW2100_FW_MINOR_VERSION 3 10072 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 10073 #define IPW2100_FW_MAJOR(x) (x & 0xff) 10074 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 10075 IPW2100_FW_MAJOR_VERSION) 10076 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 10077 "." __stringify(IPW2100_FW_MINOR_VERSION) 10078 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 10079 #ifdef CONFIG_IPW2100_MONITOR 10080 #endif 10081 #ifdef CONFIG_IPW2100_MONITOR 10082 #endif 10083 /* LDV_COMMENT_END_PREP */ 10084 /* content: static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state)*/ 10085 /* LDV_COMMENT_BEGIN_PREP */ 10086 #define IPW2100_VERSION "git-1.2.2" 10087 #define DRV_NAME "ipw2100" 10088 #define DRV_VERSION IPW2100_VERSION 10089 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 10090 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 10091 #ifdef CONFIG_IPW2100_DEBUG 10092 #define IPW2100_RX_DEBUG 10093 #endif 10094 #ifdef CONFIG_PM 10095 #endif 10096 #ifdef CONFIG_IPW2100_DEBUG 10097 #define IPW_DEBUG(level, message...) \ 10098 do { \ 10099 if (ipw2100_debug_level & (level)) { \ 10100 printk(KERN_DEBUG "ipw2100: %c %s ", \ 10101 in_interrupt() ? 'I' : 'U', __func__); \ 10102 printk(message); \ 10103 } \ 10104 } while (0) 10105 #else 10106 #define IPW_DEBUG(level, message...) do {} while (0) 10107 #endif 10108 #ifdef CONFIG_IPW2100_DEBUG 10109 #endif 10110 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 10111 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 10112 #define MAX_RESET_BACKOFF 10 10113 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 10114 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 10115 #ifndef CONFIG_PM 10116 #endif 10117 #ifdef CONFIG_PM 10118 #else 10119 #endif 10120 #ifndef CONFIG_PM 10121 #endif 10122 #define MAX_RF_KILL_CHECKS 5 10123 #define RF_KILL_CHECK_DELAY 40 10124 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 10125 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 10126 #define MAC_ASSOCIATION_READ_DELAY (HZ) 10127 #ifdef CONFIG_IPW2100_DEBUG 10128 #define IPW2100_HANDLER(v, f) { v, f, # v } 10129 #else 10130 #define IPW2100_HANDLER(v, f) { v, f } 10131 #endif 10132 #ifdef CONFIG_IPW2100_DEBUG 10133 #endif 10134 #ifdef CONFIG_IPW2100_DEBUG 10135 #endif 10136 #define SEARCH_ERROR 0xffffffff 10137 #define SEARCH_FAIL 0xfffffffe 10138 #define SEARCH_SUCCESS 0xfffffff0 10139 #define SEARCH_DISCARD 0 10140 #define SEARCH_SNAPSHOT 1 10141 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 10142 #ifdef IPW2100_DEBUG_C3 10143 #endif 10144 #ifdef IPW2100_RX_DEBUG 10145 #endif 10146 #ifdef IPW2100_DEBUG_C3 10147 #endif 10148 #ifdef IPW2100_DEBUG_C3 10149 #endif 10150 #ifdef IPW2100_RX_DEBUG 10151 #endif 10152 #ifdef IPW2100_RX_DEBUG 10153 #endif 10154 #ifdef CONFIG_IPW2100_MONITOR 10155 #endif 10156 #ifdef CONFIG_IPW2100_MONITOR 10157 #else 10158 #endif 10159 #ifdef CONFIG_IPW2100_MONITOR 10160 #endif 10161 #ifdef CONFIG_IPW2100_DEBUG 10162 #endif 10163 #ifdef CONFIG_IPW2100_DEBUG 10164 #endif 10165 #ifdef CONFIG_IPW2100_DEBUG 10166 #endif 10167 #define IPW2100_REG(x) { IPW_ ##x, #x } 10168 #define IPW2100_NIC(x, s) { x, #x, s } 10169 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 10170 #ifdef CONFIG_IPW2100_DEBUG 10171 #endif 10172 #ifdef CONFIG_IPW2100_MONITOR 10173 #endif 10174 #ifdef CONFIG_PM 10175 #endif 10176 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 10177 #ifdef CONFIG_IPW2100_DEBUG 10178 #endif 10179 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 10180 #endif 10181 #ifdef IPW2100_TX_POWER 10182 #endif 10183 #if 0 10184 #endif 10185 #ifdef CONFIG_IPW2100_DEBUG 10186 #endif 10187 #define IPW_PRIVACY_CAPABLE 0x0008 10188 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 10189 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 10190 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 10191 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 10192 #ifdef CONFIG_IPW2100_MONITOR 10193 #endif 10194 #ifdef CONFIG_IPW2100_MONITOR 10195 #endif 10196 #ifdef CONFIG_IPW2100_MONITOR 10197 #endif 10198 #ifdef CONFIG_IPW2100_MONITOR 10199 #endif 10200 #ifdef CONFIG_PM 10201 #endif 10202 #ifdef CONFIG_PM 10203 /* LDV_COMMENT_END_PREP */ 10204 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_suspend" */ 10205 pm_message_t var_ipw2100_suspend_149_p1; 10206 /* LDV_COMMENT_BEGIN_PREP */ 10207 #endif 10208 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 10209 #ifdef CONFIG_PM 10210 #endif 10211 #ifdef CONFIG_IPW2100_DEBUG 10212 #endif 10213 #ifdef CONFIG_IPW2100_DEBUG 10214 #endif 10215 #ifdef CONFIG_IPW2100_MONITOR 10216 #endif 10217 #define POWER_MODES 5 10218 #ifdef CONFIG_IPW2100_MONITOR 10219 #endif 10220 #define MAX_POWER_STRING 80 10221 #ifdef CONFIG_IPW2100_MONITOR 10222 #endif 10223 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 10224 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 10225 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 10226 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 10227 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 10228 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 10229 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 10230 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 10231 #ifdef CONFIG_IPW2100_MONITOR 10232 #endif 10233 #ifdef CONFIG_IPW2100_MONITOR 10234 #endif 10235 #ifdef CONFIG_IPW2100_MONITOR 10236 #else 10237 #endif 10238 #ifdef CONFIG_IPW2100_MONITOR 10239 #else 10240 #endif 10241 #ifdef CONFIG_IPW2100_DEBUG 10242 #endif 10243 #define IPW2100_FW_MAJOR_VERSION 1 10244 #define IPW2100_FW_MINOR_VERSION 3 10245 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 10246 #define IPW2100_FW_MAJOR(x) (x & 0xff) 10247 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 10248 IPW2100_FW_MAJOR_VERSION) 10249 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 10250 "." __stringify(IPW2100_FW_MINOR_VERSION) 10251 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 10252 #ifdef CONFIG_IPW2100_MONITOR 10253 #endif 10254 #ifdef CONFIG_IPW2100_MONITOR 10255 #endif 10256 /* LDV_COMMENT_END_PREP */ 10257 /* content: static int ipw2100_resume(struct pci_dev *pci_dev)*/ 10258 /* LDV_COMMENT_BEGIN_PREP */ 10259 #define IPW2100_VERSION "git-1.2.2" 10260 #define DRV_NAME "ipw2100" 10261 #define DRV_VERSION IPW2100_VERSION 10262 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 10263 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 10264 #ifdef CONFIG_IPW2100_DEBUG 10265 #define IPW2100_RX_DEBUG 10266 #endif 10267 #ifdef CONFIG_PM 10268 #endif 10269 #ifdef CONFIG_IPW2100_DEBUG 10270 #define IPW_DEBUG(level, message...) \ 10271 do { \ 10272 if (ipw2100_debug_level & (level)) { \ 10273 printk(KERN_DEBUG "ipw2100: %c %s ", \ 10274 in_interrupt() ? 'I' : 'U', __func__); \ 10275 printk(message); \ 10276 } \ 10277 } while (0) 10278 #else 10279 #define IPW_DEBUG(level, message...) do {} while (0) 10280 #endif 10281 #ifdef CONFIG_IPW2100_DEBUG 10282 #endif 10283 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 10284 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 10285 #define MAX_RESET_BACKOFF 10 10286 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 10287 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 10288 #ifndef CONFIG_PM 10289 #endif 10290 #ifdef CONFIG_PM 10291 #else 10292 #endif 10293 #ifndef CONFIG_PM 10294 #endif 10295 #define MAX_RF_KILL_CHECKS 5 10296 #define RF_KILL_CHECK_DELAY 40 10297 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 10298 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 10299 #define MAC_ASSOCIATION_READ_DELAY (HZ) 10300 #ifdef CONFIG_IPW2100_DEBUG 10301 #define IPW2100_HANDLER(v, f) { v, f, # v } 10302 #else 10303 #define IPW2100_HANDLER(v, f) { v, f } 10304 #endif 10305 #ifdef CONFIG_IPW2100_DEBUG 10306 #endif 10307 #ifdef CONFIG_IPW2100_DEBUG 10308 #endif 10309 #define SEARCH_ERROR 0xffffffff 10310 #define SEARCH_FAIL 0xfffffffe 10311 #define SEARCH_SUCCESS 0xfffffff0 10312 #define SEARCH_DISCARD 0 10313 #define SEARCH_SNAPSHOT 1 10314 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 10315 #ifdef IPW2100_DEBUG_C3 10316 #endif 10317 #ifdef IPW2100_RX_DEBUG 10318 #endif 10319 #ifdef IPW2100_DEBUG_C3 10320 #endif 10321 #ifdef IPW2100_DEBUG_C3 10322 #endif 10323 #ifdef IPW2100_RX_DEBUG 10324 #endif 10325 #ifdef IPW2100_RX_DEBUG 10326 #endif 10327 #ifdef CONFIG_IPW2100_MONITOR 10328 #endif 10329 #ifdef CONFIG_IPW2100_MONITOR 10330 #else 10331 #endif 10332 #ifdef CONFIG_IPW2100_MONITOR 10333 #endif 10334 #ifdef CONFIG_IPW2100_DEBUG 10335 #endif 10336 #ifdef CONFIG_IPW2100_DEBUG 10337 #endif 10338 #ifdef CONFIG_IPW2100_DEBUG 10339 #endif 10340 #define IPW2100_REG(x) { IPW_ ##x, #x } 10341 #define IPW2100_NIC(x, s) { x, #x, s } 10342 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 10343 #ifdef CONFIG_IPW2100_DEBUG 10344 #endif 10345 #ifdef CONFIG_IPW2100_MONITOR 10346 #endif 10347 #ifdef CONFIG_PM 10348 #endif 10349 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 10350 #ifdef CONFIG_IPW2100_DEBUG 10351 #endif 10352 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 10353 #endif 10354 #ifdef IPW2100_TX_POWER 10355 #endif 10356 #if 0 10357 #endif 10358 #ifdef CONFIG_IPW2100_DEBUG 10359 #endif 10360 #define IPW_PRIVACY_CAPABLE 0x0008 10361 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 10362 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 10363 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 10364 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 10365 #ifdef CONFIG_IPW2100_MONITOR 10366 #endif 10367 #ifdef CONFIG_IPW2100_MONITOR 10368 #endif 10369 #ifdef CONFIG_IPW2100_MONITOR 10370 #endif 10371 #ifdef CONFIG_IPW2100_MONITOR 10372 #endif 10373 #ifdef CONFIG_PM 10374 #endif 10375 #ifdef CONFIG_PM 10376 /* LDV_COMMENT_END_PREP */ 10377 /* LDV_COMMENT_BEGIN_PREP */ 10378 #endif 10379 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 10380 #ifdef CONFIG_PM 10381 #endif 10382 #ifdef CONFIG_IPW2100_DEBUG 10383 #endif 10384 #ifdef CONFIG_IPW2100_DEBUG 10385 #endif 10386 #ifdef CONFIG_IPW2100_MONITOR 10387 #endif 10388 #define POWER_MODES 5 10389 #ifdef CONFIG_IPW2100_MONITOR 10390 #endif 10391 #define MAX_POWER_STRING 80 10392 #ifdef CONFIG_IPW2100_MONITOR 10393 #endif 10394 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 10395 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 10396 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 10397 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 10398 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 10399 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 10400 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 10401 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 10402 #ifdef CONFIG_IPW2100_MONITOR 10403 #endif 10404 #ifdef CONFIG_IPW2100_MONITOR 10405 #endif 10406 #ifdef CONFIG_IPW2100_MONITOR 10407 #else 10408 #endif 10409 #ifdef CONFIG_IPW2100_MONITOR 10410 #else 10411 #endif 10412 #ifdef CONFIG_IPW2100_DEBUG 10413 #endif 10414 #define IPW2100_FW_MAJOR_VERSION 1 10415 #define IPW2100_FW_MINOR_VERSION 3 10416 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 10417 #define IPW2100_FW_MAJOR(x) (x & 0xff) 10418 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 10419 IPW2100_FW_MAJOR_VERSION) 10420 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 10421 "." __stringify(IPW2100_FW_MINOR_VERSION) 10422 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 10423 #ifdef CONFIG_IPW2100_MONITOR 10424 #endif 10425 #ifdef CONFIG_IPW2100_MONITOR 10426 #endif 10427 /* LDV_COMMENT_END_PREP */ 10428 /* content: static void ipw2100_shutdown(struct pci_dev *pci_dev)*/ 10429 /* LDV_COMMENT_BEGIN_PREP */ 10430 #define IPW2100_VERSION "git-1.2.2" 10431 #define DRV_NAME "ipw2100" 10432 #define DRV_VERSION IPW2100_VERSION 10433 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 10434 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 10435 #ifdef CONFIG_IPW2100_DEBUG 10436 #define IPW2100_RX_DEBUG 10437 #endif 10438 #ifdef CONFIG_PM 10439 #endif 10440 #ifdef CONFIG_IPW2100_DEBUG 10441 #define IPW_DEBUG(level, message...) \ 10442 do { \ 10443 if (ipw2100_debug_level & (level)) { \ 10444 printk(KERN_DEBUG "ipw2100: %c %s ", \ 10445 in_interrupt() ? 'I' : 'U', __func__); \ 10446 printk(message); \ 10447 } \ 10448 } while (0) 10449 #else 10450 #define IPW_DEBUG(level, message...) do {} while (0) 10451 #endif 10452 #ifdef CONFIG_IPW2100_DEBUG 10453 #endif 10454 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 10455 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 10456 #define MAX_RESET_BACKOFF 10 10457 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 10458 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 10459 #ifndef CONFIG_PM 10460 #endif 10461 #ifdef CONFIG_PM 10462 #else 10463 #endif 10464 #ifndef CONFIG_PM 10465 #endif 10466 #define MAX_RF_KILL_CHECKS 5 10467 #define RF_KILL_CHECK_DELAY 40 10468 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 10469 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 10470 #define MAC_ASSOCIATION_READ_DELAY (HZ) 10471 #ifdef CONFIG_IPW2100_DEBUG 10472 #define IPW2100_HANDLER(v, f) { v, f, # v } 10473 #else 10474 #define IPW2100_HANDLER(v, f) { v, f } 10475 #endif 10476 #ifdef CONFIG_IPW2100_DEBUG 10477 #endif 10478 #ifdef CONFIG_IPW2100_DEBUG 10479 #endif 10480 #define SEARCH_ERROR 0xffffffff 10481 #define SEARCH_FAIL 0xfffffffe 10482 #define SEARCH_SUCCESS 0xfffffff0 10483 #define SEARCH_DISCARD 0 10484 #define SEARCH_SNAPSHOT 1 10485 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 10486 #ifdef IPW2100_DEBUG_C3 10487 #endif 10488 #ifdef IPW2100_RX_DEBUG 10489 #endif 10490 #ifdef IPW2100_DEBUG_C3 10491 #endif 10492 #ifdef IPW2100_DEBUG_C3 10493 #endif 10494 #ifdef IPW2100_RX_DEBUG 10495 #endif 10496 #ifdef IPW2100_RX_DEBUG 10497 #endif 10498 #ifdef CONFIG_IPW2100_MONITOR 10499 #endif 10500 #ifdef CONFIG_IPW2100_MONITOR 10501 #else 10502 #endif 10503 #ifdef CONFIG_IPW2100_MONITOR 10504 #endif 10505 #ifdef CONFIG_IPW2100_DEBUG 10506 #endif 10507 #ifdef CONFIG_IPW2100_DEBUG 10508 #endif 10509 #ifdef CONFIG_IPW2100_DEBUG 10510 #endif 10511 #define IPW2100_REG(x) { IPW_ ##x, #x } 10512 #define IPW2100_NIC(x, s) { x, #x, s } 10513 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 10514 #ifdef CONFIG_IPW2100_DEBUG 10515 #endif 10516 #ifdef CONFIG_IPW2100_MONITOR 10517 #endif 10518 #ifdef CONFIG_PM 10519 #endif 10520 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 10521 #ifdef CONFIG_IPW2100_DEBUG 10522 #endif 10523 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 10524 #endif 10525 #ifdef IPW2100_TX_POWER 10526 #endif 10527 #if 0 10528 #endif 10529 #ifdef CONFIG_IPW2100_DEBUG 10530 #endif 10531 #define IPW_PRIVACY_CAPABLE 0x0008 10532 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 10533 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 10534 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 10535 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 10536 #ifdef CONFIG_IPW2100_MONITOR 10537 #endif 10538 #ifdef CONFIG_IPW2100_MONITOR 10539 #endif 10540 #ifdef CONFIG_IPW2100_MONITOR 10541 #endif 10542 #ifdef CONFIG_IPW2100_MONITOR 10543 #endif 10544 #ifdef CONFIG_PM 10545 #endif 10546 #ifdef CONFIG_PM 10547 #endif 10548 /* LDV_COMMENT_END_PREP */ 10549 /* LDV_COMMENT_BEGIN_PREP */ 10550 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 10551 #ifdef CONFIG_PM 10552 #endif 10553 #ifdef CONFIG_IPW2100_DEBUG 10554 #endif 10555 #ifdef CONFIG_IPW2100_DEBUG 10556 #endif 10557 #ifdef CONFIG_IPW2100_MONITOR 10558 #endif 10559 #define POWER_MODES 5 10560 #ifdef CONFIG_IPW2100_MONITOR 10561 #endif 10562 #define MAX_POWER_STRING 80 10563 #ifdef CONFIG_IPW2100_MONITOR 10564 #endif 10565 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 10566 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 10567 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 10568 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 10569 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 10570 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 10571 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 10572 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 10573 #ifdef CONFIG_IPW2100_MONITOR 10574 #endif 10575 #ifdef CONFIG_IPW2100_MONITOR 10576 #endif 10577 #ifdef CONFIG_IPW2100_MONITOR 10578 #else 10579 #endif 10580 #ifdef CONFIG_IPW2100_MONITOR 10581 #else 10582 #endif 10583 #ifdef CONFIG_IPW2100_DEBUG 10584 #endif 10585 #define IPW2100_FW_MAJOR_VERSION 1 10586 #define IPW2100_FW_MINOR_VERSION 3 10587 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 10588 #define IPW2100_FW_MAJOR(x) (x & 0xff) 10589 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 10590 IPW2100_FW_MAJOR_VERSION) 10591 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 10592 "." __stringify(IPW2100_FW_MINOR_VERSION) 10593 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 10594 #ifdef CONFIG_IPW2100_MONITOR 10595 #endif 10596 #ifdef CONFIG_IPW2100_MONITOR 10597 #endif 10598 /* LDV_COMMENT_END_PREP */ 10599 10600 /** STRUCT: struct type: iw_handler_def, struct name: ipw2100_wx_handler_def **/ 10601 /* content: static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev)*/ 10602 /* LDV_COMMENT_BEGIN_PREP */ 10603 #define IPW2100_VERSION "git-1.2.2" 10604 #define DRV_NAME "ipw2100" 10605 #define DRV_VERSION IPW2100_VERSION 10606 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 10607 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 10608 #ifdef CONFIG_IPW2100_DEBUG 10609 #define IPW2100_RX_DEBUG 10610 #endif 10611 #ifdef CONFIG_PM 10612 #endif 10613 #ifdef CONFIG_IPW2100_DEBUG 10614 #define IPW_DEBUG(level, message...) \ 10615 do { \ 10616 if (ipw2100_debug_level & (level)) { \ 10617 printk(KERN_DEBUG "ipw2100: %c %s ", \ 10618 in_interrupt() ? 'I' : 'U', __func__); \ 10619 printk(message); \ 10620 } \ 10621 } while (0) 10622 #else 10623 #define IPW_DEBUG(level, message...) do {} while (0) 10624 #endif 10625 #ifdef CONFIG_IPW2100_DEBUG 10626 #endif 10627 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 10628 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 10629 #define MAX_RESET_BACKOFF 10 10630 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 10631 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 10632 #ifndef CONFIG_PM 10633 #endif 10634 #ifdef CONFIG_PM 10635 #else 10636 #endif 10637 #ifndef CONFIG_PM 10638 #endif 10639 #define MAX_RF_KILL_CHECKS 5 10640 #define RF_KILL_CHECK_DELAY 40 10641 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 10642 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 10643 #define MAC_ASSOCIATION_READ_DELAY (HZ) 10644 #ifdef CONFIG_IPW2100_DEBUG 10645 #define IPW2100_HANDLER(v, f) { v, f, # v } 10646 #else 10647 #define IPW2100_HANDLER(v, f) { v, f } 10648 #endif 10649 #ifdef CONFIG_IPW2100_DEBUG 10650 #endif 10651 #ifdef CONFIG_IPW2100_DEBUG 10652 #endif 10653 #define SEARCH_ERROR 0xffffffff 10654 #define SEARCH_FAIL 0xfffffffe 10655 #define SEARCH_SUCCESS 0xfffffff0 10656 #define SEARCH_DISCARD 0 10657 #define SEARCH_SNAPSHOT 1 10658 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 10659 #ifdef IPW2100_DEBUG_C3 10660 #endif 10661 #ifdef IPW2100_RX_DEBUG 10662 #endif 10663 #ifdef IPW2100_DEBUG_C3 10664 #endif 10665 #ifdef IPW2100_DEBUG_C3 10666 #endif 10667 #ifdef IPW2100_RX_DEBUG 10668 #endif 10669 #ifdef IPW2100_RX_DEBUG 10670 #endif 10671 #ifdef CONFIG_IPW2100_MONITOR 10672 #endif 10673 #ifdef CONFIG_IPW2100_MONITOR 10674 #else 10675 #endif 10676 #ifdef CONFIG_IPW2100_MONITOR 10677 #endif 10678 #ifdef CONFIG_IPW2100_DEBUG 10679 #endif 10680 #ifdef CONFIG_IPW2100_DEBUG 10681 #endif 10682 #ifdef CONFIG_IPW2100_DEBUG 10683 #endif 10684 #define IPW2100_REG(x) { IPW_ ##x, #x } 10685 #define IPW2100_NIC(x, s) { x, #x, s } 10686 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 10687 #ifdef CONFIG_IPW2100_DEBUG 10688 #endif 10689 #ifdef CONFIG_IPW2100_MONITOR 10690 #endif 10691 #ifdef CONFIG_PM 10692 #endif 10693 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 10694 #ifdef CONFIG_IPW2100_DEBUG 10695 #endif 10696 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 10697 #endif 10698 #ifdef IPW2100_TX_POWER 10699 #endif 10700 #if 0 10701 #endif 10702 #ifdef CONFIG_IPW2100_DEBUG 10703 #endif 10704 #define IPW_PRIVACY_CAPABLE 0x0008 10705 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 10706 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 10707 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 10708 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 10709 #ifdef CONFIG_IPW2100_MONITOR 10710 #endif 10711 #ifdef CONFIG_IPW2100_MONITOR 10712 #endif 10713 #ifdef CONFIG_IPW2100_MONITOR 10714 #endif 10715 #ifdef CONFIG_IPW2100_MONITOR 10716 #endif 10717 #ifdef CONFIG_PM 10718 #endif 10719 #ifdef CONFIG_PM 10720 #endif 10721 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 10722 #ifdef CONFIG_PM 10723 #endif 10724 #ifdef CONFIG_IPW2100_DEBUG 10725 #endif 10726 #ifdef CONFIG_IPW2100_DEBUG 10727 #endif 10728 #ifdef CONFIG_IPW2100_MONITOR 10729 #endif 10730 #define POWER_MODES 5 10731 #ifdef CONFIG_IPW2100_MONITOR 10732 #endif 10733 #define MAX_POWER_STRING 80 10734 #ifdef CONFIG_IPW2100_MONITOR 10735 #endif 10736 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 10737 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 10738 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 10739 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 10740 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 10741 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 10742 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 10743 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 10744 #ifdef CONFIG_IPW2100_MONITOR 10745 #endif 10746 #ifdef CONFIG_IPW2100_MONITOR 10747 #endif 10748 #ifdef CONFIG_IPW2100_MONITOR 10749 #else 10750 #endif 10751 #ifdef CONFIG_IPW2100_MONITOR 10752 #else 10753 #endif 10754 /* LDV_COMMENT_END_PREP */ 10755 /* LDV_COMMENT_BEGIN_PREP */ 10756 #define IPW2100_FW_MAJOR_VERSION 1 10757 #define IPW2100_FW_MINOR_VERSION 3 10758 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 10759 #define IPW2100_FW_MAJOR(x) (x & 0xff) 10760 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 10761 IPW2100_FW_MAJOR_VERSION) 10762 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 10763 "." __stringify(IPW2100_FW_MINOR_VERSION) 10764 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 10765 #ifdef CONFIG_IPW2100_MONITOR 10766 #endif 10767 #ifdef CONFIG_IPW2100_MONITOR 10768 #endif 10769 /* LDV_COMMENT_END_PREP */ 10770 10771 /** CALLBACK SECTION request_irq **/ 10772 /* content: static irqreturn_t ipw2100_interrupt(int irq, void *data)*/ 10773 /* LDV_COMMENT_BEGIN_PREP */ 10774 #define IPW2100_VERSION "git-1.2.2" 10775 #define DRV_NAME "ipw2100" 10776 #define DRV_VERSION IPW2100_VERSION 10777 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 10778 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 10779 #ifdef CONFIG_IPW2100_DEBUG 10780 #define IPW2100_RX_DEBUG 10781 #endif 10782 #ifdef CONFIG_PM 10783 #endif 10784 #ifdef CONFIG_IPW2100_DEBUG 10785 #define IPW_DEBUG(level, message...) \ 10786 do { \ 10787 if (ipw2100_debug_level & (level)) { \ 10788 printk(KERN_DEBUG "ipw2100: %c %s ", \ 10789 in_interrupt() ? 'I' : 'U', __func__); \ 10790 printk(message); \ 10791 } \ 10792 } while (0) 10793 #else 10794 #define IPW_DEBUG(level, message...) do {} while (0) 10795 #endif 10796 #ifdef CONFIG_IPW2100_DEBUG 10797 #endif 10798 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 10799 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 10800 #define MAX_RESET_BACKOFF 10 10801 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 10802 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 10803 #ifndef CONFIG_PM 10804 #endif 10805 #ifdef CONFIG_PM 10806 #else 10807 #endif 10808 #ifndef CONFIG_PM 10809 #endif 10810 #define MAX_RF_KILL_CHECKS 5 10811 #define RF_KILL_CHECK_DELAY 40 10812 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 10813 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 10814 #define MAC_ASSOCIATION_READ_DELAY (HZ) 10815 #ifdef CONFIG_IPW2100_DEBUG 10816 #define IPW2100_HANDLER(v, f) { v, f, # v } 10817 #else 10818 #define IPW2100_HANDLER(v, f) { v, f } 10819 #endif 10820 #ifdef CONFIG_IPW2100_DEBUG 10821 #endif 10822 #ifdef CONFIG_IPW2100_DEBUG 10823 #endif 10824 #define SEARCH_ERROR 0xffffffff 10825 #define SEARCH_FAIL 0xfffffffe 10826 #define SEARCH_SUCCESS 0xfffffff0 10827 #define SEARCH_DISCARD 0 10828 #define SEARCH_SNAPSHOT 1 10829 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 10830 #ifdef IPW2100_DEBUG_C3 10831 #endif 10832 #ifdef IPW2100_RX_DEBUG 10833 #endif 10834 #ifdef IPW2100_DEBUG_C3 10835 #endif 10836 #ifdef IPW2100_DEBUG_C3 10837 #endif 10838 #ifdef IPW2100_RX_DEBUG 10839 #endif 10840 #ifdef IPW2100_RX_DEBUG 10841 #endif 10842 #ifdef CONFIG_IPW2100_MONITOR 10843 #endif 10844 #ifdef CONFIG_IPW2100_MONITOR 10845 #else 10846 #endif 10847 #ifdef CONFIG_IPW2100_MONITOR 10848 #endif 10849 #ifdef CONFIG_IPW2100_DEBUG 10850 #endif 10851 #ifdef CONFIG_IPW2100_DEBUG 10852 #endif 10853 #ifdef CONFIG_IPW2100_DEBUG 10854 #endif 10855 /* LDV_COMMENT_END_PREP */ 10856 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_interrupt" */ 10857 int var_ipw2100_interrupt_69_p0; 10858 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_interrupt" */ 10859 void * var_ipw2100_interrupt_69_p1; 10860 /* LDV_COMMENT_BEGIN_PREP */ 10861 #define IPW2100_REG(x) { IPW_ ##x, #x } 10862 #define IPW2100_NIC(x, s) { x, #x, s } 10863 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 10864 #ifdef CONFIG_IPW2100_DEBUG 10865 #endif 10866 #ifdef CONFIG_IPW2100_MONITOR 10867 #endif 10868 #ifdef CONFIG_PM 10869 #endif 10870 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 10871 #ifdef CONFIG_IPW2100_DEBUG 10872 #endif 10873 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 10874 #endif 10875 #ifdef IPW2100_TX_POWER 10876 #endif 10877 #if 0 10878 #endif 10879 #ifdef CONFIG_IPW2100_DEBUG 10880 #endif 10881 #define IPW_PRIVACY_CAPABLE 0x0008 10882 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 10883 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 10884 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 10885 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 10886 #ifdef CONFIG_IPW2100_MONITOR 10887 #endif 10888 #ifdef CONFIG_IPW2100_MONITOR 10889 #endif 10890 #ifdef CONFIG_IPW2100_MONITOR 10891 #endif 10892 #ifdef CONFIG_IPW2100_MONITOR 10893 #endif 10894 #ifdef CONFIG_PM 10895 #endif 10896 #ifdef CONFIG_PM 10897 #endif 10898 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 10899 #ifdef CONFIG_PM 10900 #endif 10901 #ifdef CONFIG_IPW2100_DEBUG 10902 #endif 10903 #ifdef CONFIG_IPW2100_DEBUG 10904 #endif 10905 #ifdef CONFIG_IPW2100_MONITOR 10906 #endif 10907 #define POWER_MODES 5 10908 #ifdef CONFIG_IPW2100_MONITOR 10909 #endif 10910 #define MAX_POWER_STRING 80 10911 #ifdef CONFIG_IPW2100_MONITOR 10912 #endif 10913 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 10914 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 10915 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 10916 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 10917 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 10918 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 10919 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 10920 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 10921 #ifdef CONFIG_IPW2100_MONITOR 10922 #endif 10923 #ifdef CONFIG_IPW2100_MONITOR 10924 #endif 10925 #ifdef CONFIG_IPW2100_MONITOR 10926 #else 10927 #endif 10928 #ifdef CONFIG_IPW2100_MONITOR 10929 #else 10930 #endif 10931 #ifdef CONFIG_IPW2100_DEBUG 10932 #endif 10933 #define IPW2100_FW_MAJOR_VERSION 1 10934 #define IPW2100_FW_MINOR_VERSION 3 10935 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 10936 #define IPW2100_FW_MAJOR(x) (x & 0xff) 10937 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 10938 IPW2100_FW_MAJOR_VERSION) 10939 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 10940 "." __stringify(IPW2100_FW_MINOR_VERSION) 10941 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 10942 #ifdef CONFIG_IPW2100_MONITOR 10943 #endif 10944 #ifdef CONFIG_IPW2100_MONITOR 10945 #endif 10946 /* LDV_COMMENT_END_PREP */ 10947 10948 10949 10950 10951 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 10952 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 10953 /*============================= VARIABLE INITIALIZING PART =============================*/ 10954 LDV_IN_INTERRUPT=1; 10955 10956 10957 10958 10959 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 10960 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 10961 /*============================= FUNCTION CALL SECTION =============================*/ 10962 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 10963 ldv_initialize(); 10964 10965 /** INIT: init_type: ST_MODULE_INIT **/ 10966 /* content: static int __init ipw2100_init(void)*/ 10967 /* LDV_COMMENT_BEGIN_PREP */ 10968 #define IPW2100_VERSION "git-1.2.2" 10969 #define DRV_NAME "ipw2100" 10970 #define DRV_VERSION IPW2100_VERSION 10971 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 10972 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 10973 #ifdef CONFIG_IPW2100_DEBUG 10974 #define IPW2100_RX_DEBUG 10975 #endif 10976 #ifdef CONFIG_PM 10977 #endif 10978 #ifdef CONFIG_IPW2100_DEBUG 10979 #define IPW_DEBUG(level, message...) \ 10980 do { \ 10981 if (ipw2100_debug_level & (level)) { \ 10982 printk(KERN_DEBUG "ipw2100: %c %s ", \ 10983 in_interrupt() ? 'I' : 'U', __func__); \ 10984 printk(message); \ 10985 } \ 10986 } while (0) 10987 #else 10988 #define IPW_DEBUG(level, message...) do {} while (0) 10989 #endif 10990 #ifdef CONFIG_IPW2100_DEBUG 10991 #endif 10992 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 10993 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 10994 #define MAX_RESET_BACKOFF 10 10995 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 10996 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 10997 #ifndef CONFIG_PM 10998 #endif 10999 #ifdef CONFIG_PM 11000 #else 11001 #endif 11002 #ifndef CONFIG_PM 11003 #endif 11004 #define MAX_RF_KILL_CHECKS 5 11005 #define RF_KILL_CHECK_DELAY 40 11006 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 11007 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 11008 #define MAC_ASSOCIATION_READ_DELAY (HZ) 11009 #ifdef CONFIG_IPW2100_DEBUG 11010 #define IPW2100_HANDLER(v, f) { v, f, # v } 11011 #else 11012 #define IPW2100_HANDLER(v, f) { v, f } 11013 #endif 11014 #ifdef CONFIG_IPW2100_DEBUG 11015 #endif 11016 #ifdef CONFIG_IPW2100_DEBUG 11017 #endif 11018 #define SEARCH_ERROR 0xffffffff 11019 #define SEARCH_FAIL 0xfffffffe 11020 #define SEARCH_SUCCESS 0xfffffff0 11021 #define SEARCH_DISCARD 0 11022 #define SEARCH_SNAPSHOT 1 11023 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 11024 #ifdef IPW2100_DEBUG_C3 11025 #endif 11026 #ifdef IPW2100_RX_DEBUG 11027 #endif 11028 #ifdef IPW2100_DEBUG_C3 11029 #endif 11030 #ifdef IPW2100_DEBUG_C3 11031 #endif 11032 #ifdef IPW2100_RX_DEBUG 11033 #endif 11034 #ifdef IPW2100_RX_DEBUG 11035 #endif 11036 #ifdef CONFIG_IPW2100_MONITOR 11037 #endif 11038 #ifdef CONFIG_IPW2100_MONITOR 11039 #else 11040 #endif 11041 #ifdef CONFIG_IPW2100_MONITOR 11042 #endif 11043 #ifdef CONFIG_IPW2100_DEBUG 11044 #endif 11045 #ifdef CONFIG_IPW2100_DEBUG 11046 #endif 11047 #ifdef CONFIG_IPW2100_DEBUG 11048 #endif 11049 #define IPW2100_REG(x) { IPW_ ##x, #x } 11050 #define IPW2100_NIC(x, s) { x, #x, s } 11051 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 11052 #ifdef CONFIG_IPW2100_DEBUG 11053 #endif 11054 #ifdef CONFIG_IPW2100_MONITOR 11055 #endif 11056 #ifdef CONFIG_PM 11057 #endif 11058 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 11059 #ifdef CONFIG_IPW2100_DEBUG 11060 #endif 11061 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 11062 #endif 11063 #ifdef IPW2100_TX_POWER 11064 #endif 11065 #if 0 11066 #endif 11067 #ifdef CONFIG_IPW2100_DEBUG 11068 #endif 11069 #define IPW_PRIVACY_CAPABLE 0x0008 11070 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 11071 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 11072 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 11073 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 11074 #ifdef CONFIG_IPW2100_MONITOR 11075 #endif 11076 #ifdef CONFIG_IPW2100_MONITOR 11077 #endif 11078 #ifdef CONFIG_IPW2100_MONITOR 11079 #endif 11080 #ifdef CONFIG_IPW2100_MONITOR 11081 #endif 11082 #ifdef CONFIG_PM 11083 #endif 11084 #ifdef CONFIG_PM 11085 #endif 11086 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 11087 #ifdef CONFIG_PM 11088 #endif 11089 /* LDV_COMMENT_END_PREP */ 11090 /* LDV_COMMENT_FUNCTION_CALL Kernel calls driver init function after driver loading to kernel. This function declared as "MODULE_INIT(function name)". */ 11091 ldv_handler_precall(); 11092 if(ipw2100_init()) 11093 goto ldv_final; 11094 /* LDV_COMMENT_BEGIN_PREP */ 11095 #ifdef CONFIG_IPW2100_DEBUG 11096 #endif 11097 #ifdef CONFIG_IPW2100_MONITOR 11098 #endif 11099 #define POWER_MODES 5 11100 #ifdef CONFIG_IPW2100_MONITOR 11101 #endif 11102 #define MAX_POWER_STRING 80 11103 #ifdef CONFIG_IPW2100_MONITOR 11104 #endif 11105 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 11106 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 11107 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 11108 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 11109 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 11110 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 11111 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 11112 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 11113 #ifdef CONFIG_IPW2100_MONITOR 11114 #endif 11115 #ifdef CONFIG_IPW2100_MONITOR 11116 #endif 11117 #ifdef CONFIG_IPW2100_MONITOR 11118 #else 11119 #endif 11120 #ifdef CONFIG_IPW2100_MONITOR 11121 #else 11122 #endif 11123 #ifdef CONFIG_IPW2100_DEBUG 11124 #endif 11125 #define IPW2100_FW_MAJOR_VERSION 1 11126 #define IPW2100_FW_MINOR_VERSION 3 11127 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 11128 #define IPW2100_FW_MAJOR(x) (x & 0xff) 11129 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 11130 IPW2100_FW_MAJOR_VERSION) 11131 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 11132 "." __stringify(IPW2100_FW_MINOR_VERSION) 11133 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 11134 #ifdef CONFIG_IPW2100_MONITOR 11135 #endif 11136 #ifdef CONFIG_IPW2100_MONITOR 11137 #endif 11138 /* LDV_COMMENT_END_PREP */ 11139 11140 11141 int ldv_s_ipw2100_netdev_ops_net_device_ops = 0; 11142 11143 11144 int ldv_s_ipw2100_pci_driver_pci_driver = 0; 11145 11146 11147 11148 11149 11150 11151 11152 while( nondet_int() 11153 || !(ldv_s_ipw2100_netdev_ops_net_device_ops == 0) 11154 || !(ldv_s_ipw2100_pci_driver_pci_driver == 0) 11155 ) { 11156 11157 switch(nondet_int()) { 11158 11159 case 0: { 11160 11161 /** STRUCT: struct type: ethtool_ops, struct name: ipw2100_ethtool_ops **/ 11162 11163 11164 /* content: static u32 ipw2100_ethtool_get_link(struct net_device *dev)*/ 11165 /* LDV_COMMENT_BEGIN_PREP */ 11166 #define IPW2100_VERSION "git-1.2.2" 11167 #define DRV_NAME "ipw2100" 11168 #define DRV_VERSION IPW2100_VERSION 11169 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 11170 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 11171 #ifdef CONFIG_IPW2100_DEBUG 11172 #define IPW2100_RX_DEBUG 11173 #endif 11174 #ifdef CONFIG_PM 11175 #endif 11176 #ifdef CONFIG_IPW2100_DEBUG 11177 #define IPW_DEBUG(level, message...) \ 11178 do { \ 11179 if (ipw2100_debug_level & (level)) { \ 11180 printk(KERN_DEBUG "ipw2100: %c %s ", \ 11181 in_interrupt() ? 'I' : 'U', __func__); \ 11182 printk(message); \ 11183 } \ 11184 } while (0) 11185 #else 11186 #define IPW_DEBUG(level, message...) do {} while (0) 11187 #endif 11188 #ifdef CONFIG_IPW2100_DEBUG 11189 #endif 11190 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 11191 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 11192 #define MAX_RESET_BACKOFF 10 11193 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 11194 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 11195 #ifndef CONFIG_PM 11196 #endif 11197 #ifdef CONFIG_PM 11198 #else 11199 #endif 11200 #ifndef CONFIG_PM 11201 #endif 11202 #define MAX_RF_KILL_CHECKS 5 11203 #define RF_KILL_CHECK_DELAY 40 11204 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 11205 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 11206 #define MAC_ASSOCIATION_READ_DELAY (HZ) 11207 #ifdef CONFIG_IPW2100_DEBUG 11208 #define IPW2100_HANDLER(v, f) { v, f, # v } 11209 #else 11210 #define IPW2100_HANDLER(v, f) { v, f } 11211 #endif 11212 #ifdef CONFIG_IPW2100_DEBUG 11213 #endif 11214 #ifdef CONFIG_IPW2100_DEBUG 11215 #endif 11216 #define SEARCH_ERROR 0xffffffff 11217 #define SEARCH_FAIL 0xfffffffe 11218 #define SEARCH_SUCCESS 0xfffffff0 11219 #define SEARCH_DISCARD 0 11220 #define SEARCH_SNAPSHOT 1 11221 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 11222 #ifdef IPW2100_DEBUG_C3 11223 #endif 11224 #ifdef IPW2100_RX_DEBUG 11225 #endif 11226 #ifdef IPW2100_DEBUG_C3 11227 #endif 11228 #ifdef IPW2100_DEBUG_C3 11229 #endif 11230 #ifdef IPW2100_RX_DEBUG 11231 #endif 11232 #ifdef IPW2100_RX_DEBUG 11233 #endif 11234 #ifdef CONFIG_IPW2100_MONITOR 11235 #endif 11236 #ifdef CONFIG_IPW2100_MONITOR 11237 #else 11238 #endif 11239 #ifdef CONFIG_IPW2100_MONITOR 11240 #endif 11241 #ifdef CONFIG_IPW2100_DEBUG 11242 #endif 11243 #ifdef CONFIG_IPW2100_DEBUG 11244 #endif 11245 #ifdef CONFIG_IPW2100_DEBUG 11246 #endif 11247 #define IPW2100_REG(x) { IPW_ ##x, #x } 11248 #define IPW2100_NIC(x, s) { x, #x, s } 11249 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 11250 #ifdef CONFIG_IPW2100_DEBUG 11251 #endif 11252 #ifdef CONFIG_IPW2100_MONITOR 11253 #endif 11254 #ifdef CONFIG_PM 11255 #endif 11256 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 11257 #ifdef CONFIG_IPW2100_DEBUG 11258 #endif 11259 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 11260 #endif 11261 #ifdef IPW2100_TX_POWER 11262 #endif 11263 #if 0 11264 #endif 11265 #ifdef CONFIG_IPW2100_DEBUG 11266 #endif 11267 #define IPW_PRIVACY_CAPABLE 0x0008 11268 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 11269 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 11270 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 11271 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 11272 #ifdef CONFIG_IPW2100_MONITOR 11273 #endif 11274 #ifdef CONFIG_IPW2100_MONITOR 11275 #endif 11276 /* LDV_COMMENT_END_PREP */ 11277 /* LDV_COMMENT_FUNCTION_CALL Function from field "get_link" from driver structure with callbacks "ipw2100_ethtool_ops" */ 11278 ldv_handler_precall(); 11279 ipw2100_ethtool_get_link( var_group1); 11280 /* LDV_COMMENT_BEGIN_PREP */ 11281 #ifdef CONFIG_IPW2100_MONITOR 11282 #endif 11283 #ifdef CONFIG_IPW2100_MONITOR 11284 #endif 11285 #ifdef CONFIG_PM 11286 #endif 11287 #ifdef CONFIG_PM 11288 #endif 11289 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 11290 #ifdef CONFIG_PM 11291 #endif 11292 #ifdef CONFIG_IPW2100_DEBUG 11293 #endif 11294 #ifdef CONFIG_IPW2100_DEBUG 11295 #endif 11296 #ifdef CONFIG_IPW2100_MONITOR 11297 #endif 11298 #define POWER_MODES 5 11299 #ifdef CONFIG_IPW2100_MONITOR 11300 #endif 11301 #define MAX_POWER_STRING 80 11302 #ifdef CONFIG_IPW2100_MONITOR 11303 #endif 11304 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 11305 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 11306 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 11307 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 11308 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 11309 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 11310 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 11311 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 11312 #ifdef CONFIG_IPW2100_MONITOR 11313 #endif 11314 #ifdef CONFIG_IPW2100_MONITOR 11315 #endif 11316 #ifdef CONFIG_IPW2100_MONITOR 11317 #else 11318 #endif 11319 #ifdef CONFIG_IPW2100_MONITOR 11320 #else 11321 #endif 11322 #ifdef CONFIG_IPW2100_DEBUG 11323 #endif 11324 #define IPW2100_FW_MAJOR_VERSION 1 11325 #define IPW2100_FW_MINOR_VERSION 3 11326 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 11327 #define IPW2100_FW_MAJOR(x) (x & 0xff) 11328 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 11329 IPW2100_FW_MAJOR_VERSION) 11330 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 11331 "." __stringify(IPW2100_FW_MINOR_VERSION) 11332 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 11333 #ifdef CONFIG_IPW2100_MONITOR 11334 #endif 11335 #ifdef CONFIG_IPW2100_MONITOR 11336 #endif 11337 /* LDV_COMMENT_END_PREP */ 11338 11339 11340 11341 11342 } 11343 11344 break; 11345 case 1: { 11346 11347 /** STRUCT: struct type: ethtool_ops, struct name: ipw2100_ethtool_ops **/ 11348 11349 11350 /* content: static void ipw_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)*/ 11351 /* LDV_COMMENT_BEGIN_PREP */ 11352 #define IPW2100_VERSION "git-1.2.2" 11353 #define DRV_NAME "ipw2100" 11354 #define DRV_VERSION IPW2100_VERSION 11355 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 11356 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 11357 #ifdef CONFIG_IPW2100_DEBUG 11358 #define IPW2100_RX_DEBUG 11359 #endif 11360 #ifdef CONFIG_PM 11361 #endif 11362 #ifdef CONFIG_IPW2100_DEBUG 11363 #define IPW_DEBUG(level, message...) \ 11364 do { \ 11365 if (ipw2100_debug_level & (level)) { \ 11366 printk(KERN_DEBUG "ipw2100: %c %s ", \ 11367 in_interrupt() ? 'I' : 'U', __func__); \ 11368 printk(message); \ 11369 } \ 11370 } while (0) 11371 #else 11372 #define IPW_DEBUG(level, message...) do {} while (0) 11373 #endif 11374 #ifdef CONFIG_IPW2100_DEBUG 11375 #endif 11376 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 11377 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 11378 #define MAX_RESET_BACKOFF 10 11379 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 11380 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 11381 #ifndef CONFIG_PM 11382 #endif 11383 #ifdef CONFIG_PM 11384 #else 11385 #endif 11386 #ifndef CONFIG_PM 11387 #endif 11388 #define MAX_RF_KILL_CHECKS 5 11389 #define RF_KILL_CHECK_DELAY 40 11390 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 11391 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 11392 #define MAC_ASSOCIATION_READ_DELAY (HZ) 11393 #ifdef CONFIG_IPW2100_DEBUG 11394 #define IPW2100_HANDLER(v, f) { v, f, # v } 11395 #else 11396 #define IPW2100_HANDLER(v, f) { v, f } 11397 #endif 11398 #ifdef CONFIG_IPW2100_DEBUG 11399 #endif 11400 #ifdef CONFIG_IPW2100_DEBUG 11401 #endif 11402 #define SEARCH_ERROR 0xffffffff 11403 #define SEARCH_FAIL 0xfffffffe 11404 #define SEARCH_SUCCESS 0xfffffff0 11405 #define SEARCH_DISCARD 0 11406 #define SEARCH_SNAPSHOT 1 11407 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 11408 #ifdef IPW2100_DEBUG_C3 11409 #endif 11410 #ifdef IPW2100_RX_DEBUG 11411 #endif 11412 #ifdef IPW2100_DEBUG_C3 11413 #endif 11414 #ifdef IPW2100_DEBUG_C3 11415 #endif 11416 #ifdef IPW2100_RX_DEBUG 11417 #endif 11418 #ifdef IPW2100_RX_DEBUG 11419 #endif 11420 #ifdef CONFIG_IPW2100_MONITOR 11421 #endif 11422 #ifdef CONFIG_IPW2100_MONITOR 11423 #else 11424 #endif 11425 #ifdef CONFIG_IPW2100_MONITOR 11426 #endif 11427 #ifdef CONFIG_IPW2100_DEBUG 11428 #endif 11429 #ifdef CONFIG_IPW2100_DEBUG 11430 #endif 11431 #ifdef CONFIG_IPW2100_DEBUG 11432 #endif 11433 #define IPW2100_REG(x) { IPW_ ##x, #x } 11434 #define IPW2100_NIC(x, s) { x, #x, s } 11435 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 11436 #ifdef CONFIG_IPW2100_DEBUG 11437 #endif 11438 #ifdef CONFIG_IPW2100_MONITOR 11439 #endif 11440 #ifdef CONFIG_PM 11441 #endif 11442 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 11443 #ifdef CONFIG_IPW2100_DEBUG 11444 #endif 11445 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 11446 #endif 11447 #ifdef IPW2100_TX_POWER 11448 #endif 11449 #if 0 11450 #endif 11451 #ifdef CONFIG_IPW2100_DEBUG 11452 #endif 11453 #define IPW_PRIVACY_CAPABLE 0x0008 11454 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 11455 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 11456 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 11457 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 11458 #ifdef CONFIG_IPW2100_MONITOR 11459 #endif 11460 #ifdef CONFIG_IPW2100_MONITOR 11461 #endif 11462 /* LDV_COMMENT_END_PREP */ 11463 /* LDV_COMMENT_FUNCTION_CALL Function from field "get_drvinfo" from driver structure with callbacks "ipw2100_ethtool_ops" */ 11464 ldv_handler_precall(); 11465 ipw_ethtool_get_drvinfo( var_group1, var_group2); 11466 /* LDV_COMMENT_BEGIN_PREP */ 11467 #ifdef CONFIG_IPW2100_MONITOR 11468 #endif 11469 #ifdef CONFIG_IPW2100_MONITOR 11470 #endif 11471 #ifdef CONFIG_PM 11472 #endif 11473 #ifdef CONFIG_PM 11474 #endif 11475 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 11476 #ifdef CONFIG_PM 11477 #endif 11478 #ifdef CONFIG_IPW2100_DEBUG 11479 #endif 11480 #ifdef CONFIG_IPW2100_DEBUG 11481 #endif 11482 #ifdef CONFIG_IPW2100_MONITOR 11483 #endif 11484 #define POWER_MODES 5 11485 #ifdef CONFIG_IPW2100_MONITOR 11486 #endif 11487 #define MAX_POWER_STRING 80 11488 #ifdef CONFIG_IPW2100_MONITOR 11489 #endif 11490 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 11491 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 11492 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 11493 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 11494 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 11495 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 11496 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 11497 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 11498 #ifdef CONFIG_IPW2100_MONITOR 11499 #endif 11500 #ifdef CONFIG_IPW2100_MONITOR 11501 #endif 11502 #ifdef CONFIG_IPW2100_MONITOR 11503 #else 11504 #endif 11505 #ifdef CONFIG_IPW2100_MONITOR 11506 #else 11507 #endif 11508 #ifdef CONFIG_IPW2100_DEBUG 11509 #endif 11510 #define IPW2100_FW_MAJOR_VERSION 1 11511 #define IPW2100_FW_MINOR_VERSION 3 11512 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 11513 #define IPW2100_FW_MAJOR(x) (x & 0xff) 11514 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 11515 IPW2100_FW_MAJOR_VERSION) 11516 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 11517 "." __stringify(IPW2100_FW_MINOR_VERSION) 11518 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 11519 #ifdef CONFIG_IPW2100_MONITOR 11520 #endif 11521 #ifdef CONFIG_IPW2100_MONITOR 11522 #endif 11523 /* LDV_COMMENT_END_PREP */ 11524 11525 11526 11527 11528 } 11529 11530 break; 11531 case 2: { 11532 11533 /** STRUCT: struct type: net_device_ops, struct name: ipw2100_netdev_ops **/ 11534 if(ldv_s_ipw2100_netdev_ops_net_device_ops==0) { 11535 11536 /* content: static int ipw2100_open(struct net_device *dev)*/ 11537 /* LDV_COMMENT_BEGIN_PREP */ 11538 #define IPW2100_VERSION "git-1.2.2" 11539 #define DRV_NAME "ipw2100" 11540 #define DRV_VERSION IPW2100_VERSION 11541 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 11542 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 11543 #ifdef CONFIG_IPW2100_DEBUG 11544 #define IPW2100_RX_DEBUG 11545 #endif 11546 #ifdef CONFIG_PM 11547 #endif 11548 #ifdef CONFIG_IPW2100_DEBUG 11549 #define IPW_DEBUG(level, message...) \ 11550 do { \ 11551 if (ipw2100_debug_level & (level)) { \ 11552 printk(KERN_DEBUG "ipw2100: %c %s ", \ 11553 in_interrupt() ? 'I' : 'U', __func__); \ 11554 printk(message); \ 11555 } \ 11556 } while (0) 11557 #else 11558 #define IPW_DEBUG(level, message...) do {} while (0) 11559 #endif 11560 #ifdef CONFIG_IPW2100_DEBUG 11561 #endif 11562 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 11563 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 11564 #define MAX_RESET_BACKOFF 10 11565 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 11566 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 11567 #ifndef CONFIG_PM 11568 #endif 11569 #ifdef CONFIG_PM 11570 #else 11571 #endif 11572 #ifndef CONFIG_PM 11573 #endif 11574 #define MAX_RF_KILL_CHECKS 5 11575 #define RF_KILL_CHECK_DELAY 40 11576 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 11577 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 11578 #define MAC_ASSOCIATION_READ_DELAY (HZ) 11579 #ifdef CONFIG_IPW2100_DEBUG 11580 #define IPW2100_HANDLER(v, f) { v, f, # v } 11581 #else 11582 #define IPW2100_HANDLER(v, f) { v, f } 11583 #endif 11584 #ifdef CONFIG_IPW2100_DEBUG 11585 #endif 11586 #ifdef CONFIG_IPW2100_DEBUG 11587 #endif 11588 #define SEARCH_ERROR 0xffffffff 11589 #define SEARCH_FAIL 0xfffffffe 11590 #define SEARCH_SUCCESS 0xfffffff0 11591 #define SEARCH_DISCARD 0 11592 #define SEARCH_SNAPSHOT 1 11593 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 11594 #ifdef IPW2100_DEBUG_C3 11595 #endif 11596 #ifdef IPW2100_RX_DEBUG 11597 #endif 11598 #ifdef IPW2100_DEBUG_C3 11599 #endif 11600 #ifdef IPW2100_DEBUG_C3 11601 #endif 11602 #ifdef IPW2100_RX_DEBUG 11603 #endif 11604 #ifdef IPW2100_RX_DEBUG 11605 #endif 11606 #ifdef CONFIG_IPW2100_MONITOR 11607 #endif 11608 #ifdef CONFIG_IPW2100_MONITOR 11609 #else 11610 #endif 11611 #ifdef CONFIG_IPW2100_MONITOR 11612 #endif 11613 #ifdef CONFIG_IPW2100_DEBUG 11614 #endif 11615 #ifdef CONFIG_IPW2100_DEBUG 11616 #endif 11617 #ifdef CONFIG_IPW2100_DEBUG 11618 #endif 11619 #define IPW2100_REG(x) { IPW_ ##x, #x } 11620 #define IPW2100_NIC(x, s) { x, #x, s } 11621 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 11622 #ifdef CONFIG_IPW2100_DEBUG 11623 #endif 11624 #ifdef CONFIG_IPW2100_MONITOR 11625 #endif 11626 #ifdef CONFIG_PM 11627 #endif 11628 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 11629 #ifdef CONFIG_IPW2100_DEBUG 11630 #endif 11631 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 11632 #endif 11633 #ifdef IPW2100_TX_POWER 11634 #endif 11635 #if 0 11636 #endif 11637 #ifdef CONFIG_IPW2100_DEBUG 11638 #endif 11639 #define IPW_PRIVACY_CAPABLE 0x0008 11640 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 11641 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 11642 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 11643 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 11644 #ifdef CONFIG_IPW2100_MONITOR 11645 #endif 11646 /* LDV_COMMENT_END_PREP */ 11647 /* LDV_COMMENT_FUNCTION_CALL Function from field "ndo_open" from driver structure with callbacks "ipw2100_netdev_ops". Standart function test for correct return result. */ 11648 ldv_handler_precall(); 11649 res_ipw2100_open_136 = ipw2100_open( var_group1); 11650 ldv_check_return_value(res_ipw2100_open_136); 11651 if(res_ipw2100_open_136 < 0) 11652 goto ldv_module_exit; 11653 /* LDV_COMMENT_BEGIN_PREP */ 11654 #ifdef CONFIG_IPW2100_MONITOR 11655 #endif 11656 #ifdef CONFIG_IPW2100_MONITOR 11657 #endif 11658 #ifdef CONFIG_IPW2100_MONITOR 11659 #endif 11660 #ifdef CONFIG_PM 11661 #endif 11662 #ifdef CONFIG_PM 11663 #endif 11664 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 11665 #ifdef CONFIG_PM 11666 #endif 11667 #ifdef CONFIG_IPW2100_DEBUG 11668 #endif 11669 #ifdef CONFIG_IPW2100_DEBUG 11670 #endif 11671 #ifdef CONFIG_IPW2100_MONITOR 11672 #endif 11673 #define POWER_MODES 5 11674 #ifdef CONFIG_IPW2100_MONITOR 11675 #endif 11676 #define MAX_POWER_STRING 80 11677 #ifdef CONFIG_IPW2100_MONITOR 11678 #endif 11679 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 11680 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 11681 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 11682 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 11683 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 11684 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 11685 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 11686 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 11687 #ifdef CONFIG_IPW2100_MONITOR 11688 #endif 11689 #ifdef CONFIG_IPW2100_MONITOR 11690 #endif 11691 #ifdef CONFIG_IPW2100_MONITOR 11692 #else 11693 #endif 11694 #ifdef CONFIG_IPW2100_MONITOR 11695 #else 11696 #endif 11697 #ifdef CONFIG_IPW2100_DEBUG 11698 #endif 11699 #define IPW2100_FW_MAJOR_VERSION 1 11700 #define IPW2100_FW_MINOR_VERSION 3 11701 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 11702 #define IPW2100_FW_MAJOR(x) (x & 0xff) 11703 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 11704 IPW2100_FW_MAJOR_VERSION) 11705 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 11706 "." __stringify(IPW2100_FW_MINOR_VERSION) 11707 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 11708 #ifdef CONFIG_IPW2100_MONITOR 11709 #endif 11710 #ifdef CONFIG_IPW2100_MONITOR 11711 #endif 11712 /* LDV_COMMENT_END_PREP */ 11713 ldv_s_ipw2100_netdev_ops_net_device_ops++; 11714 11715 } 11716 11717 } 11718 11719 break; 11720 case 3: { 11721 11722 /** STRUCT: struct type: net_device_ops, struct name: ipw2100_netdev_ops **/ 11723 if(ldv_s_ipw2100_netdev_ops_net_device_ops==1) { 11724 11725 /* content: static int ipw2100_close(struct net_device *dev)*/ 11726 /* LDV_COMMENT_BEGIN_PREP */ 11727 #define IPW2100_VERSION "git-1.2.2" 11728 #define DRV_NAME "ipw2100" 11729 #define DRV_VERSION IPW2100_VERSION 11730 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 11731 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 11732 #ifdef CONFIG_IPW2100_DEBUG 11733 #define IPW2100_RX_DEBUG 11734 #endif 11735 #ifdef CONFIG_PM 11736 #endif 11737 #ifdef CONFIG_IPW2100_DEBUG 11738 #define IPW_DEBUG(level, message...) \ 11739 do { \ 11740 if (ipw2100_debug_level & (level)) { \ 11741 printk(KERN_DEBUG "ipw2100: %c %s ", \ 11742 in_interrupt() ? 'I' : 'U', __func__); \ 11743 printk(message); \ 11744 } \ 11745 } while (0) 11746 #else 11747 #define IPW_DEBUG(level, message...) do {} while (0) 11748 #endif 11749 #ifdef CONFIG_IPW2100_DEBUG 11750 #endif 11751 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 11752 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 11753 #define MAX_RESET_BACKOFF 10 11754 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 11755 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 11756 #ifndef CONFIG_PM 11757 #endif 11758 #ifdef CONFIG_PM 11759 #else 11760 #endif 11761 #ifndef CONFIG_PM 11762 #endif 11763 #define MAX_RF_KILL_CHECKS 5 11764 #define RF_KILL_CHECK_DELAY 40 11765 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 11766 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 11767 #define MAC_ASSOCIATION_READ_DELAY (HZ) 11768 #ifdef CONFIG_IPW2100_DEBUG 11769 #define IPW2100_HANDLER(v, f) { v, f, # v } 11770 #else 11771 #define IPW2100_HANDLER(v, f) { v, f } 11772 #endif 11773 #ifdef CONFIG_IPW2100_DEBUG 11774 #endif 11775 #ifdef CONFIG_IPW2100_DEBUG 11776 #endif 11777 #define SEARCH_ERROR 0xffffffff 11778 #define SEARCH_FAIL 0xfffffffe 11779 #define SEARCH_SUCCESS 0xfffffff0 11780 #define SEARCH_DISCARD 0 11781 #define SEARCH_SNAPSHOT 1 11782 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 11783 #ifdef IPW2100_DEBUG_C3 11784 #endif 11785 #ifdef IPW2100_RX_DEBUG 11786 #endif 11787 #ifdef IPW2100_DEBUG_C3 11788 #endif 11789 #ifdef IPW2100_DEBUG_C3 11790 #endif 11791 #ifdef IPW2100_RX_DEBUG 11792 #endif 11793 #ifdef IPW2100_RX_DEBUG 11794 #endif 11795 #ifdef CONFIG_IPW2100_MONITOR 11796 #endif 11797 #ifdef CONFIG_IPW2100_MONITOR 11798 #else 11799 #endif 11800 #ifdef CONFIG_IPW2100_MONITOR 11801 #endif 11802 #ifdef CONFIG_IPW2100_DEBUG 11803 #endif 11804 #ifdef CONFIG_IPW2100_DEBUG 11805 #endif 11806 #ifdef CONFIG_IPW2100_DEBUG 11807 #endif 11808 #define IPW2100_REG(x) { IPW_ ##x, #x } 11809 #define IPW2100_NIC(x, s) { x, #x, s } 11810 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 11811 #ifdef CONFIG_IPW2100_DEBUG 11812 #endif 11813 #ifdef CONFIG_IPW2100_MONITOR 11814 #endif 11815 #ifdef CONFIG_PM 11816 #endif 11817 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 11818 #ifdef CONFIG_IPW2100_DEBUG 11819 #endif 11820 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 11821 #endif 11822 #ifdef IPW2100_TX_POWER 11823 #endif 11824 #if 0 11825 #endif 11826 #ifdef CONFIG_IPW2100_DEBUG 11827 #endif 11828 #define IPW_PRIVACY_CAPABLE 0x0008 11829 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 11830 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 11831 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 11832 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 11833 #ifdef CONFIG_IPW2100_MONITOR 11834 #endif 11835 /* LDV_COMMENT_END_PREP */ 11836 /* LDV_COMMENT_FUNCTION_CALL Function from field "ndo_stop" from driver structure with callbacks "ipw2100_netdev_ops". Standart function test for correct return result. */ 11837 ldv_handler_precall(); 11838 res_ipw2100_close_137 = ipw2100_close( var_group1); 11839 ldv_check_return_value(res_ipw2100_close_137); 11840 if(res_ipw2100_close_137) 11841 goto ldv_module_exit; 11842 /* LDV_COMMENT_BEGIN_PREP */ 11843 #ifdef CONFIG_IPW2100_MONITOR 11844 #endif 11845 #ifdef CONFIG_IPW2100_MONITOR 11846 #endif 11847 #ifdef CONFIG_IPW2100_MONITOR 11848 #endif 11849 #ifdef CONFIG_PM 11850 #endif 11851 #ifdef CONFIG_PM 11852 #endif 11853 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 11854 #ifdef CONFIG_PM 11855 #endif 11856 #ifdef CONFIG_IPW2100_DEBUG 11857 #endif 11858 #ifdef CONFIG_IPW2100_DEBUG 11859 #endif 11860 #ifdef CONFIG_IPW2100_MONITOR 11861 #endif 11862 #define POWER_MODES 5 11863 #ifdef CONFIG_IPW2100_MONITOR 11864 #endif 11865 #define MAX_POWER_STRING 80 11866 #ifdef CONFIG_IPW2100_MONITOR 11867 #endif 11868 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 11869 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 11870 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 11871 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 11872 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 11873 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 11874 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 11875 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 11876 #ifdef CONFIG_IPW2100_MONITOR 11877 #endif 11878 #ifdef CONFIG_IPW2100_MONITOR 11879 #endif 11880 #ifdef CONFIG_IPW2100_MONITOR 11881 #else 11882 #endif 11883 #ifdef CONFIG_IPW2100_MONITOR 11884 #else 11885 #endif 11886 #ifdef CONFIG_IPW2100_DEBUG 11887 #endif 11888 #define IPW2100_FW_MAJOR_VERSION 1 11889 #define IPW2100_FW_MINOR_VERSION 3 11890 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 11891 #define IPW2100_FW_MAJOR(x) (x & 0xff) 11892 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 11893 IPW2100_FW_MAJOR_VERSION) 11894 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 11895 "." __stringify(IPW2100_FW_MINOR_VERSION) 11896 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 11897 #ifdef CONFIG_IPW2100_MONITOR 11898 #endif 11899 #ifdef CONFIG_IPW2100_MONITOR 11900 #endif 11901 /* LDV_COMMENT_END_PREP */ 11902 ldv_s_ipw2100_netdev_ops_net_device_ops=0; 11903 11904 } 11905 11906 } 11907 11908 break; 11909 case 4: { 11910 11911 /** STRUCT: struct type: net_device_ops, struct name: ipw2100_netdev_ops **/ 11912 11913 11914 /* content: static void ipw2100_tx_timeout(struct net_device *dev)*/ 11915 /* LDV_COMMENT_BEGIN_PREP */ 11916 #define IPW2100_VERSION "git-1.2.2" 11917 #define DRV_NAME "ipw2100" 11918 #define DRV_VERSION IPW2100_VERSION 11919 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 11920 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 11921 #ifdef CONFIG_IPW2100_DEBUG 11922 #define IPW2100_RX_DEBUG 11923 #endif 11924 #ifdef CONFIG_PM 11925 #endif 11926 #ifdef CONFIG_IPW2100_DEBUG 11927 #define IPW_DEBUG(level, message...) \ 11928 do { \ 11929 if (ipw2100_debug_level & (level)) { \ 11930 printk(KERN_DEBUG "ipw2100: %c %s ", \ 11931 in_interrupt() ? 'I' : 'U', __func__); \ 11932 printk(message); \ 11933 } \ 11934 } while (0) 11935 #else 11936 #define IPW_DEBUG(level, message...) do {} while (0) 11937 #endif 11938 #ifdef CONFIG_IPW2100_DEBUG 11939 #endif 11940 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 11941 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 11942 #define MAX_RESET_BACKOFF 10 11943 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 11944 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 11945 #ifndef CONFIG_PM 11946 #endif 11947 #ifdef CONFIG_PM 11948 #else 11949 #endif 11950 #ifndef CONFIG_PM 11951 #endif 11952 #define MAX_RF_KILL_CHECKS 5 11953 #define RF_KILL_CHECK_DELAY 40 11954 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 11955 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 11956 #define MAC_ASSOCIATION_READ_DELAY (HZ) 11957 #ifdef CONFIG_IPW2100_DEBUG 11958 #define IPW2100_HANDLER(v, f) { v, f, # v } 11959 #else 11960 #define IPW2100_HANDLER(v, f) { v, f } 11961 #endif 11962 #ifdef CONFIG_IPW2100_DEBUG 11963 #endif 11964 #ifdef CONFIG_IPW2100_DEBUG 11965 #endif 11966 #define SEARCH_ERROR 0xffffffff 11967 #define SEARCH_FAIL 0xfffffffe 11968 #define SEARCH_SUCCESS 0xfffffff0 11969 #define SEARCH_DISCARD 0 11970 #define SEARCH_SNAPSHOT 1 11971 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 11972 #ifdef IPW2100_DEBUG_C3 11973 #endif 11974 #ifdef IPW2100_RX_DEBUG 11975 #endif 11976 #ifdef IPW2100_DEBUG_C3 11977 #endif 11978 #ifdef IPW2100_DEBUG_C3 11979 #endif 11980 #ifdef IPW2100_RX_DEBUG 11981 #endif 11982 #ifdef IPW2100_RX_DEBUG 11983 #endif 11984 #ifdef CONFIG_IPW2100_MONITOR 11985 #endif 11986 #ifdef CONFIG_IPW2100_MONITOR 11987 #else 11988 #endif 11989 #ifdef CONFIG_IPW2100_MONITOR 11990 #endif 11991 #ifdef CONFIG_IPW2100_DEBUG 11992 #endif 11993 #ifdef CONFIG_IPW2100_DEBUG 11994 #endif 11995 #ifdef CONFIG_IPW2100_DEBUG 11996 #endif 11997 #define IPW2100_REG(x) { IPW_ ##x, #x } 11998 #define IPW2100_NIC(x, s) { x, #x, s } 11999 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 12000 #ifdef CONFIG_IPW2100_DEBUG 12001 #endif 12002 #ifdef CONFIG_IPW2100_MONITOR 12003 #endif 12004 #ifdef CONFIG_PM 12005 #endif 12006 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 12007 #ifdef CONFIG_IPW2100_DEBUG 12008 #endif 12009 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 12010 #endif 12011 #ifdef IPW2100_TX_POWER 12012 #endif 12013 #if 0 12014 #endif 12015 #ifdef CONFIG_IPW2100_DEBUG 12016 #endif 12017 #define IPW_PRIVACY_CAPABLE 0x0008 12018 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 12019 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 12020 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 12021 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 12022 #ifdef CONFIG_IPW2100_MONITOR 12023 #endif 12024 /* LDV_COMMENT_END_PREP */ 12025 /* LDV_COMMENT_FUNCTION_CALL Function from field "ndo_tx_timeout" from driver structure with callbacks "ipw2100_netdev_ops" */ 12026 ldv_handler_precall(); 12027 ipw2100_tx_timeout( var_group1); 12028 /* LDV_COMMENT_BEGIN_PREP */ 12029 #ifdef CONFIG_IPW2100_MONITOR 12030 #endif 12031 #ifdef CONFIG_IPW2100_MONITOR 12032 #endif 12033 #ifdef CONFIG_PM 12034 #endif 12035 #ifdef CONFIG_PM 12036 #endif 12037 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 12038 #ifdef CONFIG_PM 12039 #endif 12040 #ifdef CONFIG_IPW2100_DEBUG 12041 #endif 12042 #ifdef CONFIG_IPW2100_DEBUG 12043 #endif 12044 #ifdef CONFIG_IPW2100_MONITOR 12045 #endif 12046 #define POWER_MODES 5 12047 #ifdef CONFIG_IPW2100_MONITOR 12048 #endif 12049 #define MAX_POWER_STRING 80 12050 #ifdef CONFIG_IPW2100_MONITOR 12051 #endif 12052 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 12053 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 12054 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 12055 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 12056 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 12057 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 12058 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 12059 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 12060 #ifdef CONFIG_IPW2100_MONITOR 12061 #endif 12062 #ifdef CONFIG_IPW2100_MONITOR 12063 #endif 12064 #ifdef CONFIG_IPW2100_MONITOR 12065 #else 12066 #endif 12067 #ifdef CONFIG_IPW2100_MONITOR 12068 #else 12069 #endif 12070 #ifdef CONFIG_IPW2100_DEBUG 12071 #endif 12072 #define IPW2100_FW_MAJOR_VERSION 1 12073 #define IPW2100_FW_MINOR_VERSION 3 12074 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 12075 #define IPW2100_FW_MAJOR(x) (x & 0xff) 12076 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 12077 IPW2100_FW_MAJOR_VERSION) 12078 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 12079 "." __stringify(IPW2100_FW_MINOR_VERSION) 12080 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 12081 #ifdef CONFIG_IPW2100_MONITOR 12082 #endif 12083 #ifdef CONFIG_IPW2100_MONITOR 12084 #endif 12085 /* LDV_COMMENT_END_PREP */ 12086 12087 12088 12089 12090 } 12091 12092 break; 12093 case 5: { 12094 12095 /** STRUCT: struct type: net_device_ops, struct name: ipw2100_netdev_ops **/ 12096 12097 12098 /* content: static int ipw2100_set_address(struct net_device *dev, void *p)*/ 12099 /* LDV_COMMENT_BEGIN_PREP */ 12100 #define IPW2100_VERSION "git-1.2.2" 12101 #define DRV_NAME "ipw2100" 12102 #define DRV_VERSION IPW2100_VERSION 12103 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 12104 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 12105 #ifdef CONFIG_IPW2100_DEBUG 12106 #define IPW2100_RX_DEBUG 12107 #endif 12108 #ifdef CONFIG_PM 12109 #endif 12110 #ifdef CONFIG_IPW2100_DEBUG 12111 #define IPW_DEBUG(level, message...) \ 12112 do { \ 12113 if (ipw2100_debug_level & (level)) { \ 12114 printk(KERN_DEBUG "ipw2100: %c %s ", \ 12115 in_interrupt() ? 'I' : 'U', __func__); \ 12116 printk(message); \ 12117 } \ 12118 } while (0) 12119 #else 12120 #define IPW_DEBUG(level, message...) do {} while (0) 12121 #endif 12122 #ifdef CONFIG_IPW2100_DEBUG 12123 #endif 12124 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 12125 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 12126 #define MAX_RESET_BACKOFF 10 12127 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 12128 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 12129 #ifndef CONFIG_PM 12130 #endif 12131 #ifdef CONFIG_PM 12132 #else 12133 #endif 12134 #ifndef CONFIG_PM 12135 #endif 12136 #define MAX_RF_KILL_CHECKS 5 12137 #define RF_KILL_CHECK_DELAY 40 12138 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 12139 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 12140 #define MAC_ASSOCIATION_READ_DELAY (HZ) 12141 #ifdef CONFIG_IPW2100_DEBUG 12142 #define IPW2100_HANDLER(v, f) { v, f, # v } 12143 #else 12144 #define IPW2100_HANDLER(v, f) { v, f } 12145 #endif 12146 #ifdef CONFIG_IPW2100_DEBUG 12147 #endif 12148 #ifdef CONFIG_IPW2100_DEBUG 12149 #endif 12150 #define SEARCH_ERROR 0xffffffff 12151 #define SEARCH_FAIL 0xfffffffe 12152 #define SEARCH_SUCCESS 0xfffffff0 12153 #define SEARCH_DISCARD 0 12154 #define SEARCH_SNAPSHOT 1 12155 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 12156 #ifdef IPW2100_DEBUG_C3 12157 #endif 12158 #ifdef IPW2100_RX_DEBUG 12159 #endif 12160 #ifdef IPW2100_DEBUG_C3 12161 #endif 12162 #ifdef IPW2100_DEBUG_C3 12163 #endif 12164 #ifdef IPW2100_RX_DEBUG 12165 #endif 12166 #ifdef IPW2100_RX_DEBUG 12167 #endif 12168 #ifdef CONFIG_IPW2100_MONITOR 12169 #endif 12170 #ifdef CONFIG_IPW2100_MONITOR 12171 #else 12172 #endif 12173 #ifdef CONFIG_IPW2100_MONITOR 12174 #endif 12175 #ifdef CONFIG_IPW2100_DEBUG 12176 #endif 12177 #ifdef CONFIG_IPW2100_DEBUG 12178 #endif 12179 #ifdef CONFIG_IPW2100_DEBUG 12180 #endif 12181 #define IPW2100_REG(x) { IPW_ ##x, #x } 12182 #define IPW2100_NIC(x, s) { x, #x, s } 12183 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 12184 #ifdef CONFIG_IPW2100_DEBUG 12185 #endif 12186 #ifdef CONFIG_IPW2100_MONITOR 12187 #endif 12188 #ifdef CONFIG_PM 12189 #endif 12190 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 12191 #ifdef CONFIG_IPW2100_DEBUG 12192 #endif 12193 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 12194 #endif 12195 #ifdef IPW2100_TX_POWER 12196 #endif 12197 #if 0 12198 #endif 12199 #ifdef CONFIG_IPW2100_DEBUG 12200 #endif 12201 #define IPW_PRIVACY_CAPABLE 0x0008 12202 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 12203 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 12204 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 12205 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 12206 #ifdef CONFIG_IPW2100_MONITOR 12207 #endif 12208 /* LDV_COMMENT_END_PREP */ 12209 /* LDV_COMMENT_FUNCTION_CALL Function from field "ndo_set_mac_address" from driver structure with callbacks "ipw2100_netdev_ops" */ 12210 ldv_handler_precall(); 12211 ipw2100_set_address( var_group1, var_ipw2100_set_address_135_p1); 12212 /* LDV_COMMENT_BEGIN_PREP */ 12213 #ifdef CONFIG_IPW2100_MONITOR 12214 #endif 12215 #ifdef CONFIG_IPW2100_MONITOR 12216 #endif 12217 #ifdef CONFIG_IPW2100_MONITOR 12218 #endif 12219 #ifdef CONFIG_PM 12220 #endif 12221 #ifdef CONFIG_PM 12222 #endif 12223 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 12224 #ifdef CONFIG_PM 12225 #endif 12226 #ifdef CONFIG_IPW2100_DEBUG 12227 #endif 12228 #ifdef CONFIG_IPW2100_DEBUG 12229 #endif 12230 #ifdef CONFIG_IPW2100_MONITOR 12231 #endif 12232 #define POWER_MODES 5 12233 #ifdef CONFIG_IPW2100_MONITOR 12234 #endif 12235 #define MAX_POWER_STRING 80 12236 #ifdef CONFIG_IPW2100_MONITOR 12237 #endif 12238 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 12239 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 12240 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 12241 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 12242 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 12243 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 12244 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 12245 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 12246 #ifdef CONFIG_IPW2100_MONITOR 12247 #endif 12248 #ifdef CONFIG_IPW2100_MONITOR 12249 #endif 12250 #ifdef CONFIG_IPW2100_MONITOR 12251 #else 12252 #endif 12253 #ifdef CONFIG_IPW2100_MONITOR 12254 #else 12255 #endif 12256 #ifdef CONFIG_IPW2100_DEBUG 12257 #endif 12258 #define IPW2100_FW_MAJOR_VERSION 1 12259 #define IPW2100_FW_MINOR_VERSION 3 12260 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 12261 #define IPW2100_FW_MAJOR(x) (x & 0xff) 12262 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 12263 IPW2100_FW_MAJOR_VERSION) 12264 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 12265 "." __stringify(IPW2100_FW_MINOR_VERSION) 12266 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 12267 #ifdef CONFIG_IPW2100_MONITOR 12268 #endif 12269 #ifdef CONFIG_IPW2100_MONITOR 12270 #endif 12271 /* LDV_COMMENT_END_PREP */ 12272 12273 12274 12275 12276 } 12277 12278 break; 12279 case 6: { 12280 12281 /** STRUCT: struct type: pci_driver, struct name: ipw2100_pci_driver **/ 12282 if(ldv_s_ipw2100_pci_driver_pci_driver==0) { 12283 12284 /* content: static int ipw2100_pci_init_one(struct pci_dev *pci_dev, const struct pci_device_id *ent)*/ 12285 /* LDV_COMMENT_BEGIN_PREP */ 12286 #define IPW2100_VERSION "git-1.2.2" 12287 #define DRV_NAME "ipw2100" 12288 #define DRV_VERSION IPW2100_VERSION 12289 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 12290 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 12291 #ifdef CONFIG_IPW2100_DEBUG 12292 #define IPW2100_RX_DEBUG 12293 #endif 12294 #ifdef CONFIG_PM 12295 #endif 12296 #ifdef CONFIG_IPW2100_DEBUG 12297 #define IPW_DEBUG(level, message...) \ 12298 do { \ 12299 if (ipw2100_debug_level & (level)) { \ 12300 printk(KERN_DEBUG "ipw2100: %c %s ", \ 12301 in_interrupt() ? 'I' : 'U', __func__); \ 12302 printk(message); \ 12303 } \ 12304 } while (0) 12305 #else 12306 #define IPW_DEBUG(level, message...) do {} while (0) 12307 #endif 12308 #ifdef CONFIG_IPW2100_DEBUG 12309 #endif 12310 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 12311 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 12312 #define MAX_RESET_BACKOFF 10 12313 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 12314 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 12315 #ifndef CONFIG_PM 12316 #endif 12317 #ifdef CONFIG_PM 12318 #else 12319 #endif 12320 #ifndef CONFIG_PM 12321 #endif 12322 #define MAX_RF_KILL_CHECKS 5 12323 #define RF_KILL_CHECK_DELAY 40 12324 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 12325 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 12326 #define MAC_ASSOCIATION_READ_DELAY (HZ) 12327 #ifdef CONFIG_IPW2100_DEBUG 12328 #define IPW2100_HANDLER(v, f) { v, f, # v } 12329 #else 12330 #define IPW2100_HANDLER(v, f) { v, f } 12331 #endif 12332 #ifdef CONFIG_IPW2100_DEBUG 12333 #endif 12334 #ifdef CONFIG_IPW2100_DEBUG 12335 #endif 12336 #define SEARCH_ERROR 0xffffffff 12337 #define SEARCH_FAIL 0xfffffffe 12338 #define SEARCH_SUCCESS 0xfffffff0 12339 #define SEARCH_DISCARD 0 12340 #define SEARCH_SNAPSHOT 1 12341 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 12342 #ifdef IPW2100_DEBUG_C3 12343 #endif 12344 #ifdef IPW2100_RX_DEBUG 12345 #endif 12346 #ifdef IPW2100_DEBUG_C3 12347 #endif 12348 #ifdef IPW2100_DEBUG_C3 12349 #endif 12350 #ifdef IPW2100_RX_DEBUG 12351 #endif 12352 #ifdef IPW2100_RX_DEBUG 12353 #endif 12354 #ifdef CONFIG_IPW2100_MONITOR 12355 #endif 12356 #ifdef CONFIG_IPW2100_MONITOR 12357 #else 12358 #endif 12359 #ifdef CONFIG_IPW2100_MONITOR 12360 #endif 12361 #ifdef CONFIG_IPW2100_DEBUG 12362 #endif 12363 #ifdef CONFIG_IPW2100_DEBUG 12364 #endif 12365 #ifdef CONFIG_IPW2100_DEBUG 12366 #endif 12367 #define IPW2100_REG(x) { IPW_ ##x, #x } 12368 #define IPW2100_NIC(x, s) { x, #x, s } 12369 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 12370 #ifdef CONFIG_IPW2100_DEBUG 12371 #endif 12372 #ifdef CONFIG_IPW2100_MONITOR 12373 #endif 12374 #ifdef CONFIG_PM 12375 #endif 12376 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 12377 #ifdef CONFIG_IPW2100_DEBUG 12378 #endif 12379 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 12380 #endif 12381 #ifdef IPW2100_TX_POWER 12382 #endif 12383 #if 0 12384 #endif 12385 #ifdef CONFIG_IPW2100_DEBUG 12386 #endif 12387 #define IPW_PRIVACY_CAPABLE 0x0008 12388 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 12389 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 12390 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 12391 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 12392 #ifdef CONFIG_IPW2100_MONITOR 12393 #endif 12394 #ifdef CONFIG_IPW2100_MONITOR 12395 #endif 12396 #ifdef CONFIG_IPW2100_MONITOR 12397 #endif 12398 #ifdef CONFIG_IPW2100_MONITOR 12399 #endif 12400 /* LDV_COMMENT_END_PREP */ 12401 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "ipw2100_pci_driver". Standart function test for correct return result. */ 12402 res_ipw2100_pci_init_one_147 = ipw2100_pci_init_one( var_group3, var_ipw2100_pci_init_one_147_p1); 12403 ldv_check_return_value(res_ipw2100_pci_init_one_147); 12404 ldv_check_return_value_probe(res_ipw2100_pci_init_one_147); 12405 if(res_ipw2100_pci_init_one_147) 12406 goto ldv_module_exit; 12407 /* LDV_COMMENT_BEGIN_PREP */ 12408 #ifdef CONFIG_PM 12409 #endif 12410 #ifdef CONFIG_PM 12411 #endif 12412 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 12413 #ifdef CONFIG_PM 12414 #endif 12415 #ifdef CONFIG_IPW2100_DEBUG 12416 #endif 12417 #ifdef CONFIG_IPW2100_DEBUG 12418 #endif 12419 #ifdef CONFIG_IPW2100_MONITOR 12420 #endif 12421 #define POWER_MODES 5 12422 #ifdef CONFIG_IPW2100_MONITOR 12423 #endif 12424 #define MAX_POWER_STRING 80 12425 #ifdef CONFIG_IPW2100_MONITOR 12426 #endif 12427 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 12428 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 12429 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 12430 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 12431 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 12432 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 12433 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 12434 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 12435 #ifdef CONFIG_IPW2100_MONITOR 12436 #endif 12437 #ifdef CONFIG_IPW2100_MONITOR 12438 #endif 12439 #ifdef CONFIG_IPW2100_MONITOR 12440 #else 12441 #endif 12442 #ifdef CONFIG_IPW2100_MONITOR 12443 #else 12444 #endif 12445 #ifdef CONFIG_IPW2100_DEBUG 12446 #endif 12447 #define IPW2100_FW_MAJOR_VERSION 1 12448 #define IPW2100_FW_MINOR_VERSION 3 12449 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 12450 #define IPW2100_FW_MAJOR(x) (x & 0xff) 12451 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 12452 IPW2100_FW_MAJOR_VERSION) 12453 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 12454 "." __stringify(IPW2100_FW_MINOR_VERSION) 12455 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 12456 #ifdef CONFIG_IPW2100_MONITOR 12457 #endif 12458 #ifdef CONFIG_IPW2100_MONITOR 12459 #endif 12460 /* LDV_COMMENT_END_PREP */ 12461 ldv_s_ipw2100_pci_driver_pci_driver++; 12462 12463 } 12464 12465 } 12466 12467 break; 12468 case 7: { 12469 12470 /** STRUCT: struct type: pci_driver, struct name: ipw2100_pci_driver **/ 12471 if(ldv_s_ipw2100_pci_driver_pci_driver==1) { 12472 12473 /* content: static void ipw2100_pci_remove_one(struct pci_dev *pci_dev)*/ 12474 /* LDV_COMMENT_BEGIN_PREP */ 12475 #define IPW2100_VERSION "git-1.2.2" 12476 #define DRV_NAME "ipw2100" 12477 #define DRV_VERSION IPW2100_VERSION 12478 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 12479 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 12480 #ifdef CONFIG_IPW2100_DEBUG 12481 #define IPW2100_RX_DEBUG 12482 #endif 12483 #ifdef CONFIG_PM 12484 #endif 12485 #ifdef CONFIG_IPW2100_DEBUG 12486 #define IPW_DEBUG(level, message...) \ 12487 do { \ 12488 if (ipw2100_debug_level & (level)) { \ 12489 printk(KERN_DEBUG "ipw2100: %c %s ", \ 12490 in_interrupt() ? 'I' : 'U', __func__); \ 12491 printk(message); \ 12492 } \ 12493 } while (0) 12494 #else 12495 #define IPW_DEBUG(level, message...) do {} while (0) 12496 #endif 12497 #ifdef CONFIG_IPW2100_DEBUG 12498 #endif 12499 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 12500 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 12501 #define MAX_RESET_BACKOFF 10 12502 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 12503 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 12504 #ifndef CONFIG_PM 12505 #endif 12506 #ifdef CONFIG_PM 12507 #else 12508 #endif 12509 #ifndef CONFIG_PM 12510 #endif 12511 #define MAX_RF_KILL_CHECKS 5 12512 #define RF_KILL_CHECK_DELAY 40 12513 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 12514 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 12515 #define MAC_ASSOCIATION_READ_DELAY (HZ) 12516 #ifdef CONFIG_IPW2100_DEBUG 12517 #define IPW2100_HANDLER(v, f) { v, f, # v } 12518 #else 12519 #define IPW2100_HANDLER(v, f) { v, f } 12520 #endif 12521 #ifdef CONFIG_IPW2100_DEBUG 12522 #endif 12523 #ifdef CONFIG_IPW2100_DEBUG 12524 #endif 12525 #define SEARCH_ERROR 0xffffffff 12526 #define SEARCH_FAIL 0xfffffffe 12527 #define SEARCH_SUCCESS 0xfffffff0 12528 #define SEARCH_DISCARD 0 12529 #define SEARCH_SNAPSHOT 1 12530 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 12531 #ifdef IPW2100_DEBUG_C3 12532 #endif 12533 #ifdef IPW2100_RX_DEBUG 12534 #endif 12535 #ifdef IPW2100_DEBUG_C3 12536 #endif 12537 #ifdef IPW2100_DEBUG_C3 12538 #endif 12539 #ifdef IPW2100_RX_DEBUG 12540 #endif 12541 #ifdef IPW2100_RX_DEBUG 12542 #endif 12543 #ifdef CONFIG_IPW2100_MONITOR 12544 #endif 12545 #ifdef CONFIG_IPW2100_MONITOR 12546 #else 12547 #endif 12548 #ifdef CONFIG_IPW2100_MONITOR 12549 #endif 12550 #ifdef CONFIG_IPW2100_DEBUG 12551 #endif 12552 #ifdef CONFIG_IPW2100_DEBUG 12553 #endif 12554 #ifdef CONFIG_IPW2100_DEBUG 12555 #endif 12556 #define IPW2100_REG(x) { IPW_ ##x, #x } 12557 #define IPW2100_NIC(x, s) { x, #x, s } 12558 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 12559 #ifdef CONFIG_IPW2100_DEBUG 12560 #endif 12561 #ifdef CONFIG_IPW2100_MONITOR 12562 #endif 12563 #ifdef CONFIG_PM 12564 #endif 12565 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 12566 #ifdef CONFIG_IPW2100_DEBUG 12567 #endif 12568 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 12569 #endif 12570 #ifdef IPW2100_TX_POWER 12571 #endif 12572 #if 0 12573 #endif 12574 #ifdef CONFIG_IPW2100_DEBUG 12575 #endif 12576 #define IPW_PRIVACY_CAPABLE 0x0008 12577 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 12578 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 12579 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 12580 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 12581 #ifdef CONFIG_IPW2100_MONITOR 12582 #endif 12583 #ifdef CONFIG_IPW2100_MONITOR 12584 #endif 12585 #ifdef CONFIG_IPW2100_MONITOR 12586 #endif 12587 #ifdef CONFIG_IPW2100_MONITOR 12588 #endif 12589 /* LDV_COMMENT_END_PREP */ 12590 /* LDV_COMMENT_FUNCTION_CALL Function from field "remove" from driver structure with callbacks "ipw2100_pci_driver" */ 12591 ldv_handler_precall(); 12592 ipw2100_pci_remove_one( var_group3); 12593 /* LDV_COMMENT_BEGIN_PREP */ 12594 #ifdef CONFIG_PM 12595 #endif 12596 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 12597 #ifdef CONFIG_PM 12598 #endif 12599 #ifdef CONFIG_IPW2100_DEBUG 12600 #endif 12601 #ifdef CONFIG_IPW2100_DEBUG 12602 #endif 12603 #ifdef CONFIG_IPW2100_MONITOR 12604 #endif 12605 #define POWER_MODES 5 12606 #ifdef CONFIG_IPW2100_MONITOR 12607 #endif 12608 #define MAX_POWER_STRING 80 12609 #ifdef CONFIG_IPW2100_MONITOR 12610 #endif 12611 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 12612 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 12613 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 12614 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 12615 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 12616 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 12617 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 12618 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 12619 #ifdef CONFIG_IPW2100_MONITOR 12620 #endif 12621 #ifdef CONFIG_IPW2100_MONITOR 12622 #endif 12623 #ifdef CONFIG_IPW2100_MONITOR 12624 #else 12625 #endif 12626 #ifdef CONFIG_IPW2100_MONITOR 12627 #else 12628 #endif 12629 #ifdef CONFIG_IPW2100_DEBUG 12630 #endif 12631 #define IPW2100_FW_MAJOR_VERSION 1 12632 #define IPW2100_FW_MINOR_VERSION 3 12633 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 12634 #define IPW2100_FW_MAJOR(x) (x & 0xff) 12635 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 12636 IPW2100_FW_MAJOR_VERSION) 12637 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 12638 "." __stringify(IPW2100_FW_MINOR_VERSION) 12639 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 12640 #ifdef CONFIG_IPW2100_MONITOR 12641 #endif 12642 #ifdef CONFIG_IPW2100_MONITOR 12643 #endif 12644 /* LDV_COMMENT_END_PREP */ 12645 ldv_s_ipw2100_pci_driver_pci_driver=0; 12646 12647 } 12648 12649 } 12650 12651 break; 12652 case 8: { 12653 12654 /** STRUCT: struct type: pci_driver, struct name: ipw2100_pci_driver **/ 12655 12656 12657 /* content: static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state)*/ 12658 /* LDV_COMMENT_BEGIN_PREP */ 12659 #define IPW2100_VERSION "git-1.2.2" 12660 #define DRV_NAME "ipw2100" 12661 #define DRV_VERSION IPW2100_VERSION 12662 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 12663 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 12664 #ifdef CONFIG_IPW2100_DEBUG 12665 #define IPW2100_RX_DEBUG 12666 #endif 12667 #ifdef CONFIG_PM 12668 #endif 12669 #ifdef CONFIG_IPW2100_DEBUG 12670 #define IPW_DEBUG(level, message...) \ 12671 do { \ 12672 if (ipw2100_debug_level & (level)) { \ 12673 printk(KERN_DEBUG "ipw2100: %c %s ", \ 12674 in_interrupt() ? 'I' : 'U', __func__); \ 12675 printk(message); \ 12676 } \ 12677 } while (0) 12678 #else 12679 #define IPW_DEBUG(level, message...) do {} while (0) 12680 #endif 12681 #ifdef CONFIG_IPW2100_DEBUG 12682 #endif 12683 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 12684 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 12685 #define MAX_RESET_BACKOFF 10 12686 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 12687 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 12688 #ifndef CONFIG_PM 12689 #endif 12690 #ifdef CONFIG_PM 12691 #else 12692 #endif 12693 #ifndef CONFIG_PM 12694 #endif 12695 #define MAX_RF_KILL_CHECKS 5 12696 #define RF_KILL_CHECK_DELAY 40 12697 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 12698 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 12699 #define MAC_ASSOCIATION_READ_DELAY (HZ) 12700 #ifdef CONFIG_IPW2100_DEBUG 12701 #define IPW2100_HANDLER(v, f) { v, f, # v } 12702 #else 12703 #define IPW2100_HANDLER(v, f) { v, f } 12704 #endif 12705 #ifdef CONFIG_IPW2100_DEBUG 12706 #endif 12707 #ifdef CONFIG_IPW2100_DEBUG 12708 #endif 12709 #define SEARCH_ERROR 0xffffffff 12710 #define SEARCH_FAIL 0xfffffffe 12711 #define SEARCH_SUCCESS 0xfffffff0 12712 #define SEARCH_DISCARD 0 12713 #define SEARCH_SNAPSHOT 1 12714 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 12715 #ifdef IPW2100_DEBUG_C3 12716 #endif 12717 #ifdef IPW2100_RX_DEBUG 12718 #endif 12719 #ifdef IPW2100_DEBUG_C3 12720 #endif 12721 #ifdef IPW2100_DEBUG_C3 12722 #endif 12723 #ifdef IPW2100_RX_DEBUG 12724 #endif 12725 #ifdef IPW2100_RX_DEBUG 12726 #endif 12727 #ifdef CONFIG_IPW2100_MONITOR 12728 #endif 12729 #ifdef CONFIG_IPW2100_MONITOR 12730 #else 12731 #endif 12732 #ifdef CONFIG_IPW2100_MONITOR 12733 #endif 12734 #ifdef CONFIG_IPW2100_DEBUG 12735 #endif 12736 #ifdef CONFIG_IPW2100_DEBUG 12737 #endif 12738 #ifdef CONFIG_IPW2100_DEBUG 12739 #endif 12740 #define IPW2100_REG(x) { IPW_ ##x, #x } 12741 #define IPW2100_NIC(x, s) { x, #x, s } 12742 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 12743 #ifdef CONFIG_IPW2100_DEBUG 12744 #endif 12745 #ifdef CONFIG_IPW2100_MONITOR 12746 #endif 12747 #ifdef CONFIG_PM 12748 #endif 12749 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 12750 #ifdef CONFIG_IPW2100_DEBUG 12751 #endif 12752 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 12753 #endif 12754 #ifdef IPW2100_TX_POWER 12755 #endif 12756 #if 0 12757 #endif 12758 #ifdef CONFIG_IPW2100_DEBUG 12759 #endif 12760 #define IPW_PRIVACY_CAPABLE 0x0008 12761 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 12762 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 12763 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 12764 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 12765 #ifdef CONFIG_IPW2100_MONITOR 12766 #endif 12767 #ifdef CONFIG_IPW2100_MONITOR 12768 #endif 12769 #ifdef CONFIG_IPW2100_MONITOR 12770 #endif 12771 #ifdef CONFIG_IPW2100_MONITOR 12772 #endif 12773 #ifdef CONFIG_PM 12774 #endif 12775 #ifdef CONFIG_PM 12776 /* LDV_COMMENT_END_PREP */ 12777 /* LDV_COMMENT_FUNCTION_CALL Function from field "suspend" from driver structure with callbacks "ipw2100_pci_driver" */ 12778 ldv_handler_precall(); 12779 ipw2100_suspend( var_group3, var_ipw2100_suspend_149_p1); 12780 /* LDV_COMMENT_BEGIN_PREP */ 12781 #endif 12782 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 12783 #ifdef CONFIG_PM 12784 #endif 12785 #ifdef CONFIG_IPW2100_DEBUG 12786 #endif 12787 #ifdef CONFIG_IPW2100_DEBUG 12788 #endif 12789 #ifdef CONFIG_IPW2100_MONITOR 12790 #endif 12791 #define POWER_MODES 5 12792 #ifdef CONFIG_IPW2100_MONITOR 12793 #endif 12794 #define MAX_POWER_STRING 80 12795 #ifdef CONFIG_IPW2100_MONITOR 12796 #endif 12797 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 12798 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 12799 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 12800 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 12801 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 12802 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 12803 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 12804 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 12805 #ifdef CONFIG_IPW2100_MONITOR 12806 #endif 12807 #ifdef CONFIG_IPW2100_MONITOR 12808 #endif 12809 #ifdef CONFIG_IPW2100_MONITOR 12810 #else 12811 #endif 12812 #ifdef CONFIG_IPW2100_MONITOR 12813 #else 12814 #endif 12815 #ifdef CONFIG_IPW2100_DEBUG 12816 #endif 12817 #define IPW2100_FW_MAJOR_VERSION 1 12818 #define IPW2100_FW_MINOR_VERSION 3 12819 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 12820 #define IPW2100_FW_MAJOR(x) (x & 0xff) 12821 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 12822 IPW2100_FW_MAJOR_VERSION) 12823 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 12824 "." __stringify(IPW2100_FW_MINOR_VERSION) 12825 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 12826 #ifdef CONFIG_IPW2100_MONITOR 12827 #endif 12828 #ifdef CONFIG_IPW2100_MONITOR 12829 #endif 12830 /* LDV_COMMENT_END_PREP */ 12831 12832 12833 12834 12835 } 12836 12837 break; 12838 case 9: { 12839 12840 /** STRUCT: struct type: pci_driver, struct name: ipw2100_pci_driver **/ 12841 12842 12843 /* content: static int ipw2100_resume(struct pci_dev *pci_dev)*/ 12844 /* LDV_COMMENT_BEGIN_PREP */ 12845 #define IPW2100_VERSION "git-1.2.2" 12846 #define DRV_NAME "ipw2100" 12847 #define DRV_VERSION IPW2100_VERSION 12848 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 12849 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 12850 #ifdef CONFIG_IPW2100_DEBUG 12851 #define IPW2100_RX_DEBUG 12852 #endif 12853 #ifdef CONFIG_PM 12854 #endif 12855 #ifdef CONFIG_IPW2100_DEBUG 12856 #define IPW_DEBUG(level, message...) \ 12857 do { \ 12858 if (ipw2100_debug_level & (level)) { \ 12859 printk(KERN_DEBUG "ipw2100: %c %s ", \ 12860 in_interrupt() ? 'I' : 'U', __func__); \ 12861 printk(message); \ 12862 } \ 12863 } while (0) 12864 #else 12865 #define IPW_DEBUG(level, message...) do {} while (0) 12866 #endif 12867 #ifdef CONFIG_IPW2100_DEBUG 12868 #endif 12869 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 12870 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 12871 #define MAX_RESET_BACKOFF 10 12872 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 12873 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 12874 #ifndef CONFIG_PM 12875 #endif 12876 #ifdef CONFIG_PM 12877 #else 12878 #endif 12879 #ifndef CONFIG_PM 12880 #endif 12881 #define MAX_RF_KILL_CHECKS 5 12882 #define RF_KILL_CHECK_DELAY 40 12883 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 12884 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 12885 #define MAC_ASSOCIATION_READ_DELAY (HZ) 12886 #ifdef CONFIG_IPW2100_DEBUG 12887 #define IPW2100_HANDLER(v, f) { v, f, # v } 12888 #else 12889 #define IPW2100_HANDLER(v, f) { v, f } 12890 #endif 12891 #ifdef CONFIG_IPW2100_DEBUG 12892 #endif 12893 #ifdef CONFIG_IPW2100_DEBUG 12894 #endif 12895 #define SEARCH_ERROR 0xffffffff 12896 #define SEARCH_FAIL 0xfffffffe 12897 #define SEARCH_SUCCESS 0xfffffff0 12898 #define SEARCH_DISCARD 0 12899 #define SEARCH_SNAPSHOT 1 12900 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 12901 #ifdef IPW2100_DEBUG_C3 12902 #endif 12903 #ifdef IPW2100_RX_DEBUG 12904 #endif 12905 #ifdef IPW2100_DEBUG_C3 12906 #endif 12907 #ifdef IPW2100_DEBUG_C3 12908 #endif 12909 #ifdef IPW2100_RX_DEBUG 12910 #endif 12911 #ifdef IPW2100_RX_DEBUG 12912 #endif 12913 #ifdef CONFIG_IPW2100_MONITOR 12914 #endif 12915 #ifdef CONFIG_IPW2100_MONITOR 12916 #else 12917 #endif 12918 #ifdef CONFIG_IPW2100_MONITOR 12919 #endif 12920 #ifdef CONFIG_IPW2100_DEBUG 12921 #endif 12922 #ifdef CONFIG_IPW2100_DEBUG 12923 #endif 12924 #ifdef CONFIG_IPW2100_DEBUG 12925 #endif 12926 #define IPW2100_REG(x) { IPW_ ##x, #x } 12927 #define IPW2100_NIC(x, s) { x, #x, s } 12928 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 12929 #ifdef CONFIG_IPW2100_DEBUG 12930 #endif 12931 #ifdef CONFIG_IPW2100_MONITOR 12932 #endif 12933 #ifdef CONFIG_PM 12934 #endif 12935 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 12936 #ifdef CONFIG_IPW2100_DEBUG 12937 #endif 12938 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 12939 #endif 12940 #ifdef IPW2100_TX_POWER 12941 #endif 12942 #if 0 12943 #endif 12944 #ifdef CONFIG_IPW2100_DEBUG 12945 #endif 12946 #define IPW_PRIVACY_CAPABLE 0x0008 12947 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 12948 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 12949 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 12950 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 12951 #ifdef CONFIG_IPW2100_MONITOR 12952 #endif 12953 #ifdef CONFIG_IPW2100_MONITOR 12954 #endif 12955 #ifdef CONFIG_IPW2100_MONITOR 12956 #endif 12957 #ifdef CONFIG_IPW2100_MONITOR 12958 #endif 12959 #ifdef CONFIG_PM 12960 #endif 12961 #ifdef CONFIG_PM 12962 /* LDV_COMMENT_END_PREP */ 12963 /* LDV_COMMENT_FUNCTION_CALL Function from field "resume" from driver structure with callbacks "ipw2100_pci_driver" */ 12964 ldv_handler_precall(); 12965 ipw2100_resume( var_group3); 12966 /* LDV_COMMENT_BEGIN_PREP */ 12967 #endif 12968 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 12969 #ifdef CONFIG_PM 12970 #endif 12971 #ifdef CONFIG_IPW2100_DEBUG 12972 #endif 12973 #ifdef CONFIG_IPW2100_DEBUG 12974 #endif 12975 #ifdef CONFIG_IPW2100_MONITOR 12976 #endif 12977 #define POWER_MODES 5 12978 #ifdef CONFIG_IPW2100_MONITOR 12979 #endif 12980 #define MAX_POWER_STRING 80 12981 #ifdef CONFIG_IPW2100_MONITOR 12982 #endif 12983 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 12984 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 12985 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 12986 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 12987 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 12988 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 12989 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 12990 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 12991 #ifdef CONFIG_IPW2100_MONITOR 12992 #endif 12993 #ifdef CONFIG_IPW2100_MONITOR 12994 #endif 12995 #ifdef CONFIG_IPW2100_MONITOR 12996 #else 12997 #endif 12998 #ifdef CONFIG_IPW2100_MONITOR 12999 #else 13000 #endif 13001 #ifdef CONFIG_IPW2100_DEBUG 13002 #endif 13003 #define IPW2100_FW_MAJOR_VERSION 1 13004 #define IPW2100_FW_MINOR_VERSION 3 13005 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 13006 #define IPW2100_FW_MAJOR(x) (x & 0xff) 13007 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 13008 IPW2100_FW_MAJOR_VERSION) 13009 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 13010 "." __stringify(IPW2100_FW_MINOR_VERSION) 13011 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 13012 #ifdef CONFIG_IPW2100_MONITOR 13013 #endif 13014 #ifdef CONFIG_IPW2100_MONITOR 13015 #endif 13016 /* LDV_COMMENT_END_PREP */ 13017 13018 13019 13020 13021 } 13022 13023 break; 13024 case 10: { 13025 13026 /** STRUCT: struct type: pci_driver, struct name: ipw2100_pci_driver **/ 13027 13028 13029 /* content: static void ipw2100_shutdown(struct pci_dev *pci_dev)*/ 13030 /* LDV_COMMENT_BEGIN_PREP */ 13031 #define IPW2100_VERSION "git-1.2.2" 13032 #define DRV_NAME "ipw2100" 13033 #define DRV_VERSION IPW2100_VERSION 13034 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 13035 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 13036 #ifdef CONFIG_IPW2100_DEBUG 13037 #define IPW2100_RX_DEBUG 13038 #endif 13039 #ifdef CONFIG_PM 13040 #endif 13041 #ifdef CONFIG_IPW2100_DEBUG 13042 #define IPW_DEBUG(level, message...) \ 13043 do { \ 13044 if (ipw2100_debug_level & (level)) { \ 13045 printk(KERN_DEBUG "ipw2100: %c %s ", \ 13046 in_interrupt() ? 'I' : 'U', __func__); \ 13047 printk(message); \ 13048 } \ 13049 } while (0) 13050 #else 13051 #define IPW_DEBUG(level, message...) do {} while (0) 13052 #endif 13053 #ifdef CONFIG_IPW2100_DEBUG 13054 #endif 13055 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 13056 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 13057 #define MAX_RESET_BACKOFF 10 13058 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 13059 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 13060 #ifndef CONFIG_PM 13061 #endif 13062 #ifdef CONFIG_PM 13063 #else 13064 #endif 13065 #ifndef CONFIG_PM 13066 #endif 13067 #define MAX_RF_KILL_CHECKS 5 13068 #define RF_KILL_CHECK_DELAY 40 13069 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 13070 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 13071 #define MAC_ASSOCIATION_READ_DELAY (HZ) 13072 #ifdef CONFIG_IPW2100_DEBUG 13073 #define IPW2100_HANDLER(v, f) { v, f, # v } 13074 #else 13075 #define IPW2100_HANDLER(v, f) { v, f } 13076 #endif 13077 #ifdef CONFIG_IPW2100_DEBUG 13078 #endif 13079 #ifdef CONFIG_IPW2100_DEBUG 13080 #endif 13081 #define SEARCH_ERROR 0xffffffff 13082 #define SEARCH_FAIL 0xfffffffe 13083 #define SEARCH_SUCCESS 0xfffffff0 13084 #define SEARCH_DISCARD 0 13085 #define SEARCH_SNAPSHOT 1 13086 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 13087 #ifdef IPW2100_DEBUG_C3 13088 #endif 13089 #ifdef IPW2100_RX_DEBUG 13090 #endif 13091 #ifdef IPW2100_DEBUG_C3 13092 #endif 13093 #ifdef IPW2100_DEBUG_C3 13094 #endif 13095 #ifdef IPW2100_RX_DEBUG 13096 #endif 13097 #ifdef IPW2100_RX_DEBUG 13098 #endif 13099 #ifdef CONFIG_IPW2100_MONITOR 13100 #endif 13101 #ifdef CONFIG_IPW2100_MONITOR 13102 #else 13103 #endif 13104 #ifdef CONFIG_IPW2100_MONITOR 13105 #endif 13106 #ifdef CONFIG_IPW2100_DEBUG 13107 #endif 13108 #ifdef CONFIG_IPW2100_DEBUG 13109 #endif 13110 #ifdef CONFIG_IPW2100_DEBUG 13111 #endif 13112 #define IPW2100_REG(x) { IPW_ ##x, #x } 13113 #define IPW2100_NIC(x, s) { x, #x, s } 13114 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 13115 #ifdef CONFIG_IPW2100_DEBUG 13116 #endif 13117 #ifdef CONFIG_IPW2100_MONITOR 13118 #endif 13119 #ifdef CONFIG_PM 13120 #endif 13121 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 13122 #ifdef CONFIG_IPW2100_DEBUG 13123 #endif 13124 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 13125 #endif 13126 #ifdef IPW2100_TX_POWER 13127 #endif 13128 #if 0 13129 #endif 13130 #ifdef CONFIG_IPW2100_DEBUG 13131 #endif 13132 #define IPW_PRIVACY_CAPABLE 0x0008 13133 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 13134 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 13135 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 13136 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 13137 #ifdef CONFIG_IPW2100_MONITOR 13138 #endif 13139 #ifdef CONFIG_IPW2100_MONITOR 13140 #endif 13141 #ifdef CONFIG_IPW2100_MONITOR 13142 #endif 13143 #ifdef CONFIG_IPW2100_MONITOR 13144 #endif 13145 #ifdef CONFIG_PM 13146 #endif 13147 #ifdef CONFIG_PM 13148 #endif 13149 /* LDV_COMMENT_END_PREP */ 13150 /* LDV_COMMENT_FUNCTION_CALL Function from field "shutdown" from driver structure with callbacks "ipw2100_pci_driver" */ 13151 ldv_handler_precall(); 13152 ipw2100_shutdown( var_group3); 13153 /* LDV_COMMENT_BEGIN_PREP */ 13154 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 13155 #ifdef CONFIG_PM 13156 #endif 13157 #ifdef CONFIG_IPW2100_DEBUG 13158 #endif 13159 #ifdef CONFIG_IPW2100_DEBUG 13160 #endif 13161 #ifdef CONFIG_IPW2100_MONITOR 13162 #endif 13163 #define POWER_MODES 5 13164 #ifdef CONFIG_IPW2100_MONITOR 13165 #endif 13166 #define MAX_POWER_STRING 80 13167 #ifdef CONFIG_IPW2100_MONITOR 13168 #endif 13169 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 13170 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 13171 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 13172 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 13173 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 13174 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 13175 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 13176 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 13177 #ifdef CONFIG_IPW2100_MONITOR 13178 #endif 13179 #ifdef CONFIG_IPW2100_MONITOR 13180 #endif 13181 #ifdef CONFIG_IPW2100_MONITOR 13182 #else 13183 #endif 13184 #ifdef CONFIG_IPW2100_MONITOR 13185 #else 13186 #endif 13187 #ifdef CONFIG_IPW2100_DEBUG 13188 #endif 13189 #define IPW2100_FW_MAJOR_VERSION 1 13190 #define IPW2100_FW_MINOR_VERSION 3 13191 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 13192 #define IPW2100_FW_MAJOR(x) (x & 0xff) 13193 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 13194 IPW2100_FW_MAJOR_VERSION) 13195 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 13196 "." __stringify(IPW2100_FW_MINOR_VERSION) 13197 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 13198 #ifdef CONFIG_IPW2100_MONITOR 13199 #endif 13200 #ifdef CONFIG_IPW2100_MONITOR 13201 #endif 13202 /* LDV_COMMENT_END_PREP */ 13203 13204 13205 13206 13207 } 13208 13209 break; 13210 case 11: { 13211 13212 /** STRUCT: struct type: iw_handler_def, struct name: ipw2100_wx_handler_def **/ 13213 13214 13215 /* content: static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev)*/ 13216 /* LDV_COMMENT_BEGIN_PREP */ 13217 #define IPW2100_VERSION "git-1.2.2" 13218 #define DRV_NAME "ipw2100" 13219 #define DRV_VERSION IPW2100_VERSION 13220 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 13221 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 13222 #ifdef CONFIG_IPW2100_DEBUG 13223 #define IPW2100_RX_DEBUG 13224 #endif 13225 #ifdef CONFIG_PM 13226 #endif 13227 #ifdef CONFIG_IPW2100_DEBUG 13228 #define IPW_DEBUG(level, message...) \ 13229 do { \ 13230 if (ipw2100_debug_level & (level)) { \ 13231 printk(KERN_DEBUG "ipw2100: %c %s ", \ 13232 in_interrupt() ? 'I' : 'U', __func__); \ 13233 printk(message); \ 13234 } \ 13235 } while (0) 13236 #else 13237 #define IPW_DEBUG(level, message...) do {} while (0) 13238 #endif 13239 #ifdef CONFIG_IPW2100_DEBUG 13240 #endif 13241 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 13242 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 13243 #define MAX_RESET_BACKOFF 10 13244 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 13245 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 13246 #ifndef CONFIG_PM 13247 #endif 13248 #ifdef CONFIG_PM 13249 #else 13250 #endif 13251 #ifndef CONFIG_PM 13252 #endif 13253 #define MAX_RF_KILL_CHECKS 5 13254 #define RF_KILL_CHECK_DELAY 40 13255 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 13256 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 13257 #define MAC_ASSOCIATION_READ_DELAY (HZ) 13258 #ifdef CONFIG_IPW2100_DEBUG 13259 #define IPW2100_HANDLER(v, f) { v, f, # v } 13260 #else 13261 #define IPW2100_HANDLER(v, f) { v, f } 13262 #endif 13263 #ifdef CONFIG_IPW2100_DEBUG 13264 #endif 13265 #ifdef CONFIG_IPW2100_DEBUG 13266 #endif 13267 #define SEARCH_ERROR 0xffffffff 13268 #define SEARCH_FAIL 0xfffffffe 13269 #define SEARCH_SUCCESS 0xfffffff0 13270 #define SEARCH_DISCARD 0 13271 #define SEARCH_SNAPSHOT 1 13272 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 13273 #ifdef IPW2100_DEBUG_C3 13274 #endif 13275 #ifdef IPW2100_RX_DEBUG 13276 #endif 13277 #ifdef IPW2100_DEBUG_C3 13278 #endif 13279 #ifdef IPW2100_DEBUG_C3 13280 #endif 13281 #ifdef IPW2100_RX_DEBUG 13282 #endif 13283 #ifdef IPW2100_RX_DEBUG 13284 #endif 13285 #ifdef CONFIG_IPW2100_MONITOR 13286 #endif 13287 #ifdef CONFIG_IPW2100_MONITOR 13288 #else 13289 #endif 13290 #ifdef CONFIG_IPW2100_MONITOR 13291 #endif 13292 #ifdef CONFIG_IPW2100_DEBUG 13293 #endif 13294 #ifdef CONFIG_IPW2100_DEBUG 13295 #endif 13296 #ifdef CONFIG_IPW2100_DEBUG 13297 #endif 13298 #define IPW2100_REG(x) { IPW_ ##x, #x } 13299 #define IPW2100_NIC(x, s) { x, #x, s } 13300 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 13301 #ifdef CONFIG_IPW2100_DEBUG 13302 #endif 13303 #ifdef CONFIG_IPW2100_MONITOR 13304 #endif 13305 #ifdef CONFIG_PM 13306 #endif 13307 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 13308 #ifdef CONFIG_IPW2100_DEBUG 13309 #endif 13310 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 13311 #endif 13312 #ifdef IPW2100_TX_POWER 13313 #endif 13314 #if 0 13315 #endif 13316 #ifdef CONFIG_IPW2100_DEBUG 13317 #endif 13318 #define IPW_PRIVACY_CAPABLE 0x0008 13319 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 13320 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 13321 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 13322 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 13323 #ifdef CONFIG_IPW2100_MONITOR 13324 #endif 13325 #ifdef CONFIG_IPW2100_MONITOR 13326 #endif 13327 #ifdef CONFIG_IPW2100_MONITOR 13328 #endif 13329 #ifdef CONFIG_IPW2100_MONITOR 13330 #endif 13331 #ifdef CONFIG_PM 13332 #endif 13333 #ifdef CONFIG_PM 13334 #endif 13335 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 13336 #ifdef CONFIG_PM 13337 #endif 13338 #ifdef CONFIG_IPW2100_DEBUG 13339 #endif 13340 #ifdef CONFIG_IPW2100_DEBUG 13341 #endif 13342 #ifdef CONFIG_IPW2100_MONITOR 13343 #endif 13344 #define POWER_MODES 5 13345 #ifdef CONFIG_IPW2100_MONITOR 13346 #endif 13347 #define MAX_POWER_STRING 80 13348 #ifdef CONFIG_IPW2100_MONITOR 13349 #endif 13350 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 13351 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 13352 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 13353 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 13354 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 13355 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 13356 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 13357 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 13358 #ifdef CONFIG_IPW2100_MONITOR 13359 #endif 13360 #ifdef CONFIG_IPW2100_MONITOR 13361 #endif 13362 #ifdef CONFIG_IPW2100_MONITOR 13363 #else 13364 #endif 13365 #ifdef CONFIG_IPW2100_MONITOR 13366 #else 13367 #endif 13368 /* LDV_COMMENT_END_PREP */ 13369 /* LDV_COMMENT_FUNCTION_CALL Function from field "get_wireless_stats" from driver structure with callbacks "ipw2100_wx_handler_def" */ 13370 ldv_handler_precall(); 13371 ipw2100_wx_wireless_stats( var_group1); 13372 /* LDV_COMMENT_BEGIN_PREP */ 13373 #define IPW2100_FW_MAJOR_VERSION 1 13374 #define IPW2100_FW_MINOR_VERSION 3 13375 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 13376 #define IPW2100_FW_MAJOR(x) (x & 0xff) 13377 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 13378 IPW2100_FW_MAJOR_VERSION) 13379 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 13380 "." __stringify(IPW2100_FW_MINOR_VERSION) 13381 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 13382 #ifdef CONFIG_IPW2100_MONITOR 13383 #endif 13384 #ifdef CONFIG_IPW2100_MONITOR 13385 #endif 13386 /* LDV_COMMENT_END_PREP */ 13387 13388 13389 13390 13391 } 13392 13393 break; 13394 case 12: { 13395 13396 /** CALLBACK SECTION request_irq **/ 13397 LDV_IN_INTERRUPT=2; 13398 13399 /* content: static irqreturn_t ipw2100_interrupt(int irq, void *data)*/ 13400 /* LDV_COMMENT_BEGIN_PREP */ 13401 #define IPW2100_VERSION "git-1.2.2" 13402 #define DRV_NAME "ipw2100" 13403 #define DRV_VERSION IPW2100_VERSION 13404 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 13405 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 13406 #ifdef CONFIG_IPW2100_DEBUG 13407 #define IPW2100_RX_DEBUG 13408 #endif 13409 #ifdef CONFIG_PM 13410 #endif 13411 #ifdef CONFIG_IPW2100_DEBUG 13412 #define IPW_DEBUG(level, message...) \ 13413 do { \ 13414 if (ipw2100_debug_level & (level)) { \ 13415 printk(KERN_DEBUG "ipw2100: %c %s ", \ 13416 in_interrupt() ? 'I' : 'U', __func__); \ 13417 printk(message); \ 13418 } \ 13419 } while (0) 13420 #else 13421 #define IPW_DEBUG(level, message...) do {} while (0) 13422 #endif 13423 #ifdef CONFIG_IPW2100_DEBUG 13424 #endif 13425 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 13426 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 13427 #define MAX_RESET_BACKOFF 10 13428 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 13429 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 13430 #ifndef CONFIG_PM 13431 #endif 13432 #ifdef CONFIG_PM 13433 #else 13434 #endif 13435 #ifndef CONFIG_PM 13436 #endif 13437 #define MAX_RF_KILL_CHECKS 5 13438 #define RF_KILL_CHECK_DELAY 40 13439 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 13440 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 13441 #define MAC_ASSOCIATION_READ_DELAY (HZ) 13442 #ifdef CONFIG_IPW2100_DEBUG 13443 #define IPW2100_HANDLER(v, f) { v, f, # v } 13444 #else 13445 #define IPW2100_HANDLER(v, f) { v, f } 13446 #endif 13447 #ifdef CONFIG_IPW2100_DEBUG 13448 #endif 13449 #ifdef CONFIG_IPW2100_DEBUG 13450 #endif 13451 #define SEARCH_ERROR 0xffffffff 13452 #define SEARCH_FAIL 0xfffffffe 13453 #define SEARCH_SUCCESS 0xfffffff0 13454 #define SEARCH_DISCARD 0 13455 #define SEARCH_SNAPSHOT 1 13456 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 13457 #ifdef IPW2100_DEBUG_C3 13458 #endif 13459 #ifdef IPW2100_RX_DEBUG 13460 #endif 13461 #ifdef IPW2100_DEBUG_C3 13462 #endif 13463 #ifdef IPW2100_DEBUG_C3 13464 #endif 13465 #ifdef IPW2100_RX_DEBUG 13466 #endif 13467 #ifdef IPW2100_RX_DEBUG 13468 #endif 13469 #ifdef CONFIG_IPW2100_MONITOR 13470 #endif 13471 #ifdef CONFIG_IPW2100_MONITOR 13472 #else 13473 #endif 13474 #ifdef CONFIG_IPW2100_MONITOR 13475 #endif 13476 #ifdef CONFIG_IPW2100_DEBUG 13477 #endif 13478 #ifdef CONFIG_IPW2100_DEBUG 13479 #endif 13480 #ifdef CONFIG_IPW2100_DEBUG 13481 #endif 13482 /* LDV_COMMENT_END_PREP */ 13483 /* LDV_COMMENT_FUNCTION_CALL */ 13484 ldv_handler_precall(); 13485 ipw2100_interrupt( var_ipw2100_interrupt_69_p0, var_ipw2100_interrupt_69_p1); 13486 /* LDV_COMMENT_BEGIN_PREP */ 13487 #define IPW2100_REG(x) { IPW_ ##x, #x } 13488 #define IPW2100_NIC(x, s) { x, #x, s } 13489 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 13490 #ifdef CONFIG_IPW2100_DEBUG 13491 #endif 13492 #ifdef CONFIG_IPW2100_MONITOR 13493 #endif 13494 #ifdef CONFIG_PM 13495 #endif 13496 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 13497 #ifdef CONFIG_IPW2100_DEBUG 13498 #endif 13499 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 13500 #endif 13501 #ifdef IPW2100_TX_POWER 13502 #endif 13503 #if 0 13504 #endif 13505 #ifdef CONFIG_IPW2100_DEBUG 13506 #endif 13507 #define IPW_PRIVACY_CAPABLE 0x0008 13508 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 13509 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 13510 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 13511 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 13512 #ifdef CONFIG_IPW2100_MONITOR 13513 #endif 13514 #ifdef CONFIG_IPW2100_MONITOR 13515 #endif 13516 #ifdef CONFIG_IPW2100_MONITOR 13517 #endif 13518 #ifdef CONFIG_IPW2100_MONITOR 13519 #endif 13520 #ifdef CONFIG_PM 13521 #endif 13522 #ifdef CONFIG_PM 13523 #endif 13524 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 13525 #ifdef CONFIG_PM 13526 #endif 13527 #ifdef CONFIG_IPW2100_DEBUG 13528 #endif 13529 #ifdef CONFIG_IPW2100_DEBUG 13530 #endif 13531 #ifdef CONFIG_IPW2100_MONITOR 13532 #endif 13533 #define POWER_MODES 5 13534 #ifdef CONFIG_IPW2100_MONITOR 13535 #endif 13536 #define MAX_POWER_STRING 80 13537 #ifdef CONFIG_IPW2100_MONITOR 13538 #endif 13539 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 13540 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 13541 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 13542 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 13543 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 13544 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 13545 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 13546 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 13547 #ifdef CONFIG_IPW2100_MONITOR 13548 #endif 13549 #ifdef CONFIG_IPW2100_MONITOR 13550 #endif 13551 #ifdef CONFIG_IPW2100_MONITOR 13552 #else 13553 #endif 13554 #ifdef CONFIG_IPW2100_MONITOR 13555 #else 13556 #endif 13557 #ifdef CONFIG_IPW2100_DEBUG 13558 #endif 13559 #define IPW2100_FW_MAJOR_VERSION 1 13560 #define IPW2100_FW_MINOR_VERSION 3 13561 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 13562 #define IPW2100_FW_MAJOR(x) (x & 0xff) 13563 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 13564 IPW2100_FW_MAJOR_VERSION) 13565 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 13566 "." __stringify(IPW2100_FW_MINOR_VERSION) 13567 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 13568 #ifdef CONFIG_IPW2100_MONITOR 13569 #endif 13570 #ifdef CONFIG_IPW2100_MONITOR 13571 #endif 13572 /* LDV_COMMENT_END_PREP */ 13573 LDV_IN_INTERRUPT=1; 13574 13575 13576 13577 } 13578 13579 break; 13580 default: break; 13581 13582 } 13583 13584 } 13585 13586 ldv_module_exit: 13587 13588 /** INIT: init_type: ST_MODULE_EXIT **/ 13589 /* content: static void __exit ipw2100_exit(void)*/ 13590 /* LDV_COMMENT_BEGIN_PREP */ 13591 #define IPW2100_VERSION "git-1.2.2" 13592 #define DRV_NAME "ipw2100" 13593 #define DRV_VERSION IPW2100_VERSION 13594 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 13595 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 13596 #ifdef CONFIG_IPW2100_DEBUG 13597 #define IPW2100_RX_DEBUG 13598 #endif 13599 #ifdef CONFIG_PM 13600 #endif 13601 #ifdef CONFIG_IPW2100_DEBUG 13602 #define IPW_DEBUG(level, message...) \ 13603 do { \ 13604 if (ipw2100_debug_level & (level)) { \ 13605 printk(KERN_DEBUG "ipw2100: %c %s ", \ 13606 in_interrupt() ? 'I' : 'U', __func__); \ 13607 printk(message); \ 13608 } \ 13609 } while (0) 13610 #else 13611 #define IPW_DEBUG(level, message...) do {} while (0) 13612 #endif 13613 #ifdef CONFIG_IPW2100_DEBUG 13614 #endif 13615 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 13616 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 13617 #define MAX_RESET_BACKOFF 10 13618 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 13619 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 13620 #ifndef CONFIG_PM 13621 #endif 13622 #ifdef CONFIG_PM 13623 #else 13624 #endif 13625 #ifndef CONFIG_PM 13626 #endif 13627 #define MAX_RF_KILL_CHECKS 5 13628 #define RF_KILL_CHECK_DELAY 40 13629 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 13630 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 13631 #define MAC_ASSOCIATION_READ_DELAY (HZ) 13632 #ifdef CONFIG_IPW2100_DEBUG 13633 #define IPW2100_HANDLER(v, f) { v, f, # v } 13634 #else 13635 #define IPW2100_HANDLER(v, f) { v, f } 13636 #endif 13637 #ifdef CONFIG_IPW2100_DEBUG 13638 #endif 13639 #ifdef CONFIG_IPW2100_DEBUG 13640 #endif 13641 #define SEARCH_ERROR 0xffffffff 13642 #define SEARCH_FAIL 0xfffffffe 13643 #define SEARCH_SUCCESS 0xfffffff0 13644 #define SEARCH_DISCARD 0 13645 #define SEARCH_SNAPSHOT 1 13646 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 13647 #ifdef IPW2100_DEBUG_C3 13648 #endif 13649 #ifdef IPW2100_RX_DEBUG 13650 #endif 13651 #ifdef IPW2100_DEBUG_C3 13652 #endif 13653 #ifdef IPW2100_DEBUG_C3 13654 #endif 13655 #ifdef IPW2100_RX_DEBUG 13656 #endif 13657 #ifdef IPW2100_RX_DEBUG 13658 #endif 13659 #ifdef CONFIG_IPW2100_MONITOR 13660 #endif 13661 #ifdef CONFIG_IPW2100_MONITOR 13662 #else 13663 #endif 13664 #ifdef CONFIG_IPW2100_MONITOR 13665 #endif 13666 #ifdef CONFIG_IPW2100_DEBUG 13667 #endif 13668 #ifdef CONFIG_IPW2100_DEBUG 13669 #endif 13670 #ifdef CONFIG_IPW2100_DEBUG 13671 #endif 13672 #define IPW2100_REG(x) { IPW_ ##x, #x } 13673 #define IPW2100_NIC(x, s) { x, #x, s } 13674 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 13675 #ifdef CONFIG_IPW2100_DEBUG 13676 #endif 13677 #ifdef CONFIG_IPW2100_MONITOR 13678 #endif 13679 #ifdef CONFIG_PM 13680 #endif 13681 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 13682 #ifdef CONFIG_IPW2100_DEBUG 13683 #endif 13684 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 13685 #endif 13686 #ifdef IPW2100_TX_POWER 13687 #endif 13688 #if 0 13689 #endif 13690 #ifdef CONFIG_IPW2100_DEBUG 13691 #endif 13692 #define IPW_PRIVACY_CAPABLE 0x0008 13693 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 13694 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 13695 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 13696 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 13697 #ifdef CONFIG_IPW2100_MONITOR 13698 #endif 13699 #ifdef CONFIG_IPW2100_MONITOR 13700 #endif 13701 #ifdef CONFIG_IPW2100_MONITOR 13702 #endif 13703 #ifdef CONFIG_IPW2100_MONITOR 13704 #endif 13705 #ifdef CONFIG_PM 13706 #endif 13707 #ifdef CONFIG_PM 13708 #endif 13709 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 13710 #ifdef CONFIG_PM 13711 #endif 13712 #ifdef CONFIG_IPW2100_DEBUG 13713 #endif 13714 /* LDV_COMMENT_END_PREP */ 13715 /* LDV_COMMENT_FUNCTION_CALL Kernel calls driver release function before driver will be uploaded from kernel. This function declared as "MODULE_EXIT(function name)". */ 13716 ldv_handler_precall(); 13717 ipw2100_exit(); 13718 /* LDV_COMMENT_BEGIN_PREP */ 13719 #ifdef CONFIG_IPW2100_MONITOR 13720 #endif 13721 #define POWER_MODES 5 13722 #ifdef CONFIG_IPW2100_MONITOR 13723 #endif 13724 #define MAX_POWER_STRING 80 13725 #ifdef CONFIG_IPW2100_MONITOR 13726 #endif 13727 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 13728 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 13729 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 13730 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 13731 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 13732 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 13733 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 13734 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 13735 #ifdef CONFIG_IPW2100_MONITOR 13736 #endif 13737 #ifdef CONFIG_IPW2100_MONITOR 13738 #endif 13739 #ifdef CONFIG_IPW2100_MONITOR 13740 #else 13741 #endif 13742 #ifdef CONFIG_IPW2100_MONITOR 13743 #else 13744 #endif 13745 #ifdef CONFIG_IPW2100_DEBUG 13746 #endif 13747 #define IPW2100_FW_MAJOR_VERSION 1 13748 #define IPW2100_FW_MINOR_VERSION 3 13749 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 13750 #define IPW2100_FW_MAJOR(x) (x & 0xff) 13751 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 13752 IPW2100_FW_MAJOR_VERSION) 13753 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 13754 "." __stringify(IPW2100_FW_MINOR_VERSION) 13755 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 13756 #ifdef CONFIG_IPW2100_MONITOR 13757 #endif 13758 #ifdef CONFIG_IPW2100_MONITOR 13759 #endif 13760 /* LDV_COMMENT_END_PREP */ 13761 13762 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 13763 ldv_final: ldv_check_final_state(); 13764 13765 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 13766 return; 13767 13768 } 13769 #endif 13770 13771 /* LDV_COMMENT_END_MAIN */
1 2 #include <linux/types.h> 3 #include <linux/dma-direction.h> 4 5 extern dma_addr_t ldv_dma_map_page(struct device *dev, struct page *page, size_t offset, size_t size, enum dma_data_direction dir); 6 extern dma_addr_t ldv_dma_map_single(struct device *dev, void *cpu_addr, size_t size, enum dma_data_direction dir); 7 extern dma_addr_t ldv_dma_map_single_attrs(struct device *dev, void *ptr, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs); 8 extern int ldv_dma_mapping_error(struct device *dev, dma_addr_t dma_addr); 9 #line 1 "/home/druidos/temp/331_1a/work/current--X--drivers--X--defaultlinux-3.14.1.tar.xz--X--331_1a--X--cpachecker/linux-3.14.1.tar.xz/csd_deg_dscv/6893/dscv_tempdir/dscv/ri/331_1a/drivers/net/wireless/ipw2x00/ipw2100.c" 10 11 /****************************************************************************** 12 13 Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved. 14 15 This program is free software; you can redistribute it and/or modify it 16 under the terms of version 2 of the GNU General Public License as 17 published by the Free Software Foundation. 18 19 This program is distributed in the hope that it will be useful, but WITHOUT 20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 22 more details. 23 24 You should have received a copy of the GNU General Public License along with 25 this program; if not, write to the Free Software Foundation, Inc., 59 26 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 27 28 The full GNU General Public License is included in this distribution in the 29 file called LICENSE. 30 31 Contact Information: 32 Intel Linux Wireless <ilw@linux.intel.com> 33 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 34 35 Portions of this file are based on the sample_* files provided by Wireless 36 Extensions 0.26 package and copyright (c) 1997-2003 Jean Tourrilhes 37 <jt@hpl.hp.com> 38 39 Portions of this file are based on the Host AP project, 40 Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen 41 <j@w1.fi> 42 Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi> 43 44 Portions of ipw2100_mod_firmware_load, ipw2100_do_mod_firmware_load, and 45 ipw2100_fw_load are loosely based on drivers/sound/sound_firmware.c 46 available in the 2.4.25 kernel sources, and are copyright (c) Alan Cox 47 48 ******************************************************************************/ 49 /* 50 51 Initial driver on which this is based was developed by Janusz Gorycki, 52 Maciej Urbaniak, and Maciej Sosnowski. 53 54 Promiscuous mode support added by Jacek Wysoczynski and Maciej Urbaniak. 55 56 Theory of Operation 57 58 Tx - Commands and Data 59 60 Firmware and host share a circular queue of Transmit Buffer Descriptors (TBDs) 61 Each TBD contains a pointer to the physical (dma_addr_t) address of data being 62 sent to the firmware as well as the length of the data. 63 64 The host writes to the TBD queue at the WRITE index. The WRITE index points 65 to the _next_ packet to be written and is advanced when after the TBD has been 66 filled. 67 68 The firmware pulls from the TBD queue at the READ index. The READ index points 69 to the currently being read entry, and is advanced once the firmware is 70 done with a packet. 71 72 When data is sent to the firmware, the first TBD is used to indicate to the 73 firmware if a Command or Data is being sent. If it is Command, all of the 74 command information is contained within the physical address referred to by the 75 TBD. If it is Data, the first TBD indicates the type of data packet, number 76 of fragments, etc. The next TBD then refers to the actual packet location. 77 78 The Tx flow cycle is as follows: 79 80 1) ipw2100_tx() is called by kernel with SKB to transmit 81 2) Packet is move from the tx_free_list and appended to the transmit pending 82 list (tx_pend_list) 83 3) work is scheduled to move pending packets into the shared circular queue. 84 4) when placing packet in the circular queue, the incoming SKB is DMA mapped 85 to a physical address. That address is entered into a TBD. Two TBDs are 86 filled out. The first indicating a data packet, the second referring to the 87 actual payload data. 88 5) the packet is removed from tx_pend_list and placed on the end of the 89 firmware pending list (fw_pend_list) 90 6) firmware is notified that the WRITE index has 91 7) Once the firmware has processed the TBD, INTA is triggered. 92 8) For each Tx interrupt received from the firmware, the READ index is checked 93 to see which TBDs are done being processed. 94 9) For each TBD that has been processed, the ISR pulls the oldest packet 95 from the fw_pend_list. 96 10)The packet structure contained in the fw_pend_list is then used 97 to unmap the DMA address and to free the SKB originally passed to the driver 98 from the kernel. 99 11)The packet structure is placed onto the tx_free_list 100 101 The above steps are the same for commands, only the msg_free_list/msg_pend_list 102 are used instead of tx_free_list/tx_pend_list 103 104 ... 105 106 Critical Sections / Locking : 107 108 There are two locks utilized. The first is the low level lock (priv->low_lock) 109 that protects the following: 110 111 - Access to the Tx/Rx queue lists via priv->low_lock. The lists are as follows: 112 113 tx_free_list : Holds pre-allocated Tx buffers. 114 TAIL modified in __ipw2100_tx_process() 115 HEAD modified in ipw2100_tx() 116 117 tx_pend_list : Holds used Tx buffers waiting to go into the TBD ring 118 TAIL modified ipw2100_tx() 119 HEAD modified by ipw2100_tx_send_data() 120 121 msg_free_list : Holds pre-allocated Msg (Command) buffers 122 TAIL modified in __ipw2100_tx_process() 123 HEAD modified in ipw2100_hw_send_command() 124 125 msg_pend_list : Holds used Msg buffers waiting to go into the TBD ring 126 TAIL modified in ipw2100_hw_send_command() 127 HEAD modified in ipw2100_tx_send_commands() 128 129 The flow of data on the TX side is as follows: 130 131 MSG_FREE_LIST + COMMAND => MSG_PEND_LIST => TBD => MSG_FREE_LIST 132 TX_FREE_LIST + DATA => TX_PEND_LIST => TBD => TX_FREE_LIST 133 134 The methods that work on the TBD ring are protected via priv->low_lock. 135 136 - The internal data state of the device itself 137 - Access to the firmware read/write indexes for the BD queues 138 and associated logic 139 140 All external entry functions are locked with the priv->action_lock to ensure 141 that only one external action is invoked at a time. 142 143 144 */ 145 146 #include <linux/compiler.h> 147 #include <linux/errno.h> 148 #include <linux/if_arp.h> 149 #include <linux/in6.h> 150 #include <linux/in.h> 151 #include <linux/ip.h> 152 #include <linux/kernel.h> 153 #include <linux/kmod.h> 154 #include <linux/module.h> 155 #include <linux/netdevice.h> 156 #include <linux/ethtool.h> 157 #include <linux/pci.h> 158 #include <linux/dma-mapping.h> 159 #include <linux/proc_fs.h> 160 #include <linux/skbuff.h> 161 #include <asm/uaccess.h> 162 #include <asm/io.h> 163 #include <linux/fs.h> 164 #include <linux/mm.h> 165 #include <linux/slab.h> 166 #include <linux/unistd.h> 167 #include <linux/stringify.h> 168 #include <linux/tcp.h> 169 #include <linux/types.h> 170 #include <linux/time.h> 171 #include <linux/firmware.h> 172 #include <linux/acpi.h> 173 #include <linux/ctype.h> 174 #include <linux/pm_qos.h> 175 176 #include <net/lib80211.h> 177 178 #include "ipw2100.h" 179 #include "ipw.h" 180 181 #define IPW2100_VERSION "git-1.2.2" 182 183 #define DRV_NAME "ipw2100" 184 #define DRV_VERSION IPW2100_VERSION 185 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 186 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 187 188 static struct pm_qos_request ipw2100_pm_qos_req; 189 190 /* Debugging stuff */ 191 #ifdef CONFIG_IPW2100_DEBUG 192 #define IPW2100_RX_DEBUG /* Reception debugging */ 193 #endif 194 195 MODULE_DESCRIPTION(DRV_DESCRIPTION); 196 MODULE_VERSION(DRV_VERSION); 197 MODULE_AUTHOR(DRV_COPYRIGHT); 198 MODULE_LICENSE("GPL"); 199 200 static int debug = 0; 201 static int network_mode = 0; 202 static int channel = 0; 203 static int associate = 0; 204 static int disable = 0; 205 #ifdef CONFIG_PM 206 static struct ipw2100_fw ipw2100_firmware; 207 #endif 208 209 #include <linux/moduleparam.h> 210 module_param(debug, int, 0444); 211 module_param_named(mode, network_mode, int, 0444); 212 module_param(channel, int, 0444); 213 module_param(associate, int, 0444); 214 module_param(disable, int, 0444); 215 216 MODULE_PARM_DESC(debug, "debug level"); 217 MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS,2=Monitor)"); 218 MODULE_PARM_DESC(channel, "channel"); 219 MODULE_PARM_DESC(associate, "auto associate when scanning (default off)"); 220 MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); 221 222 static u32 ipw2100_debug_level = IPW_DL_NONE; 223 224 #ifdef CONFIG_IPW2100_DEBUG 225 #define IPW_DEBUG(level, message...) \ 226 do { \ 227 if (ipw2100_debug_level & (level)) { \ 228 printk(KERN_DEBUG "ipw2100: %c %s ", \ 229 in_interrupt() ? 'I' : 'U', __func__); \ 230 printk(message); \ 231 } \ 232 } while (0) 233 #else 234 #define IPW_DEBUG(level, message...) do {} while (0) 235 #endif /* CONFIG_IPW2100_DEBUG */ 236 237 #ifdef CONFIG_IPW2100_DEBUG 238 static const char *command_types[] = { 239 "undefined", 240 "unused", /* HOST_ATTENTION */ 241 "HOST_COMPLETE", 242 "unused", /* SLEEP */ 243 "unused", /* HOST_POWER_DOWN */ 244 "unused", 245 "SYSTEM_CONFIG", 246 "unused", /* SET_IMR */ 247 "SSID", 248 "MANDATORY_BSSID", 249 "AUTHENTICATION_TYPE", 250 "ADAPTER_ADDRESS", 251 "PORT_TYPE", 252 "INTERNATIONAL_MODE", 253 "CHANNEL", 254 "RTS_THRESHOLD", 255 "FRAG_THRESHOLD", 256 "POWER_MODE", 257 "TX_RATES", 258 "BASIC_TX_RATES", 259 "WEP_KEY_INFO", 260 "unused", 261 "unused", 262 "unused", 263 "unused", 264 "WEP_KEY_INDEX", 265 "WEP_FLAGS", 266 "ADD_MULTICAST", 267 "CLEAR_ALL_MULTICAST", 268 "BEACON_INTERVAL", 269 "ATIM_WINDOW", 270 "CLEAR_STATISTICS", 271 "undefined", 272 "undefined", 273 "undefined", 274 "undefined", 275 "TX_POWER_INDEX", 276 "undefined", 277 "undefined", 278 "undefined", 279 "undefined", 280 "undefined", 281 "undefined", 282 "BROADCAST_SCAN", 283 "CARD_DISABLE", 284 "PREFERRED_BSSID", 285 "SET_SCAN_OPTIONS", 286 "SCAN_DWELL_TIME", 287 "SWEEP_TABLE", 288 "AP_OR_STATION_TABLE", 289 "GROUP_ORDINALS", 290 "SHORT_RETRY_LIMIT", 291 "LONG_RETRY_LIMIT", 292 "unused", /* SAVE_CALIBRATION */ 293 "unused", /* RESTORE_CALIBRATION */ 294 "undefined", 295 "undefined", 296 "undefined", 297 "HOST_PRE_POWER_DOWN", 298 "unused", /* HOST_INTERRUPT_COALESCING */ 299 "undefined", 300 "CARD_DISABLE_PHY_OFF", 301 "MSDU_TX_RATES", 302 "undefined", 303 "SET_STATION_STAT_BITS", 304 "CLEAR_STATIONS_STAT_BITS", 305 "LEAP_ROGUE_MODE", 306 "SET_SECURITY_INFORMATION", 307 "DISASSOCIATION_BSSID", 308 "SET_WPA_ASS_IE" 309 }; 310 #endif 311 312 static const long ipw2100_frequencies[] = { 313 2412, 2417, 2422, 2427, 314 2432, 2437, 2442, 2447, 315 2452, 2457, 2462, 2467, 316 2472, 2484 317 }; 318 319 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 320 321 static struct ieee80211_rate ipw2100_bg_rates[] = { 322 { .bitrate = 10 }, 323 { .bitrate = 20, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, 324 { .bitrate = 55, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, 325 { .bitrate = 110, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, 326 }; 327 328 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 329 330 /* Pre-decl until we get the code solid and then we can clean it up */ 331 static void ipw2100_tx_send_commands(struct ipw2100_priv *priv); 332 static void ipw2100_tx_send_data(struct ipw2100_priv *priv); 333 static int ipw2100_adapter_setup(struct ipw2100_priv *priv); 334 335 static void ipw2100_queues_initialize(struct ipw2100_priv *priv); 336 static void ipw2100_queues_free(struct ipw2100_priv *priv); 337 static int ipw2100_queues_allocate(struct ipw2100_priv *priv); 338 339 static int ipw2100_fw_download(struct ipw2100_priv *priv, 340 struct ipw2100_fw *fw); 341 static int ipw2100_get_firmware(struct ipw2100_priv *priv, 342 struct ipw2100_fw *fw); 343 static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, 344 size_t max); 345 static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, 346 size_t max); 347 static void ipw2100_release_firmware(struct ipw2100_priv *priv, 348 struct ipw2100_fw *fw); 349 static int ipw2100_ucode_download(struct ipw2100_priv *priv, 350 struct ipw2100_fw *fw); 351 static void ipw2100_wx_event_work(struct work_struct *work); 352 static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev); 353 static struct iw_handler_def ipw2100_wx_handler_def; 354 355 static inline void read_register(struct net_device *dev, u32 reg, u32 * val) 356 { 357 struct ipw2100_priv *priv = libipw_priv(dev); 358 359 *val = ioread32(priv->ioaddr + reg); 360 IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val); 361 } 362 363 static inline void write_register(struct net_device *dev, u32 reg, u32 val) 364 { 365 struct ipw2100_priv *priv = libipw_priv(dev); 366 367 iowrite32(val, priv->ioaddr + reg); 368 IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val); 369 } 370 371 static inline void read_register_word(struct net_device *dev, u32 reg, 372 u16 * val) 373 { 374 struct ipw2100_priv *priv = libipw_priv(dev); 375 376 *val = ioread16(priv->ioaddr + reg); 377 IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val); 378 } 379 380 static inline void read_register_byte(struct net_device *dev, u32 reg, u8 * val) 381 { 382 struct ipw2100_priv *priv = libipw_priv(dev); 383 384 *val = ioread8(priv->ioaddr + reg); 385 IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val); 386 } 387 388 static inline void write_register_word(struct net_device *dev, u32 reg, u16 val) 389 { 390 struct ipw2100_priv *priv = libipw_priv(dev); 391 392 iowrite16(val, priv->ioaddr + reg); 393 IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val); 394 } 395 396 static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val) 397 { 398 struct ipw2100_priv *priv = libipw_priv(dev); 399 400 iowrite8(val, priv->ioaddr + reg); 401 IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val); 402 } 403 404 static inline void read_nic_dword(struct net_device *dev, u32 addr, u32 * val) 405 { 406 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 407 addr & IPW_REG_INDIRECT_ADDR_MASK); 408 read_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 409 } 410 411 static inline void write_nic_dword(struct net_device *dev, u32 addr, u32 val) 412 { 413 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 414 addr & IPW_REG_INDIRECT_ADDR_MASK); 415 write_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 416 } 417 418 static inline void read_nic_word(struct net_device *dev, u32 addr, u16 * val) 419 { 420 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 421 addr & IPW_REG_INDIRECT_ADDR_MASK); 422 read_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 423 } 424 425 static inline void write_nic_word(struct net_device *dev, u32 addr, u16 val) 426 { 427 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 428 addr & IPW_REG_INDIRECT_ADDR_MASK); 429 write_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 430 } 431 432 static inline void read_nic_byte(struct net_device *dev, u32 addr, u8 * val) 433 { 434 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 435 addr & IPW_REG_INDIRECT_ADDR_MASK); 436 read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 437 } 438 439 static inline void write_nic_byte(struct net_device *dev, u32 addr, u8 val) 440 { 441 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 442 addr & IPW_REG_INDIRECT_ADDR_MASK); 443 write_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 444 } 445 446 static inline void write_nic_auto_inc_address(struct net_device *dev, u32 addr) 447 { 448 write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, 449 addr & IPW_REG_INDIRECT_ADDR_MASK); 450 } 451 452 static inline void write_nic_dword_auto_inc(struct net_device *dev, u32 val) 453 { 454 write_register(dev, IPW_REG_AUTOINCREMENT_DATA, val); 455 } 456 457 static void write_nic_memory(struct net_device *dev, u32 addr, u32 len, 458 const u8 * buf) 459 { 460 u32 aligned_addr; 461 u32 aligned_len; 462 u32 dif_len; 463 u32 i; 464 465 /* read first nibble byte by byte */ 466 aligned_addr = addr & (~0x3); 467 dif_len = addr - aligned_addr; 468 if (dif_len) { 469 /* Start reading at aligned_addr + dif_len */ 470 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 471 aligned_addr); 472 for (i = dif_len; i < 4; i++, buf++) 473 write_register_byte(dev, 474 IPW_REG_INDIRECT_ACCESS_DATA + i, 475 *buf); 476 477 len -= dif_len; 478 aligned_addr += 4; 479 } 480 481 /* read DWs through autoincrement registers */ 482 write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr); 483 aligned_len = len & (~0x3); 484 for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) 485 write_register(dev, IPW_REG_AUTOINCREMENT_DATA, *(u32 *) buf); 486 487 /* copy the last nibble */ 488 dif_len = len - aligned_len; 489 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); 490 for (i = 0; i < dif_len; i++, buf++) 491 write_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, 492 *buf); 493 } 494 495 static void read_nic_memory(struct net_device *dev, u32 addr, u32 len, 496 u8 * buf) 497 { 498 u32 aligned_addr; 499 u32 aligned_len; 500 u32 dif_len; 501 u32 i; 502 503 /* read first nibble byte by byte */ 504 aligned_addr = addr & (~0x3); 505 dif_len = addr - aligned_addr; 506 if (dif_len) { 507 /* Start reading at aligned_addr + dif_len */ 508 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 509 aligned_addr); 510 for (i = dif_len; i < 4; i++, buf++) 511 read_register_byte(dev, 512 IPW_REG_INDIRECT_ACCESS_DATA + i, 513 buf); 514 515 len -= dif_len; 516 aligned_addr += 4; 517 } 518 519 /* read DWs through autoincrement registers */ 520 write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr); 521 aligned_len = len & (~0x3); 522 for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) 523 read_register(dev, IPW_REG_AUTOINCREMENT_DATA, (u32 *) buf); 524 525 /* copy the last nibble */ 526 dif_len = len - aligned_len; 527 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); 528 for (i = 0; i < dif_len; i++, buf++) 529 read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf); 530 } 531 532 static bool ipw2100_hw_is_adapter_in_system(struct net_device *dev) 533 { 534 u32 dbg; 535 536 read_register(dev, IPW_REG_DOA_DEBUG_AREA_START, &dbg); 537 538 return dbg == IPW_DATA_DOA_DEBUG_VALUE; 539 } 540 541 static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, 542 void *val, u32 * len) 543 { 544 struct ipw2100_ordinals *ordinals = &priv->ordinals; 545 u32 addr; 546 u32 field_info; 547 u16 field_len; 548 u16 field_count; 549 u32 total_length; 550 551 if (ordinals->table1_addr == 0) { 552 printk(KERN_WARNING DRV_NAME ": attempt to use fw ordinals " 553 "before they have been loaded.\n"); 554 return -EINVAL; 555 } 556 557 if (IS_ORDINAL_TABLE_ONE(ordinals, ord)) { 558 if (*len < IPW_ORD_TAB_1_ENTRY_SIZE) { 559 *len = IPW_ORD_TAB_1_ENTRY_SIZE; 560 561 printk(KERN_WARNING DRV_NAME 562 ": ordinal buffer length too small, need %zd\n", 563 IPW_ORD_TAB_1_ENTRY_SIZE); 564 565 return -EINVAL; 566 } 567 568 read_nic_dword(priv->net_dev, 569 ordinals->table1_addr + (ord << 2), &addr); 570 read_nic_dword(priv->net_dev, addr, val); 571 572 *len = IPW_ORD_TAB_1_ENTRY_SIZE; 573 574 return 0; 575 } 576 577 if (IS_ORDINAL_TABLE_TWO(ordinals, ord)) { 578 579 ord -= IPW_START_ORD_TAB_2; 580 581 /* get the address of statistic */ 582 read_nic_dword(priv->net_dev, 583 ordinals->table2_addr + (ord << 3), &addr); 584 585 /* get the second DW of statistics ; 586 * two 16-bit words - first is length, second is count */ 587 read_nic_dword(priv->net_dev, 588 ordinals->table2_addr + (ord << 3) + sizeof(u32), 589 &field_info); 590 591 /* get each entry length */ 592 field_len = *((u16 *) & field_info); 593 594 /* get number of entries */ 595 field_count = *(((u16 *) & field_info) + 1); 596 597 /* abort if no enough memory */ 598 total_length = field_len * field_count; 599 if (total_length > *len) { 600 *len = total_length; 601 return -EINVAL; 602 } 603 604 *len = total_length; 605 if (!total_length) 606 return 0; 607 608 /* read the ordinal data from the SRAM */ 609 read_nic_memory(priv->net_dev, addr, total_length, val); 610 611 return 0; 612 } 613 614 printk(KERN_WARNING DRV_NAME ": ordinal %d neither in table 1 nor " 615 "in table 2\n", ord); 616 617 return -EINVAL; 618 } 619 620 static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 * val, 621 u32 * len) 622 { 623 struct ipw2100_ordinals *ordinals = &priv->ordinals; 624 u32 addr; 625 626 if (IS_ORDINAL_TABLE_ONE(ordinals, ord)) { 627 if (*len != IPW_ORD_TAB_1_ENTRY_SIZE) { 628 *len = IPW_ORD_TAB_1_ENTRY_SIZE; 629 IPW_DEBUG_INFO("wrong size\n"); 630 return -EINVAL; 631 } 632 633 read_nic_dword(priv->net_dev, 634 ordinals->table1_addr + (ord << 2), &addr); 635 636 write_nic_dword(priv->net_dev, addr, *val); 637 638 *len = IPW_ORD_TAB_1_ENTRY_SIZE; 639 640 return 0; 641 } 642 643 IPW_DEBUG_INFO("wrong table\n"); 644 if (IS_ORDINAL_TABLE_TWO(ordinals, ord)) 645 return -EINVAL; 646 647 return -EINVAL; 648 } 649 650 static char *snprint_line(char *buf, size_t count, 651 const u8 * data, u32 len, u32 ofs) 652 { 653 int out, i, j, l; 654 char c; 655 656 out = snprintf(buf, count, "%08X", ofs); 657 658 for (l = 0, i = 0; i < 2; i++) { 659 out += snprintf(buf + out, count - out, " "); 660 for (j = 0; j < 8 && l < len; j++, l++) 661 out += snprintf(buf + out, count - out, "%02X ", 662 data[(i * 8 + j)]); 663 for (; j < 8; j++) 664 out += snprintf(buf + out, count - out, " "); 665 } 666 667 out += snprintf(buf + out, count - out, " "); 668 for (l = 0, i = 0; i < 2; i++) { 669 out += snprintf(buf + out, count - out, " "); 670 for (j = 0; j < 8 && l < len; j++, l++) { 671 c = data[(i * 8 + j)]; 672 if (!isascii(c) || !isprint(c)) 673 c = '.'; 674 675 out += snprintf(buf + out, count - out, "%c", c); 676 } 677 678 for (; j < 8; j++) 679 out += snprintf(buf + out, count - out, " "); 680 } 681 682 return buf; 683 } 684 685 static void printk_buf(int level, const u8 * data, u32 len) 686 { 687 char line[81]; 688 u32 ofs = 0; 689 if (!(ipw2100_debug_level & level)) 690 return; 691 692 while (len) { 693 printk(KERN_DEBUG "%s\n", 694 snprint_line(line, sizeof(line), &data[ofs], 695 min(len, 16U), ofs)); 696 ofs += 16; 697 len -= min(len, 16U); 698 } 699 } 700 701 #define MAX_RESET_BACKOFF 10 702 703 static void schedule_reset(struct ipw2100_priv *priv) 704 { 705 unsigned long now = get_seconds(); 706 707 /* If we haven't received a reset request within the backoff period, 708 * then we can reset the backoff interval so this reset occurs 709 * immediately */ 710 if (priv->reset_backoff && 711 (now - priv->last_reset > priv->reset_backoff)) 712 priv->reset_backoff = 0; 713 714 priv->last_reset = get_seconds(); 715 716 if (!(priv->status & STATUS_RESET_PENDING)) { 717 IPW_DEBUG_INFO("%s: Scheduling firmware restart (%ds).\n", 718 priv->net_dev->name, priv->reset_backoff); 719 netif_carrier_off(priv->net_dev); 720 netif_stop_queue(priv->net_dev); 721 priv->status |= STATUS_RESET_PENDING; 722 if (priv->reset_backoff) 723 schedule_delayed_work(&priv->reset_work, 724 priv->reset_backoff * HZ); 725 else 726 schedule_delayed_work(&priv->reset_work, 0); 727 728 if (priv->reset_backoff < MAX_RESET_BACKOFF) 729 priv->reset_backoff++; 730 731 wake_up_interruptible(&priv->wait_command_queue); 732 } else 733 IPW_DEBUG_INFO("%s: Firmware restart already in progress.\n", 734 priv->net_dev->name); 735 736 } 737 738 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 739 static int ipw2100_hw_send_command(struct ipw2100_priv *priv, 740 struct host_command *cmd) 741 { 742 struct list_head *element; 743 struct ipw2100_tx_packet *packet; 744 unsigned long flags; 745 int err = 0; 746 747 IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", 748 command_types[cmd->host_command], cmd->host_command, 749 cmd->host_command_length); 750 printk_buf(IPW_DL_HC, (u8 *) cmd->host_command_parameters, 751 cmd->host_command_length); 752 753 spin_lock_irqsave(&priv->low_lock, flags); 754 755 if (priv->fatal_error) { 756 IPW_DEBUG_INFO 757 ("Attempt to send command while hardware in fatal error condition.\n"); 758 err = -EIO; 759 goto fail_unlock; 760 } 761 762 if (!(priv->status & STATUS_RUNNING)) { 763 IPW_DEBUG_INFO 764 ("Attempt to send command while hardware is not running.\n"); 765 err = -EIO; 766 goto fail_unlock; 767 } 768 769 if (priv->status & STATUS_CMD_ACTIVE) { 770 IPW_DEBUG_INFO 771 ("Attempt to send command while another command is pending.\n"); 772 err = -EBUSY; 773 goto fail_unlock; 774 } 775 776 if (list_empty(&priv->msg_free_list)) { 777 IPW_DEBUG_INFO("no available msg buffers\n"); 778 goto fail_unlock; 779 } 780 781 priv->status |= STATUS_CMD_ACTIVE; 782 priv->messages_sent++; 783 784 element = priv->msg_free_list.next; 785 786 packet = list_entry(element, struct ipw2100_tx_packet, list); 787 packet->jiffy_start = jiffies; 788 789 /* initialize the firmware command packet */ 790 packet->info.c_struct.cmd->host_command_reg = cmd->host_command; 791 packet->info.c_struct.cmd->host_command_reg1 = cmd->host_command1; 792 packet->info.c_struct.cmd->host_command_len_reg = 793 cmd->host_command_length; 794 packet->info.c_struct.cmd->sequence = cmd->host_command_sequence; 795 796 memcpy(packet->info.c_struct.cmd->host_command_params_reg, 797 cmd->host_command_parameters, 798 sizeof(packet->info.c_struct.cmd->host_command_params_reg)); 799 800 list_del(element); 801 DEC_STAT(&priv->msg_free_stat); 802 803 list_add_tail(element, &priv->msg_pend_list); 804 INC_STAT(&priv->msg_pend_stat); 805 806 ipw2100_tx_send_commands(priv); 807 ipw2100_tx_send_data(priv); 808 809 spin_unlock_irqrestore(&priv->low_lock, flags); 810 811 /* 812 * We must wait for this command to complete before another 813 * command can be sent... but if we wait more than 3 seconds 814 * then there is a problem. 815 */ 816 817 err = 818 wait_event_interruptible_timeout(priv->wait_command_queue, 819 !(priv-> 820 status & STATUS_CMD_ACTIVE), 821 HOST_COMPLETE_TIMEOUT); 822 823 if (err == 0) { 824 IPW_DEBUG_INFO("Command completion failed out after %dms.\n", 825 1000 * (HOST_COMPLETE_TIMEOUT / HZ)); 826 priv->fatal_error = IPW2100_ERR_MSG_TIMEOUT; 827 priv->status &= ~STATUS_CMD_ACTIVE; 828 schedule_reset(priv); 829 return -EIO; 830 } 831 832 if (priv->fatal_error) { 833 printk(KERN_WARNING DRV_NAME ": %s: firmware fatal error\n", 834 priv->net_dev->name); 835 return -EIO; 836 } 837 838 /* !!!!! HACK TEST !!!!! 839 * When lots of debug trace statements are enabled, the driver 840 * doesn't seem to have as many firmware restart cycles... 841 * 842 * As a test, we're sticking in a 1/100s delay here */ 843 schedule_timeout_uninterruptible(msecs_to_jiffies(10)); 844 845 return 0; 846 847 fail_unlock: 848 spin_unlock_irqrestore(&priv->low_lock, flags); 849 850 return err; 851 } 852 853 /* 854 * Verify the values and data access of the hardware 855 * No locks needed or used. No functions called. 856 */ 857 static int ipw2100_verify(struct ipw2100_priv *priv) 858 { 859 u32 data1, data2; 860 u32 address; 861 862 u32 val1 = 0x76543210; 863 u32 val2 = 0xFEDCBA98; 864 865 /* Domain 0 check - all values should be DOA_DEBUG */ 866 for (address = IPW_REG_DOA_DEBUG_AREA_START; 867 address < IPW_REG_DOA_DEBUG_AREA_END; address += sizeof(u32)) { 868 read_register(priv->net_dev, address, &data1); 869 if (data1 != IPW_DATA_DOA_DEBUG_VALUE) 870 return -EIO; 871 } 872 873 /* Domain 1 check - use arbitrary read/write compare */ 874 for (address = 0; address < 5; address++) { 875 /* The memory area is not used now */ 876 write_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x32, 877 val1); 878 write_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x36, 879 val2); 880 read_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x32, 881 &data1); 882 read_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x36, 883 &data2); 884 if (val1 == data1 && val2 == data2) 885 return 0; 886 } 887 888 return -EIO; 889 } 890 891 /* 892 * 893 * Loop until the CARD_DISABLED bit is the same value as the 894 * supplied parameter 895 * 896 * TODO: See if it would be more efficient to do a wait/wake 897 * cycle and have the completion event trigger the wakeup 898 * 899 */ 900 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 // 100 milli 901 static int ipw2100_wait_for_card_state(struct ipw2100_priv *priv, int state) 902 { 903 int i; 904 u32 card_state; 905 u32 len = sizeof(card_state); 906 int err; 907 908 for (i = 0; i <= IPW_CARD_DISABLE_COMPLETE_WAIT * 1000; i += 50) { 909 err = ipw2100_get_ordinal(priv, IPW_ORD_CARD_DISABLED, 910 &card_state, &len); 911 if (err) { 912 IPW_DEBUG_INFO("Query of CARD_DISABLED ordinal " 913 "failed.\n"); 914 return 0; 915 } 916 917 /* We'll break out if either the HW state says it is 918 * in the state we want, or if HOST_COMPLETE command 919 * finishes */ 920 if ((card_state == state) || 921 ((priv->status & STATUS_ENABLED) ? 922 IPW_HW_STATE_ENABLED : IPW_HW_STATE_DISABLED) == state) { 923 if (state == IPW_HW_STATE_ENABLED) 924 priv->status |= STATUS_ENABLED; 925 else 926 priv->status &= ~STATUS_ENABLED; 927 928 return 0; 929 } 930 931 udelay(50); 932 } 933 934 IPW_DEBUG_INFO("ipw2100_wait_for_card_state to %s state timed out\n", 935 state ? "DISABLED" : "ENABLED"); 936 return -EIO; 937 } 938 939 /********************************************************************* 940 Procedure : sw_reset_and_clock 941 Purpose : Asserts s/w reset, asserts clock initialization 942 and waits for clock stabilization 943 ********************************************************************/ 944 static int sw_reset_and_clock(struct ipw2100_priv *priv) 945 { 946 int i; 947 u32 r; 948 949 // assert s/w reset 950 write_register(priv->net_dev, IPW_REG_RESET_REG, 951 IPW_AUX_HOST_RESET_REG_SW_RESET); 952 953 // wait for clock stabilization 954 for (i = 0; i < 1000; i++) { 955 udelay(IPW_WAIT_RESET_ARC_COMPLETE_DELAY); 956 957 // check clock ready bit 958 read_register(priv->net_dev, IPW_REG_RESET_REG, &r); 959 if (r & IPW_AUX_HOST_RESET_REG_PRINCETON_RESET) 960 break; 961 } 962 963 if (i == 1000) 964 return -EIO; // TODO: better error value 965 966 /* set "initialization complete" bit to move adapter to 967 * D0 state */ 968 write_register(priv->net_dev, IPW_REG_GP_CNTRL, 969 IPW_AUX_HOST_GP_CNTRL_BIT_INIT_DONE); 970 971 /* wait for clock stabilization */ 972 for (i = 0; i < 10000; i++) { 973 udelay(IPW_WAIT_CLOCK_STABILIZATION_DELAY * 4); 974 975 /* check clock ready bit */ 976 read_register(priv->net_dev, IPW_REG_GP_CNTRL, &r); 977 if (r & IPW_AUX_HOST_GP_CNTRL_BIT_CLOCK_READY) 978 break; 979 } 980 981 if (i == 10000) 982 return -EIO; /* TODO: better error value */ 983 984 /* set D0 standby bit */ 985 read_register(priv->net_dev, IPW_REG_GP_CNTRL, &r); 986 write_register(priv->net_dev, IPW_REG_GP_CNTRL, 987 r | IPW_AUX_HOST_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); 988 989 return 0; 990 } 991 992 /********************************************************************* 993 Procedure : ipw2100_download_firmware 994 Purpose : Initiaze adapter after power on. 995 The sequence is: 996 1. assert s/w reset first! 997 2. awake clocks & wait for clock stabilization 998 3. hold ARC (don't ask me why...) 999 4. load Dino ucode and reset/clock init again 1000 5. zero-out shared mem 1001 6. download f/w 1002 *******************************************************************/ 1003 static int ipw2100_download_firmware(struct ipw2100_priv *priv) 1004 { 1005 u32 address; 1006 int err; 1007 1008 #ifndef CONFIG_PM 1009 /* Fetch the firmware and microcode */ 1010 struct ipw2100_fw ipw2100_firmware; 1011 #endif 1012 1013 if (priv->fatal_error) { 1014 IPW_DEBUG_ERROR("%s: ipw2100_download_firmware called after " 1015 "fatal error %d. Interface must be brought down.\n", 1016 priv->net_dev->name, priv->fatal_error); 1017 return -EINVAL; 1018 } 1019 #ifdef CONFIG_PM 1020 if (!ipw2100_firmware.version) { 1021 err = ipw2100_get_firmware(priv, &ipw2100_firmware); 1022 if (err) { 1023 IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", 1024 priv->net_dev->name, err); 1025 priv->fatal_error = IPW2100_ERR_FW_LOAD; 1026 goto fail; 1027 } 1028 } 1029 #else 1030 err = ipw2100_get_firmware(priv, &ipw2100_firmware); 1031 if (err) { 1032 IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", 1033 priv->net_dev->name, err); 1034 priv->fatal_error = IPW2100_ERR_FW_LOAD; 1035 goto fail; 1036 } 1037 #endif 1038 priv->firmware_version = ipw2100_firmware.version; 1039 1040 /* s/w reset and clock stabilization */ 1041 err = sw_reset_and_clock(priv); 1042 if (err) { 1043 IPW_DEBUG_ERROR("%s: sw_reset_and_clock failed: %d\n", 1044 priv->net_dev->name, err); 1045 goto fail; 1046 } 1047 1048 err = ipw2100_verify(priv); 1049 if (err) { 1050 IPW_DEBUG_ERROR("%s: ipw2100_verify failed: %d\n", 1051 priv->net_dev->name, err); 1052 goto fail; 1053 } 1054 1055 /* Hold ARC */ 1056 write_nic_dword(priv->net_dev, 1057 IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x80000000); 1058 1059 /* allow ARC to run */ 1060 write_register(priv->net_dev, IPW_REG_RESET_REG, 0); 1061 1062 /* load microcode */ 1063 err = ipw2100_ucode_download(priv, &ipw2100_firmware); 1064 if (err) { 1065 printk(KERN_ERR DRV_NAME ": %s: Error loading microcode: %d\n", 1066 priv->net_dev->name, err); 1067 goto fail; 1068 } 1069 1070 /* release ARC */ 1071 write_nic_dword(priv->net_dev, 1072 IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x00000000); 1073 1074 /* s/w reset and clock stabilization (again!!!) */ 1075 err = sw_reset_and_clock(priv); 1076 if (err) { 1077 printk(KERN_ERR DRV_NAME 1078 ": %s: sw_reset_and_clock failed: %d\n", 1079 priv->net_dev->name, err); 1080 goto fail; 1081 } 1082 1083 /* load f/w */ 1084 err = ipw2100_fw_download(priv, &ipw2100_firmware); 1085 if (err) { 1086 IPW_DEBUG_ERROR("%s: Error loading firmware: %d\n", 1087 priv->net_dev->name, err); 1088 goto fail; 1089 } 1090 #ifndef CONFIG_PM 1091 /* 1092 * When the .resume method of the driver is called, the other 1093 * part of the system, i.e. the ide driver could still stay in 1094 * the suspend stage. This prevents us from loading the firmware 1095 * from the disk. --YZ 1096 */ 1097 1098 /* free any storage allocated for firmware image */ 1099 ipw2100_release_firmware(priv, &ipw2100_firmware); 1100 #endif 1101 1102 /* zero out Domain 1 area indirectly (Si requirement) */ 1103 for (address = IPW_HOST_FW_SHARED_AREA0; 1104 address < IPW_HOST_FW_SHARED_AREA0_END; address += 4) 1105 write_nic_dword(priv->net_dev, address, 0); 1106 for (address = IPW_HOST_FW_SHARED_AREA1; 1107 address < IPW_HOST_FW_SHARED_AREA1_END; address += 4) 1108 write_nic_dword(priv->net_dev, address, 0); 1109 for (address = IPW_HOST_FW_SHARED_AREA2; 1110 address < IPW_HOST_FW_SHARED_AREA2_END; address += 4) 1111 write_nic_dword(priv->net_dev, address, 0); 1112 for (address = IPW_HOST_FW_SHARED_AREA3; 1113 address < IPW_HOST_FW_SHARED_AREA3_END; address += 4) 1114 write_nic_dword(priv->net_dev, address, 0); 1115 for (address = IPW_HOST_FW_INTERRUPT_AREA; 1116 address < IPW_HOST_FW_INTERRUPT_AREA_END; address += 4) 1117 write_nic_dword(priv->net_dev, address, 0); 1118 1119 return 0; 1120 1121 fail: 1122 ipw2100_release_firmware(priv, &ipw2100_firmware); 1123 return err; 1124 } 1125 1126 static inline void ipw2100_enable_interrupts(struct ipw2100_priv *priv) 1127 { 1128 if (priv->status & STATUS_INT_ENABLED) 1129 return; 1130 priv->status |= STATUS_INT_ENABLED; 1131 write_register(priv->net_dev, IPW_REG_INTA_MASK, IPW_INTERRUPT_MASK); 1132 } 1133 1134 static inline void ipw2100_disable_interrupts(struct ipw2100_priv *priv) 1135 { 1136 if (!(priv->status & STATUS_INT_ENABLED)) 1137 return; 1138 priv->status &= ~STATUS_INT_ENABLED; 1139 write_register(priv->net_dev, IPW_REG_INTA_MASK, 0x0); 1140 } 1141 1142 static void ipw2100_initialize_ordinals(struct ipw2100_priv *priv) 1143 { 1144 struct ipw2100_ordinals *ord = &priv->ordinals; 1145 1146 IPW_DEBUG_INFO("enter\n"); 1147 1148 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_ORDINALS_TABLE_1, 1149 &ord->table1_addr); 1150 1151 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_ORDINALS_TABLE_2, 1152 &ord->table2_addr); 1153 1154 read_nic_dword(priv->net_dev, ord->table1_addr, &ord->table1_size); 1155 read_nic_dword(priv->net_dev, ord->table2_addr, &ord->table2_size); 1156 1157 ord->table2_size &= 0x0000FFFF; 1158 1159 IPW_DEBUG_INFO("table 1 size: %d\n", ord->table1_size); 1160 IPW_DEBUG_INFO("table 2 size: %d\n", ord->table2_size); 1161 IPW_DEBUG_INFO("exit\n"); 1162 } 1163 1164 static inline void ipw2100_hw_set_gpio(struct ipw2100_priv *priv) 1165 { 1166 u32 reg = 0; 1167 /* 1168 * Set GPIO 3 writable by FW; GPIO 1 writable 1169 * by driver and enable clock 1170 */ 1171 reg = (IPW_BIT_GPIO_GPIO3_MASK | IPW_BIT_GPIO_GPIO1_ENABLE | 1172 IPW_BIT_GPIO_LED_OFF); 1173 write_register(priv->net_dev, IPW_REG_GPIO, reg); 1174 } 1175 1176 static int rf_kill_active(struct ipw2100_priv *priv) 1177 { 1178 #define MAX_RF_KILL_CHECKS 5 1179 #define RF_KILL_CHECK_DELAY 40 1180 1181 unsigned short value = 0; 1182 u32 reg = 0; 1183 int i; 1184 1185 if (!(priv->hw_features & HW_FEATURE_RFKILL)) { 1186 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, false); 1187 priv->status &= ~STATUS_RF_KILL_HW; 1188 return 0; 1189 } 1190 1191 for (i = 0; i < MAX_RF_KILL_CHECKS; i++) { 1192 udelay(RF_KILL_CHECK_DELAY); 1193 read_register(priv->net_dev, IPW_REG_GPIO, &reg); 1194 value = (value << 1) | ((reg & IPW_BIT_GPIO_RF_KILL) ? 0 : 1); 1195 } 1196 1197 if (value == 0) { 1198 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, true); 1199 priv->status |= STATUS_RF_KILL_HW; 1200 } else { 1201 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, false); 1202 priv->status &= ~STATUS_RF_KILL_HW; 1203 } 1204 1205 return (value == 0); 1206 } 1207 1208 static int ipw2100_get_hw_features(struct ipw2100_priv *priv) 1209 { 1210 u32 addr, len; 1211 u32 val; 1212 1213 /* 1214 * EEPROM_SRAM_DB_START_ADDRESS using ordinal in ordinal table 1 1215 */ 1216 len = sizeof(addr); 1217 if (ipw2100_get_ordinal 1218 (priv, IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, &addr, &len)) { 1219 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 1220 __LINE__); 1221 return -EIO; 1222 } 1223 1224 IPW_DEBUG_INFO("EEPROM address: %08X\n", addr); 1225 1226 /* 1227 * EEPROM version is the byte at offset 0xfd in firmware 1228 * We read 4 bytes, then shift out the byte we actually want */ 1229 read_nic_dword(priv->net_dev, addr + 0xFC, &val); 1230 priv->eeprom_version = (val >> 24) & 0xFF; 1231 IPW_DEBUG_INFO("EEPROM version: %d\n", priv->eeprom_version); 1232 1233 /* 1234 * HW RF Kill enable is bit 0 in byte at offset 0x21 in firmware 1235 * 1236 * notice that the EEPROM bit is reverse polarity, i.e. 1237 * bit = 0 signifies HW RF kill switch is supported 1238 * bit = 1 signifies HW RF kill switch is NOT supported 1239 */ 1240 read_nic_dword(priv->net_dev, addr + 0x20, &val); 1241 if (!((val >> 24) & 0x01)) 1242 priv->hw_features |= HW_FEATURE_RFKILL; 1243 1244 IPW_DEBUG_INFO("HW RF Kill: %ssupported.\n", 1245 (priv->hw_features & HW_FEATURE_RFKILL) ? "" : "not "); 1246 1247 return 0; 1248 } 1249 1250 /* 1251 * Start firmware execution after power on and intialization 1252 * The sequence is: 1253 * 1. Release ARC 1254 * 2. Wait for f/w initialization completes; 1255 */ 1256 static int ipw2100_start_adapter(struct ipw2100_priv *priv) 1257 { 1258 int i; 1259 u32 inta, inta_mask, gpio; 1260 1261 IPW_DEBUG_INFO("enter\n"); 1262 1263 if (priv->status & STATUS_RUNNING) 1264 return 0; 1265 1266 /* 1267 * Initialize the hw - drive adapter to DO state by setting 1268 * init_done bit. Wait for clk_ready bit and Download 1269 * fw & dino ucode 1270 */ 1271 if (ipw2100_download_firmware(priv)) { 1272 printk(KERN_ERR DRV_NAME 1273 ": %s: Failed to power on the adapter.\n", 1274 priv->net_dev->name); 1275 return -EIO; 1276 } 1277 1278 /* Clear the Tx, Rx and Msg queues and the r/w indexes 1279 * in the firmware RBD and TBD ring queue */ 1280 ipw2100_queues_initialize(priv); 1281 1282 ipw2100_hw_set_gpio(priv); 1283 1284 /* TODO -- Look at disabling interrupts here to make sure none 1285 * get fired during FW initialization */ 1286 1287 /* Release ARC - clear reset bit */ 1288 write_register(priv->net_dev, IPW_REG_RESET_REG, 0); 1289 1290 /* wait for f/w intialization complete */ 1291 IPW_DEBUG_FW("Waiting for f/w initialization to complete...\n"); 1292 i = 5000; 1293 do { 1294 schedule_timeout_uninterruptible(msecs_to_jiffies(40)); 1295 /* Todo... wait for sync command ... */ 1296 1297 read_register(priv->net_dev, IPW_REG_INTA, &inta); 1298 1299 /* check "init done" bit */ 1300 if (inta & IPW2100_INTA_FW_INIT_DONE) { 1301 /* reset "init done" bit */ 1302 write_register(priv->net_dev, IPW_REG_INTA, 1303 IPW2100_INTA_FW_INIT_DONE); 1304 break; 1305 } 1306 1307 /* check error conditions : we check these after the firmware 1308 * check so that if there is an error, the interrupt handler 1309 * will see it and the adapter will be reset */ 1310 if (inta & 1311 (IPW2100_INTA_FATAL_ERROR | IPW2100_INTA_PARITY_ERROR)) { 1312 /* clear error conditions */ 1313 write_register(priv->net_dev, IPW_REG_INTA, 1314 IPW2100_INTA_FATAL_ERROR | 1315 IPW2100_INTA_PARITY_ERROR); 1316 } 1317 } while (--i); 1318 1319 /* Clear out any pending INTAs since we aren't supposed to have 1320 * interrupts enabled at this point... */ 1321 read_register(priv->net_dev, IPW_REG_INTA, &inta); 1322 read_register(priv->net_dev, IPW_REG_INTA_MASK, &inta_mask); 1323 inta &= IPW_INTERRUPT_MASK; 1324 /* Clear out any pending interrupts */ 1325 if (inta & inta_mask) 1326 write_register(priv->net_dev, IPW_REG_INTA, inta); 1327 1328 IPW_DEBUG_FW("f/w initialization complete: %s\n", 1329 i ? "SUCCESS" : "FAILED"); 1330 1331 if (!i) { 1332 printk(KERN_WARNING DRV_NAME 1333 ": %s: Firmware did not initialize.\n", 1334 priv->net_dev->name); 1335 return -EIO; 1336 } 1337 1338 /* allow firmware to write to GPIO1 & GPIO3 */ 1339 read_register(priv->net_dev, IPW_REG_GPIO, &gpio); 1340 1341 gpio |= (IPW_BIT_GPIO_GPIO1_MASK | IPW_BIT_GPIO_GPIO3_MASK); 1342 1343 write_register(priv->net_dev, IPW_REG_GPIO, gpio); 1344 1345 /* Ready to receive commands */ 1346 priv->status |= STATUS_RUNNING; 1347 1348 /* The adapter has been reset; we are not associated */ 1349 priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED); 1350 1351 IPW_DEBUG_INFO("exit\n"); 1352 1353 return 0; 1354 } 1355 1356 static inline void ipw2100_reset_fatalerror(struct ipw2100_priv *priv) 1357 { 1358 if (!priv->fatal_error) 1359 return; 1360 1361 priv->fatal_errors[priv->fatal_index++] = priv->fatal_error; 1362 priv->fatal_index %= IPW2100_ERROR_QUEUE; 1363 priv->fatal_error = 0; 1364 } 1365 1366 /* NOTE: Our interrupt is disabled when this method is called */ 1367 static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) 1368 { 1369 u32 reg; 1370 int i; 1371 1372 IPW_DEBUG_INFO("Power cycling the hardware.\n"); 1373 1374 ipw2100_hw_set_gpio(priv); 1375 1376 /* Step 1. Stop Master Assert */ 1377 write_register(priv->net_dev, IPW_REG_RESET_REG, 1378 IPW_AUX_HOST_RESET_REG_STOP_MASTER); 1379 1380 /* Step 2. Wait for stop Master Assert 1381 * (not more than 50us, otherwise ret error */ 1382 i = 5; 1383 do { 1384 udelay(IPW_WAIT_RESET_MASTER_ASSERT_COMPLETE_DELAY); 1385 read_register(priv->net_dev, IPW_REG_RESET_REG, &reg); 1386 1387 if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) 1388 break; 1389 } while (--i); 1390 1391 priv->status &= ~STATUS_RESET_PENDING; 1392 1393 if (!i) { 1394 IPW_DEBUG_INFO 1395 ("exit - waited too long for master assert stop\n"); 1396 return -EIO; 1397 } 1398 1399 write_register(priv->net_dev, IPW_REG_RESET_REG, 1400 IPW_AUX_HOST_RESET_REG_SW_RESET); 1401 1402 /* Reset any fatal_error conditions */ 1403 ipw2100_reset_fatalerror(priv); 1404 1405 /* At this point, the adapter is now stopped and disabled */ 1406 priv->status &= ~(STATUS_RUNNING | STATUS_ASSOCIATING | 1407 STATUS_ASSOCIATED | STATUS_ENABLED); 1408 1409 return 0; 1410 } 1411 1412 /* 1413 * Send the CARD_DISABLE_PHY_OFF command to the card to disable it 1414 * 1415 * After disabling, if the card was associated, a STATUS_ASSN_LOST will be sent. 1416 * 1417 * STATUS_CARD_DISABLE_NOTIFICATION will be sent regardless of 1418 * if STATUS_ASSN_LOST is sent. 1419 */ 1420 static int ipw2100_hw_phy_off(struct ipw2100_priv *priv) 1421 { 1422 1423 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 1424 1425 struct host_command cmd = { 1426 .host_command = CARD_DISABLE_PHY_OFF, 1427 .host_command_sequence = 0, 1428 .host_command_length = 0, 1429 }; 1430 int err, i; 1431 u32 val1, val2; 1432 1433 IPW_DEBUG_HC("CARD_DISABLE_PHY_OFF\n"); 1434 1435 /* Turn off the radio */ 1436 err = ipw2100_hw_send_command(priv, &cmd); 1437 if (err) 1438 return err; 1439 1440 for (i = 0; i < 2500; i++) { 1441 read_nic_dword(priv->net_dev, IPW2100_CONTROL_REG, &val1); 1442 read_nic_dword(priv->net_dev, IPW2100_COMMAND, &val2); 1443 1444 if ((val1 & IPW2100_CONTROL_PHY_OFF) && 1445 (val2 & IPW2100_COMMAND_PHY_OFF)) 1446 return 0; 1447 1448 schedule_timeout_uninterruptible(HW_PHY_OFF_LOOP_DELAY); 1449 } 1450 1451 return -EIO; 1452 } 1453 1454 static int ipw2100_enable_adapter(struct ipw2100_priv *priv) 1455 { 1456 struct host_command cmd = { 1457 .host_command = HOST_COMPLETE, 1458 .host_command_sequence = 0, 1459 .host_command_length = 0 1460 }; 1461 int err = 0; 1462 1463 IPW_DEBUG_HC("HOST_COMPLETE\n"); 1464 1465 if (priv->status & STATUS_ENABLED) 1466 return 0; 1467 1468 mutex_lock(&priv->adapter_mutex); 1469 1470 if (rf_kill_active(priv)) { 1471 IPW_DEBUG_HC("Command aborted due to RF kill active.\n"); 1472 goto fail_up; 1473 } 1474 1475 err = ipw2100_hw_send_command(priv, &cmd); 1476 if (err) { 1477 IPW_DEBUG_INFO("Failed to send HOST_COMPLETE command\n"); 1478 goto fail_up; 1479 } 1480 1481 err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_ENABLED); 1482 if (err) { 1483 IPW_DEBUG_INFO("%s: card not responding to init command.\n", 1484 priv->net_dev->name); 1485 goto fail_up; 1486 } 1487 1488 if (priv->stop_hang_check) { 1489 priv->stop_hang_check = 0; 1490 schedule_delayed_work(&priv->hang_check, HZ / 2); 1491 } 1492 1493 fail_up: 1494 mutex_unlock(&priv->adapter_mutex); 1495 return err; 1496 } 1497 1498 static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) 1499 { 1500 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 1501 1502 struct host_command cmd = { 1503 .host_command = HOST_PRE_POWER_DOWN, 1504 .host_command_sequence = 0, 1505 .host_command_length = 0, 1506 }; 1507 int err, i; 1508 u32 reg; 1509 1510 if (!(priv->status & STATUS_RUNNING)) 1511 return 0; 1512 1513 priv->status |= STATUS_STOPPING; 1514 1515 /* We can only shut down the card if the firmware is operational. So, 1516 * if we haven't reset since a fatal_error, then we can not send the 1517 * shutdown commands. */ 1518 if (!priv->fatal_error) { 1519 /* First, make sure the adapter is enabled so that the PHY_OFF 1520 * command can shut it down */ 1521 ipw2100_enable_adapter(priv); 1522 1523 err = ipw2100_hw_phy_off(priv); 1524 if (err) 1525 printk(KERN_WARNING DRV_NAME 1526 ": Error disabling radio %d\n", err); 1527 1528 /* 1529 * If in D0-standby mode going directly to D3 may cause a 1530 * PCI bus violation. Therefore we must change out of the D0 1531 * state. 1532 * 1533 * Sending the PREPARE_FOR_POWER_DOWN will restrict the 1534 * hardware from going into standby mode and will transition 1535 * out of D0-standby if it is already in that state. 1536 * 1537 * STATUS_PREPARE_POWER_DOWN_COMPLETE will be sent by the 1538 * driver upon completion. Once received, the driver can 1539 * proceed to the D3 state. 1540 * 1541 * Prepare for power down command to fw. This command would 1542 * take HW out of D0-standby and prepare it for D3 state. 1543 * 1544 * Currently FW does not support event notification for this 1545 * event. Therefore, skip waiting for it. Just wait a fixed 1546 * 100ms 1547 */ 1548 IPW_DEBUG_HC("HOST_PRE_POWER_DOWN\n"); 1549 1550 err = ipw2100_hw_send_command(priv, &cmd); 1551 if (err) 1552 printk(KERN_WARNING DRV_NAME ": " 1553 "%s: Power down command failed: Error %d\n", 1554 priv->net_dev->name, err); 1555 else 1556 schedule_timeout_uninterruptible(HW_POWER_DOWN_DELAY); 1557 } 1558 1559 priv->status &= ~STATUS_ENABLED; 1560 1561 /* 1562 * Set GPIO 3 writable by FW; GPIO 1 writable 1563 * by driver and enable clock 1564 */ 1565 ipw2100_hw_set_gpio(priv); 1566 1567 /* 1568 * Power down adapter. Sequence: 1569 * 1. Stop master assert (RESET_REG[9]=1) 1570 * 2. Wait for stop master (RESET_REG[8]==1) 1571 * 3. S/w reset assert (RESET_REG[7] = 1) 1572 */ 1573 1574 /* Stop master assert */ 1575 write_register(priv->net_dev, IPW_REG_RESET_REG, 1576 IPW_AUX_HOST_RESET_REG_STOP_MASTER); 1577 1578 /* wait stop master not more than 50 usec. 1579 * Otherwise return error. */ 1580 for (i = 5; i > 0; i--) { 1581 udelay(10); 1582 1583 /* Check master stop bit */ 1584 read_register(priv->net_dev, IPW_REG_RESET_REG, &reg); 1585 1586 if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) 1587 break; 1588 } 1589 1590 if (i == 0) 1591 printk(KERN_WARNING DRV_NAME 1592 ": %s: Could now power down adapter.\n", 1593 priv->net_dev->name); 1594 1595 /* assert s/w reset */ 1596 write_register(priv->net_dev, IPW_REG_RESET_REG, 1597 IPW_AUX_HOST_RESET_REG_SW_RESET); 1598 1599 priv->status &= ~(STATUS_RUNNING | STATUS_STOPPING); 1600 1601 return 0; 1602 } 1603 1604 static int ipw2100_disable_adapter(struct ipw2100_priv *priv) 1605 { 1606 struct host_command cmd = { 1607 .host_command = CARD_DISABLE, 1608 .host_command_sequence = 0, 1609 .host_command_length = 0 1610 }; 1611 int err = 0; 1612 1613 IPW_DEBUG_HC("CARD_DISABLE\n"); 1614 1615 if (!(priv->status & STATUS_ENABLED)) 1616 return 0; 1617 1618 /* Make sure we clear the associated state */ 1619 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); 1620 1621 if (!priv->stop_hang_check) { 1622 priv->stop_hang_check = 1; 1623 cancel_delayed_work(&priv->hang_check); 1624 } 1625 1626 mutex_lock(&priv->adapter_mutex); 1627 1628 err = ipw2100_hw_send_command(priv, &cmd); 1629 if (err) { 1630 printk(KERN_WARNING DRV_NAME 1631 ": exit - failed to send CARD_DISABLE command\n"); 1632 goto fail_up; 1633 } 1634 1635 err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_DISABLED); 1636 if (err) { 1637 printk(KERN_WARNING DRV_NAME 1638 ": exit - card failed to change to DISABLED\n"); 1639 goto fail_up; 1640 } 1641 1642 IPW_DEBUG_INFO("TODO: implement scan state machine\n"); 1643 1644 fail_up: 1645 mutex_unlock(&priv->adapter_mutex); 1646 return err; 1647 } 1648 1649 static int ipw2100_set_scan_options(struct ipw2100_priv *priv) 1650 { 1651 struct host_command cmd = { 1652 .host_command = SET_SCAN_OPTIONS, 1653 .host_command_sequence = 0, 1654 .host_command_length = 8 1655 }; 1656 int err; 1657 1658 IPW_DEBUG_INFO("enter\n"); 1659 1660 IPW_DEBUG_SCAN("setting scan options\n"); 1661 1662 cmd.host_command_parameters[0] = 0; 1663 1664 if (!(priv->config & CFG_ASSOCIATE)) 1665 cmd.host_command_parameters[0] |= IPW_SCAN_NOASSOCIATE; 1666 if ((priv->ieee->sec.flags & SEC_ENABLED) && priv->ieee->sec.enabled) 1667 cmd.host_command_parameters[0] |= IPW_SCAN_MIXED_CELL; 1668 if (priv->config & CFG_PASSIVE_SCAN) 1669 cmd.host_command_parameters[0] |= IPW_SCAN_PASSIVE; 1670 1671 cmd.host_command_parameters[1] = priv->channel_mask; 1672 1673 err = ipw2100_hw_send_command(priv, &cmd); 1674 1675 IPW_DEBUG_HC("SET_SCAN_OPTIONS 0x%04X\n", 1676 cmd.host_command_parameters[0]); 1677 1678 return err; 1679 } 1680 1681 static int ipw2100_start_scan(struct ipw2100_priv *priv) 1682 { 1683 struct host_command cmd = { 1684 .host_command = BROADCAST_SCAN, 1685 .host_command_sequence = 0, 1686 .host_command_length = 4 1687 }; 1688 int err; 1689 1690 IPW_DEBUG_HC("START_SCAN\n"); 1691 1692 cmd.host_command_parameters[0] = 0; 1693 1694 /* No scanning if in monitor mode */ 1695 if (priv->ieee->iw_mode == IW_MODE_MONITOR) 1696 return 1; 1697 1698 if (priv->status & STATUS_SCANNING) { 1699 IPW_DEBUG_SCAN("Scan requested while already in scan...\n"); 1700 return 0; 1701 } 1702 1703 IPW_DEBUG_INFO("enter\n"); 1704 1705 /* Not clearing here; doing so makes iwlist always return nothing... 1706 * 1707 * We should modify the table logic to use aging tables vs. clearing 1708 * the table on each scan start. 1709 */ 1710 IPW_DEBUG_SCAN("starting scan\n"); 1711 1712 priv->status |= STATUS_SCANNING; 1713 err = ipw2100_hw_send_command(priv, &cmd); 1714 if (err) 1715 priv->status &= ~STATUS_SCANNING; 1716 1717 IPW_DEBUG_INFO("exit\n"); 1718 1719 return err; 1720 } 1721 1722 static const struct libipw_geo ipw_geos[] = { 1723 { /* Restricted */ 1724 "---", 1725 .bg_channels = 14, 1726 .bg = {{2412, 1}, {2417, 2}, {2422, 3}, 1727 {2427, 4}, {2432, 5}, {2437, 6}, 1728 {2442, 7}, {2447, 8}, {2452, 9}, 1729 {2457, 10}, {2462, 11}, {2467, 12}, 1730 {2472, 13}, {2484, 14}}, 1731 }, 1732 }; 1733 1734 static int ipw2100_up(struct ipw2100_priv *priv, int deferred) 1735 { 1736 unsigned long flags; 1737 int rc = 0; 1738 u32 lock; 1739 u32 ord_len = sizeof(lock); 1740 1741 /* Age scan list entries found before suspend */ 1742 if (priv->suspend_time) { 1743 libipw_networks_age(priv->ieee, priv->suspend_time); 1744 priv->suspend_time = 0; 1745 } 1746 1747 /* Quiet if manually disabled. */ 1748 if (priv->status & STATUS_RF_KILL_SW) { 1749 IPW_DEBUG_INFO("%s: Radio is disabled by Manual Disable " 1750 "switch\n", priv->net_dev->name); 1751 return 0; 1752 } 1753 1754 /* the ipw2100 hardware really doesn't want power management delays 1755 * longer than 175usec 1756 */ 1757 pm_qos_update_request(&ipw2100_pm_qos_req, 175); 1758 1759 /* If the interrupt is enabled, turn it off... */ 1760 spin_lock_irqsave(&priv->low_lock, flags); 1761 ipw2100_disable_interrupts(priv); 1762 1763 /* Reset any fatal_error conditions */ 1764 ipw2100_reset_fatalerror(priv); 1765 spin_unlock_irqrestore(&priv->low_lock, flags); 1766 1767 if (priv->status & STATUS_POWERED || 1768 (priv->status & STATUS_RESET_PENDING)) { 1769 /* Power cycle the card ... */ 1770 if (ipw2100_power_cycle_adapter(priv)) { 1771 printk(KERN_WARNING DRV_NAME 1772 ": %s: Could not cycle adapter.\n", 1773 priv->net_dev->name); 1774 rc = 1; 1775 goto exit; 1776 } 1777 } else 1778 priv->status |= STATUS_POWERED; 1779 1780 /* Load the firmware, start the clocks, etc. */ 1781 if (ipw2100_start_adapter(priv)) { 1782 printk(KERN_ERR DRV_NAME 1783 ": %s: Failed to start the firmware.\n", 1784 priv->net_dev->name); 1785 rc = 1; 1786 goto exit; 1787 } 1788 1789 ipw2100_initialize_ordinals(priv); 1790 1791 /* Determine capabilities of this particular HW configuration */ 1792 if (ipw2100_get_hw_features(priv)) { 1793 printk(KERN_ERR DRV_NAME 1794 ": %s: Failed to determine HW features.\n", 1795 priv->net_dev->name); 1796 rc = 1; 1797 goto exit; 1798 } 1799 1800 /* Initialize the geo */ 1801 libipw_set_geo(priv->ieee, &ipw_geos[0]); 1802 priv->ieee->freq_band = LIBIPW_24GHZ_BAND; 1803 1804 lock = LOCK_NONE; 1805 if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) { 1806 printk(KERN_ERR DRV_NAME 1807 ": %s: Failed to clear ordinal lock.\n", 1808 priv->net_dev->name); 1809 rc = 1; 1810 goto exit; 1811 } 1812 1813 priv->status &= ~STATUS_SCANNING; 1814 1815 if (rf_kill_active(priv)) { 1816 printk(KERN_INFO "%s: Radio is disabled by RF switch.\n", 1817 priv->net_dev->name); 1818 1819 if (priv->stop_rf_kill) { 1820 priv->stop_rf_kill = 0; 1821 schedule_delayed_work(&priv->rf_kill, 1822 round_jiffies_relative(HZ)); 1823 } 1824 1825 deferred = 1; 1826 } 1827 1828 /* Turn on the interrupt so that commands can be processed */ 1829 ipw2100_enable_interrupts(priv); 1830 1831 /* Send all of the commands that must be sent prior to 1832 * HOST_COMPLETE */ 1833 if (ipw2100_adapter_setup(priv)) { 1834 printk(KERN_ERR DRV_NAME ": %s: Failed to start the card.\n", 1835 priv->net_dev->name); 1836 rc = 1; 1837 goto exit; 1838 } 1839 1840 if (!deferred) { 1841 /* Enable the adapter - sends HOST_COMPLETE */ 1842 if (ipw2100_enable_adapter(priv)) { 1843 printk(KERN_ERR DRV_NAME ": " 1844 "%s: failed in call to enable adapter.\n", 1845 priv->net_dev->name); 1846 ipw2100_hw_stop_adapter(priv); 1847 rc = 1; 1848 goto exit; 1849 } 1850 1851 /* Start a scan . . . */ 1852 ipw2100_set_scan_options(priv); 1853 ipw2100_start_scan(priv); 1854 } 1855 1856 exit: 1857 return rc; 1858 } 1859 1860 static void ipw2100_down(struct ipw2100_priv *priv) 1861 { 1862 unsigned long flags; 1863 union iwreq_data wrqu = { 1864 .ap_addr = { 1865 .sa_family = ARPHRD_ETHER} 1866 }; 1867 int associated = priv->status & STATUS_ASSOCIATED; 1868 1869 /* Kill the RF switch timer */ 1870 if (!priv->stop_rf_kill) { 1871 priv->stop_rf_kill = 1; 1872 cancel_delayed_work(&priv->rf_kill); 1873 } 1874 1875 /* Kill the firmware hang check timer */ 1876 if (!priv->stop_hang_check) { 1877 priv->stop_hang_check = 1; 1878 cancel_delayed_work(&priv->hang_check); 1879 } 1880 1881 /* Kill any pending resets */ 1882 if (priv->status & STATUS_RESET_PENDING) 1883 cancel_delayed_work(&priv->reset_work); 1884 1885 /* Make sure the interrupt is on so that FW commands will be 1886 * processed correctly */ 1887 spin_lock_irqsave(&priv->low_lock, flags); 1888 ipw2100_enable_interrupts(priv); 1889 spin_unlock_irqrestore(&priv->low_lock, flags); 1890 1891 if (ipw2100_hw_stop_adapter(priv)) 1892 printk(KERN_ERR DRV_NAME ": %s: Error stopping adapter.\n", 1893 priv->net_dev->name); 1894 1895 /* Do not disable the interrupt until _after_ we disable 1896 * the adaptor. Otherwise the CARD_DISABLE command will never 1897 * be ack'd by the firmware */ 1898 spin_lock_irqsave(&priv->low_lock, flags); 1899 ipw2100_disable_interrupts(priv); 1900 spin_unlock_irqrestore(&priv->low_lock, flags); 1901 1902 pm_qos_update_request(&ipw2100_pm_qos_req, PM_QOS_DEFAULT_VALUE); 1903 1904 /* We have to signal any supplicant if we are disassociating */ 1905 if (associated) 1906 wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); 1907 1908 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); 1909 netif_carrier_off(priv->net_dev); 1910 netif_stop_queue(priv->net_dev); 1911 } 1912 1913 static int ipw2100_wdev_init(struct net_device *dev) 1914 { 1915 struct ipw2100_priv *priv = libipw_priv(dev); 1916 const struct libipw_geo *geo = libipw_get_geo(priv->ieee); 1917 struct wireless_dev *wdev = &priv->ieee->wdev; 1918 int i; 1919 1920 memcpy(wdev->wiphy->perm_addr, priv->mac_addr, ETH_ALEN); 1921 1922 /* fill-out priv->ieee->bg_band */ 1923 if (geo->bg_channels) { 1924 struct ieee80211_supported_band *bg_band = &priv->ieee->bg_band; 1925 1926 bg_band->band = IEEE80211_BAND_2GHZ; 1927 bg_band->n_channels = geo->bg_channels; 1928 bg_band->channels = kcalloc(geo->bg_channels, 1929 sizeof(struct ieee80211_channel), 1930 GFP_KERNEL); 1931 if (!bg_band->channels) { 1932 ipw2100_down(priv); 1933 return -ENOMEM; 1934 } 1935 /* translate geo->bg to bg_band.channels */ 1936 for (i = 0; i < geo->bg_channels; i++) { 1937 bg_band->channels[i].band = IEEE80211_BAND_2GHZ; 1938 bg_band->channels[i].center_freq = geo->bg[i].freq; 1939 bg_band->channels[i].hw_value = geo->bg[i].channel; 1940 bg_band->channels[i].max_power = geo->bg[i].max_power; 1941 if (geo->bg[i].flags & LIBIPW_CH_PASSIVE_ONLY) 1942 bg_band->channels[i].flags |= 1943 IEEE80211_CHAN_NO_IR; 1944 if (geo->bg[i].flags & LIBIPW_CH_NO_IBSS) 1945 bg_band->channels[i].flags |= 1946 IEEE80211_CHAN_NO_IR; 1947 if (geo->bg[i].flags & LIBIPW_CH_RADAR_DETECT) 1948 bg_band->channels[i].flags |= 1949 IEEE80211_CHAN_RADAR; 1950 /* No equivalent for LIBIPW_CH_80211H_RULES, 1951 LIBIPW_CH_UNIFORM_SPREADING, or 1952 LIBIPW_CH_B_ONLY... */ 1953 } 1954 /* point at bitrate info */ 1955 bg_band->bitrates = ipw2100_bg_rates; 1956 bg_band->n_bitrates = RATE_COUNT; 1957 1958 wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = bg_band; 1959 } 1960 1961 wdev->wiphy->cipher_suites = ipw_cipher_suites; 1962 wdev->wiphy->n_cipher_suites = ARRAY_SIZE(ipw_cipher_suites); 1963 1964 set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev); 1965 if (wiphy_register(wdev->wiphy)) 1966 return -EIO; 1967 return 0; 1968 } 1969 1970 static void ipw2100_reset_adapter(struct work_struct *work) 1971 { 1972 struct ipw2100_priv *priv = 1973 container_of(work, struct ipw2100_priv, reset_work.work); 1974 unsigned long flags; 1975 union iwreq_data wrqu = { 1976 .ap_addr = { 1977 .sa_family = ARPHRD_ETHER} 1978 }; 1979 int associated = priv->status & STATUS_ASSOCIATED; 1980 1981 spin_lock_irqsave(&priv->low_lock, flags); 1982 IPW_DEBUG_INFO(": %s: Restarting adapter.\n", priv->net_dev->name); 1983 priv->resets++; 1984 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); 1985 priv->status |= STATUS_SECURITY_UPDATED; 1986 1987 /* Force a power cycle even if interface hasn't been opened 1988 * yet */ 1989 cancel_delayed_work(&priv->reset_work); 1990 priv->status |= STATUS_RESET_PENDING; 1991 spin_unlock_irqrestore(&priv->low_lock, flags); 1992 1993 mutex_lock(&priv->action_mutex); 1994 /* stop timed checks so that they don't interfere with reset */ 1995 priv->stop_hang_check = 1; 1996 cancel_delayed_work(&priv->hang_check); 1997 1998 /* We have to signal any supplicant if we are disassociating */ 1999 if (associated) 2000 wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); 2001 2002 ipw2100_up(priv, 0); 2003 mutex_unlock(&priv->action_mutex); 2004 2005 } 2006 2007 static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) 2008 { 2009 2010 #define MAC_ASSOCIATION_READ_DELAY (HZ) 2011 int ret; 2012 unsigned int len, essid_len; 2013 char essid[IW_ESSID_MAX_SIZE]; 2014 u32 txrate; 2015 u32 chan; 2016 char *txratename; 2017 u8 bssid[ETH_ALEN]; 2018 DECLARE_SSID_BUF(ssid); 2019 2020 /* 2021 * TBD: BSSID is usually 00:00:00:00:00:00 here and not 2022 * an actual MAC of the AP. Seems like FW sets this 2023 * address too late. Read it later and expose through 2024 * /proc or schedule a later task to query and update 2025 */ 2026 2027 essid_len = IW_ESSID_MAX_SIZE; 2028 ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_SSID, 2029 essid, &essid_len); 2030 if (ret) { 2031 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 2032 __LINE__); 2033 return; 2034 } 2035 2036 len = sizeof(u32); 2037 ret = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &txrate, &len); 2038 if (ret) { 2039 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 2040 __LINE__); 2041 return; 2042 } 2043 2044 len = sizeof(u32); 2045 ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &len); 2046 if (ret) { 2047 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 2048 __LINE__); 2049 return; 2050 } 2051 len = ETH_ALEN; 2052 ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, bssid, 2053 &len); 2054 if (ret) { 2055 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 2056 __LINE__); 2057 return; 2058 } 2059 memcpy(priv->ieee->bssid, bssid, ETH_ALEN); 2060 2061 switch (txrate) { 2062 case TX_RATE_1_MBIT: 2063 txratename = "1Mbps"; 2064 break; 2065 case TX_RATE_2_MBIT: 2066 txratename = "2Mbsp"; 2067 break; 2068 case TX_RATE_5_5_MBIT: 2069 txratename = "5.5Mbps"; 2070 break; 2071 case TX_RATE_11_MBIT: 2072 txratename = "11Mbps"; 2073 break; 2074 default: 2075 IPW_DEBUG_INFO("Unknown rate: %d\n", txrate); 2076 txratename = "unknown rate"; 2077 break; 2078 } 2079 2080 IPW_DEBUG_INFO("%s: Associated with '%s' at %s, channel %d (BSSID=%pM)\n", 2081 priv->net_dev->name, print_ssid(ssid, essid, essid_len), 2082 txratename, chan, bssid); 2083 2084 /* now we copy read ssid into dev */ 2085 if (!(priv->config & CFG_STATIC_ESSID)) { 2086 priv->essid_len = min((u8) essid_len, (u8) IW_ESSID_MAX_SIZE); 2087 memcpy(priv->essid, essid, priv->essid_len); 2088 } 2089 priv->channel = chan; 2090 memcpy(priv->bssid, bssid, ETH_ALEN); 2091 2092 priv->status |= STATUS_ASSOCIATING; 2093 priv->connect_start = get_seconds(); 2094 2095 schedule_delayed_work(&priv->wx_event_work, HZ / 10); 2096 } 2097 2098 static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, 2099 int length, int batch_mode) 2100 { 2101 int ssid_len = min(length, IW_ESSID_MAX_SIZE); 2102 struct host_command cmd = { 2103 .host_command = SSID, 2104 .host_command_sequence = 0, 2105 .host_command_length = ssid_len 2106 }; 2107 int err; 2108 DECLARE_SSID_BUF(ssid); 2109 2110 IPW_DEBUG_HC("SSID: '%s'\n", print_ssid(ssid, essid, ssid_len)); 2111 2112 if (ssid_len) 2113 memcpy(cmd.host_command_parameters, essid, ssid_len); 2114 2115 if (!batch_mode) { 2116 err = ipw2100_disable_adapter(priv); 2117 if (err) 2118 return err; 2119 } 2120 2121 /* Bug in FW currently doesn't honor bit 0 in SET_SCAN_OPTIONS to 2122 * disable auto association -- so we cheat by setting a bogus SSID */ 2123 if (!ssid_len && !(priv->config & CFG_ASSOCIATE)) { 2124 int i; 2125 u8 *bogus = (u8 *) cmd.host_command_parameters; 2126 for (i = 0; i < IW_ESSID_MAX_SIZE; i++) 2127 bogus[i] = 0x18 + i; 2128 cmd.host_command_length = IW_ESSID_MAX_SIZE; 2129 } 2130 2131 /* NOTE: We always send the SSID command even if the provided ESSID is 2132 * the same as what we currently think is set. */ 2133 2134 err = ipw2100_hw_send_command(priv, &cmd); 2135 if (!err) { 2136 memset(priv->essid + ssid_len, 0, IW_ESSID_MAX_SIZE - ssid_len); 2137 memcpy(priv->essid, essid, ssid_len); 2138 priv->essid_len = ssid_len; 2139 } 2140 2141 if (!batch_mode) { 2142 if (ipw2100_enable_adapter(priv)) 2143 err = -EIO; 2144 } 2145 2146 return err; 2147 } 2148 2149 static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status) 2150 { 2151 DECLARE_SSID_BUF(ssid); 2152 2153 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, 2154 "disassociated: '%s' %pM\n", 2155 print_ssid(ssid, priv->essid, priv->essid_len), 2156 priv->bssid); 2157 2158 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); 2159 2160 if (priv->status & STATUS_STOPPING) { 2161 IPW_DEBUG_INFO("Card is stopping itself, discard ASSN_LOST.\n"); 2162 return; 2163 } 2164 2165 memset(priv->bssid, 0, ETH_ALEN); 2166 memset(priv->ieee->bssid, 0, ETH_ALEN); 2167 2168 netif_carrier_off(priv->net_dev); 2169 netif_stop_queue(priv->net_dev); 2170 2171 if (!(priv->status & STATUS_RUNNING)) 2172 return; 2173 2174 if (priv->status & STATUS_SECURITY_UPDATED) 2175 schedule_delayed_work(&priv->security_work, 0); 2176 2177 schedule_delayed_work(&priv->wx_event_work, 0); 2178 } 2179 2180 static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) 2181 { 2182 IPW_DEBUG_INFO("%s: RF Kill state changed to radio OFF.\n", 2183 priv->net_dev->name); 2184 2185 /* RF_KILL is now enabled (else we wouldn't be here) */ 2186 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, true); 2187 priv->status |= STATUS_RF_KILL_HW; 2188 2189 /* Make sure the RF Kill check timer is running */ 2190 priv->stop_rf_kill = 0; 2191 mod_delayed_work(system_wq, &priv->rf_kill, round_jiffies_relative(HZ)); 2192 } 2193 2194 static void ipw2100_scan_event(struct work_struct *work) 2195 { 2196 struct ipw2100_priv *priv = container_of(work, struct ipw2100_priv, 2197 scan_event.work); 2198 union iwreq_data wrqu; 2199 2200 wrqu.data.length = 0; 2201 wrqu.data.flags = 0; 2202 wireless_send_event(priv->net_dev, SIOCGIWSCAN, &wrqu, NULL); 2203 } 2204 2205 static void isr_scan_complete(struct ipw2100_priv *priv, u32 status) 2206 { 2207 IPW_DEBUG_SCAN("scan complete\n"); 2208 /* Age the scan results... */ 2209 priv->ieee->scans++; 2210 priv->status &= ~STATUS_SCANNING; 2211 2212 /* Only userspace-requested scan completion events go out immediately */ 2213 if (!priv->user_requested_scan) { 2214 schedule_delayed_work(&priv->scan_event, 2215 round_jiffies_relative(msecs_to_jiffies(4000))); 2216 } else { 2217 priv->user_requested_scan = 0; 2218 mod_delayed_work(system_wq, &priv->scan_event, 0); 2219 } 2220 } 2221 2222 #ifdef CONFIG_IPW2100_DEBUG 2223 #define IPW2100_HANDLER(v, f) { v, f, # v } 2224 struct ipw2100_status_indicator { 2225 int status; 2226 void (*cb) (struct ipw2100_priv * priv, u32 status); 2227 char *name; 2228 }; 2229 #else 2230 #define IPW2100_HANDLER(v, f) { v, f } 2231 struct ipw2100_status_indicator { 2232 int status; 2233 void (*cb) (struct ipw2100_priv * priv, u32 status); 2234 }; 2235 #endif /* CONFIG_IPW2100_DEBUG */ 2236 2237 static void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status) 2238 { 2239 IPW_DEBUG_SCAN("Scanning...\n"); 2240 priv->status |= STATUS_SCANNING; 2241 } 2242 2243 static const struct ipw2100_status_indicator status_handlers[] = { 2244 IPW2100_HANDLER(IPW_STATE_INITIALIZED, NULL), 2245 IPW2100_HANDLER(IPW_STATE_COUNTRY_FOUND, NULL), 2246 IPW2100_HANDLER(IPW_STATE_ASSOCIATED, isr_indicate_associated), 2247 IPW2100_HANDLER(IPW_STATE_ASSN_LOST, isr_indicate_association_lost), 2248 IPW2100_HANDLER(IPW_STATE_ASSN_CHANGED, NULL), 2249 IPW2100_HANDLER(IPW_STATE_SCAN_COMPLETE, isr_scan_complete), 2250 IPW2100_HANDLER(IPW_STATE_ENTERED_PSP, NULL), 2251 IPW2100_HANDLER(IPW_STATE_LEFT_PSP, NULL), 2252 IPW2100_HANDLER(IPW_STATE_RF_KILL, isr_indicate_rf_kill), 2253 IPW2100_HANDLER(IPW_STATE_DISABLED, NULL), 2254 IPW2100_HANDLER(IPW_STATE_POWER_DOWN, NULL), 2255 IPW2100_HANDLER(IPW_STATE_SCANNING, isr_indicate_scanning), 2256 IPW2100_HANDLER(-1, NULL) 2257 }; 2258 2259 static void isr_status_change(struct ipw2100_priv *priv, int status) 2260 { 2261 int i; 2262 2263 if (status == IPW_STATE_SCANNING && 2264 priv->status & STATUS_ASSOCIATED && 2265 !(priv->status & STATUS_SCANNING)) { 2266 IPW_DEBUG_INFO("Scan detected while associated, with " 2267 "no scan request. Restarting firmware.\n"); 2268 2269 /* Wake up any sleeping jobs */ 2270 schedule_reset(priv); 2271 } 2272 2273 for (i = 0; status_handlers[i].status != -1; i++) { 2274 if (status == status_handlers[i].status) { 2275 IPW_DEBUG_NOTIF("Status change: %s\n", 2276 status_handlers[i].name); 2277 if (status_handlers[i].cb) 2278 status_handlers[i].cb(priv, status); 2279 priv->wstats.status = status; 2280 return; 2281 } 2282 } 2283 2284 IPW_DEBUG_NOTIF("unknown status received: %04x\n", status); 2285 } 2286 2287 static void isr_rx_complete_command(struct ipw2100_priv *priv, 2288 struct ipw2100_cmd_header *cmd) 2289 { 2290 #ifdef CONFIG_IPW2100_DEBUG 2291 if (cmd->host_command_reg < ARRAY_SIZE(command_types)) { 2292 IPW_DEBUG_HC("Command completed '%s (%d)'\n", 2293 command_types[cmd->host_command_reg], 2294 cmd->host_command_reg); 2295 } 2296 #endif 2297 if (cmd->host_command_reg == HOST_COMPLETE) 2298 priv->status |= STATUS_ENABLED; 2299 2300 if (cmd->host_command_reg == CARD_DISABLE) 2301 priv->status &= ~STATUS_ENABLED; 2302 2303 priv->status &= ~STATUS_CMD_ACTIVE; 2304 2305 wake_up_interruptible(&priv->wait_command_queue); 2306 } 2307 2308 #ifdef CONFIG_IPW2100_DEBUG 2309 static const char *frame_types[] = { 2310 "COMMAND_STATUS_VAL", 2311 "STATUS_CHANGE_VAL", 2312 "P80211_DATA_VAL", 2313 "P8023_DATA_VAL", 2314 "HOST_NOTIFICATION_VAL" 2315 }; 2316 #endif 2317 2318 static int ipw2100_alloc_skb(struct ipw2100_priv *priv, 2319 struct ipw2100_rx_packet *packet) 2320 { 2321 packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx)); 2322 if (!packet->skb) 2323 return -ENOMEM; 2324 2325 packet->rxp = (struct ipw2100_rx *)packet->skb->data; 2326 packet->dma_addr = pci_map_single(priv->pci_dev, packet->skb->data, 2327 sizeof(struct ipw2100_rx), 2328 PCI_DMA_FROMDEVICE); 2329 /* NOTE: pci_map_single does not return an error code, and 0 is a valid 2330 * dma_addr */ 2331 2332 return 0; 2333 } 2334 2335 #define SEARCH_ERROR 0xffffffff 2336 #define SEARCH_FAIL 0xfffffffe 2337 #define SEARCH_SUCCESS 0xfffffff0 2338 #define SEARCH_DISCARD 0 2339 #define SEARCH_SNAPSHOT 1 2340 2341 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 2342 static void ipw2100_snapshot_free(struct ipw2100_priv *priv) 2343 { 2344 int i; 2345 if (!priv->snapshot[0]) 2346 return; 2347 for (i = 0; i < 0x30; i++) 2348 kfree(priv->snapshot[i]); 2349 priv->snapshot[0] = NULL; 2350 } 2351 2352 #ifdef IPW2100_DEBUG_C3 2353 static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) 2354 { 2355 int i; 2356 if (priv->snapshot[0]) 2357 return 1; 2358 for (i = 0; i < 0x30; i++) { 2359 priv->snapshot[i] = kmalloc(0x1000, GFP_ATOMIC); 2360 if (!priv->snapshot[i]) { 2361 IPW_DEBUG_INFO("%s: Error allocating snapshot " 2362 "buffer %d\n", priv->net_dev->name, i); 2363 while (i > 0) 2364 kfree(priv->snapshot[--i]); 2365 priv->snapshot[0] = NULL; 2366 return 0; 2367 } 2368 } 2369 2370 return 1; 2371 } 2372 2373 static u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, 2374 size_t len, int mode) 2375 { 2376 u32 i, j; 2377 u32 tmp; 2378 u8 *s, *d; 2379 u32 ret; 2380 2381 s = in_buf; 2382 if (mode == SEARCH_SNAPSHOT) { 2383 if (!ipw2100_snapshot_alloc(priv)) 2384 mode = SEARCH_DISCARD; 2385 } 2386 2387 for (ret = SEARCH_FAIL, i = 0; i < 0x30000; i += 4) { 2388 read_nic_dword(priv->net_dev, i, &tmp); 2389 if (mode == SEARCH_SNAPSHOT) 2390 *(u32 *) SNAPSHOT_ADDR(i) = tmp; 2391 if (ret == SEARCH_FAIL) { 2392 d = (u8 *) & tmp; 2393 for (j = 0; j < 4; j++) { 2394 if (*s != *d) { 2395 s = in_buf; 2396 continue; 2397 } 2398 2399 s++; 2400 d++; 2401 2402 if ((s - in_buf) == len) 2403 ret = (i + j) - len + 1; 2404 } 2405 } else if (mode == SEARCH_DISCARD) 2406 return ret; 2407 } 2408 2409 return ret; 2410 } 2411 #endif 2412 2413 /* 2414 * 2415 * 0) Disconnect the SKB from the firmware (just unmap) 2416 * 1) Pack the ETH header into the SKB 2417 * 2) Pass the SKB to the network stack 2418 * 2419 * When packet is provided by the firmware, it contains the following: 2420 * 2421 * . libipw_hdr 2422 * . libipw_snap_hdr 2423 * 2424 * The size of the constructed ethernet 2425 * 2426 */ 2427 #ifdef IPW2100_RX_DEBUG 2428 static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; 2429 #endif 2430 2431 static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) 2432 { 2433 #ifdef IPW2100_DEBUG_C3 2434 struct ipw2100_status *status = &priv->status_queue.drv[i]; 2435 u32 match, reg; 2436 int j; 2437 #endif 2438 2439 IPW_DEBUG_INFO(": PCI latency error detected at 0x%04zX.\n", 2440 i * sizeof(struct ipw2100_status)); 2441 2442 #ifdef IPW2100_DEBUG_C3 2443 /* Halt the firmware so we can get a good image */ 2444 write_register(priv->net_dev, IPW_REG_RESET_REG, 2445 IPW_AUX_HOST_RESET_REG_STOP_MASTER); 2446 j = 5; 2447 do { 2448 udelay(IPW_WAIT_RESET_MASTER_ASSERT_COMPLETE_DELAY); 2449 read_register(priv->net_dev, IPW_REG_RESET_REG, &reg); 2450 2451 if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) 2452 break; 2453 } while (j--); 2454 2455 match = ipw2100_match_buf(priv, (u8 *) status, 2456 sizeof(struct ipw2100_status), 2457 SEARCH_SNAPSHOT); 2458 if (match < SEARCH_SUCCESS) 2459 IPW_DEBUG_INFO("%s: DMA status match in Firmware at " 2460 "offset 0x%06X, length %d:\n", 2461 priv->net_dev->name, match, 2462 sizeof(struct ipw2100_status)); 2463 else 2464 IPW_DEBUG_INFO("%s: No DMA status match in " 2465 "Firmware.\n", priv->net_dev->name); 2466 2467 printk_buf((u8 *) priv->status_queue.drv, 2468 sizeof(struct ipw2100_status) * RX_QUEUE_LENGTH); 2469 #endif 2470 2471 priv->fatal_error = IPW2100_ERR_C3_CORRUPTION; 2472 priv->net_dev->stats.rx_errors++; 2473 schedule_reset(priv); 2474 } 2475 2476 static void isr_rx(struct ipw2100_priv *priv, int i, 2477 struct libipw_rx_stats *stats) 2478 { 2479 struct net_device *dev = priv->net_dev; 2480 struct ipw2100_status *status = &priv->status_queue.drv[i]; 2481 struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; 2482 2483 IPW_DEBUG_RX("Handler...\n"); 2484 2485 if (unlikely(status->frame_size > skb_tailroom(packet->skb))) { 2486 IPW_DEBUG_INFO("%s: frame_size (%u) > skb_tailroom (%u)!" 2487 " Dropping.\n", 2488 dev->name, 2489 status->frame_size, skb_tailroom(packet->skb)); 2490 dev->stats.rx_errors++; 2491 return; 2492 } 2493 2494 if (unlikely(!netif_running(dev))) { 2495 dev->stats.rx_errors++; 2496 priv->wstats.discard.misc++; 2497 IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); 2498 return; 2499 } 2500 2501 if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && 2502 !(priv->status & STATUS_ASSOCIATED))) { 2503 IPW_DEBUG_DROP("Dropping packet while not associated.\n"); 2504 priv->wstats.discard.misc++; 2505 return; 2506 } 2507 2508 pci_unmap_single(priv->pci_dev, 2509 packet->dma_addr, 2510 sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE); 2511 2512 skb_put(packet->skb, status->frame_size); 2513 2514 #ifdef IPW2100_RX_DEBUG 2515 /* Make a copy of the frame so we can dump it to the logs if 2516 * libipw_rx fails */ 2517 skb_copy_from_linear_data(packet->skb, packet_data, 2518 min_t(u32, status->frame_size, 2519 IPW_RX_NIC_BUFFER_LENGTH)); 2520 #endif 2521 2522 if (!libipw_rx(priv->ieee, packet->skb, stats)) { 2523 #ifdef IPW2100_RX_DEBUG 2524 IPW_DEBUG_DROP("%s: Non consumed packet:\n", 2525 dev->name); 2526 printk_buf(IPW_DL_DROP, packet_data, status->frame_size); 2527 #endif 2528 dev->stats.rx_errors++; 2529 2530 /* libipw_rx failed, so it didn't free the SKB */ 2531 dev_kfree_skb_any(packet->skb); 2532 packet->skb = NULL; 2533 } 2534 2535 /* We need to allocate a new SKB and attach it to the RDB. */ 2536 if (unlikely(ipw2100_alloc_skb(priv, packet))) { 2537 printk(KERN_WARNING DRV_NAME ": " 2538 "%s: Unable to allocate SKB onto RBD ring - disabling " 2539 "adapter.\n", dev->name); 2540 /* TODO: schedule adapter shutdown */ 2541 IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); 2542 } 2543 2544 /* Update the RDB entry */ 2545 priv->rx_queue.drv[i].host_addr = packet->dma_addr; 2546 } 2547 2548 #ifdef CONFIG_IPW2100_MONITOR 2549 2550 static void isr_rx_monitor(struct ipw2100_priv *priv, int i, 2551 struct libipw_rx_stats *stats) 2552 { 2553 struct net_device *dev = priv->net_dev; 2554 struct ipw2100_status *status = &priv->status_queue.drv[i]; 2555 struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; 2556 2557 /* Magic struct that slots into the radiotap header -- no reason 2558 * to build this manually element by element, we can write it much 2559 * more efficiently than we can parse it. ORDER MATTERS HERE */ 2560 struct ipw_rt_hdr { 2561 struct ieee80211_radiotap_header rt_hdr; 2562 s8 rt_dbmsignal; /* signal in dbM, kluged to signed */ 2563 } *ipw_rt; 2564 2565 IPW_DEBUG_RX("Handler...\n"); 2566 2567 if (unlikely(status->frame_size > skb_tailroom(packet->skb) - 2568 sizeof(struct ipw_rt_hdr))) { 2569 IPW_DEBUG_INFO("%s: frame_size (%u) > skb_tailroom (%u)!" 2570 " Dropping.\n", 2571 dev->name, 2572 status->frame_size, 2573 skb_tailroom(packet->skb)); 2574 dev->stats.rx_errors++; 2575 return; 2576 } 2577 2578 if (unlikely(!netif_running(dev))) { 2579 dev->stats.rx_errors++; 2580 priv->wstats.discard.misc++; 2581 IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); 2582 return; 2583 } 2584 2585 if (unlikely(priv->config & CFG_CRC_CHECK && 2586 status->flags & IPW_STATUS_FLAG_CRC_ERROR)) { 2587 IPW_DEBUG_RX("CRC error in packet. Dropping.\n"); 2588 dev->stats.rx_errors++; 2589 return; 2590 } 2591 2592 pci_unmap_single(priv->pci_dev, packet->dma_addr, 2593 sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE); 2594 memmove(packet->skb->data + sizeof(struct ipw_rt_hdr), 2595 packet->skb->data, status->frame_size); 2596 2597 ipw_rt = (struct ipw_rt_hdr *) packet->skb->data; 2598 2599 ipw_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; 2600 ipw_rt->rt_hdr.it_pad = 0; /* always good to zero */ 2601 ipw_rt->rt_hdr.it_len = cpu_to_le16(sizeof(struct ipw_rt_hdr)); /* total hdr+data */ 2602 2603 ipw_rt->rt_hdr.it_present = cpu_to_le32(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL); 2604 2605 ipw_rt->rt_dbmsignal = status->rssi + IPW2100_RSSI_TO_DBM; 2606 2607 skb_put(packet->skb, status->frame_size + sizeof(struct ipw_rt_hdr)); 2608 2609 if (!libipw_rx(priv->ieee, packet->skb, stats)) { 2610 dev->stats.rx_errors++; 2611 2612 /* libipw_rx failed, so it didn't free the SKB */ 2613 dev_kfree_skb_any(packet->skb); 2614 packet->skb = NULL; 2615 } 2616 2617 /* We need to allocate a new SKB and attach it to the RDB. */ 2618 if (unlikely(ipw2100_alloc_skb(priv, packet))) { 2619 IPW_DEBUG_WARNING( 2620 "%s: Unable to allocate SKB onto RBD ring - disabling " 2621 "adapter.\n", dev->name); 2622 /* TODO: schedule adapter shutdown */ 2623 IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); 2624 } 2625 2626 /* Update the RDB entry */ 2627 priv->rx_queue.drv[i].host_addr = packet->dma_addr; 2628 } 2629 2630 #endif 2631 2632 static int ipw2100_corruption_check(struct ipw2100_priv *priv, int i) 2633 { 2634 struct ipw2100_status *status = &priv->status_queue.drv[i]; 2635 struct ipw2100_rx *u = priv->rx_buffers[i].rxp; 2636 u16 frame_type = status->status_fields & STATUS_TYPE_MASK; 2637 2638 switch (frame_type) { 2639 case COMMAND_STATUS_VAL: 2640 return (status->frame_size != sizeof(u->rx_data.command)); 2641 case STATUS_CHANGE_VAL: 2642 return (status->frame_size != sizeof(u->rx_data.status)); 2643 case HOST_NOTIFICATION_VAL: 2644 return (status->frame_size < sizeof(u->rx_data.notification)); 2645 case P80211_DATA_VAL: 2646 case P8023_DATA_VAL: 2647 #ifdef CONFIG_IPW2100_MONITOR 2648 return 0; 2649 #else 2650 switch (WLAN_FC_GET_TYPE(le16_to_cpu(u->rx_data.header.frame_ctl))) { 2651 case IEEE80211_FTYPE_MGMT: 2652 case IEEE80211_FTYPE_CTL: 2653 return 0; 2654 case IEEE80211_FTYPE_DATA: 2655 return (status->frame_size > 2656 IPW_MAX_802_11_PAYLOAD_LENGTH); 2657 } 2658 #endif 2659 } 2660 2661 return 1; 2662 } 2663 2664 /* 2665 * ipw2100 interrupts are disabled at this point, and the ISR 2666 * is the only code that calls this method. So, we do not need 2667 * to play with any locks. 2668 * 2669 * RX Queue works as follows: 2670 * 2671 * Read index - firmware places packet in entry identified by the 2672 * Read index and advances Read index. In this manner, 2673 * Read index will always point to the next packet to 2674 * be filled--but not yet valid. 2675 * 2676 * Write index - driver fills this entry with an unused RBD entry. 2677 * This entry has not filled by the firmware yet. 2678 * 2679 * In between the W and R indexes are the RBDs that have been received 2680 * but not yet processed. 2681 * 2682 * The process of handling packets will start at WRITE + 1 and advance 2683 * until it reaches the READ index. 2684 * 2685 * The WRITE index is cached in the variable 'priv->rx_queue.next'. 2686 * 2687 */ 2688 static void __ipw2100_rx_process(struct ipw2100_priv *priv) 2689 { 2690 struct ipw2100_bd_queue *rxq = &priv->rx_queue; 2691 struct ipw2100_status_queue *sq = &priv->status_queue; 2692 struct ipw2100_rx_packet *packet; 2693 u16 frame_type; 2694 u32 r, w, i, s; 2695 struct ipw2100_rx *u; 2696 struct libipw_rx_stats stats = { 2697 .mac_time = jiffies, 2698 }; 2699 2700 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_RX_READ_INDEX, &r); 2701 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, &w); 2702 2703 if (r >= rxq->entries) { 2704 IPW_DEBUG_RX("exit - bad read index\n"); 2705 return; 2706 } 2707 2708 i = (rxq->next + 1) % rxq->entries; 2709 s = i; 2710 while (i != r) { 2711 /* IPW_DEBUG_RX("r = %d : w = %d : processing = %d\n", 2712 r, rxq->next, i); */ 2713 2714 packet = &priv->rx_buffers[i]; 2715 2716 /* Sync the DMA for the RX buffer so CPU is sure to get 2717 * the correct values */ 2718 pci_dma_sync_single_for_cpu(priv->pci_dev, packet->dma_addr, 2719 sizeof(struct ipw2100_rx), 2720 PCI_DMA_FROMDEVICE); 2721 2722 if (unlikely(ipw2100_corruption_check(priv, i))) { 2723 ipw2100_corruption_detected(priv, i); 2724 goto increment; 2725 } 2726 2727 u = packet->rxp; 2728 frame_type = sq->drv[i].status_fields & STATUS_TYPE_MASK; 2729 stats.rssi = sq->drv[i].rssi + IPW2100_RSSI_TO_DBM; 2730 stats.len = sq->drv[i].frame_size; 2731 2732 stats.mask = 0; 2733 if (stats.rssi != 0) 2734 stats.mask |= LIBIPW_STATMASK_RSSI; 2735 stats.freq = LIBIPW_24GHZ_BAND; 2736 2737 IPW_DEBUG_RX("%s: '%s' frame type received (%d).\n", 2738 priv->net_dev->name, frame_types[frame_type], 2739 stats.len); 2740 2741 switch (frame_type) { 2742 case COMMAND_STATUS_VAL: 2743 /* Reset Rx watchdog */ 2744 isr_rx_complete_command(priv, &u->rx_data.command); 2745 break; 2746 2747 case STATUS_CHANGE_VAL: 2748 isr_status_change(priv, u->rx_data.status); 2749 break; 2750 2751 case P80211_DATA_VAL: 2752 case P8023_DATA_VAL: 2753 #ifdef CONFIG_IPW2100_MONITOR 2754 if (priv->ieee->iw_mode == IW_MODE_MONITOR) { 2755 isr_rx_monitor(priv, i, &stats); 2756 break; 2757 } 2758 #endif 2759 if (stats.len < sizeof(struct libipw_hdr_3addr)) 2760 break; 2761 switch (WLAN_FC_GET_TYPE(le16_to_cpu(u->rx_data.header.frame_ctl))) { 2762 case IEEE80211_FTYPE_MGMT: 2763 libipw_rx_mgt(priv->ieee, 2764 &u->rx_data.header, &stats); 2765 break; 2766 2767 case IEEE80211_FTYPE_CTL: 2768 break; 2769 2770 case IEEE80211_FTYPE_DATA: 2771 isr_rx(priv, i, &stats); 2772 break; 2773 2774 } 2775 break; 2776 } 2777 2778 increment: 2779 /* clear status field associated with this RBD */ 2780 rxq->drv[i].status.info.field = 0; 2781 2782 i = (i + 1) % rxq->entries; 2783 } 2784 2785 if (i != s) { 2786 /* backtrack one entry, wrapping to end if at 0 */ 2787 rxq->next = (i ? i : rxq->entries) - 1; 2788 2789 write_register(priv->net_dev, 2790 IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, rxq->next); 2791 } 2792 } 2793 2794 /* 2795 * __ipw2100_tx_process 2796 * 2797 * This routine will determine whether the next packet on 2798 * the fw_pend_list has been processed by the firmware yet. 2799 * 2800 * If not, then it does nothing and returns. 2801 * 2802 * If so, then it removes the item from the fw_pend_list, frees 2803 * any associated storage, and places the item back on the 2804 * free list of its source (either msg_free_list or tx_free_list) 2805 * 2806 * TX Queue works as follows: 2807 * 2808 * Read index - points to the next TBD that the firmware will 2809 * process. The firmware will read the data, and once 2810 * done processing, it will advance the Read index. 2811 * 2812 * Write index - driver fills this entry with an constructed TBD 2813 * entry. The Write index is not advanced until the 2814 * packet has been configured. 2815 * 2816 * In between the W and R indexes are the TBDs that have NOT been 2817 * processed. Lagging behind the R index are packets that have 2818 * been processed but have not been freed by the driver. 2819 * 2820 * In order to free old storage, an internal index will be maintained 2821 * that points to the next packet to be freed. When all used 2822 * packets have been freed, the oldest index will be the same as the 2823 * firmware's read index. 2824 * 2825 * The OLDEST index is cached in the variable 'priv->tx_queue.oldest' 2826 * 2827 * Because the TBD structure can not contain arbitrary data, the 2828 * driver must keep an internal queue of cached allocations such that 2829 * it can put that data back into the tx_free_list and msg_free_list 2830 * for use by future command and data packets. 2831 * 2832 */ 2833 static int __ipw2100_tx_process(struct ipw2100_priv *priv) 2834 { 2835 struct ipw2100_bd_queue *txq = &priv->tx_queue; 2836 struct ipw2100_bd *tbd; 2837 struct list_head *element; 2838 struct ipw2100_tx_packet *packet; 2839 int descriptors_used; 2840 int e, i; 2841 u32 r, w, frag_num = 0; 2842 2843 if (list_empty(&priv->fw_pend_list)) 2844 return 0; 2845 2846 element = priv->fw_pend_list.next; 2847 2848 packet = list_entry(element, struct ipw2100_tx_packet, list); 2849 tbd = &txq->drv[packet->index]; 2850 2851 /* Determine how many TBD entries must be finished... */ 2852 switch (packet->type) { 2853 case COMMAND: 2854 /* COMMAND uses only one slot; don't advance */ 2855 descriptors_used = 1; 2856 e = txq->oldest; 2857 break; 2858 2859 case DATA: 2860 /* DATA uses two slots; advance and loop position. */ 2861 descriptors_used = tbd->num_fragments; 2862 frag_num = tbd->num_fragments - 1; 2863 e = txq->oldest + frag_num; 2864 e %= txq->entries; 2865 break; 2866 2867 default: 2868 printk(KERN_WARNING DRV_NAME ": %s: Bad fw_pend_list entry!\n", 2869 priv->net_dev->name); 2870 return 0; 2871 } 2872 2873 /* if the last TBD is not done by NIC yet, then packet is 2874 * not ready to be released. 2875 * 2876 */ 2877 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_TX_QUEUE_READ_INDEX, 2878 &r); 2879 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, 2880 &w); 2881 if (w != txq->next) 2882 printk(KERN_WARNING DRV_NAME ": %s: write index mismatch\n", 2883 priv->net_dev->name); 2884 2885 /* 2886 * txq->next is the index of the last packet written txq->oldest is 2887 * the index of the r is the index of the next packet to be read by 2888 * firmware 2889 */ 2890 2891 /* 2892 * Quick graphic to help you visualize the following 2893 * if / else statement 2894 * 2895 * ===>| s---->|=============== 2896 * e>| 2897 * | a | b | c | d | e | f | g | h | i | j | k | l 2898 * r---->| 2899 * w 2900 * 2901 * w - updated by driver 2902 * r - updated by firmware 2903 * s - start of oldest BD entry (txq->oldest) 2904 * e - end of oldest BD entry 2905 * 2906 */ 2907 if (!((r <= w && (e < r || e >= w)) || (e < r && e >= w))) { 2908 IPW_DEBUG_TX("exit - no processed packets ready to release.\n"); 2909 return 0; 2910 } 2911 2912 list_del(element); 2913 DEC_STAT(&priv->fw_pend_stat); 2914 2915 #ifdef CONFIG_IPW2100_DEBUG 2916 { 2917 i = txq->oldest; 2918 IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, 2919 &txq->drv[i], 2920 (u32) (txq->nic + i * sizeof(struct ipw2100_bd)), 2921 txq->drv[i].host_addr, txq->drv[i].buf_length); 2922 2923 if (packet->type == DATA) { 2924 i = (i + 1) % txq->entries; 2925 2926 IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, 2927 &txq->drv[i], 2928 (u32) (txq->nic + i * 2929 sizeof(struct ipw2100_bd)), 2930 (u32) txq->drv[i].host_addr, 2931 txq->drv[i].buf_length); 2932 } 2933 } 2934 #endif 2935 2936 switch (packet->type) { 2937 case DATA: 2938 if (txq->drv[txq->oldest].status.info.fields.txType != 0) 2939 printk(KERN_WARNING DRV_NAME ": %s: Queue mismatch. " 2940 "Expecting DATA TBD but pulled " 2941 "something else: ids %d=%d.\n", 2942 priv->net_dev->name, txq->oldest, packet->index); 2943 2944 /* DATA packet; we have to unmap and free the SKB */ 2945 for (i = 0; i < frag_num; i++) { 2946 tbd = &txq->drv[(packet->index + 1 + i) % txq->entries]; 2947 2948 IPW_DEBUG_TX("TX%d P=%08x L=%d\n", 2949 (packet->index + 1 + i) % txq->entries, 2950 tbd->host_addr, tbd->buf_length); 2951 2952 pci_unmap_single(priv->pci_dev, 2953 tbd->host_addr, 2954 tbd->buf_length, PCI_DMA_TODEVICE); 2955 } 2956 2957 libipw_txb_free(packet->info.d_struct.txb); 2958 packet->info.d_struct.txb = NULL; 2959 2960 list_add_tail(element, &priv->tx_free_list); 2961 INC_STAT(&priv->tx_free_stat); 2962 2963 /* We have a free slot in the Tx queue, so wake up the 2964 * transmit layer if it is stopped. */ 2965 if (priv->status & STATUS_ASSOCIATED) 2966 netif_wake_queue(priv->net_dev); 2967 2968 /* A packet was processed by the hardware, so update the 2969 * watchdog */ 2970 priv->net_dev->trans_start = jiffies; 2971 2972 break; 2973 2974 case COMMAND: 2975 if (txq->drv[txq->oldest].status.info.fields.txType != 1) 2976 printk(KERN_WARNING DRV_NAME ": %s: Queue mismatch. " 2977 "Expecting COMMAND TBD but pulled " 2978 "something else: ids %d=%d.\n", 2979 priv->net_dev->name, txq->oldest, packet->index); 2980 2981 #ifdef CONFIG_IPW2100_DEBUG 2982 if (packet->info.c_struct.cmd->host_command_reg < 2983 ARRAY_SIZE(command_types)) 2984 IPW_DEBUG_TX("Command '%s (%d)' processed: %d.\n", 2985 command_types[packet->info.c_struct.cmd-> 2986 host_command_reg], 2987 packet->info.c_struct.cmd-> 2988 host_command_reg, 2989 packet->info.c_struct.cmd->cmd_status_reg); 2990 #endif 2991 2992 list_add_tail(element, &priv->msg_free_list); 2993 INC_STAT(&priv->msg_free_stat); 2994 break; 2995 } 2996 2997 /* advance oldest used TBD pointer to start of next entry */ 2998 txq->oldest = (e + 1) % txq->entries; 2999 /* increase available TBDs number */ 3000 txq->available += descriptors_used; 3001 SET_STAT(&priv->txq_stat, txq->available); 3002 3003 IPW_DEBUG_TX("packet latency (send to process) %ld jiffies\n", 3004 jiffies - packet->jiffy_start); 3005 3006 return (!list_empty(&priv->fw_pend_list)); 3007 } 3008 3009 static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv) 3010 { 3011 int i = 0; 3012 3013 while (__ipw2100_tx_process(priv) && i < 200) 3014 i++; 3015 3016 if (i == 200) { 3017 printk(KERN_WARNING DRV_NAME ": " 3018 "%s: Driver is running slow (%d iters).\n", 3019 priv->net_dev->name, i); 3020 } 3021 } 3022 3023 static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) 3024 { 3025 struct list_head *element; 3026 struct ipw2100_tx_packet *packet; 3027 struct ipw2100_bd_queue *txq = &priv->tx_queue; 3028 struct ipw2100_bd *tbd; 3029 int next = txq->next; 3030 3031 while (!list_empty(&priv->msg_pend_list)) { 3032 /* if there isn't enough space in TBD queue, then 3033 * don't stuff a new one in. 3034 * NOTE: 3 are needed as a command will take one, 3035 * and there is a minimum of 2 that must be 3036 * maintained between the r and w indexes 3037 */ 3038 if (txq->available <= 3) { 3039 IPW_DEBUG_TX("no room in tx_queue\n"); 3040 break; 3041 } 3042 3043 element = priv->msg_pend_list.next; 3044 list_del(element); 3045 DEC_STAT(&priv->msg_pend_stat); 3046 3047 packet = list_entry(element, struct ipw2100_tx_packet, list); 3048 3049 IPW_DEBUG_TX("using TBD at virt=%p, phys=%04X\n", 3050 &txq->drv[txq->next], 3051 (u32) (txq->nic + txq->next * 3052 sizeof(struct ipw2100_bd))); 3053 3054 packet->index = txq->next; 3055 3056 tbd = &txq->drv[txq->next]; 3057 3058 /* initialize TBD */ 3059 tbd->host_addr = packet->info.c_struct.cmd_phys; 3060 tbd->buf_length = sizeof(struct ipw2100_cmd_header); 3061 /* not marking number of fragments causes problems 3062 * with f/w debug version */ 3063 tbd->num_fragments = 1; 3064 tbd->status.info.field = 3065 IPW_BD_STATUS_TX_FRAME_COMMAND | 3066 IPW_BD_STATUS_TX_INTERRUPT_ENABLE; 3067 3068 /* update TBD queue counters */ 3069 txq->next++; 3070 txq->next %= txq->entries; 3071 txq->available--; 3072 DEC_STAT(&priv->txq_stat); 3073 3074 list_add_tail(element, &priv->fw_pend_list); 3075 INC_STAT(&priv->fw_pend_stat); 3076 } 3077 3078 if (txq->next != next) { 3079 /* kick off the DMA by notifying firmware the 3080 * write index has moved; make sure TBD stores are sync'd */ 3081 wmb(); 3082 write_register(priv->net_dev, 3083 IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, 3084 txq->next); 3085 } 3086 } 3087 3088 /* 3089 * ipw2100_tx_send_data 3090 * 3091 */ 3092 static void ipw2100_tx_send_data(struct ipw2100_priv *priv) 3093 { 3094 struct list_head *element; 3095 struct ipw2100_tx_packet *packet; 3096 struct ipw2100_bd_queue *txq = &priv->tx_queue; 3097 struct ipw2100_bd *tbd; 3098 int next = txq->next; 3099 int i = 0; 3100 struct ipw2100_data_header *ipw_hdr; 3101 struct libipw_hdr_3addr *hdr; 3102 3103 while (!list_empty(&priv->tx_pend_list)) { 3104 /* if there isn't enough space in TBD queue, then 3105 * don't stuff a new one in. 3106 * NOTE: 4 are needed as a data will take two, 3107 * and there is a minimum of 2 that must be 3108 * maintained between the r and w indexes 3109 */ 3110 element = priv->tx_pend_list.next; 3111 packet = list_entry(element, struct ipw2100_tx_packet, list); 3112 3113 if (unlikely(1 + packet->info.d_struct.txb->nr_frags > 3114 IPW_MAX_BDS)) { 3115 /* TODO: Support merging buffers if more than 3116 * IPW_MAX_BDS are used */ 3117 IPW_DEBUG_INFO("%s: Maximum BD threshold exceeded. " 3118 "Increase fragmentation level.\n", 3119 priv->net_dev->name); 3120 } 3121 3122 if (txq->available <= 3 + packet->info.d_struct.txb->nr_frags) { 3123 IPW_DEBUG_TX("no room in tx_queue\n"); 3124 break; 3125 } 3126 3127 list_del(element); 3128 DEC_STAT(&priv->tx_pend_stat); 3129 3130 tbd = &txq->drv[txq->next]; 3131 3132 packet->index = txq->next; 3133 3134 ipw_hdr = packet->info.d_struct.data; 3135 hdr = (struct libipw_hdr_3addr *)packet->info.d_struct.txb-> 3136 fragments[0]->data; 3137 3138 if (priv->ieee->iw_mode == IW_MODE_INFRA) { 3139 /* To DS: Addr1 = BSSID, Addr2 = SA, 3140 Addr3 = DA */ 3141 memcpy(ipw_hdr->src_addr, hdr->addr2, ETH_ALEN); 3142 memcpy(ipw_hdr->dst_addr, hdr->addr3, ETH_ALEN); 3143 } else if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 3144 /* not From/To DS: Addr1 = DA, Addr2 = SA, 3145 Addr3 = BSSID */ 3146 memcpy(ipw_hdr->src_addr, hdr->addr2, ETH_ALEN); 3147 memcpy(ipw_hdr->dst_addr, hdr->addr1, ETH_ALEN); 3148 } 3149 3150 ipw_hdr->host_command_reg = SEND; 3151 ipw_hdr->host_command_reg1 = 0; 3152 3153 /* For now we only support host based encryption */ 3154 ipw_hdr->needs_encryption = 0; 3155 ipw_hdr->encrypted = packet->info.d_struct.txb->encrypted; 3156 if (packet->info.d_struct.txb->nr_frags > 1) 3157 ipw_hdr->fragment_size = 3158 packet->info.d_struct.txb->frag_size - 3159 LIBIPW_3ADDR_LEN; 3160 else 3161 ipw_hdr->fragment_size = 0; 3162 3163 tbd->host_addr = packet->info.d_struct.data_phys; 3164 tbd->buf_length = sizeof(struct ipw2100_data_header); 3165 tbd->num_fragments = 1 + packet->info.d_struct.txb->nr_frags; 3166 tbd->status.info.field = 3167 IPW_BD_STATUS_TX_FRAME_802_3 | 3168 IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; 3169 txq->next++; 3170 txq->next %= txq->entries; 3171 3172 IPW_DEBUG_TX("data header tbd TX%d P=%08x L=%d\n", 3173 packet->index, tbd->host_addr, tbd->buf_length); 3174 #ifdef CONFIG_IPW2100_DEBUG 3175 if (packet->info.d_struct.txb->nr_frags > 1) 3176 IPW_DEBUG_FRAG("fragment Tx: %d frames\n", 3177 packet->info.d_struct.txb->nr_frags); 3178 #endif 3179 3180 for (i = 0; i < packet->info.d_struct.txb->nr_frags; i++) { 3181 tbd = &txq->drv[txq->next]; 3182 if (i == packet->info.d_struct.txb->nr_frags - 1) 3183 tbd->status.info.field = 3184 IPW_BD_STATUS_TX_FRAME_802_3 | 3185 IPW_BD_STATUS_TX_INTERRUPT_ENABLE; 3186 else 3187 tbd->status.info.field = 3188 IPW_BD_STATUS_TX_FRAME_802_3 | 3189 IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; 3190 3191 tbd->buf_length = packet->info.d_struct.txb-> 3192 fragments[i]->len - LIBIPW_3ADDR_LEN; 3193 3194 tbd->host_addr = pci_map_single(priv->pci_dev, 3195 packet->info.d_struct. 3196 txb->fragments[i]-> 3197 data + 3198 LIBIPW_3ADDR_LEN, 3199 tbd->buf_length, 3200 PCI_DMA_TODEVICE); 3201 3202 IPW_DEBUG_TX("data frag tbd TX%d P=%08x L=%d\n", 3203 txq->next, tbd->host_addr, 3204 tbd->buf_length); 3205 3206 pci_dma_sync_single_for_device(priv->pci_dev, 3207 tbd->host_addr, 3208 tbd->buf_length, 3209 PCI_DMA_TODEVICE); 3210 3211 txq->next++; 3212 txq->next %= txq->entries; 3213 } 3214 3215 txq->available -= 1 + packet->info.d_struct.txb->nr_frags; 3216 SET_STAT(&priv->txq_stat, txq->available); 3217 3218 list_add_tail(element, &priv->fw_pend_list); 3219 INC_STAT(&priv->fw_pend_stat); 3220 } 3221 3222 if (txq->next != next) { 3223 /* kick off the DMA by notifying firmware the 3224 * write index has moved; make sure TBD stores are sync'd */ 3225 write_register(priv->net_dev, 3226 IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, 3227 txq->next); 3228 } 3229 } 3230 3231 static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) 3232 { 3233 struct net_device *dev = priv->net_dev; 3234 unsigned long flags; 3235 u32 inta, tmp; 3236 3237 spin_lock_irqsave(&priv->low_lock, flags); 3238 ipw2100_disable_interrupts(priv); 3239 3240 read_register(dev, IPW_REG_INTA, &inta); 3241 3242 IPW_DEBUG_ISR("enter - INTA: 0x%08lX\n", 3243 (unsigned long)inta & IPW_INTERRUPT_MASK); 3244 3245 priv->in_isr++; 3246 priv->interrupts++; 3247 3248 /* We do not loop and keep polling for more interrupts as this 3249 * is frowned upon and doesn't play nicely with other potentially 3250 * chained IRQs */ 3251 IPW_DEBUG_ISR("INTA: 0x%08lX\n", 3252 (unsigned long)inta & IPW_INTERRUPT_MASK); 3253 3254 if (inta & IPW2100_INTA_FATAL_ERROR) { 3255 printk(KERN_WARNING DRV_NAME 3256 ": Fatal interrupt. Scheduling firmware restart.\n"); 3257 priv->inta_other++; 3258 write_register(dev, IPW_REG_INTA, IPW2100_INTA_FATAL_ERROR); 3259 3260 read_nic_dword(dev, IPW_NIC_FATAL_ERROR, &priv->fatal_error); 3261 IPW_DEBUG_INFO("%s: Fatal error value: 0x%08X\n", 3262 priv->net_dev->name, priv->fatal_error); 3263 3264 read_nic_dword(dev, IPW_ERROR_ADDR(priv->fatal_error), &tmp); 3265 IPW_DEBUG_INFO("%s: Fatal error address value: 0x%08X\n", 3266 priv->net_dev->name, tmp); 3267 3268 /* Wake up any sleeping jobs */ 3269 schedule_reset(priv); 3270 } 3271 3272 if (inta & IPW2100_INTA_PARITY_ERROR) { 3273 printk(KERN_ERR DRV_NAME 3274 ": ***** PARITY ERROR INTERRUPT !!!!\n"); 3275 priv->inta_other++; 3276 write_register(dev, IPW_REG_INTA, IPW2100_INTA_PARITY_ERROR); 3277 } 3278 3279 if (inta & IPW2100_INTA_RX_TRANSFER) { 3280 IPW_DEBUG_ISR("RX interrupt\n"); 3281 3282 priv->rx_interrupts++; 3283 3284 write_register(dev, IPW_REG_INTA, IPW2100_INTA_RX_TRANSFER); 3285 3286 __ipw2100_rx_process(priv); 3287 __ipw2100_tx_complete(priv); 3288 } 3289 3290 if (inta & IPW2100_INTA_TX_TRANSFER) { 3291 IPW_DEBUG_ISR("TX interrupt\n"); 3292 3293 priv->tx_interrupts++; 3294 3295 write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_TRANSFER); 3296 3297 __ipw2100_tx_complete(priv); 3298 ipw2100_tx_send_commands(priv); 3299 ipw2100_tx_send_data(priv); 3300 } 3301 3302 if (inta & IPW2100_INTA_TX_COMPLETE) { 3303 IPW_DEBUG_ISR("TX complete\n"); 3304 priv->inta_other++; 3305 write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_COMPLETE); 3306 3307 __ipw2100_tx_complete(priv); 3308 } 3309 3310 if (inta & IPW2100_INTA_EVENT_INTERRUPT) { 3311 /* ipw2100_handle_event(dev); */ 3312 priv->inta_other++; 3313 write_register(dev, IPW_REG_INTA, IPW2100_INTA_EVENT_INTERRUPT); 3314 } 3315 3316 if (inta & IPW2100_INTA_FW_INIT_DONE) { 3317 IPW_DEBUG_ISR("FW init done interrupt\n"); 3318 priv->inta_other++; 3319 3320 read_register(dev, IPW_REG_INTA, &tmp); 3321 if (tmp & (IPW2100_INTA_FATAL_ERROR | 3322 IPW2100_INTA_PARITY_ERROR)) { 3323 write_register(dev, IPW_REG_INTA, 3324 IPW2100_INTA_FATAL_ERROR | 3325 IPW2100_INTA_PARITY_ERROR); 3326 } 3327 3328 write_register(dev, IPW_REG_INTA, IPW2100_INTA_FW_INIT_DONE); 3329 } 3330 3331 if (inta & IPW2100_INTA_STATUS_CHANGE) { 3332 IPW_DEBUG_ISR("Status change interrupt\n"); 3333 priv->inta_other++; 3334 write_register(dev, IPW_REG_INTA, IPW2100_INTA_STATUS_CHANGE); 3335 } 3336 3337 if (inta & IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE) { 3338 IPW_DEBUG_ISR("slave host mode interrupt\n"); 3339 priv->inta_other++; 3340 write_register(dev, IPW_REG_INTA, 3341 IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE); 3342 } 3343 3344 priv->in_isr--; 3345 ipw2100_enable_interrupts(priv); 3346 3347 spin_unlock_irqrestore(&priv->low_lock, flags); 3348 3349 IPW_DEBUG_ISR("exit\n"); 3350 } 3351 3352 static irqreturn_t ipw2100_interrupt(int irq, void *data) 3353 { 3354 struct ipw2100_priv *priv = data; 3355 u32 inta, inta_mask; 3356 3357 if (!data) 3358 return IRQ_NONE; 3359 3360 spin_lock(&priv->low_lock); 3361 3362 /* We check to see if we should be ignoring interrupts before 3363 * we touch the hardware. During ucode load if we try and handle 3364 * an interrupt we can cause keyboard problems as well as cause 3365 * the ucode to fail to initialize */ 3366 if (!(priv->status & STATUS_INT_ENABLED)) { 3367 /* Shared IRQ */ 3368 goto none; 3369 } 3370 3371 read_register(priv->net_dev, IPW_REG_INTA_MASK, &inta_mask); 3372 read_register(priv->net_dev, IPW_REG_INTA, &inta); 3373 3374 if (inta == 0xFFFFFFFF) { 3375 /* Hardware disappeared */ 3376 printk(KERN_WARNING DRV_NAME ": IRQ INTA == 0xFFFFFFFF\n"); 3377 goto none; 3378 } 3379 3380 inta &= IPW_INTERRUPT_MASK; 3381 3382 if (!(inta & inta_mask)) { 3383 /* Shared interrupt */ 3384 goto none; 3385 } 3386 3387 /* We disable the hardware interrupt here just to prevent unneeded 3388 * calls to be made. We disable this again within the actual 3389 * work tasklet, so if another part of the code re-enables the 3390 * interrupt, that is fine */ 3391 ipw2100_disable_interrupts(priv); 3392 3393 tasklet_schedule(&priv->irq_tasklet); 3394 spin_unlock(&priv->low_lock); 3395 3396 return IRQ_HANDLED; 3397 none: 3398 spin_unlock(&priv->low_lock); 3399 return IRQ_NONE; 3400 } 3401 3402 static netdev_tx_t ipw2100_tx(struct libipw_txb *txb, 3403 struct net_device *dev, int pri) 3404 { 3405 struct ipw2100_priv *priv = libipw_priv(dev); 3406 struct list_head *element; 3407 struct ipw2100_tx_packet *packet; 3408 unsigned long flags; 3409 3410 spin_lock_irqsave(&priv->low_lock, flags); 3411 3412 if (!(priv->status & STATUS_ASSOCIATED)) { 3413 IPW_DEBUG_INFO("Can not transmit when not connected.\n"); 3414 priv->net_dev->stats.tx_carrier_errors++; 3415 netif_stop_queue(dev); 3416 goto fail_unlock; 3417 } 3418 3419 if (list_empty(&priv->tx_free_list)) 3420 goto fail_unlock; 3421 3422 element = priv->tx_free_list.next; 3423 packet = list_entry(element, struct ipw2100_tx_packet, list); 3424 3425 packet->info.d_struct.txb = txb; 3426 3427 IPW_DEBUG_TX("Sending fragment (%d bytes):\n", txb->fragments[0]->len); 3428 printk_buf(IPW_DL_TX, txb->fragments[0]->data, txb->fragments[0]->len); 3429 3430 packet->jiffy_start = jiffies; 3431 3432 list_del(element); 3433 DEC_STAT(&priv->tx_free_stat); 3434 3435 list_add_tail(element, &priv->tx_pend_list); 3436 INC_STAT(&priv->tx_pend_stat); 3437 3438 ipw2100_tx_send_data(priv); 3439 3440 spin_unlock_irqrestore(&priv->low_lock, flags); 3441 return NETDEV_TX_OK; 3442 3443 fail_unlock: 3444 netif_stop_queue(dev); 3445 spin_unlock_irqrestore(&priv->low_lock, flags); 3446 return NETDEV_TX_BUSY; 3447 } 3448 3449 static int ipw2100_msg_allocate(struct ipw2100_priv *priv) 3450 { 3451 int i, j, err = -EINVAL; 3452 void *v; 3453 dma_addr_t p; 3454 3455 priv->msg_buffers = 3456 kmalloc(IPW_COMMAND_POOL_SIZE * sizeof(struct ipw2100_tx_packet), 3457 GFP_KERNEL); 3458 if (!priv->msg_buffers) 3459 return -ENOMEM; 3460 3461 for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { 3462 v = pci_alloc_consistent(priv->pci_dev, 3463 sizeof(struct ipw2100_cmd_header), &p); 3464 if (!v) { 3465 printk(KERN_ERR DRV_NAME ": " 3466 "%s: PCI alloc failed for msg " 3467 "buffers.\n", priv->net_dev->name); 3468 err = -ENOMEM; 3469 break; 3470 } 3471 3472 memset(v, 0, sizeof(struct ipw2100_cmd_header)); 3473 3474 priv->msg_buffers[i].type = COMMAND; 3475 priv->msg_buffers[i].info.c_struct.cmd = 3476 (struct ipw2100_cmd_header *)v; 3477 priv->msg_buffers[i].info.c_struct.cmd_phys = p; 3478 } 3479 3480 if (i == IPW_COMMAND_POOL_SIZE) 3481 return 0; 3482 3483 for (j = 0; j < i; j++) { 3484 pci_free_consistent(priv->pci_dev, 3485 sizeof(struct ipw2100_cmd_header), 3486 priv->msg_buffers[j].info.c_struct.cmd, 3487 priv->msg_buffers[j].info.c_struct. 3488 cmd_phys); 3489 } 3490 3491 kfree(priv->msg_buffers); 3492 priv->msg_buffers = NULL; 3493 3494 return err; 3495 } 3496 3497 static int ipw2100_msg_initialize(struct ipw2100_priv *priv) 3498 { 3499 int i; 3500 3501 INIT_LIST_HEAD(&priv->msg_free_list); 3502 INIT_LIST_HEAD(&priv->msg_pend_list); 3503 3504 for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) 3505 list_add_tail(&priv->msg_buffers[i].list, &priv->msg_free_list); 3506 SET_STAT(&priv->msg_free_stat, i); 3507 3508 return 0; 3509 } 3510 3511 static void ipw2100_msg_free(struct ipw2100_priv *priv) 3512 { 3513 int i; 3514 3515 if (!priv->msg_buffers) 3516 return; 3517 3518 for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { 3519 pci_free_consistent(priv->pci_dev, 3520 sizeof(struct ipw2100_cmd_header), 3521 priv->msg_buffers[i].info.c_struct.cmd, 3522 priv->msg_buffers[i].info.c_struct. 3523 cmd_phys); 3524 } 3525 3526 kfree(priv->msg_buffers); 3527 priv->msg_buffers = NULL; 3528 } 3529 3530 static ssize_t show_pci(struct device *d, struct device_attribute *attr, 3531 char *buf) 3532 { 3533 struct pci_dev *pci_dev = container_of(d, struct pci_dev, dev); 3534 char *out = buf; 3535 int i, j; 3536 u32 val; 3537 3538 for (i = 0; i < 16; i++) { 3539 out += sprintf(out, "[%08X] ", i * 16); 3540 for (j = 0; j < 16; j += 4) { 3541 pci_read_config_dword(pci_dev, i * 16 + j, &val); 3542 out += sprintf(out, "%08X ", val); 3543 } 3544 out += sprintf(out, "\n"); 3545 } 3546 3547 return out - buf; 3548 } 3549 3550 static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL); 3551 3552 static ssize_t show_cfg(struct device *d, struct device_attribute *attr, 3553 char *buf) 3554 { 3555 struct ipw2100_priv *p = dev_get_drvdata(d); 3556 return sprintf(buf, "0x%08x\n", (int)p->config); 3557 } 3558 3559 static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); 3560 3561 static ssize_t show_status(struct device *d, struct device_attribute *attr, 3562 char *buf) 3563 { 3564 struct ipw2100_priv *p = dev_get_drvdata(d); 3565 return sprintf(buf, "0x%08x\n", (int)p->status); 3566 } 3567 3568 static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); 3569 3570 static ssize_t show_capability(struct device *d, struct device_attribute *attr, 3571 char *buf) 3572 { 3573 struct ipw2100_priv *p = dev_get_drvdata(d); 3574 return sprintf(buf, "0x%08x\n", (int)p->capability); 3575 } 3576 3577 static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL); 3578 3579 #define IPW2100_REG(x) { IPW_ ##x, #x } 3580 static const struct { 3581 u32 addr; 3582 const char *name; 3583 } hw_data[] = { 3584 IPW2100_REG(REG_GP_CNTRL), 3585 IPW2100_REG(REG_GPIO), 3586 IPW2100_REG(REG_INTA), 3587 IPW2100_REG(REG_INTA_MASK), IPW2100_REG(REG_RESET_REG),}; 3588 #define IPW2100_NIC(x, s) { x, #x, s } 3589 static const struct { 3590 u32 addr; 3591 const char *name; 3592 size_t size; 3593 } nic_data[] = { 3594 IPW2100_NIC(IPW2100_CONTROL_REG, 2), 3595 IPW2100_NIC(0x210014, 1), IPW2100_NIC(0x210000, 1),}; 3596 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 3597 static const struct { 3598 u8 index; 3599 const char *name; 3600 const char *desc; 3601 } ord_data[] = { 3602 IPW2100_ORD(STAT_TX_HOST_REQUESTS, "requested Host Tx's (MSDU)"), 3603 IPW2100_ORD(STAT_TX_HOST_COMPLETE, 3604 "successful Host Tx's (MSDU)"), 3605 IPW2100_ORD(STAT_TX_DIR_DATA, 3606 "successful Directed Tx's (MSDU)"), 3607 IPW2100_ORD(STAT_TX_DIR_DATA1, 3608 "successful Directed Tx's (MSDU) @ 1MB"), 3609 IPW2100_ORD(STAT_TX_DIR_DATA2, 3610 "successful Directed Tx's (MSDU) @ 2MB"), 3611 IPW2100_ORD(STAT_TX_DIR_DATA5_5, 3612 "successful Directed Tx's (MSDU) @ 5_5MB"), 3613 IPW2100_ORD(STAT_TX_DIR_DATA11, 3614 "successful Directed Tx's (MSDU) @ 11MB"), 3615 IPW2100_ORD(STAT_TX_NODIR_DATA1, 3616 "successful Non_Directed Tx's (MSDU) @ 1MB"), 3617 IPW2100_ORD(STAT_TX_NODIR_DATA2, 3618 "successful Non_Directed Tx's (MSDU) @ 2MB"), 3619 IPW2100_ORD(STAT_TX_NODIR_DATA5_5, 3620 "successful Non_Directed Tx's (MSDU) @ 5.5MB"), 3621 IPW2100_ORD(STAT_TX_NODIR_DATA11, 3622 "successful Non_Directed Tx's (MSDU) @ 11MB"), 3623 IPW2100_ORD(STAT_NULL_DATA, "successful NULL data Tx's"), 3624 IPW2100_ORD(STAT_TX_RTS, "successful Tx RTS"), 3625 IPW2100_ORD(STAT_TX_CTS, "successful Tx CTS"), 3626 IPW2100_ORD(STAT_TX_ACK, "successful Tx ACK"), 3627 IPW2100_ORD(STAT_TX_ASSN, "successful Association Tx's"), 3628 IPW2100_ORD(STAT_TX_ASSN_RESP, 3629 "successful Association response Tx's"), 3630 IPW2100_ORD(STAT_TX_REASSN, 3631 "successful Reassociation Tx's"), 3632 IPW2100_ORD(STAT_TX_REASSN_RESP, 3633 "successful Reassociation response Tx's"), 3634 IPW2100_ORD(STAT_TX_PROBE, 3635 "probes successfully transmitted"), 3636 IPW2100_ORD(STAT_TX_PROBE_RESP, 3637 "probe responses successfully transmitted"), 3638 IPW2100_ORD(STAT_TX_BEACON, "tx beacon"), 3639 IPW2100_ORD(STAT_TX_ATIM, "Tx ATIM"), 3640 IPW2100_ORD(STAT_TX_DISASSN, 3641 "successful Disassociation TX"), 3642 IPW2100_ORD(STAT_TX_AUTH, "successful Authentication Tx"), 3643 IPW2100_ORD(STAT_TX_DEAUTH, 3644 "successful Deauthentication TX"), 3645 IPW2100_ORD(STAT_TX_TOTAL_BYTES, 3646 "Total successful Tx data bytes"), 3647 IPW2100_ORD(STAT_TX_RETRIES, "Tx retries"), 3648 IPW2100_ORD(STAT_TX_RETRY1, "Tx retries at 1MBPS"), 3649 IPW2100_ORD(STAT_TX_RETRY2, "Tx retries at 2MBPS"), 3650 IPW2100_ORD(STAT_TX_RETRY5_5, "Tx retries at 5.5MBPS"), 3651 IPW2100_ORD(STAT_TX_RETRY11, "Tx retries at 11MBPS"), 3652 IPW2100_ORD(STAT_TX_FAILURES, "Tx Failures"), 3653 IPW2100_ORD(STAT_TX_MAX_TRIES_IN_HOP, 3654 "times max tries in a hop failed"), 3655 IPW2100_ORD(STAT_TX_DISASSN_FAIL, 3656 "times disassociation failed"), 3657 IPW2100_ORD(STAT_TX_ERR_CTS, "missed/bad CTS frames"), 3658 IPW2100_ORD(STAT_TX_ERR_ACK, "tx err due to acks"), 3659 IPW2100_ORD(STAT_RX_HOST, "packets passed to host"), 3660 IPW2100_ORD(STAT_RX_DIR_DATA, "directed packets"), 3661 IPW2100_ORD(STAT_RX_DIR_DATA1, "directed packets at 1MB"), 3662 IPW2100_ORD(STAT_RX_DIR_DATA2, "directed packets at 2MB"), 3663 IPW2100_ORD(STAT_RX_DIR_DATA5_5, 3664 "directed packets at 5.5MB"), 3665 IPW2100_ORD(STAT_RX_DIR_DATA11, "directed packets at 11MB"), 3666 IPW2100_ORD(STAT_RX_NODIR_DATA, "nondirected packets"), 3667 IPW2100_ORD(STAT_RX_NODIR_DATA1, 3668 "nondirected packets at 1MB"), 3669 IPW2100_ORD(STAT_RX_NODIR_DATA2, 3670 "nondirected packets at 2MB"), 3671 IPW2100_ORD(STAT_RX_NODIR_DATA5_5, 3672 "nondirected packets at 5.5MB"), 3673 IPW2100_ORD(STAT_RX_NODIR_DATA11, 3674 "nondirected packets at 11MB"), 3675 IPW2100_ORD(STAT_RX_NULL_DATA, "null data rx's"), 3676 IPW2100_ORD(STAT_RX_RTS, "Rx RTS"), IPW2100_ORD(STAT_RX_CTS, 3677 "Rx CTS"), 3678 IPW2100_ORD(STAT_RX_ACK, "Rx ACK"), 3679 IPW2100_ORD(STAT_RX_CFEND, "Rx CF End"), 3680 IPW2100_ORD(STAT_RX_CFEND_ACK, "Rx CF End + CF Ack"), 3681 IPW2100_ORD(STAT_RX_ASSN, "Association Rx's"), 3682 IPW2100_ORD(STAT_RX_ASSN_RESP, "Association response Rx's"), 3683 IPW2100_ORD(STAT_RX_REASSN, "Reassociation Rx's"), 3684 IPW2100_ORD(STAT_RX_REASSN_RESP, 3685 "Reassociation response Rx's"), 3686 IPW2100_ORD(STAT_RX_PROBE, "probe Rx's"), 3687 IPW2100_ORD(STAT_RX_PROBE_RESP, "probe response Rx's"), 3688 IPW2100_ORD(STAT_RX_BEACON, "Rx beacon"), 3689 IPW2100_ORD(STAT_RX_ATIM, "Rx ATIM"), 3690 IPW2100_ORD(STAT_RX_DISASSN, "disassociation Rx"), 3691 IPW2100_ORD(STAT_RX_AUTH, "authentication Rx"), 3692 IPW2100_ORD(STAT_RX_DEAUTH, "deauthentication Rx"), 3693 IPW2100_ORD(STAT_RX_TOTAL_BYTES, 3694 "Total rx data bytes received"), 3695 IPW2100_ORD(STAT_RX_ERR_CRC, "packets with Rx CRC error"), 3696 IPW2100_ORD(STAT_RX_ERR_CRC1, "Rx CRC errors at 1MB"), 3697 IPW2100_ORD(STAT_RX_ERR_CRC2, "Rx CRC errors at 2MB"), 3698 IPW2100_ORD(STAT_RX_ERR_CRC5_5, "Rx CRC errors at 5.5MB"), 3699 IPW2100_ORD(STAT_RX_ERR_CRC11, "Rx CRC errors at 11MB"), 3700 IPW2100_ORD(STAT_RX_DUPLICATE1, 3701 "duplicate rx packets at 1MB"), 3702 IPW2100_ORD(STAT_RX_DUPLICATE2, 3703 "duplicate rx packets at 2MB"), 3704 IPW2100_ORD(STAT_RX_DUPLICATE5_5, 3705 "duplicate rx packets at 5.5MB"), 3706 IPW2100_ORD(STAT_RX_DUPLICATE11, 3707 "duplicate rx packets at 11MB"), 3708 IPW2100_ORD(STAT_RX_DUPLICATE, "duplicate rx packets"), 3709 IPW2100_ORD(PERS_DB_LOCK, "locking fw permanent db"), 3710 IPW2100_ORD(PERS_DB_SIZE, "size of fw permanent db"), 3711 IPW2100_ORD(PERS_DB_ADDR, "address of fw permanent db"), 3712 IPW2100_ORD(STAT_RX_INVALID_PROTOCOL, 3713 "rx frames with invalid protocol"), 3714 IPW2100_ORD(SYS_BOOT_TIME, "Boot time"), 3715 IPW2100_ORD(STAT_RX_NO_BUFFER, 3716 "rx frames rejected due to no buffer"), 3717 IPW2100_ORD(STAT_RX_MISSING_FRAG, 3718 "rx frames dropped due to missing fragment"), 3719 IPW2100_ORD(STAT_RX_ORPHAN_FRAG, 3720 "rx frames dropped due to non-sequential fragment"), 3721 IPW2100_ORD(STAT_RX_ORPHAN_FRAME, 3722 "rx frames dropped due to unmatched 1st frame"), 3723 IPW2100_ORD(STAT_RX_FRAG_AGEOUT, 3724 "rx frames dropped due to uncompleted frame"), 3725 IPW2100_ORD(STAT_RX_ICV_ERRORS, 3726 "ICV errors during decryption"), 3727 IPW2100_ORD(STAT_PSP_SUSPENSION, "times adapter suspended"), 3728 IPW2100_ORD(STAT_PSP_BCN_TIMEOUT, "beacon timeout"), 3729 IPW2100_ORD(STAT_PSP_POLL_TIMEOUT, 3730 "poll response timeouts"), 3731 IPW2100_ORD(STAT_PSP_NONDIR_TIMEOUT, 3732 "timeouts waiting for last {broad,multi}cast pkt"), 3733 IPW2100_ORD(STAT_PSP_RX_DTIMS, "PSP DTIMs received"), 3734 IPW2100_ORD(STAT_PSP_RX_TIMS, "PSP TIMs received"), 3735 IPW2100_ORD(STAT_PSP_STATION_ID, "PSP Station ID"), 3736 IPW2100_ORD(LAST_ASSN_TIME, "RTC time of last association"), 3737 IPW2100_ORD(STAT_PERCENT_MISSED_BCNS, 3738 "current calculation of % missed beacons"), 3739 IPW2100_ORD(STAT_PERCENT_RETRIES, 3740 "current calculation of % missed tx retries"), 3741 IPW2100_ORD(ASSOCIATED_AP_PTR, 3742 "0 if not associated, else pointer to AP table entry"), 3743 IPW2100_ORD(AVAILABLE_AP_CNT, 3744 "AP's decsribed in the AP table"), 3745 IPW2100_ORD(AP_LIST_PTR, "Ptr to list of available APs"), 3746 IPW2100_ORD(STAT_AP_ASSNS, "associations"), 3747 IPW2100_ORD(STAT_ASSN_FAIL, "association failures"), 3748 IPW2100_ORD(STAT_ASSN_RESP_FAIL, 3749 "failures due to response fail"), 3750 IPW2100_ORD(STAT_FULL_SCANS, "full scans"), 3751 IPW2100_ORD(CARD_DISABLED, "Card Disabled"), 3752 IPW2100_ORD(STAT_ROAM_INHIBIT, 3753 "times roaming was inhibited due to activity"), 3754 IPW2100_ORD(RSSI_AT_ASSN, 3755 "RSSI of associated AP at time of association"), 3756 IPW2100_ORD(STAT_ASSN_CAUSE1, 3757 "reassociation: no probe response or TX on hop"), 3758 IPW2100_ORD(STAT_ASSN_CAUSE2, 3759 "reassociation: poor tx/rx quality"), 3760 IPW2100_ORD(STAT_ASSN_CAUSE3, 3761 "reassociation: tx/rx quality (excessive AP load"), 3762 IPW2100_ORD(STAT_ASSN_CAUSE4, 3763 "reassociation: AP RSSI level"), 3764 IPW2100_ORD(STAT_ASSN_CAUSE5, 3765 "reassociations due to load leveling"), 3766 IPW2100_ORD(STAT_AUTH_FAIL, "times authentication failed"), 3767 IPW2100_ORD(STAT_AUTH_RESP_FAIL, 3768 "times authentication response failed"), 3769 IPW2100_ORD(STATION_TABLE_CNT, 3770 "entries in association table"), 3771 IPW2100_ORD(RSSI_AVG_CURR, "Current avg RSSI"), 3772 IPW2100_ORD(POWER_MGMT_MODE, "Power mode - 0=CAM, 1=PSP"), 3773 IPW2100_ORD(COUNTRY_CODE, 3774 "IEEE country code as recv'd from beacon"), 3775 IPW2100_ORD(COUNTRY_CHANNELS, 3776 "channels supported by country"), 3777 IPW2100_ORD(RESET_CNT, "adapter resets (warm)"), 3778 IPW2100_ORD(BEACON_INTERVAL, "Beacon interval"), 3779 IPW2100_ORD(ANTENNA_DIVERSITY, 3780 "TRUE if antenna diversity is disabled"), 3781 IPW2100_ORD(DTIM_PERIOD, "beacon intervals between DTIMs"), 3782 IPW2100_ORD(OUR_FREQ, 3783 "current radio freq lower digits - channel ID"), 3784 IPW2100_ORD(RTC_TIME, "current RTC time"), 3785 IPW2100_ORD(PORT_TYPE, "operating mode"), 3786 IPW2100_ORD(CURRENT_TX_RATE, "current tx rate"), 3787 IPW2100_ORD(SUPPORTED_RATES, "supported tx rates"), 3788 IPW2100_ORD(ATIM_WINDOW, "current ATIM Window"), 3789 IPW2100_ORD(BASIC_RATES, "basic tx rates"), 3790 IPW2100_ORD(NIC_HIGHEST_RATE, "NIC highest tx rate"), 3791 IPW2100_ORD(AP_HIGHEST_RATE, "AP highest tx rate"), 3792 IPW2100_ORD(CAPABILITIES, 3793 "Management frame capability field"), 3794 IPW2100_ORD(AUTH_TYPE, "Type of authentication"), 3795 IPW2100_ORD(RADIO_TYPE, "Adapter card platform type"), 3796 IPW2100_ORD(RTS_THRESHOLD, 3797 "Min packet length for RTS handshaking"), 3798 IPW2100_ORD(INT_MODE, "International mode"), 3799 IPW2100_ORD(FRAGMENTATION_THRESHOLD, 3800 "protocol frag threshold"), 3801 IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_START_ADDRESS, 3802 "EEPROM offset in SRAM"), 3803 IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_SIZE, 3804 "EEPROM size in SRAM"), 3805 IPW2100_ORD(EEPROM_SKU_CAPABILITY, "EEPROM SKU Capability"), 3806 IPW2100_ORD(EEPROM_IBSS_11B_CHANNELS, 3807 "EEPROM IBSS 11b channel set"), 3808 IPW2100_ORD(MAC_VERSION, "MAC Version"), 3809 IPW2100_ORD(MAC_REVISION, "MAC Revision"), 3810 IPW2100_ORD(RADIO_VERSION, "Radio Version"), 3811 IPW2100_ORD(NIC_MANF_DATE_TIME, "MANF Date/Time STAMP"), 3812 IPW2100_ORD(UCODE_VERSION, "Ucode Version"),}; 3813 3814 static ssize_t show_registers(struct device *d, struct device_attribute *attr, 3815 char *buf) 3816 { 3817 int i; 3818 struct ipw2100_priv *priv = dev_get_drvdata(d); 3819 struct net_device *dev = priv->net_dev; 3820 char *out = buf; 3821 u32 val = 0; 3822 3823 out += sprintf(out, "%30s [Address ] : Hex\n", "Register"); 3824 3825 for (i = 0; i < ARRAY_SIZE(hw_data); i++) { 3826 read_register(dev, hw_data[i].addr, &val); 3827 out += sprintf(out, "%30s [%08X] : %08X\n", 3828 hw_data[i].name, hw_data[i].addr, val); 3829 } 3830 3831 return out - buf; 3832 } 3833 3834 static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL); 3835 3836 static ssize_t show_hardware(struct device *d, struct device_attribute *attr, 3837 char *buf) 3838 { 3839 struct ipw2100_priv *priv = dev_get_drvdata(d); 3840 struct net_device *dev = priv->net_dev; 3841 char *out = buf; 3842 int i; 3843 3844 out += sprintf(out, "%30s [Address ] : Hex\n", "NIC entry"); 3845 3846 for (i = 0; i < ARRAY_SIZE(nic_data); i++) { 3847 u8 tmp8; 3848 u16 tmp16; 3849 u32 tmp32; 3850 3851 switch (nic_data[i].size) { 3852 case 1: 3853 read_nic_byte(dev, nic_data[i].addr, &tmp8); 3854 out += sprintf(out, "%30s [%08X] : %02X\n", 3855 nic_data[i].name, nic_data[i].addr, 3856 tmp8); 3857 break; 3858 case 2: 3859 read_nic_word(dev, nic_data[i].addr, &tmp16); 3860 out += sprintf(out, "%30s [%08X] : %04X\n", 3861 nic_data[i].name, nic_data[i].addr, 3862 tmp16); 3863 break; 3864 case 4: 3865 read_nic_dword(dev, nic_data[i].addr, &tmp32); 3866 out += sprintf(out, "%30s [%08X] : %08X\n", 3867 nic_data[i].name, nic_data[i].addr, 3868 tmp32); 3869 break; 3870 } 3871 } 3872 return out - buf; 3873 } 3874 3875 static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL); 3876 3877 static ssize_t show_memory(struct device *d, struct device_attribute *attr, 3878 char *buf) 3879 { 3880 struct ipw2100_priv *priv = dev_get_drvdata(d); 3881 struct net_device *dev = priv->net_dev; 3882 static unsigned long loop = 0; 3883 int len = 0; 3884 u32 buffer[4]; 3885 int i; 3886 char line[81]; 3887 3888 if (loop >= 0x30000) 3889 loop = 0; 3890 3891 /* sysfs provides us PAGE_SIZE buffer */ 3892 while (len < PAGE_SIZE - 128 && loop < 0x30000) { 3893 3894 if (priv->snapshot[0]) 3895 for (i = 0; i < 4; i++) 3896 buffer[i] = 3897 *(u32 *) SNAPSHOT_ADDR(loop + i * 4); 3898 else 3899 for (i = 0; i < 4; i++) 3900 read_nic_dword(dev, loop + i * 4, &buffer[i]); 3901 3902 if (priv->dump_raw) 3903 len += sprintf(buf + len, 3904 "%c%c%c%c" 3905 "%c%c%c%c" 3906 "%c%c%c%c" 3907 "%c%c%c%c", 3908 ((u8 *) buffer)[0x0], 3909 ((u8 *) buffer)[0x1], 3910 ((u8 *) buffer)[0x2], 3911 ((u8 *) buffer)[0x3], 3912 ((u8 *) buffer)[0x4], 3913 ((u8 *) buffer)[0x5], 3914 ((u8 *) buffer)[0x6], 3915 ((u8 *) buffer)[0x7], 3916 ((u8 *) buffer)[0x8], 3917 ((u8 *) buffer)[0x9], 3918 ((u8 *) buffer)[0xa], 3919 ((u8 *) buffer)[0xb], 3920 ((u8 *) buffer)[0xc], 3921 ((u8 *) buffer)[0xd], 3922 ((u8 *) buffer)[0xe], 3923 ((u8 *) buffer)[0xf]); 3924 else 3925 len += sprintf(buf + len, "%s\n", 3926 snprint_line(line, sizeof(line), 3927 (u8 *) buffer, 16, loop)); 3928 loop += 16; 3929 } 3930 3931 return len; 3932 } 3933 3934 static ssize_t store_memory(struct device *d, struct device_attribute *attr, 3935 const char *buf, size_t count) 3936 { 3937 struct ipw2100_priv *priv = dev_get_drvdata(d); 3938 struct net_device *dev = priv->net_dev; 3939 const char *p = buf; 3940 3941 (void)dev; /* kill unused-var warning for debug-only code */ 3942 3943 if (count < 1) 3944 return count; 3945 3946 if (p[0] == '1' || 3947 (count >= 2 && tolower(p[0]) == 'o' && tolower(p[1]) == 'n')) { 3948 IPW_DEBUG_INFO("%s: Setting memory dump to RAW mode.\n", 3949 dev->name); 3950 priv->dump_raw = 1; 3951 3952 } else if (p[0] == '0' || (count >= 2 && tolower(p[0]) == 'o' && 3953 tolower(p[1]) == 'f')) { 3954 IPW_DEBUG_INFO("%s: Setting memory dump to HEX mode.\n", 3955 dev->name); 3956 priv->dump_raw = 0; 3957 3958 } else if (tolower(p[0]) == 'r') { 3959 IPW_DEBUG_INFO("%s: Resetting firmware snapshot.\n", dev->name); 3960 ipw2100_snapshot_free(priv); 3961 3962 } else 3963 IPW_DEBUG_INFO("%s: Usage: 0|on = HEX, 1|off = RAW, " 3964 "reset = clear memory snapshot\n", dev->name); 3965 3966 return count; 3967 } 3968 3969 static DEVICE_ATTR(memory, S_IWUSR | S_IRUGO, show_memory, store_memory); 3970 3971 static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, 3972 char *buf) 3973 { 3974 struct ipw2100_priv *priv = dev_get_drvdata(d); 3975 u32 val = 0; 3976 int len = 0; 3977 u32 val_len; 3978 static int loop = 0; 3979 3980 if (priv->status & STATUS_RF_KILL_MASK) 3981 return 0; 3982 3983 if (loop >= ARRAY_SIZE(ord_data)) 3984 loop = 0; 3985 3986 /* sysfs provides us PAGE_SIZE buffer */ 3987 while (len < PAGE_SIZE - 128 && loop < ARRAY_SIZE(ord_data)) { 3988 val_len = sizeof(u32); 3989 3990 if (ipw2100_get_ordinal(priv, ord_data[loop].index, &val, 3991 &val_len)) 3992 len += sprintf(buf + len, "[0x%02X] = ERROR %s\n", 3993 ord_data[loop].index, 3994 ord_data[loop].desc); 3995 else 3996 len += sprintf(buf + len, "[0x%02X] = 0x%08X %s\n", 3997 ord_data[loop].index, val, 3998 ord_data[loop].desc); 3999 loop++; 4000 } 4001 4002 return len; 4003 } 4004 4005 static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL); 4006 4007 static ssize_t show_stats(struct device *d, struct device_attribute *attr, 4008 char *buf) 4009 { 4010 struct ipw2100_priv *priv = dev_get_drvdata(d); 4011 char *out = buf; 4012 4013 out += sprintf(out, "interrupts: %d {tx: %d, rx: %d, other: %d}\n", 4014 priv->interrupts, priv->tx_interrupts, 4015 priv->rx_interrupts, priv->inta_other); 4016 out += sprintf(out, "firmware resets: %d\n", priv->resets); 4017 out += sprintf(out, "firmware hangs: %d\n", priv->hangs); 4018 #ifdef CONFIG_IPW2100_DEBUG 4019 out += sprintf(out, "packet mismatch image: %s\n", 4020 priv->snapshot[0] ? "YES" : "NO"); 4021 #endif 4022 4023 return out - buf; 4024 } 4025 4026 static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); 4027 4028 static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) 4029 { 4030 int err; 4031 4032 if (mode == priv->ieee->iw_mode) 4033 return 0; 4034 4035 err = ipw2100_disable_adapter(priv); 4036 if (err) { 4037 printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", 4038 priv->net_dev->name, err); 4039 return err; 4040 } 4041 4042 switch (mode) { 4043 case IW_MODE_INFRA: 4044 priv->net_dev->type = ARPHRD_ETHER; 4045 break; 4046 case IW_MODE_ADHOC: 4047 priv->net_dev->type = ARPHRD_ETHER; 4048 break; 4049 #ifdef CONFIG_IPW2100_MONITOR 4050 case IW_MODE_MONITOR: 4051 priv->last_mode = priv->ieee->iw_mode; 4052 priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; 4053 break; 4054 #endif /* CONFIG_IPW2100_MONITOR */ 4055 } 4056 4057 priv->ieee->iw_mode = mode; 4058 4059 #ifdef CONFIG_PM 4060 /* Indicate ipw2100_download_firmware download firmware 4061 * from disk instead of memory. */ 4062 ipw2100_firmware.version = 0; 4063 #endif 4064 4065 printk(KERN_INFO "%s: Resetting on mode change.\n", priv->net_dev->name); 4066 priv->reset_backoff = 0; 4067 schedule_reset(priv); 4068 4069 return 0; 4070 } 4071 4072 static ssize_t show_internals(struct device *d, struct device_attribute *attr, 4073 char *buf) 4074 { 4075 struct ipw2100_priv *priv = dev_get_drvdata(d); 4076 int len = 0; 4077 4078 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 4079 4080 if (priv->status & STATUS_ASSOCIATED) 4081 len += sprintf(buf + len, "connected: %lu\n", 4082 get_seconds() - priv->connect_start); 4083 else 4084 len += sprintf(buf + len, "not connected\n"); 4085 4086 DUMP_VAR(ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx], "p"); 4087 DUMP_VAR(status, "08lx"); 4088 DUMP_VAR(config, "08lx"); 4089 DUMP_VAR(capability, "08lx"); 4090 4091 len += 4092 sprintf(buf + len, "last_rtc: %lu\n", 4093 (unsigned long)priv->last_rtc); 4094 4095 DUMP_VAR(fatal_error, "d"); 4096 DUMP_VAR(stop_hang_check, "d"); 4097 DUMP_VAR(stop_rf_kill, "d"); 4098 DUMP_VAR(messages_sent, "d"); 4099 4100 DUMP_VAR(tx_pend_stat.value, "d"); 4101 DUMP_VAR(tx_pend_stat.hi, "d"); 4102 4103 DUMP_VAR(tx_free_stat.value, "d"); 4104 DUMP_VAR(tx_free_stat.lo, "d"); 4105 4106 DUMP_VAR(msg_free_stat.value, "d"); 4107 DUMP_VAR(msg_free_stat.lo, "d"); 4108 4109 DUMP_VAR(msg_pend_stat.value, "d"); 4110 DUMP_VAR(msg_pend_stat.hi, "d"); 4111 4112 DUMP_VAR(fw_pend_stat.value, "d"); 4113 DUMP_VAR(fw_pend_stat.hi, "d"); 4114 4115 DUMP_VAR(txq_stat.value, "d"); 4116 DUMP_VAR(txq_stat.lo, "d"); 4117 4118 DUMP_VAR(ieee->scans, "d"); 4119 DUMP_VAR(reset_backoff, "d"); 4120 4121 return len; 4122 } 4123 4124 static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL); 4125 4126 static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, 4127 char *buf) 4128 { 4129 struct ipw2100_priv *priv = dev_get_drvdata(d); 4130 char essid[IW_ESSID_MAX_SIZE + 1]; 4131 u8 bssid[ETH_ALEN]; 4132 u32 chan = 0; 4133 char *out = buf; 4134 unsigned int length; 4135 int ret; 4136 4137 if (priv->status & STATUS_RF_KILL_MASK) 4138 return 0; 4139 4140 memset(essid, 0, sizeof(essid)); 4141 memset(bssid, 0, sizeof(bssid)); 4142 4143 length = IW_ESSID_MAX_SIZE; 4144 ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_SSID, essid, &length); 4145 if (ret) 4146 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 4147 __LINE__); 4148 4149 length = sizeof(bssid); 4150 ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, 4151 bssid, &length); 4152 if (ret) 4153 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 4154 __LINE__); 4155 4156 length = sizeof(u32); 4157 ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &length); 4158 if (ret) 4159 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 4160 __LINE__); 4161 4162 out += sprintf(out, "ESSID: %s\n", essid); 4163 out += sprintf(out, "BSSID: %pM\n", bssid); 4164 out += sprintf(out, "Channel: %d\n", chan); 4165 4166 return out - buf; 4167 } 4168 4169 static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL); 4170 4171 #ifdef CONFIG_IPW2100_DEBUG 4172 static ssize_t show_debug_level(struct device_driver *d, char *buf) 4173 { 4174 return sprintf(buf, "0x%08X\n", ipw2100_debug_level); 4175 } 4176 4177 static ssize_t store_debug_level(struct device_driver *d, 4178 const char *buf, size_t count) 4179 { 4180 u32 val; 4181 int ret; 4182 4183 ret = kstrtou32(buf, 0, &val); 4184 if (ret) 4185 IPW_DEBUG_INFO(": %s is not in hex or decimal form.\n", buf); 4186 else 4187 ipw2100_debug_level = val; 4188 4189 return strnlen(buf, count); 4190 } 4191 4192 static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, 4193 store_debug_level); 4194 #endif /* CONFIG_IPW2100_DEBUG */ 4195 4196 static ssize_t show_fatal_error(struct device *d, 4197 struct device_attribute *attr, char *buf) 4198 { 4199 struct ipw2100_priv *priv = dev_get_drvdata(d); 4200 char *out = buf; 4201 int i; 4202 4203 if (priv->fatal_error) 4204 out += sprintf(out, "0x%08X\n", priv->fatal_error); 4205 else 4206 out += sprintf(out, "0\n"); 4207 4208 for (i = 1; i <= IPW2100_ERROR_QUEUE; i++) { 4209 if (!priv->fatal_errors[(priv->fatal_index - i) % 4210 IPW2100_ERROR_QUEUE]) 4211 continue; 4212 4213 out += sprintf(out, "%d. 0x%08X\n", i, 4214 priv->fatal_errors[(priv->fatal_index - i) % 4215 IPW2100_ERROR_QUEUE]); 4216 } 4217 4218 return out - buf; 4219 } 4220 4221 static ssize_t store_fatal_error(struct device *d, 4222 struct device_attribute *attr, const char *buf, 4223 size_t count) 4224 { 4225 struct ipw2100_priv *priv = dev_get_drvdata(d); 4226 schedule_reset(priv); 4227 return count; 4228 } 4229 4230 static DEVICE_ATTR(fatal_error, S_IWUSR | S_IRUGO, show_fatal_error, 4231 store_fatal_error); 4232 4233 static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, 4234 char *buf) 4235 { 4236 struct ipw2100_priv *priv = dev_get_drvdata(d); 4237 return sprintf(buf, "%d\n", priv->ieee->scan_age); 4238 } 4239 4240 static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, 4241 const char *buf, size_t count) 4242 { 4243 struct ipw2100_priv *priv = dev_get_drvdata(d); 4244 struct net_device *dev = priv->net_dev; 4245 unsigned long val; 4246 int ret; 4247 4248 (void)dev; /* kill unused-var warning for debug-only code */ 4249 4250 IPW_DEBUG_INFO("enter\n"); 4251 4252 ret = kstrtoul(buf, 0, &val); 4253 if (ret) { 4254 IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name); 4255 } else { 4256 priv->ieee->scan_age = val; 4257 IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); 4258 } 4259 4260 IPW_DEBUG_INFO("exit\n"); 4261 return strnlen(buf, count); 4262 } 4263 4264 static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); 4265 4266 static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, 4267 char *buf) 4268 { 4269 /* 0 - RF kill not enabled 4270 1 - SW based RF kill active (sysfs) 4271 2 - HW based RF kill active 4272 3 - Both HW and SW baed RF kill active */ 4273 struct ipw2100_priv *priv = dev_get_drvdata(d); 4274 int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | 4275 (rf_kill_active(priv) ? 0x2 : 0x0); 4276 return sprintf(buf, "%i\n", val); 4277 } 4278 4279 static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) 4280 { 4281 if ((disable_radio ? 1 : 0) == 4282 (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) 4283 return 0; 4284 4285 IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", 4286 disable_radio ? "OFF" : "ON"); 4287 4288 mutex_lock(&priv->action_mutex); 4289 4290 if (disable_radio) { 4291 priv->status |= STATUS_RF_KILL_SW; 4292 ipw2100_down(priv); 4293 } else { 4294 priv->status &= ~STATUS_RF_KILL_SW; 4295 if (rf_kill_active(priv)) { 4296 IPW_DEBUG_RF_KILL("Can not turn radio back on - " 4297 "disabled by HW switch\n"); 4298 /* Make sure the RF_KILL check timer is running */ 4299 priv->stop_rf_kill = 0; 4300 mod_delayed_work(system_wq, &priv->rf_kill, 4301 round_jiffies_relative(HZ)); 4302 } else 4303 schedule_reset(priv); 4304 } 4305 4306 mutex_unlock(&priv->action_mutex); 4307 return 1; 4308 } 4309 4310 static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, 4311 const char *buf, size_t count) 4312 { 4313 struct ipw2100_priv *priv = dev_get_drvdata(d); 4314 ipw_radio_kill_sw(priv, buf[0] == '1'); 4315 return count; 4316 } 4317 4318 static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); 4319 4320 static struct attribute *ipw2100_sysfs_entries[] = { 4321 &dev_attr_hardware.attr, 4322 &dev_attr_registers.attr, 4323 &dev_attr_ordinals.attr, 4324 &dev_attr_pci.attr, 4325 &dev_attr_stats.attr, 4326 &dev_attr_internals.attr, 4327 &dev_attr_bssinfo.attr, 4328 &dev_attr_memory.attr, 4329 &dev_attr_scan_age.attr, 4330 &dev_attr_fatal_error.attr, 4331 &dev_attr_rf_kill.attr, 4332 &dev_attr_cfg.attr, 4333 &dev_attr_status.attr, 4334 &dev_attr_capability.attr, 4335 NULL, 4336 }; 4337 4338 static struct attribute_group ipw2100_attribute_group = { 4339 .attrs = ipw2100_sysfs_entries, 4340 }; 4341 4342 static int status_queue_allocate(struct ipw2100_priv *priv, int entries) 4343 { 4344 struct ipw2100_status_queue *q = &priv->status_queue; 4345 4346 IPW_DEBUG_INFO("enter\n"); 4347 4348 q->size = entries * sizeof(struct ipw2100_status); 4349 q->drv = 4350 (struct ipw2100_status *)pci_alloc_consistent(priv->pci_dev, 4351 q->size, &q->nic); 4352 if (!q->drv) { 4353 IPW_DEBUG_WARNING("Can not allocate status queue.\n"); 4354 return -ENOMEM; 4355 } 4356 4357 memset(q->drv, 0, q->size); 4358 4359 IPW_DEBUG_INFO("exit\n"); 4360 4361 return 0; 4362 } 4363 4364 static void status_queue_free(struct ipw2100_priv *priv) 4365 { 4366 IPW_DEBUG_INFO("enter\n"); 4367 4368 if (priv->status_queue.drv) { 4369 pci_free_consistent(priv->pci_dev, priv->status_queue.size, 4370 priv->status_queue.drv, 4371 priv->status_queue.nic); 4372 priv->status_queue.drv = NULL; 4373 } 4374 4375 IPW_DEBUG_INFO("exit\n"); 4376 } 4377 4378 static int bd_queue_allocate(struct ipw2100_priv *priv, 4379 struct ipw2100_bd_queue *q, int entries) 4380 { 4381 IPW_DEBUG_INFO("enter\n"); 4382 4383 memset(q, 0, sizeof(struct ipw2100_bd_queue)); 4384 4385 q->entries = entries; 4386 q->size = entries * sizeof(struct ipw2100_bd); 4387 q->drv = pci_alloc_consistent(priv->pci_dev, q->size, &q->nic); 4388 if (!q->drv) { 4389 IPW_DEBUG_INFO 4390 ("can't allocate shared memory for buffer descriptors\n"); 4391 return -ENOMEM; 4392 } 4393 memset(q->drv, 0, q->size); 4394 4395 IPW_DEBUG_INFO("exit\n"); 4396 4397 return 0; 4398 } 4399 4400 static void bd_queue_free(struct ipw2100_priv *priv, struct ipw2100_bd_queue *q) 4401 { 4402 IPW_DEBUG_INFO("enter\n"); 4403 4404 if (!q) 4405 return; 4406 4407 if (q->drv) { 4408 pci_free_consistent(priv->pci_dev, q->size, q->drv, q->nic); 4409 q->drv = NULL; 4410 } 4411 4412 IPW_DEBUG_INFO("exit\n"); 4413 } 4414 4415 static void bd_queue_initialize(struct ipw2100_priv *priv, 4416 struct ipw2100_bd_queue *q, u32 base, u32 size, 4417 u32 r, u32 w) 4418 { 4419 IPW_DEBUG_INFO("enter\n"); 4420 4421 IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, 4422 (u32) q->nic); 4423 4424 write_register(priv->net_dev, base, q->nic); 4425 write_register(priv->net_dev, size, q->entries); 4426 write_register(priv->net_dev, r, q->oldest); 4427 write_register(priv->net_dev, w, q->next); 4428 4429 IPW_DEBUG_INFO("exit\n"); 4430 } 4431 4432 static void ipw2100_kill_works(struct ipw2100_priv *priv) 4433 { 4434 priv->stop_rf_kill = 1; 4435 priv->stop_hang_check = 1; 4436 cancel_delayed_work_sync(&priv->reset_work); 4437 cancel_delayed_work_sync(&priv->security_work); 4438 cancel_delayed_work_sync(&priv->wx_event_work); 4439 cancel_delayed_work_sync(&priv->hang_check); 4440 cancel_delayed_work_sync(&priv->rf_kill); 4441 cancel_delayed_work_sync(&priv->scan_event); 4442 } 4443 4444 static int ipw2100_tx_allocate(struct ipw2100_priv *priv) 4445 { 4446 int i, j, err = -EINVAL; 4447 void *v; 4448 dma_addr_t p; 4449 4450 IPW_DEBUG_INFO("enter\n"); 4451 4452 err = bd_queue_allocate(priv, &priv->tx_queue, TX_QUEUE_LENGTH); 4453 if (err) { 4454 IPW_DEBUG_ERROR("%s: failed bd_queue_allocate\n", 4455 priv->net_dev->name); 4456 return err; 4457 } 4458 4459 priv->tx_buffers = kmalloc_array(TX_PENDED_QUEUE_LENGTH, 4460 sizeof(struct ipw2100_tx_packet), 4461 GFP_ATOMIC); 4462 if (!priv->tx_buffers) { 4463 bd_queue_free(priv, &priv->tx_queue); 4464 return -ENOMEM; 4465 } 4466 4467 for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { 4468 v = pci_alloc_consistent(priv->pci_dev, 4469 sizeof(struct ipw2100_data_header), 4470 &p); 4471 if (!v) { 4472 printk(KERN_ERR DRV_NAME 4473 ": %s: PCI alloc failed for tx " "buffers.\n", 4474 priv->net_dev->name); 4475 err = -ENOMEM; 4476 break; 4477 } 4478 4479 priv->tx_buffers[i].type = DATA; 4480 priv->tx_buffers[i].info.d_struct.data = 4481 (struct ipw2100_data_header *)v; 4482 priv->tx_buffers[i].info.d_struct.data_phys = p; 4483 priv->tx_buffers[i].info.d_struct.txb = NULL; 4484 } 4485 4486 if (i == TX_PENDED_QUEUE_LENGTH) 4487 return 0; 4488 4489 for (j = 0; j < i; j++) { 4490 pci_free_consistent(priv->pci_dev, 4491 sizeof(struct ipw2100_data_header), 4492 priv->tx_buffers[j].info.d_struct.data, 4493 priv->tx_buffers[j].info.d_struct. 4494 data_phys); 4495 } 4496 4497 kfree(priv->tx_buffers); 4498 priv->tx_buffers = NULL; 4499 4500 return err; 4501 } 4502 4503 static void ipw2100_tx_initialize(struct ipw2100_priv *priv) 4504 { 4505 int i; 4506 4507 IPW_DEBUG_INFO("enter\n"); 4508 4509 /* 4510 * reinitialize packet info lists 4511 */ 4512 INIT_LIST_HEAD(&priv->fw_pend_list); 4513 INIT_STAT(&priv->fw_pend_stat); 4514 4515 /* 4516 * reinitialize lists 4517 */ 4518 INIT_LIST_HEAD(&priv->tx_pend_list); 4519 INIT_LIST_HEAD(&priv->tx_free_list); 4520 INIT_STAT(&priv->tx_pend_stat); 4521 INIT_STAT(&priv->tx_free_stat); 4522 4523 for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { 4524 /* We simply drop any SKBs that have been queued for 4525 * transmit */ 4526 if (priv->tx_buffers[i].info.d_struct.txb) { 4527 libipw_txb_free(priv->tx_buffers[i].info.d_struct. 4528 txb); 4529 priv->tx_buffers[i].info.d_struct.txb = NULL; 4530 } 4531 4532 list_add_tail(&priv->tx_buffers[i].list, &priv->tx_free_list); 4533 } 4534 4535 SET_STAT(&priv->tx_free_stat, i); 4536 4537 priv->tx_queue.oldest = 0; 4538 priv->tx_queue.available = priv->tx_queue.entries; 4539 priv->tx_queue.next = 0; 4540 INIT_STAT(&priv->txq_stat); 4541 SET_STAT(&priv->txq_stat, priv->tx_queue.available); 4542 4543 bd_queue_initialize(priv, &priv->tx_queue, 4544 IPW_MEM_HOST_SHARED_TX_QUEUE_BD_BASE, 4545 IPW_MEM_HOST_SHARED_TX_QUEUE_BD_SIZE, 4546 IPW_MEM_HOST_SHARED_TX_QUEUE_READ_INDEX, 4547 IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX); 4548 4549 IPW_DEBUG_INFO("exit\n"); 4550 4551 } 4552 4553 static void ipw2100_tx_free(struct ipw2100_priv *priv) 4554 { 4555 int i; 4556 4557 IPW_DEBUG_INFO("enter\n"); 4558 4559 bd_queue_free(priv, &priv->tx_queue); 4560 4561 if (!priv->tx_buffers) 4562 return; 4563 4564 for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { 4565 if (priv->tx_buffers[i].info.d_struct.txb) { 4566 libipw_txb_free(priv->tx_buffers[i].info.d_struct. 4567 txb); 4568 priv->tx_buffers[i].info.d_struct.txb = NULL; 4569 } 4570 if (priv->tx_buffers[i].info.d_struct.data) 4571 pci_free_consistent(priv->pci_dev, 4572 sizeof(struct ipw2100_data_header), 4573 priv->tx_buffers[i].info.d_struct. 4574 data, 4575 priv->tx_buffers[i].info.d_struct. 4576 data_phys); 4577 } 4578 4579 kfree(priv->tx_buffers); 4580 priv->tx_buffers = NULL; 4581 4582 IPW_DEBUG_INFO("exit\n"); 4583 } 4584 4585 static int ipw2100_rx_allocate(struct ipw2100_priv *priv) 4586 { 4587 int i, j, err = -EINVAL; 4588 4589 IPW_DEBUG_INFO("enter\n"); 4590 4591 err = bd_queue_allocate(priv, &priv->rx_queue, RX_QUEUE_LENGTH); 4592 if (err) { 4593 IPW_DEBUG_INFO("failed bd_queue_allocate\n"); 4594 return err; 4595 } 4596 4597 err = status_queue_allocate(priv, RX_QUEUE_LENGTH); 4598 if (err) { 4599 IPW_DEBUG_INFO("failed status_queue_allocate\n"); 4600 bd_queue_free(priv, &priv->rx_queue); 4601 return err; 4602 } 4603 4604 /* 4605 * allocate packets 4606 */ 4607 priv->rx_buffers = kmalloc(RX_QUEUE_LENGTH * 4608 sizeof(struct ipw2100_rx_packet), 4609 GFP_KERNEL); 4610 if (!priv->rx_buffers) { 4611 IPW_DEBUG_INFO("can't allocate rx packet buffer table\n"); 4612 4613 bd_queue_free(priv, &priv->rx_queue); 4614 4615 status_queue_free(priv); 4616 4617 return -ENOMEM; 4618 } 4619 4620 for (i = 0; i < RX_QUEUE_LENGTH; i++) { 4621 struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; 4622 4623 err = ipw2100_alloc_skb(priv, packet); 4624 if (unlikely(err)) { 4625 err = -ENOMEM; 4626 break; 4627 } 4628 4629 /* The BD holds the cache aligned address */ 4630 priv->rx_queue.drv[i].host_addr = packet->dma_addr; 4631 priv->rx_queue.drv[i].buf_length = IPW_RX_NIC_BUFFER_LENGTH; 4632 priv->status_queue.drv[i].status_fields = 0; 4633 } 4634 4635 if (i == RX_QUEUE_LENGTH) 4636 return 0; 4637 4638 for (j = 0; j < i; j++) { 4639 pci_unmap_single(priv->pci_dev, priv->rx_buffers[j].dma_addr, 4640 sizeof(struct ipw2100_rx_packet), 4641 PCI_DMA_FROMDEVICE); 4642 dev_kfree_skb(priv->rx_buffers[j].skb); 4643 } 4644 4645 kfree(priv->rx_buffers); 4646 priv->rx_buffers = NULL; 4647 4648 bd_queue_free(priv, &priv->rx_queue); 4649 4650 status_queue_free(priv); 4651 4652 return err; 4653 } 4654 4655 static void ipw2100_rx_initialize(struct ipw2100_priv *priv) 4656 { 4657 IPW_DEBUG_INFO("enter\n"); 4658 4659 priv->rx_queue.oldest = 0; 4660 priv->rx_queue.available = priv->rx_queue.entries - 1; 4661 priv->rx_queue.next = priv->rx_queue.entries - 1; 4662 4663 INIT_STAT(&priv->rxq_stat); 4664 SET_STAT(&priv->rxq_stat, priv->rx_queue.available); 4665 4666 bd_queue_initialize(priv, &priv->rx_queue, 4667 IPW_MEM_HOST_SHARED_RX_BD_BASE, 4668 IPW_MEM_HOST_SHARED_RX_BD_SIZE, 4669 IPW_MEM_HOST_SHARED_RX_READ_INDEX, 4670 IPW_MEM_HOST_SHARED_RX_WRITE_INDEX); 4671 4672 /* set up the status queue */ 4673 write_register(priv->net_dev, IPW_MEM_HOST_SHARED_RX_STATUS_BASE, 4674 priv->status_queue.nic); 4675 4676 IPW_DEBUG_INFO("exit\n"); 4677 } 4678 4679 static void ipw2100_rx_free(struct ipw2100_priv *priv) 4680 { 4681 int i; 4682 4683 IPW_DEBUG_INFO("enter\n"); 4684 4685 bd_queue_free(priv, &priv->rx_queue); 4686 status_queue_free(priv); 4687 4688 if (!priv->rx_buffers) 4689 return; 4690 4691 for (i = 0; i < RX_QUEUE_LENGTH; i++) { 4692 if (priv->rx_buffers[i].rxp) { 4693 pci_unmap_single(priv->pci_dev, 4694 priv->rx_buffers[i].dma_addr, 4695 sizeof(struct ipw2100_rx), 4696 PCI_DMA_FROMDEVICE); 4697 dev_kfree_skb(priv->rx_buffers[i].skb); 4698 } 4699 } 4700 4701 kfree(priv->rx_buffers); 4702 priv->rx_buffers = NULL; 4703 4704 IPW_DEBUG_INFO("exit\n"); 4705 } 4706 4707 static int ipw2100_read_mac_address(struct ipw2100_priv *priv) 4708 { 4709 u32 length = ETH_ALEN; 4710 u8 addr[ETH_ALEN]; 4711 4712 int err; 4713 4714 err = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ADAPTER_MAC, addr, &length); 4715 if (err) { 4716 IPW_DEBUG_INFO("MAC address read failed\n"); 4717 return -EIO; 4718 } 4719 4720 memcpy(priv->net_dev->dev_addr, addr, ETH_ALEN); 4721 IPW_DEBUG_INFO("card MAC is %pM\n", priv->net_dev->dev_addr); 4722 4723 return 0; 4724 } 4725 4726 /******************************************************************** 4727 * 4728 * Firmware Commands 4729 * 4730 ********************************************************************/ 4731 4732 static int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode) 4733 { 4734 struct host_command cmd = { 4735 .host_command = ADAPTER_ADDRESS, 4736 .host_command_sequence = 0, 4737 .host_command_length = ETH_ALEN 4738 }; 4739 int err; 4740 4741 IPW_DEBUG_HC("SET_MAC_ADDRESS\n"); 4742 4743 IPW_DEBUG_INFO("enter\n"); 4744 4745 if (priv->config & CFG_CUSTOM_MAC) { 4746 memcpy(cmd.host_command_parameters, priv->mac_addr, ETH_ALEN); 4747 memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); 4748 } else 4749 memcpy(cmd.host_command_parameters, priv->net_dev->dev_addr, 4750 ETH_ALEN); 4751 4752 err = ipw2100_hw_send_command(priv, &cmd); 4753 4754 IPW_DEBUG_INFO("exit\n"); 4755 return err; 4756 } 4757 4758 static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type, 4759 int batch_mode) 4760 { 4761 struct host_command cmd = { 4762 .host_command = PORT_TYPE, 4763 .host_command_sequence = 0, 4764 .host_command_length = sizeof(u32) 4765 }; 4766 int err; 4767 4768 switch (port_type) { 4769 case IW_MODE_INFRA: 4770 cmd.host_command_parameters[0] = IPW_BSS; 4771 break; 4772 case IW_MODE_ADHOC: 4773 cmd.host_command_parameters[0] = IPW_IBSS; 4774 break; 4775 } 4776 4777 IPW_DEBUG_HC("PORT_TYPE: %s\n", 4778 port_type == IPW_IBSS ? "Ad-Hoc" : "Managed"); 4779 4780 if (!batch_mode) { 4781 err = ipw2100_disable_adapter(priv); 4782 if (err) { 4783 printk(KERN_ERR DRV_NAME 4784 ": %s: Could not disable adapter %d\n", 4785 priv->net_dev->name, err); 4786 return err; 4787 } 4788 } 4789 4790 /* send cmd to firmware */ 4791 err = ipw2100_hw_send_command(priv, &cmd); 4792 4793 if (!batch_mode) 4794 ipw2100_enable_adapter(priv); 4795 4796 return err; 4797 } 4798 4799 static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, 4800 int batch_mode) 4801 { 4802 struct host_command cmd = { 4803 .host_command = CHANNEL, 4804 .host_command_sequence = 0, 4805 .host_command_length = sizeof(u32) 4806 }; 4807 int err; 4808 4809 cmd.host_command_parameters[0] = channel; 4810 4811 IPW_DEBUG_HC("CHANNEL: %d\n", channel); 4812 4813 /* If BSS then we don't support channel selection */ 4814 if (priv->ieee->iw_mode == IW_MODE_INFRA) 4815 return 0; 4816 4817 if ((channel != 0) && 4818 ((channel < REG_MIN_CHANNEL) || (channel > REG_MAX_CHANNEL))) 4819 return -EINVAL; 4820 4821 if (!batch_mode) { 4822 err = ipw2100_disable_adapter(priv); 4823 if (err) 4824 return err; 4825 } 4826 4827 err = ipw2100_hw_send_command(priv, &cmd); 4828 if (err) { 4829 IPW_DEBUG_INFO("Failed to set channel to %d", channel); 4830 return err; 4831 } 4832 4833 if (channel) 4834 priv->config |= CFG_STATIC_CHANNEL; 4835 else 4836 priv->config &= ~CFG_STATIC_CHANNEL; 4837 4838 priv->channel = channel; 4839 4840 if (!batch_mode) { 4841 err = ipw2100_enable_adapter(priv); 4842 if (err) 4843 return err; 4844 } 4845 4846 return 0; 4847 } 4848 4849 static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode) 4850 { 4851 struct host_command cmd = { 4852 .host_command = SYSTEM_CONFIG, 4853 .host_command_sequence = 0, 4854 .host_command_length = 12, 4855 }; 4856 u32 ibss_mask, len = sizeof(u32); 4857 int err; 4858 4859 /* Set system configuration */ 4860 4861 if (!batch_mode) { 4862 err = ipw2100_disable_adapter(priv); 4863 if (err) 4864 return err; 4865 } 4866 4867 if (priv->ieee->iw_mode == IW_MODE_ADHOC) 4868 cmd.host_command_parameters[0] |= IPW_CFG_IBSS_AUTO_START; 4869 4870 cmd.host_command_parameters[0] |= IPW_CFG_IBSS_MASK | 4871 IPW_CFG_BSS_MASK | IPW_CFG_802_1x_ENABLE; 4872 4873 if (!(priv->config & CFG_LONG_PREAMBLE)) 4874 cmd.host_command_parameters[0] |= IPW_CFG_PREAMBLE_AUTO; 4875 4876 err = ipw2100_get_ordinal(priv, 4877 IPW_ORD_EEPROM_IBSS_11B_CHANNELS, 4878 &ibss_mask, &len); 4879 if (err) 4880 ibss_mask = IPW_IBSS_11B_DEFAULT_MASK; 4881 4882 cmd.host_command_parameters[1] = REG_CHANNEL_MASK; 4883 cmd.host_command_parameters[2] = REG_CHANNEL_MASK & ibss_mask; 4884 4885 /* 11b only */ 4886 /*cmd.host_command_parameters[0] |= DIVERSITY_ANTENNA_A; */ 4887 4888 err = ipw2100_hw_send_command(priv, &cmd); 4889 if (err) 4890 return err; 4891 4892 /* If IPv6 is configured in the kernel then we don't want to filter out all 4893 * of the multicast packets as IPv6 needs some. */ 4894 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 4895 cmd.host_command = ADD_MULTICAST; 4896 cmd.host_command_sequence = 0; 4897 cmd.host_command_length = 0; 4898 4899 ipw2100_hw_send_command(priv, &cmd); 4900 #endif 4901 if (!batch_mode) { 4902 err = ipw2100_enable_adapter(priv); 4903 if (err) 4904 return err; 4905 } 4906 4907 return 0; 4908 } 4909 4910 static int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate, 4911 int batch_mode) 4912 { 4913 struct host_command cmd = { 4914 .host_command = BASIC_TX_RATES, 4915 .host_command_sequence = 0, 4916 .host_command_length = 4 4917 }; 4918 int err; 4919 4920 cmd.host_command_parameters[0] = rate & TX_RATE_MASK; 4921 4922 if (!batch_mode) { 4923 err = ipw2100_disable_adapter(priv); 4924 if (err) 4925 return err; 4926 } 4927 4928 /* Set BASIC TX Rate first */ 4929 ipw2100_hw_send_command(priv, &cmd); 4930 4931 /* Set TX Rate */ 4932 cmd.host_command = TX_RATES; 4933 ipw2100_hw_send_command(priv, &cmd); 4934 4935 /* Set MSDU TX Rate */ 4936 cmd.host_command = MSDU_TX_RATES; 4937 ipw2100_hw_send_command(priv, &cmd); 4938 4939 if (!batch_mode) { 4940 err = ipw2100_enable_adapter(priv); 4941 if (err) 4942 return err; 4943 } 4944 4945 priv->tx_rates = rate; 4946 4947 return 0; 4948 } 4949 4950 static int ipw2100_set_power_mode(struct ipw2100_priv *priv, int power_level) 4951 { 4952 struct host_command cmd = { 4953 .host_command = POWER_MODE, 4954 .host_command_sequence = 0, 4955 .host_command_length = 4 4956 }; 4957 int err; 4958 4959 cmd.host_command_parameters[0] = power_level; 4960 4961 err = ipw2100_hw_send_command(priv, &cmd); 4962 if (err) 4963 return err; 4964 4965 if (power_level == IPW_POWER_MODE_CAM) 4966 priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); 4967 else 4968 priv->power_mode = IPW_POWER_ENABLED | power_level; 4969 4970 #ifdef IPW2100_TX_POWER 4971 if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) { 4972 /* Set beacon interval */ 4973 cmd.host_command = TX_POWER_INDEX; 4974 cmd.host_command_parameters[0] = (u32) priv->adhoc_power; 4975 4976 err = ipw2100_hw_send_command(priv, &cmd); 4977 if (err) 4978 return err; 4979 } 4980 #endif 4981 4982 return 0; 4983 } 4984 4985 static int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold) 4986 { 4987 struct host_command cmd = { 4988 .host_command = RTS_THRESHOLD, 4989 .host_command_sequence = 0, 4990 .host_command_length = 4 4991 }; 4992 int err; 4993 4994 if (threshold & RTS_DISABLED) 4995 cmd.host_command_parameters[0] = MAX_RTS_THRESHOLD; 4996 else 4997 cmd.host_command_parameters[0] = threshold & ~RTS_DISABLED; 4998 4999 err = ipw2100_hw_send_command(priv, &cmd); 5000 if (err) 5001 return err; 5002 5003 priv->rts_threshold = threshold; 5004 5005 return 0; 5006 } 5007 5008 #if 0 5009 int ipw2100_set_fragmentation_threshold(struct ipw2100_priv *priv, 5010 u32 threshold, int batch_mode) 5011 { 5012 struct host_command cmd = { 5013 .host_command = FRAG_THRESHOLD, 5014 .host_command_sequence = 0, 5015 .host_command_length = 4, 5016 .host_command_parameters[0] = 0, 5017 }; 5018 int err; 5019 5020 if (!batch_mode) { 5021 err = ipw2100_disable_adapter(priv); 5022 if (err) 5023 return err; 5024 } 5025 5026 if (threshold == 0) 5027 threshold = DEFAULT_FRAG_THRESHOLD; 5028 else { 5029 threshold = max(threshold, MIN_FRAG_THRESHOLD); 5030 threshold = min(threshold, MAX_FRAG_THRESHOLD); 5031 } 5032 5033 cmd.host_command_parameters[0] = threshold; 5034 5035 IPW_DEBUG_HC("FRAG_THRESHOLD: %u\n", threshold); 5036 5037 err = ipw2100_hw_send_command(priv, &cmd); 5038 5039 if (!batch_mode) 5040 ipw2100_enable_adapter(priv); 5041 5042 if (!err) 5043 priv->frag_threshold = threshold; 5044 5045 return err; 5046 } 5047 #endif 5048 5049 static int ipw2100_set_short_retry(struct ipw2100_priv *priv, u32 retry) 5050 { 5051 struct host_command cmd = { 5052 .host_command = SHORT_RETRY_LIMIT, 5053 .host_command_sequence = 0, 5054 .host_command_length = 4 5055 }; 5056 int err; 5057 5058 cmd.host_command_parameters[0] = retry; 5059 5060 err = ipw2100_hw_send_command(priv, &cmd); 5061 if (err) 5062 return err; 5063 5064 priv->short_retry_limit = retry; 5065 5066 return 0; 5067 } 5068 5069 static int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry) 5070 { 5071 struct host_command cmd = { 5072 .host_command = LONG_RETRY_LIMIT, 5073 .host_command_sequence = 0, 5074 .host_command_length = 4 5075 }; 5076 int err; 5077 5078 cmd.host_command_parameters[0] = retry; 5079 5080 err = ipw2100_hw_send_command(priv, &cmd); 5081 if (err) 5082 return err; 5083 5084 priv->long_retry_limit = retry; 5085 5086 return 0; 5087 } 5088 5089 static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 * bssid, 5090 int batch_mode) 5091 { 5092 struct host_command cmd = { 5093 .host_command = MANDATORY_BSSID, 5094 .host_command_sequence = 0, 5095 .host_command_length = (bssid == NULL) ? 0 : ETH_ALEN 5096 }; 5097 int err; 5098 5099 #ifdef CONFIG_IPW2100_DEBUG 5100 if (bssid != NULL) 5101 IPW_DEBUG_HC("MANDATORY_BSSID: %pM\n", bssid); 5102 else 5103 IPW_DEBUG_HC("MANDATORY_BSSID: <clear>\n"); 5104 #endif 5105 /* if BSSID is empty then we disable mandatory bssid mode */ 5106 if (bssid != NULL) 5107 memcpy(cmd.host_command_parameters, bssid, ETH_ALEN); 5108 5109 if (!batch_mode) { 5110 err = ipw2100_disable_adapter(priv); 5111 if (err) 5112 return err; 5113 } 5114 5115 err = ipw2100_hw_send_command(priv, &cmd); 5116 5117 if (!batch_mode) 5118 ipw2100_enable_adapter(priv); 5119 5120 return err; 5121 } 5122 5123 static int ipw2100_disassociate_bssid(struct ipw2100_priv *priv) 5124 { 5125 struct host_command cmd = { 5126 .host_command = DISASSOCIATION_BSSID, 5127 .host_command_sequence = 0, 5128 .host_command_length = ETH_ALEN 5129 }; 5130 int err; 5131 int len; 5132 5133 IPW_DEBUG_HC("DISASSOCIATION_BSSID\n"); 5134 5135 len = ETH_ALEN; 5136 /* The Firmware currently ignores the BSSID and just disassociates from 5137 * the currently associated AP -- but in the off chance that a future 5138 * firmware does use the BSSID provided here, we go ahead and try and 5139 * set it to the currently associated AP's BSSID */ 5140 memcpy(cmd.host_command_parameters, priv->bssid, ETH_ALEN); 5141 5142 err = ipw2100_hw_send_command(priv, &cmd); 5143 5144 return err; 5145 } 5146 5147 static int ipw2100_set_wpa_ie(struct ipw2100_priv *, 5148 struct ipw2100_wpa_assoc_frame *, int) 5149 __attribute__ ((unused)); 5150 5151 static int ipw2100_set_wpa_ie(struct ipw2100_priv *priv, 5152 struct ipw2100_wpa_assoc_frame *wpa_frame, 5153 int batch_mode) 5154 { 5155 struct host_command cmd = { 5156 .host_command = SET_WPA_IE, 5157 .host_command_sequence = 0, 5158 .host_command_length = sizeof(struct ipw2100_wpa_assoc_frame), 5159 }; 5160 int err; 5161 5162 IPW_DEBUG_HC("SET_WPA_IE\n"); 5163 5164 if (!batch_mode) { 5165 err = ipw2100_disable_adapter(priv); 5166 if (err) 5167 return err; 5168 } 5169 5170 memcpy(cmd.host_command_parameters, wpa_frame, 5171 sizeof(struct ipw2100_wpa_assoc_frame)); 5172 5173 err = ipw2100_hw_send_command(priv, &cmd); 5174 5175 if (!batch_mode) { 5176 if (ipw2100_enable_adapter(priv)) 5177 err = -EIO; 5178 } 5179 5180 return err; 5181 } 5182 5183 struct security_info_params { 5184 u32 allowed_ciphers; 5185 u16 version; 5186 u8 auth_mode; 5187 u8 replay_counters_number; 5188 u8 unicast_using_group; 5189 } __packed; 5190 5191 static int ipw2100_set_security_information(struct ipw2100_priv *priv, 5192 int auth_mode, 5193 int security_level, 5194 int unicast_using_group, 5195 int batch_mode) 5196 { 5197 struct host_command cmd = { 5198 .host_command = SET_SECURITY_INFORMATION, 5199 .host_command_sequence = 0, 5200 .host_command_length = sizeof(struct security_info_params) 5201 }; 5202 struct security_info_params *security = 5203 (struct security_info_params *)&cmd.host_command_parameters; 5204 int err; 5205 memset(security, 0, sizeof(*security)); 5206 5207 /* If shared key AP authentication is turned on, then we need to 5208 * configure the firmware to try and use it. 5209 * 5210 * Actual data encryption/decryption is handled by the host. */ 5211 security->auth_mode = auth_mode; 5212 security->unicast_using_group = unicast_using_group; 5213 5214 switch (security_level) { 5215 default: 5216 case SEC_LEVEL_0: 5217 security->allowed_ciphers = IPW_NONE_CIPHER; 5218 break; 5219 case SEC_LEVEL_1: 5220 security->allowed_ciphers = IPW_WEP40_CIPHER | 5221 IPW_WEP104_CIPHER; 5222 break; 5223 case SEC_LEVEL_2: 5224 security->allowed_ciphers = IPW_WEP40_CIPHER | 5225 IPW_WEP104_CIPHER | IPW_TKIP_CIPHER; 5226 break; 5227 case SEC_LEVEL_2_CKIP: 5228 security->allowed_ciphers = IPW_WEP40_CIPHER | 5229 IPW_WEP104_CIPHER | IPW_CKIP_CIPHER; 5230 break; 5231 case SEC_LEVEL_3: 5232 security->allowed_ciphers = IPW_WEP40_CIPHER | 5233 IPW_WEP104_CIPHER | IPW_TKIP_CIPHER | IPW_CCMP_CIPHER; 5234 break; 5235 } 5236 5237 IPW_DEBUG_HC 5238 ("SET_SECURITY_INFORMATION: auth:%d cipher:0x%02X (level %d)\n", 5239 security->auth_mode, security->allowed_ciphers, security_level); 5240 5241 security->replay_counters_number = 0; 5242 5243 if (!batch_mode) { 5244 err = ipw2100_disable_adapter(priv); 5245 if (err) 5246 return err; 5247 } 5248 5249 err = ipw2100_hw_send_command(priv, &cmd); 5250 5251 if (!batch_mode) 5252 ipw2100_enable_adapter(priv); 5253 5254 return err; 5255 } 5256 5257 static int ipw2100_set_tx_power(struct ipw2100_priv *priv, u32 tx_power) 5258 { 5259 struct host_command cmd = { 5260 .host_command = TX_POWER_INDEX, 5261 .host_command_sequence = 0, 5262 .host_command_length = 4 5263 }; 5264 int err = 0; 5265 u32 tmp = tx_power; 5266 5267 if (tx_power != IPW_TX_POWER_DEFAULT) 5268 tmp = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / 5269 (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); 5270 5271 cmd.host_command_parameters[0] = tmp; 5272 5273 if (priv->ieee->iw_mode == IW_MODE_ADHOC) 5274 err = ipw2100_hw_send_command(priv, &cmd); 5275 if (!err) 5276 priv->tx_power = tx_power; 5277 5278 return 0; 5279 } 5280 5281 static int ipw2100_set_ibss_beacon_interval(struct ipw2100_priv *priv, 5282 u32 interval, int batch_mode) 5283 { 5284 struct host_command cmd = { 5285 .host_command = BEACON_INTERVAL, 5286 .host_command_sequence = 0, 5287 .host_command_length = 4 5288 }; 5289 int err; 5290 5291 cmd.host_command_parameters[0] = interval; 5292 5293 IPW_DEBUG_INFO("enter\n"); 5294 5295 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 5296 if (!batch_mode) { 5297 err = ipw2100_disable_adapter(priv); 5298 if (err) 5299 return err; 5300 } 5301 5302 ipw2100_hw_send_command(priv, &cmd); 5303 5304 if (!batch_mode) { 5305 err = ipw2100_enable_adapter(priv); 5306 if (err) 5307 return err; 5308 } 5309 } 5310 5311 IPW_DEBUG_INFO("exit\n"); 5312 5313 return 0; 5314 } 5315 5316 static void ipw2100_queues_initialize(struct ipw2100_priv *priv) 5317 { 5318 ipw2100_tx_initialize(priv); 5319 ipw2100_rx_initialize(priv); 5320 ipw2100_msg_initialize(priv); 5321 } 5322 5323 static void ipw2100_queues_free(struct ipw2100_priv *priv) 5324 { 5325 ipw2100_tx_free(priv); 5326 ipw2100_rx_free(priv); 5327 ipw2100_msg_free(priv); 5328 } 5329 5330 static int ipw2100_queues_allocate(struct ipw2100_priv *priv) 5331 { 5332 if (ipw2100_tx_allocate(priv) || 5333 ipw2100_rx_allocate(priv) || ipw2100_msg_allocate(priv)) 5334 goto fail; 5335 5336 return 0; 5337 5338 fail: 5339 ipw2100_tx_free(priv); 5340 ipw2100_rx_free(priv); 5341 ipw2100_msg_free(priv); 5342 return -ENOMEM; 5343 } 5344 5345 #define IPW_PRIVACY_CAPABLE 0x0008 5346 5347 static int ipw2100_set_wep_flags(struct ipw2100_priv *priv, u32 flags, 5348 int batch_mode) 5349 { 5350 struct host_command cmd = { 5351 .host_command = WEP_FLAGS, 5352 .host_command_sequence = 0, 5353 .host_command_length = 4 5354 }; 5355 int err; 5356 5357 cmd.host_command_parameters[0] = flags; 5358 5359 IPW_DEBUG_HC("WEP_FLAGS: flags = 0x%08X\n", flags); 5360 5361 if (!batch_mode) { 5362 err = ipw2100_disable_adapter(priv); 5363 if (err) { 5364 printk(KERN_ERR DRV_NAME 5365 ": %s: Could not disable adapter %d\n", 5366 priv->net_dev->name, err); 5367 return err; 5368 } 5369 } 5370 5371 /* send cmd to firmware */ 5372 err = ipw2100_hw_send_command(priv, &cmd); 5373 5374 if (!batch_mode) 5375 ipw2100_enable_adapter(priv); 5376 5377 return err; 5378 } 5379 5380 struct ipw2100_wep_key { 5381 u8 idx; 5382 u8 len; 5383 u8 key[13]; 5384 }; 5385 5386 /* Macros to ease up priting WEP keys */ 5387 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 5388 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 5389 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 5390 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 5391 5392 /** 5393 * Set a the wep key 5394 * 5395 * @priv: struct to work on 5396 * @idx: index of the key we want to set 5397 * @key: ptr to the key data to set 5398 * @len: length of the buffer at @key 5399 * @batch_mode: FIXME perform the operation in batch mode, not 5400 * disabling the device. 5401 * 5402 * @returns 0 if OK, < 0 errno code on error. 5403 * 5404 * Fill out a command structure with the new wep key, length an 5405 * index and send it down the wire. 5406 */ 5407 static int ipw2100_set_key(struct ipw2100_priv *priv, 5408 int idx, char *key, int len, int batch_mode) 5409 { 5410 int keylen = len ? (len <= 5 ? 5 : 13) : 0; 5411 struct host_command cmd = { 5412 .host_command = WEP_KEY_INFO, 5413 .host_command_sequence = 0, 5414 .host_command_length = sizeof(struct ipw2100_wep_key), 5415 }; 5416 struct ipw2100_wep_key *wep_key = (void *)cmd.host_command_parameters; 5417 int err; 5418 5419 IPW_DEBUG_HC("WEP_KEY_INFO: index = %d, len = %d/%d\n", 5420 idx, keylen, len); 5421 5422 /* NOTE: We don't check cached values in case the firmware was reset 5423 * or some other problem is occurring. If the user is setting the key, 5424 * then we push the change */ 5425 5426 wep_key->idx = idx; 5427 wep_key->len = keylen; 5428 5429 if (keylen) { 5430 memcpy(wep_key->key, key, len); 5431 memset(wep_key->key + len, 0, keylen - len); 5432 } 5433 5434 /* Will be optimized out on debug not being configured in */ 5435 if (keylen == 0) 5436 IPW_DEBUG_WEP("%s: Clearing key %d\n", 5437 priv->net_dev->name, wep_key->idx); 5438 else if (keylen == 5) 5439 IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_64 "\n", 5440 priv->net_dev->name, wep_key->idx, wep_key->len, 5441 WEP_STR_64(wep_key->key)); 5442 else 5443 IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_128 5444 "\n", 5445 priv->net_dev->name, wep_key->idx, wep_key->len, 5446 WEP_STR_128(wep_key->key)); 5447 5448 if (!batch_mode) { 5449 err = ipw2100_disable_adapter(priv); 5450 /* FIXME: IPG: shouldn't this prink be in _disable_adapter()? */ 5451 if (err) { 5452 printk(KERN_ERR DRV_NAME 5453 ": %s: Could not disable adapter %d\n", 5454 priv->net_dev->name, err); 5455 return err; 5456 } 5457 } 5458 5459 /* send cmd to firmware */ 5460 err = ipw2100_hw_send_command(priv, &cmd); 5461 5462 if (!batch_mode) { 5463 int err2 = ipw2100_enable_adapter(priv); 5464 if (err == 0) 5465 err = err2; 5466 } 5467 return err; 5468 } 5469 5470 static int ipw2100_set_key_index(struct ipw2100_priv *priv, 5471 int idx, int batch_mode) 5472 { 5473 struct host_command cmd = { 5474 .host_command = WEP_KEY_INDEX, 5475 .host_command_sequence = 0, 5476 .host_command_length = 4, 5477 .host_command_parameters = {idx}, 5478 }; 5479 int err; 5480 5481 IPW_DEBUG_HC("WEP_KEY_INDEX: index = %d\n", idx); 5482 5483 if (idx < 0 || idx > 3) 5484 return -EINVAL; 5485 5486 if (!batch_mode) { 5487 err = ipw2100_disable_adapter(priv); 5488 if (err) { 5489 printk(KERN_ERR DRV_NAME 5490 ": %s: Could not disable adapter %d\n", 5491 priv->net_dev->name, err); 5492 return err; 5493 } 5494 } 5495 5496 /* send cmd to firmware */ 5497 err = ipw2100_hw_send_command(priv, &cmd); 5498 5499 if (!batch_mode) 5500 ipw2100_enable_adapter(priv); 5501 5502 return err; 5503 } 5504 5505 static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode) 5506 { 5507 int i, err, auth_mode, sec_level, use_group; 5508 5509 if (!(priv->status & STATUS_RUNNING)) 5510 return 0; 5511 5512 if (!batch_mode) { 5513 err = ipw2100_disable_adapter(priv); 5514 if (err) 5515 return err; 5516 } 5517 5518 if (!priv->ieee->sec.enabled) { 5519 err = 5520 ipw2100_set_security_information(priv, IPW_AUTH_OPEN, 5521 SEC_LEVEL_0, 0, 1); 5522 } else { 5523 auth_mode = IPW_AUTH_OPEN; 5524 if (priv->ieee->sec.flags & SEC_AUTH_MODE) { 5525 if (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY) 5526 auth_mode = IPW_AUTH_SHARED; 5527 else if (priv->ieee->sec.auth_mode == WLAN_AUTH_LEAP) 5528 auth_mode = IPW_AUTH_LEAP_CISCO_ID; 5529 } 5530 5531 sec_level = SEC_LEVEL_0; 5532 if (priv->ieee->sec.flags & SEC_LEVEL) 5533 sec_level = priv->ieee->sec.level; 5534 5535 use_group = 0; 5536 if (priv->ieee->sec.flags & SEC_UNICAST_GROUP) 5537 use_group = priv->ieee->sec.unicast_uses_group; 5538 5539 err = 5540 ipw2100_set_security_information(priv, auth_mode, sec_level, 5541 use_group, 1); 5542 } 5543 5544 if (err) 5545 goto exit; 5546 5547 if (priv->ieee->sec.enabled) { 5548 for (i = 0; i < 4; i++) { 5549 if (!(priv->ieee->sec.flags & (1 << i))) { 5550 memset(priv->ieee->sec.keys[i], 0, WEP_KEY_LEN); 5551 priv->ieee->sec.key_sizes[i] = 0; 5552 } else { 5553 err = ipw2100_set_key(priv, i, 5554 priv->ieee->sec.keys[i], 5555 priv->ieee->sec. 5556 key_sizes[i], 1); 5557 if (err) 5558 goto exit; 5559 } 5560 } 5561 5562 ipw2100_set_key_index(priv, priv->ieee->crypt_info.tx_keyidx, 1); 5563 } 5564 5565 /* Always enable privacy so the Host can filter WEP packets if 5566 * encrypted data is sent up */ 5567 err = 5568 ipw2100_set_wep_flags(priv, 5569 priv->ieee->sec. 5570 enabled ? IPW_PRIVACY_CAPABLE : 0, 1); 5571 if (err) 5572 goto exit; 5573 5574 priv->status &= ~STATUS_SECURITY_UPDATED; 5575 5576 exit: 5577 if (!batch_mode) 5578 ipw2100_enable_adapter(priv); 5579 5580 return err; 5581 } 5582 5583 static void ipw2100_security_work(struct work_struct *work) 5584 { 5585 struct ipw2100_priv *priv = 5586 container_of(work, struct ipw2100_priv, security_work.work); 5587 5588 /* If we happen to have reconnected before we get a chance to 5589 * process this, then update the security settings--which causes 5590 * a disassociation to occur */ 5591 if (!(priv->status & STATUS_ASSOCIATED) && 5592 priv->status & STATUS_SECURITY_UPDATED) 5593 ipw2100_configure_security(priv, 0); 5594 } 5595 5596 static void shim__set_security(struct net_device *dev, 5597 struct libipw_security *sec) 5598 { 5599 struct ipw2100_priv *priv = libipw_priv(dev); 5600 int i, force_update = 0; 5601 5602 mutex_lock(&priv->action_mutex); 5603 if (!(priv->status & STATUS_INITIALIZED)) 5604 goto done; 5605 5606 for (i = 0; i < 4; i++) { 5607 if (sec->flags & (1 << i)) { 5608 priv->ieee->sec.key_sizes[i] = sec->key_sizes[i]; 5609 if (sec->key_sizes[i] == 0) 5610 priv->ieee->sec.flags &= ~(1 << i); 5611 else 5612 memcpy(priv->ieee->sec.keys[i], sec->keys[i], 5613 sec->key_sizes[i]); 5614 if (sec->level == SEC_LEVEL_1) { 5615 priv->ieee->sec.flags |= (1 << i); 5616 priv->status |= STATUS_SECURITY_UPDATED; 5617 } else 5618 priv->ieee->sec.flags &= ~(1 << i); 5619 } 5620 } 5621 5622 if ((sec->flags & SEC_ACTIVE_KEY) && 5623 priv->ieee->sec.active_key != sec->active_key) { 5624 if (sec->active_key <= 3) { 5625 priv->ieee->sec.active_key = sec->active_key; 5626 priv->ieee->sec.flags |= SEC_ACTIVE_KEY; 5627 } else 5628 priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; 5629 5630 priv->status |= STATUS_SECURITY_UPDATED; 5631 } 5632 5633 if ((sec->flags & SEC_AUTH_MODE) && 5634 (priv->ieee->sec.auth_mode != sec->auth_mode)) { 5635 priv->ieee->sec.auth_mode = sec->auth_mode; 5636 priv->ieee->sec.flags |= SEC_AUTH_MODE; 5637 priv->status |= STATUS_SECURITY_UPDATED; 5638 } 5639 5640 if (sec->flags & SEC_ENABLED && priv->ieee->sec.enabled != sec->enabled) { 5641 priv->ieee->sec.flags |= SEC_ENABLED; 5642 priv->ieee->sec.enabled = sec->enabled; 5643 priv->status |= STATUS_SECURITY_UPDATED; 5644 force_update = 1; 5645 } 5646 5647 if (sec->flags & SEC_ENCRYPT) 5648 priv->ieee->sec.encrypt = sec->encrypt; 5649 5650 if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) { 5651 priv->ieee->sec.level = sec->level; 5652 priv->ieee->sec.flags |= SEC_LEVEL; 5653 priv->status |= STATUS_SECURITY_UPDATED; 5654 } 5655 5656 IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n", 5657 priv->ieee->sec.flags & (1 << 8) ? '1' : '0', 5658 priv->ieee->sec.flags & (1 << 7) ? '1' : '0', 5659 priv->ieee->sec.flags & (1 << 6) ? '1' : '0', 5660 priv->ieee->sec.flags & (1 << 5) ? '1' : '0', 5661 priv->ieee->sec.flags & (1 << 4) ? '1' : '0', 5662 priv->ieee->sec.flags & (1 << 3) ? '1' : '0', 5663 priv->ieee->sec.flags & (1 << 2) ? '1' : '0', 5664 priv->ieee->sec.flags & (1 << 1) ? '1' : '0', 5665 priv->ieee->sec.flags & (1 << 0) ? '1' : '0'); 5666 5667 /* As a temporary work around to enable WPA until we figure out why 5668 * wpa_supplicant toggles the security capability of the driver, which 5669 * forces a disassocation with force_update... 5670 * 5671 * if (force_update || !(priv->status & STATUS_ASSOCIATED))*/ 5672 if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) 5673 ipw2100_configure_security(priv, 0); 5674 done: 5675 mutex_unlock(&priv->action_mutex); 5676 } 5677 5678 static int ipw2100_adapter_setup(struct ipw2100_priv *priv) 5679 { 5680 int err; 5681 int batch_mode = 1; 5682 u8 *bssid; 5683 5684 IPW_DEBUG_INFO("enter\n"); 5685 5686 err = ipw2100_disable_adapter(priv); 5687 if (err) 5688 return err; 5689 #ifdef CONFIG_IPW2100_MONITOR 5690 if (priv->ieee->iw_mode == IW_MODE_MONITOR) { 5691 err = ipw2100_set_channel(priv, priv->channel, batch_mode); 5692 if (err) 5693 return err; 5694 5695 IPW_DEBUG_INFO("exit\n"); 5696 5697 return 0; 5698 } 5699 #endif /* CONFIG_IPW2100_MONITOR */ 5700 5701 err = ipw2100_read_mac_address(priv); 5702 if (err) 5703 return -EIO; 5704 5705 err = ipw2100_set_mac_address(priv, batch_mode); 5706 if (err) 5707 return err; 5708 5709 err = ipw2100_set_port_type(priv, priv->ieee->iw_mode, batch_mode); 5710 if (err) 5711 return err; 5712 5713 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 5714 err = ipw2100_set_channel(priv, priv->channel, batch_mode); 5715 if (err) 5716 return err; 5717 } 5718 5719 err = ipw2100_system_config(priv, batch_mode); 5720 if (err) 5721 return err; 5722 5723 err = ipw2100_set_tx_rates(priv, priv->tx_rates, batch_mode); 5724 if (err) 5725 return err; 5726 5727 /* Default to power mode OFF */ 5728 err = ipw2100_set_power_mode(priv, IPW_POWER_MODE_CAM); 5729 if (err) 5730 return err; 5731 5732 err = ipw2100_set_rts_threshold(priv, priv->rts_threshold); 5733 if (err) 5734 return err; 5735 5736 if (priv->config & CFG_STATIC_BSSID) 5737 bssid = priv->bssid; 5738 else 5739 bssid = NULL; 5740 err = ipw2100_set_mandatory_bssid(priv, bssid, batch_mode); 5741 if (err) 5742 return err; 5743 5744 if (priv->config & CFG_STATIC_ESSID) 5745 err = ipw2100_set_essid(priv, priv->essid, priv->essid_len, 5746 batch_mode); 5747 else 5748 err = ipw2100_set_essid(priv, NULL, 0, batch_mode); 5749 if (err) 5750 return err; 5751 5752 err = ipw2100_configure_security(priv, batch_mode); 5753 if (err) 5754 return err; 5755 5756 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 5757 err = 5758 ipw2100_set_ibss_beacon_interval(priv, 5759 priv->beacon_interval, 5760 batch_mode); 5761 if (err) 5762 return err; 5763 5764 err = ipw2100_set_tx_power(priv, priv->tx_power); 5765 if (err) 5766 return err; 5767 } 5768 5769 /* 5770 err = ipw2100_set_fragmentation_threshold( 5771 priv, priv->frag_threshold, batch_mode); 5772 if (err) 5773 return err; 5774 */ 5775 5776 IPW_DEBUG_INFO("exit\n"); 5777 5778 return 0; 5779 } 5780 5781 /************************************************************************* 5782 * 5783 * EXTERNALLY CALLED METHODS 5784 * 5785 *************************************************************************/ 5786 5787 /* This method is called by the network layer -- not to be confused with 5788 * ipw2100_set_mac_address() declared above called by this driver (and this 5789 * method as well) to talk to the firmware */ 5790 static int ipw2100_set_address(struct net_device *dev, void *p) 5791 { 5792 struct ipw2100_priv *priv = libipw_priv(dev); 5793 struct sockaddr *addr = p; 5794 int err = 0; 5795 5796 if (!is_valid_ether_addr(addr->sa_data)) 5797 return -EADDRNOTAVAIL; 5798 5799 mutex_lock(&priv->action_mutex); 5800 5801 priv->config |= CFG_CUSTOM_MAC; 5802 memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); 5803 5804 err = ipw2100_set_mac_address(priv, 0); 5805 if (err) 5806 goto done; 5807 5808 priv->reset_backoff = 0; 5809 mutex_unlock(&priv->action_mutex); 5810 ipw2100_reset_adapter(&priv->reset_work.work); 5811 return 0; 5812 5813 done: 5814 mutex_unlock(&priv->action_mutex); 5815 return err; 5816 } 5817 5818 static int ipw2100_open(struct net_device *dev) 5819 { 5820 struct ipw2100_priv *priv = libipw_priv(dev); 5821 unsigned long flags; 5822 IPW_DEBUG_INFO("dev->open\n"); 5823 5824 spin_lock_irqsave(&priv->low_lock, flags); 5825 if (priv->status & STATUS_ASSOCIATED) { 5826 netif_carrier_on(dev); 5827 netif_start_queue(dev); 5828 } 5829 spin_unlock_irqrestore(&priv->low_lock, flags); 5830 5831 return 0; 5832 } 5833 5834 static int ipw2100_close(struct net_device *dev) 5835 { 5836 struct ipw2100_priv *priv = libipw_priv(dev); 5837 unsigned long flags; 5838 struct list_head *element; 5839 struct ipw2100_tx_packet *packet; 5840 5841 IPW_DEBUG_INFO("enter\n"); 5842 5843 spin_lock_irqsave(&priv->low_lock, flags); 5844 5845 if (priv->status & STATUS_ASSOCIATED) 5846 netif_carrier_off(dev); 5847 netif_stop_queue(dev); 5848 5849 /* Flush the TX queue ... */ 5850 while (!list_empty(&priv->tx_pend_list)) { 5851 element = priv->tx_pend_list.next; 5852 packet = list_entry(element, struct ipw2100_tx_packet, list); 5853 5854 list_del(element); 5855 DEC_STAT(&priv->tx_pend_stat); 5856 5857 libipw_txb_free(packet->info.d_struct.txb); 5858 packet->info.d_struct.txb = NULL; 5859 5860 list_add_tail(element, &priv->tx_free_list); 5861 INC_STAT(&priv->tx_free_stat); 5862 } 5863 spin_unlock_irqrestore(&priv->low_lock, flags); 5864 5865 IPW_DEBUG_INFO("exit\n"); 5866 5867 return 0; 5868 } 5869 5870 /* 5871 * TODO: Fix this function... its just wrong 5872 */ 5873 static void ipw2100_tx_timeout(struct net_device *dev) 5874 { 5875 struct ipw2100_priv *priv = libipw_priv(dev); 5876 5877 dev->stats.tx_errors++; 5878 5879 #ifdef CONFIG_IPW2100_MONITOR 5880 if (priv->ieee->iw_mode == IW_MODE_MONITOR) 5881 return; 5882 #endif 5883 5884 IPW_DEBUG_INFO("%s: TX timed out. Scheduling firmware restart.\n", 5885 dev->name); 5886 schedule_reset(priv); 5887 } 5888 5889 static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value) 5890 { 5891 /* This is called when wpa_supplicant loads and closes the driver 5892 * interface. */ 5893 priv->ieee->wpa_enabled = value; 5894 return 0; 5895 } 5896 5897 static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) 5898 { 5899 5900 struct libipw_device *ieee = priv->ieee; 5901 struct libipw_security sec = { 5902 .flags = SEC_AUTH_MODE, 5903 }; 5904 int ret = 0; 5905 5906 if (value & IW_AUTH_ALG_SHARED_KEY) { 5907 sec.auth_mode = WLAN_AUTH_SHARED_KEY; 5908 ieee->open_wep = 0; 5909 } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { 5910 sec.auth_mode = WLAN_AUTH_OPEN; 5911 ieee->open_wep = 1; 5912 } else if (value & IW_AUTH_ALG_LEAP) { 5913 sec.auth_mode = WLAN_AUTH_LEAP; 5914 ieee->open_wep = 1; 5915 } else 5916 return -EINVAL; 5917 5918 if (ieee->set_security) 5919 ieee->set_security(ieee->dev, &sec); 5920 else 5921 ret = -EOPNOTSUPP; 5922 5923 return ret; 5924 } 5925 5926 static void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, 5927 char *wpa_ie, int wpa_ie_len) 5928 { 5929 5930 struct ipw2100_wpa_assoc_frame frame; 5931 5932 frame.fixed_ie_mask = 0; 5933 5934 /* copy WPA IE */ 5935 memcpy(frame.var_ie, wpa_ie, wpa_ie_len); 5936 frame.var_ie_len = wpa_ie_len; 5937 5938 /* make sure WPA is enabled */ 5939 ipw2100_wpa_enable(priv, 1); 5940 ipw2100_set_wpa_ie(priv, &frame, 0); 5941 } 5942 5943 static void ipw_ethtool_get_drvinfo(struct net_device *dev, 5944 struct ethtool_drvinfo *info) 5945 { 5946 struct ipw2100_priv *priv = libipw_priv(dev); 5947 char fw_ver[64], ucode_ver[64]; 5948 5949 strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); 5950 strlcpy(info->version, DRV_VERSION, sizeof(info->version)); 5951 5952 ipw2100_get_fwversion(priv, fw_ver, sizeof(fw_ver)); 5953 ipw2100_get_ucodeversion(priv, ucode_ver, sizeof(ucode_ver)); 5954 5955 snprintf(info->fw_version, sizeof(info->fw_version), "%s:%d:%s", 5956 fw_ver, priv->eeprom_version, ucode_ver); 5957 5958 strlcpy(info->bus_info, pci_name(priv->pci_dev), 5959 sizeof(info->bus_info)); 5960 } 5961 5962 static u32 ipw2100_ethtool_get_link(struct net_device *dev) 5963 { 5964 struct ipw2100_priv *priv = libipw_priv(dev); 5965 return (priv->status & STATUS_ASSOCIATED) ? 1 : 0; 5966 } 5967 5968 static const struct ethtool_ops ipw2100_ethtool_ops = { 5969 .get_link = ipw2100_ethtool_get_link, 5970 .get_drvinfo = ipw_ethtool_get_drvinfo, 5971 }; 5972 5973 static void ipw2100_hang_check(struct work_struct *work) 5974 { 5975 struct ipw2100_priv *priv = 5976 container_of(work, struct ipw2100_priv, hang_check.work); 5977 unsigned long flags; 5978 u32 rtc = 0xa5a5a5a5; 5979 u32 len = sizeof(rtc); 5980 int restart = 0; 5981 5982 spin_lock_irqsave(&priv->low_lock, flags); 5983 5984 if (priv->fatal_error != 0) { 5985 /* If fatal_error is set then we need to restart */ 5986 IPW_DEBUG_INFO("%s: Hardware fatal error detected.\n", 5987 priv->net_dev->name); 5988 5989 restart = 1; 5990 } else if (ipw2100_get_ordinal(priv, IPW_ORD_RTC_TIME, &rtc, &len) || 5991 (rtc == priv->last_rtc)) { 5992 /* Check if firmware is hung */ 5993 IPW_DEBUG_INFO("%s: Firmware RTC stalled.\n", 5994 priv->net_dev->name); 5995 5996 restart = 1; 5997 } 5998 5999 if (restart) { 6000 /* Kill timer */ 6001 priv->stop_hang_check = 1; 6002 priv->hangs++; 6003 6004 /* Restart the NIC */ 6005 schedule_reset(priv); 6006 } 6007 6008 priv->last_rtc = rtc; 6009 6010 if (!priv->stop_hang_check) 6011 schedule_delayed_work(&priv->hang_check, HZ / 2); 6012 6013 spin_unlock_irqrestore(&priv->low_lock, flags); 6014 } 6015 6016 static void ipw2100_rf_kill(struct work_struct *work) 6017 { 6018 struct ipw2100_priv *priv = 6019 container_of(work, struct ipw2100_priv, rf_kill.work); 6020 unsigned long flags; 6021 6022 spin_lock_irqsave(&priv->low_lock, flags); 6023 6024 if (rf_kill_active(priv)) { 6025 IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n"); 6026 if (!priv->stop_rf_kill) 6027 schedule_delayed_work(&priv->rf_kill, 6028 round_jiffies_relative(HZ)); 6029 goto exit_unlock; 6030 } 6031 6032 /* RF Kill is now disabled, so bring the device back up */ 6033 6034 if (!(priv->status & STATUS_RF_KILL_MASK)) { 6035 IPW_DEBUG_RF_KILL("HW RF Kill no longer active, restarting " 6036 "device\n"); 6037 schedule_reset(priv); 6038 } else 6039 IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " 6040 "enabled\n"); 6041 6042 exit_unlock: 6043 spin_unlock_irqrestore(&priv->low_lock, flags); 6044 } 6045 6046 static void ipw2100_irq_tasklet(struct ipw2100_priv *priv); 6047 6048 static const struct net_device_ops ipw2100_netdev_ops = { 6049 .ndo_open = ipw2100_open, 6050 .ndo_stop = ipw2100_close, 6051 .ndo_start_xmit = libipw_xmit, 6052 .ndo_change_mtu = libipw_change_mtu, 6053 .ndo_tx_timeout = ipw2100_tx_timeout, 6054 .ndo_set_mac_address = ipw2100_set_address, 6055 .ndo_validate_addr = eth_validate_addr, 6056 }; 6057 6058 /* Look into using netdev destructor to shutdown libipw? */ 6059 6060 static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, 6061 void __iomem * ioaddr) 6062 { 6063 struct ipw2100_priv *priv; 6064 struct net_device *dev; 6065 6066 dev = alloc_libipw(sizeof(struct ipw2100_priv), 0); 6067 if (!dev) 6068 return NULL; 6069 priv = libipw_priv(dev); 6070 priv->ieee = netdev_priv(dev); 6071 priv->pci_dev = pci_dev; 6072 priv->net_dev = dev; 6073 priv->ioaddr = ioaddr; 6074 6075 priv->ieee->hard_start_xmit = ipw2100_tx; 6076 priv->ieee->set_security = shim__set_security; 6077 6078 priv->ieee->perfect_rssi = -20; 6079 priv->ieee->worst_rssi = -85; 6080 6081 dev->netdev_ops = &ipw2100_netdev_ops; 6082 dev->ethtool_ops = &ipw2100_ethtool_ops; 6083 dev->wireless_handlers = &ipw2100_wx_handler_def; 6084 priv->wireless_data.libipw = priv->ieee; 6085 dev->wireless_data = &priv->wireless_data; 6086 dev->watchdog_timeo = 3 * HZ; 6087 dev->irq = 0; 6088 6089 /* NOTE: We don't use the wireless_handlers hook 6090 * in dev as the system will start throwing WX requests 6091 * to us before we're actually initialized and it just 6092 * ends up causing problems. So, we just handle 6093 * the WX extensions through the ipw2100_ioctl interface */ 6094 6095 /* memset() puts everything to 0, so we only have explicitly set 6096 * those values that need to be something else */ 6097 6098 /* If power management is turned on, default to AUTO mode */ 6099 priv->power_mode = IPW_POWER_AUTO; 6100 6101 #ifdef CONFIG_IPW2100_MONITOR 6102 priv->config |= CFG_CRC_CHECK; 6103 #endif 6104 priv->ieee->wpa_enabled = 0; 6105 priv->ieee->drop_unencrypted = 0; 6106 priv->ieee->privacy_invoked = 0; 6107 priv->ieee->ieee802_1x = 1; 6108 6109 /* Set module parameters */ 6110 switch (network_mode) { 6111 case 1: 6112 priv->ieee->iw_mode = IW_MODE_ADHOC; 6113 break; 6114 #ifdef CONFIG_IPW2100_MONITOR 6115 case 2: 6116 priv->ieee->iw_mode = IW_MODE_MONITOR; 6117 break; 6118 #endif 6119 default: 6120 case 0: 6121 priv->ieee->iw_mode = IW_MODE_INFRA; 6122 break; 6123 } 6124 6125 if (disable == 1) 6126 priv->status |= STATUS_RF_KILL_SW; 6127 6128 if (channel != 0 && 6129 ((channel >= REG_MIN_CHANNEL) && (channel <= REG_MAX_CHANNEL))) { 6130 priv->config |= CFG_STATIC_CHANNEL; 6131 priv->channel = channel; 6132 } 6133 6134 if (associate) 6135 priv->config |= CFG_ASSOCIATE; 6136 6137 priv->beacon_interval = DEFAULT_BEACON_INTERVAL; 6138 priv->short_retry_limit = DEFAULT_SHORT_RETRY_LIMIT; 6139 priv->long_retry_limit = DEFAULT_LONG_RETRY_LIMIT; 6140 priv->rts_threshold = DEFAULT_RTS_THRESHOLD | RTS_DISABLED; 6141 priv->frag_threshold = DEFAULT_FTS | FRAG_DISABLED; 6142 priv->tx_power = IPW_TX_POWER_DEFAULT; 6143 priv->tx_rates = DEFAULT_TX_RATES; 6144 6145 strcpy(priv->nick, "ipw2100"); 6146 6147 spin_lock_init(&priv->low_lock); 6148 mutex_init(&priv->action_mutex); 6149 mutex_init(&priv->adapter_mutex); 6150 6151 init_waitqueue_head(&priv->wait_command_queue); 6152 6153 netif_carrier_off(dev); 6154 6155 INIT_LIST_HEAD(&priv->msg_free_list); 6156 INIT_LIST_HEAD(&priv->msg_pend_list); 6157 INIT_STAT(&priv->msg_free_stat); 6158 INIT_STAT(&priv->msg_pend_stat); 6159 6160 INIT_LIST_HEAD(&priv->tx_free_list); 6161 INIT_LIST_HEAD(&priv->tx_pend_list); 6162 INIT_STAT(&priv->tx_free_stat); 6163 INIT_STAT(&priv->tx_pend_stat); 6164 6165 INIT_LIST_HEAD(&priv->fw_pend_list); 6166 INIT_STAT(&priv->fw_pend_stat); 6167 6168 INIT_DELAYED_WORK(&priv->reset_work, ipw2100_reset_adapter); 6169 INIT_DELAYED_WORK(&priv->security_work, ipw2100_security_work); 6170 INIT_DELAYED_WORK(&priv->wx_event_work, ipw2100_wx_event_work); 6171 INIT_DELAYED_WORK(&priv->hang_check, ipw2100_hang_check); 6172 INIT_DELAYED_WORK(&priv->rf_kill, ipw2100_rf_kill); 6173 INIT_DELAYED_WORK(&priv->scan_event, ipw2100_scan_event); 6174 6175 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 6176 ipw2100_irq_tasklet, (unsigned long)priv); 6177 6178 /* NOTE: We do not start the deferred work for status checks yet */ 6179 priv->stop_rf_kill = 1; 6180 priv->stop_hang_check = 1; 6181 6182 return dev; 6183 } 6184 6185 static int ipw2100_pci_init_one(struct pci_dev *pci_dev, 6186 const struct pci_device_id *ent) 6187 { 6188 void __iomem *ioaddr; 6189 struct net_device *dev = NULL; 6190 struct ipw2100_priv *priv = NULL; 6191 int err = 0; 6192 int registered = 0; 6193 u32 val; 6194 6195 IPW_DEBUG_INFO("enter\n"); 6196 6197 if (!(pci_resource_flags(pci_dev, 0) & IORESOURCE_MEM)) { 6198 IPW_DEBUG_INFO("weird - resource type is not memory\n"); 6199 err = -ENODEV; 6200 goto out; 6201 } 6202 6203 ioaddr = pci_iomap(pci_dev, 0, 0); 6204 if (!ioaddr) { 6205 printk(KERN_WARNING DRV_NAME 6206 "Error calling ioremap_nocache.\n"); 6207 err = -EIO; 6208 goto fail; 6209 } 6210 6211 /* allocate and initialize our net_device */ 6212 dev = ipw2100_alloc_device(pci_dev, ioaddr); 6213 if (!dev) { 6214 printk(KERN_WARNING DRV_NAME 6215 "Error calling ipw2100_alloc_device.\n"); 6216 err = -ENOMEM; 6217 goto fail; 6218 } 6219 6220 /* set up PCI mappings for device */ 6221 err = pci_enable_device(pci_dev); 6222 if (err) { 6223 printk(KERN_WARNING DRV_NAME 6224 "Error calling pci_enable_device.\n"); 6225 return err; 6226 } 6227 6228 priv = libipw_priv(dev); 6229 6230 pci_set_master(pci_dev); 6231 pci_set_drvdata(pci_dev, priv); 6232 6233 err = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)); 6234 if (err) { 6235 printk(KERN_WARNING DRV_NAME 6236 "Error calling pci_set_dma_mask.\n"); 6237 pci_disable_device(pci_dev); 6238 return err; 6239 } 6240 6241 err = pci_request_regions(pci_dev, DRV_NAME); 6242 if (err) { 6243 printk(KERN_WARNING DRV_NAME 6244 "Error calling pci_request_regions.\n"); 6245 pci_disable_device(pci_dev); 6246 return err; 6247 } 6248 6249 /* We disable the RETRY_TIMEOUT register (0x41) to keep 6250 * PCI Tx retries from interfering with C3 CPU state */ 6251 pci_read_config_dword(pci_dev, 0x40, &val); 6252 if ((val & 0x0000ff00) != 0) 6253 pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff); 6254 6255 if (!ipw2100_hw_is_adapter_in_system(dev)) { 6256 printk(KERN_WARNING DRV_NAME 6257 "Device not found via register read.\n"); 6258 err = -ENODEV; 6259 goto fail; 6260 } 6261 6262 SET_NETDEV_DEV(dev, &pci_dev->dev); 6263 6264 /* Force interrupts to be shut off on the device */ 6265 priv->status |= STATUS_INT_ENABLED; 6266 ipw2100_disable_interrupts(priv); 6267 6268 /* Allocate and initialize the Tx/Rx queues and lists */ 6269 if (ipw2100_queues_allocate(priv)) { 6270 printk(KERN_WARNING DRV_NAME 6271 "Error calling ipw2100_queues_allocate.\n"); 6272 err = -ENOMEM; 6273 goto fail; 6274 } 6275 ipw2100_queues_initialize(priv); 6276 6277 err = request_irq(pci_dev->irq, 6278 ipw2100_interrupt, IRQF_SHARED, dev->name, priv); 6279 if (err) { 6280 printk(KERN_WARNING DRV_NAME 6281 "Error calling request_irq: %d.\n", pci_dev->irq); 6282 goto fail; 6283 } 6284 dev->irq = pci_dev->irq; 6285 6286 IPW_DEBUG_INFO("Attempting to register device...\n"); 6287 6288 printk(KERN_INFO DRV_NAME 6289 ": Detected Intel PRO/Wireless 2100 Network Connection\n"); 6290 6291 err = ipw2100_up(priv, 1); 6292 if (err) 6293 goto fail; 6294 6295 err = ipw2100_wdev_init(dev); 6296 if (err) 6297 goto fail; 6298 registered = 1; 6299 6300 /* Bring up the interface. Pre 0.46, after we registered the 6301 * network device we would call ipw2100_up. This introduced a race 6302 * condition with newer hotplug configurations (network was coming 6303 * up and making calls before the device was initialized). 6304 */ 6305 err = register_netdev(dev); 6306 if (err) { 6307 printk(KERN_WARNING DRV_NAME 6308 "Error calling register_netdev.\n"); 6309 goto fail; 6310 } 6311 registered = 2; 6312 6313 mutex_lock(&priv->action_mutex); 6314 6315 IPW_DEBUG_INFO("%s: Bound to %s\n", dev->name, pci_name(pci_dev)); 6316 6317 /* perform this after register_netdev so that dev->name is set */ 6318 err = sysfs_create_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); 6319 if (err) 6320 goto fail_unlock; 6321 6322 /* If the RF Kill switch is disabled, go ahead and complete the 6323 * startup sequence */ 6324 if (!(priv->status & STATUS_RF_KILL_MASK)) { 6325 /* Enable the adapter - sends HOST_COMPLETE */ 6326 if (ipw2100_enable_adapter(priv)) { 6327 printk(KERN_WARNING DRV_NAME 6328 ": %s: failed in call to enable adapter.\n", 6329 priv->net_dev->name); 6330 ipw2100_hw_stop_adapter(priv); 6331 err = -EIO; 6332 goto fail_unlock; 6333 } 6334 6335 /* Start a scan . . . */ 6336 ipw2100_set_scan_options(priv); 6337 ipw2100_start_scan(priv); 6338 } 6339 6340 IPW_DEBUG_INFO("exit\n"); 6341 6342 priv->status |= STATUS_INITIALIZED; 6343 6344 mutex_unlock(&priv->action_mutex); 6345 out: 6346 return err; 6347 6348 fail_unlock: 6349 mutex_unlock(&priv->action_mutex); 6350 fail: 6351 if (dev) { 6352 if (registered >= 2) 6353 unregister_netdev(dev); 6354 6355 if (registered) { 6356 wiphy_unregister(priv->ieee->wdev.wiphy); 6357 kfree(priv->ieee->bg_band.channels); 6358 } 6359 6360 ipw2100_hw_stop_adapter(priv); 6361 6362 ipw2100_disable_interrupts(priv); 6363 6364 if (dev->irq) 6365 free_irq(dev->irq, priv); 6366 6367 ipw2100_kill_works(priv); 6368 6369 /* These are safe to call even if they weren't allocated */ 6370 ipw2100_queues_free(priv); 6371 sysfs_remove_group(&pci_dev->dev.kobj, 6372 &ipw2100_attribute_group); 6373 6374 free_libipw(dev, 0); 6375 } 6376 6377 pci_iounmap(pci_dev, ioaddr); 6378 6379 pci_release_regions(pci_dev); 6380 pci_disable_device(pci_dev); 6381 goto out; 6382 } 6383 6384 static void ipw2100_pci_remove_one(struct pci_dev *pci_dev) 6385 { 6386 struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); 6387 struct net_device *dev = priv->net_dev; 6388 6389 mutex_lock(&priv->action_mutex); 6390 6391 priv->status &= ~STATUS_INITIALIZED; 6392 6393 sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); 6394 6395 #ifdef CONFIG_PM 6396 if (ipw2100_firmware.version) 6397 ipw2100_release_firmware(priv, &ipw2100_firmware); 6398 #endif 6399 /* Take down the hardware */ 6400 ipw2100_down(priv); 6401 6402 /* Release the mutex so that the network subsystem can 6403 * complete any needed calls into the driver... */ 6404 mutex_unlock(&priv->action_mutex); 6405 6406 /* Unregister the device first - this results in close() 6407 * being called if the device is open. If we free storage 6408 * first, then close() will crash. 6409 * FIXME: remove the comment above. */ 6410 unregister_netdev(dev); 6411 6412 ipw2100_kill_works(priv); 6413 6414 ipw2100_queues_free(priv); 6415 6416 /* Free potential debugging firmware snapshot */ 6417 ipw2100_snapshot_free(priv); 6418 6419 free_irq(dev->irq, priv); 6420 6421 pci_iounmap(pci_dev, priv->ioaddr); 6422 6423 /* wiphy_unregister needs to be here, before free_libipw */ 6424 wiphy_unregister(priv->ieee->wdev.wiphy); 6425 kfree(priv->ieee->bg_band.channels); 6426 free_libipw(dev, 0); 6427 6428 pci_release_regions(pci_dev); 6429 pci_disable_device(pci_dev); 6430 6431 IPW_DEBUG_INFO("exit\n"); 6432 } 6433 6434 #ifdef CONFIG_PM 6435 static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) 6436 { 6437 struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); 6438 struct net_device *dev = priv->net_dev; 6439 6440 IPW_DEBUG_INFO("%s: Going into suspend...\n", dev->name); 6441 6442 mutex_lock(&priv->action_mutex); 6443 if (priv->status & STATUS_INITIALIZED) { 6444 /* Take down the device; powers it off, etc. */ 6445 ipw2100_down(priv); 6446 } 6447 6448 /* Remove the PRESENT state of the device */ 6449 netif_device_detach(dev); 6450 6451 pci_save_state(pci_dev); 6452 pci_disable_device(pci_dev); 6453 pci_set_power_state(pci_dev, PCI_D3hot); 6454 6455 priv->suspend_at = get_seconds(); 6456 6457 mutex_unlock(&priv->action_mutex); 6458 6459 return 0; 6460 } 6461 6462 static int ipw2100_resume(struct pci_dev *pci_dev) 6463 { 6464 struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); 6465 struct net_device *dev = priv->net_dev; 6466 int err; 6467 u32 val; 6468 6469 if (IPW2100_PM_DISABLED) 6470 return 0; 6471 6472 mutex_lock(&priv->action_mutex); 6473 6474 IPW_DEBUG_INFO("%s: Coming out of suspend...\n", dev->name); 6475 6476 pci_set_power_state(pci_dev, PCI_D0); 6477 err = pci_enable_device(pci_dev); 6478 if (err) { 6479 printk(KERN_ERR "%s: pci_enable_device failed on resume\n", 6480 dev->name); 6481 mutex_unlock(&priv->action_mutex); 6482 return err; 6483 } 6484 pci_restore_state(pci_dev); 6485 6486 /* 6487 * Suspend/Resume resets the PCI configuration space, so we have to 6488 * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries 6489 * from interfering with C3 CPU state. pci_restore_state won't help 6490 * here since it only restores the first 64 bytes pci config header. 6491 */ 6492 pci_read_config_dword(pci_dev, 0x40, &val); 6493 if ((val & 0x0000ff00) != 0) 6494 pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff); 6495 6496 /* Set the device back into the PRESENT state; this will also wake 6497 * the queue of needed */ 6498 netif_device_attach(dev); 6499 6500 priv->suspend_time = get_seconds() - priv->suspend_at; 6501 6502 /* Bring the device back up */ 6503 if (!(priv->status & STATUS_RF_KILL_SW)) 6504 ipw2100_up(priv, 0); 6505 6506 mutex_unlock(&priv->action_mutex); 6507 6508 return 0; 6509 } 6510 #endif 6511 6512 static void ipw2100_shutdown(struct pci_dev *pci_dev) 6513 { 6514 struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); 6515 6516 /* Take down the device; powers it off, etc. */ 6517 ipw2100_down(priv); 6518 6519 pci_disable_device(pci_dev); 6520 } 6521 6522 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 6523 6524 static DEFINE_PCI_DEVICE_TABLE(ipw2100_pci_id_table) = { 6525 IPW2100_DEV_ID(0x2520), /* IN 2100A mPCI 3A */ 6526 IPW2100_DEV_ID(0x2521), /* IN 2100A mPCI 3B */ 6527 IPW2100_DEV_ID(0x2524), /* IN 2100A mPCI 3B */ 6528 IPW2100_DEV_ID(0x2525), /* IN 2100A mPCI 3B */ 6529 IPW2100_DEV_ID(0x2526), /* IN 2100A mPCI Gen A3 */ 6530 IPW2100_DEV_ID(0x2522), /* IN 2100 mPCI 3B */ 6531 IPW2100_DEV_ID(0x2523), /* IN 2100 mPCI 3A */ 6532 IPW2100_DEV_ID(0x2527), /* IN 2100 mPCI 3B */ 6533 IPW2100_DEV_ID(0x2528), /* IN 2100 mPCI 3B */ 6534 IPW2100_DEV_ID(0x2529), /* IN 2100 mPCI 3B */ 6535 IPW2100_DEV_ID(0x252B), /* IN 2100 mPCI 3A */ 6536 IPW2100_DEV_ID(0x252C), /* IN 2100 mPCI 3A */ 6537 IPW2100_DEV_ID(0x252D), /* IN 2100 mPCI 3A */ 6538 6539 IPW2100_DEV_ID(0x2550), /* IB 2100A mPCI 3B */ 6540 IPW2100_DEV_ID(0x2551), /* IB 2100 mPCI 3B */ 6541 IPW2100_DEV_ID(0x2553), /* IB 2100 mPCI 3B */ 6542 IPW2100_DEV_ID(0x2554), /* IB 2100 mPCI 3B */ 6543 IPW2100_DEV_ID(0x2555), /* IB 2100 mPCI 3B */ 6544 6545 IPW2100_DEV_ID(0x2560), /* DE 2100A mPCI 3A */ 6546 IPW2100_DEV_ID(0x2562), /* DE 2100A mPCI 3A */ 6547 IPW2100_DEV_ID(0x2563), /* DE 2100A mPCI 3A */ 6548 IPW2100_DEV_ID(0x2561), /* DE 2100 mPCI 3A */ 6549 IPW2100_DEV_ID(0x2565), /* DE 2100 mPCI 3A */ 6550 IPW2100_DEV_ID(0x2566), /* DE 2100 mPCI 3A */ 6551 IPW2100_DEV_ID(0x2567), /* DE 2100 mPCI 3A */ 6552 6553 IPW2100_DEV_ID(0x2570), /* GA 2100 mPCI 3B */ 6554 6555 IPW2100_DEV_ID(0x2580), /* TO 2100A mPCI 3B */ 6556 IPW2100_DEV_ID(0x2582), /* TO 2100A mPCI 3B */ 6557 IPW2100_DEV_ID(0x2583), /* TO 2100A mPCI 3B */ 6558 IPW2100_DEV_ID(0x2581), /* TO 2100 mPCI 3B */ 6559 IPW2100_DEV_ID(0x2585), /* TO 2100 mPCI 3B */ 6560 IPW2100_DEV_ID(0x2586), /* TO 2100 mPCI 3B */ 6561 IPW2100_DEV_ID(0x2587), /* TO 2100 mPCI 3B */ 6562 6563 IPW2100_DEV_ID(0x2590), /* SO 2100A mPCI 3B */ 6564 IPW2100_DEV_ID(0x2592), /* SO 2100A mPCI 3B */ 6565 IPW2100_DEV_ID(0x2591), /* SO 2100 mPCI 3B */ 6566 IPW2100_DEV_ID(0x2593), /* SO 2100 mPCI 3B */ 6567 IPW2100_DEV_ID(0x2596), /* SO 2100 mPCI 3B */ 6568 IPW2100_DEV_ID(0x2598), /* SO 2100 mPCI 3B */ 6569 6570 IPW2100_DEV_ID(0x25A0), /* HP 2100 mPCI 3B */ 6571 {0,}, 6572 }; 6573 6574 MODULE_DEVICE_TABLE(pci, ipw2100_pci_id_table); 6575 6576 static struct pci_driver ipw2100_pci_driver = { 6577 .name = DRV_NAME, 6578 .id_table = ipw2100_pci_id_table, 6579 .probe = ipw2100_pci_init_one, 6580 .remove = ipw2100_pci_remove_one, 6581 #ifdef CONFIG_PM 6582 .suspend = ipw2100_suspend, 6583 .resume = ipw2100_resume, 6584 #endif 6585 .shutdown = ipw2100_shutdown, 6586 }; 6587 6588 /** 6589 * Initialize the ipw2100 driver/module 6590 * 6591 * @returns 0 if ok, < 0 errno node con error. 6592 * 6593 * Note: we cannot init the /proc stuff until the PCI driver is there, 6594 * or we risk an unlikely race condition on someone accessing 6595 * uninitialized data in the PCI dev struct through /proc. 6596 */ 6597 static int __init ipw2100_init(void) 6598 { 6599 int ret; 6600 6601 printk(KERN_INFO DRV_NAME ": %s, %s\n", DRV_DESCRIPTION, DRV_VERSION); 6602 printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT); 6603 6604 pm_qos_add_request(&ipw2100_pm_qos_req, PM_QOS_CPU_DMA_LATENCY, 6605 PM_QOS_DEFAULT_VALUE); 6606 6607 ret = pci_register_driver(&ipw2100_pci_driver); 6608 if (ret) 6609 goto out; 6610 6611 #ifdef CONFIG_IPW2100_DEBUG 6612 ipw2100_debug_level = debug; 6613 ret = driver_create_file(&ipw2100_pci_driver.driver, 6614 &driver_attr_debug_level); 6615 #endif 6616 6617 out: 6618 return ret; 6619 } 6620 6621 /** 6622 * Cleanup ipw2100 driver registration 6623 */ 6624 static void __exit ipw2100_exit(void) 6625 { 6626 /* FIXME: IPG: check that we have no instances of the devices open */ 6627 #ifdef CONFIG_IPW2100_DEBUG 6628 driver_remove_file(&ipw2100_pci_driver.driver, 6629 &driver_attr_debug_level); 6630 #endif 6631 pci_unregister_driver(&ipw2100_pci_driver); 6632 pm_qos_remove_request(&ipw2100_pm_qos_req); 6633 } 6634 6635 module_init(ipw2100_init); 6636 module_exit(ipw2100_exit); 6637 6638 static int ipw2100_wx_get_name(struct net_device *dev, 6639 struct iw_request_info *info, 6640 union iwreq_data *wrqu, char *extra) 6641 { 6642 /* 6643 * This can be called at any time. No action lock required 6644 */ 6645 6646 struct ipw2100_priv *priv = libipw_priv(dev); 6647 if (!(priv->status & STATUS_ASSOCIATED)) 6648 strcpy(wrqu->name, "unassociated"); 6649 else 6650 snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11b"); 6651 6652 IPW_DEBUG_WX("Name: %s\n", wrqu->name); 6653 return 0; 6654 } 6655 6656 static int ipw2100_wx_set_freq(struct net_device *dev, 6657 struct iw_request_info *info, 6658 union iwreq_data *wrqu, char *extra) 6659 { 6660 struct ipw2100_priv *priv = libipw_priv(dev); 6661 struct iw_freq *fwrq = &wrqu->freq; 6662 int err = 0; 6663 6664 if (priv->ieee->iw_mode == IW_MODE_INFRA) 6665 return -EOPNOTSUPP; 6666 6667 mutex_lock(&priv->action_mutex); 6668 if (!(priv->status & STATUS_INITIALIZED)) { 6669 err = -EIO; 6670 goto done; 6671 } 6672 6673 /* if setting by freq convert to channel */ 6674 if (fwrq->e == 1) { 6675 if ((fwrq->m >= (int)2.412e8 && fwrq->m <= (int)2.487e8)) { 6676 int f = fwrq->m / 100000; 6677 int c = 0; 6678 6679 while ((c < REG_MAX_CHANNEL) && 6680 (f != ipw2100_frequencies[c])) 6681 c++; 6682 6683 /* hack to fall through */ 6684 fwrq->e = 0; 6685 fwrq->m = c + 1; 6686 } 6687 } 6688 6689 if (fwrq->e > 0 || fwrq->m > 1000) { 6690 err = -EOPNOTSUPP; 6691 goto done; 6692 } else { /* Set the channel */ 6693 IPW_DEBUG_WX("SET Freq/Channel -> %d\n", fwrq->m); 6694 err = ipw2100_set_channel(priv, fwrq->m, 0); 6695 } 6696 6697 done: 6698 mutex_unlock(&priv->action_mutex); 6699 return err; 6700 } 6701 6702 static int ipw2100_wx_get_freq(struct net_device *dev, 6703 struct iw_request_info *info, 6704 union iwreq_data *wrqu, char *extra) 6705 { 6706 /* 6707 * This can be called at any time. No action lock required 6708 */ 6709 6710 struct ipw2100_priv *priv = libipw_priv(dev); 6711 6712 wrqu->freq.e = 0; 6713 6714 /* If we are associated, trying to associate, or have a statically 6715 * configured CHANNEL then return that; otherwise return ANY */ 6716 if (priv->config & CFG_STATIC_CHANNEL || 6717 priv->status & STATUS_ASSOCIATED) 6718 wrqu->freq.m = priv->channel; 6719 else 6720 wrqu->freq.m = 0; 6721 6722 IPW_DEBUG_WX("GET Freq/Channel -> %d\n", priv->channel); 6723 return 0; 6724 6725 } 6726 6727 static int ipw2100_wx_set_mode(struct net_device *dev, 6728 struct iw_request_info *info, 6729 union iwreq_data *wrqu, char *extra) 6730 { 6731 struct ipw2100_priv *priv = libipw_priv(dev); 6732 int err = 0; 6733 6734 IPW_DEBUG_WX("SET Mode -> %d\n", wrqu->mode); 6735 6736 if (wrqu->mode == priv->ieee->iw_mode) 6737 return 0; 6738 6739 mutex_lock(&priv->action_mutex); 6740 if (!(priv->status & STATUS_INITIALIZED)) { 6741 err = -EIO; 6742 goto done; 6743 } 6744 6745 switch (wrqu->mode) { 6746 #ifdef CONFIG_IPW2100_MONITOR 6747 case IW_MODE_MONITOR: 6748 err = ipw2100_switch_mode(priv, IW_MODE_MONITOR); 6749 break; 6750 #endif /* CONFIG_IPW2100_MONITOR */ 6751 case IW_MODE_ADHOC: 6752 err = ipw2100_switch_mode(priv, IW_MODE_ADHOC); 6753 break; 6754 case IW_MODE_INFRA: 6755 case IW_MODE_AUTO: 6756 default: 6757 err = ipw2100_switch_mode(priv, IW_MODE_INFRA); 6758 break; 6759 } 6760 6761 done: 6762 mutex_unlock(&priv->action_mutex); 6763 return err; 6764 } 6765 6766 static int ipw2100_wx_get_mode(struct net_device *dev, 6767 struct iw_request_info *info, 6768 union iwreq_data *wrqu, char *extra) 6769 { 6770 /* 6771 * This can be called at any time. No action lock required 6772 */ 6773 6774 struct ipw2100_priv *priv = libipw_priv(dev); 6775 6776 wrqu->mode = priv->ieee->iw_mode; 6777 IPW_DEBUG_WX("GET Mode -> %d\n", wrqu->mode); 6778 6779 return 0; 6780 } 6781 6782 #define POWER_MODES 5 6783 6784 /* Values are in microsecond */ 6785 static const s32 timeout_duration[POWER_MODES] = { 6786 350000, 6787 250000, 6788 75000, 6789 37000, 6790 25000, 6791 }; 6792 6793 static const s32 period_duration[POWER_MODES] = { 6794 400000, 6795 700000, 6796 1000000, 6797 1000000, 6798 1000000 6799 }; 6800 6801 static int ipw2100_wx_get_range(struct net_device *dev, 6802 struct iw_request_info *info, 6803 union iwreq_data *wrqu, char *extra) 6804 { 6805 /* 6806 * This can be called at any time. No action lock required 6807 */ 6808 6809 struct ipw2100_priv *priv = libipw_priv(dev); 6810 struct iw_range *range = (struct iw_range *)extra; 6811 u16 val; 6812 int i, level; 6813 6814 wrqu->data.length = sizeof(*range); 6815 memset(range, 0, sizeof(*range)); 6816 6817 /* Let's try to keep this struct in the same order as in 6818 * linux/include/wireless.h 6819 */ 6820 6821 /* TODO: See what values we can set, and remove the ones we can't 6822 * set, or fill them with some default data. 6823 */ 6824 6825 /* ~5 Mb/s real (802.11b) */ 6826 range->throughput = 5 * 1000 * 1000; 6827 6828 // range->sensitivity; /* signal level threshold range */ 6829 6830 range->max_qual.qual = 100; 6831 /* TODO: Find real max RSSI and stick here */ 6832 range->max_qual.level = 0; 6833 range->max_qual.noise = 0; 6834 range->max_qual.updated = 7; /* Updated all three */ 6835 6836 range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */ 6837 /* TODO: Find real 'good' to 'bad' threshold value for RSSI */ 6838 range->avg_qual.level = 20 + IPW2100_RSSI_TO_DBM; 6839 range->avg_qual.noise = 0; 6840 range->avg_qual.updated = 7; /* Updated all three */ 6841 6842 range->num_bitrates = RATE_COUNT; 6843 6844 for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) { 6845 range->bitrate[i] = ipw2100_bg_rates[i].bitrate * 100 * 1000; 6846 } 6847 6848 range->min_rts = MIN_RTS_THRESHOLD; 6849 range->max_rts = MAX_RTS_THRESHOLD; 6850 range->min_frag = MIN_FRAG_THRESHOLD; 6851 range->max_frag = MAX_FRAG_THRESHOLD; 6852 6853 range->min_pmp = period_duration[0]; /* Minimal PM period */ 6854 range->max_pmp = period_duration[POWER_MODES - 1]; /* Maximal PM period */ 6855 range->min_pmt = timeout_duration[POWER_MODES - 1]; /* Minimal PM timeout */ 6856 range->max_pmt = timeout_duration[0]; /* Maximal PM timeout */ 6857 6858 /* How to decode max/min PM period */ 6859 range->pmp_flags = IW_POWER_PERIOD; 6860 /* How to decode max/min PM period */ 6861 range->pmt_flags = IW_POWER_TIMEOUT; 6862 /* What PM options are supported */ 6863 range->pm_capa = IW_POWER_TIMEOUT | IW_POWER_PERIOD; 6864 6865 range->encoding_size[0] = 5; 6866 range->encoding_size[1] = 13; /* Different token sizes */ 6867 range->num_encoding_sizes = 2; /* Number of entry in the list */ 6868 range->max_encoding_tokens = WEP_KEYS; /* Max number of tokens */ 6869 // range->encoding_login_index; /* token index for login token */ 6870 6871 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 6872 range->txpower_capa = IW_TXPOW_DBM; 6873 range->num_txpower = IW_MAX_TXPOWER; 6874 for (i = 0, level = (IPW_TX_POWER_MAX_DBM * 16); 6875 i < IW_MAX_TXPOWER; 6876 i++, level -= 6877 ((IPW_TX_POWER_MAX_DBM - 6878 IPW_TX_POWER_MIN_DBM) * 16) / (IW_MAX_TXPOWER - 1)) 6879 range->txpower[i] = level / 16; 6880 } else { 6881 range->txpower_capa = 0; 6882 range->num_txpower = 0; 6883 } 6884 6885 /* Set the Wireless Extension versions */ 6886 range->we_version_compiled = WIRELESS_EXT; 6887 range->we_version_source = 18; 6888 6889 // range->retry_capa; /* What retry options are supported */ 6890 // range->retry_flags; /* How to decode max/min retry limit */ 6891 // range->r_time_flags; /* How to decode max/min retry life */ 6892 // range->min_retry; /* Minimal number of retries */ 6893 // range->max_retry; /* Maximal number of retries */ 6894 // range->min_r_time; /* Minimal retry lifetime */ 6895 // range->max_r_time; /* Maximal retry lifetime */ 6896 6897 range->num_channels = FREQ_COUNT; 6898 6899 val = 0; 6900 for (i = 0; i < FREQ_COUNT; i++) { 6901 // TODO: Include only legal frequencies for some countries 6902 // if (local->channel_mask & (1 << i)) { 6903 range->freq[val].i = i + 1; 6904 range->freq[val].m = ipw2100_frequencies[i] * 100000; 6905 range->freq[val].e = 1; 6906 val++; 6907 // } 6908 if (val == IW_MAX_FREQUENCIES) 6909 break; 6910 } 6911 range->num_frequency = val; 6912 6913 /* Event capability (kernel + driver) */ 6914 range->event_capa[0] = (IW_EVENT_CAPA_K_0 | 6915 IW_EVENT_CAPA_MASK(SIOCGIWAP)); 6916 range->event_capa[1] = IW_EVENT_CAPA_K_1; 6917 6918 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | 6919 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; 6920 6921 IPW_DEBUG_WX("GET Range\n"); 6922 6923 return 0; 6924 } 6925 6926 static int ipw2100_wx_set_wap(struct net_device *dev, 6927 struct iw_request_info *info, 6928 union iwreq_data *wrqu, char *extra) 6929 { 6930 struct ipw2100_priv *priv = libipw_priv(dev); 6931 int err = 0; 6932 6933 // sanity checks 6934 if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) 6935 return -EINVAL; 6936 6937 mutex_lock(&priv->action_mutex); 6938 if (!(priv->status & STATUS_INITIALIZED)) { 6939 err = -EIO; 6940 goto done; 6941 } 6942 6943 if (is_broadcast_ether_addr(wrqu->ap_addr.sa_data) || 6944 is_zero_ether_addr(wrqu->ap_addr.sa_data)) { 6945 /* we disable mandatory BSSID association */ 6946 IPW_DEBUG_WX("exit - disable mandatory BSSID\n"); 6947 priv->config &= ~CFG_STATIC_BSSID; 6948 err = ipw2100_set_mandatory_bssid(priv, NULL, 0); 6949 goto done; 6950 } 6951 6952 priv->config |= CFG_STATIC_BSSID; 6953 memcpy(priv->mandatory_bssid_mac, wrqu->ap_addr.sa_data, ETH_ALEN); 6954 6955 err = ipw2100_set_mandatory_bssid(priv, wrqu->ap_addr.sa_data, 0); 6956 6957 IPW_DEBUG_WX("SET BSSID -> %pM\n", wrqu->ap_addr.sa_data); 6958 6959 done: 6960 mutex_unlock(&priv->action_mutex); 6961 return err; 6962 } 6963 6964 static int ipw2100_wx_get_wap(struct net_device *dev, 6965 struct iw_request_info *info, 6966 union iwreq_data *wrqu, char *extra) 6967 { 6968 /* 6969 * This can be called at any time. No action lock required 6970 */ 6971 6972 struct ipw2100_priv *priv = libipw_priv(dev); 6973 6974 /* If we are associated, trying to associate, or have a statically 6975 * configured BSSID then return that; otherwise return ANY */ 6976 if (priv->config & CFG_STATIC_BSSID || priv->status & STATUS_ASSOCIATED) { 6977 wrqu->ap_addr.sa_family = ARPHRD_ETHER; 6978 memcpy(wrqu->ap_addr.sa_data, priv->bssid, ETH_ALEN); 6979 } else 6980 memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); 6981 6982 IPW_DEBUG_WX("Getting WAP BSSID: %pM\n", wrqu->ap_addr.sa_data); 6983 return 0; 6984 } 6985 6986 static int ipw2100_wx_set_essid(struct net_device *dev, 6987 struct iw_request_info *info, 6988 union iwreq_data *wrqu, char *extra) 6989 { 6990 struct ipw2100_priv *priv = libipw_priv(dev); 6991 char *essid = ""; /* ANY */ 6992 int length = 0; 6993 int err = 0; 6994 DECLARE_SSID_BUF(ssid); 6995 6996 mutex_lock(&priv->action_mutex); 6997 if (!(priv->status & STATUS_INITIALIZED)) { 6998 err = -EIO; 6999 goto done; 7000 } 7001 7002 if (wrqu->essid.flags && wrqu->essid.length) { 7003 length = wrqu->essid.length; 7004 essid = extra; 7005 } 7006 7007 if (length == 0) { 7008 IPW_DEBUG_WX("Setting ESSID to ANY\n"); 7009 priv->config &= ~CFG_STATIC_ESSID; 7010 err = ipw2100_set_essid(priv, NULL, 0, 0); 7011 goto done; 7012 } 7013 7014 length = min(length, IW_ESSID_MAX_SIZE); 7015 7016 priv->config |= CFG_STATIC_ESSID; 7017 7018 if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { 7019 IPW_DEBUG_WX("ESSID set to current ESSID.\n"); 7020 err = 0; 7021 goto done; 7022 } 7023 7024 IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", 7025 print_ssid(ssid, essid, length), length); 7026 7027 priv->essid_len = length; 7028 memcpy(priv->essid, essid, priv->essid_len); 7029 7030 err = ipw2100_set_essid(priv, essid, length, 0); 7031 7032 done: 7033 mutex_unlock(&priv->action_mutex); 7034 return err; 7035 } 7036 7037 static int ipw2100_wx_get_essid(struct net_device *dev, 7038 struct iw_request_info *info, 7039 union iwreq_data *wrqu, char *extra) 7040 { 7041 /* 7042 * This can be called at any time. No action lock required 7043 */ 7044 7045 struct ipw2100_priv *priv = libipw_priv(dev); 7046 DECLARE_SSID_BUF(ssid); 7047 7048 /* If we are associated, trying to associate, or have a statically 7049 * configured ESSID then return that; otherwise return ANY */ 7050 if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) { 7051 IPW_DEBUG_WX("Getting essid: '%s'\n", 7052 print_ssid(ssid, priv->essid, priv->essid_len)); 7053 memcpy(extra, priv->essid, priv->essid_len); 7054 wrqu->essid.length = priv->essid_len; 7055 wrqu->essid.flags = 1; /* active */ 7056 } else { 7057 IPW_DEBUG_WX("Getting essid: ANY\n"); 7058 wrqu->essid.length = 0; 7059 wrqu->essid.flags = 0; /* active */ 7060 } 7061 7062 return 0; 7063 } 7064 7065 static int ipw2100_wx_set_nick(struct net_device *dev, 7066 struct iw_request_info *info, 7067 union iwreq_data *wrqu, char *extra) 7068 { 7069 /* 7070 * This can be called at any time. No action lock required 7071 */ 7072 7073 struct ipw2100_priv *priv = libipw_priv(dev); 7074 7075 if (wrqu->data.length > IW_ESSID_MAX_SIZE) 7076 return -E2BIG; 7077 7078 wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); 7079 memset(priv->nick, 0, sizeof(priv->nick)); 7080 memcpy(priv->nick, extra, wrqu->data.length); 7081 7082 IPW_DEBUG_WX("SET Nickname -> %s\n", priv->nick); 7083 7084 return 0; 7085 } 7086 7087 static int ipw2100_wx_get_nick(struct net_device *dev, 7088 struct iw_request_info *info, 7089 union iwreq_data *wrqu, char *extra) 7090 { 7091 /* 7092 * This can be called at any time. No action lock required 7093 */ 7094 7095 struct ipw2100_priv *priv = libipw_priv(dev); 7096 7097 wrqu->data.length = strlen(priv->nick); 7098 memcpy(extra, priv->nick, wrqu->data.length); 7099 wrqu->data.flags = 1; /* active */ 7100 7101 IPW_DEBUG_WX("GET Nickname -> %s\n", extra); 7102 7103 return 0; 7104 } 7105 7106 static int ipw2100_wx_set_rate(struct net_device *dev, 7107 struct iw_request_info *info, 7108 union iwreq_data *wrqu, char *extra) 7109 { 7110 struct ipw2100_priv *priv = libipw_priv(dev); 7111 u32 target_rate = wrqu->bitrate.value; 7112 u32 rate; 7113 int err = 0; 7114 7115 mutex_lock(&priv->action_mutex); 7116 if (!(priv->status & STATUS_INITIALIZED)) { 7117 err = -EIO; 7118 goto done; 7119 } 7120 7121 rate = 0; 7122 7123 if (target_rate == 1000000 || 7124 (!wrqu->bitrate.fixed && target_rate > 1000000)) 7125 rate |= TX_RATE_1_MBIT; 7126 if (target_rate == 2000000 || 7127 (!wrqu->bitrate.fixed && target_rate > 2000000)) 7128 rate |= TX_RATE_2_MBIT; 7129 if (target_rate == 5500000 || 7130 (!wrqu->bitrate.fixed && target_rate > 5500000)) 7131 rate |= TX_RATE_5_5_MBIT; 7132 if (target_rate == 11000000 || 7133 (!wrqu->bitrate.fixed && target_rate > 11000000)) 7134 rate |= TX_RATE_11_MBIT; 7135 if (rate == 0) 7136 rate = DEFAULT_TX_RATES; 7137 7138 err = ipw2100_set_tx_rates(priv, rate, 0); 7139 7140 IPW_DEBUG_WX("SET Rate -> %04X\n", rate); 7141 done: 7142 mutex_unlock(&priv->action_mutex); 7143 return err; 7144 } 7145 7146 static int ipw2100_wx_get_rate(struct net_device *dev, 7147 struct iw_request_info *info, 7148 union iwreq_data *wrqu, char *extra) 7149 { 7150 struct ipw2100_priv *priv = libipw_priv(dev); 7151 int val; 7152 unsigned int len = sizeof(val); 7153 int err = 0; 7154 7155 if (!(priv->status & STATUS_ENABLED) || 7156 priv->status & STATUS_RF_KILL_MASK || 7157 !(priv->status & STATUS_ASSOCIATED)) { 7158 wrqu->bitrate.value = 0; 7159 return 0; 7160 } 7161 7162 mutex_lock(&priv->action_mutex); 7163 if (!(priv->status & STATUS_INITIALIZED)) { 7164 err = -EIO; 7165 goto done; 7166 } 7167 7168 err = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &val, &len); 7169 if (err) { 7170 IPW_DEBUG_WX("failed querying ordinals.\n"); 7171 goto done; 7172 } 7173 7174 switch (val & TX_RATE_MASK) { 7175 case TX_RATE_1_MBIT: 7176 wrqu->bitrate.value = 1000000; 7177 break; 7178 case TX_RATE_2_MBIT: 7179 wrqu->bitrate.value = 2000000; 7180 break; 7181 case TX_RATE_5_5_MBIT: 7182 wrqu->bitrate.value = 5500000; 7183 break; 7184 case TX_RATE_11_MBIT: 7185 wrqu->bitrate.value = 11000000; 7186 break; 7187 default: 7188 wrqu->bitrate.value = 0; 7189 } 7190 7191 IPW_DEBUG_WX("GET Rate -> %d\n", wrqu->bitrate.value); 7192 7193 done: 7194 mutex_unlock(&priv->action_mutex); 7195 return err; 7196 } 7197 7198 static int ipw2100_wx_set_rts(struct net_device *dev, 7199 struct iw_request_info *info, 7200 union iwreq_data *wrqu, char *extra) 7201 { 7202 struct ipw2100_priv *priv = libipw_priv(dev); 7203 int value, err; 7204 7205 /* Auto RTS not yet supported */ 7206 if (wrqu->rts.fixed == 0) 7207 return -EINVAL; 7208 7209 mutex_lock(&priv->action_mutex); 7210 if (!(priv->status & STATUS_INITIALIZED)) { 7211 err = -EIO; 7212 goto done; 7213 } 7214 7215 if (wrqu->rts.disabled) 7216 value = priv->rts_threshold | RTS_DISABLED; 7217 else { 7218 if (wrqu->rts.value < 1 || wrqu->rts.value > 2304) { 7219 err = -EINVAL; 7220 goto done; 7221 } 7222 value = wrqu->rts.value; 7223 } 7224 7225 err = ipw2100_set_rts_threshold(priv, value); 7226 7227 IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X\n", value); 7228 done: 7229 mutex_unlock(&priv->action_mutex); 7230 return err; 7231 } 7232 7233 static int ipw2100_wx_get_rts(struct net_device *dev, 7234 struct iw_request_info *info, 7235 union iwreq_data *wrqu, char *extra) 7236 { 7237 /* 7238 * This can be called at any time. No action lock required 7239 */ 7240 7241 struct ipw2100_priv *priv = libipw_priv(dev); 7242 7243 wrqu->rts.value = priv->rts_threshold & ~RTS_DISABLED; 7244 wrqu->rts.fixed = 1; /* no auto select */ 7245 7246 /* If RTS is set to the default value, then it is disabled */ 7247 wrqu->rts.disabled = (priv->rts_threshold & RTS_DISABLED) ? 1 : 0; 7248 7249 IPW_DEBUG_WX("GET RTS Threshold -> 0x%08X\n", wrqu->rts.value); 7250 7251 return 0; 7252 } 7253 7254 static int ipw2100_wx_set_txpow(struct net_device *dev, 7255 struct iw_request_info *info, 7256 union iwreq_data *wrqu, char *extra) 7257 { 7258 struct ipw2100_priv *priv = libipw_priv(dev); 7259 int err = 0, value; 7260 7261 if (ipw_radio_kill_sw(priv, wrqu->txpower.disabled)) 7262 return -EINPROGRESS; 7263 7264 if (priv->ieee->iw_mode != IW_MODE_ADHOC) 7265 return 0; 7266 7267 if ((wrqu->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) 7268 return -EINVAL; 7269 7270 if (wrqu->txpower.fixed == 0) 7271 value = IPW_TX_POWER_DEFAULT; 7272 else { 7273 if (wrqu->txpower.value < IPW_TX_POWER_MIN_DBM || 7274 wrqu->txpower.value > IPW_TX_POWER_MAX_DBM) 7275 return -EINVAL; 7276 7277 value = wrqu->txpower.value; 7278 } 7279 7280 mutex_lock(&priv->action_mutex); 7281 if (!(priv->status & STATUS_INITIALIZED)) { 7282 err = -EIO; 7283 goto done; 7284 } 7285 7286 err = ipw2100_set_tx_power(priv, value); 7287 7288 IPW_DEBUG_WX("SET TX Power -> %d\n", value); 7289 7290 done: 7291 mutex_unlock(&priv->action_mutex); 7292 return err; 7293 } 7294 7295 static int ipw2100_wx_get_txpow(struct net_device *dev, 7296 struct iw_request_info *info, 7297 union iwreq_data *wrqu, char *extra) 7298 { 7299 /* 7300 * This can be called at any time. No action lock required 7301 */ 7302 7303 struct ipw2100_priv *priv = libipw_priv(dev); 7304 7305 wrqu->txpower.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; 7306 7307 if (priv->tx_power == IPW_TX_POWER_DEFAULT) { 7308 wrqu->txpower.fixed = 0; 7309 wrqu->txpower.value = IPW_TX_POWER_MAX_DBM; 7310 } else { 7311 wrqu->txpower.fixed = 1; 7312 wrqu->txpower.value = priv->tx_power; 7313 } 7314 7315 wrqu->txpower.flags = IW_TXPOW_DBM; 7316 7317 IPW_DEBUG_WX("GET TX Power -> %d\n", wrqu->txpower.value); 7318 7319 return 0; 7320 } 7321 7322 static int ipw2100_wx_set_frag(struct net_device *dev, 7323 struct iw_request_info *info, 7324 union iwreq_data *wrqu, char *extra) 7325 { 7326 /* 7327 * This can be called at any time. No action lock required 7328 */ 7329 7330 struct ipw2100_priv *priv = libipw_priv(dev); 7331 7332 if (!wrqu->frag.fixed) 7333 return -EINVAL; 7334 7335 if (wrqu->frag.disabled) { 7336 priv->frag_threshold |= FRAG_DISABLED; 7337 priv->ieee->fts = DEFAULT_FTS; 7338 } else { 7339 if (wrqu->frag.value < MIN_FRAG_THRESHOLD || 7340 wrqu->frag.value > MAX_FRAG_THRESHOLD) 7341 return -EINVAL; 7342 7343 priv->ieee->fts = wrqu->frag.value & ~0x1; 7344 priv->frag_threshold = priv->ieee->fts; 7345 } 7346 7347 IPW_DEBUG_WX("SET Frag Threshold -> %d\n", priv->ieee->fts); 7348 7349 return 0; 7350 } 7351 7352 static int ipw2100_wx_get_frag(struct net_device *dev, 7353 struct iw_request_info *info, 7354 union iwreq_data *wrqu, char *extra) 7355 { 7356 /* 7357 * This can be called at any time. No action lock required 7358 */ 7359 7360 struct ipw2100_priv *priv = libipw_priv(dev); 7361 wrqu->frag.value = priv->frag_threshold & ~FRAG_DISABLED; 7362 wrqu->frag.fixed = 0; /* no auto select */ 7363 wrqu->frag.disabled = (priv->frag_threshold & FRAG_DISABLED) ? 1 : 0; 7364 7365 IPW_DEBUG_WX("GET Frag Threshold -> %d\n", wrqu->frag.value); 7366 7367 return 0; 7368 } 7369 7370 static int ipw2100_wx_set_retry(struct net_device *dev, 7371 struct iw_request_info *info, 7372 union iwreq_data *wrqu, char *extra) 7373 { 7374 struct ipw2100_priv *priv = libipw_priv(dev); 7375 int err = 0; 7376 7377 if (wrqu->retry.flags & IW_RETRY_LIFETIME || wrqu->retry.disabled) 7378 return -EINVAL; 7379 7380 if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) 7381 return 0; 7382 7383 mutex_lock(&priv->action_mutex); 7384 if (!(priv->status & STATUS_INITIALIZED)) { 7385 err = -EIO; 7386 goto done; 7387 } 7388 7389 if (wrqu->retry.flags & IW_RETRY_SHORT) { 7390 err = ipw2100_set_short_retry(priv, wrqu->retry.value); 7391 IPW_DEBUG_WX("SET Short Retry Limit -> %d\n", 7392 wrqu->retry.value); 7393 goto done; 7394 } 7395 7396 if (wrqu->retry.flags & IW_RETRY_LONG) { 7397 err = ipw2100_set_long_retry(priv, wrqu->retry.value); 7398 IPW_DEBUG_WX("SET Long Retry Limit -> %d\n", 7399 wrqu->retry.value); 7400 goto done; 7401 } 7402 7403 err = ipw2100_set_short_retry(priv, wrqu->retry.value); 7404 if (!err) 7405 err = ipw2100_set_long_retry(priv, wrqu->retry.value); 7406 7407 IPW_DEBUG_WX("SET Both Retry Limits -> %d\n", wrqu->retry.value); 7408 7409 done: 7410 mutex_unlock(&priv->action_mutex); 7411 return err; 7412 } 7413 7414 static int ipw2100_wx_get_retry(struct net_device *dev, 7415 struct iw_request_info *info, 7416 union iwreq_data *wrqu, char *extra) 7417 { 7418 /* 7419 * This can be called at any time. No action lock required 7420 */ 7421 7422 struct ipw2100_priv *priv = libipw_priv(dev); 7423 7424 wrqu->retry.disabled = 0; /* can't be disabled */ 7425 7426 if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) 7427 return -EINVAL; 7428 7429 if (wrqu->retry.flags & IW_RETRY_LONG) { 7430 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; 7431 wrqu->retry.value = priv->long_retry_limit; 7432 } else { 7433 wrqu->retry.flags = 7434 (priv->short_retry_limit != 7435 priv->long_retry_limit) ? 7436 IW_RETRY_LIMIT | IW_RETRY_SHORT : IW_RETRY_LIMIT; 7437 7438 wrqu->retry.value = priv->short_retry_limit; 7439 } 7440 7441 IPW_DEBUG_WX("GET Retry -> %d\n", wrqu->retry.value); 7442 7443 return 0; 7444 } 7445 7446 static int ipw2100_wx_set_scan(struct net_device *dev, 7447 struct iw_request_info *info, 7448 union iwreq_data *wrqu, char *extra) 7449 { 7450 struct ipw2100_priv *priv = libipw_priv(dev); 7451 int err = 0; 7452 7453 mutex_lock(&priv->action_mutex); 7454 if (!(priv->status & STATUS_INITIALIZED)) { 7455 err = -EIO; 7456 goto done; 7457 } 7458 7459 IPW_DEBUG_WX("Initiating scan...\n"); 7460 7461 priv->user_requested_scan = 1; 7462 if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) { 7463 IPW_DEBUG_WX("Start scan failed.\n"); 7464 7465 /* TODO: Mark a scan as pending so when hardware initialized 7466 * a scan starts */ 7467 } 7468 7469 done: 7470 mutex_unlock(&priv->action_mutex); 7471 return err; 7472 } 7473 7474 static int ipw2100_wx_get_scan(struct net_device *dev, 7475 struct iw_request_info *info, 7476 union iwreq_data *wrqu, char *extra) 7477 { 7478 /* 7479 * This can be called at any time. No action lock required 7480 */ 7481 7482 struct ipw2100_priv *priv = libipw_priv(dev); 7483 return libipw_wx_get_scan(priv->ieee, info, wrqu, extra); 7484 } 7485 7486 /* 7487 * Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c 7488 */ 7489 static int ipw2100_wx_set_encode(struct net_device *dev, 7490 struct iw_request_info *info, 7491 union iwreq_data *wrqu, char *key) 7492 { 7493 /* 7494 * No check of STATUS_INITIALIZED required 7495 */ 7496 7497 struct ipw2100_priv *priv = libipw_priv(dev); 7498 return libipw_wx_set_encode(priv->ieee, info, wrqu, key); 7499 } 7500 7501 static int ipw2100_wx_get_encode(struct net_device *dev, 7502 struct iw_request_info *info, 7503 union iwreq_data *wrqu, char *key) 7504 { 7505 /* 7506 * This can be called at any time. No action lock required 7507 */ 7508 7509 struct ipw2100_priv *priv = libipw_priv(dev); 7510 return libipw_wx_get_encode(priv->ieee, info, wrqu, key); 7511 } 7512 7513 static int ipw2100_wx_set_power(struct net_device *dev, 7514 struct iw_request_info *info, 7515 union iwreq_data *wrqu, char *extra) 7516 { 7517 struct ipw2100_priv *priv = libipw_priv(dev); 7518 int err = 0; 7519 7520 mutex_lock(&priv->action_mutex); 7521 if (!(priv->status & STATUS_INITIALIZED)) { 7522 err = -EIO; 7523 goto done; 7524 } 7525 7526 if (wrqu->power.disabled) { 7527 priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); 7528 err = ipw2100_set_power_mode(priv, IPW_POWER_MODE_CAM); 7529 IPW_DEBUG_WX("SET Power Management Mode -> off\n"); 7530 goto done; 7531 } 7532 7533 switch (wrqu->power.flags & IW_POWER_MODE) { 7534 case IW_POWER_ON: /* If not specified */ 7535 case IW_POWER_MODE: /* If set all mask */ 7536 case IW_POWER_ALL_R: /* If explicitly state all */ 7537 break; 7538 default: /* Otherwise we don't support it */ 7539 IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", 7540 wrqu->power.flags); 7541 err = -EOPNOTSUPP; 7542 goto done; 7543 } 7544 7545 /* If the user hasn't specified a power management mode yet, default 7546 * to BATTERY */ 7547 priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; 7548 err = ipw2100_set_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); 7549 7550 IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); 7551 7552 done: 7553 mutex_unlock(&priv->action_mutex); 7554 return err; 7555 7556 } 7557 7558 static int ipw2100_wx_get_power(struct net_device *dev, 7559 struct iw_request_info *info, 7560 union iwreq_data *wrqu, char *extra) 7561 { 7562 /* 7563 * This can be called at any time. No action lock required 7564 */ 7565 7566 struct ipw2100_priv *priv = libipw_priv(dev); 7567 7568 if (!(priv->power_mode & IPW_POWER_ENABLED)) 7569 wrqu->power.disabled = 1; 7570 else { 7571 wrqu->power.disabled = 0; 7572 wrqu->power.flags = 0; 7573 } 7574 7575 IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); 7576 7577 return 0; 7578 } 7579 7580 /* 7581 * WE-18 WPA support 7582 */ 7583 7584 /* SIOCSIWGENIE */ 7585 static int ipw2100_wx_set_genie(struct net_device *dev, 7586 struct iw_request_info *info, 7587 union iwreq_data *wrqu, char *extra) 7588 { 7589 7590 struct ipw2100_priv *priv = libipw_priv(dev); 7591 struct libipw_device *ieee = priv->ieee; 7592 u8 *buf; 7593 7594 if (!ieee->wpa_enabled) 7595 return -EOPNOTSUPP; 7596 7597 if (wrqu->data.length > MAX_WPA_IE_LEN || 7598 (wrqu->data.length && extra == NULL)) 7599 return -EINVAL; 7600 7601 if (wrqu->data.length) { 7602 buf = kmemdup(extra, wrqu->data.length, GFP_KERNEL); 7603 if (buf == NULL) 7604 return -ENOMEM; 7605 7606 kfree(ieee->wpa_ie); 7607 ieee->wpa_ie = buf; 7608 ieee->wpa_ie_len = wrqu->data.length; 7609 } else { 7610 kfree(ieee->wpa_ie); 7611 ieee->wpa_ie = NULL; 7612 ieee->wpa_ie_len = 0; 7613 } 7614 7615 ipw2100_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); 7616 7617 return 0; 7618 } 7619 7620 /* SIOCGIWGENIE */ 7621 static int ipw2100_wx_get_genie(struct net_device *dev, 7622 struct iw_request_info *info, 7623 union iwreq_data *wrqu, char *extra) 7624 { 7625 struct ipw2100_priv *priv = libipw_priv(dev); 7626 struct libipw_device *ieee = priv->ieee; 7627 7628 if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { 7629 wrqu->data.length = 0; 7630 return 0; 7631 } 7632 7633 if (wrqu->data.length < ieee->wpa_ie_len) 7634 return -E2BIG; 7635 7636 wrqu->data.length = ieee->wpa_ie_len; 7637 memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); 7638 7639 return 0; 7640 } 7641 7642 /* SIOCSIWAUTH */ 7643 static int ipw2100_wx_set_auth(struct net_device *dev, 7644 struct iw_request_info *info, 7645 union iwreq_data *wrqu, char *extra) 7646 { 7647 struct ipw2100_priv *priv = libipw_priv(dev); 7648 struct libipw_device *ieee = priv->ieee; 7649 struct iw_param *param = &wrqu->param; 7650 struct lib80211_crypt_data *crypt; 7651 unsigned long flags; 7652 int ret = 0; 7653 7654 switch (param->flags & IW_AUTH_INDEX) { 7655 case IW_AUTH_WPA_VERSION: 7656 case IW_AUTH_CIPHER_PAIRWISE: 7657 case IW_AUTH_CIPHER_GROUP: 7658 case IW_AUTH_KEY_MGMT: 7659 /* 7660 * ipw2200 does not use these parameters 7661 */ 7662 break; 7663 7664 case IW_AUTH_TKIP_COUNTERMEASURES: 7665 crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx]; 7666 if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) 7667 break; 7668 7669 flags = crypt->ops->get_flags(crypt->priv); 7670 7671 if (param->value) 7672 flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; 7673 else 7674 flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; 7675 7676 crypt->ops->set_flags(flags, crypt->priv); 7677 7678 break; 7679 7680 case IW_AUTH_DROP_UNENCRYPTED:{ 7681 /* HACK: 7682 * 7683 * wpa_supplicant calls set_wpa_enabled when the driver 7684 * is loaded and unloaded, regardless of if WPA is being 7685 * used. No other calls are made which can be used to 7686 * determine if encryption will be used or not prior to 7687 * association being expected. If encryption is not being 7688 * used, drop_unencrypted is set to false, else true -- we 7689 * can use this to determine if the CAP_PRIVACY_ON bit should 7690 * be set. 7691 */ 7692 struct libipw_security sec = { 7693 .flags = SEC_ENABLED, 7694 .enabled = param->value, 7695 }; 7696 priv->ieee->drop_unencrypted = param->value; 7697 /* We only change SEC_LEVEL for open mode. Others 7698 * are set by ipw_wpa_set_encryption. 7699 */ 7700 if (!param->value) { 7701 sec.flags |= SEC_LEVEL; 7702 sec.level = SEC_LEVEL_0; 7703 } else { 7704 sec.flags |= SEC_LEVEL; 7705 sec.level = SEC_LEVEL_1; 7706 } 7707 if (priv->ieee->set_security) 7708 priv->ieee->set_security(priv->ieee->dev, &sec); 7709 break; 7710 } 7711 7712 case IW_AUTH_80211_AUTH_ALG: 7713 ret = ipw2100_wpa_set_auth_algs(priv, param->value); 7714 break; 7715 7716 case IW_AUTH_WPA_ENABLED: 7717 ret = ipw2100_wpa_enable(priv, param->value); 7718 break; 7719 7720 case IW_AUTH_RX_UNENCRYPTED_EAPOL: 7721 ieee->ieee802_1x = param->value; 7722 break; 7723 7724 //case IW_AUTH_ROAMING_CONTROL: 7725 case IW_AUTH_PRIVACY_INVOKED: 7726 ieee->privacy_invoked = param->value; 7727 break; 7728 7729 default: 7730 return -EOPNOTSUPP; 7731 } 7732 return ret; 7733 } 7734 7735 /* SIOCGIWAUTH */ 7736 static int ipw2100_wx_get_auth(struct net_device *dev, 7737 struct iw_request_info *info, 7738 union iwreq_data *wrqu, char *extra) 7739 { 7740 struct ipw2100_priv *priv = libipw_priv(dev); 7741 struct libipw_device *ieee = priv->ieee; 7742 struct lib80211_crypt_data *crypt; 7743 struct iw_param *param = &wrqu->param; 7744 int ret = 0; 7745 7746 switch (param->flags & IW_AUTH_INDEX) { 7747 case IW_AUTH_WPA_VERSION: 7748 case IW_AUTH_CIPHER_PAIRWISE: 7749 case IW_AUTH_CIPHER_GROUP: 7750 case IW_AUTH_KEY_MGMT: 7751 /* 7752 * wpa_supplicant will control these internally 7753 */ 7754 ret = -EOPNOTSUPP; 7755 break; 7756 7757 case IW_AUTH_TKIP_COUNTERMEASURES: 7758 crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx]; 7759 if (!crypt || !crypt->ops->get_flags) { 7760 IPW_DEBUG_WARNING("Can't get TKIP countermeasures: " 7761 "crypt not set!\n"); 7762 break; 7763 } 7764 7765 param->value = (crypt->ops->get_flags(crypt->priv) & 7766 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) ? 1 : 0; 7767 7768 break; 7769 7770 case IW_AUTH_DROP_UNENCRYPTED: 7771 param->value = ieee->drop_unencrypted; 7772 break; 7773 7774 case IW_AUTH_80211_AUTH_ALG: 7775 param->value = priv->ieee->sec.auth_mode; 7776 break; 7777 7778 case IW_AUTH_WPA_ENABLED: 7779 param->value = ieee->wpa_enabled; 7780 break; 7781 7782 case IW_AUTH_RX_UNENCRYPTED_EAPOL: 7783 param->value = ieee->ieee802_1x; 7784 break; 7785 7786 case IW_AUTH_ROAMING_CONTROL: 7787 case IW_AUTH_PRIVACY_INVOKED: 7788 param->value = ieee->privacy_invoked; 7789 break; 7790 7791 default: 7792 return -EOPNOTSUPP; 7793 } 7794 return 0; 7795 } 7796 7797 /* SIOCSIWENCODEEXT */ 7798 static int ipw2100_wx_set_encodeext(struct net_device *dev, 7799 struct iw_request_info *info, 7800 union iwreq_data *wrqu, char *extra) 7801 { 7802 struct ipw2100_priv *priv = libipw_priv(dev); 7803 return libipw_wx_set_encodeext(priv->ieee, info, wrqu, extra); 7804 } 7805 7806 /* SIOCGIWENCODEEXT */ 7807 static int ipw2100_wx_get_encodeext(struct net_device *dev, 7808 struct iw_request_info *info, 7809 union iwreq_data *wrqu, char *extra) 7810 { 7811 struct ipw2100_priv *priv = libipw_priv(dev); 7812 return libipw_wx_get_encodeext(priv->ieee, info, wrqu, extra); 7813 } 7814 7815 /* SIOCSIWMLME */ 7816 static int ipw2100_wx_set_mlme(struct net_device *dev, 7817 struct iw_request_info *info, 7818 union iwreq_data *wrqu, char *extra) 7819 { 7820 struct ipw2100_priv *priv = libipw_priv(dev); 7821 struct iw_mlme *mlme = (struct iw_mlme *)extra; 7822 __le16 reason; 7823 7824 reason = cpu_to_le16(mlme->reason_code); 7825 7826 switch (mlme->cmd) { 7827 case IW_MLME_DEAUTH: 7828 // silently ignore 7829 break; 7830 7831 case IW_MLME_DISASSOC: 7832 ipw2100_disassociate_bssid(priv); 7833 break; 7834 7835 default: 7836 return -EOPNOTSUPP; 7837 } 7838 return 0; 7839 } 7840 7841 /* 7842 * 7843 * IWPRIV handlers 7844 * 7845 */ 7846 #ifdef CONFIG_IPW2100_MONITOR 7847 static int ipw2100_wx_set_promisc(struct net_device *dev, 7848 struct iw_request_info *info, 7849 union iwreq_data *wrqu, char *extra) 7850 { 7851 struct ipw2100_priv *priv = libipw_priv(dev); 7852 int *parms = (int *)extra; 7853 int enable = (parms[0] > 0); 7854 int err = 0; 7855 7856 mutex_lock(&priv->action_mutex); 7857 if (!(priv->status & STATUS_INITIALIZED)) { 7858 err = -EIO; 7859 goto done; 7860 } 7861 7862 if (enable) { 7863 if (priv->ieee->iw_mode == IW_MODE_MONITOR) { 7864 err = ipw2100_set_channel(priv, parms[1], 0); 7865 goto done; 7866 } 7867 priv->channel = parms[1]; 7868 err = ipw2100_switch_mode(priv, IW_MODE_MONITOR); 7869 } else { 7870 if (priv->ieee->iw_mode == IW_MODE_MONITOR) 7871 err = ipw2100_switch_mode(priv, priv->last_mode); 7872 } 7873 done: 7874 mutex_unlock(&priv->action_mutex); 7875 return err; 7876 } 7877 7878 static int ipw2100_wx_reset(struct net_device *dev, 7879 struct iw_request_info *info, 7880 union iwreq_data *wrqu, char *extra) 7881 { 7882 struct ipw2100_priv *priv = libipw_priv(dev); 7883 if (priv->status & STATUS_INITIALIZED) 7884 schedule_reset(priv); 7885 return 0; 7886 } 7887 7888 #endif 7889 7890 static int ipw2100_wx_set_powermode(struct net_device *dev, 7891 struct iw_request_info *info, 7892 union iwreq_data *wrqu, char *extra) 7893 { 7894 struct ipw2100_priv *priv = libipw_priv(dev); 7895 int err = 0, mode = *(int *)extra; 7896 7897 mutex_lock(&priv->action_mutex); 7898 if (!(priv->status & STATUS_INITIALIZED)) { 7899 err = -EIO; 7900 goto done; 7901 } 7902 7903 if ((mode < 0) || (mode > POWER_MODES)) 7904 mode = IPW_POWER_AUTO; 7905 7906 if (IPW_POWER_LEVEL(priv->power_mode) != mode) 7907 err = ipw2100_set_power_mode(priv, mode); 7908 done: 7909 mutex_unlock(&priv->action_mutex); 7910 return err; 7911 } 7912 7913 #define MAX_POWER_STRING 80 7914 static int ipw2100_wx_get_powermode(struct net_device *dev, 7915 struct iw_request_info *info, 7916 union iwreq_data *wrqu, char *extra) 7917 { 7918 /* 7919 * This can be called at any time. No action lock required 7920 */ 7921 7922 struct ipw2100_priv *priv = libipw_priv(dev); 7923 int level = IPW_POWER_LEVEL(priv->power_mode); 7924 s32 timeout, period; 7925 7926 if (!(priv->power_mode & IPW_POWER_ENABLED)) { 7927 snprintf(extra, MAX_POWER_STRING, 7928 "Power save level: %d (Off)", level); 7929 } else { 7930 switch (level) { 7931 case IPW_POWER_MODE_CAM: 7932 snprintf(extra, MAX_POWER_STRING, 7933 "Power save level: %d (None)", level); 7934 break; 7935 case IPW_POWER_AUTO: 7936 snprintf(extra, MAX_POWER_STRING, 7937 "Power save level: %d (Auto)", level); 7938 break; 7939 default: 7940 timeout = timeout_duration[level - 1] / 1000; 7941 period = period_duration[level - 1] / 1000; 7942 snprintf(extra, MAX_POWER_STRING, 7943 "Power save level: %d " 7944 "(Timeout %dms, Period %dms)", 7945 level, timeout, period); 7946 } 7947 } 7948 7949 wrqu->data.length = strlen(extra) + 1; 7950 7951 return 0; 7952 } 7953 7954 static int ipw2100_wx_set_preamble(struct net_device *dev, 7955 struct iw_request_info *info, 7956 union iwreq_data *wrqu, char *extra) 7957 { 7958 struct ipw2100_priv *priv = libipw_priv(dev); 7959 int err, mode = *(int *)extra; 7960 7961 mutex_lock(&priv->action_mutex); 7962 if (!(priv->status & STATUS_INITIALIZED)) { 7963 err = -EIO; 7964 goto done; 7965 } 7966 7967 if (mode == 1) 7968 priv->config |= CFG_LONG_PREAMBLE; 7969 else if (mode == 0) 7970 priv->config &= ~CFG_LONG_PREAMBLE; 7971 else { 7972 err = -EINVAL; 7973 goto done; 7974 } 7975 7976 err = ipw2100_system_config(priv, 0); 7977 7978 done: 7979 mutex_unlock(&priv->action_mutex); 7980 return err; 7981 } 7982 7983 static int ipw2100_wx_get_preamble(struct net_device *dev, 7984 struct iw_request_info *info, 7985 union iwreq_data *wrqu, char *extra) 7986 { 7987 /* 7988 * This can be called at any time. No action lock required 7989 */ 7990 7991 struct ipw2100_priv *priv = libipw_priv(dev); 7992 7993 if (priv->config & CFG_LONG_PREAMBLE) 7994 snprintf(wrqu->name, IFNAMSIZ, "long (1)"); 7995 else 7996 snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); 7997 7998 return 0; 7999 } 8000 8001 #ifdef CONFIG_IPW2100_MONITOR 8002 static int ipw2100_wx_set_crc_check(struct net_device *dev, 8003 struct iw_request_info *info, 8004 union iwreq_data *wrqu, char *extra) 8005 { 8006 struct ipw2100_priv *priv = libipw_priv(dev); 8007 int err, mode = *(int *)extra; 8008 8009 mutex_lock(&priv->action_mutex); 8010 if (!(priv->status & STATUS_INITIALIZED)) { 8011 err = -EIO; 8012 goto done; 8013 } 8014 8015 if (mode == 1) 8016 priv->config |= CFG_CRC_CHECK; 8017 else if (mode == 0) 8018 priv->config &= ~CFG_CRC_CHECK; 8019 else { 8020 err = -EINVAL; 8021 goto done; 8022 } 8023 err = 0; 8024 8025 done: 8026 mutex_unlock(&priv->action_mutex); 8027 return err; 8028 } 8029 8030 static int ipw2100_wx_get_crc_check(struct net_device *dev, 8031 struct iw_request_info *info, 8032 union iwreq_data *wrqu, char *extra) 8033 { 8034 /* 8035 * This can be called at any time. No action lock required 8036 */ 8037 8038 struct ipw2100_priv *priv = libipw_priv(dev); 8039 8040 if (priv->config & CFG_CRC_CHECK) 8041 snprintf(wrqu->name, IFNAMSIZ, "CRC checked (1)"); 8042 else 8043 snprintf(wrqu->name, IFNAMSIZ, "CRC ignored (0)"); 8044 8045 return 0; 8046 } 8047 #endif /* CONFIG_IPW2100_MONITOR */ 8048 8049 static iw_handler ipw2100_wx_handlers[] = { 8050 IW_HANDLER(SIOCGIWNAME, ipw2100_wx_get_name), 8051 IW_HANDLER(SIOCSIWFREQ, ipw2100_wx_set_freq), 8052 IW_HANDLER(SIOCGIWFREQ, ipw2100_wx_get_freq), 8053 IW_HANDLER(SIOCSIWMODE, ipw2100_wx_set_mode), 8054 IW_HANDLER(SIOCGIWMODE, ipw2100_wx_get_mode), 8055 IW_HANDLER(SIOCGIWRANGE, ipw2100_wx_get_range), 8056 IW_HANDLER(SIOCSIWAP, ipw2100_wx_set_wap), 8057 IW_HANDLER(SIOCGIWAP, ipw2100_wx_get_wap), 8058 IW_HANDLER(SIOCSIWMLME, ipw2100_wx_set_mlme), 8059 IW_HANDLER(SIOCSIWSCAN, ipw2100_wx_set_scan), 8060 IW_HANDLER(SIOCGIWSCAN, ipw2100_wx_get_scan), 8061 IW_HANDLER(SIOCSIWESSID, ipw2100_wx_set_essid), 8062 IW_HANDLER(SIOCGIWESSID, ipw2100_wx_get_essid), 8063 IW_HANDLER(SIOCSIWNICKN, ipw2100_wx_set_nick), 8064 IW_HANDLER(SIOCGIWNICKN, ipw2100_wx_get_nick), 8065 IW_HANDLER(SIOCSIWRATE, ipw2100_wx_set_rate), 8066 IW_HANDLER(SIOCGIWRATE, ipw2100_wx_get_rate), 8067 IW_HANDLER(SIOCSIWRTS, ipw2100_wx_set_rts), 8068 IW_HANDLER(SIOCGIWRTS, ipw2100_wx_get_rts), 8069 IW_HANDLER(SIOCSIWFRAG, ipw2100_wx_set_frag), 8070 IW_HANDLER(SIOCGIWFRAG, ipw2100_wx_get_frag), 8071 IW_HANDLER(SIOCSIWTXPOW, ipw2100_wx_set_txpow), 8072 IW_HANDLER(SIOCGIWTXPOW, ipw2100_wx_get_txpow), 8073 IW_HANDLER(SIOCSIWRETRY, ipw2100_wx_set_retry), 8074 IW_HANDLER(SIOCGIWRETRY, ipw2100_wx_get_retry), 8075 IW_HANDLER(SIOCSIWENCODE, ipw2100_wx_set_encode), 8076 IW_HANDLER(SIOCGIWENCODE, ipw2100_wx_get_encode), 8077 IW_HANDLER(SIOCSIWPOWER, ipw2100_wx_set_power), 8078 IW_HANDLER(SIOCGIWPOWER, ipw2100_wx_get_power), 8079 IW_HANDLER(SIOCSIWGENIE, ipw2100_wx_set_genie), 8080 IW_HANDLER(SIOCGIWGENIE, ipw2100_wx_get_genie), 8081 IW_HANDLER(SIOCSIWAUTH, ipw2100_wx_set_auth), 8082 IW_HANDLER(SIOCGIWAUTH, ipw2100_wx_get_auth), 8083 IW_HANDLER(SIOCSIWENCODEEXT, ipw2100_wx_set_encodeext), 8084 IW_HANDLER(SIOCGIWENCODEEXT, ipw2100_wx_get_encodeext), 8085 }; 8086 8087 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 8088 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 8089 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 8090 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 8091 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 8092 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 8093 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 8094 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 8095 8096 static const struct iw_priv_args ipw2100_private_args[] = { 8097 8098 #ifdef CONFIG_IPW2100_MONITOR 8099 { 8100 IPW2100_PRIV_SET_MONITOR, 8101 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, 8102 { 8103 IPW2100_PRIV_RESET, 8104 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, 8105 #endif /* CONFIG_IPW2100_MONITOR */ 8106 8107 { 8108 IPW2100_PRIV_SET_POWER, 8109 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_power"}, 8110 { 8111 IPW2100_PRIV_GET_POWER, 8112 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_POWER_STRING, 8113 "get_power"}, 8114 { 8115 IPW2100_PRIV_SET_LONGPREAMBLE, 8116 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble"}, 8117 { 8118 IPW2100_PRIV_GET_LONGPREAMBLE, 8119 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_preamble"}, 8120 #ifdef CONFIG_IPW2100_MONITOR 8121 { 8122 IPW2100_PRIV_SET_CRC_CHECK, 8123 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_crc_check"}, 8124 { 8125 IPW2100_PRIV_GET_CRC_CHECK, 8126 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_crc_check"}, 8127 #endif /* CONFIG_IPW2100_MONITOR */ 8128 }; 8129 8130 static iw_handler ipw2100_private_handler[] = { 8131 #ifdef CONFIG_IPW2100_MONITOR 8132 ipw2100_wx_set_promisc, 8133 ipw2100_wx_reset, 8134 #else /* CONFIG_IPW2100_MONITOR */ 8135 NULL, 8136 NULL, 8137 #endif /* CONFIG_IPW2100_MONITOR */ 8138 ipw2100_wx_set_powermode, 8139 ipw2100_wx_get_powermode, 8140 ipw2100_wx_set_preamble, 8141 ipw2100_wx_get_preamble, 8142 #ifdef CONFIG_IPW2100_MONITOR 8143 ipw2100_wx_set_crc_check, 8144 ipw2100_wx_get_crc_check, 8145 #else /* CONFIG_IPW2100_MONITOR */ 8146 NULL, 8147 NULL, 8148 #endif /* CONFIG_IPW2100_MONITOR */ 8149 }; 8150 8151 /* 8152 * Get wireless statistics. 8153 * Called by /proc/net/wireless 8154 * Also called by SIOCGIWSTATS 8155 */ 8156 static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev) 8157 { 8158 enum { 8159 POOR = 30, 8160 FAIR = 60, 8161 GOOD = 80, 8162 VERY_GOOD = 90, 8163 EXCELLENT = 95, 8164 PERFECT = 100 8165 }; 8166 int rssi_qual; 8167 int tx_qual; 8168 int beacon_qual; 8169 int quality; 8170 8171 struct ipw2100_priv *priv = libipw_priv(dev); 8172 struct iw_statistics *wstats; 8173 u32 rssi, tx_retries, missed_beacons, tx_failures; 8174 u32 ord_len = sizeof(u32); 8175 8176 if (!priv) 8177 return (struct iw_statistics *)NULL; 8178 8179 wstats = &priv->wstats; 8180 8181 /* if hw is disabled, then ipw2100_get_ordinal() can't be called. 8182 * ipw2100_wx_wireless_stats seems to be called before fw is 8183 * initialized. STATUS_ASSOCIATED will only be set if the hw is up 8184 * and associated; if not associcated, the values are all meaningless 8185 * anyway, so set them all to NULL and INVALID */ 8186 if (!(priv->status & STATUS_ASSOCIATED)) { 8187 wstats->miss.beacon = 0; 8188 wstats->discard.retries = 0; 8189 wstats->qual.qual = 0; 8190 wstats->qual.level = 0; 8191 wstats->qual.noise = 0; 8192 wstats->qual.updated = 7; 8193 wstats->qual.updated |= IW_QUAL_NOISE_INVALID | 8194 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; 8195 return wstats; 8196 } 8197 8198 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_MISSED_BCNS, 8199 &missed_beacons, &ord_len)) 8200 goto fail_get_ordinal; 8201 8202 /* If we don't have a connection the quality and level is 0 */ 8203 if (!(priv->status & STATUS_ASSOCIATED)) { 8204 wstats->qual.qual = 0; 8205 wstats->qual.level = 0; 8206 } else { 8207 if (ipw2100_get_ordinal(priv, IPW_ORD_RSSI_AVG_CURR, 8208 &rssi, &ord_len)) 8209 goto fail_get_ordinal; 8210 wstats->qual.level = rssi + IPW2100_RSSI_TO_DBM; 8211 if (rssi < 10) 8212 rssi_qual = rssi * POOR / 10; 8213 else if (rssi < 15) 8214 rssi_qual = (rssi - 10) * (FAIR - POOR) / 5 + POOR; 8215 else if (rssi < 20) 8216 rssi_qual = (rssi - 15) * (GOOD - FAIR) / 5 + FAIR; 8217 else if (rssi < 30) 8218 rssi_qual = (rssi - 20) * (VERY_GOOD - GOOD) / 8219 10 + GOOD; 8220 else 8221 rssi_qual = (rssi - 30) * (PERFECT - VERY_GOOD) / 8222 10 + VERY_GOOD; 8223 8224 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_RETRIES, 8225 &tx_retries, &ord_len)) 8226 goto fail_get_ordinal; 8227 8228 if (tx_retries > 75) 8229 tx_qual = (90 - tx_retries) * POOR / 15; 8230 else if (tx_retries > 70) 8231 tx_qual = (75 - tx_retries) * (FAIR - POOR) / 5 + POOR; 8232 else if (tx_retries > 65) 8233 tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR; 8234 else if (tx_retries > 50) 8235 tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) / 8236 15 + GOOD; 8237 else 8238 tx_qual = (50 - tx_retries) * 8239 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; 8240 8241 if (missed_beacons > 50) 8242 beacon_qual = (60 - missed_beacons) * POOR / 10; 8243 else if (missed_beacons > 40) 8244 beacon_qual = (50 - missed_beacons) * (FAIR - POOR) / 8245 10 + POOR; 8246 else if (missed_beacons > 32) 8247 beacon_qual = (40 - missed_beacons) * (GOOD - FAIR) / 8248 18 + FAIR; 8249 else if (missed_beacons > 20) 8250 beacon_qual = (32 - missed_beacons) * 8251 (VERY_GOOD - GOOD) / 20 + GOOD; 8252 else 8253 beacon_qual = (20 - missed_beacons) * 8254 (PERFECT - VERY_GOOD) / 20 + VERY_GOOD; 8255 8256 quality = min(tx_qual, rssi_qual); 8257 quality = min(beacon_qual, quality); 8258 8259 #ifdef CONFIG_IPW2100_DEBUG 8260 if (beacon_qual == quality) 8261 IPW_DEBUG_WX("Quality clamped by Missed Beacons\n"); 8262 else if (tx_qual == quality) 8263 IPW_DEBUG_WX("Quality clamped by Tx Retries\n"); 8264 else if (quality != 100) 8265 IPW_DEBUG_WX("Quality clamped by Signal Strength\n"); 8266 else 8267 IPW_DEBUG_WX("Quality not clamped.\n"); 8268 #endif 8269 8270 wstats->qual.qual = quality; 8271 wstats->qual.level = rssi + IPW2100_RSSI_TO_DBM; 8272 } 8273 8274 wstats->qual.noise = 0; 8275 wstats->qual.updated = 7; 8276 wstats->qual.updated |= IW_QUAL_NOISE_INVALID; 8277 8278 /* FIXME: this is percent and not a # */ 8279 wstats->miss.beacon = missed_beacons; 8280 8281 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURES, 8282 &tx_failures, &ord_len)) 8283 goto fail_get_ordinal; 8284 wstats->discard.retries = tx_failures; 8285 8286 return wstats; 8287 8288 fail_get_ordinal: 8289 IPW_DEBUG_WX("failed querying ordinals.\n"); 8290 8291 return (struct iw_statistics *)NULL; 8292 } 8293 8294 static struct iw_handler_def ipw2100_wx_handler_def = { 8295 .standard = ipw2100_wx_handlers, 8296 .num_standard = ARRAY_SIZE(ipw2100_wx_handlers), 8297 .num_private = ARRAY_SIZE(ipw2100_private_handler), 8298 .num_private_args = ARRAY_SIZE(ipw2100_private_args), 8299 .private = (iw_handler *) ipw2100_private_handler, 8300 .private_args = (struct iw_priv_args *)ipw2100_private_args, 8301 .get_wireless_stats = ipw2100_wx_wireless_stats, 8302 }; 8303 8304 static void ipw2100_wx_event_work(struct work_struct *work) 8305 { 8306 struct ipw2100_priv *priv = 8307 container_of(work, struct ipw2100_priv, wx_event_work.work); 8308 union iwreq_data wrqu; 8309 unsigned int len = ETH_ALEN; 8310 8311 if (priv->status & STATUS_STOPPING) 8312 return; 8313 8314 mutex_lock(&priv->action_mutex); 8315 8316 IPW_DEBUG_WX("enter\n"); 8317 8318 mutex_unlock(&priv->action_mutex); 8319 8320 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 8321 8322 /* Fetch BSSID from the hardware */ 8323 if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) || 8324 priv->status & STATUS_RF_KILL_MASK || 8325 ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, 8326 &priv->bssid, &len)) { 8327 memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); 8328 } else { 8329 /* We now have the BSSID, so can finish setting to the full 8330 * associated state */ 8331 memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); 8332 memcpy(priv->ieee->bssid, priv->bssid, ETH_ALEN); 8333 priv->status &= ~STATUS_ASSOCIATING; 8334 priv->status |= STATUS_ASSOCIATED; 8335 netif_carrier_on(priv->net_dev); 8336 netif_wake_queue(priv->net_dev); 8337 } 8338 8339 if (!(priv->status & STATUS_ASSOCIATED)) { 8340 IPW_DEBUG_WX("Configuring ESSID\n"); 8341 mutex_lock(&priv->action_mutex); 8342 /* This is a disassociation event, so kick the firmware to 8343 * look for another AP */ 8344 if (priv->config & CFG_STATIC_ESSID) 8345 ipw2100_set_essid(priv, priv->essid, priv->essid_len, 8346 0); 8347 else 8348 ipw2100_set_essid(priv, NULL, 0, 0); 8349 mutex_unlock(&priv->action_mutex); 8350 } 8351 8352 wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); 8353 } 8354 8355 #define IPW2100_FW_MAJOR_VERSION 1 8356 #define IPW2100_FW_MINOR_VERSION 3 8357 8358 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 8359 #define IPW2100_FW_MAJOR(x) (x & 0xff) 8360 8361 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 8362 IPW2100_FW_MAJOR_VERSION) 8363 8364 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 8365 "." __stringify(IPW2100_FW_MINOR_VERSION) 8366 8367 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 8368 8369 /* 8370 8371 BINARY FIRMWARE HEADER FORMAT 8372 8373 offset length desc 8374 0 2 version 8375 2 2 mode == 0:BSS,1:IBSS,2:MONITOR 8376 4 4 fw_len 8377 8 4 uc_len 8378 C fw_len firmware data 8379 12 + fw_len uc_len microcode data 8380 8381 */ 8382 8383 struct ipw2100_fw_header { 8384 short version; 8385 short mode; 8386 unsigned int fw_size; 8387 unsigned int uc_size; 8388 } __packed; 8389 8390 static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw) 8391 { 8392 struct ipw2100_fw_header *h = 8393 (struct ipw2100_fw_header *)fw->fw_entry->data; 8394 8395 if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) { 8396 printk(KERN_WARNING DRV_NAME ": Firmware image not compatible " 8397 "(detected version id of %u). " 8398 "See Documentation/networking/README.ipw2100\n", 8399 h->version); 8400 return 1; 8401 } 8402 8403 fw->version = h->version; 8404 fw->fw.data = fw->fw_entry->data + sizeof(struct ipw2100_fw_header); 8405 fw->fw.size = h->fw_size; 8406 fw->uc.data = fw->fw.data + h->fw_size; 8407 fw->uc.size = h->uc_size; 8408 8409 return 0; 8410 } 8411 8412 static int ipw2100_get_firmware(struct ipw2100_priv *priv, 8413 struct ipw2100_fw *fw) 8414 { 8415 char *fw_name; 8416 int rc; 8417 8418 IPW_DEBUG_INFO("%s: Using hotplug firmware load.\n", 8419 priv->net_dev->name); 8420 8421 switch (priv->ieee->iw_mode) { 8422 case IW_MODE_ADHOC: 8423 fw_name = IPW2100_FW_NAME("-i"); 8424 break; 8425 #ifdef CONFIG_IPW2100_MONITOR 8426 case IW_MODE_MONITOR: 8427 fw_name = IPW2100_FW_NAME("-p"); 8428 break; 8429 #endif 8430 case IW_MODE_INFRA: 8431 default: 8432 fw_name = IPW2100_FW_NAME(""); 8433 break; 8434 } 8435 8436 rc = request_firmware(&fw->fw_entry, fw_name, &priv->pci_dev->dev); 8437 8438 if (rc < 0) { 8439 printk(KERN_ERR DRV_NAME ": " 8440 "%s: Firmware '%s' not available or load failed.\n", 8441 priv->net_dev->name, fw_name); 8442 return rc; 8443 } 8444 IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data, 8445 fw->fw_entry->size); 8446 8447 ipw2100_mod_firmware_load(fw); 8448 8449 return 0; 8450 } 8451 8452 MODULE_FIRMWARE(IPW2100_FW_NAME("-i")); 8453 #ifdef CONFIG_IPW2100_MONITOR 8454 MODULE_FIRMWARE(IPW2100_FW_NAME("-p")); 8455 #endif 8456 MODULE_FIRMWARE(IPW2100_FW_NAME("")); 8457 8458 static void ipw2100_release_firmware(struct ipw2100_priv *priv, 8459 struct ipw2100_fw *fw) 8460 { 8461 fw->version = 0; 8462 release_firmware(fw->fw_entry); 8463 fw->fw_entry = NULL; 8464 } 8465 8466 static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, 8467 size_t max) 8468 { 8469 char ver[MAX_FW_VERSION_LEN]; 8470 u32 len = MAX_FW_VERSION_LEN; 8471 u32 tmp; 8472 int i; 8473 /* firmware version is an ascii string (max len of 14) */ 8474 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_FW_VER_NUM, ver, &len)) 8475 return -EIO; 8476 tmp = max; 8477 if (len >= max) 8478 len = max - 1; 8479 for (i = 0; i < len; i++) 8480 buf[i] = ver[i]; 8481 buf[i] = '\0'; 8482 return tmp; 8483 } 8484 8485 static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, 8486 size_t max) 8487 { 8488 u32 ver; 8489 u32 len = sizeof(ver); 8490 /* microcode version is a 32 bit integer */ 8491 if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, &ver, &len)) 8492 return -EIO; 8493 return snprintf(buf, max, "%08X", ver); 8494 } 8495 8496 /* 8497 * On exit, the firmware will have been freed from the fw list 8498 */ 8499 static int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw) 8500 { 8501 /* firmware is constructed of N contiguous entries, each entry is 8502 * structured as: 8503 * 8504 * offset sie desc 8505 * 0 4 address to write to 8506 * 4 2 length of data run 8507 * 6 length data 8508 */ 8509 unsigned int addr; 8510 unsigned short len; 8511 8512 const unsigned char *firmware_data = fw->fw.data; 8513 unsigned int firmware_data_left = fw->fw.size; 8514 8515 while (firmware_data_left > 0) { 8516 addr = *(u32 *) (firmware_data); 8517 firmware_data += 4; 8518 firmware_data_left -= 4; 8519 8520 len = *(u16 *) (firmware_data); 8521 firmware_data += 2; 8522 firmware_data_left -= 2; 8523 8524 if (len > 32) { 8525 printk(KERN_ERR DRV_NAME ": " 8526 "Invalid firmware run-length of %d bytes\n", 8527 len); 8528 return -EINVAL; 8529 } 8530 8531 write_nic_memory(priv->net_dev, addr, len, firmware_data); 8532 firmware_data += len; 8533 firmware_data_left -= len; 8534 } 8535 8536 return 0; 8537 } 8538 8539 struct symbol_alive_response { 8540 u8 cmd_id; 8541 u8 seq_num; 8542 u8 ucode_rev; 8543 u8 eeprom_valid; 8544 u16 valid_flags; 8545 u8 IEEE_addr[6]; 8546 u16 flags; 8547 u16 pcb_rev; 8548 u16 clock_settle_time; // 1us LSB 8549 u16 powerup_settle_time; // 1us LSB 8550 u16 hop_settle_time; // 1us LSB 8551 u8 date[3]; // month, day, year 8552 u8 time[2]; // hours, minutes 8553 u8 ucode_valid; 8554 }; 8555 8556 static int ipw2100_ucode_download(struct ipw2100_priv *priv, 8557 struct ipw2100_fw *fw) 8558 { 8559 struct net_device *dev = priv->net_dev; 8560 const unsigned char *microcode_data = fw->uc.data; 8561 unsigned int microcode_data_left = fw->uc.size; 8562 void __iomem *reg = priv->ioaddr; 8563 8564 struct symbol_alive_response response; 8565 int i, j; 8566 u8 data; 8567 8568 /* Symbol control */ 8569 write_nic_word(dev, IPW2100_CONTROL_REG, 0x703); 8570 readl(reg); 8571 write_nic_word(dev, IPW2100_CONTROL_REG, 0x707); 8572 readl(reg); 8573 8574 /* HW config */ 8575 write_nic_byte(dev, 0x210014, 0x72); /* fifo width =16 */ 8576 readl(reg); 8577 write_nic_byte(dev, 0x210014, 0x72); /* fifo width =16 */ 8578 readl(reg); 8579 8580 /* EN_CS_ACCESS bit to reset control store pointer */ 8581 write_nic_byte(dev, 0x210000, 0x40); 8582 readl(reg); 8583 write_nic_byte(dev, 0x210000, 0x0); 8584 readl(reg); 8585 write_nic_byte(dev, 0x210000, 0x40); 8586 readl(reg); 8587 8588 /* copy microcode from buffer into Symbol */ 8589 8590 while (microcode_data_left > 0) { 8591 write_nic_byte(dev, 0x210010, *microcode_data++); 8592 write_nic_byte(dev, 0x210010, *microcode_data++); 8593 microcode_data_left -= 2; 8594 } 8595 8596 /* EN_CS_ACCESS bit to reset the control store pointer */ 8597 write_nic_byte(dev, 0x210000, 0x0); 8598 readl(reg); 8599 8600 /* Enable System (Reg 0) 8601 * first enable causes garbage in RX FIFO */ 8602 write_nic_byte(dev, 0x210000, 0x0); 8603 readl(reg); 8604 write_nic_byte(dev, 0x210000, 0x80); 8605 readl(reg); 8606 8607 /* Reset External Baseband Reg */ 8608 write_nic_word(dev, IPW2100_CONTROL_REG, 0x703); 8609 readl(reg); 8610 write_nic_word(dev, IPW2100_CONTROL_REG, 0x707); 8611 readl(reg); 8612 8613 /* HW Config (Reg 5) */ 8614 write_nic_byte(dev, 0x210014, 0x72); // fifo width =16 8615 readl(reg); 8616 write_nic_byte(dev, 0x210014, 0x72); // fifo width =16 8617 readl(reg); 8618 8619 /* Enable System (Reg 0) 8620 * second enable should be OK */ 8621 write_nic_byte(dev, 0x210000, 0x00); // clear enable system 8622 readl(reg); 8623 write_nic_byte(dev, 0x210000, 0x80); // set enable system 8624 8625 /* check Symbol is enabled - upped this from 5 as it wasn't always 8626 * catching the update */ 8627 for (i = 0; i < 10; i++) { 8628 udelay(10); 8629 8630 /* check Dino is enabled bit */ 8631 read_nic_byte(dev, 0x210000, &data); 8632 if (data & 0x1) 8633 break; 8634 } 8635 8636 if (i == 10) { 8637 printk(KERN_ERR DRV_NAME ": %s: Error initializing Symbol\n", 8638 dev->name); 8639 return -EIO; 8640 } 8641 8642 /* Get Symbol alive response */ 8643 for (i = 0; i < 30; i++) { 8644 /* Read alive response structure */ 8645 for (j = 0; 8646 j < (sizeof(struct symbol_alive_response) >> 1); j++) 8647 read_nic_word(dev, 0x210004, ((u16 *) & response) + j); 8648 8649 if ((response.cmd_id == 1) && (response.ucode_valid == 0x1)) 8650 break; 8651 udelay(10); 8652 } 8653 8654 if (i == 30) { 8655 printk(KERN_ERR DRV_NAME 8656 ": %s: No response from Symbol - hw not alive\n", 8657 dev->name); 8658 printk_buf(IPW_DL_ERROR, (u8 *) & response, sizeof(response)); 8659 return -EIO; 8660 } 8661 8662 return 0; 8663 } 8664 8665 8666 8667 8668 8669 /* LDV_COMMENT_BEGIN_MAIN */ 8670 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 8671 8672 /*###########################################################################*/ 8673 8674 /*############## Driver Environment Generator 0.2 output ####################*/ 8675 8676 /*###########################################################################*/ 8677 8678 8679 8680 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test if all kernel resources are correctly released by driver before driver will be unloaded. */ 8681 void ldv_check_final_state(void); 8682 8683 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 8684 void ldv_check_return_value(int res); 8685 8686 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 8687 void ldv_check_return_value_probe(int res); 8688 8689 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 8690 void ldv_initialize(void); 8691 8692 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 8693 void ldv_handler_precall(void); 8694 8695 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 8696 int nondet_int(void); 8697 8698 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 8699 int LDV_IN_INTERRUPT; 8700 8701 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 8702 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 8703 8704 8705 8706 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 8707 /*============================= VARIABLE DECLARATION PART =============================*/ 8708 /** STRUCT: struct type: ethtool_ops, struct name: ipw2100_ethtool_ops **/ 8709 /* content: static u32 ipw2100_ethtool_get_link(struct net_device *dev)*/ 8710 /* LDV_COMMENT_BEGIN_PREP */ 8711 #define IPW2100_VERSION "git-1.2.2" 8712 #define DRV_NAME "ipw2100" 8713 #define DRV_VERSION IPW2100_VERSION 8714 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 8715 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 8716 #ifdef CONFIG_IPW2100_DEBUG 8717 #define IPW2100_RX_DEBUG 8718 #endif 8719 #ifdef CONFIG_PM 8720 #endif 8721 #ifdef CONFIG_IPW2100_DEBUG 8722 #define IPW_DEBUG(level, message...) \ 8723 do { \ 8724 if (ipw2100_debug_level & (level)) { \ 8725 printk(KERN_DEBUG "ipw2100: %c %s ", \ 8726 in_interrupt() ? 'I' : 'U', __func__); \ 8727 printk(message); \ 8728 } \ 8729 } while (0) 8730 #else 8731 #define IPW_DEBUG(level, message...) do {} while (0) 8732 #endif 8733 #ifdef CONFIG_IPW2100_DEBUG 8734 #endif 8735 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 8736 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 8737 #define MAX_RESET_BACKOFF 10 8738 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 8739 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 8740 #ifndef CONFIG_PM 8741 #endif 8742 #ifdef CONFIG_PM 8743 #else 8744 #endif 8745 #ifndef CONFIG_PM 8746 #endif 8747 #define MAX_RF_KILL_CHECKS 5 8748 #define RF_KILL_CHECK_DELAY 40 8749 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 8750 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 8751 #define MAC_ASSOCIATION_READ_DELAY (HZ) 8752 #ifdef CONFIG_IPW2100_DEBUG 8753 #define IPW2100_HANDLER(v, f) { v, f, # v } 8754 #else 8755 #define IPW2100_HANDLER(v, f) { v, f } 8756 #endif 8757 #ifdef CONFIG_IPW2100_DEBUG 8758 #endif 8759 #ifdef CONFIG_IPW2100_DEBUG 8760 #endif 8761 #define SEARCH_ERROR 0xffffffff 8762 #define SEARCH_FAIL 0xfffffffe 8763 #define SEARCH_SUCCESS 0xfffffff0 8764 #define SEARCH_DISCARD 0 8765 #define SEARCH_SNAPSHOT 1 8766 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 8767 #ifdef IPW2100_DEBUG_C3 8768 #endif 8769 #ifdef IPW2100_RX_DEBUG 8770 #endif 8771 #ifdef IPW2100_DEBUG_C3 8772 #endif 8773 #ifdef IPW2100_DEBUG_C3 8774 #endif 8775 #ifdef IPW2100_RX_DEBUG 8776 #endif 8777 #ifdef IPW2100_RX_DEBUG 8778 #endif 8779 #ifdef CONFIG_IPW2100_MONITOR 8780 #endif 8781 #ifdef CONFIG_IPW2100_MONITOR 8782 #else 8783 #endif 8784 #ifdef CONFIG_IPW2100_MONITOR 8785 #endif 8786 #ifdef CONFIG_IPW2100_DEBUG 8787 #endif 8788 #ifdef CONFIG_IPW2100_DEBUG 8789 #endif 8790 #ifdef CONFIG_IPW2100_DEBUG 8791 #endif 8792 #define IPW2100_REG(x) { IPW_ ##x, #x } 8793 #define IPW2100_NIC(x, s) { x, #x, s } 8794 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 8795 #ifdef CONFIG_IPW2100_DEBUG 8796 #endif 8797 #ifdef CONFIG_IPW2100_MONITOR 8798 #endif 8799 #ifdef CONFIG_PM 8800 #endif 8801 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 8802 #ifdef CONFIG_IPW2100_DEBUG 8803 #endif 8804 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 8805 #endif 8806 #ifdef IPW2100_TX_POWER 8807 #endif 8808 #if 0 8809 #endif 8810 #ifdef CONFIG_IPW2100_DEBUG 8811 #endif 8812 #define IPW_PRIVACY_CAPABLE 0x0008 8813 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 8814 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 8815 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 8816 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 8817 #ifdef CONFIG_IPW2100_MONITOR 8818 #endif 8819 #ifdef CONFIG_IPW2100_MONITOR 8820 #endif 8821 /* LDV_COMMENT_END_PREP */ 8822 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_ethtool_get_link" */ 8823 struct net_device * var_group1; 8824 /* LDV_COMMENT_BEGIN_PREP */ 8825 #ifdef CONFIG_IPW2100_MONITOR 8826 #endif 8827 #ifdef CONFIG_IPW2100_MONITOR 8828 #endif 8829 #ifdef CONFIG_PM 8830 #endif 8831 #ifdef CONFIG_PM 8832 #endif 8833 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 8834 #ifdef CONFIG_PM 8835 #endif 8836 #ifdef CONFIG_IPW2100_DEBUG 8837 #endif 8838 #ifdef CONFIG_IPW2100_DEBUG 8839 #endif 8840 #ifdef CONFIG_IPW2100_MONITOR 8841 #endif 8842 #define POWER_MODES 5 8843 #ifdef CONFIG_IPW2100_MONITOR 8844 #endif 8845 #define MAX_POWER_STRING 80 8846 #ifdef CONFIG_IPW2100_MONITOR 8847 #endif 8848 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 8849 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 8850 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 8851 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 8852 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 8853 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 8854 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 8855 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 8856 #ifdef CONFIG_IPW2100_MONITOR 8857 #endif 8858 #ifdef CONFIG_IPW2100_MONITOR 8859 #endif 8860 #ifdef CONFIG_IPW2100_MONITOR 8861 #else 8862 #endif 8863 #ifdef CONFIG_IPW2100_MONITOR 8864 #else 8865 #endif 8866 #ifdef CONFIG_IPW2100_DEBUG 8867 #endif 8868 #define IPW2100_FW_MAJOR_VERSION 1 8869 #define IPW2100_FW_MINOR_VERSION 3 8870 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 8871 #define IPW2100_FW_MAJOR(x) (x & 0xff) 8872 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 8873 IPW2100_FW_MAJOR_VERSION) 8874 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 8875 "." __stringify(IPW2100_FW_MINOR_VERSION) 8876 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 8877 #ifdef CONFIG_IPW2100_MONITOR 8878 #endif 8879 #ifdef CONFIG_IPW2100_MONITOR 8880 #endif 8881 /* LDV_COMMENT_END_PREP */ 8882 /* content: static void ipw_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)*/ 8883 /* LDV_COMMENT_BEGIN_PREP */ 8884 #define IPW2100_VERSION "git-1.2.2" 8885 #define DRV_NAME "ipw2100" 8886 #define DRV_VERSION IPW2100_VERSION 8887 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 8888 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 8889 #ifdef CONFIG_IPW2100_DEBUG 8890 #define IPW2100_RX_DEBUG 8891 #endif 8892 #ifdef CONFIG_PM 8893 #endif 8894 #ifdef CONFIG_IPW2100_DEBUG 8895 #define IPW_DEBUG(level, message...) \ 8896 do { \ 8897 if (ipw2100_debug_level & (level)) { \ 8898 printk(KERN_DEBUG "ipw2100: %c %s ", \ 8899 in_interrupt() ? 'I' : 'U', __func__); \ 8900 printk(message); \ 8901 } \ 8902 } while (0) 8903 #else 8904 #define IPW_DEBUG(level, message...) do {} while (0) 8905 #endif 8906 #ifdef CONFIG_IPW2100_DEBUG 8907 #endif 8908 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 8909 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 8910 #define MAX_RESET_BACKOFF 10 8911 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 8912 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 8913 #ifndef CONFIG_PM 8914 #endif 8915 #ifdef CONFIG_PM 8916 #else 8917 #endif 8918 #ifndef CONFIG_PM 8919 #endif 8920 #define MAX_RF_KILL_CHECKS 5 8921 #define RF_KILL_CHECK_DELAY 40 8922 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 8923 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 8924 #define MAC_ASSOCIATION_READ_DELAY (HZ) 8925 #ifdef CONFIG_IPW2100_DEBUG 8926 #define IPW2100_HANDLER(v, f) { v, f, # v } 8927 #else 8928 #define IPW2100_HANDLER(v, f) { v, f } 8929 #endif 8930 #ifdef CONFIG_IPW2100_DEBUG 8931 #endif 8932 #ifdef CONFIG_IPW2100_DEBUG 8933 #endif 8934 #define SEARCH_ERROR 0xffffffff 8935 #define SEARCH_FAIL 0xfffffffe 8936 #define SEARCH_SUCCESS 0xfffffff0 8937 #define SEARCH_DISCARD 0 8938 #define SEARCH_SNAPSHOT 1 8939 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 8940 #ifdef IPW2100_DEBUG_C3 8941 #endif 8942 #ifdef IPW2100_RX_DEBUG 8943 #endif 8944 #ifdef IPW2100_DEBUG_C3 8945 #endif 8946 #ifdef IPW2100_DEBUG_C3 8947 #endif 8948 #ifdef IPW2100_RX_DEBUG 8949 #endif 8950 #ifdef IPW2100_RX_DEBUG 8951 #endif 8952 #ifdef CONFIG_IPW2100_MONITOR 8953 #endif 8954 #ifdef CONFIG_IPW2100_MONITOR 8955 #else 8956 #endif 8957 #ifdef CONFIG_IPW2100_MONITOR 8958 #endif 8959 #ifdef CONFIG_IPW2100_DEBUG 8960 #endif 8961 #ifdef CONFIG_IPW2100_DEBUG 8962 #endif 8963 #ifdef CONFIG_IPW2100_DEBUG 8964 #endif 8965 #define IPW2100_REG(x) { IPW_ ##x, #x } 8966 #define IPW2100_NIC(x, s) { x, #x, s } 8967 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 8968 #ifdef CONFIG_IPW2100_DEBUG 8969 #endif 8970 #ifdef CONFIG_IPW2100_MONITOR 8971 #endif 8972 #ifdef CONFIG_PM 8973 #endif 8974 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 8975 #ifdef CONFIG_IPW2100_DEBUG 8976 #endif 8977 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 8978 #endif 8979 #ifdef IPW2100_TX_POWER 8980 #endif 8981 #if 0 8982 #endif 8983 #ifdef CONFIG_IPW2100_DEBUG 8984 #endif 8985 #define IPW_PRIVACY_CAPABLE 0x0008 8986 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 8987 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 8988 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 8989 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 8990 #ifdef CONFIG_IPW2100_MONITOR 8991 #endif 8992 #ifdef CONFIG_IPW2100_MONITOR 8993 #endif 8994 /* LDV_COMMENT_END_PREP */ 8995 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw_ethtool_get_drvinfo" */ 8996 struct ethtool_drvinfo * var_group2; 8997 /* LDV_COMMENT_BEGIN_PREP */ 8998 #ifdef CONFIG_IPW2100_MONITOR 8999 #endif 9000 #ifdef CONFIG_IPW2100_MONITOR 9001 #endif 9002 #ifdef CONFIG_PM 9003 #endif 9004 #ifdef CONFIG_PM 9005 #endif 9006 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 9007 #ifdef CONFIG_PM 9008 #endif 9009 #ifdef CONFIG_IPW2100_DEBUG 9010 #endif 9011 #ifdef CONFIG_IPW2100_DEBUG 9012 #endif 9013 #ifdef CONFIG_IPW2100_MONITOR 9014 #endif 9015 #define POWER_MODES 5 9016 #ifdef CONFIG_IPW2100_MONITOR 9017 #endif 9018 #define MAX_POWER_STRING 80 9019 #ifdef CONFIG_IPW2100_MONITOR 9020 #endif 9021 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 9022 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 9023 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 9024 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 9025 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 9026 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 9027 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 9028 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 9029 #ifdef CONFIG_IPW2100_MONITOR 9030 #endif 9031 #ifdef CONFIG_IPW2100_MONITOR 9032 #endif 9033 #ifdef CONFIG_IPW2100_MONITOR 9034 #else 9035 #endif 9036 #ifdef CONFIG_IPW2100_MONITOR 9037 #else 9038 #endif 9039 #ifdef CONFIG_IPW2100_DEBUG 9040 #endif 9041 #define IPW2100_FW_MAJOR_VERSION 1 9042 #define IPW2100_FW_MINOR_VERSION 3 9043 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 9044 #define IPW2100_FW_MAJOR(x) (x & 0xff) 9045 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 9046 IPW2100_FW_MAJOR_VERSION) 9047 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 9048 "." __stringify(IPW2100_FW_MINOR_VERSION) 9049 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 9050 #ifdef CONFIG_IPW2100_MONITOR 9051 #endif 9052 #ifdef CONFIG_IPW2100_MONITOR 9053 #endif 9054 /* LDV_COMMENT_END_PREP */ 9055 9056 /** STRUCT: struct type: net_device_ops, struct name: ipw2100_netdev_ops **/ 9057 /* content: static int ipw2100_open(struct net_device *dev)*/ 9058 /* LDV_COMMENT_BEGIN_PREP */ 9059 #define IPW2100_VERSION "git-1.2.2" 9060 #define DRV_NAME "ipw2100" 9061 #define DRV_VERSION IPW2100_VERSION 9062 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 9063 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 9064 #ifdef CONFIG_IPW2100_DEBUG 9065 #define IPW2100_RX_DEBUG 9066 #endif 9067 #ifdef CONFIG_PM 9068 #endif 9069 #ifdef CONFIG_IPW2100_DEBUG 9070 #define IPW_DEBUG(level, message...) \ 9071 do { \ 9072 if (ipw2100_debug_level & (level)) { \ 9073 printk(KERN_DEBUG "ipw2100: %c %s ", \ 9074 in_interrupt() ? 'I' : 'U', __func__); \ 9075 printk(message); \ 9076 } \ 9077 } while (0) 9078 #else 9079 #define IPW_DEBUG(level, message...) do {} while (0) 9080 #endif 9081 #ifdef CONFIG_IPW2100_DEBUG 9082 #endif 9083 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 9084 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 9085 #define MAX_RESET_BACKOFF 10 9086 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 9087 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 9088 #ifndef CONFIG_PM 9089 #endif 9090 #ifdef CONFIG_PM 9091 #else 9092 #endif 9093 #ifndef CONFIG_PM 9094 #endif 9095 #define MAX_RF_KILL_CHECKS 5 9096 #define RF_KILL_CHECK_DELAY 40 9097 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 9098 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 9099 #define MAC_ASSOCIATION_READ_DELAY (HZ) 9100 #ifdef CONFIG_IPW2100_DEBUG 9101 #define IPW2100_HANDLER(v, f) { v, f, # v } 9102 #else 9103 #define IPW2100_HANDLER(v, f) { v, f } 9104 #endif 9105 #ifdef CONFIG_IPW2100_DEBUG 9106 #endif 9107 #ifdef CONFIG_IPW2100_DEBUG 9108 #endif 9109 #define SEARCH_ERROR 0xffffffff 9110 #define SEARCH_FAIL 0xfffffffe 9111 #define SEARCH_SUCCESS 0xfffffff0 9112 #define SEARCH_DISCARD 0 9113 #define SEARCH_SNAPSHOT 1 9114 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 9115 #ifdef IPW2100_DEBUG_C3 9116 #endif 9117 #ifdef IPW2100_RX_DEBUG 9118 #endif 9119 #ifdef IPW2100_DEBUG_C3 9120 #endif 9121 #ifdef IPW2100_DEBUG_C3 9122 #endif 9123 #ifdef IPW2100_RX_DEBUG 9124 #endif 9125 #ifdef IPW2100_RX_DEBUG 9126 #endif 9127 #ifdef CONFIG_IPW2100_MONITOR 9128 #endif 9129 #ifdef CONFIG_IPW2100_MONITOR 9130 #else 9131 #endif 9132 #ifdef CONFIG_IPW2100_MONITOR 9133 #endif 9134 #ifdef CONFIG_IPW2100_DEBUG 9135 #endif 9136 #ifdef CONFIG_IPW2100_DEBUG 9137 #endif 9138 #ifdef CONFIG_IPW2100_DEBUG 9139 #endif 9140 #define IPW2100_REG(x) { IPW_ ##x, #x } 9141 #define IPW2100_NIC(x, s) { x, #x, s } 9142 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 9143 #ifdef CONFIG_IPW2100_DEBUG 9144 #endif 9145 #ifdef CONFIG_IPW2100_MONITOR 9146 #endif 9147 #ifdef CONFIG_PM 9148 #endif 9149 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 9150 #ifdef CONFIG_IPW2100_DEBUG 9151 #endif 9152 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 9153 #endif 9154 #ifdef IPW2100_TX_POWER 9155 #endif 9156 #if 0 9157 #endif 9158 #ifdef CONFIG_IPW2100_DEBUG 9159 #endif 9160 #define IPW_PRIVACY_CAPABLE 0x0008 9161 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 9162 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 9163 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 9164 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 9165 #ifdef CONFIG_IPW2100_MONITOR 9166 #endif 9167 /* LDV_COMMENT_END_PREP */ 9168 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "ipw2100_open" */ 9169 static int res_ipw2100_open_136; 9170 /* LDV_COMMENT_BEGIN_PREP */ 9171 #ifdef CONFIG_IPW2100_MONITOR 9172 #endif 9173 #ifdef CONFIG_IPW2100_MONITOR 9174 #endif 9175 #ifdef CONFIG_IPW2100_MONITOR 9176 #endif 9177 #ifdef CONFIG_PM 9178 #endif 9179 #ifdef CONFIG_PM 9180 #endif 9181 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 9182 #ifdef CONFIG_PM 9183 #endif 9184 #ifdef CONFIG_IPW2100_DEBUG 9185 #endif 9186 #ifdef CONFIG_IPW2100_DEBUG 9187 #endif 9188 #ifdef CONFIG_IPW2100_MONITOR 9189 #endif 9190 #define POWER_MODES 5 9191 #ifdef CONFIG_IPW2100_MONITOR 9192 #endif 9193 #define MAX_POWER_STRING 80 9194 #ifdef CONFIG_IPW2100_MONITOR 9195 #endif 9196 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 9197 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 9198 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 9199 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 9200 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 9201 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 9202 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 9203 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 9204 #ifdef CONFIG_IPW2100_MONITOR 9205 #endif 9206 #ifdef CONFIG_IPW2100_MONITOR 9207 #endif 9208 #ifdef CONFIG_IPW2100_MONITOR 9209 #else 9210 #endif 9211 #ifdef CONFIG_IPW2100_MONITOR 9212 #else 9213 #endif 9214 #ifdef CONFIG_IPW2100_DEBUG 9215 #endif 9216 #define IPW2100_FW_MAJOR_VERSION 1 9217 #define IPW2100_FW_MINOR_VERSION 3 9218 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 9219 #define IPW2100_FW_MAJOR(x) (x & 0xff) 9220 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 9221 IPW2100_FW_MAJOR_VERSION) 9222 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 9223 "." __stringify(IPW2100_FW_MINOR_VERSION) 9224 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 9225 #ifdef CONFIG_IPW2100_MONITOR 9226 #endif 9227 #ifdef CONFIG_IPW2100_MONITOR 9228 #endif 9229 /* LDV_COMMENT_END_PREP */ 9230 /* content: static int ipw2100_close(struct net_device *dev)*/ 9231 /* LDV_COMMENT_BEGIN_PREP */ 9232 #define IPW2100_VERSION "git-1.2.2" 9233 #define DRV_NAME "ipw2100" 9234 #define DRV_VERSION IPW2100_VERSION 9235 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 9236 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 9237 #ifdef CONFIG_IPW2100_DEBUG 9238 #define IPW2100_RX_DEBUG 9239 #endif 9240 #ifdef CONFIG_PM 9241 #endif 9242 #ifdef CONFIG_IPW2100_DEBUG 9243 #define IPW_DEBUG(level, message...) \ 9244 do { \ 9245 if (ipw2100_debug_level & (level)) { \ 9246 printk(KERN_DEBUG "ipw2100: %c %s ", \ 9247 in_interrupt() ? 'I' : 'U', __func__); \ 9248 printk(message); \ 9249 } \ 9250 } while (0) 9251 #else 9252 #define IPW_DEBUG(level, message...) do {} while (0) 9253 #endif 9254 #ifdef CONFIG_IPW2100_DEBUG 9255 #endif 9256 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 9257 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 9258 #define MAX_RESET_BACKOFF 10 9259 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 9260 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 9261 #ifndef CONFIG_PM 9262 #endif 9263 #ifdef CONFIG_PM 9264 #else 9265 #endif 9266 #ifndef CONFIG_PM 9267 #endif 9268 #define MAX_RF_KILL_CHECKS 5 9269 #define RF_KILL_CHECK_DELAY 40 9270 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 9271 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 9272 #define MAC_ASSOCIATION_READ_DELAY (HZ) 9273 #ifdef CONFIG_IPW2100_DEBUG 9274 #define IPW2100_HANDLER(v, f) { v, f, # v } 9275 #else 9276 #define IPW2100_HANDLER(v, f) { v, f } 9277 #endif 9278 #ifdef CONFIG_IPW2100_DEBUG 9279 #endif 9280 #ifdef CONFIG_IPW2100_DEBUG 9281 #endif 9282 #define SEARCH_ERROR 0xffffffff 9283 #define SEARCH_FAIL 0xfffffffe 9284 #define SEARCH_SUCCESS 0xfffffff0 9285 #define SEARCH_DISCARD 0 9286 #define SEARCH_SNAPSHOT 1 9287 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 9288 #ifdef IPW2100_DEBUG_C3 9289 #endif 9290 #ifdef IPW2100_RX_DEBUG 9291 #endif 9292 #ifdef IPW2100_DEBUG_C3 9293 #endif 9294 #ifdef IPW2100_DEBUG_C3 9295 #endif 9296 #ifdef IPW2100_RX_DEBUG 9297 #endif 9298 #ifdef IPW2100_RX_DEBUG 9299 #endif 9300 #ifdef CONFIG_IPW2100_MONITOR 9301 #endif 9302 #ifdef CONFIG_IPW2100_MONITOR 9303 #else 9304 #endif 9305 #ifdef CONFIG_IPW2100_MONITOR 9306 #endif 9307 #ifdef CONFIG_IPW2100_DEBUG 9308 #endif 9309 #ifdef CONFIG_IPW2100_DEBUG 9310 #endif 9311 #ifdef CONFIG_IPW2100_DEBUG 9312 #endif 9313 #define IPW2100_REG(x) { IPW_ ##x, #x } 9314 #define IPW2100_NIC(x, s) { x, #x, s } 9315 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 9316 #ifdef CONFIG_IPW2100_DEBUG 9317 #endif 9318 #ifdef CONFIG_IPW2100_MONITOR 9319 #endif 9320 #ifdef CONFIG_PM 9321 #endif 9322 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 9323 #ifdef CONFIG_IPW2100_DEBUG 9324 #endif 9325 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 9326 #endif 9327 #ifdef IPW2100_TX_POWER 9328 #endif 9329 #if 0 9330 #endif 9331 #ifdef CONFIG_IPW2100_DEBUG 9332 #endif 9333 #define IPW_PRIVACY_CAPABLE 0x0008 9334 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 9335 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 9336 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 9337 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 9338 #ifdef CONFIG_IPW2100_MONITOR 9339 #endif 9340 /* LDV_COMMENT_END_PREP */ 9341 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "ipw2100_close" */ 9342 static int res_ipw2100_close_137; 9343 /* LDV_COMMENT_BEGIN_PREP */ 9344 #ifdef CONFIG_IPW2100_MONITOR 9345 #endif 9346 #ifdef CONFIG_IPW2100_MONITOR 9347 #endif 9348 #ifdef CONFIG_IPW2100_MONITOR 9349 #endif 9350 #ifdef CONFIG_PM 9351 #endif 9352 #ifdef CONFIG_PM 9353 #endif 9354 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 9355 #ifdef CONFIG_PM 9356 #endif 9357 #ifdef CONFIG_IPW2100_DEBUG 9358 #endif 9359 #ifdef CONFIG_IPW2100_DEBUG 9360 #endif 9361 #ifdef CONFIG_IPW2100_MONITOR 9362 #endif 9363 #define POWER_MODES 5 9364 #ifdef CONFIG_IPW2100_MONITOR 9365 #endif 9366 #define MAX_POWER_STRING 80 9367 #ifdef CONFIG_IPW2100_MONITOR 9368 #endif 9369 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 9370 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 9371 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 9372 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 9373 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 9374 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 9375 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 9376 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 9377 #ifdef CONFIG_IPW2100_MONITOR 9378 #endif 9379 #ifdef CONFIG_IPW2100_MONITOR 9380 #endif 9381 #ifdef CONFIG_IPW2100_MONITOR 9382 #else 9383 #endif 9384 #ifdef CONFIG_IPW2100_MONITOR 9385 #else 9386 #endif 9387 #ifdef CONFIG_IPW2100_DEBUG 9388 #endif 9389 #define IPW2100_FW_MAJOR_VERSION 1 9390 #define IPW2100_FW_MINOR_VERSION 3 9391 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 9392 #define IPW2100_FW_MAJOR(x) (x & 0xff) 9393 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 9394 IPW2100_FW_MAJOR_VERSION) 9395 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 9396 "." __stringify(IPW2100_FW_MINOR_VERSION) 9397 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 9398 #ifdef CONFIG_IPW2100_MONITOR 9399 #endif 9400 #ifdef CONFIG_IPW2100_MONITOR 9401 #endif 9402 /* LDV_COMMENT_END_PREP */ 9403 /* content: static void ipw2100_tx_timeout(struct net_device *dev)*/ 9404 /* LDV_COMMENT_BEGIN_PREP */ 9405 #define IPW2100_VERSION "git-1.2.2" 9406 #define DRV_NAME "ipw2100" 9407 #define DRV_VERSION IPW2100_VERSION 9408 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 9409 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 9410 #ifdef CONFIG_IPW2100_DEBUG 9411 #define IPW2100_RX_DEBUG 9412 #endif 9413 #ifdef CONFIG_PM 9414 #endif 9415 #ifdef CONFIG_IPW2100_DEBUG 9416 #define IPW_DEBUG(level, message...) \ 9417 do { \ 9418 if (ipw2100_debug_level & (level)) { \ 9419 printk(KERN_DEBUG "ipw2100: %c %s ", \ 9420 in_interrupt() ? 'I' : 'U', __func__); \ 9421 printk(message); \ 9422 } \ 9423 } while (0) 9424 #else 9425 #define IPW_DEBUG(level, message...) do {} while (0) 9426 #endif 9427 #ifdef CONFIG_IPW2100_DEBUG 9428 #endif 9429 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 9430 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 9431 #define MAX_RESET_BACKOFF 10 9432 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 9433 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 9434 #ifndef CONFIG_PM 9435 #endif 9436 #ifdef CONFIG_PM 9437 #else 9438 #endif 9439 #ifndef CONFIG_PM 9440 #endif 9441 #define MAX_RF_KILL_CHECKS 5 9442 #define RF_KILL_CHECK_DELAY 40 9443 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 9444 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 9445 #define MAC_ASSOCIATION_READ_DELAY (HZ) 9446 #ifdef CONFIG_IPW2100_DEBUG 9447 #define IPW2100_HANDLER(v, f) { v, f, # v } 9448 #else 9449 #define IPW2100_HANDLER(v, f) { v, f } 9450 #endif 9451 #ifdef CONFIG_IPW2100_DEBUG 9452 #endif 9453 #ifdef CONFIG_IPW2100_DEBUG 9454 #endif 9455 #define SEARCH_ERROR 0xffffffff 9456 #define SEARCH_FAIL 0xfffffffe 9457 #define SEARCH_SUCCESS 0xfffffff0 9458 #define SEARCH_DISCARD 0 9459 #define SEARCH_SNAPSHOT 1 9460 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 9461 #ifdef IPW2100_DEBUG_C3 9462 #endif 9463 #ifdef IPW2100_RX_DEBUG 9464 #endif 9465 #ifdef IPW2100_DEBUG_C3 9466 #endif 9467 #ifdef IPW2100_DEBUG_C3 9468 #endif 9469 #ifdef IPW2100_RX_DEBUG 9470 #endif 9471 #ifdef IPW2100_RX_DEBUG 9472 #endif 9473 #ifdef CONFIG_IPW2100_MONITOR 9474 #endif 9475 #ifdef CONFIG_IPW2100_MONITOR 9476 #else 9477 #endif 9478 #ifdef CONFIG_IPW2100_MONITOR 9479 #endif 9480 #ifdef CONFIG_IPW2100_DEBUG 9481 #endif 9482 #ifdef CONFIG_IPW2100_DEBUG 9483 #endif 9484 #ifdef CONFIG_IPW2100_DEBUG 9485 #endif 9486 #define IPW2100_REG(x) { IPW_ ##x, #x } 9487 #define IPW2100_NIC(x, s) { x, #x, s } 9488 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 9489 #ifdef CONFIG_IPW2100_DEBUG 9490 #endif 9491 #ifdef CONFIG_IPW2100_MONITOR 9492 #endif 9493 #ifdef CONFIG_PM 9494 #endif 9495 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 9496 #ifdef CONFIG_IPW2100_DEBUG 9497 #endif 9498 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 9499 #endif 9500 #ifdef IPW2100_TX_POWER 9501 #endif 9502 #if 0 9503 #endif 9504 #ifdef CONFIG_IPW2100_DEBUG 9505 #endif 9506 #define IPW_PRIVACY_CAPABLE 0x0008 9507 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 9508 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 9509 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 9510 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 9511 #ifdef CONFIG_IPW2100_MONITOR 9512 #endif 9513 /* LDV_COMMENT_END_PREP */ 9514 /* LDV_COMMENT_BEGIN_PREP */ 9515 #ifdef CONFIG_IPW2100_MONITOR 9516 #endif 9517 #ifdef CONFIG_IPW2100_MONITOR 9518 #endif 9519 #ifdef CONFIG_PM 9520 #endif 9521 #ifdef CONFIG_PM 9522 #endif 9523 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 9524 #ifdef CONFIG_PM 9525 #endif 9526 #ifdef CONFIG_IPW2100_DEBUG 9527 #endif 9528 #ifdef CONFIG_IPW2100_DEBUG 9529 #endif 9530 #ifdef CONFIG_IPW2100_MONITOR 9531 #endif 9532 #define POWER_MODES 5 9533 #ifdef CONFIG_IPW2100_MONITOR 9534 #endif 9535 #define MAX_POWER_STRING 80 9536 #ifdef CONFIG_IPW2100_MONITOR 9537 #endif 9538 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 9539 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 9540 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 9541 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 9542 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 9543 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 9544 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 9545 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 9546 #ifdef CONFIG_IPW2100_MONITOR 9547 #endif 9548 #ifdef CONFIG_IPW2100_MONITOR 9549 #endif 9550 #ifdef CONFIG_IPW2100_MONITOR 9551 #else 9552 #endif 9553 #ifdef CONFIG_IPW2100_MONITOR 9554 #else 9555 #endif 9556 #ifdef CONFIG_IPW2100_DEBUG 9557 #endif 9558 #define IPW2100_FW_MAJOR_VERSION 1 9559 #define IPW2100_FW_MINOR_VERSION 3 9560 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 9561 #define IPW2100_FW_MAJOR(x) (x & 0xff) 9562 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 9563 IPW2100_FW_MAJOR_VERSION) 9564 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 9565 "." __stringify(IPW2100_FW_MINOR_VERSION) 9566 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 9567 #ifdef CONFIG_IPW2100_MONITOR 9568 #endif 9569 #ifdef CONFIG_IPW2100_MONITOR 9570 #endif 9571 /* LDV_COMMENT_END_PREP */ 9572 /* content: static int ipw2100_set_address(struct net_device *dev, void *p)*/ 9573 /* LDV_COMMENT_BEGIN_PREP */ 9574 #define IPW2100_VERSION "git-1.2.2" 9575 #define DRV_NAME "ipw2100" 9576 #define DRV_VERSION IPW2100_VERSION 9577 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 9578 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 9579 #ifdef CONFIG_IPW2100_DEBUG 9580 #define IPW2100_RX_DEBUG 9581 #endif 9582 #ifdef CONFIG_PM 9583 #endif 9584 #ifdef CONFIG_IPW2100_DEBUG 9585 #define IPW_DEBUG(level, message...) \ 9586 do { \ 9587 if (ipw2100_debug_level & (level)) { \ 9588 printk(KERN_DEBUG "ipw2100: %c %s ", \ 9589 in_interrupt() ? 'I' : 'U', __func__); \ 9590 printk(message); \ 9591 } \ 9592 } while (0) 9593 #else 9594 #define IPW_DEBUG(level, message...) do {} while (0) 9595 #endif 9596 #ifdef CONFIG_IPW2100_DEBUG 9597 #endif 9598 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 9599 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 9600 #define MAX_RESET_BACKOFF 10 9601 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 9602 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 9603 #ifndef CONFIG_PM 9604 #endif 9605 #ifdef CONFIG_PM 9606 #else 9607 #endif 9608 #ifndef CONFIG_PM 9609 #endif 9610 #define MAX_RF_KILL_CHECKS 5 9611 #define RF_KILL_CHECK_DELAY 40 9612 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 9613 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 9614 #define MAC_ASSOCIATION_READ_DELAY (HZ) 9615 #ifdef CONFIG_IPW2100_DEBUG 9616 #define IPW2100_HANDLER(v, f) { v, f, # v } 9617 #else 9618 #define IPW2100_HANDLER(v, f) { v, f } 9619 #endif 9620 #ifdef CONFIG_IPW2100_DEBUG 9621 #endif 9622 #ifdef CONFIG_IPW2100_DEBUG 9623 #endif 9624 #define SEARCH_ERROR 0xffffffff 9625 #define SEARCH_FAIL 0xfffffffe 9626 #define SEARCH_SUCCESS 0xfffffff0 9627 #define SEARCH_DISCARD 0 9628 #define SEARCH_SNAPSHOT 1 9629 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 9630 #ifdef IPW2100_DEBUG_C3 9631 #endif 9632 #ifdef IPW2100_RX_DEBUG 9633 #endif 9634 #ifdef IPW2100_DEBUG_C3 9635 #endif 9636 #ifdef IPW2100_DEBUG_C3 9637 #endif 9638 #ifdef IPW2100_RX_DEBUG 9639 #endif 9640 #ifdef IPW2100_RX_DEBUG 9641 #endif 9642 #ifdef CONFIG_IPW2100_MONITOR 9643 #endif 9644 #ifdef CONFIG_IPW2100_MONITOR 9645 #else 9646 #endif 9647 #ifdef CONFIG_IPW2100_MONITOR 9648 #endif 9649 #ifdef CONFIG_IPW2100_DEBUG 9650 #endif 9651 #ifdef CONFIG_IPW2100_DEBUG 9652 #endif 9653 #ifdef CONFIG_IPW2100_DEBUG 9654 #endif 9655 #define IPW2100_REG(x) { IPW_ ##x, #x } 9656 #define IPW2100_NIC(x, s) { x, #x, s } 9657 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 9658 #ifdef CONFIG_IPW2100_DEBUG 9659 #endif 9660 #ifdef CONFIG_IPW2100_MONITOR 9661 #endif 9662 #ifdef CONFIG_PM 9663 #endif 9664 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 9665 #ifdef CONFIG_IPW2100_DEBUG 9666 #endif 9667 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 9668 #endif 9669 #ifdef IPW2100_TX_POWER 9670 #endif 9671 #if 0 9672 #endif 9673 #ifdef CONFIG_IPW2100_DEBUG 9674 #endif 9675 #define IPW_PRIVACY_CAPABLE 0x0008 9676 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 9677 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 9678 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 9679 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 9680 #ifdef CONFIG_IPW2100_MONITOR 9681 #endif 9682 /* LDV_COMMENT_END_PREP */ 9683 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_set_address" */ 9684 void * var_ipw2100_set_address_135_p1; 9685 /* LDV_COMMENT_BEGIN_PREP */ 9686 #ifdef CONFIG_IPW2100_MONITOR 9687 #endif 9688 #ifdef CONFIG_IPW2100_MONITOR 9689 #endif 9690 #ifdef CONFIG_IPW2100_MONITOR 9691 #endif 9692 #ifdef CONFIG_PM 9693 #endif 9694 #ifdef CONFIG_PM 9695 #endif 9696 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 9697 #ifdef CONFIG_PM 9698 #endif 9699 #ifdef CONFIG_IPW2100_DEBUG 9700 #endif 9701 #ifdef CONFIG_IPW2100_DEBUG 9702 #endif 9703 #ifdef CONFIG_IPW2100_MONITOR 9704 #endif 9705 #define POWER_MODES 5 9706 #ifdef CONFIG_IPW2100_MONITOR 9707 #endif 9708 #define MAX_POWER_STRING 80 9709 #ifdef CONFIG_IPW2100_MONITOR 9710 #endif 9711 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 9712 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 9713 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 9714 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 9715 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 9716 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 9717 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 9718 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 9719 #ifdef CONFIG_IPW2100_MONITOR 9720 #endif 9721 #ifdef CONFIG_IPW2100_MONITOR 9722 #endif 9723 #ifdef CONFIG_IPW2100_MONITOR 9724 #else 9725 #endif 9726 #ifdef CONFIG_IPW2100_MONITOR 9727 #else 9728 #endif 9729 #ifdef CONFIG_IPW2100_DEBUG 9730 #endif 9731 #define IPW2100_FW_MAJOR_VERSION 1 9732 #define IPW2100_FW_MINOR_VERSION 3 9733 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 9734 #define IPW2100_FW_MAJOR(x) (x & 0xff) 9735 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 9736 IPW2100_FW_MAJOR_VERSION) 9737 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 9738 "." __stringify(IPW2100_FW_MINOR_VERSION) 9739 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 9740 #ifdef CONFIG_IPW2100_MONITOR 9741 #endif 9742 #ifdef CONFIG_IPW2100_MONITOR 9743 #endif 9744 /* LDV_COMMENT_END_PREP */ 9745 9746 /** STRUCT: struct type: pci_driver, struct name: ipw2100_pci_driver **/ 9747 /* content: static int ipw2100_pci_init_one(struct pci_dev *pci_dev, const struct pci_device_id *ent)*/ 9748 /* LDV_COMMENT_BEGIN_PREP */ 9749 #define IPW2100_VERSION "git-1.2.2" 9750 #define DRV_NAME "ipw2100" 9751 #define DRV_VERSION IPW2100_VERSION 9752 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 9753 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 9754 #ifdef CONFIG_IPW2100_DEBUG 9755 #define IPW2100_RX_DEBUG 9756 #endif 9757 #ifdef CONFIG_PM 9758 #endif 9759 #ifdef CONFIG_IPW2100_DEBUG 9760 #define IPW_DEBUG(level, message...) \ 9761 do { \ 9762 if (ipw2100_debug_level & (level)) { \ 9763 printk(KERN_DEBUG "ipw2100: %c %s ", \ 9764 in_interrupt() ? 'I' : 'U', __func__); \ 9765 printk(message); \ 9766 } \ 9767 } while (0) 9768 #else 9769 #define IPW_DEBUG(level, message...) do {} while (0) 9770 #endif 9771 #ifdef CONFIG_IPW2100_DEBUG 9772 #endif 9773 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 9774 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 9775 #define MAX_RESET_BACKOFF 10 9776 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 9777 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 9778 #ifndef CONFIG_PM 9779 #endif 9780 #ifdef CONFIG_PM 9781 #else 9782 #endif 9783 #ifndef CONFIG_PM 9784 #endif 9785 #define MAX_RF_KILL_CHECKS 5 9786 #define RF_KILL_CHECK_DELAY 40 9787 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 9788 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 9789 #define MAC_ASSOCIATION_READ_DELAY (HZ) 9790 #ifdef CONFIG_IPW2100_DEBUG 9791 #define IPW2100_HANDLER(v, f) { v, f, # v } 9792 #else 9793 #define IPW2100_HANDLER(v, f) { v, f } 9794 #endif 9795 #ifdef CONFIG_IPW2100_DEBUG 9796 #endif 9797 #ifdef CONFIG_IPW2100_DEBUG 9798 #endif 9799 #define SEARCH_ERROR 0xffffffff 9800 #define SEARCH_FAIL 0xfffffffe 9801 #define SEARCH_SUCCESS 0xfffffff0 9802 #define SEARCH_DISCARD 0 9803 #define SEARCH_SNAPSHOT 1 9804 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 9805 #ifdef IPW2100_DEBUG_C3 9806 #endif 9807 #ifdef IPW2100_RX_DEBUG 9808 #endif 9809 #ifdef IPW2100_DEBUG_C3 9810 #endif 9811 #ifdef IPW2100_DEBUG_C3 9812 #endif 9813 #ifdef IPW2100_RX_DEBUG 9814 #endif 9815 #ifdef IPW2100_RX_DEBUG 9816 #endif 9817 #ifdef CONFIG_IPW2100_MONITOR 9818 #endif 9819 #ifdef CONFIG_IPW2100_MONITOR 9820 #else 9821 #endif 9822 #ifdef CONFIG_IPW2100_MONITOR 9823 #endif 9824 #ifdef CONFIG_IPW2100_DEBUG 9825 #endif 9826 #ifdef CONFIG_IPW2100_DEBUG 9827 #endif 9828 #ifdef CONFIG_IPW2100_DEBUG 9829 #endif 9830 #define IPW2100_REG(x) { IPW_ ##x, #x } 9831 #define IPW2100_NIC(x, s) { x, #x, s } 9832 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 9833 #ifdef CONFIG_IPW2100_DEBUG 9834 #endif 9835 #ifdef CONFIG_IPW2100_MONITOR 9836 #endif 9837 #ifdef CONFIG_PM 9838 #endif 9839 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 9840 #ifdef CONFIG_IPW2100_DEBUG 9841 #endif 9842 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 9843 #endif 9844 #ifdef IPW2100_TX_POWER 9845 #endif 9846 #if 0 9847 #endif 9848 #ifdef CONFIG_IPW2100_DEBUG 9849 #endif 9850 #define IPW_PRIVACY_CAPABLE 0x0008 9851 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 9852 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 9853 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 9854 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 9855 #ifdef CONFIG_IPW2100_MONITOR 9856 #endif 9857 #ifdef CONFIG_IPW2100_MONITOR 9858 #endif 9859 #ifdef CONFIG_IPW2100_MONITOR 9860 #endif 9861 #ifdef CONFIG_IPW2100_MONITOR 9862 #endif 9863 /* LDV_COMMENT_END_PREP */ 9864 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_pci_init_one" */ 9865 struct pci_dev * var_group3; 9866 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_pci_init_one" */ 9867 const struct pci_device_id * var_ipw2100_pci_init_one_147_p1; 9868 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "ipw2100_pci_init_one" */ 9869 static int res_ipw2100_pci_init_one_147; 9870 /* LDV_COMMENT_BEGIN_PREP */ 9871 #ifdef CONFIG_PM 9872 #endif 9873 #ifdef CONFIG_PM 9874 #endif 9875 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 9876 #ifdef CONFIG_PM 9877 #endif 9878 #ifdef CONFIG_IPW2100_DEBUG 9879 #endif 9880 #ifdef CONFIG_IPW2100_DEBUG 9881 #endif 9882 #ifdef CONFIG_IPW2100_MONITOR 9883 #endif 9884 #define POWER_MODES 5 9885 #ifdef CONFIG_IPW2100_MONITOR 9886 #endif 9887 #define MAX_POWER_STRING 80 9888 #ifdef CONFIG_IPW2100_MONITOR 9889 #endif 9890 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 9891 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 9892 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 9893 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 9894 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 9895 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 9896 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 9897 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 9898 #ifdef CONFIG_IPW2100_MONITOR 9899 #endif 9900 #ifdef CONFIG_IPW2100_MONITOR 9901 #endif 9902 #ifdef CONFIG_IPW2100_MONITOR 9903 #else 9904 #endif 9905 #ifdef CONFIG_IPW2100_MONITOR 9906 #else 9907 #endif 9908 #ifdef CONFIG_IPW2100_DEBUG 9909 #endif 9910 #define IPW2100_FW_MAJOR_VERSION 1 9911 #define IPW2100_FW_MINOR_VERSION 3 9912 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 9913 #define IPW2100_FW_MAJOR(x) (x & 0xff) 9914 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 9915 IPW2100_FW_MAJOR_VERSION) 9916 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 9917 "." __stringify(IPW2100_FW_MINOR_VERSION) 9918 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 9919 #ifdef CONFIG_IPW2100_MONITOR 9920 #endif 9921 #ifdef CONFIG_IPW2100_MONITOR 9922 #endif 9923 /* LDV_COMMENT_END_PREP */ 9924 /* content: static void ipw2100_pci_remove_one(struct pci_dev *pci_dev)*/ 9925 /* LDV_COMMENT_BEGIN_PREP */ 9926 #define IPW2100_VERSION "git-1.2.2" 9927 #define DRV_NAME "ipw2100" 9928 #define DRV_VERSION IPW2100_VERSION 9929 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 9930 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 9931 #ifdef CONFIG_IPW2100_DEBUG 9932 #define IPW2100_RX_DEBUG 9933 #endif 9934 #ifdef CONFIG_PM 9935 #endif 9936 #ifdef CONFIG_IPW2100_DEBUG 9937 #define IPW_DEBUG(level, message...) \ 9938 do { \ 9939 if (ipw2100_debug_level & (level)) { \ 9940 printk(KERN_DEBUG "ipw2100: %c %s ", \ 9941 in_interrupt() ? 'I' : 'U', __func__); \ 9942 printk(message); \ 9943 } \ 9944 } while (0) 9945 #else 9946 #define IPW_DEBUG(level, message...) do {} while (0) 9947 #endif 9948 #ifdef CONFIG_IPW2100_DEBUG 9949 #endif 9950 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 9951 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 9952 #define MAX_RESET_BACKOFF 10 9953 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 9954 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 9955 #ifndef CONFIG_PM 9956 #endif 9957 #ifdef CONFIG_PM 9958 #else 9959 #endif 9960 #ifndef CONFIG_PM 9961 #endif 9962 #define MAX_RF_KILL_CHECKS 5 9963 #define RF_KILL_CHECK_DELAY 40 9964 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 9965 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 9966 #define MAC_ASSOCIATION_READ_DELAY (HZ) 9967 #ifdef CONFIG_IPW2100_DEBUG 9968 #define IPW2100_HANDLER(v, f) { v, f, # v } 9969 #else 9970 #define IPW2100_HANDLER(v, f) { v, f } 9971 #endif 9972 #ifdef CONFIG_IPW2100_DEBUG 9973 #endif 9974 #ifdef CONFIG_IPW2100_DEBUG 9975 #endif 9976 #define SEARCH_ERROR 0xffffffff 9977 #define SEARCH_FAIL 0xfffffffe 9978 #define SEARCH_SUCCESS 0xfffffff0 9979 #define SEARCH_DISCARD 0 9980 #define SEARCH_SNAPSHOT 1 9981 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 9982 #ifdef IPW2100_DEBUG_C3 9983 #endif 9984 #ifdef IPW2100_RX_DEBUG 9985 #endif 9986 #ifdef IPW2100_DEBUG_C3 9987 #endif 9988 #ifdef IPW2100_DEBUG_C3 9989 #endif 9990 #ifdef IPW2100_RX_DEBUG 9991 #endif 9992 #ifdef IPW2100_RX_DEBUG 9993 #endif 9994 #ifdef CONFIG_IPW2100_MONITOR 9995 #endif 9996 #ifdef CONFIG_IPW2100_MONITOR 9997 #else 9998 #endif 9999 #ifdef CONFIG_IPW2100_MONITOR 10000 #endif 10001 #ifdef CONFIG_IPW2100_DEBUG 10002 #endif 10003 #ifdef CONFIG_IPW2100_DEBUG 10004 #endif 10005 #ifdef CONFIG_IPW2100_DEBUG 10006 #endif 10007 #define IPW2100_REG(x) { IPW_ ##x, #x } 10008 #define IPW2100_NIC(x, s) { x, #x, s } 10009 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 10010 #ifdef CONFIG_IPW2100_DEBUG 10011 #endif 10012 #ifdef CONFIG_IPW2100_MONITOR 10013 #endif 10014 #ifdef CONFIG_PM 10015 #endif 10016 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 10017 #ifdef CONFIG_IPW2100_DEBUG 10018 #endif 10019 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 10020 #endif 10021 #ifdef IPW2100_TX_POWER 10022 #endif 10023 #if 0 10024 #endif 10025 #ifdef CONFIG_IPW2100_DEBUG 10026 #endif 10027 #define IPW_PRIVACY_CAPABLE 0x0008 10028 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 10029 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 10030 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 10031 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 10032 #ifdef CONFIG_IPW2100_MONITOR 10033 #endif 10034 #ifdef CONFIG_IPW2100_MONITOR 10035 #endif 10036 #ifdef CONFIG_IPW2100_MONITOR 10037 #endif 10038 #ifdef CONFIG_IPW2100_MONITOR 10039 #endif 10040 /* LDV_COMMENT_END_PREP */ 10041 /* LDV_COMMENT_BEGIN_PREP */ 10042 #ifdef CONFIG_PM 10043 #endif 10044 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 10045 #ifdef CONFIG_PM 10046 #endif 10047 #ifdef CONFIG_IPW2100_DEBUG 10048 #endif 10049 #ifdef CONFIG_IPW2100_DEBUG 10050 #endif 10051 #ifdef CONFIG_IPW2100_MONITOR 10052 #endif 10053 #define POWER_MODES 5 10054 #ifdef CONFIG_IPW2100_MONITOR 10055 #endif 10056 #define MAX_POWER_STRING 80 10057 #ifdef CONFIG_IPW2100_MONITOR 10058 #endif 10059 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 10060 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 10061 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 10062 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 10063 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 10064 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 10065 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 10066 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 10067 #ifdef CONFIG_IPW2100_MONITOR 10068 #endif 10069 #ifdef CONFIG_IPW2100_MONITOR 10070 #endif 10071 #ifdef CONFIG_IPW2100_MONITOR 10072 #else 10073 #endif 10074 #ifdef CONFIG_IPW2100_MONITOR 10075 #else 10076 #endif 10077 #ifdef CONFIG_IPW2100_DEBUG 10078 #endif 10079 #define IPW2100_FW_MAJOR_VERSION 1 10080 #define IPW2100_FW_MINOR_VERSION 3 10081 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 10082 #define IPW2100_FW_MAJOR(x) (x & 0xff) 10083 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 10084 IPW2100_FW_MAJOR_VERSION) 10085 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 10086 "." __stringify(IPW2100_FW_MINOR_VERSION) 10087 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 10088 #ifdef CONFIG_IPW2100_MONITOR 10089 #endif 10090 #ifdef CONFIG_IPW2100_MONITOR 10091 #endif 10092 /* LDV_COMMENT_END_PREP */ 10093 /* content: static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state)*/ 10094 /* LDV_COMMENT_BEGIN_PREP */ 10095 #define IPW2100_VERSION "git-1.2.2" 10096 #define DRV_NAME "ipw2100" 10097 #define DRV_VERSION IPW2100_VERSION 10098 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 10099 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 10100 #ifdef CONFIG_IPW2100_DEBUG 10101 #define IPW2100_RX_DEBUG 10102 #endif 10103 #ifdef CONFIG_PM 10104 #endif 10105 #ifdef CONFIG_IPW2100_DEBUG 10106 #define IPW_DEBUG(level, message...) \ 10107 do { \ 10108 if (ipw2100_debug_level & (level)) { \ 10109 printk(KERN_DEBUG "ipw2100: %c %s ", \ 10110 in_interrupt() ? 'I' : 'U', __func__); \ 10111 printk(message); \ 10112 } \ 10113 } while (0) 10114 #else 10115 #define IPW_DEBUG(level, message...) do {} while (0) 10116 #endif 10117 #ifdef CONFIG_IPW2100_DEBUG 10118 #endif 10119 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 10120 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 10121 #define MAX_RESET_BACKOFF 10 10122 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 10123 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 10124 #ifndef CONFIG_PM 10125 #endif 10126 #ifdef CONFIG_PM 10127 #else 10128 #endif 10129 #ifndef CONFIG_PM 10130 #endif 10131 #define MAX_RF_KILL_CHECKS 5 10132 #define RF_KILL_CHECK_DELAY 40 10133 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 10134 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 10135 #define MAC_ASSOCIATION_READ_DELAY (HZ) 10136 #ifdef CONFIG_IPW2100_DEBUG 10137 #define IPW2100_HANDLER(v, f) { v, f, # v } 10138 #else 10139 #define IPW2100_HANDLER(v, f) { v, f } 10140 #endif 10141 #ifdef CONFIG_IPW2100_DEBUG 10142 #endif 10143 #ifdef CONFIG_IPW2100_DEBUG 10144 #endif 10145 #define SEARCH_ERROR 0xffffffff 10146 #define SEARCH_FAIL 0xfffffffe 10147 #define SEARCH_SUCCESS 0xfffffff0 10148 #define SEARCH_DISCARD 0 10149 #define SEARCH_SNAPSHOT 1 10150 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 10151 #ifdef IPW2100_DEBUG_C3 10152 #endif 10153 #ifdef IPW2100_RX_DEBUG 10154 #endif 10155 #ifdef IPW2100_DEBUG_C3 10156 #endif 10157 #ifdef IPW2100_DEBUG_C3 10158 #endif 10159 #ifdef IPW2100_RX_DEBUG 10160 #endif 10161 #ifdef IPW2100_RX_DEBUG 10162 #endif 10163 #ifdef CONFIG_IPW2100_MONITOR 10164 #endif 10165 #ifdef CONFIG_IPW2100_MONITOR 10166 #else 10167 #endif 10168 #ifdef CONFIG_IPW2100_MONITOR 10169 #endif 10170 #ifdef CONFIG_IPW2100_DEBUG 10171 #endif 10172 #ifdef CONFIG_IPW2100_DEBUG 10173 #endif 10174 #ifdef CONFIG_IPW2100_DEBUG 10175 #endif 10176 #define IPW2100_REG(x) { IPW_ ##x, #x } 10177 #define IPW2100_NIC(x, s) { x, #x, s } 10178 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 10179 #ifdef CONFIG_IPW2100_DEBUG 10180 #endif 10181 #ifdef CONFIG_IPW2100_MONITOR 10182 #endif 10183 #ifdef CONFIG_PM 10184 #endif 10185 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 10186 #ifdef CONFIG_IPW2100_DEBUG 10187 #endif 10188 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 10189 #endif 10190 #ifdef IPW2100_TX_POWER 10191 #endif 10192 #if 0 10193 #endif 10194 #ifdef CONFIG_IPW2100_DEBUG 10195 #endif 10196 #define IPW_PRIVACY_CAPABLE 0x0008 10197 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 10198 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 10199 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 10200 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 10201 #ifdef CONFIG_IPW2100_MONITOR 10202 #endif 10203 #ifdef CONFIG_IPW2100_MONITOR 10204 #endif 10205 #ifdef CONFIG_IPW2100_MONITOR 10206 #endif 10207 #ifdef CONFIG_IPW2100_MONITOR 10208 #endif 10209 #ifdef CONFIG_PM 10210 #endif 10211 #ifdef CONFIG_PM 10212 /* LDV_COMMENT_END_PREP */ 10213 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_suspend" */ 10214 pm_message_t var_ipw2100_suspend_149_p1; 10215 /* LDV_COMMENT_BEGIN_PREP */ 10216 #endif 10217 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 10218 #ifdef CONFIG_PM 10219 #endif 10220 #ifdef CONFIG_IPW2100_DEBUG 10221 #endif 10222 #ifdef CONFIG_IPW2100_DEBUG 10223 #endif 10224 #ifdef CONFIG_IPW2100_MONITOR 10225 #endif 10226 #define POWER_MODES 5 10227 #ifdef CONFIG_IPW2100_MONITOR 10228 #endif 10229 #define MAX_POWER_STRING 80 10230 #ifdef CONFIG_IPW2100_MONITOR 10231 #endif 10232 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 10233 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 10234 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 10235 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 10236 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 10237 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 10238 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 10239 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 10240 #ifdef CONFIG_IPW2100_MONITOR 10241 #endif 10242 #ifdef CONFIG_IPW2100_MONITOR 10243 #endif 10244 #ifdef CONFIG_IPW2100_MONITOR 10245 #else 10246 #endif 10247 #ifdef CONFIG_IPW2100_MONITOR 10248 #else 10249 #endif 10250 #ifdef CONFIG_IPW2100_DEBUG 10251 #endif 10252 #define IPW2100_FW_MAJOR_VERSION 1 10253 #define IPW2100_FW_MINOR_VERSION 3 10254 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 10255 #define IPW2100_FW_MAJOR(x) (x & 0xff) 10256 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 10257 IPW2100_FW_MAJOR_VERSION) 10258 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 10259 "." __stringify(IPW2100_FW_MINOR_VERSION) 10260 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 10261 #ifdef CONFIG_IPW2100_MONITOR 10262 #endif 10263 #ifdef CONFIG_IPW2100_MONITOR 10264 #endif 10265 /* LDV_COMMENT_END_PREP */ 10266 /* content: static int ipw2100_resume(struct pci_dev *pci_dev)*/ 10267 /* LDV_COMMENT_BEGIN_PREP */ 10268 #define IPW2100_VERSION "git-1.2.2" 10269 #define DRV_NAME "ipw2100" 10270 #define DRV_VERSION IPW2100_VERSION 10271 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 10272 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 10273 #ifdef CONFIG_IPW2100_DEBUG 10274 #define IPW2100_RX_DEBUG 10275 #endif 10276 #ifdef CONFIG_PM 10277 #endif 10278 #ifdef CONFIG_IPW2100_DEBUG 10279 #define IPW_DEBUG(level, message...) \ 10280 do { \ 10281 if (ipw2100_debug_level & (level)) { \ 10282 printk(KERN_DEBUG "ipw2100: %c %s ", \ 10283 in_interrupt() ? 'I' : 'U', __func__); \ 10284 printk(message); \ 10285 } \ 10286 } while (0) 10287 #else 10288 #define IPW_DEBUG(level, message...) do {} while (0) 10289 #endif 10290 #ifdef CONFIG_IPW2100_DEBUG 10291 #endif 10292 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 10293 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 10294 #define MAX_RESET_BACKOFF 10 10295 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 10296 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 10297 #ifndef CONFIG_PM 10298 #endif 10299 #ifdef CONFIG_PM 10300 #else 10301 #endif 10302 #ifndef CONFIG_PM 10303 #endif 10304 #define MAX_RF_KILL_CHECKS 5 10305 #define RF_KILL_CHECK_DELAY 40 10306 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 10307 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 10308 #define MAC_ASSOCIATION_READ_DELAY (HZ) 10309 #ifdef CONFIG_IPW2100_DEBUG 10310 #define IPW2100_HANDLER(v, f) { v, f, # v } 10311 #else 10312 #define IPW2100_HANDLER(v, f) { v, f } 10313 #endif 10314 #ifdef CONFIG_IPW2100_DEBUG 10315 #endif 10316 #ifdef CONFIG_IPW2100_DEBUG 10317 #endif 10318 #define SEARCH_ERROR 0xffffffff 10319 #define SEARCH_FAIL 0xfffffffe 10320 #define SEARCH_SUCCESS 0xfffffff0 10321 #define SEARCH_DISCARD 0 10322 #define SEARCH_SNAPSHOT 1 10323 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 10324 #ifdef IPW2100_DEBUG_C3 10325 #endif 10326 #ifdef IPW2100_RX_DEBUG 10327 #endif 10328 #ifdef IPW2100_DEBUG_C3 10329 #endif 10330 #ifdef IPW2100_DEBUG_C3 10331 #endif 10332 #ifdef IPW2100_RX_DEBUG 10333 #endif 10334 #ifdef IPW2100_RX_DEBUG 10335 #endif 10336 #ifdef CONFIG_IPW2100_MONITOR 10337 #endif 10338 #ifdef CONFIG_IPW2100_MONITOR 10339 #else 10340 #endif 10341 #ifdef CONFIG_IPW2100_MONITOR 10342 #endif 10343 #ifdef CONFIG_IPW2100_DEBUG 10344 #endif 10345 #ifdef CONFIG_IPW2100_DEBUG 10346 #endif 10347 #ifdef CONFIG_IPW2100_DEBUG 10348 #endif 10349 #define IPW2100_REG(x) { IPW_ ##x, #x } 10350 #define IPW2100_NIC(x, s) { x, #x, s } 10351 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 10352 #ifdef CONFIG_IPW2100_DEBUG 10353 #endif 10354 #ifdef CONFIG_IPW2100_MONITOR 10355 #endif 10356 #ifdef CONFIG_PM 10357 #endif 10358 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 10359 #ifdef CONFIG_IPW2100_DEBUG 10360 #endif 10361 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 10362 #endif 10363 #ifdef IPW2100_TX_POWER 10364 #endif 10365 #if 0 10366 #endif 10367 #ifdef CONFIG_IPW2100_DEBUG 10368 #endif 10369 #define IPW_PRIVACY_CAPABLE 0x0008 10370 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 10371 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 10372 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 10373 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 10374 #ifdef CONFIG_IPW2100_MONITOR 10375 #endif 10376 #ifdef CONFIG_IPW2100_MONITOR 10377 #endif 10378 #ifdef CONFIG_IPW2100_MONITOR 10379 #endif 10380 #ifdef CONFIG_IPW2100_MONITOR 10381 #endif 10382 #ifdef CONFIG_PM 10383 #endif 10384 #ifdef CONFIG_PM 10385 /* LDV_COMMENT_END_PREP */ 10386 /* LDV_COMMENT_BEGIN_PREP */ 10387 #endif 10388 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 10389 #ifdef CONFIG_PM 10390 #endif 10391 #ifdef CONFIG_IPW2100_DEBUG 10392 #endif 10393 #ifdef CONFIG_IPW2100_DEBUG 10394 #endif 10395 #ifdef CONFIG_IPW2100_MONITOR 10396 #endif 10397 #define POWER_MODES 5 10398 #ifdef CONFIG_IPW2100_MONITOR 10399 #endif 10400 #define MAX_POWER_STRING 80 10401 #ifdef CONFIG_IPW2100_MONITOR 10402 #endif 10403 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 10404 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 10405 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 10406 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 10407 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 10408 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 10409 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 10410 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 10411 #ifdef CONFIG_IPW2100_MONITOR 10412 #endif 10413 #ifdef CONFIG_IPW2100_MONITOR 10414 #endif 10415 #ifdef CONFIG_IPW2100_MONITOR 10416 #else 10417 #endif 10418 #ifdef CONFIG_IPW2100_MONITOR 10419 #else 10420 #endif 10421 #ifdef CONFIG_IPW2100_DEBUG 10422 #endif 10423 #define IPW2100_FW_MAJOR_VERSION 1 10424 #define IPW2100_FW_MINOR_VERSION 3 10425 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 10426 #define IPW2100_FW_MAJOR(x) (x & 0xff) 10427 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 10428 IPW2100_FW_MAJOR_VERSION) 10429 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 10430 "." __stringify(IPW2100_FW_MINOR_VERSION) 10431 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 10432 #ifdef CONFIG_IPW2100_MONITOR 10433 #endif 10434 #ifdef CONFIG_IPW2100_MONITOR 10435 #endif 10436 /* LDV_COMMENT_END_PREP */ 10437 /* content: static void ipw2100_shutdown(struct pci_dev *pci_dev)*/ 10438 /* LDV_COMMENT_BEGIN_PREP */ 10439 #define IPW2100_VERSION "git-1.2.2" 10440 #define DRV_NAME "ipw2100" 10441 #define DRV_VERSION IPW2100_VERSION 10442 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 10443 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 10444 #ifdef CONFIG_IPW2100_DEBUG 10445 #define IPW2100_RX_DEBUG 10446 #endif 10447 #ifdef CONFIG_PM 10448 #endif 10449 #ifdef CONFIG_IPW2100_DEBUG 10450 #define IPW_DEBUG(level, message...) \ 10451 do { \ 10452 if (ipw2100_debug_level & (level)) { \ 10453 printk(KERN_DEBUG "ipw2100: %c %s ", \ 10454 in_interrupt() ? 'I' : 'U', __func__); \ 10455 printk(message); \ 10456 } \ 10457 } while (0) 10458 #else 10459 #define IPW_DEBUG(level, message...) do {} while (0) 10460 #endif 10461 #ifdef CONFIG_IPW2100_DEBUG 10462 #endif 10463 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 10464 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 10465 #define MAX_RESET_BACKOFF 10 10466 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 10467 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 10468 #ifndef CONFIG_PM 10469 #endif 10470 #ifdef CONFIG_PM 10471 #else 10472 #endif 10473 #ifndef CONFIG_PM 10474 #endif 10475 #define MAX_RF_KILL_CHECKS 5 10476 #define RF_KILL_CHECK_DELAY 40 10477 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 10478 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 10479 #define MAC_ASSOCIATION_READ_DELAY (HZ) 10480 #ifdef CONFIG_IPW2100_DEBUG 10481 #define IPW2100_HANDLER(v, f) { v, f, # v } 10482 #else 10483 #define IPW2100_HANDLER(v, f) { v, f } 10484 #endif 10485 #ifdef CONFIG_IPW2100_DEBUG 10486 #endif 10487 #ifdef CONFIG_IPW2100_DEBUG 10488 #endif 10489 #define SEARCH_ERROR 0xffffffff 10490 #define SEARCH_FAIL 0xfffffffe 10491 #define SEARCH_SUCCESS 0xfffffff0 10492 #define SEARCH_DISCARD 0 10493 #define SEARCH_SNAPSHOT 1 10494 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 10495 #ifdef IPW2100_DEBUG_C3 10496 #endif 10497 #ifdef IPW2100_RX_DEBUG 10498 #endif 10499 #ifdef IPW2100_DEBUG_C3 10500 #endif 10501 #ifdef IPW2100_DEBUG_C3 10502 #endif 10503 #ifdef IPW2100_RX_DEBUG 10504 #endif 10505 #ifdef IPW2100_RX_DEBUG 10506 #endif 10507 #ifdef CONFIG_IPW2100_MONITOR 10508 #endif 10509 #ifdef CONFIG_IPW2100_MONITOR 10510 #else 10511 #endif 10512 #ifdef CONFIG_IPW2100_MONITOR 10513 #endif 10514 #ifdef CONFIG_IPW2100_DEBUG 10515 #endif 10516 #ifdef CONFIG_IPW2100_DEBUG 10517 #endif 10518 #ifdef CONFIG_IPW2100_DEBUG 10519 #endif 10520 #define IPW2100_REG(x) { IPW_ ##x, #x } 10521 #define IPW2100_NIC(x, s) { x, #x, s } 10522 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 10523 #ifdef CONFIG_IPW2100_DEBUG 10524 #endif 10525 #ifdef CONFIG_IPW2100_MONITOR 10526 #endif 10527 #ifdef CONFIG_PM 10528 #endif 10529 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 10530 #ifdef CONFIG_IPW2100_DEBUG 10531 #endif 10532 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 10533 #endif 10534 #ifdef IPW2100_TX_POWER 10535 #endif 10536 #if 0 10537 #endif 10538 #ifdef CONFIG_IPW2100_DEBUG 10539 #endif 10540 #define IPW_PRIVACY_CAPABLE 0x0008 10541 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 10542 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 10543 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 10544 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 10545 #ifdef CONFIG_IPW2100_MONITOR 10546 #endif 10547 #ifdef CONFIG_IPW2100_MONITOR 10548 #endif 10549 #ifdef CONFIG_IPW2100_MONITOR 10550 #endif 10551 #ifdef CONFIG_IPW2100_MONITOR 10552 #endif 10553 #ifdef CONFIG_PM 10554 #endif 10555 #ifdef CONFIG_PM 10556 #endif 10557 /* LDV_COMMENT_END_PREP */ 10558 /* LDV_COMMENT_BEGIN_PREP */ 10559 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 10560 #ifdef CONFIG_PM 10561 #endif 10562 #ifdef CONFIG_IPW2100_DEBUG 10563 #endif 10564 #ifdef CONFIG_IPW2100_DEBUG 10565 #endif 10566 #ifdef CONFIG_IPW2100_MONITOR 10567 #endif 10568 #define POWER_MODES 5 10569 #ifdef CONFIG_IPW2100_MONITOR 10570 #endif 10571 #define MAX_POWER_STRING 80 10572 #ifdef CONFIG_IPW2100_MONITOR 10573 #endif 10574 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 10575 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 10576 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 10577 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 10578 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 10579 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 10580 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 10581 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 10582 #ifdef CONFIG_IPW2100_MONITOR 10583 #endif 10584 #ifdef CONFIG_IPW2100_MONITOR 10585 #endif 10586 #ifdef CONFIG_IPW2100_MONITOR 10587 #else 10588 #endif 10589 #ifdef CONFIG_IPW2100_MONITOR 10590 #else 10591 #endif 10592 #ifdef CONFIG_IPW2100_DEBUG 10593 #endif 10594 #define IPW2100_FW_MAJOR_VERSION 1 10595 #define IPW2100_FW_MINOR_VERSION 3 10596 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 10597 #define IPW2100_FW_MAJOR(x) (x & 0xff) 10598 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 10599 IPW2100_FW_MAJOR_VERSION) 10600 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 10601 "." __stringify(IPW2100_FW_MINOR_VERSION) 10602 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 10603 #ifdef CONFIG_IPW2100_MONITOR 10604 #endif 10605 #ifdef CONFIG_IPW2100_MONITOR 10606 #endif 10607 /* LDV_COMMENT_END_PREP */ 10608 10609 /** STRUCT: struct type: iw_handler_def, struct name: ipw2100_wx_handler_def **/ 10610 /* content: static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev)*/ 10611 /* LDV_COMMENT_BEGIN_PREP */ 10612 #define IPW2100_VERSION "git-1.2.2" 10613 #define DRV_NAME "ipw2100" 10614 #define DRV_VERSION IPW2100_VERSION 10615 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 10616 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 10617 #ifdef CONFIG_IPW2100_DEBUG 10618 #define IPW2100_RX_DEBUG 10619 #endif 10620 #ifdef CONFIG_PM 10621 #endif 10622 #ifdef CONFIG_IPW2100_DEBUG 10623 #define IPW_DEBUG(level, message...) \ 10624 do { \ 10625 if (ipw2100_debug_level & (level)) { \ 10626 printk(KERN_DEBUG "ipw2100: %c %s ", \ 10627 in_interrupt() ? 'I' : 'U', __func__); \ 10628 printk(message); \ 10629 } \ 10630 } while (0) 10631 #else 10632 #define IPW_DEBUG(level, message...) do {} while (0) 10633 #endif 10634 #ifdef CONFIG_IPW2100_DEBUG 10635 #endif 10636 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 10637 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 10638 #define MAX_RESET_BACKOFF 10 10639 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 10640 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 10641 #ifndef CONFIG_PM 10642 #endif 10643 #ifdef CONFIG_PM 10644 #else 10645 #endif 10646 #ifndef CONFIG_PM 10647 #endif 10648 #define MAX_RF_KILL_CHECKS 5 10649 #define RF_KILL_CHECK_DELAY 40 10650 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 10651 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 10652 #define MAC_ASSOCIATION_READ_DELAY (HZ) 10653 #ifdef CONFIG_IPW2100_DEBUG 10654 #define IPW2100_HANDLER(v, f) { v, f, # v } 10655 #else 10656 #define IPW2100_HANDLER(v, f) { v, f } 10657 #endif 10658 #ifdef CONFIG_IPW2100_DEBUG 10659 #endif 10660 #ifdef CONFIG_IPW2100_DEBUG 10661 #endif 10662 #define SEARCH_ERROR 0xffffffff 10663 #define SEARCH_FAIL 0xfffffffe 10664 #define SEARCH_SUCCESS 0xfffffff0 10665 #define SEARCH_DISCARD 0 10666 #define SEARCH_SNAPSHOT 1 10667 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 10668 #ifdef IPW2100_DEBUG_C3 10669 #endif 10670 #ifdef IPW2100_RX_DEBUG 10671 #endif 10672 #ifdef IPW2100_DEBUG_C3 10673 #endif 10674 #ifdef IPW2100_DEBUG_C3 10675 #endif 10676 #ifdef IPW2100_RX_DEBUG 10677 #endif 10678 #ifdef IPW2100_RX_DEBUG 10679 #endif 10680 #ifdef CONFIG_IPW2100_MONITOR 10681 #endif 10682 #ifdef CONFIG_IPW2100_MONITOR 10683 #else 10684 #endif 10685 #ifdef CONFIG_IPW2100_MONITOR 10686 #endif 10687 #ifdef CONFIG_IPW2100_DEBUG 10688 #endif 10689 #ifdef CONFIG_IPW2100_DEBUG 10690 #endif 10691 #ifdef CONFIG_IPW2100_DEBUG 10692 #endif 10693 #define IPW2100_REG(x) { IPW_ ##x, #x } 10694 #define IPW2100_NIC(x, s) { x, #x, s } 10695 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 10696 #ifdef CONFIG_IPW2100_DEBUG 10697 #endif 10698 #ifdef CONFIG_IPW2100_MONITOR 10699 #endif 10700 #ifdef CONFIG_PM 10701 #endif 10702 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 10703 #ifdef CONFIG_IPW2100_DEBUG 10704 #endif 10705 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 10706 #endif 10707 #ifdef IPW2100_TX_POWER 10708 #endif 10709 #if 0 10710 #endif 10711 #ifdef CONFIG_IPW2100_DEBUG 10712 #endif 10713 #define IPW_PRIVACY_CAPABLE 0x0008 10714 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 10715 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 10716 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 10717 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 10718 #ifdef CONFIG_IPW2100_MONITOR 10719 #endif 10720 #ifdef CONFIG_IPW2100_MONITOR 10721 #endif 10722 #ifdef CONFIG_IPW2100_MONITOR 10723 #endif 10724 #ifdef CONFIG_IPW2100_MONITOR 10725 #endif 10726 #ifdef CONFIG_PM 10727 #endif 10728 #ifdef CONFIG_PM 10729 #endif 10730 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 10731 #ifdef CONFIG_PM 10732 #endif 10733 #ifdef CONFIG_IPW2100_DEBUG 10734 #endif 10735 #ifdef CONFIG_IPW2100_DEBUG 10736 #endif 10737 #ifdef CONFIG_IPW2100_MONITOR 10738 #endif 10739 #define POWER_MODES 5 10740 #ifdef CONFIG_IPW2100_MONITOR 10741 #endif 10742 #define MAX_POWER_STRING 80 10743 #ifdef CONFIG_IPW2100_MONITOR 10744 #endif 10745 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 10746 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 10747 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 10748 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 10749 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 10750 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 10751 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 10752 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 10753 #ifdef CONFIG_IPW2100_MONITOR 10754 #endif 10755 #ifdef CONFIG_IPW2100_MONITOR 10756 #endif 10757 #ifdef CONFIG_IPW2100_MONITOR 10758 #else 10759 #endif 10760 #ifdef CONFIG_IPW2100_MONITOR 10761 #else 10762 #endif 10763 /* LDV_COMMENT_END_PREP */ 10764 /* LDV_COMMENT_BEGIN_PREP */ 10765 #define IPW2100_FW_MAJOR_VERSION 1 10766 #define IPW2100_FW_MINOR_VERSION 3 10767 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 10768 #define IPW2100_FW_MAJOR(x) (x & 0xff) 10769 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 10770 IPW2100_FW_MAJOR_VERSION) 10771 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 10772 "." __stringify(IPW2100_FW_MINOR_VERSION) 10773 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 10774 #ifdef CONFIG_IPW2100_MONITOR 10775 #endif 10776 #ifdef CONFIG_IPW2100_MONITOR 10777 #endif 10778 /* LDV_COMMENT_END_PREP */ 10779 10780 /** CALLBACK SECTION request_irq **/ 10781 /* content: static irqreturn_t ipw2100_interrupt(int irq, void *data)*/ 10782 /* LDV_COMMENT_BEGIN_PREP */ 10783 #define IPW2100_VERSION "git-1.2.2" 10784 #define DRV_NAME "ipw2100" 10785 #define DRV_VERSION IPW2100_VERSION 10786 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 10787 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 10788 #ifdef CONFIG_IPW2100_DEBUG 10789 #define IPW2100_RX_DEBUG 10790 #endif 10791 #ifdef CONFIG_PM 10792 #endif 10793 #ifdef CONFIG_IPW2100_DEBUG 10794 #define IPW_DEBUG(level, message...) \ 10795 do { \ 10796 if (ipw2100_debug_level & (level)) { \ 10797 printk(KERN_DEBUG "ipw2100: %c %s ", \ 10798 in_interrupt() ? 'I' : 'U', __func__); \ 10799 printk(message); \ 10800 } \ 10801 } while (0) 10802 #else 10803 #define IPW_DEBUG(level, message...) do {} while (0) 10804 #endif 10805 #ifdef CONFIG_IPW2100_DEBUG 10806 #endif 10807 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 10808 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 10809 #define MAX_RESET_BACKOFF 10 10810 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 10811 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 10812 #ifndef CONFIG_PM 10813 #endif 10814 #ifdef CONFIG_PM 10815 #else 10816 #endif 10817 #ifndef CONFIG_PM 10818 #endif 10819 #define MAX_RF_KILL_CHECKS 5 10820 #define RF_KILL_CHECK_DELAY 40 10821 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 10822 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 10823 #define MAC_ASSOCIATION_READ_DELAY (HZ) 10824 #ifdef CONFIG_IPW2100_DEBUG 10825 #define IPW2100_HANDLER(v, f) { v, f, # v } 10826 #else 10827 #define IPW2100_HANDLER(v, f) { v, f } 10828 #endif 10829 #ifdef CONFIG_IPW2100_DEBUG 10830 #endif 10831 #ifdef CONFIG_IPW2100_DEBUG 10832 #endif 10833 #define SEARCH_ERROR 0xffffffff 10834 #define SEARCH_FAIL 0xfffffffe 10835 #define SEARCH_SUCCESS 0xfffffff0 10836 #define SEARCH_DISCARD 0 10837 #define SEARCH_SNAPSHOT 1 10838 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 10839 #ifdef IPW2100_DEBUG_C3 10840 #endif 10841 #ifdef IPW2100_RX_DEBUG 10842 #endif 10843 #ifdef IPW2100_DEBUG_C3 10844 #endif 10845 #ifdef IPW2100_DEBUG_C3 10846 #endif 10847 #ifdef IPW2100_RX_DEBUG 10848 #endif 10849 #ifdef IPW2100_RX_DEBUG 10850 #endif 10851 #ifdef CONFIG_IPW2100_MONITOR 10852 #endif 10853 #ifdef CONFIG_IPW2100_MONITOR 10854 #else 10855 #endif 10856 #ifdef CONFIG_IPW2100_MONITOR 10857 #endif 10858 #ifdef CONFIG_IPW2100_DEBUG 10859 #endif 10860 #ifdef CONFIG_IPW2100_DEBUG 10861 #endif 10862 #ifdef CONFIG_IPW2100_DEBUG 10863 #endif 10864 /* LDV_COMMENT_END_PREP */ 10865 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_interrupt" */ 10866 int var_ipw2100_interrupt_69_p0; 10867 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ipw2100_interrupt" */ 10868 void * var_ipw2100_interrupt_69_p1; 10869 /* LDV_COMMENT_BEGIN_PREP */ 10870 #define IPW2100_REG(x) { IPW_ ##x, #x } 10871 #define IPW2100_NIC(x, s) { x, #x, s } 10872 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 10873 #ifdef CONFIG_IPW2100_DEBUG 10874 #endif 10875 #ifdef CONFIG_IPW2100_MONITOR 10876 #endif 10877 #ifdef CONFIG_PM 10878 #endif 10879 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 10880 #ifdef CONFIG_IPW2100_DEBUG 10881 #endif 10882 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 10883 #endif 10884 #ifdef IPW2100_TX_POWER 10885 #endif 10886 #if 0 10887 #endif 10888 #ifdef CONFIG_IPW2100_DEBUG 10889 #endif 10890 #define IPW_PRIVACY_CAPABLE 0x0008 10891 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 10892 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 10893 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 10894 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 10895 #ifdef CONFIG_IPW2100_MONITOR 10896 #endif 10897 #ifdef CONFIG_IPW2100_MONITOR 10898 #endif 10899 #ifdef CONFIG_IPW2100_MONITOR 10900 #endif 10901 #ifdef CONFIG_IPW2100_MONITOR 10902 #endif 10903 #ifdef CONFIG_PM 10904 #endif 10905 #ifdef CONFIG_PM 10906 #endif 10907 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 10908 #ifdef CONFIG_PM 10909 #endif 10910 #ifdef CONFIG_IPW2100_DEBUG 10911 #endif 10912 #ifdef CONFIG_IPW2100_DEBUG 10913 #endif 10914 #ifdef CONFIG_IPW2100_MONITOR 10915 #endif 10916 #define POWER_MODES 5 10917 #ifdef CONFIG_IPW2100_MONITOR 10918 #endif 10919 #define MAX_POWER_STRING 80 10920 #ifdef CONFIG_IPW2100_MONITOR 10921 #endif 10922 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 10923 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 10924 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 10925 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 10926 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 10927 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 10928 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 10929 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 10930 #ifdef CONFIG_IPW2100_MONITOR 10931 #endif 10932 #ifdef CONFIG_IPW2100_MONITOR 10933 #endif 10934 #ifdef CONFIG_IPW2100_MONITOR 10935 #else 10936 #endif 10937 #ifdef CONFIG_IPW2100_MONITOR 10938 #else 10939 #endif 10940 #ifdef CONFIG_IPW2100_DEBUG 10941 #endif 10942 #define IPW2100_FW_MAJOR_VERSION 1 10943 #define IPW2100_FW_MINOR_VERSION 3 10944 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 10945 #define IPW2100_FW_MAJOR(x) (x & 0xff) 10946 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 10947 IPW2100_FW_MAJOR_VERSION) 10948 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 10949 "." __stringify(IPW2100_FW_MINOR_VERSION) 10950 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 10951 #ifdef CONFIG_IPW2100_MONITOR 10952 #endif 10953 #ifdef CONFIG_IPW2100_MONITOR 10954 #endif 10955 /* LDV_COMMENT_END_PREP */ 10956 10957 10958 10959 10960 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 10961 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 10962 /*============================= VARIABLE INITIALIZING PART =============================*/ 10963 LDV_IN_INTERRUPT=1; 10964 10965 10966 10967 10968 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 10969 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 10970 /*============================= FUNCTION CALL SECTION =============================*/ 10971 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 10972 ldv_initialize(); 10973 10974 /** INIT: init_type: ST_MODULE_INIT **/ 10975 /* content: static int __init ipw2100_init(void)*/ 10976 /* LDV_COMMENT_BEGIN_PREP */ 10977 #define IPW2100_VERSION "git-1.2.2" 10978 #define DRV_NAME "ipw2100" 10979 #define DRV_VERSION IPW2100_VERSION 10980 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 10981 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 10982 #ifdef CONFIG_IPW2100_DEBUG 10983 #define IPW2100_RX_DEBUG 10984 #endif 10985 #ifdef CONFIG_PM 10986 #endif 10987 #ifdef CONFIG_IPW2100_DEBUG 10988 #define IPW_DEBUG(level, message...) \ 10989 do { \ 10990 if (ipw2100_debug_level & (level)) { \ 10991 printk(KERN_DEBUG "ipw2100: %c %s ", \ 10992 in_interrupt() ? 'I' : 'U', __func__); \ 10993 printk(message); \ 10994 } \ 10995 } while (0) 10996 #else 10997 #define IPW_DEBUG(level, message...) do {} while (0) 10998 #endif 10999 #ifdef CONFIG_IPW2100_DEBUG 11000 #endif 11001 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 11002 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 11003 #define MAX_RESET_BACKOFF 10 11004 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 11005 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 11006 #ifndef CONFIG_PM 11007 #endif 11008 #ifdef CONFIG_PM 11009 #else 11010 #endif 11011 #ifndef CONFIG_PM 11012 #endif 11013 #define MAX_RF_KILL_CHECKS 5 11014 #define RF_KILL_CHECK_DELAY 40 11015 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 11016 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 11017 #define MAC_ASSOCIATION_READ_DELAY (HZ) 11018 #ifdef CONFIG_IPW2100_DEBUG 11019 #define IPW2100_HANDLER(v, f) { v, f, # v } 11020 #else 11021 #define IPW2100_HANDLER(v, f) { v, f } 11022 #endif 11023 #ifdef CONFIG_IPW2100_DEBUG 11024 #endif 11025 #ifdef CONFIG_IPW2100_DEBUG 11026 #endif 11027 #define SEARCH_ERROR 0xffffffff 11028 #define SEARCH_FAIL 0xfffffffe 11029 #define SEARCH_SUCCESS 0xfffffff0 11030 #define SEARCH_DISCARD 0 11031 #define SEARCH_SNAPSHOT 1 11032 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 11033 #ifdef IPW2100_DEBUG_C3 11034 #endif 11035 #ifdef IPW2100_RX_DEBUG 11036 #endif 11037 #ifdef IPW2100_DEBUG_C3 11038 #endif 11039 #ifdef IPW2100_DEBUG_C3 11040 #endif 11041 #ifdef IPW2100_RX_DEBUG 11042 #endif 11043 #ifdef IPW2100_RX_DEBUG 11044 #endif 11045 #ifdef CONFIG_IPW2100_MONITOR 11046 #endif 11047 #ifdef CONFIG_IPW2100_MONITOR 11048 #else 11049 #endif 11050 #ifdef CONFIG_IPW2100_MONITOR 11051 #endif 11052 #ifdef CONFIG_IPW2100_DEBUG 11053 #endif 11054 #ifdef CONFIG_IPW2100_DEBUG 11055 #endif 11056 #ifdef CONFIG_IPW2100_DEBUG 11057 #endif 11058 #define IPW2100_REG(x) { IPW_ ##x, #x } 11059 #define IPW2100_NIC(x, s) { x, #x, s } 11060 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 11061 #ifdef CONFIG_IPW2100_DEBUG 11062 #endif 11063 #ifdef CONFIG_IPW2100_MONITOR 11064 #endif 11065 #ifdef CONFIG_PM 11066 #endif 11067 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 11068 #ifdef CONFIG_IPW2100_DEBUG 11069 #endif 11070 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 11071 #endif 11072 #ifdef IPW2100_TX_POWER 11073 #endif 11074 #if 0 11075 #endif 11076 #ifdef CONFIG_IPW2100_DEBUG 11077 #endif 11078 #define IPW_PRIVACY_CAPABLE 0x0008 11079 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 11080 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 11081 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 11082 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 11083 #ifdef CONFIG_IPW2100_MONITOR 11084 #endif 11085 #ifdef CONFIG_IPW2100_MONITOR 11086 #endif 11087 #ifdef CONFIG_IPW2100_MONITOR 11088 #endif 11089 #ifdef CONFIG_IPW2100_MONITOR 11090 #endif 11091 #ifdef CONFIG_PM 11092 #endif 11093 #ifdef CONFIG_PM 11094 #endif 11095 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 11096 #ifdef CONFIG_PM 11097 #endif 11098 /* LDV_COMMENT_END_PREP */ 11099 /* LDV_COMMENT_FUNCTION_CALL Kernel calls driver init function after driver loading to kernel. This function declared as "MODULE_INIT(function name)". */ 11100 ldv_handler_precall(); 11101 if(ipw2100_init()) 11102 goto ldv_final; 11103 /* LDV_COMMENT_BEGIN_PREP */ 11104 #ifdef CONFIG_IPW2100_DEBUG 11105 #endif 11106 #ifdef CONFIG_IPW2100_MONITOR 11107 #endif 11108 #define POWER_MODES 5 11109 #ifdef CONFIG_IPW2100_MONITOR 11110 #endif 11111 #define MAX_POWER_STRING 80 11112 #ifdef CONFIG_IPW2100_MONITOR 11113 #endif 11114 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 11115 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 11116 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 11117 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 11118 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 11119 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 11120 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 11121 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 11122 #ifdef CONFIG_IPW2100_MONITOR 11123 #endif 11124 #ifdef CONFIG_IPW2100_MONITOR 11125 #endif 11126 #ifdef CONFIG_IPW2100_MONITOR 11127 #else 11128 #endif 11129 #ifdef CONFIG_IPW2100_MONITOR 11130 #else 11131 #endif 11132 #ifdef CONFIG_IPW2100_DEBUG 11133 #endif 11134 #define IPW2100_FW_MAJOR_VERSION 1 11135 #define IPW2100_FW_MINOR_VERSION 3 11136 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 11137 #define IPW2100_FW_MAJOR(x) (x & 0xff) 11138 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 11139 IPW2100_FW_MAJOR_VERSION) 11140 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 11141 "." __stringify(IPW2100_FW_MINOR_VERSION) 11142 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 11143 #ifdef CONFIG_IPW2100_MONITOR 11144 #endif 11145 #ifdef CONFIG_IPW2100_MONITOR 11146 #endif 11147 /* LDV_COMMENT_END_PREP */ 11148 11149 11150 int ldv_s_ipw2100_netdev_ops_net_device_ops = 0; 11151 11152 11153 int ldv_s_ipw2100_pci_driver_pci_driver = 0; 11154 11155 11156 11157 11158 11159 11160 11161 while( nondet_int() 11162 || !(ldv_s_ipw2100_netdev_ops_net_device_ops == 0) 11163 || !(ldv_s_ipw2100_pci_driver_pci_driver == 0) 11164 ) { 11165 11166 switch(nondet_int()) { 11167 11168 case 0: { 11169 11170 /** STRUCT: struct type: ethtool_ops, struct name: ipw2100_ethtool_ops **/ 11171 11172 11173 /* content: static u32 ipw2100_ethtool_get_link(struct net_device *dev)*/ 11174 /* LDV_COMMENT_BEGIN_PREP */ 11175 #define IPW2100_VERSION "git-1.2.2" 11176 #define DRV_NAME "ipw2100" 11177 #define DRV_VERSION IPW2100_VERSION 11178 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 11179 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 11180 #ifdef CONFIG_IPW2100_DEBUG 11181 #define IPW2100_RX_DEBUG 11182 #endif 11183 #ifdef CONFIG_PM 11184 #endif 11185 #ifdef CONFIG_IPW2100_DEBUG 11186 #define IPW_DEBUG(level, message...) \ 11187 do { \ 11188 if (ipw2100_debug_level & (level)) { \ 11189 printk(KERN_DEBUG "ipw2100: %c %s ", \ 11190 in_interrupt() ? 'I' : 'U', __func__); \ 11191 printk(message); \ 11192 } \ 11193 } while (0) 11194 #else 11195 #define IPW_DEBUG(level, message...) do {} while (0) 11196 #endif 11197 #ifdef CONFIG_IPW2100_DEBUG 11198 #endif 11199 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 11200 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 11201 #define MAX_RESET_BACKOFF 10 11202 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 11203 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 11204 #ifndef CONFIG_PM 11205 #endif 11206 #ifdef CONFIG_PM 11207 #else 11208 #endif 11209 #ifndef CONFIG_PM 11210 #endif 11211 #define MAX_RF_KILL_CHECKS 5 11212 #define RF_KILL_CHECK_DELAY 40 11213 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 11214 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 11215 #define MAC_ASSOCIATION_READ_DELAY (HZ) 11216 #ifdef CONFIG_IPW2100_DEBUG 11217 #define IPW2100_HANDLER(v, f) { v, f, # v } 11218 #else 11219 #define IPW2100_HANDLER(v, f) { v, f } 11220 #endif 11221 #ifdef CONFIG_IPW2100_DEBUG 11222 #endif 11223 #ifdef CONFIG_IPW2100_DEBUG 11224 #endif 11225 #define SEARCH_ERROR 0xffffffff 11226 #define SEARCH_FAIL 0xfffffffe 11227 #define SEARCH_SUCCESS 0xfffffff0 11228 #define SEARCH_DISCARD 0 11229 #define SEARCH_SNAPSHOT 1 11230 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 11231 #ifdef IPW2100_DEBUG_C3 11232 #endif 11233 #ifdef IPW2100_RX_DEBUG 11234 #endif 11235 #ifdef IPW2100_DEBUG_C3 11236 #endif 11237 #ifdef IPW2100_DEBUG_C3 11238 #endif 11239 #ifdef IPW2100_RX_DEBUG 11240 #endif 11241 #ifdef IPW2100_RX_DEBUG 11242 #endif 11243 #ifdef CONFIG_IPW2100_MONITOR 11244 #endif 11245 #ifdef CONFIG_IPW2100_MONITOR 11246 #else 11247 #endif 11248 #ifdef CONFIG_IPW2100_MONITOR 11249 #endif 11250 #ifdef CONFIG_IPW2100_DEBUG 11251 #endif 11252 #ifdef CONFIG_IPW2100_DEBUG 11253 #endif 11254 #ifdef CONFIG_IPW2100_DEBUG 11255 #endif 11256 #define IPW2100_REG(x) { IPW_ ##x, #x } 11257 #define IPW2100_NIC(x, s) { x, #x, s } 11258 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 11259 #ifdef CONFIG_IPW2100_DEBUG 11260 #endif 11261 #ifdef CONFIG_IPW2100_MONITOR 11262 #endif 11263 #ifdef CONFIG_PM 11264 #endif 11265 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 11266 #ifdef CONFIG_IPW2100_DEBUG 11267 #endif 11268 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 11269 #endif 11270 #ifdef IPW2100_TX_POWER 11271 #endif 11272 #if 0 11273 #endif 11274 #ifdef CONFIG_IPW2100_DEBUG 11275 #endif 11276 #define IPW_PRIVACY_CAPABLE 0x0008 11277 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 11278 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 11279 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 11280 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 11281 #ifdef CONFIG_IPW2100_MONITOR 11282 #endif 11283 #ifdef CONFIG_IPW2100_MONITOR 11284 #endif 11285 /* LDV_COMMENT_END_PREP */ 11286 /* LDV_COMMENT_FUNCTION_CALL Function from field "get_link" from driver structure with callbacks "ipw2100_ethtool_ops" */ 11287 ldv_handler_precall(); 11288 ipw2100_ethtool_get_link( var_group1); 11289 /* LDV_COMMENT_BEGIN_PREP */ 11290 #ifdef CONFIG_IPW2100_MONITOR 11291 #endif 11292 #ifdef CONFIG_IPW2100_MONITOR 11293 #endif 11294 #ifdef CONFIG_PM 11295 #endif 11296 #ifdef CONFIG_PM 11297 #endif 11298 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 11299 #ifdef CONFIG_PM 11300 #endif 11301 #ifdef CONFIG_IPW2100_DEBUG 11302 #endif 11303 #ifdef CONFIG_IPW2100_DEBUG 11304 #endif 11305 #ifdef CONFIG_IPW2100_MONITOR 11306 #endif 11307 #define POWER_MODES 5 11308 #ifdef CONFIG_IPW2100_MONITOR 11309 #endif 11310 #define MAX_POWER_STRING 80 11311 #ifdef CONFIG_IPW2100_MONITOR 11312 #endif 11313 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 11314 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 11315 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 11316 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 11317 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 11318 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 11319 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 11320 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 11321 #ifdef CONFIG_IPW2100_MONITOR 11322 #endif 11323 #ifdef CONFIG_IPW2100_MONITOR 11324 #endif 11325 #ifdef CONFIG_IPW2100_MONITOR 11326 #else 11327 #endif 11328 #ifdef CONFIG_IPW2100_MONITOR 11329 #else 11330 #endif 11331 #ifdef CONFIG_IPW2100_DEBUG 11332 #endif 11333 #define IPW2100_FW_MAJOR_VERSION 1 11334 #define IPW2100_FW_MINOR_VERSION 3 11335 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 11336 #define IPW2100_FW_MAJOR(x) (x & 0xff) 11337 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 11338 IPW2100_FW_MAJOR_VERSION) 11339 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 11340 "." __stringify(IPW2100_FW_MINOR_VERSION) 11341 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 11342 #ifdef CONFIG_IPW2100_MONITOR 11343 #endif 11344 #ifdef CONFIG_IPW2100_MONITOR 11345 #endif 11346 /* LDV_COMMENT_END_PREP */ 11347 11348 11349 11350 11351 } 11352 11353 break; 11354 case 1: { 11355 11356 /** STRUCT: struct type: ethtool_ops, struct name: ipw2100_ethtool_ops **/ 11357 11358 11359 /* content: static void ipw_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)*/ 11360 /* LDV_COMMENT_BEGIN_PREP */ 11361 #define IPW2100_VERSION "git-1.2.2" 11362 #define DRV_NAME "ipw2100" 11363 #define DRV_VERSION IPW2100_VERSION 11364 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 11365 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 11366 #ifdef CONFIG_IPW2100_DEBUG 11367 #define IPW2100_RX_DEBUG 11368 #endif 11369 #ifdef CONFIG_PM 11370 #endif 11371 #ifdef CONFIG_IPW2100_DEBUG 11372 #define IPW_DEBUG(level, message...) \ 11373 do { \ 11374 if (ipw2100_debug_level & (level)) { \ 11375 printk(KERN_DEBUG "ipw2100: %c %s ", \ 11376 in_interrupt() ? 'I' : 'U', __func__); \ 11377 printk(message); \ 11378 } \ 11379 } while (0) 11380 #else 11381 #define IPW_DEBUG(level, message...) do {} while (0) 11382 #endif 11383 #ifdef CONFIG_IPW2100_DEBUG 11384 #endif 11385 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 11386 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 11387 #define MAX_RESET_BACKOFF 10 11388 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 11389 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 11390 #ifndef CONFIG_PM 11391 #endif 11392 #ifdef CONFIG_PM 11393 #else 11394 #endif 11395 #ifndef CONFIG_PM 11396 #endif 11397 #define MAX_RF_KILL_CHECKS 5 11398 #define RF_KILL_CHECK_DELAY 40 11399 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 11400 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 11401 #define MAC_ASSOCIATION_READ_DELAY (HZ) 11402 #ifdef CONFIG_IPW2100_DEBUG 11403 #define IPW2100_HANDLER(v, f) { v, f, # v } 11404 #else 11405 #define IPW2100_HANDLER(v, f) { v, f } 11406 #endif 11407 #ifdef CONFIG_IPW2100_DEBUG 11408 #endif 11409 #ifdef CONFIG_IPW2100_DEBUG 11410 #endif 11411 #define SEARCH_ERROR 0xffffffff 11412 #define SEARCH_FAIL 0xfffffffe 11413 #define SEARCH_SUCCESS 0xfffffff0 11414 #define SEARCH_DISCARD 0 11415 #define SEARCH_SNAPSHOT 1 11416 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 11417 #ifdef IPW2100_DEBUG_C3 11418 #endif 11419 #ifdef IPW2100_RX_DEBUG 11420 #endif 11421 #ifdef IPW2100_DEBUG_C3 11422 #endif 11423 #ifdef IPW2100_DEBUG_C3 11424 #endif 11425 #ifdef IPW2100_RX_DEBUG 11426 #endif 11427 #ifdef IPW2100_RX_DEBUG 11428 #endif 11429 #ifdef CONFIG_IPW2100_MONITOR 11430 #endif 11431 #ifdef CONFIG_IPW2100_MONITOR 11432 #else 11433 #endif 11434 #ifdef CONFIG_IPW2100_MONITOR 11435 #endif 11436 #ifdef CONFIG_IPW2100_DEBUG 11437 #endif 11438 #ifdef CONFIG_IPW2100_DEBUG 11439 #endif 11440 #ifdef CONFIG_IPW2100_DEBUG 11441 #endif 11442 #define IPW2100_REG(x) { IPW_ ##x, #x } 11443 #define IPW2100_NIC(x, s) { x, #x, s } 11444 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 11445 #ifdef CONFIG_IPW2100_DEBUG 11446 #endif 11447 #ifdef CONFIG_IPW2100_MONITOR 11448 #endif 11449 #ifdef CONFIG_PM 11450 #endif 11451 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 11452 #ifdef CONFIG_IPW2100_DEBUG 11453 #endif 11454 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 11455 #endif 11456 #ifdef IPW2100_TX_POWER 11457 #endif 11458 #if 0 11459 #endif 11460 #ifdef CONFIG_IPW2100_DEBUG 11461 #endif 11462 #define IPW_PRIVACY_CAPABLE 0x0008 11463 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 11464 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 11465 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 11466 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 11467 #ifdef CONFIG_IPW2100_MONITOR 11468 #endif 11469 #ifdef CONFIG_IPW2100_MONITOR 11470 #endif 11471 /* LDV_COMMENT_END_PREP */ 11472 /* LDV_COMMENT_FUNCTION_CALL Function from field "get_drvinfo" from driver structure with callbacks "ipw2100_ethtool_ops" */ 11473 ldv_handler_precall(); 11474 ipw_ethtool_get_drvinfo( var_group1, var_group2); 11475 /* LDV_COMMENT_BEGIN_PREP */ 11476 #ifdef CONFIG_IPW2100_MONITOR 11477 #endif 11478 #ifdef CONFIG_IPW2100_MONITOR 11479 #endif 11480 #ifdef CONFIG_PM 11481 #endif 11482 #ifdef CONFIG_PM 11483 #endif 11484 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 11485 #ifdef CONFIG_PM 11486 #endif 11487 #ifdef CONFIG_IPW2100_DEBUG 11488 #endif 11489 #ifdef CONFIG_IPW2100_DEBUG 11490 #endif 11491 #ifdef CONFIG_IPW2100_MONITOR 11492 #endif 11493 #define POWER_MODES 5 11494 #ifdef CONFIG_IPW2100_MONITOR 11495 #endif 11496 #define MAX_POWER_STRING 80 11497 #ifdef CONFIG_IPW2100_MONITOR 11498 #endif 11499 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 11500 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 11501 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 11502 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 11503 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 11504 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 11505 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 11506 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 11507 #ifdef CONFIG_IPW2100_MONITOR 11508 #endif 11509 #ifdef CONFIG_IPW2100_MONITOR 11510 #endif 11511 #ifdef CONFIG_IPW2100_MONITOR 11512 #else 11513 #endif 11514 #ifdef CONFIG_IPW2100_MONITOR 11515 #else 11516 #endif 11517 #ifdef CONFIG_IPW2100_DEBUG 11518 #endif 11519 #define IPW2100_FW_MAJOR_VERSION 1 11520 #define IPW2100_FW_MINOR_VERSION 3 11521 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 11522 #define IPW2100_FW_MAJOR(x) (x & 0xff) 11523 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 11524 IPW2100_FW_MAJOR_VERSION) 11525 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 11526 "." __stringify(IPW2100_FW_MINOR_VERSION) 11527 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 11528 #ifdef CONFIG_IPW2100_MONITOR 11529 #endif 11530 #ifdef CONFIG_IPW2100_MONITOR 11531 #endif 11532 /* LDV_COMMENT_END_PREP */ 11533 11534 11535 11536 11537 } 11538 11539 break; 11540 case 2: { 11541 11542 /** STRUCT: struct type: net_device_ops, struct name: ipw2100_netdev_ops **/ 11543 if(ldv_s_ipw2100_netdev_ops_net_device_ops==0) { 11544 11545 /* content: static int ipw2100_open(struct net_device *dev)*/ 11546 /* LDV_COMMENT_BEGIN_PREP */ 11547 #define IPW2100_VERSION "git-1.2.2" 11548 #define DRV_NAME "ipw2100" 11549 #define DRV_VERSION IPW2100_VERSION 11550 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 11551 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 11552 #ifdef CONFIG_IPW2100_DEBUG 11553 #define IPW2100_RX_DEBUG 11554 #endif 11555 #ifdef CONFIG_PM 11556 #endif 11557 #ifdef CONFIG_IPW2100_DEBUG 11558 #define IPW_DEBUG(level, message...) \ 11559 do { \ 11560 if (ipw2100_debug_level & (level)) { \ 11561 printk(KERN_DEBUG "ipw2100: %c %s ", \ 11562 in_interrupt() ? 'I' : 'U', __func__); \ 11563 printk(message); \ 11564 } \ 11565 } while (0) 11566 #else 11567 #define IPW_DEBUG(level, message...) do {} while (0) 11568 #endif 11569 #ifdef CONFIG_IPW2100_DEBUG 11570 #endif 11571 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 11572 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 11573 #define MAX_RESET_BACKOFF 10 11574 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 11575 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 11576 #ifndef CONFIG_PM 11577 #endif 11578 #ifdef CONFIG_PM 11579 #else 11580 #endif 11581 #ifndef CONFIG_PM 11582 #endif 11583 #define MAX_RF_KILL_CHECKS 5 11584 #define RF_KILL_CHECK_DELAY 40 11585 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 11586 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 11587 #define MAC_ASSOCIATION_READ_DELAY (HZ) 11588 #ifdef CONFIG_IPW2100_DEBUG 11589 #define IPW2100_HANDLER(v, f) { v, f, # v } 11590 #else 11591 #define IPW2100_HANDLER(v, f) { v, f } 11592 #endif 11593 #ifdef CONFIG_IPW2100_DEBUG 11594 #endif 11595 #ifdef CONFIG_IPW2100_DEBUG 11596 #endif 11597 #define SEARCH_ERROR 0xffffffff 11598 #define SEARCH_FAIL 0xfffffffe 11599 #define SEARCH_SUCCESS 0xfffffff0 11600 #define SEARCH_DISCARD 0 11601 #define SEARCH_SNAPSHOT 1 11602 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 11603 #ifdef IPW2100_DEBUG_C3 11604 #endif 11605 #ifdef IPW2100_RX_DEBUG 11606 #endif 11607 #ifdef IPW2100_DEBUG_C3 11608 #endif 11609 #ifdef IPW2100_DEBUG_C3 11610 #endif 11611 #ifdef IPW2100_RX_DEBUG 11612 #endif 11613 #ifdef IPW2100_RX_DEBUG 11614 #endif 11615 #ifdef CONFIG_IPW2100_MONITOR 11616 #endif 11617 #ifdef CONFIG_IPW2100_MONITOR 11618 #else 11619 #endif 11620 #ifdef CONFIG_IPW2100_MONITOR 11621 #endif 11622 #ifdef CONFIG_IPW2100_DEBUG 11623 #endif 11624 #ifdef CONFIG_IPW2100_DEBUG 11625 #endif 11626 #ifdef CONFIG_IPW2100_DEBUG 11627 #endif 11628 #define IPW2100_REG(x) { IPW_ ##x, #x } 11629 #define IPW2100_NIC(x, s) { x, #x, s } 11630 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 11631 #ifdef CONFIG_IPW2100_DEBUG 11632 #endif 11633 #ifdef CONFIG_IPW2100_MONITOR 11634 #endif 11635 #ifdef CONFIG_PM 11636 #endif 11637 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 11638 #ifdef CONFIG_IPW2100_DEBUG 11639 #endif 11640 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 11641 #endif 11642 #ifdef IPW2100_TX_POWER 11643 #endif 11644 #if 0 11645 #endif 11646 #ifdef CONFIG_IPW2100_DEBUG 11647 #endif 11648 #define IPW_PRIVACY_CAPABLE 0x0008 11649 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 11650 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 11651 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 11652 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 11653 #ifdef CONFIG_IPW2100_MONITOR 11654 #endif 11655 /* LDV_COMMENT_END_PREP */ 11656 /* LDV_COMMENT_FUNCTION_CALL Function from field "ndo_open" from driver structure with callbacks "ipw2100_netdev_ops". Standart function test for correct return result. */ 11657 ldv_handler_precall(); 11658 res_ipw2100_open_136 = ipw2100_open( var_group1); 11659 ldv_check_return_value(res_ipw2100_open_136); 11660 if(res_ipw2100_open_136 < 0) 11661 goto ldv_module_exit; 11662 /* LDV_COMMENT_BEGIN_PREP */ 11663 #ifdef CONFIG_IPW2100_MONITOR 11664 #endif 11665 #ifdef CONFIG_IPW2100_MONITOR 11666 #endif 11667 #ifdef CONFIG_IPW2100_MONITOR 11668 #endif 11669 #ifdef CONFIG_PM 11670 #endif 11671 #ifdef CONFIG_PM 11672 #endif 11673 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 11674 #ifdef CONFIG_PM 11675 #endif 11676 #ifdef CONFIG_IPW2100_DEBUG 11677 #endif 11678 #ifdef CONFIG_IPW2100_DEBUG 11679 #endif 11680 #ifdef CONFIG_IPW2100_MONITOR 11681 #endif 11682 #define POWER_MODES 5 11683 #ifdef CONFIG_IPW2100_MONITOR 11684 #endif 11685 #define MAX_POWER_STRING 80 11686 #ifdef CONFIG_IPW2100_MONITOR 11687 #endif 11688 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 11689 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 11690 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 11691 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 11692 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 11693 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 11694 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 11695 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 11696 #ifdef CONFIG_IPW2100_MONITOR 11697 #endif 11698 #ifdef CONFIG_IPW2100_MONITOR 11699 #endif 11700 #ifdef CONFIG_IPW2100_MONITOR 11701 #else 11702 #endif 11703 #ifdef CONFIG_IPW2100_MONITOR 11704 #else 11705 #endif 11706 #ifdef CONFIG_IPW2100_DEBUG 11707 #endif 11708 #define IPW2100_FW_MAJOR_VERSION 1 11709 #define IPW2100_FW_MINOR_VERSION 3 11710 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 11711 #define IPW2100_FW_MAJOR(x) (x & 0xff) 11712 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 11713 IPW2100_FW_MAJOR_VERSION) 11714 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 11715 "." __stringify(IPW2100_FW_MINOR_VERSION) 11716 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 11717 #ifdef CONFIG_IPW2100_MONITOR 11718 #endif 11719 #ifdef CONFIG_IPW2100_MONITOR 11720 #endif 11721 /* LDV_COMMENT_END_PREP */ 11722 ldv_s_ipw2100_netdev_ops_net_device_ops++; 11723 11724 } 11725 11726 } 11727 11728 break; 11729 case 3: { 11730 11731 /** STRUCT: struct type: net_device_ops, struct name: ipw2100_netdev_ops **/ 11732 if(ldv_s_ipw2100_netdev_ops_net_device_ops==1) { 11733 11734 /* content: static int ipw2100_close(struct net_device *dev)*/ 11735 /* LDV_COMMENT_BEGIN_PREP */ 11736 #define IPW2100_VERSION "git-1.2.2" 11737 #define DRV_NAME "ipw2100" 11738 #define DRV_VERSION IPW2100_VERSION 11739 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 11740 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 11741 #ifdef CONFIG_IPW2100_DEBUG 11742 #define IPW2100_RX_DEBUG 11743 #endif 11744 #ifdef CONFIG_PM 11745 #endif 11746 #ifdef CONFIG_IPW2100_DEBUG 11747 #define IPW_DEBUG(level, message...) \ 11748 do { \ 11749 if (ipw2100_debug_level & (level)) { \ 11750 printk(KERN_DEBUG "ipw2100: %c %s ", \ 11751 in_interrupt() ? 'I' : 'U', __func__); \ 11752 printk(message); \ 11753 } \ 11754 } while (0) 11755 #else 11756 #define IPW_DEBUG(level, message...) do {} while (0) 11757 #endif 11758 #ifdef CONFIG_IPW2100_DEBUG 11759 #endif 11760 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 11761 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 11762 #define MAX_RESET_BACKOFF 10 11763 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 11764 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 11765 #ifndef CONFIG_PM 11766 #endif 11767 #ifdef CONFIG_PM 11768 #else 11769 #endif 11770 #ifndef CONFIG_PM 11771 #endif 11772 #define MAX_RF_KILL_CHECKS 5 11773 #define RF_KILL_CHECK_DELAY 40 11774 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 11775 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 11776 #define MAC_ASSOCIATION_READ_DELAY (HZ) 11777 #ifdef CONFIG_IPW2100_DEBUG 11778 #define IPW2100_HANDLER(v, f) { v, f, # v } 11779 #else 11780 #define IPW2100_HANDLER(v, f) { v, f } 11781 #endif 11782 #ifdef CONFIG_IPW2100_DEBUG 11783 #endif 11784 #ifdef CONFIG_IPW2100_DEBUG 11785 #endif 11786 #define SEARCH_ERROR 0xffffffff 11787 #define SEARCH_FAIL 0xfffffffe 11788 #define SEARCH_SUCCESS 0xfffffff0 11789 #define SEARCH_DISCARD 0 11790 #define SEARCH_SNAPSHOT 1 11791 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 11792 #ifdef IPW2100_DEBUG_C3 11793 #endif 11794 #ifdef IPW2100_RX_DEBUG 11795 #endif 11796 #ifdef IPW2100_DEBUG_C3 11797 #endif 11798 #ifdef IPW2100_DEBUG_C3 11799 #endif 11800 #ifdef IPW2100_RX_DEBUG 11801 #endif 11802 #ifdef IPW2100_RX_DEBUG 11803 #endif 11804 #ifdef CONFIG_IPW2100_MONITOR 11805 #endif 11806 #ifdef CONFIG_IPW2100_MONITOR 11807 #else 11808 #endif 11809 #ifdef CONFIG_IPW2100_MONITOR 11810 #endif 11811 #ifdef CONFIG_IPW2100_DEBUG 11812 #endif 11813 #ifdef CONFIG_IPW2100_DEBUG 11814 #endif 11815 #ifdef CONFIG_IPW2100_DEBUG 11816 #endif 11817 #define IPW2100_REG(x) { IPW_ ##x, #x } 11818 #define IPW2100_NIC(x, s) { x, #x, s } 11819 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 11820 #ifdef CONFIG_IPW2100_DEBUG 11821 #endif 11822 #ifdef CONFIG_IPW2100_MONITOR 11823 #endif 11824 #ifdef CONFIG_PM 11825 #endif 11826 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 11827 #ifdef CONFIG_IPW2100_DEBUG 11828 #endif 11829 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 11830 #endif 11831 #ifdef IPW2100_TX_POWER 11832 #endif 11833 #if 0 11834 #endif 11835 #ifdef CONFIG_IPW2100_DEBUG 11836 #endif 11837 #define IPW_PRIVACY_CAPABLE 0x0008 11838 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 11839 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 11840 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 11841 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 11842 #ifdef CONFIG_IPW2100_MONITOR 11843 #endif 11844 /* LDV_COMMENT_END_PREP */ 11845 /* LDV_COMMENT_FUNCTION_CALL Function from field "ndo_stop" from driver structure with callbacks "ipw2100_netdev_ops". Standart function test for correct return result. */ 11846 ldv_handler_precall(); 11847 res_ipw2100_close_137 = ipw2100_close( var_group1); 11848 ldv_check_return_value(res_ipw2100_close_137); 11849 if(res_ipw2100_close_137) 11850 goto ldv_module_exit; 11851 /* LDV_COMMENT_BEGIN_PREP */ 11852 #ifdef CONFIG_IPW2100_MONITOR 11853 #endif 11854 #ifdef CONFIG_IPW2100_MONITOR 11855 #endif 11856 #ifdef CONFIG_IPW2100_MONITOR 11857 #endif 11858 #ifdef CONFIG_PM 11859 #endif 11860 #ifdef CONFIG_PM 11861 #endif 11862 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 11863 #ifdef CONFIG_PM 11864 #endif 11865 #ifdef CONFIG_IPW2100_DEBUG 11866 #endif 11867 #ifdef CONFIG_IPW2100_DEBUG 11868 #endif 11869 #ifdef CONFIG_IPW2100_MONITOR 11870 #endif 11871 #define POWER_MODES 5 11872 #ifdef CONFIG_IPW2100_MONITOR 11873 #endif 11874 #define MAX_POWER_STRING 80 11875 #ifdef CONFIG_IPW2100_MONITOR 11876 #endif 11877 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 11878 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 11879 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 11880 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 11881 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 11882 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 11883 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 11884 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 11885 #ifdef CONFIG_IPW2100_MONITOR 11886 #endif 11887 #ifdef CONFIG_IPW2100_MONITOR 11888 #endif 11889 #ifdef CONFIG_IPW2100_MONITOR 11890 #else 11891 #endif 11892 #ifdef CONFIG_IPW2100_MONITOR 11893 #else 11894 #endif 11895 #ifdef CONFIG_IPW2100_DEBUG 11896 #endif 11897 #define IPW2100_FW_MAJOR_VERSION 1 11898 #define IPW2100_FW_MINOR_VERSION 3 11899 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 11900 #define IPW2100_FW_MAJOR(x) (x & 0xff) 11901 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 11902 IPW2100_FW_MAJOR_VERSION) 11903 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 11904 "." __stringify(IPW2100_FW_MINOR_VERSION) 11905 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 11906 #ifdef CONFIG_IPW2100_MONITOR 11907 #endif 11908 #ifdef CONFIG_IPW2100_MONITOR 11909 #endif 11910 /* LDV_COMMENT_END_PREP */ 11911 ldv_s_ipw2100_netdev_ops_net_device_ops=0; 11912 11913 } 11914 11915 } 11916 11917 break; 11918 case 4: { 11919 11920 /** STRUCT: struct type: net_device_ops, struct name: ipw2100_netdev_ops **/ 11921 11922 11923 /* content: static void ipw2100_tx_timeout(struct net_device *dev)*/ 11924 /* LDV_COMMENT_BEGIN_PREP */ 11925 #define IPW2100_VERSION "git-1.2.2" 11926 #define DRV_NAME "ipw2100" 11927 #define DRV_VERSION IPW2100_VERSION 11928 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 11929 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 11930 #ifdef CONFIG_IPW2100_DEBUG 11931 #define IPW2100_RX_DEBUG 11932 #endif 11933 #ifdef CONFIG_PM 11934 #endif 11935 #ifdef CONFIG_IPW2100_DEBUG 11936 #define IPW_DEBUG(level, message...) \ 11937 do { \ 11938 if (ipw2100_debug_level & (level)) { \ 11939 printk(KERN_DEBUG "ipw2100: %c %s ", \ 11940 in_interrupt() ? 'I' : 'U', __func__); \ 11941 printk(message); \ 11942 } \ 11943 } while (0) 11944 #else 11945 #define IPW_DEBUG(level, message...) do {} while (0) 11946 #endif 11947 #ifdef CONFIG_IPW2100_DEBUG 11948 #endif 11949 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 11950 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 11951 #define MAX_RESET_BACKOFF 10 11952 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 11953 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 11954 #ifndef CONFIG_PM 11955 #endif 11956 #ifdef CONFIG_PM 11957 #else 11958 #endif 11959 #ifndef CONFIG_PM 11960 #endif 11961 #define MAX_RF_KILL_CHECKS 5 11962 #define RF_KILL_CHECK_DELAY 40 11963 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 11964 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 11965 #define MAC_ASSOCIATION_READ_DELAY (HZ) 11966 #ifdef CONFIG_IPW2100_DEBUG 11967 #define IPW2100_HANDLER(v, f) { v, f, # v } 11968 #else 11969 #define IPW2100_HANDLER(v, f) { v, f } 11970 #endif 11971 #ifdef CONFIG_IPW2100_DEBUG 11972 #endif 11973 #ifdef CONFIG_IPW2100_DEBUG 11974 #endif 11975 #define SEARCH_ERROR 0xffffffff 11976 #define SEARCH_FAIL 0xfffffffe 11977 #define SEARCH_SUCCESS 0xfffffff0 11978 #define SEARCH_DISCARD 0 11979 #define SEARCH_SNAPSHOT 1 11980 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 11981 #ifdef IPW2100_DEBUG_C3 11982 #endif 11983 #ifdef IPW2100_RX_DEBUG 11984 #endif 11985 #ifdef IPW2100_DEBUG_C3 11986 #endif 11987 #ifdef IPW2100_DEBUG_C3 11988 #endif 11989 #ifdef IPW2100_RX_DEBUG 11990 #endif 11991 #ifdef IPW2100_RX_DEBUG 11992 #endif 11993 #ifdef CONFIG_IPW2100_MONITOR 11994 #endif 11995 #ifdef CONFIG_IPW2100_MONITOR 11996 #else 11997 #endif 11998 #ifdef CONFIG_IPW2100_MONITOR 11999 #endif 12000 #ifdef CONFIG_IPW2100_DEBUG 12001 #endif 12002 #ifdef CONFIG_IPW2100_DEBUG 12003 #endif 12004 #ifdef CONFIG_IPW2100_DEBUG 12005 #endif 12006 #define IPW2100_REG(x) { IPW_ ##x, #x } 12007 #define IPW2100_NIC(x, s) { x, #x, s } 12008 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 12009 #ifdef CONFIG_IPW2100_DEBUG 12010 #endif 12011 #ifdef CONFIG_IPW2100_MONITOR 12012 #endif 12013 #ifdef CONFIG_PM 12014 #endif 12015 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 12016 #ifdef CONFIG_IPW2100_DEBUG 12017 #endif 12018 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 12019 #endif 12020 #ifdef IPW2100_TX_POWER 12021 #endif 12022 #if 0 12023 #endif 12024 #ifdef CONFIG_IPW2100_DEBUG 12025 #endif 12026 #define IPW_PRIVACY_CAPABLE 0x0008 12027 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 12028 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 12029 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 12030 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 12031 #ifdef CONFIG_IPW2100_MONITOR 12032 #endif 12033 /* LDV_COMMENT_END_PREP */ 12034 /* LDV_COMMENT_FUNCTION_CALL Function from field "ndo_tx_timeout" from driver structure with callbacks "ipw2100_netdev_ops" */ 12035 ldv_handler_precall(); 12036 ipw2100_tx_timeout( var_group1); 12037 /* LDV_COMMENT_BEGIN_PREP */ 12038 #ifdef CONFIG_IPW2100_MONITOR 12039 #endif 12040 #ifdef CONFIG_IPW2100_MONITOR 12041 #endif 12042 #ifdef CONFIG_PM 12043 #endif 12044 #ifdef CONFIG_PM 12045 #endif 12046 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 12047 #ifdef CONFIG_PM 12048 #endif 12049 #ifdef CONFIG_IPW2100_DEBUG 12050 #endif 12051 #ifdef CONFIG_IPW2100_DEBUG 12052 #endif 12053 #ifdef CONFIG_IPW2100_MONITOR 12054 #endif 12055 #define POWER_MODES 5 12056 #ifdef CONFIG_IPW2100_MONITOR 12057 #endif 12058 #define MAX_POWER_STRING 80 12059 #ifdef CONFIG_IPW2100_MONITOR 12060 #endif 12061 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 12062 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 12063 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 12064 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 12065 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 12066 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 12067 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 12068 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 12069 #ifdef CONFIG_IPW2100_MONITOR 12070 #endif 12071 #ifdef CONFIG_IPW2100_MONITOR 12072 #endif 12073 #ifdef CONFIG_IPW2100_MONITOR 12074 #else 12075 #endif 12076 #ifdef CONFIG_IPW2100_MONITOR 12077 #else 12078 #endif 12079 #ifdef CONFIG_IPW2100_DEBUG 12080 #endif 12081 #define IPW2100_FW_MAJOR_VERSION 1 12082 #define IPW2100_FW_MINOR_VERSION 3 12083 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 12084 #define IPW2100_FW_MAJOR(x) (x & 0xff) 12085 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 12086 IPW2100_FW_MAJOR_VERSION) 12087 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 12088 "." __stringify(IPW2100_FW_MINOR_VERSION) 12089 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 12090 #ifdef CONFIG_IPW2100_MONITOR 12091 #endif 12092 #ifdef CONFIG_IPW2100_MONITOR 12093 #endif 12094 /* LDV_COMMENT_END_PREP */ 12095 12096 12097 12098 12099 } 12100 12101 break; 12102 case 5: { 12103 12104 /** STRUCT: struct type: net_device_ops, struct name: ipw2100_netdev_ops **/ 12105 12106 12107 /* content: static int ipw2100_set_address(struct net_device *dev, void *p)*/ 12108 /* LDV_COMMENT_BEGIN_PREP */ 12109 #define IPW2100_VERSION "git-1.2.2" 12110 #define DRV_NAME "ipw2100" 12111 #define DRV_VERSION IPW2100_VERSION 12112 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 12113 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 12114 #ifdef CONFIG_IPW2100_DEBUG 12115 #define IPW2100_RX_DEBUG 12116 #endif 12117 #ifdef CONFIG_PM 12118 #endif 12119 #ifdef CONFIG_IPW2100_DEBUG 12120 #define IPW_DEBUG(level, message...) \ 12121 do { \ 12122 if (ipw2100_debug_level & (level)) { \ 12123 printk(KERN_DEBUG "ipw2100: %c %s ", \ 12124 in_interrupt() ? 'I' : 'U', __func__); \ 12125 printk(message); \ 12126 } \ 12127 } while (0) 12128 #else 12129 #define IPW_DEBUG(level, message...) do {} while (0) 12130 #endif 12131 #ifdef CONFIG_IPW2100_DEBUG 12132 #endif 12133 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 12134 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 12135 #define MAX_RESET_BACKOFF 10 12136 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 12137 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 12138 #ifndef CONFIG_PM 12139 #endif 12140 #ifdef CONFIG_PM 12141 #else 12142 #endif 12143 #ifndef CONFIG_PM 12144 #endif 12145 #define MAX_RF_KILL_CHECKS 5 12146 #define RF_KILL_CHECK_DELAY 40 12147 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 12148 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 12149 #define MAC_ASSOCIATION_READ_DELAY (HZ) 12150 #ifdef CONFIG_IPW2100_DEBUG 12151 #define IPW2100_HANDLER(v, f) { v, f, # v } 12152 #else 12153 #define IPW2100_HANDLER(v, f) { v, f } 12154 #endif 12155 #ifdef CONFIG_IPW2100_DEBUG 12156 #endif 12157 #ifdef CONFIG_IPW2100_DEBUG 12158 #endif 12159 #define SEARCH_ERROR 0xffffffff 12160 #define SEARCH_FAIL 0xfffffffe 12161 #define SEARCH_SUCCESS 0xfffffff0 12162 #define SEARCH_DISCARD 0 12163 #define SEARCH_SNAPSHOT 1 12164 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 12165 #ifdef IPW2100_DEBUG_C3 12166 #endif 12167 #ifdef IPW2100_RX_DEBUG 12168 #endif 12169 #ifdef IPW2100_DEBUG_C3 12170 #endif 12171 #ifdef IPW2100_DEBUG_C3 12172 #endif 12173 #ifdef IPW2100_RX_DEBUG 12174 #endif 12175 #ifdef IPW2100_RX_DEBUG 12176 #endif 12177 #ifdef CONFIG_IPW2100_MONITOR 12178 #endif 12179 #ifdef CONFIG_IPW2100_MONITOR 12180 #else 12181 #endif 12182 #ifdef CONFIG_IPW2100_MONITOR 12183 #endif 12184 #ifdef CONFIG_IPW2100_DEBUG 12185 #endif 12186 #ifdef CONFIG_IPW2100_DEBUG 12187 #endif 12188 #ifdef CONFIG_IPW2100_DEBUG 12189 #endif 12190 #define IPW2100_REG(x) { IPW_ ##x, #x } 12191 #define IPW2100_NIC(x, s) { x, #x, s } 12192 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 12193 #ifdef CONFIG_IPW2100_DEBUG 12194 #endif 12195 #ifdef CONFIG_IPW2100_MONITOR 12196 #endif 12197 #ifdef CONFIG_PM 12198 #endif 12199 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 12200 #ifdef CONFIG_IPW2100_DEBUG 12201 #endif 12202 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 12203 #endif 12204 #ifdef IPW2100_TX_POWER 12205 #endif 12206 #if 0 12207 #endif 12208 #ifdef CONFIG_IPW2100_DEBUG 12209 #endif 12210 #define IPW_PRIVACY_CAPABLE 0x0008 12211 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 12212 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 12213 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 12214 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 12215 #ifdef CONFIG_IPW2100_MONITOR 12216 #endif 12217 /* LDV_COMMENT_END_PREP */ 12218 /* LDV_COMMENT_FUNCTION_CALL Function from field "ndo_set_mac_address" from driver structure with callbacks "ipw2100_netdev_ops" */ 12219 ldv_handler_precall(); 12220 ipw2100_set_address( var_group1, var_ipw2100_set_address_135_p1); 12221 /* LDV_COMMENT_BEGIN_PREP */ 12222 #ifdef CONFIG_IPW2100_MONITOR 12223 #endif 12224 #ifdef CONFIG_IPW2100_MONITOR 12225 #endif 12226 #ifdef CONFIG_IPW2100_MONITOR 12227 #endif 12228 #ifdef CONFIG_PM 12229 #endif 12230 #ifdef CONFIG_PM 12231 #endif 12232 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 12233 #ifdef CONFIG_PM 12234 #endif 12235 #ifdef CONFIG_IPW2100_DEBUG 12236 #endif 12237 #ifdef CONFIG_IPW2100_DEBUG 12238 #endif 12239 #ifdef CONFIG_IPW2100_MONITOR 12240 #endif 12241 #define POWER_MODES 5 12242 #ifdef CONFIG_IPW2100_MONITOR 12243 #endif 12244 #define MAX_POWER_STRING 80 12245 #ifdef CONFIG_IPW2100_MONITOR 12246 #endif 12247 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 12248 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 12249 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 12250 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 12251 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 12252 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 12253 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 12254 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 12255 #ifdef CONFIG_IPW2100_MONITOR 12256 #endif 12257 #ifdef CONFIG_IPW2100_MONITOR 12258 #endif 12259 #ifdef CONFIG_IPW2100_MONITOR 12260 #else 12261 #endif 12262 #ifdef CONFIG_IPW2100_MONITOR 12263 #else 12264 #endif 12265 #ifdef CONFIG_IPW2100_DEBUG 12266 #endif 12267 #define IPW2100_FW_MAJOR_VERSION 1 12268 #define IPW2100_FW_MINOR_VERSION 3 12269 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 12270 #define IPW2100_FW_MAJOR(x) (x & 0xff) 12271 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 12272 IPW2100_FW_MAJOR_VERSION) 12273 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 12274 "." __stringify(IPW2100_FW_MINOR_VERSION) 12275 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 12276 #ifdef CONFIG_IPW2100_MONITOR 12277 #endif 12278 #ifdef CONFIG_IPW2100_MONITOR 12279 #endif 12280 /* LDV_COMMENT_END_PREP */ 12281 12282 12283 12284 12285 } 12286 12287 break; 12288 case 6: { 12289 12290 /** STRUCT: struct type: pci_driver, struct name: ipw2100_pci_driver **/ 12291 if(ldv_s_ipw2100_pci_driver_pci_driver==0) { 12292 12293 /* content: static int ipw2100_pci_init_one(struct pci_dev *pci_dev, const struct pci_device_id *ent)*/ 12294 /* LDV_COMMENT_BEGIN_PREP */ 12295 #define IPW2100_VERSION "git-1.2.2" 12296 #define DRV_NAME "ipw2100" 12297 #define DRV_VERSION IPW2100_VERSION 12298 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 12299 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 12300 #ifdef CONFIG_IPW2100_DEBUG 12301 #define IPW2100_RX_DEBUG 12302 #endif 12303 #ifdef CONFIG_PM 12304 #endif 12305 #ifdef CONFIG_IPW2100_DEBUG 12306 #define IPW_DEBUG(level, message...) \ 12307 do { \ 12308 if (ipw2100_debug_level & (level)) { \ 12309 printk(KERN_DEBUG "ipw2100: %c %s ", \ 12310 in_interrupt() ? 'I' : 'U', __func__); \ 12311 printk(message); \ 12312 } \ 12313 } while (0) 12314 #else 12315 #define IPW_DEBUG(level, message...) do {} while (0) 12316 #endif 12317 #ifdef CONFIG_IPW2100_DEBUG 12318 #endif 12319 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 12320 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 12321 #define MAX_RESET_BACKOFF 10 12322 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 12323 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 12324 #ifndef CONFIG_PM 12325 #endif 12326 #ifdef CONFIG_PM 12327 #else 12328 #endif 12329 #ifndef CONFIG_PM 12330 #endif 12331 #define MAX_RF_KILL_CHECKS 5 12332 #define RF_KILL_CHECK_DELAY 40 12333 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 12334 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 12335 #define MAC_ASSOCIATION_READ_DELAY (HZ) 12336 #ifdef CONFIG_IPW2100_DEBUG 12337 #define IPW2100_HANDLER(v, f) { v, f, # v } 12338 #else 12339 #define IPW2100_HANDLER(v, f) { v, f } 12340 #endif 12341 #ifdef CONFIG_IPW2100_DEBUG 12342 #endif 12343 #ifdef CONFIG_IPW2100_DEBUG 12344 #endif 12345 #define SEARCH_ERROR 0xffffffff 12346 #define SEARCH_FAIL 0xfffffffe 12347 #define SEARCH_SUCCESS 0xfffffff0 12348 #define SEARCH_DISCARD 0 12349 #define SEARCH_SNAPSHOT 1 12350 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 12351 #ifdef IPW2100_DEBUG_C3 12352 #endif 12353 #ifdef IPW2100_RX_DEBUG 12354 #endif 12355 #ifdef IPW2100_DEBUG_C3 12356 #endif 12357 #ifdef IPW2100_DEBUG_C3 12358 #endif 12359 #ifdef IPW2100_RX_DEBUG 12360 #endif 12361 #ifdef IPW2100_RX_DEBUG 12362 #endif 12363 #ifdef CONFIG_IPW2100_MONITOR 12364 #endif 12365 #ifdef CONFIG_IPW2100_MONITOR 12366 #else 12367 #endif 12368 #ifdef CONFIG_IPW2100_MONITOR 12369 #endif 12370 #ifdef CONFIG_IPW2100_DEBUG 12371 #endif 12372 #ifdef CONFIG_IPW2100_DEBUG 12373 #endif 12374 #ifdef CONFIG_IPW2100_DEBUG 12375 #endif 12376 #define IPW2100_REG(x) { IPW_ ##x, #x } 12377 #define IPW2100_NIC(x, s) { x, #x, s } 12378 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 12379 #ifdef CONFIG_IPW2100_DEBUG 12380 #endif 12381 #ifdef CONFIG_IPW2100_MONITOR 12382 #endif 12383 #ifdef CONFIG_PM 12384 #endif 12385 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 12386 #ifdef CONFIG_IPW2100_DEBUG 12387 #endif 12388 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 12389 #endif 12390 #ifdef IPW2100_TX_POWER 12391 #endif 12392 #if 0 12393 #endif 12394 #ifdef CONFIG_IPW2100_DEBUG 12395 #endif 12396 #define IPW_PRIVACY_CAPABLE 0x0008 12397 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 12398 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 12399 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 12400 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 12401 #ifdef CONFIG_IPW2100_MONITOR 12402 #endif 12403 #ifdef CONFIG_IPW2100_MONITOR 12404 #endif 12405 #ifdef CONFIG_IPW2100_MONITOR 12406 #endif 12407 #ifdef CONFIG_IPW2100_MONITOR 12408 #endif 12409 /* LDV_COMMENT_END_PREP */ 12410 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "ipw2100_pci_driver". Standart function test for correct return result. */ 12411 res_ipw2100_pci_init_one_147 = ipw2100_pci_init_one( var_group3, var_ipw2100_pci_init_one_147_p1); 12412 ldv_check_return_value(res_ipw2100_pci_init_one_147); 12413 ldv_check_return_value_probe(res_ipw2100_pci_init_one_147); 12414 if(res_ipw2100_pci_init_one_147) 12415 goto ldv_module_exit; 12416 /* LDV_COMMENT_BEGIN_PREP */ 12417 #ifdef CONFIG_PM 12418 #endif 12419 #ifdef CONFIG_PM 12420 #endif 12421 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 12422 #ifdef CONFIG_PM 12423 #endif 12424 #ifdef CONFIG_IPW2100_DEBUG 12425 #endif 12426 #ifdef CONFIG_IPW2100_DEBUG 12427 #endif 12428 #ifdef CONFIG_IPW2100_MONITOR 12429 #endif 12430 #define POWER_MODES 5 12431 #ifdef CONFIG_IPW2100_MONITOR 12432 #endif 12433 #define MAX_POWER_STRING 80 12434 #ifdef CONFIG_IPW2100_MONITOR 12435 #endif 12436 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 12437 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 12438 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 12439 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 12440 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 12441 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 12442 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 12443 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 12444 #ifdef CONFIG_IPW2100_MONITOR 12445 #endif 12446 #ifdef CONFIG_IPW2100_MONITOR 12447 #endif 12448 #ifdef CONFIG_IPW2100_MONITOR 12449 #else 12450 #endif 12451 #ifdef CONFIG_IPW2100_MONITOR 12452 #else 12453 #endif 12454 #ifdef CONFIG_IPW2100_DEBUG 12455 #endif 12456 #define IPW2100_FW_MAJOR_VERSION 1 12457 #define IPW2100_FW_MINOR_VERSION 3 12458 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 12459 #define IPW2100_FW_MAJOR(x) (x & 0xff) 12460 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 12461 IPW2100_FW_MAJOR_VERSION) 12462 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 12463 "." __stringify(IPW2100_FW_MINOR_VERSION) 12464 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 12465 #ifdef CONFIG_IPW2100_MONITOR 12466 #endif 12467 #ifdef CONFIG_IPW2100_MONITOR 12468 #endif 12469 /* LDV_COMMENT_END_PREP */ 12470 ldv_s_ipw2100_pci_driver_pci_driver++; 12471 12472 } 12473 12474 } 12475 12476 break; 12477 case 7: { 12478 12479 /** STRUCT: struct type: pci_driver, struct name: ipw2100_pci_driver **/ 12480 if(ldv_s_ipw2100_pci_driver_pci_driver==1) { 12481 12482 /* content: static void ipw2100_pci_remove_one(struct pci_dev *pci_dev)*/ 12483 /* LDV_COMMENT_BEGIN_PREP */ 12484 #define IPW2100_VERSION "git-1.2.2" 12485 #define DRV_NAME "ipw2100" 12486 #define DRV_VERSION IPW2100_VERSION 12487 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 12488 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 12489 #ifdef CONFIG_IPW2100_DEBUG 12490 #define IPW2100_RX_DEBUG 12491 #endif 12492 #ifdef CONFIG_PM 12493 #endif 12494 #ifdef CONFIG_IPW2100_DEBUG 12495 #define IPW_DEBUG(level, message...) \ 12496 do { \ 12497 if (ipw2100_debug_level & (level)) { \ 12498 printk(KERN_DEBUG "ipw2100: %c %s ", \ 12499 in_interrupt() ? 'I' : 'U', __func__); \ 12500 printk(message); \ 12501 } \ 12502 } while (0) 12503 #else 12504 #define IPW_DEBUG(level, message...) do {} while (0) 12505 #endif 12506 #ifdef CONFIG_IPW2100_DEBUG 12507 #endif 12508 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 12509 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 12510 #define MAX_RESET_BACKOFF 10 12511 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 12512 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 12513 #ifndef CONFIG_PM 12514 #endif 12515 #ifdef CONFIG_PM 12516 #else 12517 #endif 12518 #ifndef CONFIG_PM 12519 #endif 12520 #define MAX_RF_KILL_CHECKS 5 12521 #define RF_KILL_CHECK_DELAY 40 12522 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 12523 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 12524 #define MAC_ASSOCIATION_READ_DELAY (HZ) 12525 #ifdef CONFIG_IPW2100_DEBUG 12526 #define IPW2100_HANDLER(v, f) { v, f, # v } 12527 #else 12528 #define IPW2100_HANDLER(v, f) { v, f } 12529 #endif 12530 #ifdef CONFIG_IPW2100_DEBUG 12531 #endif 12532 #ifdef CONFIG_IPW2100_DEBUG 12533 #endif 12534 #define SEARCH_ERROR 0xffffffff 12535 #define SEARCH_FAIL 0xfffffffe 12536 #define SEARCH_SUCCESS 0xfffffff0 12537 #define SEARCH_DISCARD 0 12538 #define SEARCH_SNAPSHOT 1 12539 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 12540 #ifdef IPW2100_DEBUG_C3 12541 #endif 12542 #ifdef IPW2100_RX_DEBUG 12543 #endif 12544 #ifdef IPW2100_DEBUG_C3 12545 #endif 12546 #ifdef IPW2100_DEBUG_C3 12547 #endif 12548 #ifdef IPW2100_RX_DEBUG 12549 #endif 12550 #ifdef IPW2100_RX_DEBUG 12551 #endif 12552 #ifdef CONFIG_IPW2100_MONITOR 12553 #endif 12554 #ifdef CONFIG_IPW2100_MONITOR 12555 #else 12556 #endif 12557 #ifdef CONFIG_IPW2100_MONITOR 12558 #endif 12559 #ifdef CONFIG_IPW2100_DEBUG 12560 #endif 12561 #ifdef CONFIG_IPW2100_DEBUG 12562 #endif 12563 #ifdef CONFIG_IPW2100_DEBUG 12564 #endif 12565 #define IPW2100_REG(x) { IPW_ ##x, #x } 12566 #define IPW2100_NIC(x, s) { x, #x, s } 12567 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 12568 #ifdef CONFIG_IPW2100_DEBUG 12569 #endif 12570 #ifdef CONFIG_IPW2100_MONITOR 12571 #endif 12572 #ifdef CONFIG_PM 12573 #endif 12574 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 12575 #ifdef CONFIG_IPW2100_DEBUG 12576 #endif 12577 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 12578 #endif 12579 #ifdef IPW2100_TX_POWER 12580 #endif 12581 #if 0 12582 #endif 12583 #ifdef CONFIG_IPW2100_DEBUG 12584 #endif 12585 #define IPW_PRIVACY_CAPABLE 0x0008 12586 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 12587 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 12588 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 12589 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 12590 #ifdef CONFIG_IPW2100_MONITOR 12591 #endif 12592 #ifdef CONFIG_IPW2100_MONITOR 12593 #endif 12594 #ifdef CONFIG_IPW2100_MONITOR 12595 #endif 12596 #ifdef CONFIG_IPW2100_MONITOR 12597 #endif 12598 /* LDV_COMMENT_END_PREP */ 12599 /* LDV_COMMENT_FUNCTION_CALL Function from field "remove" from driver structure with callbacks "ipw2100_pci_driver" */ 12600 ldv_handler_precall(); 12601 ipw2100_pci_remove_one( var_group3); 12602 /* LDV_COMMENT_BEGIN_PREP */ 12603 #ifdef CONFIG_PM 12604 #endif 12605 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 12606 #ifdef CONFIG_PM 12607 #endif 12608 #ifdef CONFIG_IPW2100_DEBUG 12609 #endif 12610 #ifdef CONFIG_IPW2100_DEBUG 12611 #endif 12612 #ifdef CONFIG_IPW2100_MONITOR 12613 #endif 12614 #define POWER_MODES 5 12615 #ifdef CONFIG_IPW2100_MONITOR 12616 #endif 12617 #define MAX_POWER_STRING 80 12618 #ifdef CONFIG_IPW2100_MONITOR 12619 #endif 12620 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 12621 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 12622 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 12623 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 12624 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 12625 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 12626 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 12627 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 12628 #ifdef CONFIG_IPW2100_MONITOR 12629 #endif 12630 #ifdef CONFIG_IPW2100_MONITOR 12631 #endif 12632 #ifdef CONFIG_IPW2100_MONITOR 12633 #else 12634 #endif 12635 #ifdef CONFIG_IPW2100_MONITOR 12636 #else 12637 #endif 12638 #ifdef CONFIG_IPW2100_DEBUG 12639 #endif 12640 #define IPW2100_FW_MAJOR_VERSION 1 12641 #define IPW2100_FW_MINOR_VERSION 3 12642 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 12643 #define IPW2100_FW_MAJOR(x) (x & 0xff) 12644 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 12645 IPW2100_FW_MAJOR_VERSION) 12646 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 12647 "." __stringify(IPW2100_FW_MINOR_VERSION) 12648 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 12649 #ifdef CONFIG_IPW2100_MONITOR 12650 #endif 12651 #ifdef CONFIG_IPW2100_MONITOR 12652 #endif 12653 /* LDV_COMMENT_END_PREP */ 12654 ldv_s_ipw2100_pci_driver_pci_driver=0; 12655 12656 } 12657 12658 } 12659 12660 break; 12661 case 8: { 12662 12663 /** STRUCT: struct type: pci_driver, struct name: ipw2100_pci_driver **/ 12664 12665 12666 /* content: static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state)*/ 12667 /* LDV_COMMENT_BEGIN_PREP */ 12668 #define IPW2100_VERSION "git-1.2.2" 12669 #define DRV_NAME "ipw2100" 12670 #define DRV_VERSION IPW2100_VERSION 12671 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 12672 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 12673 #ifdef CONFIG_IPW2100_DEBUG 12674 #define IPW2100_RX_DEBUG 12675 #endif 12676 #ifdef CONFIG_PM 12677 #endif 12678 #ifdef CONFIG_IPW2100_DEBUG 12679 #define IPW_DEBUG(level, message...) \ 12680 do { \ 12681 if (ipw2100_debug_level & (level)) { \ 12682 printk(KERN_DEBUG "ipw2100: %c %s ", \ 12683 in_interrupt() ? 'I' : 'U', __func__); \ 12684 printk(message); \ 12685 } \ 12686 } while (0) 12687 #else 12688 #define IPW_DEBUG(level, message...) do {} while (0) 12689 #endif 12690 #ifdef CONFIG_IPW2100_DEBUG 12691 #endif 12692 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 12693 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 12694 #define MAX_RESET_BACKOFF 10 12695 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 12696 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 12697 #ifndef CONFIG_PM 12698 #endif 12699 #ifdef CONFIG_PM 12700 #else 12701 #endif 12702 #ifndef CONFIG_PM 12703 #endif 12704 #define MAX_RF_KILL_CHECKS 5 12705 #define RF_KILL_CHECK_DELAY 40 12706 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 12707 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 12708 #define MAC_ASSOCIATION_READ_DELAY (HZ) 12709 #ifdef CONFIG_IPW2100_DEBUG 12710 #define IPW2100_HANDLER(v, f) { v, f, # v } 12711 #else 12712 #define IPW2100_HANDLER(v, f) { v, f } 12713 #endif 12714 #ifdef CONFIG_IPW2100_DEBUG 12715 #endif 12716 #ifdef CONFIG_IPW2100_DEBUG 12717 #endif 12718 #define SEARCH_ERROR 0xffffffff 12719 #define SEARCH_FAIL 0xfffffffe 12720 #define SEARCH_SUCCESS 0xfffffff0 12721 #define SEARCH_DISCARD 0 12722 #define SEARCH_SNAPSHOT 1 12723 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 12724 #ifdef IPW2100_DEBUG_C3 12725 #endif 12726 #ifdef IPW2100_RX_DEBUG 12727 #endif 12728 #ifdef IPW2100_DEBUG_C3 12729 #endif 12730 #ifdef IPW2100_DEBUG_C3 12731 #endif 12732 #ifdef IPW2100_RX_DEBUG 12733 #endif 12734 #ifdef IPW2100_RX_DEBUG 12735 #endif 12736 #ifdef CONFIG_IPW2100_MONITOR 12737 #endif 12738 #ifdef CONFIG_IPW2100_MONITOR 12739 #else 12740 #endif 12741 #ifdef CONFIG_IPW2100_MONITOR 12742 #endif 12743 #ifdef CONFIG_IPW2100_DEBUG 12744 #endif 12745 #ifdef CONFIG_IPW2100_DEBUG 12746 #endif 12747 #ifdef CONFIG_IPW2100_DEBUG 12748 #endif 12749 #define IPW2100_REG(x) { IPW_ ##x, #x } 12750 #define IPW2100_NIC(x, s) { x, #x, s } 12751 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 12752 #ifdef CONFIG_IPW2100_DEBUG 12753 #endif 12754 #ifdef CONFIG_IPW2100_MONITOR 12755 #endif 12756 #ifdef CONFIG_PM 12757 #endif 12758 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 12759 #ifdef CONFIG_IPW2100_DEBUG 12760 #endif 12761 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 12762 #endif 12763 #ifdef IPW2100_TX_POWER 12764 #endif 12765 #if 0 12766 #endif 12767 #ifdef CONFIG_IPW2100_DEBUG 12768 #endif 12769 #define IPW_PRIVACY_CAPABLE 0x0008 12770 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 12771 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 12772 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 12773 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 12774 #ifdef CONFIG_IPW2100_MONITOR 12775 #endif 12776 #ifdef CONFIG_IPW2100_MONITOR 12777 #endif 12778 #ifdef CONFIG_IPW2100_MONITOR 12779 #endif 12780 #ifdef CONFIG_IPW2100_MONITOR 12781 #endif 12782 #ifdef CONFIG_PM 12783 #endif 12784 #ifdef CONFIG_PM 12785 /* LDV_COMMENT_END_PREP */ 12786 /* LDV_COMMENT_FUNCTION_CALL Function from field "suspend" from driver structure with callbacks "ipw2100_pci_driver" */ 12787 ldv_handler_precall(); 12788 ipw2100_suspend( var_group3, var_ipw2100_suspend_149_p1); 12789 /* LDV_COMMENT_BEGIN_PREP */ 12790 #endif 12791 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 12792 #ifdef CONFIG_PM 12793 #endif 12794 #ifdef CONFIG_IPW2100_DEBUG 12795 #endif 12796 #ifdef CONFIG_IPW2100_DEBUG 12797 #endif 12798 #ifdef CONFIG_IPW2100_MONITOR 12799 #endif 12800 #define POWER_MODES 5 12801 #ifdef CONFIG_IPW2100_MONITOR 12802 #endif 12803 #define MAX_POWER_STRING 80 12804 #ifdef CONFIG_IPW2100_MONITOR 12805 #endif 12806 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 12807 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 12808 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 12809 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 12810 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 12811 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 12812 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 12813 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 12814 #ifdef CONFIG_IPW2100_MONITOR 12815 #endif 12816 #ifdef CONFIG_IPW2100_MONITOR 12817 #endif 12818 #ifdef CONFIG_IPW2100_MONITOR 12819 #else 12820 #endif 12821 #ifdef CONFIG_IPW2100_MONITOR 12822 #else 12823 #endif 12824 #ifdef CONFIG_IPW2100_DEBUG 12825 #endif 12826 #define IPW2100_FW_MAJOR_VERSION 1 12827 #define IPW2100_FW_MINOR_VERSION 3 12828 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 12829 #define IPW2100_FW_MAJOR(x) (x & 0xff) 12830 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 12831 IPW2100_FW_MAJOR_VERSION) 12832 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 12833 "." __stringify(IPW2100_FW_MINOR_VERSION) 12834 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 12835 #ifdef CONFIG_IPW2100_MONITOR 12836 #endif 12837 #ifdef CONFIG_IPW2100_MONITOR 12838 #endif 12839 /* LDV_COMMENT_END_PREP */ 12840 12841 12842 12843 12844 } 12845 12846 break; 12847 case 9: { 12848 12849 /** STRUCT: struct type: pci_driver, struct name: ipw2100_pci_driver **/ 12850 12851 12852 /* content: static int ipw2100_resume(struct pci_dev *pci_dev)*/ 12853 /* LDV_COMMENT_BEGIN_PREP */ 12854 #define IPW2100_VERSION "git-1.2.2" 12855 #define DRV_NAME "ipw2100" 12856 #define DRV_VERSION IPW2100_VERSION 12857 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 12858 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 12859 #ifdef CONFIG_IPW2100_DEBUG 12860 #define IPW2100_RX_DEBUG 12861 #endif 12862 #ifdef CONFIG_PM 12863 #endif 12864 #ifdef CONFIG_IPW2100_DEBUG 12865 #define IPW_DEBUG(level, message...) \ 12866 do { \ 12867 if (ipw2100_debug_level & (level)) { \ 12868 printk(KERN_DEBUG "ipw2100: %c %s ", \ 12869 in_interrupt() ? 'I' : 'U', __func__); \ 12870 printk(message); \ 12871 } \ 12872 } while (0) 12873 #else 12874 #define IPW_DEBUG(level, message...) do {} while (0) 12875 #endif 12876 #ifdef CONFIG_IPW2100_DEBUG 12877 #endif 12878 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 12879 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 12880 #define MAX_RESET_BACKOFF 10 12881 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 12882 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 12883 #ifndef CONFIG_PM 12884 #endif 12885 #ifdef CONFIG_PM 12886 #else 12887 #endif 12888 #ifndef CONFIG_PM 12889 #endif 12890 #define MAX_RF_KILL_CHECKS 5 12891 #define RF_KILL_CHECK_DELAY 40 12892 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 12893 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 12894 #define MAC_ASSOCIATION_READ_DELAY (HZ) 12895 #ifdef CONFIG_IPW2100_DEBUG 12896 #define IPW2100_HANDLER(v, f) { v, f, # v } 12897 #else 12898 #define IPW2100_HANDLER(v, f) { v, f } 12899 #endif 12900 #ifdef CONFIG_IPW2100_DEBUG 12901 #endif 12902 #ifdef CONFIG_IPW2100_DEBUG 12903 #endif 12904 #define SEARCH_ERROR 0xffffffff 12905 #define SEARCH_FAIL 0xfffffffe 12906 #define SEARCH_SUCCESS 0xfffffff0 12907 #define SEARCH_DISCARD 0 12908 #define SEARCH_SNAPSHOT 1 12909 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 12910 #ifdef IPW2100_DEBUG_C3 12911 #endif 12912 #ifdef IPW2100_RX_DEBUG 12913 #endif 12914 #ifdef IPW2100_DEBUG_C3 12915 #endif 12916 #ifdef IPW2100_DEBUG_C3 12917 #endif 12918 #ifdef IPW2100_RX_DEBUG 12919 #endif 12920 #ifdef IPW2100_RX_DEBUG 12921 #endif 12922 #ifdef CONFIG_IPW2100_MONITOR 12923 #endif 12924 #ifdef CONFIG_IPW2100_MONITOR 12925 #else 12926 #endif 12927 #ifdef CONFIG_IPW2100_MONITOR 12928 #endif 12929 #ifdef CONFIG_IPW2100_DEBUG 12930 #endif 12931 #ifdef CONFIG_IPW2100_DEBUG 12932 #endif 12933 #ifdef CONFIG_IPW2100_DEBUG 12934 #endif 12935 #define IPW2100_REG(x) { IPW_ ##x, #x } 12936 #define IPW2100_NIC(x, s) { x, #x, s } 12937 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 12938 #ifdef CONFIG_IPW2100_DEBUG 12939 #endif 12940 #ifdef CONFIG_IPW2100_MONITOR 12941 #endif 12942 #ifdef CONFIG_PM 12943 #endif 12944 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 12945 #ifdef CONFIG_IPW2100_DEBUG 12946 #endif 12947 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 12948 #endif 12949 #ifdef IPW2100_TX_POWER 12950 #endif 12951 #if 0 12952 #endif 12953 #ifdef CONFIG_IPW2100_DEBUG 12954 #endif 12955 #define IPW_PRIVACY_CAPABLE 0x0008 12956 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 12957 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 12958 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 12959 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 12960 #ifdef CONFIG_IPW2100_MONITOR 12961 #endif 12962 #ifdef CONFIG_IPW2100_MONITOR 12963 #endif 12964 #ifdef CONFIG_IPW2100_MONITOR 12965 #endif 12966 #ifdef CONFIG_IPW2100_MONITOR 12967 #endif 12968 #ifdef CONFIG_PM 12969 #endif 12970 #ifdef CONFIG_PM 12971 /* LDV_COMMENT_END_PREP */ 12972 /* LDV_COMMENT_FUNCTION_CALL Function from field "resume" from driver structure with callbacks "ipw2100_pci_driver" */ 12973 ldv_handler_precall(); 12974 ipw2100_resume( var_group3); 12975 /* LDV_COMMENT_BEGIN_PREP */ 12976 #endif 12977 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 12978 #ifdef CONFIG_PM 12979 #endif 12980 #ifdef CONFIG_IPW2100_DEBUG 12981 #endif 12982 #ifdef CONFIG_IPW2100_DEBUG 12983 #endif 12984 #ifdef CONFIG_IPW2100_MONITOR 12985 #endif 12986 #define POWER_MODES 5 12987 #ifdef CONFIG_IPW2100_MONITOR 12988 #endif 12989 #define MAX_POWER_STRING 80 12990 #ifdef CONFIG_IPW2100_MONITOR 12991 #endif 12992 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 12993 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 12994 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 12995 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 12996 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 12997 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 12998 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 12999 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 13000 #ifdef CONFIG_IPW2100_MONITOR 13001 #endif 13002 #ifdef CONFIG_IPW2100_MONITOR 13003 #endif 13004 #ifdef CONFIG_IPW2100_MONITOR 13005 #else 13006 #endif 13007 #ifdef CONFIG_IPW2100_MONITOR 13008 #else 13009 #endif 13010 #ifdef CONFIG_IPW2100_DEBUG 13011 #endif 13012 #define IPW2100_FW_MAJOR_VERSION 1 13013 #define IPW2100_FW_MINOR_VERSION 3 13014 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 13015 #define IPW2100_FW_MAJOR(x) (x & 0xff) 13016 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 13017 IPW2100_FW_MAJOR_VERSION) 13018 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 13019 "." __stringify(IPW2100_FW_MINOR_VERSION) 13020 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 13021 #ifdef CONFIG_IPW2100_MONITOR 13022 #endif 13023 #ifdef CONFIG_IPW2100_MONITOR 13024 #endif 13025 /* LDV_COMMENT_END_PREP */ 13026 13027 13028 13029 13030 } 13031 13032 break; 13033 case 10: { 13034 13035 /** STRUCT: struct type: pci_driver, struct name: ipw2100_pci_driver **/ 13036 13037 13038 /* content: static void ipw2100_shutdown(struct pci_dev *pci_dev)*/ 13039 /* LDV_COMMENT_BEGIN_PREP */ 13040 #define IPW2100_VERSION "git-1.2.2" 13041 #define DRV_NAME "ipw2100" 13042 #define DRV_VERSION IPW2100_VERSION 13043 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 13044 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 13045 #ifdef CONFIG_IPW2100_DEBUG 13046 #define IPW2100_RX_DEBUG 13047 #endif 13048 #ifdef CONFIG_PM 13049 #endif 13050 #ifdef CONFIG_IPW2100_DEBUG 13051 #define IPW_DEBUG(level, message...) \ 13052 do { \ 13053 if (ipw2100_debug_level & (level)) { \ 13054 printk(KERN_DEBUG "ipw2100: %c %s ", \ 13055 in_interrupt() ? 'I' : 'U', __func__); \ 13056 printk(message); \ 13057 } \ 13058 } while (0) 13059 #else 13060 #define IPW_DEBUG(level, message...) do {} while (0) 13061 #endif 13062 #ifdef CONFIG_IPW2100_DEBUG 13063 #endif 13064 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 13065 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 13066 #define MAX_RESET_BACKOFF 10 13067 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 13068 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 13069 #ifndef CONFIG_PM 13070 #endif 13071 #ifdef CONFIG_PM 13072 #else 13073 #endif 13074 #ifndef CONFIG_PM 13075 #endif 13076 #define MAX_RF_KILL_CHECKS 5 13077 #define RF_KILL_CHECK_DELAY 40 13078 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 13079 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 13080 #define MAC_ASSOCIATION_READ_DELAY (HZ) 13081 #ifdef CONFIG_IPW2100_DEBUG 13082 #define IPW2100_HANDLER(v, f) { v, f, # v } 13083 #else 13084 #define IPW2100_HANDLER(v, f) { v, f } 13085 #endif 13086 #ifdef CONFIG_IPW2100_DEBUG 13087 #endif 13088 #ifdef CONFIG_IPW2100_DEBUG 13089 #endif 13090 #define SEARCH_ERROR 0xffffffff 13091 #define SEARCH_FAIL 0xfffffffe 13092 #define SEARCH_SUCCESS 0xfffffff0 13093 #define SEARCH_DISCARD 0 13094 #define SEARCH_SNAPSHOT 1 13095 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 13096 #ifdef IPW2100_DEBUG_C3 13097 #endif 13098 #ifdef IPW2100_RX_DEBUG 13099 #endif 13100 #ifdef IPW2100_DEBUG_C3 13101 #endif 13102 #ifdef IPW2100_DEBUG_C3 13103 #endif 13104 #ifdef IPW2100_RX_DEBUG 13105 #endif 13106 #ifdef IPW2100_RX_DEBUG 13107 #endif 13108 #ifdef CONFIG_IPW2100_MONITOR 13109 #endif 13110 #ifdef CONFIG_IPW2100_MONITOR 13111 #else 13112 #endif 13113 #ifdef CONFIG_IPW2100_MONITOR 13114 #endif 13115 #ifdef CONFIG_IPW2100_DEBUG 13116 #endif 13117 #ifdef CONFIG_IPW2100_DEBUG 13118 #endif 13119 #ifdef CONFIG_IPW2100_DEBUG 13120 #endif 13121 #define IPW2100_REG(x) { IPW_ ##x, #x } 13122 #define IPW2100_NIC(x, s) { x, #x, s } 13123 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 13124 #ifdef CONFIG_IPW2100_DEBUG 13125 #endif 13126 #ifdef CONFIG_IPW2100_MONITOR 13127 #endif 13128 #ifdef CONFIG_PM 13129 #endif 13130 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 13131 #ifdef CONFIG_IPW2100_DEBUG 13132 #endif 13133 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 13134 #endif 13135 #ifdef IPW2100_TX_POWER 13136 #endif 13137 #if 0 13138 #endif 13139 #ifdef CONFIG_IPW2100_DEBUG 13140 #endif 13141 #define IPW_PRIVACY_CAPABLE 0x0008 13142 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 13143 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 13144 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 13145 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 13146 #ifdef CONFIG_IPW2100_MONITOR 13147 #endif 13148 #ifdef CONFIG_IPW2100_MONITOR 13149 #endif 13150 #ifdef CONFIG_IPW2100_MONITOR 13151 #endif 13152 #ifdef CONFIG_IPW2100_MONITOR 13153 #endif 13154 #ifdef CONFIG_PM 13155 #endif 13156 #ifdef CONFIG_PM 13157 #endif 13158 /* LDV_COMMENT_END_PREP */ 13159 /* LDV_COMMENT_FUNCTION_CALL Function from field "shutdown" from driver structure with callbacks "ipw2100_pci_driver" */ 13160 ldv_handler_precall(); 13161 ipw2100_shutdown( var_group3); 13162 /* LDV_COMMENT_BEGIN_PREP */ 13163 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 13164 #ifdef CONFIG_PM 13165 #endif 13166 #ifdef CONFIG_IPW2100_DEBUG 13167 #endif 13168 #ifdef CONFIG_IPW2100_DEBUG 13169 #endif 13170 #ifdef CONFIG_IPW2100_MONITOR 13171 #endif 13172 #define POWER_MODES 5 13173 #ifdef CONFIG_IPW2100_MONITOR 13174 #endif 13175 #define MAX_POWER_STRING 80 13176 #ifdef CONFIG_IPW2100_MONITOR 13177 #endif 13178 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 13179 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 13180 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 13181 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 13182 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 13183 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 13184 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 13185 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 13186 #ifdef CONFIG_IPW2100_MONITOR 13187 #endif 13188 #ifdef CONFIG_IPW2100_MONITOR 13189 #endif 13190 #ifdef CONFIG_IPW2100_MONITOR 13191 #else 13192 #endif 13193 #ifdef CONFIG_IPW2100_MONITOR 13194 #else 13195 #endif 13196 #ifdef CONFIG_IPW2100_DEBUG 13197 #endif 13198 #define IPW2100_FW_MAJOR_VERSION 1 13199 #define IPW2100_FW_MINOR_VERSION 3 13200 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 13201 #define IPW2100_FW_MAJOR(x) (x & 0xff) 13202 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 13203 IPW2100_FW_MAJOR_VERSION) 13204 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 13205 "." __stringify(IPW2100_FW_MINOR_VERSION) 13206 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 13207 #ifdef CONFIG_IPW2100_MONITOR 13208 #endif 13209 #ifdef CONFIG_IPW2100_MONITOR 13210 #endif 13211 /* LDV_COMMENT_END_PREP */ 13212 13213 13214 13215 13216 } 13217 13218 break; 13219 case 11: { 13220 13221 /** STRUCT: struct type: iw_handler_def, struct name: ipw2100_wx_handler_def **/ 13222 13223 13224 /* content: static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev)*/ 13225 /* LDV_COMMENT_BEGIN_PREP */ 13226 #define IPW2100_VERSION "git-1.2.2" 13227 #define DRV_NAME "ipw2100" 13228 #define DRV_VERSION IPW2100_VERSION 13229 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 13230 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 13231 #ifdef CONFIG_IPW2100_DEBUG 13232 #define IPW2100_RX_DEBUG 13233 #endif 13234 #ifdef CONFIG_PM 13235 #endif 13236 #ifdef CONFIG_IPW2100_DEBUG 13237 #define IPW_DEBUG(level, message...) \ 13238 do { \ 13239 if (ipw2100_debug_level & (level)) { \ 13240 printk(KERN_DEBUG "ipw2100: %c %s ", \ 13241 in_interrupt() ? 'I' : 'U', __func__); \ 13242 printk(message); \ 13243 } \ 13244 } while (0) 13245 #else 13246 #define IPW_DEBUG(level, message...) do {} while (0) 13247 #endif 13248 #ifdef CONFIG_IPW2100_DEBUG 13249 #endif 13250 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 13251 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 13252 #define MAX_RESET_BACKOFF 10 13253 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 13254 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 13255 #ifndef CONFIG_PM 13256 #endif 13257 #ifdef CONFIG_PM 13258 #else 13259 #endif 13260 #ifndef CONFIG_PM 13261 #endif 13262 #define MAX_RF_KILL_CHECKS 5 13263 #define RF_KILL_CHECK_DELAY 40 13264 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 13265 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 13266 #define MAC_ASSOCIATION_READ_DELAY (HZ) 13267 #ifdef CONFIG_IPW2100_DEBUG 13268 #define IPW2100_HANDLER(v, f) { v, f, # v } 13269 #else 13270 #define IPW2100_HANDLER(v, f) { v, f } 13271 #endif 13272 #ifdef CONFIG_IPW2100_DEBUG 13273 #endif 13274 #ifdef CONFIG_IPW2100_DEBUG 13275 #endif 13276 #define SEARCH_ERROR 0xffffffff 13277 #define SEARCH_FAIL 0xfffffffe 13278 #define SEARCH_SUCCESS 0xfffffff0 13279 #define SEARCH_DISCARD 0 13280 #define SEARCH_SNAPSHOT 1 13281 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 13282 #ifdef IPW2100_DEBUG_C3 13283 #endif 13284 #ifdef IPW2100_RX_DEBUG 13285 #endif 13286 #ifdef IPW2100_DEBUG_C3 13287 #endif 13288 #ifdef IPW2100_DEBUG_C3 13289 #endif 13290 #ifdef IPW2100_RX_DEBUG 13291 #endif 13292 #ifdef IPW2100_RX_DEBUG 13293 #endif 13294 #ifdef CONFIG_IPW2100_MONITOR 13295 #endif 13296 #ifdef CONFIG_IPW2100_MONITOR 13297 #else 13298 #endif 13299 #ifdef CONFIG_IPW2100_MONITOR 13300 #endif 13301 #ifdef CONFIG_IPW2100_DEBUG 13302 #endif 13303 #ifdef CONFIG_IPW2100_DEBUG 13304 #endif 13305 #ifdef CONFIG_IPW2100_DEBUG 13306 #endif 13307 #define IPW2100_REG(x) { IPW_ ##x, #x } 13308 #define IPW2100_NIC(x, s) { x, #x, s } 13309 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 13310 #ifdef CONFIG_IPW2100_DEBUG 13311 #endif 13312 #ifdef CONFIG_IPW2100_MONITOR 13313 #endif 13314 #ifdef CONFIG_PM 13315 #endif 13316 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 13317 #ifdef CONFIG_IPW2100_DEBUG 13318 #endif 13319 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 13320 #endif 13321 #ifdef IPW2100_TX_POWER 13322 #endif 13323 #if 0 13324 #endif 13325 #ifdef CONFIG_IPW2100_DEBUG 13326 #endif 13327 #define IPW_PRIVACY_CAPABLE 0x0008 13328 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 13329 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 13330 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 13331 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 13332 #ifdef CONFIG_IPW2100_MONITOR 13333 #endif 13334 #ifdef CONFIG_IPW2100_MONITOR 13335 #endif 13336 #ifdef CONFIG_IPW2100_MONITOR 13337 #endif 13338 #ifdef CONFIG_IPW2100_MONITOR 13339 #endif 13340 #ifdef CONFIG_PM 13341 #endif 13342 #ifdef CONFIG_PM 13343 #endif 13344 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 13345 #ifdef CONFIG_PM 13346 #endif 13347 #ifdef CONFIG_IPW2100_DEBUG 13348 #endif 13349 #ifdef CONFIG_IPW2100_DEBUG 13350 #endif 13351 #ifdef CONFIG_IPW2100_MONITOR 13352 #endif 13353 #define POWER_MODES 5 13354 #ifdef CONFIG_IPW2100_MONITOR 13355 #endif 13356 #define MAX_POWER_STRING 80 13357 #ifdef CONFIG_IPW2100_MONITOR 13358 #endif 13359 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 13360 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 13361 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 13362 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 13363 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 13364 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 13365 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 13366 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 13367 #ifdef CONFIG_IPW2100_MONITOR 13368 #endif 13369 #ifdef CONFIG_IPW2100_MONITOR 13370 #endif 13371 #ifdef CONFIG_IPW2100_MONITOR 13372 #else 13373 #endif 13374 #ifdef CONFIG_IPW2100_MONITOR 13375 #else 13376 #endif 13377 /* LDV_COMMENT_END_PREP */ 13378 /* LDV_COMMENT_FUNCTION_CALL Function from field "get_wireless_stats" from driver structure with callbacks "ipw2100_wx_handler_def" */ 13379 ldv_handler_precall(); 13380 ipw2100_wx_wireless_stats( var_group1); 13381 /* LDV_COMMENT_BEGIN_PREP */ 13382 #define IPW2100_FW_MAJOR_VERSION 1 13383 #define IPW2100_FW_MINOR_VERSION 3 13384 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 13385 #define IPW2100_FW_MAJOR(x) (x & 0xff) 13386 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 13387 IPW2100_FW_MAJOR_VERSION) 13388 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 13389 "." __stringify(IPW2100_FW_MINOR_VERSION) 13390 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 13391 #ifdef CONFIG_IPW2100_MONITOR 13392 #endif 13393 #ifdef CONFIG_IPW2100_MONITOR 13394 #endif 13395 /* LDV_COMMENT_END_PREP */ 13396 13397 13398 13399 13400 } 13401 13402 break; 13403 case 12: { 13404 13405 /** CALLBACK SECTION request_irq **/ 13406 LDV_IN_INTERRUPT=2; 13407 13408 /* content: static irqreturn_t ipw2100_interrupt(int irq, void *data)*/ 13409 /* LDV_COMMENT_BEGIN_PREP */ 13410 #define IPW2100_VERSION "git-1.2.2" 13411 #define DRV_NAME "ipw2100" 13412 #define DRV_VERSION IPW2100_VERSION 13413 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 13414 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 13415 #ifdef CONFIG_IPW2100_DEBUG 13416 #define IPW2100_RX_DEBUG 13417 #endif 13418 #ifdef CONFIG_PM 13419 #endif 13420 #ifdef CONFIG_IPW2100_DEBUG 13421 #define IPW_DEBUG(level, message...) \ 13422 do { \ 13423 if (ipw2100_debug_level & (level)) { \ 13424 printk(KERN_DEBUG "ipw2100: %c %s ", \ 13425 in_interrupt() ? 'I' : 'U', __func__); \ 13426 printk(message); \ 13427 } \ 13428 } while (0) 13429 #else 13430 #define IPW_DEBUG(level, message...) do {} while (0) 13431 #endif 13432 #ifdef CONFIG_IPW2100_DEBUG 13433 #endif 13434 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 13435 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 13436 #define MAX_RESET_BACKOFF 10 13437 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 13438 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 13439 #ifndef CONFIG_PM 13440 #endif 13441 #ifdef CONFIG_PM 13442 #else 13443 #endif 13444 #ifndef CONFIG_PM 13445 #endif 13446 #define MAX_RF_KILL_CHECKS 5 13447 #define RF_KILL_CHECK_DELAY 40 13448 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 13449 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 13450 #define MAC_ASSOCIATION_READ_DELAY (HZ) 13451 #ifdef CONFIG_IPW2100_DEBUG 13452 #define IPW2100_HANDLER(v, f) { v, f, # v } 13453 #else 13454 #define IPW2100_HANDLER(v, f) { v, f } 13455 #endif 13456 #ifdef CONFIG_IPW2100_DEBUG 13457 #endif 13458 #ifdef CONFIG_IPW2100_DEBUG 13459 #endif 13460 #define SEARCH_ERROR 0xffffffff 13461 #define SEARCH_FAIL 0xfffffffe 13462 #define SEARCH_SUCCESS 0xfffffff0 13463 #define SEARCH_DISCARD 0 13464 #define SEARCH_SNAPSHOT 1 13465 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 13466 #ifdef IPW2100_DEBUG_C3 13467 #endif 13468 #ifdef IPW2100_RX_DEBUG 13469 #endif 13470 #ifdef IPW2100_DEBUG_C3 13471 #endif 13472 #ifdef IPW2100_DEBUG_C3 13473 #endif 13474 #ifdef IPW2100_RX_DEBUG 13475 #endif 13476 #ifdef IPW2100_RX_DEBUG 13477 #endif 13478 #ifdef CONFIG_IPW2100_MONITOR 13479 #endif 13480 #ifdef CONFIG_IPW2100_MONITOR 13481 #else 13482 #endif 13483 #ifdef CONFIG_IPW2100_MONITOR 13484 #endif 13485 #ifdef CONFIG_IPW2100_DEBUG 13486 #endif 13487 #ifdef CONFIG_IPW2100_DEBUG 13488 #endif 13489 #ifdef CONFIG_IPW2100_DEBUG 13490 #endif 13491 /* LDV_COMMENT_END_PREP */ 13492 /* LDV_COMMENT_FUNCTION_CALL */ 13493 ldv_handler_precall(); 13494 ipw2100_interrupt( var_ipw2100_interrupt_69_p0, var_ipw2100_interrupt_69_p1); 13495 /* LDV_COMMENT_BEGIN_PREP */ 13496 #define IPW2100_REG(x) { IPW_ ##x, #x } 13497 #define IPW2100_NIC(x, s) { x, #x, s } 13498 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 13499 #ifdef CONFIG_IPW2100_DEBUG 13500 #endif 13501 #ifdef CONFIG_IPW2100_MONITOR 13502 #endif 13503 #ifdef CONFIG_PM 13504 #endif 13505 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 13506 #ifdef CONFIG_IPW2100_DEBUG 13507 #endif 13508 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 13509 #endif 13510 #ifdef IPW2100_TX_POWER 13511 #endif 13512 #if 0 13513 #endif 13514 #ifdef CONFIG_IPW2100_DEBUG 13515 #endif 13516 #define IPW_PRIVACY_CAPABLE 0x0008 13517 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 13518 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 13519 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 13520 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 13521 #ifdef CONFIG_IPW2100_MONITOR 13522 #endif 13523 #ifdef CONFIG_IPW2100_MONITOR 13524 #endif 13525 #ifdef CONFIG_IPW2100_MONITOR 13526 #endif 13527 #ifdef CONFIG_IPW2100_MONITOR 13528 #endif 13529 #ifdef CONFIG_PM 13530 #endif 13531 #ifdef CONFIG_PM 13532 #endif 13533 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 13534 #ifdef CONFIG_PM 13535 #endif 13536 #ifdef CONFIG_IPW2100_DEBUG 13537 #endif 13538 #ifdef CONFIG_IPW2100_DEBUG 13539 #endif 13540 #ifdef CONFIG_IPW2100_MONITOR 13541 #endif 13542 #define POWER_MODES 5 13543 #ifdef CONFIG_IPW2100_MONITOR 13544 #endif 13545 #define MAX_POWER_STRING 80 13546 #ifdef CONFIG_IPW2100_MONITOR 13547 #endif 13548 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 13549 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 13550 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 13551 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 13552 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 13553 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 13554 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 13555 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 13556 #ifdef CONFIG_IPW2100_MONITOR 13557 #endif 13558 #ifdef CONFIG_IPW2100_MONITOR 13559 #endif 13560 #ifdef CONFIG_IPW2100_MONITOR 13561 #else 13562 #endif 13563 #ifdef CONFIG_IPW2100_MONITOR 13564 #else 13565 #endif 13566 #ifdef CONFIG_IPW2100_DEBUG 13567 #endif 13568 #define IPW2100_FW_MAJOR_VERSION 1 13569 #define IPW2100_FW_MINOR_VERSION 3 13570 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 13571 #define IPW2100_FW_MAJOR(x) (x & 0xff) 13572 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 13573 IPW2100_FW_MAJOR_VERSION) 13574 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 13575 "." __stringify(IPW2100_FW_MINOR_VERSION) 13576 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 13577 #ifdef CONFIG_IPW2100_MONITOR 13578 #endif 13579 #ifdef CONFIG_IPW2100_MONITOR 13580 #endif 13581 /* LDV_COMMENT_END_PREP */ 13582 LDV_IN_INTERRUPT=1; 13583 13584 13585 13586 } 13587 13588 break; 13589 default: break; 13590 13591 } 13592 13593 } 13594 13595 ldv_module_exit: 13596 13597 /** INIT: init_type: ST_MODULE_EXIT **/ 13598 /* content: static void __exit ipw2100_exit(void)*/ 13599 /* LDV_COMMENT_BEGIN_PREP */ 13600 #define IPW2100_VERSION "git-1.2.2" 13601 #define DRV_NAME "ipw2100" 13602 #define DRV_VERSION IPW2100_VERSION 13603 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 13604 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" 13605 #ifdef CONFIG_IPW2100_DEBUG 13606 #define IPW2100_RX_DEBUG 13607 #endif 13608 #ifdef CONFIG_PM 13609 #endif 13610 #ifdef CONFIG_IPW2100_DEBUG 13611 #define IPW_DEBUG(level, message...) \ 13612 do { \ 13613 if (ipw2100_debug_level & (level)) { \ 13614 printk(KERN_DEBUG "ipw2100: %c %s ", \ 13615 in_interrupt() ? 'I' : 'U', __func__); \ 13616 printk(message); \ 13617 } \ 13618 } while (0) 13619 #else 13620 #define IPW_DEBUG(level, message...) do {} while (0) 13621 #endif 13622 #ifdef CONFIG_IPW2100_DEBUG 13623 #endif 13624 #define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) 13625 #define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) 13626 #define MAX_RESET_BACKOFF 10 13627 #define HOST_COMPLETE_TIMEOUT (2 * HZ) 13628 #define IPW_CARD_DISABLE_COMPLETE_WAIT 100 13629 #ifndef CONFIG_PM 13630 #endif 13631 #ifdef CONFIG_PM 13632 #else 13633 #endif 13634 #ifndef CONFIG_PM 13635 #endif 13636 #define MAX_RF_KILL_CHECKS 5 13637 #define RF_KILL_CHECK_DELAY 40 13638 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) 13639 #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) 13640 #define MAC_ASSOCIATION_READ_DELAY (HZ) 13641 #ifdef CONFIG_IPW2100_DEBUG 13642 #define IPW2100_HANDLER(v, f) { v, f, # v } 13643 #else 13644 #define IPW2100_HANDLER(v, f) { v, f } 13645 #endif 13646 #ifdef CONFIG_IPW2100_DEBUG 13647 #endif 13648 #ifdef CONFIG_IPW2100_DEBUG 13649 #endif 13650 #define SEARCH_ERROR 0xffffffff 13651 #define SEARCH_FAIL 0xfffffffe 13652 #define SEARCH_SUCCESS 0xfffffff0 13653 #define SEARCH_DISCARD 0 13654 #define SEARCH_SNAPSHOT 1 13655 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) 13656 #ifdef IPW2100_DEBUG_C3 13657 #endif 13658 #ifdef IPW2100_RX_DEBUG 13659 #endif 13660 #ifdef IPW2100_DEBUG_C3 13661 #endif 13662 #ifdef IPW2100_DEBUG_C3 13663 #endif 13664 #ifdef IPW2100_RX_DEBUG 13665 #endif 13666 #ifdef IPW2100_RX_DEBUG 13667 #endif 13668 #ifdef CONFIG_IPW2100_MONITOR 13669 #endif 13670 #ifdef CONFIG_IPW2100_MONITOR 13671 #else 13672 #endif 13673 #ifdef CONFIG_IPW2100_MONITOR 13674 #endif 13675 #ifdef CONFIG_IPW2100_DEBUG 13676 #endif 13677 #ifdef CONFIG_IPW2100_DEBUG 13678 #endif 13679 #ifdef CONFIG_IPW2100_DEBUG 13680 #endif 13681 #define IPW2100_REG(x) { IPW_ ##x, #x } 13682 #define IPW2100_NIC(x, s) { x, #x, s } 13683 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 13684 #ifdef CONFIG_IPW2100_DEBUG 13685 #endif 13686 #ifdef CONFIG_IPW2100_MONITOR 13687 #endif 13688 #ifdef CONFIG_PM 13689 #endif 13690 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) 13691 #ifdef CONFIG_IPW2100_DEBUG 13692 #endif 13693 #if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 13694 #endif 13695 #ifdef IPW2100_TX_POWER 13696 #endif 13697 #if 0 13698 #endif 13699 #ifdef CONFIG_IPW2100_DEBUG 13700 #endif 13701 #define IPW_PRIVACY_CAPABLE 0x0008 13702 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X" 13703 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" 13704 #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 13705 #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 13706 #ifdef CONFIG_IPW2100_MONITOR 13707 #endif 13708 #ifdef CONFIG_IPW2100_MONITOR 13709 #endif 13710 #ifdef CONFIG_IPW2100_MONITOR 13711 #endif 13712 #ifdef CONFIG_IPW2100_MONITOR 13713 #endif 13714 #ifdef CONFIG_PM 13715 #endif 13716 #ifdef CONFIG_PM 13717 #endif 13718 #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 13719 #ifdef CONFIG_PM 13720 #endif 13721 #ifdef CONFIG_IPW2100_DEBUG 13722 #endif 13723 /* LDV_COMMENT_END_PREP */ 13724 /* LDV_COMMENT_FUNCTION_CALL Kernel calls driver release function before driver will be uploaded from kernel. This function declared as "MODULE_EXIT(function name)". */ 13725 ldv_handler_precall(); 13726 ipw2100_exit(); 13727 /* LDV_COMMENT_BEGIN_PREP */ 13728 #ifdef CONFIG_IPW2100_MONITOR 13729 #endif 13730 #define POWER_MODES 5 13731 #ifdef CONFIG_IPW2100_MONITOR 13732 #endif 13733 #define MAX_POWER_STRING 80 13734 #ifdef CONFIG_IPW2100_MONITOR 13735 #endif 13736 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 13737 #define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 13738 #define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 13739 #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 13740 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 13741 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 13742 #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 13743 #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 13744 #ifdef CONFIG_IPW2100_MONITOR 13745 #endif 13746 #ifdef CONFIG_IPW2100_MONITOR 13747 #endif 13748 #ifdef CONFIG_IPW2100_MONITOR 13749 #else 13750 #endif 13751 #ifdef CONFIG_IPW2100_MONITOR 13752 #else 13753 #endif 13754 #ifdef CONFIG_IPW2100_DEBUG 13755 #endif 13756 #define IPW2100_FW_MAJOR_VERSION 1 13757 #define IPW2100_FW_MINOR_VERSION 3 13758 #define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) 13759 #define IPW2100_FW_MAJOR(x) (x & 0xff) 13760 #define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ 13761 IPW2100_FW_MAJOR_VERSION) 13762 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ 13763 "." __stringify(IPW2100_FW_MINOR_VERSION) 13764 #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 13765 #ifdef CONFIG_IPW2100_MONITOR 13766 #endif 13767 #ifdef CONFIG_IPW2100_MONITOR 13768 #endif 13769 /* LDV_COMMENT_END_PREP */ 13770 13771 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 13772 ldv_final: ldv_check_final_state(); 13773 13774 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 13775 return; 13776 13777 } 13778 #endif 13779 13780 /* LDV_COMMENT_END_MAIN */ 13781 13782 #line 9 "/home/druidos/temp/331_1a/work/current--X--drivers--X--defaultlinux-3.14.1.tar.xz--X--331_1a--X--cpachecker/linux-3.14.1.tar.xz/csd_deg_dscv/6893/dscv_tempdir/dscv/ri/331_1a/drivers/net/wireless/ipw2x00/ipw2100.o.c.prepared"
1 2 #include <linux/types.h> 3 #include <linux/dma-direction.h> 4 #include <verifier/rcv.h> 5 #include <verifier/set.h> 6 #include <verifier/map.h> 7 8 Set LDV_DMA_MAP_CALLS; 9 10 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_dma_map_page') maps page */ 11 dma_addr_t ldv_dma_map_page(struct device *dev, struct page *page, size_t offset, size_t size, enum dma_data_direction dir) { 12 dma_addr_t nonedetermined; 13 14 nonedetermined = ldv_undef_ptr(); 15 16 /* LDV_COMMENT_ASSERT Check that previos dma_mapping call was checked*/ 17 ldv_assert(ldv_set_is_empty(LDV_DMA_MAP_CALLS)); 18 19 ldv_set_add(LDV_DMA_MAP_CALLS, nonedetermined); 20 21 return nonedetermined; 22 } 23 24 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_dma_mapping_error') unmaps page */ 25 int ldv_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { 26 27 /* LDV_COMMENT_ASSERT No dma_mapping calls to verify */ 28 ldv_assert(ldv_set_contains(LDV_DMA_MAP_CALLS, dma_addr)); 29 ldv_set_remove(LDV_DMA_MAP_CALLS, dma_addr); 30 31 int nonedetermined; 32 33 nonedetermined = ldv_undef_int(); 34 35 return nonedetermined; 36 } 37 38 39 40 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_dma_map_single') maps pci_dma */ 41 dma_addr_t ldv_dma_map_single(struct device *dev, void *cpu_addr, size_t size, enum dma_data_direction dir) { 42 dma_addr_t nonedetermined; 43 44 nonedetermined = ldv_undef_ptr(); 45 46 /* LDV_COMMENT_ASSERT Check that previos dma_mapping call was checked*/ 47 ldv_assert(ldv_set_is_empty(LDV_DMA_MAP_CALLS)); 48 49 ldv_set_add(LDV_DMA_MAP_CALLS, nonedetermined); 50 51 return nonedetermined; 52 } 53 54 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_dma_map_single_attrs') maps pci_dma */ 55 dma_addr_t ldv_dma_map_single_attrs(struct device *dev, void *ptr, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs) { 56 dma_addr_t nonedetermined; 57 58 nonedetermined = ldv_undef_ptr(); 59 60 /* LDV_COMMENT_ASSERT Check that previos dma_mapping call was checked*/ 61 ldv_assert(ldv_set_is_empty(LDV_DMA_MAP_CALLS)); 62 63 ldv_set_add(LDV_DMA_MAP_CALLS, nonedetermined); 64 65 return nonedetermined; 66 } 67 68 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_initialize') Initialize all module reference counters at the beginning */ 69 void ldv_initialize(void) { 70 /* LDV_COMMENT_CHANGE_STATE All module reference counters have some initial value at the beginning */ 71 ldv_set_init(LDV_DMA_MAP_CALLS); 72 } 73 74 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_check_final_state') Check that all module reference counters have their initial values at the end */ 75 void ldv_check_final_state(void) { 76 /* LDV_COMMENT_ASSERT All incremented module reference counters should be decremented before module unloading*/ 77 ldv_assert(ldv_set_is_empty(LDV_DMA_MAP_CALLS)); 78 }
1 #ifndef _ASM_GENERIC_DMA_MAPPING_H 2 #define _ASM_GENERIC_DMA_MAPPING_H 3 4 #include <linux/kmemcheck.h> 5 #include <linux/bug.h> 6 #include <linux/scatterlist.h> 7 #include <linux/dma-debug.h> 8 #include <linux/dma-attrs.h> 9 10 static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, 11 size_t size, 12 enum dma_data_direction dir, 13 struct dma_attrs *attrs) 14 { 15 struct dma_map_ops *ops = get_dma_ops(dev); 16 dma_addr_t addr; 17 18 kmemcheck_mark_initialized(ptr, size); 19 BUG_ON(!valid_dma_direction(dir)); 20 addr = ops->map_page(dev, virt_to_page(ptr), 21 (unsigned long)ptr & ~PAGE_MASK, size, 22 dir, attrs); 23 debug_dma_map_page(dev, virt_to_page(ptr), 24 (unsigned long)ptr & ~PAGE_MASK, size, 25 dir, addr, true); 26 return addr; 27 } 28 29 static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr, 30 size_t size, 31 enum dma_data_direction dir, 32 struct dma_attrs *attrs) 33 { 34 struct dma_map_ops *ops = get_dma_ops(dev); 35 36 BUG_ON(!valid_dma_direction(dir)); 37 if (ops->unmap_page) 38 ops->unmap_page(dev, addr, size, dir, attrs); 39 debug_dma_unmap_page(dev, addr, size, dir, true); 40 } 41 42 static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, 43 int nents, enum dma_data_direction dir, 44 struct dma_attrs *attrs) 45 { 46 struct dma_map_ops *ops = get_dma_ops(dev); 47 int i, ents; 48 struct scatterlist *s; 49 50 for_each_sg(sg, s, nents, i) 51 kmemcheck_mark_initialized(sg_virt(s), s->length); 52 BUG_ON(!valid_dma_direction(dir)); 53 ents = ops->map_sg(dev, sg, nents, dir, attrs); 54 debug_dma_map_sg(dev, sg, nents, ents, dir); 55 56 return ents; 57 } 58 59 static inline void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, 60 int nents, enum dma_data_direction dir, 61 struct dma_attrs *attrs) 62 { 63 struct dma_map_ops *ops = get_dma_ops(dev); 64 65 BUG_ON(!valid_dma_direction(dir)); 66 debug_dma_unmap_sg(dev, sg, nents, dir); 67 if (ops->unmap_sg) 68 ops->unmap_sg(dev, sg, nents, dir, attrs); 69 } 70 71 static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, 72 size_t offset, size_t size, 73 enum dma_data_direction dir) 74 { 75 struct dma_map_ops *ops = get_dma_ops(dev); 76 dma_addr_t addr; 77 78 kmemcheck_mark_initialized(page_address(page) + offset, size); 79 BUG_ON(!valid_dma_direction(dir)); 80 addr = ops->map_page(dev, page, offset, size, dir, NULL); 81 debug_dma_map_page(dev, page, offset, size, dir, addr, false); 82 83 return addr; 84 } 85 86 static inline void dma_unmap_page(struct device *dev, dma_addr_t addr, 87 size_t size, enum dma_data_direction dir) 88 { 89 struct dma_map_ops *ops = get_dma_ops(dev); 90 91 BUG_ON(!valid_dma_direction(dir)); 92 if (ops->unmap_page) 93 ops->unmap_page(dev, addr, size, dir, NULL); 94 debug_dma_unmap_page(dev, addr, size, dir, false); 95 } 96 97 static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, 98 size_t size, 99 enum dma_data_direction dir) 100 { 101 struct dma_map_ops *ops = get_dma_ops(dev); 102 103 BUG_ON(!valid_dma_direction(dir)); 104 if (ops->sync_single_for_cpu) 105 ops->sync_single_for_cpu(dev, addr, size, dir); 106 debug_dma_sync_single_for_cpu(dev, addr, size, dir); 107 } 108 109 static inline void dma_sync_single_for_device(struct device *dev, 110 dma_addr_t addr, size_t size, 111 enum dma_data_direction dir) 112 { 113 struct dma_map_ops *ops = get_dma_ops(dev); 114 115 BUG_ON(!valid_dma_direction(dir)); 116 if (ops->sync_single_for_device) 117 ops->sync_single_for_device(dev, addr, size, dir); 118 debug_dma_sync_single_for_device(dev, addr, size, dir); 119 } 120 121 static inline void dma_sync_single_range_for_cpu(struct device *dev, 122 dma_addr_t addr, 123 unsigned long offset, 124 size_t size, 125 enum dma_data_direction dir) 126 { 127 const struct dma_map_ops *ops = get_dma_ops(dev); 128 129 BUG_ON(!valid_dma_direction(dir)); 130 if (ops->sync_single_for_cpu) 131 ops->sync_single_for_cpu(dev, addr + offset, size, dir); 132 debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir); 133 } 134 135 static inline void dma_sync_single_range_for_device(struct device *dev, 136 dma_addr_t addr, 137 unsigned long offset, 138 size_t size, 139 enum dma_data_direction dir) 140 { 141 const struct dma_map_ops *ops = get_dma_ops(dev); 142 143 BUG_ON(!valid_dma_direction(dir)); 144 if (ops->sync_single_for_device) 145 ops->sync_single_for_device(dev, addr + offset, size, dir); 146 debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir); 147 } 148 149 static inline void 150 dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, 151 int nelems, enum dma_data_direction dir) 152 { 153 struct dma_map_ops *ops = get_dma_ops(dev); 154 155 BUG_ON(!valid_dma_direction(dir)); 156 if (ops->sync_sg_for_cpu) 157 ops->sync_sg_for_cpu(dev, sg, nelems, dir); 158 debug_dma_sync_sg_for_cpu(dev, sg, nelems, dir); 159 } 160 161 static inline void 162 dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, 163 int nelems, enum dma_data_direction dir) 164 { 165 struct dma_map_ops *ops = get_dma_ops(dev); 166 167 BUG_ON(!valid_dma_direction(dir)); 168 if (ops->sync_sg_for_device) 169 ops->sync_sg_for_device(dev, sg, nelems, dir); 170 debug_dma_sync_sg_for_device(dev, sg, nelems, dir); 171 172 } 173 174 #define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL) 175 #define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL) 176 #define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL) 177 #define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL) 178 179 extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, 180 void *cpu_addr, dma_addr_t dma_addr, size_t size); 181 182 /** 183 * dma_mmap_attrs - map a coherent DMA allocation into user space 184 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices 185 * @vma: vm_area_struct describing requested user mapping 186 * @cpu_addr: kernel CPU-view address returned from dma_alloc_attrs 187 * @handle: device-view address returned from dma_alloc_attrs 188 * @size: size of memory originally requested in dma_alloc_attrs 189 * @attrs: attributes of mapping properties requested in dma_alloc_attrs 190 * 191 * Map a coherent DMA buffer previously allocated by dma_alloc_attrs 192 * into user space. The coherent DMA buffer must not be freed by the 193 * driver until the user space mapping has been released. 194 */ 195 static inline int 196 dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, 197 dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs) 198 { 199 struct dma_map_ops *ops = get_dma_ops(dev); 200 BUG_ON(!ops); 201 if (ops->mmap) 202 return ops->mmap(dev, vma, cpu_addr, dma_addr, size, attrs); 203 return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size); 204 } 205 206 #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL) 207 208 static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma, 209 void *cpu_addr, dma_addr_t dma_addr, size_t size) 210 { 211 DEFINE_DMA_ATTRS(attrs); 212 dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); 213 return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs); 214 } 215 216 int 217 dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, 218 void *cpu_addr, dma_addr_t dma_addr, size_t size); 219 220 static inline int 221 dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt, void *cpu_addr, 222 dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs) 223 { 224 struct dma_map_ops *ops = get_dma_ops(dev); 225 BUG_ON(!ops); 226 if (ops->get_sgtable) 227 return ops->get_sgtable(dev, sgt, cpu_addr, dma_addr, size, 228 attrs); 229 return dma_common_get_sgtable(dev, sgt, cpu_addr, dma_addr, size); 230 } 231 232 #define dma_get_sgtable(d, t, v, h, s) dma_get_sgtable_attrs(d, t, v, h, s, NULL) 233 234 #endif
1 /* include this file if the platform implements the dma_ DMA Mapping API 2 * and wants to provide the pci_ DMA Mapping API in terms of it */ 3 4 #ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H 5 #define _ASM_GENERIC_PCI_DMA_COMPAT_H 6 7 #include <linux/dma-mapping.h> 8 9 static inline int 10 pci_dma_supported(struct pci_dev *hwdev, u64 mask) 11 { 12 return dma_supported(hwdev == NULL ? NULL : &hwdev->dev, mask); 13 } 14 15 static inline void * 16 pci_alloc_consistent(struct pci_dev *hwdev, size_t size, 17 dma_addr_t *dma_handle) 18 { 19 return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC); 20 } 21 22 static inline void 23 pci_free_consistent(struct pci_dev *hwdev, size_t size, 24 void *vaddr, dma_addr_t dma_handle) 25 { 26 dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle); 27 } 28 29 static inline dma_addr_t 30 pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) 31 { 32 return dma_map_single(hwdev == NULL ? NULL : &hwdev->dev, ptr, size, (enum dma_data_direction)direction); 33 } 34 35 static inline void 36 pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, 37 size_t size, int direction) 38 { 39 dma_unmap_single(hwdev == NULL ? NULL : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction); 40 } 41 42 static inline dma_addr_t 43 pci_map_page(struct pci_dev *hwdev, struct page *page, 44 unsigned long offset, size_t size, int direction) 45 { 46 return dma_map_page(hwdev == NULL ? NULL : &hwdev->dev, page, offset, size, (enum dma_data_direction)direction); 47 } 48 49 static inline void 50 pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address, 51 size_t size, int direction) 52 { 53 dma_unmap_page(hwdev == NULL ? NULL : &hwdev->dev, dma_address, size, (enum dma_data_direction)direction); 54 } 55 56 static inline int 57 pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, 58 int nents, int direction) 59 { 60 return dma_map_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction); 61 } 62 63 static inline void 64 pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, 65 int nents, int direction) 66 { 67 dma_unmap_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction); 68 } 69 70 static inline void 71 pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle, 72 size_t size, int direction) 73 { 74 dma_sync_single_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction); 75 } 76 77 static inline void 78 pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle, 79 size_t size, int direction) 80 { 81 dma_sync_single_for_device(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction); 82 } 83 84 static inline void 85 pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, 86 int nelems, int direction) 87 { 88 dma_sync_sg_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction); 89 } 90 91 static inline void 92 pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg, 93 int nelems, int direction) 94 { 95 dma_sync_sg_for_device(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction); 96 } 97 98 static inline int 99 pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr) 100 { 101 return dma_mapping_error(&pdev->dev, dma_addr); 102 } 103 104 #ifdef CONFIG_PCI 105 static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) 106 { 107 return dma_set_mask(&dev->dev, mask); 108 } 109 110 static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) 111 { 112 return dma_set_coherent_mask(&dev->dev, mask); 113 } 114 #endif 115 116 #endif
1 #ifndef _LINUX_DMA_MAPPING_H 2 #define _LINUX_DMA_MAPPING_H 3 4 #include <linux/string.h> 5 #include <linux/device.h> 6 #include <linux/err.h> 7 #include <linux/dma-attrs.h> 8 #include <linux/dma-direction.h> 9 #include <linux/scatterlist.h> 10 11 struct dma_map_ops { 12 void* (*alloc)(struct device *dev, size_t size, 13 dma_addr_t *dma_handle, gfp_t gfp, 14 struct dma_attrs *attrs); 15 void (*free)(struct device *dev, size_t size, 16 void *vaddr, dma_addr_t dma_handle, 17 struct dma_attrs *attrs); 18 int (*mmap)(struct device *, struct vm_area_struct *, 19 void *, dma_addr_t, size_t, struct dma_attrs *attrs); 20 21 int (*get_sgtable)(struct device *dev, struct sg_table *sgt, void *, 22 dma_addr_t, size_t, struct dma_attrs *attrs); 23 24 dma_addr_t (*map_page)(struct device *dev, struct page *page, 25 unsigned long offset, size_t size, 26 enum dma_data_direction dir, 27 struct dma_attrs *attrs); 28 void (*unmap_page)(struct device *dev, dma_addr_t dma_handle, 29 size_t size, enum dma_data_direction dir, 30 struct dma_attrs *attrs); 31 int (*map_sg)(struct device *dev, struct scatterlist *sg, 32 int nents, enum dma_data_direction dir, 33 struct dma_attrs *attrs); 34 void (*unmap_sg)(struct device *dev, 35 struct scatterlist *sg, int nents, 36 enum dma_data_direction dir, 37 struct dma_attrs *attrs); 38 void (*sync_single_for_cpu)(struct device *dev, 39 dma_addr_t dma_handle, size_t size, 40 enum dma_data_direction dir); 41 void (*sync_single_for_device)(struct device *dev, 42 dma_addr_t dma_handle, size_t size, 43 enum dma_data_direction dir); 44 void (*sync_sg_for_cpu)(struct device *dev, 45 struct scatterlist *sg, int nents, 46 enum dma_data_direction dir); 47 void (*sync_sg_for_device)(struct device *dev, 48 struct scatterlist *sg, int nents, 49 enum dma_data_direction dir); 50 int (*mapping_error)(struct device *dev, dma_addr_t dma_addr); 51 int (*dma_supported)(struct device *dev, u64 mask); 52 int (*set_dma_mask)(struct device *dev, u64 mask); 53 #ifdef ARCH_HAS_DMA_GET_REQUIRED_MASK 54 u64 (*get_required_mask)(struct device *dev); 55 #endif 56 int is_phys; 57 }; 58 59 #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) 60 61 #define DMA_MASK_NONE 0x0ULL 62 63 static inline int valid_dma_direction(int dma_direction) 64 { 65 return ((dma_direction == DMA_BIDIRECTIONAL) || 66 (dma_direction == DMA_TO_DEVICE) || 67 (dma_direction == DMA_FROM_DEVICE)); 68 } 69 70 static inline int is_device_dma_capable(struct device *dev) 71 { 72 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; 73 } 74 75 #ifdef CONFIG_HAS_DMA 76 #include <asm/dma-mapping.h> 77 #else 78 #include <asm-generic/dma-mapping-broken.h> 79 #endif 80 81 static inline u64 dma_get_mask(struct device *dev) 82 { 83 if (dev && dev->dma_mask && *dev->dma_mask) 84 return *dev->dma_mask; 85 return DMA_BIT_MASK(32); 86 } 87 88 #ifdef CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK 89 int dma_set_coherent_mask(struct device *dev, u64 mask); 90 #else 91 static inline int dma_set_coherent_mask(struct device *dev, u64 mask) 92 { 93 if (!dma_supported(dev, mask)) 94 return -EIO; 95 dev->coherent_dma_mask = mask; 96 return 0; 97 } 98 #endif 99 100 /* 101 * Set both the DMA mask and the coherent DMA mask to the same thing. 102 * Note that we don't check the return value from dma_set_coherent_mask() 103 * as the DMA API guarantees that the coherent DMA mask can be set to 104 * the same or smaller than the streaming DMA mask. 105 */ 106 static inline int dma_set_mask_and_coherent(struct device *dev, u64 mask) 107 { 108 int rc = dma_set_mask(dev, mask); 109 if (rc == 0) 110 dma_set_coherent_mask(dev, mask); 111 return rc; 112 } 113 114 /* 115 * Similar to the above, except it deals with the case where the device 116 * does not have dev->dma_mask appropriately setup. 117 */ 118 static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask) 119 { 120 dev->dma_mask = &dev->coherent_dma_mask; 121 return dma_set_mask_and_coherent(dev, mask); 122 } 123 124 extern u64 dma_get_required_mask(struct device *dev); 125 126 static inline unsigned int dma_get_max_seg_size(struct device *dev) 127 { 128 return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536; 129 } 130 131 static inline unsigned int dma_set_max_seg_size(struct device *dev, 132 unsigned int size) 133 { 134 if (dev->dma_parms) { 135 dev->dma_parms->max_segment_size = size; 136 return 0; 137 } else 138 return -EIO; 139 } 140 141 static inline unsigned long dma_get_seg_boundary(struct device *dev) 142 { 143 return dev->dma_parms ? 144 dev->dma_parms->segment_boundary_mask : 0xffffffff; 145 } 146 147 static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask) 148 { 149 if (dev->dma_parms) { 150 dev->dma_parms->segment_boundary_mask = mask; 151 return 0; 152 } else 153 return -EIO; 154 } 155 156 #ifndef dma_max_pfn 157 static inline unsigned long dma_max_pfn(struct device *dev) 158 { 159 return *dev->dma_mask >> PAGE_SHIFT; 160 } 161 #endif 162 163 static inline void *dma_zalloc_coherent(struct device *dev, size_t size, 164 dma_addr_t *dma_handle, gfp_t flag) 165 { 166 void *ret = dma_alloc_coherent(dev, size, dma_handle, 167 flag | __GFP_ZERO); 168 return ret; 169 } 170 171 #ifdef CONFIG_HAS_DMA 172 static inline int dma_get_cache_alignment(void) 173 { 174 #ifdef ARCH_DMA_MINALIGN 175 return ARCH_DMA_MINALIGN; 176 #endif 177 return 1; 178 } 179 #endif 180 181 /* flags for the coherent memory api */ 182 #define DMA_MEMORY_MAP 0x01 183 #define DMA_MEMORY_IO 0x02 184 #define DMA_MEMORY_INCLUDES_CHILDREN 0x04 185 #define DMA_MEMORY_EXCLUSIVE 0x08 186 187 #ifndef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 188 static inline int 189 dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, 190 dma_addr_t device_addr, size_t size, int flags) 191 { 192 return 0; 193 } 194 195 static inline void 196 dma_release_declared_memory(struct device *dev) 197 { 198 } 199 200 static inline void * 201 dma_mark_declared_memory_occupied(struct device *dev, 202 dma_addr_t device_addr, size_t size) 203 { 204 return ERR_PTR(-EBUSY); 205 } 206 #endif 207 208 /* 209 * Managed DMA API 210 */ 211 extern void *dmam_alloc_coherent(struct device *dev, size_t size, 212 dma_addr_t *dma_handle, gfp_t gfp); 213 extern void dmam_free_coherent(struct device *dev, size_t size, void *vaddr, 214 dma_addr_t dma_handle); 215 extern void *dmam_alloc_noncoherent(struct device *dev, size_t size, 216 dma_addr_t *dma_handle, gfp_t gfp); 217 extern void dmam_free_noncoherent(struct device *dev, size_t size, void *vaddr, 218 dma_addr_t dma_handle); 219 #ifdef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 220 extern int dmam_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, 221 dma_addr_t device_addr, size_t size, 222 int flags); 223 extern void dmam_release_declared_memory(struct device *dev); 224 #else /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */ 225 static inline int dmam_declare_coherent_memory(struct device *dev, 226 dma_addr_t bus_addr, dma_addr_t device_addr, 227 size_t size, gfp_t gfp) 228 { 229 return 0; 230 } 231 232 static inline void dmam_release_declared_memory(struct device *dev) 233 { 234 } 235 #endif /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */ 236 237 #ifndef CONFIG_HAVE_DMA_ATTRS 238 struct dma_attrs; 239 240 #define dma_map_single_attrs(dev, cpu_addr, size, dir, attrs) \ 241 dma_map_single(dev, cpu_addr, size, dir) 242 243 #define dma_unmap_single_attrs(dev, dma_addr, size, dir, attrs) \ 244 dma_unmap_single(dev, dma_addr, size, dir) 245 246 #define dma_map_sg_attrs(dev, sgl, nents, dir, attrs) \ 247 dma_map_sg(dev, sgl, nents, dir) 248 249 #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \ 250 dma_unmap_sg(dev, sgl, nents, dir) 251 252 #endif /* CONFIG_HAVE_DMA_ATTRS */ 253 254 #ifdef CONFIG_NEED_DMA_MAP_STATE 255 #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME 256 #define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME 257 #define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME) 258 #define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL)) 259 #define dma_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME) 260 #define dma_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL)) 261 #else 262 #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) 263 #define DEFINE_DMA_UNMAP_LEN(LEN_NAME) 264 #define dma_unmap_addr(PTR, ADDR_NAME) (0) 265 #define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) 266 #define dma_unmap_len(PTR, LEN_NAME) (0) 267 #define dma_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 268 #endif 269 270 #endif
1 #ifndef _LINUX_LIST_H 2 #define _LINUX_LIST_H 3 4 #include <linux/types.h> 5 #include <linux/stddef.h> 6 #include <linux/poison.h> 7 #include <linux/const.h> 8 9 /* 10 * Simple doubly linked list implementation. 11 * 12 * Some of the internal functions ("__xxx") are useful when 13 * manipulating whole lists rather than single entries, as 14 * sometimes we already know the next/prev entries and we can 15 * generate better code by using them directly rather than 16 * using the generic single-entry routines. 17 */ 18 19 #define LIST_HEAD_INIT(name) { &(name), &(name) } 20 21 #define LIST_HEAD(name) \ 22 struct list_head name = LIST_HEAD_INIT(name) 23 24 static inline void INIT_LIST_HEAD(struct list_head *list) 25 { 26 list->next = list; 27 list->prev = list; 28 } 29 30 /* 31 * Insert a new entry between two known consecutive entries. 32 * 33 * This is only for internal list manipulation where we know 34 * the prev/next entries already! 35 */ 36 #ifndef CONFIG_DEBUG_LIST 37 static inline void __list_add(struct list_head *new, 38 struct list_head *prev, 39 struct list_head *next) 40 { 41 next->prev = new; 42 new->next = next; 43 new->prev = prev; 44 prev->next = new; 45 } 46 #else 47 extern void __list_add(struct list_head *new, 48 struct list_head *prev, 49 struct list_head *next); 50 #endif 51 52 /** 53 * list_add - add a new entry 54 * @new: new entry to be added 55 * @head: list head to add it after 56 * 57 * Insert a new entry after the specified head. 58 * This is good for implementing stacks. 59 */ 60 static inline void list_add(struct list_head *new, struct list_head *head) 61 { 62 __list_add(new, head, head->next); 63 } 64 65 66 /** 67 * list_add_tail - add a new entry 68 * @new: new entry to be added 69 * @head: list head to add it before 70 * 71 * Insert a new entry before the specified head. 72 * This is useful for implementing queues. 73 */ 74 static inline void list_add_tail(struct list_head *new, struct list_head *head) 75 { 76 __list_add(new, head->prev, head); 77 } 78 79 /* 80 * Delete a list entry by making the prev/next entries 81 * point to each other. 82 * 83 * This is only for internal list manipulation where we know 84 * the prev/next entries already! 85 */ 86 static inline void __list_del(struct list_head * prev, struct list_head * next) 87 { 88 next->prev = prev; 89 prev->next = next; 90 } 91 92 /** 93 * list_del - deletes entry from list. 94 * @entry: the element to delete from the list. 95 * Note: list_empty() on entry does not return true after this, the entry is 96 * in an undefined state. 97 */ 98 #ifndef CONFIG_DEBUG_LIST 99 static inline void __list_del_entry(struct list_head *entry) 100 { 101 __list_del(entry->prev, entry->next); 102 } 103 104 static inline void list_del(struct list_head *entry) 105 { 106 __list_del(entry->prev, entry->next); 107 entry->next = LIST_POISON1; 108 entry->prev = LIST_POISON2; 109 } 110 #else 111 extern void __list_del_entry(struct list_head *entry); 112 extern void list_del(struct list_head *entry); 113 #endif 114 115 /** 116 * list_replace - replace old entry by new one 117 * @old : the element to be replaced 118 * @new : the new element to insert 119 * 120 * If @old was empty, it will be overwritten. 121 */ 122 static inline void list_replace(struct list_head *old, 123 struct list_head *new) 124 { 125 new->next = old->next; 126 new->next->prev = new; 127 new->prev = old->prev; 128 new->prev->next = new; 129 } 130 131 static inline void list_replace_init(struct list_head *old, 132 struct list_head *new) 133 { 134 list_replace(old, new); 135 INIT_LIST_HEAD(old); 136 } 137 138 /** 139 * list_del_init - deletes entry from list and reinitialize it. 140 * @entry: the element to delete from the list. 141 */ 142 static inline void list_del_init(struct list_head *entry) 143 { 144 __list_del_entry(entry); 145 INIT_LIST_HEAD(entry); 146 } 147 148 /** 149 * list_move - delete from one list and add as another's head 150 * @list: the entry to move 151 * @head: the head that will precede our entry 152 */ 153 static inline void list_move(struct list_head *list, struct list_head *head) 154 { 155 __list_del_entry(list); 156 list_add(list, head); 157 } 158 159 /** 160 * list_move_tail - delete from one list and add as another's tail 161 * @list: the entry to move 162 * @head: the head that will follow our entry 163 */ 164 static inline void list_move_tail(struct list_head *list, 165 struct list_head *head) 166 { 167 __list_del_entry(list); 168 list_add_tail(list, head); 169 } 170 171 /** 172 * list_is_last - tests whether @list is the last entry in list @head 173 * @list: the entry to test 174 * @head: the head of the list 175 */ 176 static inline int list_is_last(const struct list_head *list, 177 const struct list_head *head) 178 { 179 return list->next == head; 180 } 181 182 /** 183 * list_empty - tests whether a list is empty 184 * @head: the list to test. 185 */ 186 static inline int list_empty(const struct list_head *head) 187 { 188 return head->next == head; 189 } 190 191 /** 192 * list_empty_careful - tests whether a list is empty and not being modified 193 * @head: the list to test 194 * 195 * Description: 196 * tests whether a list is empty _and_ checks that no other CPU might be 197 * in the process of modifying either member (next or prev) 198 * 199 * NOTE: using list_empty_careful() without synchronization 200 * can only be safe if the only activity that can happen 201 * to the list entry is list_del_init(). Eg. it cannot be used 202 * if another CPU could re-list_add() it. 203 */ 204 static inline int list_empty_careful(const struct list_head *head) 205 { 206 struct list_head *next = head->next; 207 return (next == head) && (next == head->prev); 208 } 209 210 /** 211 * list_rotate_left - rotate the list to the left 212 * @head: the head of the list 213 */ 214 static inline void list_rotate_left(struct list_head *head) 215 { 216 struct list_head *first; 217 218 if (!list_empty(head)) { 219 first = head->next; 220 list_move_tail(first, head); 221 } 222 } 223 224 /** 225 * list_is_singular - tests whether a list has just one entry. 226 * @head: the list to test. 227 */ 228 static inline int list_is_singular(const struct list_head *head) 229 { 230 return !list_empty(head) && (head->next == head->prev); 231 } 232 233 static inline void __list_cut_position(struct list_head *list, 234 struct list_head *head, struct list_head *entry) 235 { 236 struct list_head *new_first = entry->next; 237 list->next = head->next; 238 list->next->prev = list; 239 list->prev = entry; 240 entry->next = list; 241 head->next = new_first; 242 new_first->prev = head; 243 } 244 245 /** 246 * list_cut_position - cut a list into two 247 * @list: a new list to add all removed entries 248 * @head: a list with entries 249 * @entry: an entry within head, could be the head itself 250 * and if so we won't cut the list 251 * 252 * This helper moves the initial part of @head, up to and 253 * including @entry, from @head to @list. You should 254 * pass on @entry an element you know is on @head. @list 255 * should be an empty list or a list you do not care about 256 * losing its data. 257 * 258 */ 259 static inline void list_cut_position(struct list_head *list, 260 struct list_head *head, struct list_head *entry) 261 { 262 if (list_empty(head)) 263 return; 264 if (list_is_singular(head) && 265 (head->next != entry && head != entry)) 266 return; 267 if (entry == head) 268 INIT_LIST_HEAD(list); 269 else 270 __list_cut_position(list, head, entry); 271 } 272 273 static inline void __list_splice(const struct list_head *list, 274 struct list_head *prev, 275 struct list_head *next) 276 { 277 struct list_head *first = list->next; 278 struct list_head *last = list->prev; 279 280 first->prev = prev; 281 prev->next = first; 282 283 last->next = next; 284 next->prev = last; 285 } 286 287 /** 288 * list_splice - join two lists, this is designed for stacks 289 * @list: the new list to add. 290 * @head: the place to add it in the first list. 291 */ 292 static inline void list_splice(const struct list_head *list, 293 struct list_head *head) 294 { 295 if (!list_empty(list)) 296 __list_splice(list, head, head->next); 297 } 298 299 /** 300 * list_splice_tail - join two lists, each list being a queue 301 * @list: the new list to add. 302 * @head: the place to add it in the first list. 303 */ 304 static inline void list_splice_tail(struct list_head *list, 305 struct list_head *head) 306 { 307 if (!list_empty(list)) 308 __list_splice(list, head->prev, head); 309 } 310 311 /** 312 * list_splice_init - join two lists and reinitialise the emptied list. 313 * @list: the new list to add. 314 * @head: the place to add it in the first list. 315 * 316 * The list at @list is reinitialised 317 */ 318 static inline void list_splice_init(struct list_head *list, 319 struct list_head *head) 320 { 321 if (!list_empty(list)) { 322 __list_splice(list, head, head->next); 323 INIT_LIST_HEAD(list); 324 } 325 } 326 327 /** 328 * list_splice_tail_init - join two lists and reinitialise the emptied list 329 * @list: the new list to add. 330 * @head: the place to add it in the first list. 331 * 332 * Each of the lists is a queue. 333 * The list at @list is reinitialised 334 */ 335 static inline void list_splice_tail_init(struct list_head *list, 336 struct list_head *head) 337 { 338 if (!list_empty(list)) { 339 __list_splice(list, head->prev, head); 340 INIT_LIST_HEAD(list); 341 } 342 } 343 344 /** 345 * list_entry - get the struct for this entry 346 * @ptr: the &struct list_head pointer. 347 * @type: the type of the struct this is embedded in. 348 * @member: the name of the list_struct within the struct. 349 */ 350 #define list_entry(ptr, type, member) \ 351 container_of(ptr, type, member) 352 353 /** 354 * list_first_entry - get the first element from a list 355 * @ptr: the list head to take the element from. 356 * @type: the type of the struct this is embedded in. 357 * @member: the name of the list_struct within the struct. 358 * 359 * Note, that list is expected to be not empty. 360 */ 361 #define list_first_entry(ptr, type, member) \ 362 list_entry((ptr)->next, type, member) 363 364 /** 365 * list_last_entry - get the last element from a list 366 * @ptr: the list head to take the element from. 367 * @type: the type of the struct this is embedded in. 368 * @member: the name of the list_struct within the struct. 369 * 370 * Note, that list is expected to be not empty. 371 */ 372 #define list_last_entry(ptr, type, member) \ 373 list_entry((ptr)->prev, type, member) 374 375 /** 376 * list_first_entry_or_null - get the first element from a list 377 * @ptr: the list head to take the element from. 378 * @type: the type of the struct this is embedded in. 379 * @member: the name of the list_struct within the struct. 380 * 381 * Note that if the list is empty, it returns NULL. 382 */ 383 #define list_first_entry_or_null(ptr, type, member) \ 384 (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL) 385 386 /** 387 * list_next_entry - get the next element in list 388 * @pos: the type * to cursor 389 * @member: the name of the list_struct within the struct. 390 */ 391 #define list_next_entry(pos, member) \ 392 list_entry((pos)->member.next, typeof(*(pos)), member) 393 394 /** 395 * list_prev_entry - get the prev element in list 396 * @pos: the type * to cursor 397 * @member: the name of the list_struct within the struct. 398 */ 399 #define list_prev_entry(pos, member) \ 400 list_entry((pos)->member.prev, typeof(*(pos)), member) 401 402 /** 403 * list_for_each - iterate over a list 404 * @pos: the &struct list_head to use as a loop cursor. 405 * @head: the head for your list. 406 */ 407 #define list_for_each(pos, head) \ 408 for (pos = (head)->next; pos != (head); pos = pos->next) 409 410 /** 411 * list_for_each_prev - iterate over a list backwards 412 * @pos: the &struct list_head to use as a loop cursor. 413 * @head: the head for your list. 414 */ 415 #define list_for_each_prev(pos, head) \ 416 for (pos = (head)->prev; pos != (head); pos = pos->prev) 417 418 /** 419 * list_for_each_safe - iterate over a list safe against removal of list entry 420 * @pos: the &struct list_head to use as a loop cursor. 421 * @n: another &struct list_head to use as temporary storage 422 * @head: the head for your list. 423 */ 424 #define list_for_each_safe(pos, n, head) \ 425 for (pos = (head)->next, n = pos->next; pos != (head); \ 426 pos = n, n = pos->next) 427 428 /** 429 * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry 430 * @pos: the &struct list_head to use as a loop cursor. 431 * @n: another &struct list_head to use as temporary storage 432 * @head: the head for your list. 433 */ 434 #define list_for_each_prev_safe(pos, n, head) \ 435 for (pos = (head)->prev, n = pos->prev; \ 436 pos != (head); \ 437 pos = n, n = pos->prev) 438 439 /** 440 * list_for_each_entry - iterate over list of given type 441 * @pos: the type * to use as a loop cursor. 442 * @head: the head for your list. 443 * @member: the name of the list_struct within the struct. 444 */ 445 #define list_for_each_entry(pos, head, member) \ 446 for (pos = list_first_entry(head, typeof(*pos), member); \ 447 &pos->member != (head); \ 448 pos = list_next_entry(pos, member)) 449 450 /** 451 * list_for_each_entry_reverse - iterate backwards over list of given type. 452 * @pos: the type * to use as a loop cursor. 453 * @head: the head for your list. 454 * @member: the name of the list_struct within the struct. 455 */ 456 #define list_for_each_entry_reverse(pos, head, member) \ 457 for (pos = list_last_entry(head, typeof(*pos), member); \ 458 &pos->member != (head); \ 459 pos = list_prev_entry(pos, member)) 460 461 /** 462 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() 463 * @pos: the type * to use as a start point 464 * @head: the head of the list 465 * @member: the name of the list_struct within the struct. 466 * 467 * Prepares a pos entry for use as a start point in list_for_each_entry_continue(). 468 */ 469 #define list_prepare_entry(pos, head, member) \ 470 ((pos) ? : list_entry(head, typeof(*pos), member)) 471 472 /** 473 * list_for_each_entry_continue - continue iteration over list of given type 474 * @pos: the type * to use as a loop cursor. 475 * @head: the head for your list. 476 * @member: the name of the list_struct within the struct. 477 * 478 * Continue to iterate over list of given type, continuing after 479 * the current position. 480 */ 481 #define list_for_each_entry_continue(pos, head, member) \ 482 for (pos = list_next_entry(pos, member); \ 483 &pos->member != (head); \ 484 pos = list_next_entry(pos, member)) 485 486 /** 487 * list_for_each_entry_continue_reverse - iterate backwards from the given point 488 * @pos: the type * to use as a loop cursor. 489 * @head: the head for your list. 490 * @member: the name of the list_struct within the struct. 491 * 492 * Start to iterate over list of given type backwards, continuing after 493 * the current position. 494 */ 495 #define list_for_each_entry_continue_reverse(pos, head, member) \ 496 for (pos = list_prev_entry(pos, member); \ 497 &pos->member != (head); \ 498 pos = list_prev_entry(pos, member)) 499 500 /** 501 * list_for_each_entry_from - iterate over list of given type from the current point 502 * @pos: the type * to use as a loop cursor. 503 * @head: the head for your list. 504 * @member: the name of the list_struct within the struct. 505 * 506 * Iterate over list of given type, continuing from current position. 507 */ 508 #define list_for_each_entry_from(pos, head, member) \ 509 for (; &pos->member != (head); \ 510 pos = list_next_entry(pos, member)) 511 512 /** 513 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry 514 * @pos: the type * to use as a loop cursor. 515 * @n: another type * to use as temporary storage 516 * @head: the head for your list. 517 * @member: the name of the list_struct within the struct. 518 */ 519 #define list_for_each_entry_safe(pos, n, head, member) \ 520 for (pos = list_first_entry(head, typeof(*pos), member), \ 521 n = list_next_entry(pos, member); \ 522 &pos->member != (head); \ 523 pos = n, n = list_next_entry(n, member)) 524 525 /** 526 * list_for_each_entry_safe_continue - continue list iteration safe against removal 527 * @pos: the type * to use as a loop cursor. 528 * @n: another type * to use as temporary storage 529 * @head: the head for your list. 530 * @member: the name of the list_struct within the struct. 531 * 532 * Iterate over list of given type, continuing after current point, 533 * safe against removal of list entry. 534 */ 535 #define list_for_each_entry_safe_continue(pos, n, head, member) \ 536 for (pos = list_next_entry(pos, member), \ 537 n = list_next_entry(pos, member); \ 538 &pos->member != (head); \ 539 pos = n, n = list_next_entry(n, member)) 540 541 /** 542 * list_for_each_entry_safe_from - iterate over list from current point safe against removal 543 * @pos: the type * to use as a loop cursor. 544 * @n: another type * to use as temporary storage 545 * @head: the head for your list. 546 * @member: the name of the list_struct within the struct. 547 * 548 * Iterate over list of given type from current point, safe against 549 * removal of list entry. 550 */ 551 #define list_for_each_entry_safe_from(pos, n, head, member) \ 552 for (n = list_next_entry(pos, member); \ 553 &pos->member != (head); \ 554 pos = n, n = list_next_entry(n, member)) 555 556 /** 557 * list_for_each_entry_safe_reverse - iterate backwards over list safe against removal 558 * @pos: the type * to use as a loop cursor. 559 * @n: another type * to use as temporary storage 560 * @head: the head for your list. 561 * @member: the name of the list_struct within the struct. 562 * 563 * Iterate backwards over list of given type, safe against removal 564 * of list entry. 565 */ 566 #define list_for_each_entry_safe_reverse(pos, n, head, member) \ 567 for (pos = list_last_entry(head, typeof(*pos), member), \ 568 n = list_prev_entry(pos, member); \ 569 &pos->member != (head); \ 570 pos = n, n = list_prev_entry(n, member)) 571 572 /** 573 * list_safe_reset_next - reset a stale list_for_each_entry_safe loop 574 * @pos: the loop cursor used in the list_for_each_entry_safe loop 575 * @n: temporary storage used in list_for_each_entry_safe 576 * @member: the name of the list_struct within the struct. 577 * 578 * list_safe_reset_next is not safe to use in general if the list may be 579 * modified concurrently (eg. the lock is dropped in the loop body). An 580 * exception to this is if the cursor element (pos) is pinned in the list, 581 * and list_safe_reset_next is called after re-taking the lock and before 582 * completing the current iteration of the loop body. 583 */ 584 #define list_safe_reset_next(pos, n, member) \ 585 n = list_next_entry(pos, member) 586 587 /* 588 * Double linked lists with a single pointer list head. 589 * Mostly useful for hash tables where the two pointer list head is 590 * too wasteful. 591 * You lose the ability to access the tail in O(1). 592 */ 593 594 #define HLIST_HEAD_INIT { .first = NULL } 595 #define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } 596 #define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) 597 static inline void INIT_HLIST_NODE(struct hlist_node *h) 598 { 599 h->next = NULL; 600 h->pprev = NULL; 601 } 602 603 static inline int hlist_unhashed(const struct hlist_node *h) 604 { 605 return !h->pprev; 606 } 607 608 static inline int hlist_empty(const struct hlist_head *h) 609 { 610 return !h->first; 611 } 612 613 static inline void __hlist_del(struct hlist_node *n) 614 { 615 struct hlist_node *next = n->next; 616 struct hlist_node **pprev = n->pprev; 617 *pprev = next; 618 if (next) 619 next->pprev = pprev; 620 } 621 622 static inline void hlist_del(struct hlist_node *n) 623 { 624 __hlist_del(n); 625 n->next = LIST_POISON1; 626 n->pprev = LIST_POISON2; 627 } 628 629 static inline void hlist_del_init(struct hlist_node *n) 630 { 631 if (!hlist_unhashed(n)) { 632 __hlist_del(n); 633 INIT_HLIST_NODE(n); 634 } 635 } 636 637 static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) 638 { 639 struct hlist_node *first = h->first; 640 n->next = first; 641 if (first) 642 first->pprev = &n->next; 643 h->first = n; 644 n->pprev = &h->first; 645 } 646 647 /* next must be != NULL */ 648 static inline void hlist_add_before(struct hlist_node *n, 649 struct hlist_node *next) 650 { 651 n->pprev = next->pprev; 652 n->next = next; 653 next->pprev = &n->next; 654 *(n->pprev) = n; 655 } 656 657 static inline void hlist_add_after(struct hlist_node *n, 658 struct hlist_node *next) 659 { 660 next->next = n->next; 661 n->next = next; 662 next->pprev = &n->next; 663 664 if(next->next) 665 next->next->pprev = &next->next; 666 } 667 668 /* after that we'll appear to be on some hlist and hlist_del will work */ 669 static inline void hlist_add_fake(struct hlist_node *n) 670 { 671 n->pprev = &n->next; 672 } 673 674 /* 675 * Move a list from one list head to another. Fixup the pprev 676 * reference of the first entry if it exists. 677 */ 678 static inline void hlist_move_list(struct hlist_head *old, 679 struct hlist_head *new) 680 { 681 new->first = old->first; 682 if (new->first) 683 new->first->pprev = &new->first; 684 old->first = NULL; 685 } 686 687 #define hlist_entry(ptr, type, member) container_of(ptr,type,member) 688 689 #define hlist_for_each(pos, head) \ 690 for (pos = (head)->first; pos ; pos = pos->next) 691 692 #define hlist_for_each_safe(pos, n, head) \ 693 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ 694 pos = n) 695 696 #define hlist_entry_safe(ptr, type, member) \ 697 ({ typeof(ptr) ____ptr = (ptr); \ 698 ____ptr ? hlist_entry(____ptr, type, member) : NULL; \ 699 }) 700 701 /** 702 * hlist_for_each_entry - iterate over list of given type 703 * @pos: the type * to use as a loop cursor. 704 * @head: the head for your list. 705 * @member: the name of the hlist_node within the struct. 706 */ 707 #define hlist_for_each_entry(pos, head, member) \ 708 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\ 709 pos; \ 710 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) 711 712 /** 713 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point 714 * @pos: the type * to use as a loop cursor. 715 * @member: the name of the hlist_node within the struct. 716 */ 717 #define hlist_for_each_entry_continue(pos, member) \ 718 for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member);\ 719 pos; \ 720 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) 721 722 /** 723 * hlist_for_each_entry_from - iterate over a hlist continuing from current point 724 * @pos: the type * to use as a loop cursor. 725 * @member: the name of the hlist_node within the struct. 726 */ 727 #define hlist_for_each_entry_from(pos, member) \ 728 for (; pos; \ 729 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) 730 731 /** 732 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry 733 * @pos: the type * to use as a loop cursor. 734 * @n: another &struct hlist_node to use as temporary storage 735 * @head: the head for your list. 736 * @member: the name of the hlist_node within the struct. 737 */ 738 #define hlist_for_each_entry_safe(pos, n, head, member) \ 739 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\ 740 pos && ({ n = pos->member.next; 1; }); \ 741 pos = hlist_entry_safe(n, typeof(*pos), member)) 742 743 #endif
1 /* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Definitions for the Interfaces handler. 7 * 8 * Version: @(#)dev.h 1.0.10 08/12/93 9 * 10 * Authors: Ross Biro 11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 12 * Corey Minyard <wf-rch!minyard@relay.EU.net> 13 * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov> 14 * Alan Cox, <alan@lxorguk.ukuu.org.uk> 15 * Bjorn Ekwall. <bj0rn@blox.se> 16 * Pekka Riikonen <priikone@poseidon.pspt.fi> 17 * 18 * This program is free software; you can redistribute it and/or 19 * modify it under the terms of the GNU General Public License 20 * as published by the Free Software Foundation; either version 21 * 2 of the License, or (at your option) any later version. 22 * 23 * Moved to /usr/include/linux for NET3 24 */ 25 #ifndef _LINUX_NETDEVICE_H 26 #define _LINUX_NETDEVICE_H 27 28 #include <linux/pm_qos.h> 29 #include <linux/timer.h> 30 #include <linux/bug.h> 31 #include <linux/delay.h> 32 #include <linux/atomic.h> 33 #include <asm/cache.h> 34 #include <asm/byteorder.h> 35 36 #include <linux/percpu.h> 37 #include <linux/rculist.h> 38 #include <linux/dmaengine.h> 39 #include <linux/workqueue.h> 40 #include <linux/dynamic_queue_limits.h> 41 42 #include <linux/ethtool.h> 43 #include <net/net_namespace.h> 44 #include <net/dsa.h> 45 #ifdef CONFIG_DCB 46 #include <net/dcbnl.h> 47 #endif 48 #include <net/netprio_cgroup.h> 49 50 #include <linux/netdev_features.h> 51 #include <linux/neighbour.h> 52 #include <uapi/linux/netdevice.h> 53 54 struct netpoll_info; 55 struct device; 56 struct phy_device; 57 /* 802.11 specific */ 58 struct wireless_dev; 59 /* source back-compat hooks */ 60 #define SET_ETHTOOL_OPS(netdev,ops) \ 61 ( (netdev)->ethtool_ops = (ops) ) 62 63 void netdev_set_default_ethtool_ops(struct net_device *dev, 64 const struct ethtool_ops *ops); 65 66 /* hardware address assignment types */ 67 #define NET_ADDR_PERM 0 /* address is permanent (default) */ 68 #define NET_ADDR_RANDOM 1 /* address is generated randomly */ 69 #define NET_ADDR_STOLEN 2 /* address is stolen from other device */ 70 #define NET_ADDR_SET 3 /* address is set using 71 * dev_set_mac_address() */ 72 73 /* Backlog congestion levels */ 74 #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 75 #define NET_RX_DROP 1 /* packet dropped */ 76 77 /* 78 * Transmit return codes: transmit return codes originate from three different 79 * namespaces: 80 * 81 * - qdisc return codes 82 * - driver transmit return codes 83 * - errno values 84 * 85 * Drivers are allowed to return any one of those in their hard_start_xmit() 86 * function. Real network devices commonly used with qdiscs should only return 87 * the driver transmit return codes though - when qdiscs are used, the actual 88 * transmission happens asynchronously, so the value is not propagated to 89 * higher layers. Virtual network devices transmit synchronously, in this case 90 * the driver transmit return codes are consumed by dev_queue_xmit(), all 91 * others are propagated to higher layers. 92 */ 93 94 /* qdisc ->enqueue() return codes. */ 95 #define NET_XMIT_SUCCESS 0x00 96 #define NET_XMIT_DROP 0x01 /* skb dropped */ 97 #define NET_XMIT_CN 0x02 /* congestion notification */ 98 #define NET_XMIT_POLICED 0x03 /* skb is shot by police */ 99 #define NET_XMIT_MASK 0x0f /* qdisc flags in net/sch_generic.h */ 100 101 /* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It 102 * indicates that the device will soon be dropping packets, or already drops 103 * some packets of the same priority; prompting us to send less aggressively. */ 104 #define net_xmit_eval(e) ((e) == NET_XMIT_CN ? 0 : (e)) 105 #define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) 106 107 /* Driver transmit return codes */ 108 #define NETDEV_TX_MASK 0xf0 109 110 enum netdev_tx { 111 __NETDEV_TX_MIN = INT_MIN, /* make sure enum is signed */ 112 NETDEV_TX_OK = 0x00, /* driver took care of packet */ 113 NETDEV_TX_BUSY = 0x10, /* driver tx path was busy*/ 114 NETDEV_TX_LOCKED = 0x20, /* driver tx lock was already taken */ 115 }; 116 typedef enum netdev_tx netdev_tx_t; 117 118 /* 119 * Current order: NETDEV_TX_MASK > NET_XMIT_MASK >= 0 is significant; 120 * hard_start_xmit() return < NET_XMIT_MASK means skb was consumed. 121 */ 122 static inline bool dev_xmit_complete(int rc) 123 { 124 /* 125 * Positive cases with an skb consumed by a driver: 126 * - successful transmission (rc == NETDEV_TX_OK) 127 * - error while transmitting (rc < 0) 128 * - error while queueing to a different device (rc & NET_XMIT_MASK) 129 */ 130 if (likely(rc < NET_XMIT_MASK)) 131 return true; 132 133 return false; 134 } 135 136 /* 137 * Compute the worst case header length according to the protocols 138 * used. 139 */ 140 141 #if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) 142 # if defined(CONFIG_MAC80211_MESH) 143 # define LL_MAX_HEADER 128 144 # else 145 # define LL_MAX_HEADER 96 146 # endif 147 #else 148 # define LL_MAX_HEADER 32 149 #endif 150 151 #if !IS_ENABLED(CONFIG_NET_IPIP) && !IS_ENABLED(CONFIG_NET_IPGRE) && \ 152 !IS_ENABLED(CONFIG_IPV6_SIT) && !IS_ENABLED(CONFIG_IPV6_TUNNEL) 153 #define MAX_HEADER LL_MAX_HEADER 154 #else 155 #define MAX_HEADER (LL_MAX_HEADER + 48) 156 #endif 157 158 /* 159 * Old network device statistics. Fields are native words 160 * (unsigned long) so they can be read and written atomically. 161 */ 162 163 struct net_device_stats { 164 unsigned long rx_packets; 165 unsigned long tx_packets; 166 unsigned long rx_bytes; 167 unsigned long tx_bytes; 168 unsigned long rx_errors; 169 unsigned long tx_errors; 170 unsigned long rx_dropped; 171 unsigned long tx_dropped; 172 unsigned long multicast; 173 unsigned long collisions; 174 unsigned long rx_length_errors; 175 unsigned long rx_over_errors; 176 unsigned long rx_crc_errors; 177 unsigned long rx_frame_errors; 178 unsigned long rx_fifo_errors; 179 unsigned long rx_missed_errors; 180 unsigned long tx_aborted_errors; 181 unsigned long tx_carrier_errors; 182 unsigned long tx_fifo_errors; 183 unsigned long tx_heartbeat_errors; 184 unsigned long tx_window_errors; 185 unsigned long rx_compressed; 186 unsigned long tx_compressed; 187 }; 188 189 190 #include <linux/cache.h> 191 #include <linux/skbuff.h> 192 193 #ifdef CONFIG_RPS 194 #include <linux/static_key.h> 195 extern struct static_key rps_needed; 196 #endif 197 198 struct neighbour; 199 struct neigh_parms; 200 struct sk_buff; 201 202 struct netdev_hw_addr { 203 struct list_head list; 204 unsigned char addr[MAX_ADDR_LEN]; 205 unsigned char type; 206 #define NETDEV_HW_ADDR_T_LAN 1 207 #define NETDEV_HW_ADDR_T_SAN 2 208 #define NETDEV_HW_ADDR_T_SLAVE 3 209 #define NETDEV_HW_ADDR_T_UNICAST 4 210 #define NETDEV_HW_ADDR_T_MULTICAST 5 211 bool global_use; 212 int sync_cnt; 213 int refcount; 214 int synced; 215 struct rcu_head rcu_head; 216 }; 217 218 struct netdev_hw_addr_list { 219 struct list_head list; 220 int count; 221 }; 222 223 #define netdev_hw_addr_list_count(l) ((l)->count) 224 #define netdev_hw_addr_list_empty(l) (netdev_hw_addr_list_count(l) == 0) 225 #define netdev_hw_addr_list_for_each(ha, l) \ 226 list_for_each_entry(ha, &(l)->list, list) 227 228 #define netdev_uc_count(dev) netdev_hw_addr_list_count(&(dev)->uc) 229 #define netdev_uc_empty(dev) netdev_hw_addr_list_empty(&(dev)->uc) 230 #define netdev_for_each_uc_addr(ha, dev) \ 231 netdev_hw_addr_list_for_each(ha, &(dev)->uc) 232 233 #define netdev_mc_count(dev) netdev_hw_addr_list_count(&(dev)->mc) 234 #define netdev_mc_empty(dev) netdev_hw_addr_list_empty(&(dev)->mc) 235 #define netdev_for_each_mc_addr(ha, dev) \ 236 netdev_hw_addr_list_for_each(ha, &(dev)->mc) 237 238 struct hh_cache { 239 u16 hh_len; 240 u16 __pad; 241 seqlock_t hh_lock; 242 243 /* cached hardware header; allow for machine alignment needs. */ 244 #define HH_DATA_MOD 16 245 #define HH_DATA_OFF(__len) \ 246 (HH_DATA_MOD - (((__len - 1) & (HH_DATA_MOD - 1)) + 1)) 247 #define HH_DATA_ALIGN(__len) \ 248 (((__len)+(HH_DATA_MOD-1))&~(HH_DATA_MOD - 1)) 249 unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)]; 250 }; 251 252 /* Reserve HH_DATA_MOD byte aligned hard_header_len, but at least that much. 253 * Alternative is: 254 * dev->hard_header_len ? (dev->hard_header_len + 255 * (HH_DATA_MOD - 1)) & ~(HH_DATA_MOD - 1) : 0 256 * 257 * We could use other alignment values, but we must maintain the 258 * relationship HH alignment <= LL alignment. 259 */ 260 #define LL_RESERVED_SPACE(dev) \ 261 ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 262 #define LL_RESERVED_SPACE_EXTRA(dev,extra) \ 263 ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 264 265 struct header_ops { 266 int (*create) (struct sk_buff *skb, struct net_device *dev, 267 unsigned short type, const void *daddr, 268 const void *saddr, unsigned int len); 269 int (*parse)(const struct sk_buff *skb, unsigned char *haddr); 270 int (*rebuild)(struct sk_buff *skb); 271 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); 272 void (*cache_update)(struct hh_cache *hh, 273 const struct net_device *dev, 274 const unsigned char *haddr); 275 }; 276 277 /* These flag bits are private to the generic network queueing 278 * layer, they may not be explicitly referenced by any other 279 * code. 280 */ 281 282 enum netdev_state_t { 283 __LINK_STATE_START, 284 __LINK_STATE_PRESENT, 285 __LINK_STATE_NOCARRIER, 286 __LINK_STATE_LINKWATCH_PENDING, 287 __LINK_STATE_DORMANT, 288 }; 289 290 291 /* 292 * This structure holds at boot time configured netdevice settings. They 293 * are then used in the device probing. 294 */ 295 struct netdev_boot_setup { 296 char name[IFNAMSIZ]; 297 struct ifmap map; 298 }; 299 #define NETDEV_BOOT_SETUP_MAX 8 300 301 int __init netdev_boot_setup(char *str); 302 303 /* 304 * Structure for NAPI scheduling similar to tasklet but with weighting 305 */ 306 struct napi_struct { 307 /* The poll_list must only be managed by the entity which 308 * changes the state of the NAPI_STATE_SCHED bit. This means 309 * whoever atomically sets that bit can add this napi_struct 310 * to the per-cpu poll_list, and whoever clears that bit 311 * can remove from the list right before clearing the bit. 312 */ 313 struct list_head poll_list; 314 315 unsigned long state; 316 int weight; 317 unsigned int gro_count; 318 int (*poll)(struct napi_struct *, int); 319 #ifdef CONFIG_NETPOLL 320 spinlock_t poll_lock; 321 int poll_owner; 322 #endif 323 struct net_device *dev; 324 struct sk_buff *gro_list; 325 struct sk_buff *skb; 326 struct list_head dev_list; 327 struct hlist_node napi_hash_node; 328 unsigned int napi_id; 329 }; 330 331 enum { 332 NAPI_STATE_SCHED, /* Poll is scheduled */ 333 NAPI_STATE_DISABLE, /* Disable pending */ 334 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ 335 NAPI_STATE_HASHED, /* In NAPI hash */ 336 }; 337 338 enum gro_result { 339 GRO_MERGED, 340 GRO_MERGED_FREE, 341 GRO_HELD, 342 GRO_NORMAL, 343 GRO_DROP, 344 }; 345 typedef enum gro_result gro_result_t; 346 347 /* 348 * enum rx_handler_result - Possible return values for rx_handlers. 349 * @RX_HANDLER_CONSUMED: skb was consumed by rx_handler, do not process it 350 * further. 351 * @RX_HANDLER_ANOTHER: Do another round in receive path. This is indicated in 352 * case skb->dev was changed by rx_handler. 353 * @RX_HANDLER_EXACT: Force exact delivery, no wildcard. 354 * @RX_HANDLER_PASS: Do nothing, passe the skb as if no rx_handler was called. 355 * 356 * rx_handlers are functions called from inside __netif_receive_skb(), to do 357 * special processing of the skb, prior to delivery to protocol handlers. 358 * 359 * Currently, a net_device can only have a single rx_handler registered. Trying 360 * to register a second rx_handler will return -EBUSY. 361 * 362 * To register a rx_handler on a net_device, use netdev_rx_handler_register(). 363 * To unregister a rx_handler on a net_device, use 364 * netdev_rx_handler_unregister(). 365 * 366 * Upon return, rx_handler is expected to tell __netif_receive_skb() what to 367 * do with the skb. 368 * 369 * If the rx_handler consumed to skb in some way, it should return 370 * RX_HANDLER_CONSUMED. This is appropriate when the rx_handler arranged for 371 * the skb to be delivered in some other ways. 372 * 373 * If the rx_handler changed skb->dev, to divert the skb to another 374 * net_device, it should return RX_HANDLER_ANOTHER. The rx_handler for the 375 * new device will be called if it exists. 376 * 377 * If the rx_handler consider the skb should be ignored, it should return 378 * RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that 379 * are registered on exact device (ptype->dev == skb->dev). 380 * 381 * If the rx_handler didn't changed skb->dev, but want the skb to be normally 382 * delivered, it should return RX_HANDLER_PASS. 383 * 384 * A device without a registered rx_handler will behave as if rx_handler 385 * returned RX_HANDLER_PASS. 386 */ 387 388 enum rx_handler_result { 389 RX_HANDLER_CONSUMED, 390 RX_HANDLER_ANOTHER, 391 RX_HANDLER_EXACT, 392 RX_HANDLER_PASS, 393 }; 394 typedef enum rx_handler_result rx_handler_result_t; 395 typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); 396 397 void __napi_schedule(struct napi_struct *n); 398 399 static inline bool napi_disable_pending(struct napi_struct *n) 400 { 401 return test_bit(NAPI_STATE_DISABLE, &n->state); 402 } 403 404 /** 405 * napi_schedule_prep - check if napi can be scheduled 406 * @n: napi context 407 * 408 * Test if NAPI routine is already running, and if not mark 409 * it as running. This is used as a condition variable 410 * insure only one NAPI poll instance runs. We also make 411 * sure there is no pending NAPI disable. 412 */ 413 static inline bool napi_schedule_prep(struct napi_struct *n) 414 { 415 return !napi_disable_pending(n) && 416 !test_and_set_bit(NAPI_STATE_SCHED, &n->state); 417 } 418 419 /** 420 * napi_schedule - schedule NAPI poll 421 * @n: napi context 422 * 423 * Schedule NAPI poll routine to be called if it is not already 424 * running. 425 */ 426 static inline void napi_schedule(struct napi_struct *n) 427 { 428 if (napi_schedule_prep(n)) 429 __napi_schedule(n); 430 } 431 432 /* Try to reschedule poll. Called by dev->poll() after napi_complete(). */ 433 static inline bool napi_reschedule(struct napi_struct *napi) 434 { 435 if (napi_schedule_prep(napi)) { 436 __napi_schedule(napi); 437 return true; 438 } 439 return false; 440 } 441 442 /** 443 * napi_complete - NAPI processing complete 444 * @n: napi context 445 * 446 * Mark NAPI processing as complete. 447 */ 448 void __napi_complete(struct napi_struct *n); 449 void napi_complete(struct napi_struct *n); 450 451 /** 452 * napi_by_id - lookup a NAPI by napi_id 453 * @napi_id: hashed napi_id 454 * 455 * lookup @napi_id in napi_hash table 456 * must be called under rcu_read_lock() 457 */ 458 struct napi_struct *napi_by_id(unsigned int napi_id); 459 460 /** 461 * napi_hash_add - add a NAPI to global hashtable 462 * @napi: napi context 463 * 464 * generate a new napi_id and store a @napi under it in napi_hash 465 */ 466 void napi_hash_add(struct napi_struct *napi); 467 468 /** 469 * napi_hash_del - remove a NAPI from global table 470 * @napi: napi context 471 * 472 * Warning: caller must observe rcu grace period 473 * before freeing memory containing @napi 474 */ 475 void napi_hash_del(struct napi_struct *napi); 476 477 /** 478 * napi_disable - prevent NAPI from scheduling 479 * @n: napi context 480 * 481 * Stop NAPI from being scheduled on this context. 482 * Waits till any outstanding processing completes. 483 */ 484 static inline void napi_disable(struct napi_struct *n) 485 { 486 might_sleep(); 487 set_bit(NAPI_STATE_DISABLE, &n->state); 488 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) 489 msleep(1); 490 clear_bit(NAPI_STATE_DISABLE, &n->state); 491 } 492 493 /** 494 * napi_enable - enable NAPI scheduling 495 * @n: napi context 496 * 497 * Resume NAPI from being scheduled on this context. 498 * Must be paired with napi_disable. 499 */ 500 static inline void napi_enable(struct napi_struct *n) 501 { 502 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); 503 smp_mb__before_clear_bit(); 504 clear_bit(NAPI_STATE_SCHED, &n->state); 505 } 506 507 #ifdef CONFIG_SMP 508 /** 509 * napi_synchronize - wait until NAPI is not running 510 * @n: napi context 511 * 512 * Wait until NAPI is done being scheduled on this context. 513 * Waits till any outstanding processing completes but 514 * does not disable future activations. 515 */ 516 static inline void napi_synchronize(const struct napi_struct *n) 517 { 518 while (test_bit(NAPI_STATE_SCHED, &n->state)) 519 msleep(1); 520 } 521 #else 522 # define napi_synchronize(n) barrier() 523 #endif 524 525 enum netdev_queue_state_t { 526 __QUEUE_STATE_DRV_XOFF, 527 __QUEUE_STATE_STACK_XOFF, 528 __QUEUE_STATE_FROZEN, 529 #define QUEUE_STATE_ANY_XOFF ((1 << __QUEUE_STATE_DRV_XOFF) | \ 530 (1 << __QUEUE_STATE_STACK_XOFF)) 531 #define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \ 532 (1 << __QUEUE_STATE_FROZEN)) 533 }; 534 /* 535 * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The 536 * netif_tx_* functions below are used to manipulate this flag. The 537 * __QUEUE_STATE_STACK_XOFF flag is used by the stack to stop the transmit 538 * queue independently. The netif_xmit_*stopped functions below are called 539 * to check if the queue has been stopped by the driver or stack (either 540 * of the XOFF bits are set in the state). Drivers should not need to call 541 * netif_xmit*stopped functions, they should only be using netif_tx_*. 542 */ 543 544 struct netdev_queue { 545 /* 546 * read mostly part 547 */ 548 struct net_device *dev; 549 struct Qdisc *qdisc; 550 struct Qdisc *qdisc_sleeping; 551 #ifdef CONFIG_SYSFS 552 struct kobject kobj; 553 #endif 554 #if defined(CONFIG_XPS) && defined(CONFIG_NUMA) 555 int numa_node; 556 #endif 557 /* 558 * write mostly part 559 */ 560 spinlock_t _xmit_lock ____cacheline_aligned_in_smp; 561 int xmit_lock_owner; 562 /* 563 * please use this field instead of dev->trans_start 564 */ 565 unsigned long trans_start; 566 567 /* 568 * Number of TX timeouts for this queue 569 * (/sys/class/net/DEV/Q/trans_timeout) 570 */ 571 unsigned long trans_timeout; 572 573 unsigned long state; 574 575 #ifdef CONFIG_BQL 576 struct dql dql; 577 #endif 578 } ____cacheline_aligned_in_smp; 579 580 static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) 581 { 582 #if defined(CONFIG_XPS) && defined(CONFIG_NUMA) 583 return q->numa_node; 584 #else 585 return NUMA_NO_NODE; 586 #endif 587 } 588 589 static inline void netdev_queue_numa_node_write(struct netdev_queue *q, int node) 590 { 591 #if defined(CONFIG_XPS) && defined(CONFIG_NUMA) 592 q->numa_node = node; 593 #endif 594 } 595 596 #ifdef CONFIG_RPS 597 /* 598 * This structure holds an RPS map which can be of variable length. The 599 * map is an array of CPUs. 600 */ 601 struct rps_map { 602 unsigned int len; 603 struct rcu_head rcu; 604 u16 cpus[0]; 605 }; 606 #define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + ((_num) * sizeof(u16))) 607 608 /* 609 * The rps_dev_flow structure contains the mapping of a flow to a CPU, the 610 * tail pointer for that CPU's input queue at the time of last enqueue, and 611 * a hardware filter index. 612 */ 613 struct rps_dev_flow { 614 u16 cpu; 615 u16 filter; 616 unsigned int last_qtail; 617 }; 618 #define RPS_NO_FILTER 0xffff 619 620 /* 621 * The rps_dev_flow_table structure contains a table of flow mappings. 622 */ 623 struct rps_dev_flow_table { 624 unsigned int mask; 625 struct rcu_head rcu; 626 struct rps_dev_flow flows[0]; 627 }; 628 #define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \ 629 ((_num) * sizeof(struct rps_dev_flow))) 630 631 /* 632 * The rps_sock_flow_table contains mappings of flows to the last CPU 633 * on which they were processed by the application (set in recvmsg). 634 */ 635 struct rps_sock_flow_table { 636 unsigned int mask; 637 u16 ents[0]; 638 }; 639 #define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \ 640 ((_num) * sizeof(u16))) 641 642 #define RPS_NO_CPU 0xffff 643 644 static inline void rps_record_sock_flow(struct rps_sock_flow_table *table, 645 u32 hash) 646 { 647 if (table && hash) { 648 unsigned int cpu, index = hash & table->mask; 649 650 /* We only give a hint, preemption can change cpu under us */ 651 cpu = raw_smp_processor_id(); 652 653 if (table->ents[index] != cpu) 654 table->ents[index] = cpu; 655 } 656 } 657 658 static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table, 659 u32 hash) 660 { 661 if (table && hash) 662 table->ents[hash & table->mask] = RPS_NO_CPU; 663 } 664 665 extern struct rps_sock_flow_table __rcu *rps_sock_flow_table; 666 667 #ifdef CONFIG_RFS_ACCEL 668 bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id, 669 u16 filter_id); 670 #endif 671 #endif /* CONFIG_RPS */ 672 673 /* This structure contains an instance of an RX queue. */ 674 struct netdev_rx_queue { 675 #ifdef CONFIG_RPS 676 struct rps_map __rcu *rps_map; 677 struct rps_dev_flow_table __rcu *rps_flow_table; 678 #endif 679 struct kobject kobj; 680 struct net_device *dev; 681 } ____cacheline_aligned_in_smp; 682 683 /* 684 * RX queue sysfs structures and functions. 685 */ 686 struct rx_queue_attribute { 687 struct attribute attr; 688 ssize_t (*show)(struct netdev_rx_queue *queue, 689 struct rx_queue_attribute *attr, char *buf); 690 ssize_t (*store)(struct netdev_rx_queue *queue, 691 struct rx_queue_attribute *attr, const char *buf, size_t len); 692 }; 693 694 #ifdef CONFIG_XPS 695 /* 696 * This structure holds an XPS map which can be of variable length. The 697 * map is an array of queues. 698 */ 699 struct xps_map { 700 unsigned int len; 701 unsigned int alloc_len; 702 struct rcu_head rcu; 703 u16 queues[0]; 704 }; 705 #define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16))) 706 #define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \ 707 / sizeof(u16)) 708 709 /* 710 * This structure holds all XPS maps for device. Maps are indexed by CPU. 711 */ 712 struct xps_dev_maps { 713 struct rcu_head rcu; 714 struct xps_map __rcu *cpu_map[0]; 715 }; 716 #define XPS_DEV_MAPS_SIZE (sizeof(struct xps_dev_maps) + \ 717 (nr_cpu_ids * sizeof(struct xps_map *))) 718 #endif /* CONFIG_XPS */ 719 720 #define TC_MAX_QUEUE 16 721 #define TC_BITMASK 15 722 /* HW offloaded queuing disciplines txq count and offset maps */ 723 struct netdev_tc_txq { 724 u16 count; 725 u16 offset; 726 }; 727 728 #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 729 /* 730 * This structure is to hold information about the device 731 * configured to run FCoE protocol stack. 732 */ 733 struct netdev_fcoe_hbainfo { 734 char manufacturer[64]; 735 char serial_number[64]; 736 char hardware_version[64]; 737 char driver_version[64]; 738 char optionrom_version[64]; 739 char firmware_version[64]; 740 char model[256]; 741 char model_description[256]; 742 }; 743 #endif 744 745 #define MAX_PHYS_PORT_ID_LEN 32 746 747 /* This structure holds a unique identifier to identify the 748 * physical port used by a netdevice. 749 */ 750 struct netdev_phys_port_id { 751 unsigned char id[MAX_PHYS_PORT_ID_LEN]; 752 unsigned char id_len; 753 }; 754 755 typedef u16 (*select_queue_fallback_t)(struct net_device *dev, 756 struct sk_buff *skb); 757 758 /* 759 * This structure defines the management hooks for network devices. 760 * The following hooks can be defined; unless noted otherwise, they are 761 * optional and can be filled with a null pointer. 762 * 763 * int (*ndo_init)(struct net_device *dev); 764 * This function is called once when network device is registered. 765 * The network device can use this to any late stage initializaton 766 * or semantic validattion. It can fail with an error code which will 767 * be propogated back to register_netdev 768 * 769 * void (*ndo_uninit)(struct net_device *dev); 770 * This function is called when device is unregistered or when registration 771 * fails. It is not called if init fails. 772 * 773 * int (*ndo_open)(struct net_device *dev); 774 * This function is called when network device transistions to the up 775 * state. 776 * 777 * int (*ndo_stop)(struct net_device *dev); 778 * This function is called when network device transistions to the down 779 * state. 780 * 781 * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, 782 * struct net_device *dev); 783 * Called when a packet needs to be transmitted. 784 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY. 785 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX) 786 * Required can not be NULL. 787 * 788 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, 789 * void *accel_priv, select_queue_fallback_t fallback); 790 * Called to decide which queue to when device supports multiple 791 * transmit queues. 792 * 793 * void (*ndo_change_rx_flags)(struct net_device *dev, int flags); 794 * This function is called to allow device receiver to make 795 * changes to configuration when multicast or promiscious is enabled. 796 * 797 * void (*ndo_set_rx_mode)(struct net_device *dev); 798 * This function is called device changes address list filtering. 799 * If driver handles unicast address filtering, it should set 800 * IFF_UNICAST_FLT to its priv_flags. 801 * 802 * int (*ndo_set_mac_address)(struct net_device *dev, void *addr); 803 * This function is called when the Media Access Control address 804 * needs to be changed. If this interface is not defined, the 805 * mac address can not be changed. 806 * 807 * int (*ndo_validate_addr)(struct net_device *dev); 808 * Test if Media Access Control address is valid for the device. 809 * 810 * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); 811 * Called when a user request an ioctl which can't be handled by 812 * the generic interface code. If not defined ioctl's return 813 * not supported error code. 814 * 815 * int (*ndo_set_config)(struct net_device *dev, struct ifmap *map); 816 * Used to set network devices bus interface parameters. This interface 817 * is retained for legacy reason, new devices should use the bus 818 * interface (PCI) for low level management. 819 * 820 * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu); 821 * Called when a user wants to change the Maximum Transfer Unit 822 * of a device. If not defined, any request to change MTU will 823 * will return an error. 824 * 825 * void (*ndo_tx_timeout)(struct net_device *dev); 826 * Callback uses when the transmitter has not made any progress 827 * for dev->watchdog ticks. 828 * 829 * struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev, 830 * struct rtnl_link_stats64 *storage); 831 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 832 * Called when a user wants to get the network device usage 833 * statistics. Drivers must do one of the following: 834 * 1. Define @ndo_get_stats64 to fill in a zero-initialised 835 * rtnl_link_stats64 structure passed by the caller. 836 * 2. Define @ndo_get_stats to update a net_device_stats structure 837 * (which should normally be dev->stats) and return a pointer to 838 * it. The structure may be changed asynchronously only if each 839 * field is written atomically. 840 * 3. Update dev->stats asynchronously and atomically, and define 841 * neither operation. 842 * 843 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16t vid); 844 * If device support VLAN filtering this function is called when a 845 * VLAN id is registered. 846 * 847 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); 848 * If device support VLAN filtering this function is called when a 849 * VLAN id is unregistered. 850 * 851 * void (*ndo_poll_controller)(struct net_device *dev); 852 * 853 * SR-IOV management functions. 854 * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac); 855 * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos); 856 * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); 857 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); 858 * int (*ndo_get_vf_config)(struct net_device *dev, 859 * int vf, struct ifla_vf_info *ivf); 860 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state); 861 * int (*ndo_set_vf_port)(struct net_device *dev, int vf, 862 * struct nlattr *port[]); 863 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); 864 * int (*ndo_setup_tc)(struct net_device *dev, u8 tc) 865 * Called to setup 'tc' number of traffic classes in the net device. This 866 * is always called from the stack with the rtnl lock held and netif tx 867 * queues stopped. This allows the netdevice to perform queue management 868 * safely. 869 * 870 * Fiber Channel over Ethernet (FCoE) offload functions. 871 * int (*ndo_fcoe_enable)(struct net_device *dev); 872 * Called when the FCoE protocol stack wants to start using LLD for FCoE 873 * so the underlying device can perform whatever needed configuration or 874 * initialization to support acceleration of FCoE traffic. 875 * 876 * int (*ndo_fcoe_disable)(struct net_device *dev); 877 * Called when the FCoE protocol stack wants to stop using LLD for FCoE 878 * so the underlying device can perform whatever needed clean-ups to 879 * stop supporting acceleration of FCoE traffic. 880 * 881 * int (*ndo_fcoe_ddp_setup)(struct net_device *dev, u16 xid, 882 * struct scatterlist *sgl, unsigned int sgc); 883 * Called when the FCoE Initiator wants to initialize an I/O that 884 * is a possible candidate for Direct Data Placement (DDP). The LLD can 885 * perform necessary setup and returns 1 to indicate the device is set up 886 * successfully to perform DDP on this I/O, otherwise this returns 0. 887 * 888 * int (*ndo_fcoe_ddp_done)(struct net_device *dev, u16 xid); 889 * Called when the FCoE Initiator/Target is done with the DDPed I/O as 890 * indicated by the FC exchange id 'xid', so the underlying device can 891 * clean up and reuse resources for later DDP requests. 892 * 893 * int (*ndo_fcoe_ddp_target)(struct net_device *dev, u16 xid, 894 * struct scatterlist *sgl, unsigned int sgc); 895 * Called when the FCoE Target wants to initialize an I/O that 896 * is a possible candidate for Direct Data Placement (DDP). The LLD can 897 * perform necessary setup and returns 1 to indicate the device is set up 898 * successfully to perform DDP on this I/O, otherwise this returns 0. 899 * 900 * int (*ndo_fcoe_get_hbainfo)(struct net_device *dev, 901 * struct netdev_fcoe_hbainfo *hbainfo); 902 * Called when the FCoE Protocol stack wants information on the underlying 903 * device. This information is utilized by the FCoE protocol stack to 904 * register attributes with Fiber Channel management service as per the 905 * FC-GS Fabric Device Management Information(FDMI) specification. 906 * 907 * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type); 908 * Called when the underlying device wants to override default World Wide 909 * Name (WWN) generation mechanism in FCoE protocol stack to pass its own 910 * World Wide Port Name (WWPN) or World Wide Node Name (WWNN) to the FCoE 911 * protocol stack to use. 912 * 913 * RFS acceleration. 914 * int (*ndo_rx_flow_steer)(struct net_device *dev, const struct sk_buff *skb, 915 * u16 rxq_index, u32 flow_id); 916 * Set hardware filter for RFS. rxq_index is the target queue index; 917 * flow_id is a flow ID to be passed to rps_may_expire_flow() later. 918 * Return the filter ID on success, or a negative error code. 919 * 920 * Slave management functions (for bridge, bonding, etc). 921 * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev); 922 * Called to make another netdev an underling. 923 * 924 * int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev); 925 * Called to release previously enslaved netdev. 926 * 927 * Feature/offload setting functions. 928 * netdev_features_t (*ndo_fix_features)(struct net_device *dev, 929 * netdev_features_t features); 930 * Adjusts the requested feature flags according to device-specific 931 * constraints, and returns the resulting flags. Must not modify 932 * the device state. 933 * 934 * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); 935 * Called to update device configuration to new features. Passed 936 * feature set might be less than what was returned by ndo_fix_features()). 937 * Must return >0 or -errno if it changed dev->features itself. 938 * 939 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct nlattr *tb[], 940 * struct net_device *dev, 941 * const unsigned char *addr, u16 flags) 942 * Adds an FDB entry to dev for addr. 943 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[], 944 * struct net_device *dev, 945 * const unsigned char *addr) 946 * Deletes the FDB entry from dev coresponding to addr. 947 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, 948 * struct net_device *dev, int idx) 949 * Used to add FDB entries to dump requests. Implementers should add 950 * entries to skb and update idx with the number of entries. 951 * 952 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh) 953 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, 954 * struct net_device *dev, u32 filter_mask) 955 * 956 * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier); 957 * Called to change device carrier. Soft-devices (like dummy, team, etc) 958 * which do not represent real hardware may define this to allow their 959 * userspace components to manage their virtual carrier state. Devices 960 * that determine carrier state from physical hardware properties (eg 961 * network cables) or protocol-dependent mechanisms (eg 962 * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function. 963 * 964 * int (*ndo_get_phys_port_id)(struct net_device *dev, 965 * struct netdev_phys_port_id *ppid); 966 * Called to get ID of physical port of this device. If driver does 967 * not implement this, it is assumed that the hw is not able to have 968 * multiple net devices on single physical port. 969 * 970 * void (*ndo_add_vxlan_port)(struct net_device *dev, 971 * sa_family_t sa_family, __be16 port); 972 * Called by vxlan to notiy a driver about the UDP port and socket 973 * address family that vxlan is listnening to. It is called only when 974 * a new port starts listening. The operation is protected by the 975 * vxlan_net->sock_lock. 976 * 977 * void (*ndo_del_vxlan_port)(struct net_device *dev, 978 * sa_family_t sa_family, __be16 port); 979 * Called by vxlan to notify the driver about a UDP port and socket 980 * address family that vxlan is not listening to anymore. The operation 981 * is protected by the vxlan_net->sock_lock. 982 * 983 * void* (*ndo_dfwd_add_station)(struct net_device *pdev, 984 * struct net_device *dev) 985 * Called by upper layer devices to accelerate switching or other 986 * station functionality into hardware. 'pdev is the lowerdev 987 * to use for the offload and 'dev' is the net device that will 988 * back the offload. Returns a pointer to the private structure 989 * the upper layer will maintain. 990 * void (*ndo_dfwd_del_station)(struct net_device *pdev, void *priv) 991 * Called by upper layer device to delete the station created 992 * by 'ndo_dfwd_add_station'. 'pdev' is the net device backing 993 * the station and priv is the structure returned by the add 994 * operation. 995 * netdev_tx_t (*ndo_dfwd_start_xmit)(struct sk_buff *skb, 996 * struct net_device *dev, 997 * void *priv); 998 * Callback to use for xmit over the accelerated station. This 999 * is used in place of ndo_start_xmit on accelerated net 1000 * devices. 1001 */ 1002 struct net_device_ops { 1003 int (*ndo_init)(struct net_device *dev); 1004 void (*ndo_uninit)(struct net_device *dev); 1005 int (*ndo_open)(struct net_device *dev); 1006 int (*ndo_stop)(struct net_device *dev); 1007 netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb, 1008 struct net_device *dev); 1009 u16 (*ndo_select_queue)(struct net_device *dev, 1010 struct sk_buff *skb, 1011 void *accel_priv, 1012 select_queue_fallback_t fallback); 1013 void (*ndo_change_rx_flags)(struct net_device *dev, 1014 int flags); 1015 void (*ndo_set_rx_mode)(struct net_device *dev); 1016 int (*ndo_set_mac_address)(struct net_device *dev, 1017 void *addr); 1018 int (*ndo_validate_addr)(struct net_device *dev); 1019 int (*ndo_do_ioctl)(struct net_device *dev, 1020 struct ifreq *ifr, int cmd); 1021 int (*ndo_set_config)(struct net_device *dev, 1022 struct ifmap *map); 1023 int (*ndo_change_mtu)(struct net_device *dev, 1024 int new_mtu); 1025 int (*ndo_neigh_setup)(struct net_device *dev, 1026 struct neigh_parms *); 1027 void (*ndo_tx_timeout) (struct net_device *dev); 1028 1029 struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev, 1030 struct rtnl_link_stats64 *storage); 1031 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 1032 1033 int (*ndo_vlan_rx_add_vid)(struct net_device *dev, 1034 __be16 proto, u16 vid); 1035 int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, 1036 __be16 proto, u16 vid); 1037 #ifdef CONFIG_NET_POLL_CONTROLLER 1038 void (*ndo_poll_controller)(struct net_device *dev); 1039 int (*ndo_netpoll_setup)(struct net_device *dev, 1040 struct netpoll_info *info, 1041 gfp_t gfp); 1042 void (*ndo_netpoll_cleanup)(struct net_device *dev); 1043 #endif 1044 #ifdef CONFIG_NET_RX_BUSY_POLL 1045 int (*ndo_busy_poll)(struct napi_struct *dev); 1046 #endif 1047 int (*ndo_set_vf_mac)(struct net_device *dev, 1048 int queue, u8 *mac); 1049 int (*ndo_set_vf_vlan)(struct net_device *dev, 1050 int queue, u16 vlan, u8 qos); 1051 int (*ndo_set_vf_tx_rate)(struct net_device *dev, 1052 int vf, int rate); 1053 int (*ndo_set_vf_spoofchk)(struct net_device *dev, 1054 int vf, bool setting); 1055 int (*ndo_get_vf_config)(struct net_device *dev, 1056 int vf, 1057 struct ifla_vf_info *ivf); 1058 int (*ndo_set_vf_link_state)(struct net_device *dev, 1059 int vf, int link_state); 1060 int (*ndo_set_vf_port)(struct net_device *dev, 1061 int vf, 1062 struct nlattr *port[]); 1063 int (*ndo_get_vf_port)(struct net_device *dev, 1064 int vf, struct sk_buff *skb); 1065 int (*ndo_setup_tc)(struct net_device *dev, u8 tc); 1066 #if IS_ENABLED(CONFIG_FCOE) 1067 int (*ndo_fcoe_enable)(struct net_device *dev); 1068 int (*ndo_fcoe_disable)(struct net_device *dev); 1069 int (*ndo_fcoe_ddp_setup)(struct net_device *dev, 1070 u16 xid, 1071 struct scatterlist *sgl, 1072 unsigned int sgc); 1073 int (*ndo_fcoe_ddp_done)(struct net_device *dev, 1074 u16 xid); 1075 int (*ndo_fcoe_ddp_target)(struct net_device *dev, 1076 u16 xid, 1077 struct scatterlist *sgl, 1078 unsigned int sgc); 1079 int (*ndo_fcoe_get_hbainfo)(struct net_device *dev, 1080 struct netdev_fcoe_hbainfo *hbainfo); 1081 #endif 1082 1083 #if IS_ENABLED(CONFIG_LIBFCOE) 1084 #define NETDEV_FCOE_WWNN 0 1085 #define NETDEV_FCOE_WWPN 1 1086 int (*ndo_fcoe_get_wwn)(struct net_device *dev, 1087 u64 *wwn, int type); 1088 #endif 1089 1090 #ifdef CONFIG_RFS_ACCEL 1091 int (*ndo_rx_flow_steer)(struct net_device *dev, 1092 const struct sk_buff *skb, 1093 u16 rxq_index, 1094 u32 flow_id); 1095 #endif 1096 int (*ndo_add_slave)(struct net_device *dev, 1097 struct net_device *slave_dev); 1098 int (*ndo_del_slave)(struct net_device *dev, 1099 struct net_device *slave_dev); 1100 netdev_features_t (*ndo_fix_features)(struct net_device *dev, 1101 netdev_features_t features); 1102 int (*ndo_set_features)(struct net_device *dev, 1103 netdev_features_t features); 1104 int (*ndo_neigh_construct)(struct neighbour *n); 1105 void (*ndo_neigh_destroy)(struct neighbour *n); 1106 1107 int (*ndo_fdb_add)(struct ndmsg *ndm, 1108 struct nlattr *tb[], 1109 struct net_device *dev, 1110 const unsigned char *addr, 1111 u16 flags); 1112 int (*ndo_fdb_del)(struct ndmsg *ndm, 1113 struct nlattr *tb[], 1114 struct net_device *dev, 1115 const unsigned char *addr); 1116 int (*ndo_fdb_dump)(struct sk_buff *skb, 1117 struct netlink_callback *cb, 1118 struct net_device *dev, 1119 int idx); 1120 1121 int (*ndo_bridge_setlink)(struct net_device *dev, 1122 struct nlmsghdr *nlh); 1123 int (*ndo_bridge_getlink)(struct sk_buff *skb, 1124 u32 pid, u32 seq, 1125 struct net_device *dev, 1126 u32 filter_mask); 1127 int (*ndo_bridge_dellink)(struct net_device *dev, 1128 struct nlmsghdr *nlh); 1129 int (*ndo_change_carrier)(struct net_device *dev, 1130 bool new_carrier); 1131 int (*ndo_get_phys_port_id)(struct net_device *dev, 1132 struct netdev_phys_port_id *ppid); 1133 void (*ndo_add_vxlan_port)(struct net_device *dev, 1134 sa_family_t sa_family, 1135 __be16 port); 1136 void (*ndo_del_vxlan_port)(struct net_device *dev, 1137 sa_family_t sa_family, 1138 __be16 port); 1139 1140 void* (*ndo_dfwd_add_station)(struct net_device *pdev, 1141 struct net_device *dev); 1142 void (*ndo_dfwd_del_station)(struct net_device *pdev, 1143 void *priv); 1144 1145 netdev_tx_t (*ndo_dfwd_start_xmit) (struct sk_buff *skb, 1146 struct net_device *dev, 1147 void *priv); 1148 }; 1149 1150 /* 1151 * The DEVICE structure. 1152 * Actually, this whole structure is a big mistake. It mixes I/O 1153 * data with strictly "high-level" data, and it has to know about 1154 * almost every data structure used in the INET module. 1155 * 1156 * FIXME: cleanup struct net_device such that network protocol info 1157 * moves out. 1158 */ 1159 1160 struct net_device { 1161 1162 /* 1163 * This is the first field of the "visible" part of this structure 1164 * (i.e. as seen by users in the "Space.c" file). It is the name 1165 * of the interface. 1166 */ 1167 char name[IFNAMSIZ]; 1168 1169 /* device name hash chain, please keep it close to name[] */ 1170 struct hlist_node name_hlist; 1171 1172 /* snmp alias */ 1173 char *ifalias; 1174 1175 /* 1176 * I/O specific fields 1177 * FIXME: Merge these and struct ifmap into one 1178 */ 1179 unsigned long mem_end; /* shared mem end */ 1180 unsigned long mem_start; /* shared mem start */ 1181 unsigned long base_addr; /* device I/O address */ 1182 int irq; /* device IRQ number */ 1183 1184 /* 1185 * Some hardware also needs these fields, but they are not 1186 * part of the usual set specified in Space.c. 1187 */ 1188 1189 unsigned long state; 1190 1191 struct list_head dev_list; 1192 struct list_head napi_list; 1193 struct list_head unreg_list; 1194 struct list_head close_list; 1195 1196 /* directly linked devices, like slaves for bonding */ 1197 struct { 1198 struct list_head upper; 1199 struct list_head lower; 1200 } adj_list; 1201 1202 /* all linked devices, *including* neighbours */ 1203 struct { 1204 struct list_head upper; 1205 struct list_head lower; 1206 } all_adj_list; 1207 1208 1209 /* currently active device features */ 1210 netdev_features_t features; 1211 /* user-changeable features */ 1212 netdev_features_t hw_features; 1213 /* user-requested features */ 1214 netdev_features_t wanted_features; 1215 /* mask of features inheritable by VLAN devices */ 1216 netdev_features_t vlan_features; 1217 /* mask of features inherited by encapsulating devices 1218 * This field indicates what encapsulation offloads 1219 * the hardware is capable of doing, and drivers will 1220 * need to set them appropriately. 1221 */ 1222 netdev_features_t hw_enc_features; 1223 /* mask of fetures inheritable by MPLS */ 1224 netdev_features_t mpls_features; 1225 1226 /* Interface index. Unique device identifier */ 1227 int ifindex; 1228 int iflink; 1229 1230 struct net_device_stats stats; 1231 atomic_long_t rx_dropped; /* dropped packets by core network 1232 * Do not use this in drivers. 1233 */ 1234 1235 #ifdef CONFIG_WIRELESS_EXT 1236 /* List of functions to handle Wireless Extensions (instead of ioctl). 1237 * See <net/iw_handler.h> for details. Jean II */ 1238 const struct iw_handler_def * wireless_handlers; 1239 /* Instance data managed by the core of Wireless Extensions. */ 1240 struct iw_public_data * wireless_data; 1241 #endif 1242 /* Management operations */ 1243 const struct net_device_ops *netdev_ops; 1244 const struct ethtool_ops *ethtool_ops; 1245 const struct forwarding_accel_ops *fwd_ops; 1246 1247 /* Hardware header description */ 1248 const struct header_ops *header_ops; 1249 1250 unsigned int flags; /* interface flags (a la BSD) */ 1251 unsigned int priv_flags; /* Like 'flags' but invisible to userspace. 1252 * See if.h for definitions. */ 1253 unsigned short gflags; 1254 unsigned short padded; /* How much padding added by alloc_netdev() */ 1255 1256 unsigned char operstate; /* RFC2863 operstate */ 1257 unsigned char link_mode; /* mapping policy to operstate */ 1258 1259 unsigned char if_port; /* Selectable AUI, TP,..*/ 1260 unsigned char dma; /* DMA channel */ 1261 1262 unsigned int mtu; /* interface MTU value */ 1263 unsigned short type; /* interface hardware type */ 1264 unsigned short hard_header_len; /* hardware hdr length */ 1265 1266 /* extra head- and tailroom the hardware may need, but not in all cases 1267 * can this be guaranteed, especially tailroom. Some cases also use 1268 * LL_MAX_HEADER instead to allocate the skb. 1269 */ 1270 unsigned short needed_headroom; 1271 unsigned short needed_tailroom; 1272 1273 /* Interface address info. */ 1274 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ 1275 unsigned char addr_assign_type; /* hw address assignment type */ 1276 unsigned char addr_len; /* hardware address length */ 1277 unsigned short neigh_priv_len; 1278 unsigned short dev_id; /* Used to differentiate devices 1279 * that share the same link 1280 * layer address 1281 */ 1282 spinlock_t addr_list_lock; 1283 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1284 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1285 struct netdev_hw_addr_list dev_addrs; /* list of device 1286 * hw addresses 1287 */ 1288 #ifdef CONFIG_SYSFS 1289 struct kset *queues_kset; 1290 #endif 1291 1292 bool uc_promisc; 1293 unsigned int promiscuity; 1294 unsigned int allmulti; 1295 1296 1297 /* Protocol specific pointers */ 1298 1299 #if IS_ENABLED(CONFIG_VLAN_8021Q) 1300 struct vlan_info __rcu *vlan_info; /* VLAN info */ 1301 #endif 1302 #if IS_ENABLED(CONFIG_NET_DSA) 1303 struct dsa_switch_tree *dsa_ptr; /* dsa specific data */ 1304 #endif 1305 #if IS_ENABLED(CONFIG_TIPC) 1306 struct tipc_bearer __rcu *tipc_ptr; /* TIPC specific data */ 1307 #endif 1308 void *atalk_ptr; /* AppleTalk link */ 1309 struct in_device __rcu *ip_ptr; /* IPv4 specific data */ 1310 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */ 1311 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */ 1312 void *ax25_ptr; /* AX.25 specific data */ 1313 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, 1314 assign before registering */ 1315 1316 /* 1317 * Cache lines mostly used on receive path (including eth_type_trans()) 1318 */ 1319 unsigned long last_rx; /* Time of last Rx 1320 * This should not be set in 1321 * drivers, unless really needed, 1322 * because network stack (bonding) 1323 * use it if/when necessary, to 1324 * avoid dirtying this cache line. 1325 */ 1326 1327 /* Interface address info used in eth_type_trans() */ 1328 unsigned char *dev_addr; /* hw address, (before bcast 1329 because most packets are 1330 unicast) */ 1331 1332 1333 #ifdef CONFIG_SYSFS 1334 struct netdev_rx_queue *_rx; 1335 1336 /* Number of RX queues allocated at register_netdev() time */ 1337 unsigned int num_rx_queues; 1338 1339 /* Number of RX queues currently active in device */ 1340 unsigned int real_num_rx_queues; 1341 1342 #endif 1343 1344 rx_handler_func_t __rcu *rx_handler; 1345 void __rcu *rx_handler_data; 1346 1347 struct netdev_queue __rcu *ingress_queue; 1348 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 1349 1350 1351 /* 1352 * Cache lines mostly used on transmit path 1353 */ 1354 struct netdev_queue *_tx ____cacheline_aligned_in_smp; 1355 1356 /* Number of TX queues allocated at alloc_netdev_mq() time */ 1357 unsigned int num_tx_queues; 1358 1359 /* Number of TX queues currently active in device */ 1360 unsigned int real_num_tx_queues; 1361 1362 /* root qdisc from userspace point of view */ 1363 struct Qdisc *qdisc; 1364 1365 unsigned long tx_queue_len; /* Max frames per queue allowed */ 1366 spinlock_t tx_global_lock; 1367 1368 #ifdef CONFIG_XPS 1369 struct xps_dev_maps __rcu *xps_maps; 1370 #endif 1371 #ifdef CONFIG_RFS_ACCEL 1372 /* CPU reverse-mapping for RX completion interrupts, indexed 1373 * by RX queue number. Assigned by driver. This must only be 1374 * set if the ndo_rx_flow_steer operation is defined. */ 1375 struct cpu_rmap *rx_cpu_rmap; 1376 #endif 1377 1378 /* These may be needed for future network-power-down code. */ 1379 1380 /* 1381 * trans_start here is expensive for high speed devices on SMP, 1382 * please use netdev_queue->trans_start instead. 1383 */ 1384 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 1385 1386 int watchdog_timeo; /* used by dev_watchdog() */ 1387 struct timer_list watchdog_timer; 1388 1389 /* Number of references to this device */ 1390 int __percpu *pcpu_refcnt; 1391 1392 /* delayed register/unregister */ 1393 struct list_head todo_list; 1394 /* device index hash chain */ 1395 struct hlist_node index_hlist; 1396 1397 struct list_head link_watch_list; 1398 1399 /* register/unregister state machine */ 1400 enum { NETREG_UNINITIALIZED=0, 1401 NETREG_REGISTERED, /* completed register_netdevice */ 1402 NETREG_UNREGISTERING, /* called unregister_netdevice */ 1403 NETREG_UNREGISTERED, /* completed unregister todo */ 1404 NETREG_RELEASED, /* called free_netdev */ 1405 NETREG_DUMMY, /* dummy device for NAPI poll */ 1406 } reg_state:8; 1407 1408 bool dismantle; /* device is going do be freed */ 1409 1410 enum { 1411 RTNL_LINK_INITIALIZED, 1412 RTNL_LINK_INITIALIZING, 1413 } rtnl_link_state:16; 1414 1415 /* Called from unregister, can be used to call free_netdev */ 1416 void (*destructor)(struct net_device *dev); 1417 1418 #ifdef CONFIG_NETPOLL 1419 struct netpoll_info __rcu *npinfo; 1420 #endif 1421 1422 #ifdef CONFIG_NET_NS 1423 /* Network namespace this network device is inside */ 1424 struct net *nd_net; 1425 #endif 1426 1427 /* mid-layer private */ 1428 union { 1429 void *ml_priv; 1430 struct pcpu_lstats __percpu *lstats; /* loopback stats */ 1431 struct pcpu_sw_netstats __percpu *tstats; 1432 struct pcpu_dstats __percpu *dstats; /* dummy stats */ 1433 struct pcpu_vstats __percpu *vstats; /* veth stats */ 1434 }; 1435 /* GARP */ 1436 struct garp_port __rcu *garp_port; 1437 /* MRP */ 1438 struct mrp_port __rcu *mrp_port; 1439 1440 /* class/net/name entry */ 1441 struct device dev; 1442 /* space for optional device, statistics, and wireless sysfs groups */ 1443 const struct attribute_group *sysfs_groups[4]; 1444 /* space for optional per-rx queue attributes */ 1445 const struct attribute_group *sysfs_rx_queue_group; 1446 1447 /* rtnetlink link ops */ 1448 const struct rtnl_link_ops *rtnl_link_ops; 1449 1450 /* for setting kernel sock attribute on TCP connection setup */ 1451 #define GSO_MAX_SIZE 65536 1452 unsigned int gso_max_size; 1453 #define GSO_MAX_SEGS 65535 1454 u16 gso_max_segs; 1455 1456 #ifdef CONFIG_DCB 1457 /* Data Center Bridging netlink ops */ 1458 const struct dcbnl_rtnl_ops *dcbnl_ops; 1459 #endif 1460 u8 num_tc; 1461 struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE]; 1462 u8 prio_tc_map[TC_BITMASK + 1]; 1463 1464 #if IS_ENABLED(CONFIG_FCOE) 1465 /* max exchange id for FCoE LRO by ddp */ 1466 unsigned int fcoe_ddp_xid; 1467 #endif 1468 #if IS_ENABLED(CONFIG_CGROUP_NET_PRIO) 1469 struct netprio_map __rcu *priomap; 1470 #endif 1471 /* phy device may attach itself for hardware timestamping */ 1472 struct phy_device *phydev; 1473 1474 struct lock_class_key *qdisc_tx_busylock; 1475 1476 /* group the device belongs to */ 1477 int group; 1478 1479 struct pm_qos_request pm_qos_req; 1480 }; 1481 #define to_net_dev(d) container_of(d, struct net_device, dev) 1482 1483 #define NETDEV_ALIGN 32 1484 1485 static inline 1486 int netdev_get_prio_tc_map(const struct net_device *dev, u32 prio) 1487 { 1488 return dev->prio_tc_map[prio & TC_BITMASK]; 1489 } 1490 1491 static inline 1492 int netdev_set_prio_tc_map(struct net_device *dev, u8 prio, u8 tc) 1493 { 1494 if (tc >= dev->num_tc) 1495 return -EINVAL; 1496 1497 dev->prio_tc_map[prio & TC_BITMASK] = tc & TC_BITMASK; 1498 return 0; 1499 } 1500 1501 static inline 1502 void netdev_reset_tc(struct net_device *dev) 1503 { 1504 dev->num_tc = 0; 1505 memset(dev->tc_to_txq, 0, sizeof(dev->tc_to_txq)); 1506 memset(dev->prio_tc_map, 0, sizeof(dev->prio_tc_map)); 1507 } 1508 1509 static inline 1510 int netdev_set_tc_queue(struct net_device *dev, u8 tc, u16 count, u16 offset) 1511 { 1512 if (tc >= dev->num_tc) 1513 return -EINVAL; 1514 1515 dev->tc_to_txq[tc].count = count; 1516 dev->tc_to_txq[tc].offset = offset; 1517 return 0; 1518 } 1519 1520 static inline 1521 int netdev_set_num_tc(struct net_device *dev, u8 num_tc) 1522 { 1523 if (num_tc > TC_MAX_QUEUE) 1524 return -EINVAL; 1525 1526 dev->num_tc = num_tc; 1527 return 0; 1528 } 1529 1530 static inline 1531 int netdev_get_num_tc(struct net_device *dev) 1532 { 1533 return dev->num_tc; 1534 } 1535 1536 static inline 1537 struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, 1538 unsigned int index) 1539 { 1540 return &dev->_tx[index]; 1541 } 1542 1543 static inline void netdev_for_each_tx_queue(struct net_device *dev, 1544 void (*f)(struct net_device *, 1545 struct netdev_queue *, 1546 void *), 1547 void *arg) 1548 { 1549 unsigned int i; 1550 1551 for (i = 0; i < dev->num_tx_queues; i++) 1552 f(dev, &dev->_tx[i], arg); 1553 } 1554 1555 struct netdev_queue *netdev_pick_tx(struct net_device *dev, 1556 struct sk_buff *skb, 1557 void *accel_priv); 1558 1559 /* 1560 * Net namespace inlines 1561 */ 1562 static inline 1563 struct net *dev_net(const struct net_device *dev) 1564 { 1565 return read_pnet(&dev->nd_net); 1566 } 1567 1568 static inline 1569 void dev_net_set(struct net_device *dev, struct net *net) 1570 { 1571 #ifdef CONFIG_NET_NS 1572 release_net(dev->nd_net); 1573 dev->nd_net = hold_net(net); 1574 #endif 1575 } 1576 1577 static inline bool netdev_uses_dsa_tags(struct net_device *dev) 1578 { 1579 #ifdef CONFIG_NET_DSA_TAG_DSA 1580 if (dev->dsa_ptr != NULL) 1581 return dsa_uses_dsa_tags(dev->dsa_ptr); 1582 #endif 1583 1584 return 0; 1585 } 1586 1587 static inline bool netdev_uses_trailer_tags(struct net_device *dev) 1588 { 1589 #ifdef CONFIG_NET_DSA_TAG_TRAILER 1590 if (dev->dsa_ptr != NULL) 1591 return dsa_uses_trailer_tags(dev->dsa_ptr); 1592 #endif 1593 1594 return 0; 1595 } 1596 1597 /** 1598 * netdev_priv - access network device private data 1599 * @dev: network device 1600 * 1601 * Get network device private data 1602 */ 1603 static inline void *netdev_priv(const struct net_device *dev) 1604 { 1605 return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_ALIGN); 1606 } 1607 1608 /* Set the sysfs physical device reference for the network logical device 1609 * if set prior to registration will cause a symlink during initialization. 1610 */ 1611 #define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) 1612 1613 /* Set the sysfs device type for the network logical device to allow 1614 * fine-grained identification of different network device types. For 1615 * example Ethernet, Wirelss LAN, Bluetooth, WiMAX etc. 1616 */ 1617 #define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) 1618 1619 /* Default NAPI poll() weight 1620 * Device drivers are strongly advised to not use bigger value 1621 */ 1622 #define NAPI_POLL_WEIGHT 64 1623 1624 /** 1625 * netif_napi_add - initialize a napi context 1626 * @dev: network device 1627 * @napi: napi context 1628 * @poll: polling function 1629 * @weight: default weight 1630 * 1631 * netif_napi_add() must be used to initialize a napi context prior to calling 1632 * *any* of the other napi related functions. 1633 */ 1634 void netif_napi_add(struct net_device *dev, struct napi_struct *napi, 1635 int (*poll)(struct napi_struct *, int), int weight); 1636 1637 /** 1638 * netif_napi_del - remove a napi context 1639 * @napi: napi context 1640 * 1641 * netif_napi_del() removes a napi context from the network device napi list 1642 */ 1643 void netif_napi_del(struct napi_struct *napi); 1644 1645 struct napi_gro_cb { 1646 /* Virtual address of skb_shinfo(skb)->frags[0].page + offset. */ 1647 void *frag0; 1648 1649 /* Length of frag0. */ 1650 unsigned int frag0_len; 1651 1652 /* This indicates where we are processing relative to skb->data. */ 1653 int data_offset; 1654 1655 /* This is non-zero if the packet cannot be merged with the new skb. */ 1656 u16 flush; 1657 1658 /* Save the IP ID here and check when we get to the transport layer */ 1659 u16 flush_id; 1660 1661 /* Number of segments aggregated. */ 1662 u16 count; 1663 1664 /* This is non-zero if the packet may be of the same flow. */ 1665 u8 same_flow; 1666 1667 /* Free the skb? */ 1668 u8 free; 1669 #define NAPI_GRO_FREE 1 1670 #define NAPI_GRO_FREE_STOLEN_HEAD 2 1671 1672 /* jiffies when first packet was created/queued */ 1673 unsigned long age; 1674 1675 /* Used in ipv6_gro_receive() */ 1676 u16 proto; 1677 1678 /* Used in udp_gro_receive */ 1679 u16 udp_mark; 1680 1681 /* used to support CHECKSUM_COMPLETE for tunneling protocols */ 1682 __wsum csum; 1683 1684 /* used in skb_gro_receive() slow path */ 1685 struct sk_buff *last; 1686 }; 1687 1688 #define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) 1689 1690 struct packet_type { 1691 __be16 type; /* This is really htons(ether_type). */ 1692 struct net_device *dev; /* NULL is wildcarded here */ 1693 int (*func) (struct sk_buff *, 1694 struct net_device *, 1695 struct packet_type *, 1696 struct net_device *); 1697 bool (*id_match)(struct packet_type *ptype, 1698 struct sock *sk); 1699 void *af_packet_priv; 1700 struct list_head list; 1701 }; 1702 1703 struct offload_callbacks { 1704 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1705 netdev_features_t features); 1706 int (*gso_send_check)(struct sk_buff *skb); 1707 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1708 struct sk_buff *skb); 1709 int (*gro_complete)(struct sk_buff *skb, int nhoff); 1710 }; 1711 1712 struct packet_offload { 1713 __be16 type; /* This is really htons(ether_type). */ 1714 struct offload_callbacks callbacks; 1715 struct list_head list; 1716 }; 1717 1718 struct udp_offload { 1719 __be16 port; 1720 struct offload_callbacks callbacks; 1721 }; 1722 1723 /* often modified stats are per cpu, other are shared (netdev->stats) */ 1724 struct pcpu_sw_netstats { 1725 u64 rx_packets; 1726 u64 rx_bytes; 1727 u64 tx_packets; 1728 u64 tx_bytes; 1729 struct u64_stats_sync syncp; 1730 }; 1731 1732 #include <linux/notifier.h> 1733 1734 /* netdevice notifier chain. Please remember to update the rtnetlink 1735 * notification exclusion list in rtnetlink_event() when adding new 1736 * types. 1737 */ 1738 #define NETDEV_UP 0x0001 /* For now you can't veto a device up/down */ 1739 #define NETDEV_DOWN 0x0002 1740 #define NETDEV_REBOOT 0x0003 /* Tell a protocol stack a network interface 1741 detected a hardware crash and restarted 1742 - we can use this eg to kick tcp sessions 1743 once done */ 1744 #define NETDEV_CHANGE 0x0004 /* Notify device state change */ 1745 #define NETDEV_REGISTER 0x0005 1746 #define NETDEV_UNREGISTER 0x0006 1747 #define NETDEV_CHANGEMTU 0x0007 /* notify after mtu change happened */ 1748 #define NETDEV_CHANGEADDR 0x0008 1749 #define NETDEV_GOING_DOWN 0x0009 1750 #define NETDEV_CHANGENAME 0x000A 1751 #define NETDEV_FEAT_CHANGE 0x000B 1752 #define NETDEV_BONDING_FAILOVER 0x000C 1753 #define NETDEV_PRE_UP 0x000D 1754 #define NETDEV_PRE_TYPE_CHANGE 0x000E 1755 #define NETDEV_POST_TYPE_CHANGE 0x000F 1756 #define NETDEV_POST_INIT 0x0010 1757 #define NETDEV_UNREGISTER_FINAL 0x0011 1758 #define NETDEV_RELEASE 0x0012 1759 #define NETDEV_NOTIFY_PEERS 0x0013 1760 #define NETDEV_JOIN 0x0014 1761 #define NETDEV_CHANGEUPPER 0x0015 1762 #define NETDEV_RESEND_IGMP 0x0016 1763 #define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */ 1764 1765 int register_netdevice_notifier(struct notifier_block *nb); 1766 int unregister_netdevice_notifier(struct notifier_block *nb); 1767 1768 struct netdev_notifier_info { 1769 struct net_device *dev; 1770 }; 1771 1772 struct netdev_notifier_change_info { 1773 struct netdev_notifier_info info; /* must be first */ 1774 unsigned int flags_changed; 1775 }; 1776 1777 static inline void netdev_notifier_info_init(struct netdev_notifier_info *info, 1778 struct net_device *dev) 1779 { 1780 info->dev = dev; 1781 } 1782 1783 static inline struct net_device * 1784 netdev_notifier_info_to_dev(const struct netdev_notifier_info *info) 1785 { 1786 return info->dev; 1787 } 1788 1789 int call_netdevice_notifiers(unsigned long val, struct net_device *dev); 1790 1791 1792 extern rwlock_t dev_base_lock; /* Device list lock */ 1793 1794 #define for_each_netdev(net, d) \ 1795 list_for_each_entry(d, &(net)->dev_base_head, dev_list) 1796 #define for_each_netdev_reverse(net, d) \ 1797 list_for_each_entry_reverse(d, &(net)->dev_base_head, dev_list) 1798 #define for_each_netdev_rcu(net, d) \ 1799 list_for_each_entry_rcu(d, &(net)->dev_base_head, dev_list) 1800 #define for_each_netdev_safe(net, d, n) \ 1801 list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list) 1802 #define for_each_netdev_continue(net, d) \ 1803 list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) 1804 #define for_each_netdev_continue_rcu(net, d) \ 1805 list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) 1806 #define for_each_netdev_in_bond_rcu(bond, slave) \ 1807 for_each_netdev_rcu(&init_net, slave) \ 1808 if (netdev_master_upper_dev_get_rcu(slave) == bond) 1809 #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) 1810 1811 static inline struct net_device *next_net_device(struct net_device *dev) 1812 { 1813 struct list_head *lh; 1814 struct net *net; 1815 1816 net = dev_net(dev); 1817 lh = dev->dev_list.next; 1818 return lh == &net->dev_base_head ? NULL : net_device_entry(lh); 1819 } 1820 1821 static inline struct net_device *next_net_device_rcu(struct net_device *dev) 1822 { 1823 struct list_head *lh; 1824 struct net *net; 1825 1826 net = dev_net(dev); 1827 lh = rcu_dereference(list_next_rcu(&dev->dev_list)); 1828 return lh == &net->dev_base_head ? NULL : net_device_entry(lh); 1829 } 1830 1831 static inline struct net_device *first_net_device(struct net *net) 1832 { 1833 return list_empty(&net->dev_base_head) ? NULL : 1834 net_device_entry(net->dev_base_head.next); 1835 } 1836 1837 static inline struct net_device *first_net_device_rcu(struct net *net) 1838 { 1839 struct list_head *lh = rcu_dereference(list_next_rcu(&net->dev_base_head)); 1840 1841 return lh == &net->dev_base_head ? NULL : net_device_entry(lh); 1842 } 1843 1844 int netdev_boot_setup_check(struct net_device *dev); 1845 unsigned long netdev_boot_base(const char *prefix, int unit); 1846 struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type, 1847 const char *hwaddr); 1848 struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type); 1849 struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type); 1850 void dev_add_pack(struct packet_type *pt); 1851 void dev_remove_pack(struct packet_type *pt); 1852 void __dev_remove_pack(struct packet_type *pt); 1853 void dev_add_offload(struct packet_offload *po); 1854 void dev_remove_offload(struct packet_offload *po); 1855 1856 struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, 1857 unsigned short mask); 1858 struct net_device *dev_get_by_name(struct net *net, const char *name); 1859 struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); 1860 struct net_device *__dev_get_by_name(struct net *net, const char *name); 1861 int dev_alloc_name(struct net_device *dev, const char *name); 1862 int dev_open(struct net_device *dev); 1863 int dev_close(struct net_device *dev); 1864 void dev_disable_lro(struct net_device *dev); 1865 int dev_loopback_xmit(struct sk_buff *newskb); 1866 int dev_queue_xmit(struct sk_buff *skb); 1867 int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv); 1868 int register_netdevice(struct net_device *dev); 1869 void unregister_netdevice_queue(struct net_device *dev, struct list_head *head); 1870 void unregister_netdevice_many(struct list_head *head); 1871 static inline void unregister_netdevice(struct net_device *dev) 1872 { 1873 unregister_netdevice_queue(dev, NULL); 1874 } 1875 1876 int netdev_refcnt_read(const struct net_device *dev); 1877 void free_netdev(struct net_device *dev); 1878 void netdev_freemem(struct net_device *dev); 1879 void synchronize_net(void); 1880 int init_dummy_netdev(struct net_device *dev); 1881 1882 struct net_device *dev_get_by_index(struct net *net, int ifindex); 1883 struct net_device *__dev_get_by_index(struct net *net, int ifindex); 1884 struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 1885 int netdev_get_name(struct net *net, char *name, int ifindex); 1886 int dev_restart(struct net_device *dev); 1887 #ifdef CONFIG_NETPOLL_TRAP 1888 int netpoll_trap(void); 1889 #endif 1890 int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb); 1891 1892 static inline unsigned int skb_gro_offset(const struct sk_buff *skb) 1893 { 1894 return NAPI_GRO_CB(skb)->data_offset; 1895 } 1896 1897 static inline unsigned int skb_gro_len(const struct sk_buff *skb) 1898 { 1899 return skb->len - NAPI_GRO_CB(skb)->data_offset; 1900 } 1901 1902 static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len) 1903 { 1904 NAPI_GRO_CB(skb)->data_offset += len; 1905 } 1906 1907 static inline void *skb_gro_header_fast(struct sk_buff *skb, 1908 unsigned int offset) 1909 { 1910 return NAPI_GRO_CB(skb)->frag0 + offset; 1911 } 1912 1913 static inline int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen) 1914 { 1915 return NAPI_GRO_CB(skb)->frag0_len < hlen; 1916 } 1917 1918 static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen, 1919 unsigned int offset) 1920 { 1921 if (!pskb_may_pull(skb, hlen)) 1922 return NULL; 1923 1924 NAPI_GRO_CB(skb)->frag0 = NULL; 1925 NAPI_GRO_CB(skb)->frag0_len = 0; 1926 return skb->data + offset; 1927 } 1928 1929 static inline void *skb_gro_mac_header(struct sk_buff *skb) 1930 { 1931 return NAPI_GRO_CB(skb)->frag0 ?: skb_mac_header(skb); 1932 } 1933 1934 static inline void *skb_gro_network_header(struct sk_buff *skb) 1935 { 1936 return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) + 1937 skb_network_offset(skb); 1938 } 1939 1940 static inline void skb_gro_postpull_rcsum(struct sk_buff *skb, 1941 const void *start, unsigned int len) 1942 { 1943 if (skb->ip_summed == CHECKSUM_COMPLETE) 1944 NAPI_GRO_CB(skb)->csum = csum_sub(NAPI_GRO_CB(skb)->csum, 1945 csum_partial(start, len, 0)); 1946 } 1947 1948 static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 1949 unsigned short type, 1950 const void *daddr, const void *saddr, 1951 unsigned int len) 1952 { 1953 if (!dev->header_ops || !dev->header_ops->create) 1954 return 0; 1955 1956 return dev->header_ops->create(skb, dev, type, daddr, saddr, len); 1957 } 1958 1959 static inline int dev_parse_header(const struct sk_buff *skb, 1960 unsigned char *haddr) 1961 { 1962 const struct net_device *dev = skb->dev; 1963 1964 if (!dev->header_ops || !dev->header_ops->parse) 1965 return 0; 1966 return dev->header_ops->parse(skb, haddr); 1967 } 1968 1969 static inline int dev_rebuild_header(struct sk_buff *skb) 1970 { 1971 const struct net_device *dev = skb->dev; 1972 1973 if (!dev->header_ops || !dev->header_ops->rebuild) 1974 return 0; 1975 return dev->header_ops->rebuild(skb); 1976 } 1977 1978 typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); 1979 int register_gifconf(unsigned int family, gifconf_func_t *gifconf); 1980 static inline int unregister_gifconf(unsigned int family) 1981 { 1982 return register_gifconf(family, NULL); 1983 } 1984 1985 #ifdef CONFIG_NET_FLOW_LIMIT 1986 #define FLOW_LIMIT_HISTORY (1 << 7) /* must be ^2 and !overflow buckets */ 1987 struct sd_flow_limit { 1988 u64 count; 1989 unsigned int num_buckets; 1990 unsigned int history_head; 1991 u16 history[FLOW_LIMIT_HISTORY]; 1992 u8 buckets[]; 1993 }; 1994 1995 extern int netdev_flow_limit_table_len; 1996 #endif /* CONFIG_NET_FLOW_LIMIT */ 1997 1998 /* 1999 * Incoming packets are placed on per-cpu queues 2000 */ 2001 struct softnet_data { 2002 struct Qdisc *output_queue; 2003 struct Qdisc **output_queue_tailp; 2004 struct list_head poll_list; 2005 struct sk_buff *completion_queue; 2006 struct sk_buff_head process_queue; 2007 2008 /* stats */ 2009 unsigned int processed; 2010 unsigned int time_squeeze; 2011 unsigned int cpu_collision; 2012 unsigned int received_rps; 2013 2014 #ifdef CONFIG_RPS 2015 struct softnet_data *rps_ipi_list; 2016 2017 /* Elements below can be accessed between CPUs for RPS */ 2018 struct call_single_data csd ____cacheline_aligned_in_smp; 2019 struct softnet_data *rps_ipi_next; 2020 unsigned int cpu; 2021 unsigned int input_queue_head; 2022 unsigned int input_queue_tail; 2023 #endif 2024 unsigned int dropped; 2025 struct sk_buff_head input_pkt_queue; 2026 struct napi_struct backlog; 2027 2028 #ifdef CONFIG_NET_FLOW_LIMIT 2029 struct sd_flow_limit __rcu *flow_limit; 2030 #endif 2031 }; 2032 2033 static inline void input_queue_head_incr(struct softnet_data *sd) 2034 { 2035 #ifdef CONFIG_RPS 2036 sd->input_queue_head++; 2037 #endif 2038 } 2039 2040 static inline void input_queue_tail_incr_save(struct softnet_data *sd, 2041 unsigned int *qtail) 2042 { 2043 #ifdef CONFIG_RPS 2044 *qtail = ++sd->input_queue_tail; 2045 #endif 2046 } 2047 2048 DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); 2049 2050 void __netif_schedule(struct Qdisc *q); 2051 2052 static inline void netif_schedule_queue(struct netdev_queue *txq) 2053 { 2054 if (!(txq->state & QUEUE_STATE_ANY_XOFF)) 2055 __netif_schedule(txq->qdisc); 2056 } 2057 2058 static inline void netif_tx_schedule_all(struct net_device *dev) 2059 { 2060 unsigned int i; 2061 2062 for (i = 0; i < dev->num_tx_queues; i++) 2063 netif_schedule_queue(netdev_get_tx_queue(dev, i)); 2064 } 2065 2066 static inline void netif_tx_start_queue(struct netdev_queue *dev_queue) 2067 { 2068 clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); 2069 } 2070 2071 /** 2072 * netif_start_queue - allow transmit 2073 * @dev: network device 2074 * 2075 * Allow upper layers to call the device hard_start_xmit routine. 2076 */ 2077 static inline void netif_start_queue(struct net_device *dev) 2078 { 2079 netif_tx_start_queue(netdev_get_tx_queue(dev, 0)); 2080 } 2081 2082 static inline void netif_tx_start_all_queues(struct net_device *dev) 2083 { 2084 unsigned int i; 2085 2086 for (i = 0; i < dev->num_tx_queues; i++) { 2087 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 2088 netif_tx_start_queue(txq); 2089 } 2090 } 2091 2092 static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue) 2093 { 2094 #ifdef CONFIG_NETPOLL_TRAP 2095 if (netpoll_trap()) { 2096 netif_tx_start_queue(dev_queue); 2097 return; 2098 } 2099 #endif 2100 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state)) 2101 __netif_schedule(dev_queue->qdisc); 2102 } 2103 2104 /** 2105 * netif_wake_queue - restart transmit 2106 * @dev: network device 2107 * 2108 * Allow upper layers to call the device hard_start_xmit routine. 2109 * Used for flow control when transmit resources are available. 2110 */ 2111 static inline void netif_wake_queue(struct net_device *dev) 2112 { 2113 netif_tx_wake_queue(netdev_get_tx_queue(dev, 0)); 2114 } 2115 2116 static inline void netif_tx_wake_all_queues(struct net_device *dev) 2117 { 2118 unsigned int i; 2119 2120 for (i = 0; i < dev->num_tx_queues; i++) { 2121 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 2122 netif_tx_wake_queue(txq); 2123 } 2124 } 2125 2126 static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue) 2127 { 2128 if (WARN_ON(!dev_queue)) { 2129 pr_info("netif_stop_queue() cannot be called before register_netdev()\n"); 2130 return; 2131 } 2132 set_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); 2133 } 2134 2135 /** 2136 * netif_stop_queue - stop transmitted packets 2137 * @dev: network device 2138 * 2139 * Stop upper layers calling the device hard_start_xmit routine. 2140 * Used for flow control when transmit resources are unavailable. 2141 */ 2142 static inline void netif_stop_queue(struct net_device *dev) 2143 { 2144 netif_tx_stop_queue(netdev_get_tx_queue(dev, 0)); 2145 } 2146 2147 static inline void netif_tx_stop_all_queues(struct net_device *dev) 2148 { 2149 unsigned int i; 2150 2151 for (i = 0; i < dev->num_tx_queues; i++) { 2152 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 2153 netif_tx_stop_queue(txq); 2154 } 2155 } 2156 2157 static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue) 2158 { 2159 return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); 2160 } 2161 2162 /** 2163 * netif_queue_stopped - test if transmit queue is flowblocked 2164 * @dev: network device 2165 * 2166 * Test if transmit queue on device is currently unable to send. 2167 */ 2168 static inline bool netif_queue_stopped(const struct net_device *dev) 2169 { 2170 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); 2171 } 2172 2173 static inline bool netif_xmit_stopped(const struct netdev_queue *dev_queue) 2174 { 2175 return dev_queue->state & QUEUE_STATE_ANY_XOFF; 2176 } 2177 2178 static inline bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) 2179 { 2180 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; 2181 } 2182 2183 static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, 2184 unsigned int bytes) 2185 { 2186 #ifdef CONFIG_BQL 2187 dql_queued(&dev_queue->dql, bytes); 2188 2189 if (likely(dql_avail(&dev_queue->dql) >= 0)) 2190 return; 2191 2192 set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); 2193 2194 /* 2195 * The XOFF flag must be set before checking the dql_avail below, 2196 * because in netdev_tx_completed_queue we update the dql_completed 2197 * before checking the XOFF flag. 2198 */ 2199 smp_mb(); 2200 2201 /* check again in case another CPU has just made room avail */ 2202 if (unlikely(dql_avail(&dev_queue->dql) >= 0)) 2203 clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); 2204 #endif 2205 } 2206 2207 /** 2208 * netdev_sent_queue - report the number of bytes queued to hardware 2209 * @dev: network device 2210 * @bytes: number of bytes queued to the hardware device queue 2211 * 2212 * Report the number of bytes queued for sending/completion to the network 2213 * device hardware queue. @bytes should be a good approximation and should 2214 * exactly match netdev_completed_queue() @bytes 2215 */ 2216 static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes) 2217 { 2218 netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes); 2219 } 2220 2221 static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, 2222 unsigned int pkts, unsigned int bytes) 2223 { 2224 #ifdef CONFIG_BQL 2225 if (unlikely(!bytes)) 2226 return; 2227 2228 dql_completed(&dev_queue->dql, bytes); 2229 2230 /* 2231 * Without the memory barrier there is a small possiblity that 2232 * netdev_tx_sent_queue will miss the update and cause the queue to 2233 * be stopped forever 2234 */ 2235 smp_mb(); 2236 2237 if (dql_avail(&dev_queue->dql) < 0) 2238 return; 2239 2240 if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state)) 2241 netif_schedule_queue(dev_queue); 2242 #endif 2243 } 2244 2245 /** 2246 * netdev_completed_queue - report bytes and packets completed by device 2247 * @dev: network device 2248 * @pkts: actual number of packets sent over the medium 2249 * @bytes: actual number of bytes sent over the medium 2250 * 2251 * Report the number of bytes and packets transmitted by the network device 2252 * hardware queue over the physical medium, @bytes must exactly match the 2253 * @bytes amount passed to netdev_sent_queue() 2254 */ 2255 static inline void netdev_completed_queue(struct net_device *dev, 2256 unsigned int pkts, unsigned int bytes) 2257 { 2258 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes); 2259 } 2260 2261 static inline void netdev_tx_reset_queue(struct netdev_queue *q) 2262 { 2263 #ifdef CONFIG_BQL 2264 clear_bit(__QUEUE_STATE_STACK_XOFF, &q->state); 2265 dql_reset(&q->dql); 2266 #endif 2267 } 2268 2269 /** 2270 * netdev_reset_queue - reset the packets and bytes count of a network device 2271 * @dev_queue: network device 2272 * 2273 * Reset the bytes and packet count of a network device and clear the 2274 * software flow control OFF bit for this network device 2275 */ 2276 static inline void netdev_reset_queue(struct net_device *dev_queue) 2277 { 2278 netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0)); 2279 } 2280 2281 /** 2282 * netdev_cap_txqueue - check if selected tx queue exceeds device queues 2283 * @dev: network device 2284 * @queue_index: given tx queue index 2285 * 2286 * Returns 0 if given tx queue index >= number of device tx queues, 2287 * otherwise returns the originally passed tx queue index. 2288 */ 2289 static inline u16 netdev_cap_txqueue(struct net_device *dev, u16 queue_index) 2290 { 2291 if (unlikely(queue_index >= dev->real_num_tx_queues)) { 2292 net_warn_ratelimited("%s selects TX queue %d, but real number of TX queues is %d\n", 2293 dev->name, queue_index, 2294 dev->real_num_tx_queues); 2295 return 0; 2296 } 2297 2298 return queue_index; 2299 } 2300 2301 /** 2302 * netif_running - test if up 2303 * @dev: network device 2304 * 2305 * Test if the device has been brought up. 2306 */ 2307 static inline bool netif_running(const struct net_device *dev) 2308 { 2309 return test_bit(__LINK_STATE_START, &dev->state); 2310 } 2311 2312 /* 2313 * Routines to manage the subqueues on a device. We only need start 2314 * stop, and a check if it's stopped. All other device management is 2315 * done at the overall netdevice level. 2316 * Also test the device if we're multiqueue. 2317 */ 2318 2319 /** 2320 * netif_start_subqueue - allow sending packets on subqueue 2321 * @dev: network device 2322 * @queue_index: sub queue index 2323 * 2324 * Start individual transmit queue of a device with multiple transmit queues. 2325 */ 2326 static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) 2327 { 2328 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 2329 2330 netif_tx_start_queue(txq); 2331 } 2332 2333 /** 2334 * netif_stop_subqueue - stop sending packets on subqueue 2335 * @dev: network device 2336 * @queue_index: sub queue index 2337 * 2338 * Stop individual transmit queue of a device with multiple transmit queues. 2339 */ 2340 static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) 2341 { 2342 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 2343 #ifdef CONFIG_NETPOLL_TRAP 2344 if (netpoll_trap()) 2345 return; 2346 #endif 2347 netif_tx_stop_queue(txq); 2348 } 2349 2350 /** 2351 * netif_subqueue_stopped - test status of subqueue 2352 * @dev: network device 2353 * @queue_index: sub queue index 2354 * 2355 * Check individual transmit queue of a device with multiple transmit queues. 2356 */ 2357 static inline bool __netif_subqueue_stopped(const struct net_device *dev, 2358 u16 queue_index) 2359 { 2360 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 2361 2362 return netif_tx_queue_stopped(txq); 2363 } 2364 2365 static inline bool netif_subqueue_stopped(const struct net_device *dev, 2366 struct sk_buff *skb) 2367 { 2368 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); 2369 } 2370 2371 /** 2372 * netif_wake_subqueue - allow sending packets on subqueue 2373 * @dev: network device 2374 * @queue_index: sub queue index 2375 * 2376 * Resume individual transmit queue of a device with multiple transmit queues. 2377 */ 2378 static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) 2379 { 2380 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 2381 #ifdef CONFIG_NETPOLL_TRAP 2382 if (netpoll_trap()) 2383 return; 2384 #endif 2385 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state)) 2386 __netif_schedule(txq->qdisc); 2387 } 2388 2389 #ifdef CONFIG_XPS 2390 int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, 2391 u16 index); 2392 #else 2393 static inline int netif_set_xps_queue(struct net_device *dev, 2394 const struct cpumask *mask, 2395 u16 index) 2396 { 2397 return 0; 2398 } 2399 #endif 2400 2401 /* 2402 * Returns a Tx hash for the given packet when dev->real_num_tx_queues is used 2403 * as a distribution range limit for the returned value. 2404 */ 2405 static inline u16 skb_tx_hash(const struct net_device *dev, 2406 const struct sk_buff *skb) 2407 { 2408 return __skb_tx_hash(dev, skb, dev->real_num_tx_queues); 2409 } 2410 2411 /** 2412 * netif_is_multiqueue - test if device has multiple transmit queues 2413 * @dev: network device 2414 * 2415 * Check if device has multiple transmit queues 2416 */ 2417 static inline bool netif_is_multiqueue(const struct net_device *dev) 2418 { 2419 return dev->num_tx_queues > 1; 2420 } 2421 2422 int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq); 2423 2424 #ifdef CONFIG_SYSFS 2425 int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq); 2426 #else 2427 static inline int netif_set_real_num_rx_queues(struct net_device *dev, 2428 unsigned int rxq) 2429 { 2430 return 0; 2431 } 2432 #endif 2433 2434 static inline int netif_copy_real_num_queues(struct net_device *to_dev, 2435 const struct net_device *from_dev) 2436 { 2437 int err; 2438 2439 err = netif_set_real_num_tx_queues(to_dev, 2440 from_dev->real_num_tx_queues); 2441 if (err) 2442 return err; 2443 #ifdef CONFIG_SYSFS 2444 return netif_set_real_num_rx_queues(to_dev, 2445 from_dev->real_num_rx_queues); 2446 #else 2447 return 0; 2448 #endif 2449 } 2450 2451 #ifdef CONFIG_SYSFS 2452 static inline unsigned int get_netdev_rx_queue_index( 2453 struct netdev_rx_queue *queue) 2454 { 2455 struct net_device *dev = queue->dev; 2456 int index = queue - dev->_rx; 2457 2458 BUG_ON(index >= dev->num_rx_queues); 2459 return index; 2460 } 2461 #endif 2462 2463 #define DEFAULT_MAX_NUM_RSS_QUEUES (8) 2464 int netif_get_num_default_rss_queues(void); 2465 2466 enum skb_free_reason { 2467 SKB_REASON_CONSUMED, 2468 SKB_REASON_DROPPED, 2469 }; 2470 2471 void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason); 2472 void __dev_kfree_skb_any(struct sk_buff *skb, enum skb_free_reason reason); 2473 2474 /* 2475 * It is not allowed to call kfree_skb() or consume_skb() from hardware 2476 * interrupt context or with hardware interrupts being disabled. 2477 * (in_irq() || irqs_disabled()) 2478 * 2479 * We provide four helpers that can be used in following contexts : 2480 * 2481 * dev_kfree_skb_irq(skb) when caller drops a packet from irq context, 2482 * replacing kfree_skb(skb) 2483 * 2484 * dev_consume_skb_irq(skb) when caller consumes a packet from irq context. 2485 * Typically used in place of consume_skb(skb) in TX completion path 2486 * 2487 * dev_kfree_skb_any(skb) when caller doesn't know its current irq context, 2488 * replacing kfree_skb(skb) 2489 * 2490 * dev_consume_skb_any(skb) when caller doesn't know its current irq context, 2491 * and consumed a packet. Used in place of consume_skb(skb) 2492 */ 2493 static inline void dev_kfree_skb_irq(struct sk_buff *skb) 2494 { 2495 __dev_kfree_skb_irq(skb, SKB_REASON_DROPPED); 2496 } 2497 2498 static inline void dev_consume_skb_irq(struct sk_buff *skb) 2499 { 2500 __dev_kfree_skb_irq(skb, SKB_REASON_CONSUMED); 2501 } 2502 2503 static inline void dev_kfree_skb_any(struct sk_buff *skb) 2504 { 2505 __dev_kfree_skb_any(skb, SKB_REASON_DROPPED); 2506 } 2507 2508 static inline void dev_consume_skb_any(struct sk_buff *skb) 2509 { 2510 __dev_kfree_skb_any(skb, SKB_REASON_CONSUMED); 2511 } 2512 2513 int netif_rx(struct sk_buff *skb); 2514 int netif_rx_ni(struct sk_buff *skb); 2515 int netif_receive_skb(struct sk_buff *skb); 2516 gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb); 2517 void napi_gro_flush(struct napi_struct *napi, bool flush_old); 2518 struct sk_buff *napi_get_frags(struct napi_struct *napi); 2519 gro_result_t napi_gro_frags(struct napi_struct *napi); 2520 struct packet_offload *gro_find_receive_by_type(__be16 type); 2521 struct packet_offload *gro_find_complete_by_type(__be16 type); 2522 2523 static inline void napi_free_frags(struct napi_struct *napi) 2524 { 2525 kfree_skb(napi->skb); 2526 napi->skb = NULL; 2527 } 2528 2529 int netdev_rx_handler_register(struct net_device *dev, 2530 rx_handler_func_t *rx_handler, 2531 void *rx_handler_data); 2532 void netdev_rx_handler_unregister(struct net_device *dev); 2533 2534 bool dev_valid_name(const char *name); 2535 int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 2536 int dev_ethtool(struct net *net, struct ifreq *); 2537 unsigned int dev_get_flags(const struct net_device *); 2538 int __dev_change_flags(struct net_device *, unsigned int flags); 2539 int dev_change_flags(struct net_device *, unsigned int); 2540 void __dev_notify_flags(struct net_device *, unsigned int old_flags, 2541 unsigned int gchanges); 2542 int dev_change_name(struct net_device *, const char *); 2543 int dev_set_alias(struct net_device *, const char *, size_t); 2544 int dev_change_net_namespace(struct net_device *, struct net *, const char *); 2545 int dev_set_mtu(struct net_device *, int); 2546 void dev_set_group(struct net_device *, int); 2547 int dev_set_mac_address(struct net_device *, struct sockaddr *); 2548 int dev_change_carrier(struct net_device *, bool new_carrier); 2549 int dev_get_phys_port_id(struct net_device *dev, 2550 struct netdev_phys_port_id *ppid); 2551 int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2552 struct netdev_queue *txq); 2553 int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2554 2555 extern int netdev_budget; 2556 2557 /* Called by rtnetlink.c:rtnl_unlock() */ 2558 void netdev_run_todo(void); 2559 2560 /** 2561 * dev_put - release reference to device 2562 * @dev: network device 2563 * 2564 * Release reference to device to allow it to be freed. 2565 */ 2566 static inline void dev_put(struct net_device *dev) 2567 { 2568 this_cpu_dec(*dev->pcpu_refcnt); 2569 } 2570 2571 /** 2572 * dev_hold - get reference to device 2573 * @dev: network device 2574 * 2575 * Hold reference to device to keep it from being freed. 2576 */ 2577 static inline void dev_hold(struct net_device *dev) 2578 { 2579 this_cpu_inc(*dev->pcpu_refcnt); 2580 } 2581 2582 /* Carrier loss detection, dial on demand. The functions netif_carrier_on 2583 * and _off may be called from IRQ context, but it is caller 2584 * who is responsible for serialization of these calls. 2585 * 2586 * The name carrier is inappropriate, these functions should really be 2587 * called netif_lowerlayer_*() because they represent the state of any 2588 * kind of lower layer not just hardware media. 2589 */ 2590 2591 void linkwatch_init_dev(struct net_device *dev); 2592 void linkwatch_fire_event(struct net_device *dev); 2593 void linkwatch_forget_dev(struct net_device *dev); 2594 2595 /** 2596 * netif_carrier_ok - test if carrier present 2597 * @dev: network device 2598 * 2599 * Check if carrier is present on device 2600 */ 2601 static inline bool netif_carrier_ok(const struct net_device *dev) 2602 { 2603 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); 2604 } 2605 2606 unsigned long dev_trans_start(struct net_device *dev); 2607 2608 void __netdev_watchdog_up(struct net_device *dev); 2609 2610 void netif_carrier_on(struct net_device *dev); 2611 2612 void netif_carrier_off(struct net_device *dev); 2613 2614 /** 2615 * netif_dormant_on - mark device as dormant. 2616 * @dev: network device 2617 * 2618 * Mark device as dormant (as per RFC2863). 2619 * 2620 * The dormant state indicates that the relevant interface is not 2621 * actually in a condition to pass packets (i.e., it is not 'up') but is 2622 * in a "pending" state, waiting for some external event. For "on- 2623 * demand" interfaces, this new state identifies the situation where the 2624 * interface is waiting for events to place it in the up state. 2625 * 2626 */ 2627 static inline void netif_dormant_on(struct net_device *dev) 2628 { 2629 if (!test_and_set_bit(__LINK_STATE_DORMANT, &dev->state)) 2630 linkwatch_fire_event(dev); 2631 } 2632 2633 /** 2634 * netif_dormant_off - set device as not dormant. 2635 * @dev: network device 2636 * 2637 * Device is not in dormant state. 2638 */ 2639 static inline void netif_dormant_off(struct net_device *dev) 2640 { 2641 if (test_and_clear_bit(__LINK_STATE_DORMANT, &dev->state)) 2642 linkwatch_fire_event(dev); 2643 } 2644 2645 /** 2646 * netif_dormant - test if carrier present 2647 * @dev: network device 2648 * 2649 * Check if carrier is present on device 2650 */ 2651 static inline bool netif_dormant(const struct net_device *dev) 2652 { 2653 return test_bit(__LINK_STATE_DORMANT, &dev->state); 2654 } 2655 2656 2657 /** 2658 * netif_oper_up - test if device is operational 2659 * @dev: network device 2660 * 2661 * Check if carrier is operational 2662 */ 2663 static inline bool netif_oper_up(const struct net_device *dev) 2664 { 2665 return (dev->operstate == IF_OPER_UP || 2666 dev->operstate == IF_OPER_UNKNOWN /* backward compat */); 2667 } 2668 2669 /** 2670 * netif_device_present - is device available or removed 2671 * @dev: network device 2672 * 2673 * Check if device has not been removed from system. 2674 */ 2675 static inline bool netif_device_present(struct net_device *dev) 2676 { 2677 return test_bit(__LINK_STATE_PRESENT, &dev->state); 2678 } 2679 2680 void netif_device_detach(struct net_device *dev); 2681 2682 void netif_device_attach(struct net_device *dev); 2683 2684 /* 2685 * Network interface message level settings 2686 */ 2687 2688 enum { 2689 NETIF_MSG_DRV = 0x0001, 2690 NETIF_MSG_PROBE = 0x0002, 2691 NETIF_MSG_LINK = 0x0004, 2692 NETIF_MSG_TIMER = 0x0008, 2693 NETIF_MSG_IFDOWN = 0x0010, 2694 NETIF_MSG_IFUP = 0x0020, 2695 NETIF_MSG_RX_ERR = 0x0040, 2696 NETIF_MSG_TX_ERR = 0x0080, 2697 NETIF_MSG_TX_QUEUED = 0x0100, 2698 NETIF_MSG_INTR = 0x0200, 2699 NETIF_MSG_TX_DONE = 0x0400, 2700 NETIF_MSG_RX_STATUS = 0x0800, 2701 NETIF_MSG_PKTDATA = 0x1000, 2702 NETIF_MSG_HW = 0x2000, 2703 NETIF_MSG_WOL = 0x4000, 2704 }; 2705 2706 #define netif_msg_drv(p) ((p)->msg_enable & NETIF_MSG_DRV) 2707 #define netif_msg_probe(p) ((p)->msg_enable & NETIF_MSG_PROBE) 2708 #define netif_msg_link(p) ((p)->msg_enable & NETIF_MSG_LINK) 2709 #define netif_msg_timer(p) ((p)->msg_enable & NETIF_MSG_TIMER) 2710 #define netif_msg_ifdown(p) ((p)->msg_enable & NETIF_MSG_IFDOWN) 2711 #define netif_msg_ifup(p) ((p)->msg_enable & NETIF_MSG_IFUP) 2712 #define netif_msg_rx_err(p) ((p)->msg_enable & NETIF_MSG_RX_ERR) 2713 #define netif_msg_tx_err(p) ((p)->msg_enable & NETIF_MSG_TX_ERR) 2714 #define netif_msg_tx_queued(p) ((p)->msg_enable & NETIF_MSG_TX_QUEUED) 2715 #define netif_msg_intr(p) ((p)->msg_enable & NETIF_MSG_INTR) 2716 #define netif_msg_tx_done(p) ((p)->msg_enable & NETIF_MSG_TX_DONE) 2717 #define netif_msg_rx_status(p) ((p)->msg_enable & NETIF_MSG_RX_STATUS) 2718 #define netif_msg_pktdata(p) ((p)->msg_enable & NETIF_MSG_PKTDATA) 2719 #define netif_msg_hw(p) ((p)->msg_enable & NETIF_MSG_HW) 2720 #define netif_msg_wol(p) ((p)->msg_enable & NETIF_MSG_WOL) 2721 2722 static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits) 2723 { 2724 /* use default */ 2725 if (debug_value < 0 || debug_value >= (sizeof(u32) * 8)) 2726 return default_msg_enable_bits; 2727 if (debug_value == 0) /* no output */ 2728 return 0; 2729 /* set low N bits */ 2730 return (1 << debug_value) - 1; 2731 } 2732 2733 static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) 2734 { 2735 spin_lock(&txq->_xmit_lock); 2736 txq->xmit_lock_owner = cpu; 2737 } 2738 2739 static inline void __netif_tx_lock_bh(struct netdev_queue *txq) 2740 { 2741 spin_lock_bh(&txq->_xmit_lock); 2742 txq->xmit_lock_owner = smp_processor_id(); 2743 } 2744 2745 static inline bool __netif_tx_trylock(struct netdev_queue *txq) 2746 { 2747 bool ok = spin_trylock(&txq->_xmit_lock); 2748 if (likely(ok)) 2749 txq->xmit_lock_owner = smp_processor_id(); 2750 return ok; 2751 } 2752 2753 static inline void __netif_tx_unlock(struct netdev_queue *txq) 2754 { 2755 txq->xmit_lock_owner = -1; 2756 spin_unlock(&txq->_xmit_lock); 2757 } 2758 2759 static inline void __netif_tx_unlock_bh(struct netdev_queue *txq) 2760 { 2761 txq->xmit_lock_owner = -1; 2762 spin_unlock_bh(&txq->_xmit_lock); 2763 } 2764 2765 static inline void txq_trans_update(struct netdev_queue *txq) 2766 { 2767 if (txq->xmit_lock_owner != -1) 2768 txq->trans_start = jiffies; 2769 } 2770 2771 /** 2772 * netif_tx_lock - grab network device transmit lock 2773 * @dev: network device 2774 * 2775 * Get network device transmit lock 2776 */ 2777 static inline void netif_tx_lock(struct net_device *dev) 2778 { 2779 unsigned int i; 2780 int cpu; 2781 2782 spin_lock(&dev->tx_global_lock); 2783 cpu = smp_processor_id(); 2784 for (i = 0; i < dev->num_tx_queues; i++) { 2785 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 2786 2787 /* We are the only thread of execution doing a 2788 * freeze, but we have to grab the _xmit_lock in 2789 * order to synchronize with threads which are in 2790 * the ->hard_start_xmit() handler and already 2791 * checked the frozen bit. 2792 */ 2793 __netif_tx_lock(txq, cpu); 2794 set_bit(__QUEUE_STATE_FROZEN, &txq->state); 2795 __netif_tx_unlock(txq); 2796 } 2797 } 2798 2799 static inline void netif_tx_lock_bh(struct net_device *dev) 2800 { 2801 local_bh_disable(); 2802 netif_tx_lock(dev); 2803 } 2804 2805 static inline void netif_tx_unlock(struct net_device *dev) 2806 { 2807 unsigned int i; 2808 2809 for (i = 0; i < dev->num_tx_queues; i++) { 2810 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 2811 2812 /* No need to grab the _xmit_lock here. If the 2813 * queue is not stopped for another reason, we 2814 * force a schedule. 2815 */ 2816 clear_bit(__QUEUE_STATE_FROZEN, &txq->state); 2817 netif_schedule_queue(txq); 2818 } 2819 spin_unlock(&dev->tx_global_lock); 2820 } 2821 2822 static inline void netif_tx_unlock_bh(struct net_device *dev) 2823 { 2824 netif_tx_unlock(dev); 2825 local_bh_enable(); 2826 } 2827 2828 #define HARD_TX_LOCK(dev, txq, cpu) { \ 2829 if ((dev->features & NETIF_F_LLTX) == 0) { \ 2830 __netif_tx_lock(txq, cpu); \ 2831 } \ 2832 } 2833 2834 #define HARD_TX_UNLOCK(dev, txq) { \ 2835 if ((dev->features & NETIF_F_LLTX) == 0) { \ 2836 __netif_tx_unlock(txq); \ 2837 } \ 2838 } 2839 2840 static inline void netif_tx_disable(struct net_device *dev) 2841 { 2842 unsigned int i; 2843 int cpu; 2844 2845 local_bh_disable(); 2846 cpu = smp_processor_id(); 2847 for (i = 0; i < dev->num_tx_queues; i++) { 2848 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 2849 2850 __netif_tx_lock(txq, cpu); 2851 netif_tx_stop_queue(txq); 2852 __netif_tx_unlock(txq); 2853 } 2854 local_bh_enable(); 2855 } 2856 2857 static inline void netif_addr_lock(struct net_device *dev) 2858 { 2859 spin_lock(&dev->addr_list_lock); 2860 } 2861 2862 static inline void netif_addr_lock_nested(struct net_device *dev) 2863 { 2864 spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING); 2865 } 2866 2867 static inline void netif_addr_lock_bh(struct net_device *dev) 2868 { 2869 spin_lock_bh(&dev->addr_list_lock); 2870 } 2871 2872 static inline void netif_addr_unlock(struct net_device *dev) 2873 { 2874 spin_unlock(&dev->addr_list_lock); 2875 } 2876 2877 static inline void netif_addr_unlock_bh(struct net_device *dev) 2878 { 2879 spin_unlock_bh(&dev->addr_list_lock); 2880 } 2881 2882 /* 2883 * dev_addrs walker. Should be used only for read access. Call with 2884 * rcu_read_lock held. 2885 */ 2886 #define for_each_dev_addr(dev, ha) \ 2887 list_for_each_entry_rcu(ha, &dev->dev_addrs.list, list) 2888 2889 /* These functions live elsewhere (drivers/net/net_init.c, but related) */ 2890 2891 void ether_setup(struct net_device *dev); 2892 2893 /* Support for loadable net-drivers */ 2894 struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, 2895 void (*setup)(struct net_device *), 2896 unsigned int txqs, unsigned int rxqs); 2897 #define alloc_netdev(sizeof_priv, name, setup) \ 2898 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1) 2899 2900 #define alloc_netdev_mq(sizeof_priv, name, setup, count) \ 2901 alloc_netdev_mqs(sizeof_priv, name, setup, count, count) 2902 2903 int register_netdev(struct net_device *dev); 2904 void unregister_netdev(struct net_device *dev); 2905 2906 /* General hardware address lists handling functions */ 2907 int __hw_addr_sync(struct netdev_hw_addr_list *to_list, 2908 struct netdev_hw_addr_list *from_list, int addr_len); 2909 void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, 2910 struct netdev_hw_addr_list *from_list, int addr_len); 2911 void __hw_addr_init(struct netdev_hw_addr_list *list); 2912 2913 /* Functions used for device addresses handling */ 2914 int dev_addr_add(struct net_device *dev, const unsigned char *addr, 2915 unsigned char addr_type); 2916 int dev_addr_del(struct net_device *dev, const unsigned char *addr, 2917 unsigned char addr_type); 2918 void dev_addr_flush(struct net_device *dev); 2919 int dev_addr_init(struct net_device *dev); 2920 2921 /* Functions used for unicast addresses handling */ 2922 int dev_uc_add(struct net_device *dev, const unsigned char *addr); 2923 int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); 2924 int dev_uc_del(struct net_device *dev, const unsigned char *addr); 2925 int dev_uc_sync(struct net_device *to, struct net_device *from); 2926 int dev_uc_sync_multiple(struct net_device *to, struct net_device *from); 2927 void dev_uc_unsync(struct net_device *to, struct net_device *from); 2928 void dev_uc_flush(struct net_device *dev); 2929 void dev_uc_init(struct net_device *dev); 2930 2931 /* Functions used for multicast addresses handling */ 2932 int dev_mc_add(struct net_device *dev, const unsigned char *addr); 2933 int dev_mc_add_global(struct net_device *dev, const unsigned char *addr); 2934 int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr); 2935 int dev_mc_del(struct net_device *dev, const unsigned char *addr); 2936 int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); 2937 int dev_mc_sync(struct net_device *to, struct net_device *from); 2938 int dev_mc_sync_multiple(struct net_device *to, struct net_device *from); 2939 void dev_mc_unsync(struct net_device *to, struct net_device *from); 2940 void dev_mc_flush(struct net_device *dev); 2941 void dev_mc_init(struct net_device *dev); 2942 2943 /* Functions used for secondary unicast and multicast support */ 2944 void dev_set_rx_mode(struct net_device *dev); 2945 void __dev_set_rx_mode(struct net_device *dev); 2946 int dev_set_promiscuity(struct net_device *dev, int inc); 2947 int dev_set_allmulti(struct net_device *dev, int inc); 2948 void netdev_state_change(struct net_device *dev); 2949 void netdev_notify_peers(struct net_device *dev); 2950 void netdev_features_change(struct net_device *dev); 2951 /* Load a device via the kmod */ 2952 void dev_load(struct net *net, const char *name); 2953 struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, 2954 struct rtnl_link_stats64 *storage); 2955 void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, 2956 const struct net_device_stats *netdev_stats); 2957 2958 extern int netdev_max_backlog; 2959 extern int netdev_tstamp_prequeue; 2960 extern int weight_p; 2961 extern int bpf_jit_enable; 2962 2963 bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev); 2964 struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev, 2965 struct list_head **iter); 2966 2967 /* iterate through upper list, must be called under RCU read lock */ 2968 #define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \ 2969 for (iter = &(dev)->all_adj_list.upper, \ 2970 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)); \ 2971 updev; \ 2972 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter))) 2973 2974 void *netdev_lower_get_next_private(struct net_device *dev, 2975 struct list_head **iter); 2976 void *netdev_lower_get_next_private_rcu(struct net_device *dev, 2977 struct list_head **iter); 2978 2979 #define netdev_for_each_lower_private(dev, priv, iter) \ 2980 for (iter = (dev)->adj_list.lower.next, \ 2981 priv = netdev_lower_get_next_private(dev, &(iter)); \ 2982 priv; \ 2983 priv = netdev_lower_get_next_private(dev, &(iter))) 2984 2985 #define netdev_for_each_lower_private_rcu(dev, priv, iter) \ 2986 for (iter = &(dev)->adj_list.lower, \ 2987 priv = netdev_lower_get_next_private_rcu(dev, &(iter)); \ 2988 priv; \ 2989 priv = netdev_lower_get_next_private_rcu(dev, &(iter))) 2990 2991 void *netdev_adjacent_get_private(struct list_head *adj_list); 2992 void *netdev_lower_get_first_private_rcu(struct net_device *dev); 2993 struct net_device *netdev_master_upper_dev_get(struct net_device *dev); 2994 struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); 2995 int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev); 2996 int netdev_master_upper_dev_link(struct net_device *dev, 2997 struct net_device *upper_dev); 2998 int netdev_master_upper_dev_link_private(struct net_device *dev, 2999 struct net_device *upper_dev, 3000 void *private); 3001 void netdev_upper_dev_unlink(struct net_device *dev, 3002 struct net_device *upper_dev); 3003 void netdev_adjacent_rename_links(struct net_device *dev, char *oldname); 3004 void *netdev_lower_dev_get_private(struct net_device *dev, 3005 struct net_device *lower_dev); 3006 int skb_checksum_help(struct sk_buff *skb); 3007 struct sk_buff *__skb_gso_segment(struct sk_buff *skb, 3008 netdev_features_t features, bool tx_path); 3009 struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, 3010 netdev_features_t features); 3011 3012 static inline 3013 struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) 3014 { 3015 return __skb_gso_segment(skb, features, true); 3016 } 3017 __be16 skb_network_protocol(struct sk_buff *skb, int *depth); 3018 3019 static inline bool can_checksum_protocol(netdev_features_t features, 3020 __be16 protocol) 3021 { 3022 return ((features & NETIF_F_GEN_CSUM) || 3023 ((features & NETIF_F_V4_CSUM) && 3024 protocol == htons(ETH_P_IP)) || 3025 ((features & NETIF_F_V6_CSUM) && 3026 protocol == htons(ETH_P_IPV6)) || 3027 ((features & NETIF_F_FCOE_CRC) && 3028 protocol == htons(ETH_P_FCOE))); 3029 } 3030 3031 #ifdef CONFIG_BUG 3032 void netdev_rx_csum_fault(struct net_device *dev); 3033 #else 3034 static inline void netdev_rx_csum_fault(struct net_device *dev) 3035 { 3036 } 3037 #endif 3038 /* rx skb timestamps */ 3039 void net_enable_timestamp(void); 3040 void net_disable_timestamp(void); 3041 3042 #ifdef CONFIG_PROC_FS 3043 int __init dev_proc_init(void); 3044 #else 3045 #define dev_proc_init() 0 3046 #endif 3047 3048 int netdev_class_create_file_ns(struct class_attribute *class_attr, 3049 const void *ns); 3050 void netdev_class_remove_file_ns(struct class_attribute *class_attr, 3051 const void *ns); 3052 3053 static inline int netdev_class_create_file(struct class_attribute *class_attr) 3054 { 3055 return netdev_class_create_file_ns(class_attr, NULL); 3056 } 3057 3058 static inline void netdev_class_remove_file(struct class_attribute *class_attr) 3059 { 3060 netdev_class_remove_file_ns(class_attr, NULL); 3061 } 3062 3063 extern struct kobj_ns_type_operations net_ns_type_operations; 3064 3065 const char *netdev_drivername(const struct net_device *dev); 3066 3067 void linkwatch_run_queue(void); 3068 3069 static inline netdev_features_t netdev_get_wanted_features( 3070 struct net_device *dev) 3071 { 3072 return (dev->features & ~dev->hw_features) | dev->wanted_features; 3073 } 3074 netdev_features_t netdev_increment_features(netdev_features_t all, 3075 netdev_features_t one, netdev_features_t mask); 3076 3077 /* Allow TSO being used on stacked device : 3078 * Performing the GSO segmentation before last device 3079 * is a performance improvement. 3080 */ 3081 static inline netdev_features_t netdev_add_tso_features(netdev_features_t features, 3082 netdev_features_t mask) 3083 { 3084 return netdev_increment_features(features, NETIF_F_ALL_TSO, mask); 3085 } 3086 3087 int __netdev_update_features(struct net_device *dev); 3088 void netdev_update_features(struct net_device *dev); 3089 void netdev_change_features(struct net_device *dev); 3090 3091 void netif_stacked_transfer_operstate(const struct net_device *rootdev, 3092 struct net_device *dev); 3093 3094 netdev_features_t netif_skb_dev_features(struct sk_buff *skb, 3095 const struct net_device *dev); 3096 static inline netdev_features_t netif_skb_features(struct sk_buff *skb) 3097 { 3098 return netif_skb_dev_features(skb, skb->dev); 3099 } 3100 3101 static inline bool net_gso_ok(netdev_features_t features, int gso_type) 3102 { 3103 netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; 3104 3105 /* check flags correspondence */ 3106 BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT)); 3107 BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_UFO >> NETIF_F_GSO_SHIFT)); 3108 BUILD_BUG_ON(SKB_GSO_DODGY != (NETIF_F_GSO_ROBUST >> NETIF_F_GSO_SHIFT)); 3109 BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT)); 3110 BUILD_BUG_ON(SKB_GSO_TCPV6 != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT)); 3111 BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT)); 3112 3113 return (features & feature) == feature; 3114 } 3115 3116 static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features) 3117 { 3118 return net_gso_ok(features, skb_shinfo(skb)->gso_type) && 3119 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 3120 } 3121 3122 static inline bool netif_needs_gso(struct sk_buff *skb, 3123 netdev_features_t features) 3124 { 3125 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 3126 unlikely((skb->ip_summed != CHECKSUM_PARTIAL) && 3127 (skb->ip_summed != CHECKSUM_UNNECESSARY))); 3128 } 3129 3130 static inline void netif_set_gso_max_size(struct net_device *dev, 3131 unsigned int size) 3132 { 3133 dev->gso_max_size = size; 3134 } 3135 3136 static inline void skb_gso_error_unwind(struct sk_buff *skb, __be16 protocol, 3137 int pulled_hlen, u16 mac_offset, 3138 int mac_len) 3139 { 3140 skb->protocol = protocol; 3141 skb->encapsulation = 1; 3142 skb_push(skb, pulled_hlen); 3143 skb_reset_transport_header(skb); 3144 skb->mac_header = mac_offset; 3145 skb->network_header = skb->mac_header + mac_len; 3146 skb->mac_len = mac_len; 3147 } 3148 3149 static inline bool netif_is_macvlan(struct net_device *dev) 3150 { 3151 return dev->priv_flags & IFF_MACVLAN; 3152 } 3153 3154 static inline bool netif_is_bond_master(struct net_device *dev) 3155 { 3156 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; 3157 } 3158 3159 static inline bool netif_is_bond_slave(struct net_device *dev) 3160 { 3161 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; 3162 } 3163 3164 static inline bool netif_supports_nofcs(struct net_device *dev) 3165 { 3166 return dev->priv_flags & IFF_SUPP_NOFCS; 3167 } 3168 3169 extern struct pernet_operations __net_initdata loopback_net_ops; 3170 3171 /* Logging, debugging and troubleshooting/diagnostic helpers. */ 3172 3173 /* netdev_printk helpers, similar to dev_printk */ 3174 3175 static inline const char *netdev_name(const struct net_device *dev) 3176 { 3177 if (dev->reg_state != NETREG_REGISTERED) 3178 return "(unregistered net_device)"; 3179 return dev->name; 3180 } 3181 3182 __printf(3, 4) 3183 int netdev_printk(const char *level, const struct net_device *dev, 3184 const char *format, ...); 3185 __printf(2, 3) 3186 int netdev_emerg(const struct net_device *dev, const char *format, ...); 3187 __printf(2, 3) 3188 int netdev_alert(const struct net_device *dev, const char *format, ...); 3189 __printf(2, 3) 3190 int netdev_crit(const struct net_device *dev, const char *format, ...); 3191 __printf(2, 3) 3192 int netdev_err(const struct net_device *dev, const char *format, ...); 3193 __printf(2, 3) 3194 int netdev_warn(const struct net_device *dev, const char *format, ...); 3195 __printf(2, 3) 3196 int netdev_notice(const struct net_device *dev, const char *format, ...); 3197 __printf(2, 3) 3198 int netdev_info(const struct net_device *dev, const char *format, ...); 3199 3200 #define MODULE_ALIAS_NETDEV(device) \ 3201 MODULE_ALIAS("netdev-" device) 3202 3203 #if defined(CONFIG_DYNAMIC_DEBUG) 3204 #define netdev_dbg(__dev, format, args...) \ 3205 do { \ 3206 dynamic_netdev_dbg(__dev, format, ##args); \ 3207 } while (0) 3208 #elif defined(DEBUG) 3209 #define netdev_dbg(__dev, format, args...) \ 3210 netdev_printk(KERN_DEBUG, __dev, format, ##args) 3211 #else 3212 #define netdev_dbg(__dev, format, args...) \ 3213 ({ \ 3214 if (0) \ 3215 netdev_printk(KERN_DEBUG, __dev, format, ##args); \ 3216 0; \ 3217 }) 3218 #endif 3219 3220 #if defined(VERBOSE_DEBUG) 3221 #define netdev_vdbg netdev_dbg 3222 #else 3223 3224 #define netdev_vdbg(dev, format, args...) \ 3225 ({ \ 3226 if (0) \ 3227 netdev_printk(KERN_DEBUG, dev, format, ##args); \ 3228 0; \ 3229 }) 3230 #endif 3231 3232 /* 3233 * netdev_WARN() acts like dev_printk(), but with the key difference 3234 * of using a WARN/WARN_ON to get the message out, including the 3235 * file/line information and a backtrace. 3236 */ 3237 #define netdev_WARN(dev, format, args...) \ 3238 WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args) 3239 3240 /* netif printk helpers, similar to netdev_printk */ 3241 3242 #define netif_printk(priv, type, level, dev, fmt, args...) \ 3243 do { \ 3244 if (netif_msg_##type(priv)) \ 3245 netdev_printk(level, (dev), fmt, ##args); \ 3246 } while (0) 3247 3248 #define netif_level(level, priv, type, dev, fmt, args...) \ 3249 do { \ 3250 if (netif_msg_##type(priv)) \ 3251 netdev_##level(dev, fmt, ##args); \ 3252 } while (0) 3253 3254 #define netif_emerg(priv, type, dev, fmt, args...) \ 3255 netif_level(emerg, priv, type, dev, fmt, ##args) 3256 #define netif_alert(priv, type, dev, fmt, args...) \ 3257 netif_level(alert, priv, type, dev, fmt, ##args) 3258 #define netif_crit(priv, type, dev, fmt, args...) \ 3259 netif_level(crit, priv, type, dev, fmt, ##args) 3260 #define netif_err(priv, type, dev, fmt, args...) \ 3261 netif_level(err, priv, type, dev, fmt, ##args) 3262 #define netif_warn(priv, type, dev, fmt, args...) \ 3263 netif_level(warn, priv, type, dev, fmt, ##args) 3264 #define netif_notice(priv, type, dev, fmt, args...) \ 3265 netif_level(notice, priv, type, dev, fmt, ##args) 3266 #define netif_info(priv, type, dev, fmt, args...) \ 3267 netif_level(info, priv, type, dev, fmt, ##args) 3268 3269 #if defined(CONFIG_DYNAMIC_DEBUG) 3270 #define netif_dbg(priv, type, netdev, format, args...) \ 3271 do { \ 3272 if (netif_msg_##type(priv)) \ 3273 dynamic_netdev_dbg(netdev, format, ##args); \ 3274 } while (0) 3275 #elif defined(DEBUG) 3276 #define netif_dbg(priv, type, dev, format, args...) \ 3277 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args) 3278 #else 3279 #define netif_dbg(priv, type, dev, format, args...) \ 3280 ({ \ 3281 if (0) \ 3282 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \ 3283 0; \ 3284 }) 3285 #endif 3286 3287 #if defined(VERBOSE_DEBUG) 3288 #define netif_vdbg netif_dbg 3289 #else 3290 #define netif_vdbg(priv, type, dev, format, args...) \ 3291 ({ \ 3292 if (0) \ 3293 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \ 3294 0; \ 3295 }) 3296 #endif 3297 3298 /* 3299 * The list of packet types we will receive (as opposed to discard) 3300 * and the routines to invoke. 3301 * 3302 * Why 16. Because with 16 the only overlap we get on a hash of the 3303 * low nibble of the protocol value is RARP/SNAP/X.25. 3304 * 3305 * NOTE: That is no longer true with the addition of VLAN tags. Not 3306 * sure which should go first, but I bet it won't make much 3307 * difference if we are running VLANs. The good news is that 3308 * this protocol won't be in the list unless compiled in, so 3309 * the average user (w/out VLANs) will not be adversely affected. 3310 * --BLG 3311 * 3312 * 0800 IP 3313 * 8100 802.1Q VLAN 3314 * 0001 802.3 3315 * 0002 AX.25 3316 * 0004 802.2 3317 * 8035 RARP 3318 * 0005 SNAP 3319 * 0805 X.25 3320 * 0806 ARP 3321 * 8137 IPX 3322 * 0009 Localtalk 3323 * 86DD IPv6 3324 */ 3325 #define PTYPE_HASH_SIZE (16) 3326 #define PTYPE_HASH_MASK (PTYPE_HASH_SIZE - 1) 3327 3328 #endif /* _LINUX_NETDEVICE_H */
1 /* 2 * pci.h 3 * 4 * PCI defines and function prototypes 5 * Copyright 1994, Drew Eckhardt 6 * Copyright 1997--1999 Martin Mares <mj@ucw.cz> 7 * 8 * For more information, please consult the following manuals (look at 9 * http://www.pcisig.com/ for how to get them): 10 * 11 * PCI BIOS Specification 12 * PCI Local Bus Specification 13 * PCI to PCI Bridge Specification 14 * PCI System Design Guide 15 */ 16 #ifndef LINUX_PCI_H 17 #define LINUX_PCI_H 18 19 20 #include <linux/mod_devicetable.h> 21 22 #include <linux/types.h> 23 #include <linux/init.h> 24 #include <linux/ioport.h> 25 #include <linux/list.h> 26 #include <linux/compiler.h> 27 #include <linux/errno.h> 28 #include <linux/kobject.h> 29 #include <linux/atomic.h> 30 #include <linux/device.h> 31 #include <linux/io.h> 32 #include <linux/irqreturn.h> 33 #include <uapi/linux/pci.h> 34 35 #include <linux/pci_ids.h> 36 37 /* 38 * The PCI interface treats multi-function devices as independent 39 * devices. The slot/function address of each device is encoded 40 * in a single byte as follows: 41 * 42 * 7:3 = slot 43 * 2:0 = function 44 * 45 * PCI_DEVFN(), PCI_SLOT(), and PCI_FUNC() are defined in uapi/linux/pci.h. 46 * In the interest of not exposing interfaces to user-space unnecessarily, 47 * the following kernel-only defines are being added here. 48 */ 49 #define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn) 50 /* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */ 51 #define PCI_BUS_NUM(x) (((x) >> 8) & 0xff) 52 53 /* pci_slot represents a physical slot */ 54 struct pci_slot { 55 struct pci_bus *bus; /* The bus this slot is on */ 56 struct list_head list; /* node in list of slots on this bus */ 57 struct hotplug_slot *hotplug; /* Hotplug info (migrate over time) */ 58 unsigned char number; /* PCI_SLOT(pci_dev->devfn) */ 59 struct kobject kobj; 60 }; 61 62 static inline const char *pci_slot_name(const struct pci_slot *slot) 63 { 64 return kobject_name(&slot->kobj); 65 } 66 67 /* File state for mmap()s on /proc/bus/pci/X/Y */ 68 enum pci_mmap_state { 69 pci_mmap_io, 70 pci_mmap_mem 71 }; 72 73 /* This defines the direction arg to the DMA mapping routines. */ 74 #define PCI_DMA_BIDIRECTIONAL 0 75 #define PCI_DMA_TODEVICE 1 76 #define PCI_DMA_FROMDEVICE 2 77 #define PCI_DMA_NONE 3 78 79 /* 80 * For PCI devices, the region numbers are assigned this way: 81 */ 82 enum { 83 /* #0-5: standard PCI resources */ 84 PCI_STD_RESOURCES, 85 PCI_STD_RESOURCE_END = 5, 86 87 /* #6: expansion ROM resource */ 88 PCI_ROM_RESOURCE, 89 90 /* device specific resources */ 91 #ifdef CONFIG_PCI_IOV 92 PCI_IOV_RESOURCES, 93 PCI_IOV_RESOURCE_END = PCI_IOV_RESOURCES + PCI_SRIOV_NUM_BARS - 1, 94 #endif 95 96 /* resources assigned to buses behind the bridge */ 97 #define PCI_BRIDGE_RESOURCE_NUM 4 98 99 PCI_BRIDGE_RESOURCES, 100 PCI_BRIDGE_RESOURCE_END = PCI_BRIDGE_RESOURCES + 101 PCI_BRIDGE_RESOURCE_NUM - 1, 102 103 /* total resources associated with a PCI device */ 104 PCI_NUM_RESOURCES, 105 106 /* preserve this for compatibility */ 107 DEVICE_COUNT_RESOURCE = PCI_NUM_RESOURCES, 108 }; 109 110 typedef int __bitwise pci_power_t; 111 112 #define PCI_D0 ((pci_power_t __force) 0) 113 #define PCI_D1 ((pci_power_t __force) 1) 114 #define PCI_D2 ((pci_power_t __force) 2) 115 #define PCI_D3hot ((pci_power_t __force) 3) 116 #define PCI_D3cold ((pci_power_t __force) 4) 117 #define PCI_UNKNOWN ((pci_power_t __force) 5) 118 #define PCI_POWER_ERROR ((pci_power_t __force) -1) 119 120 /* Remember to update this when the list above changes! */ 121 extern const char *pci_power_names[]; 122 123 static inline const char *pci_power_name(pci_power_t state) 124 { 125 return pci_power_names[1 + (int) state]; 126 } 127 128 #define PCI_PM_D2_DELAY 200 129 #define PCI_PM_D3_WAIT 10 130 #define PCI_PM_D3COLD_WAIT 100 131 #define PCI_PM_BUS_WAIT 50 132 133 /** The pci_channel state describes connectivity between the CPU and 134 * the pci device. If some PCI bus between here and the pci device 135 * has crashed or locked up, this info is reflected here. 136 */ 137 typedef unsigned int __bitwise pci_channel_state_t; 138 139 enum pci_channel_state { 140 /* I/O channel is in normal state */ 141 pci_channel_io_normal = (__force pci_channel_state_t) 1, 142 143 /* I/O to channel is blocked */ 144 pci_channel_io_frozen = (__force pci_channel_state_t) 2, 145 146 /* PCI card is dead */ 147 pci_channel_io_perm_failure = (__force pci_channel_state_t) 3, 148 }; 149 150 typedef unsigned int __bitwise pcie_reset_state_t; 151 152 enum pcie_reset_state { 153 /* Reset is NOT asserted (Use to deassert reset) */ 154 pcie_deassert_reset = (__force pcie_reset_state_t) 1, 155 156 /* Use #PERST to reset PCIe device */ 157 pcie_warm_reset = (__force pcie_reset_state_t) 2, 158 159 /* Use PCIe Hot Reset to reset device */ 160 pcie_hot_reset = (__force pcie_reset_state_t) 3 161 }; 162 163 typedef unsigned short __bitwise pci_dev_flags_t; 164 enum pci_dev_flags { 165 /* INTX_DISABLE in PCI_COMMAND register disables MSI 166 * generation too. 167 */ 168 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, 169 /* Device configuration is irrevocably lost if disabled into D3 */ 170 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, 171 /* Provide indication device is assigned by a Virtual Machine Manager */ 172 PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4, 173 }; 174 175 enum pci_irq_reroute_variant { 176 INTEL_IRQ_REROUTE_VARIANT = 1, 177 MAX_IRQ_REROUTE_VARIANTS = 3 178 }; 179 180 typedef unsigned short __bitwise pci_bus_flags_t; 181 enum pci_bus_flags { 182 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, 183 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, 184 }; 185 186 /* These values come from the PCI Express Spec */ 187 enum pcie_link_width { 188 PCIE_LNK_WIDTH_RESRV = 0x00, 189 PCIE_LNK_X1 = 0x01, 190 PCIE_LNK_X2 = 0x02, 191 PCIE_LNK_X4 = 0x04, 192 PCIE_LNK_X8 = 0x08, 193 PCIE_LNK_X12 = 0x0C, 194 PCIE_LNK_X16 = 0x10, 195 PCIE_LNK_X32 = 0x20, 196 PCIE_LNK_WIDTH_UNKNOWN = 0xFF, 197 }; 198 199 /* Based on the PCI Hotplug Spec, but some values are made up by us */ 200 enum pci_bus_speed { 201 PCI_SPEED_33MHz = 0x00, 202 PCI_SPEED_66MHz = 0x01, 203 PCI_SPEED_66MHz_PCIX = 0x02, 204 PCI_SPEED_100MHz_PCIX = 0x03, 205 PCI_SPEED_133MHz_PCIX = 0x04, 206 PCI_SPEED_66MHz_PCIX_ECC = 0x05, 207 PCI_SPEED_100MHz_PCIX_ECC = 0x06, 208 PCI_SPEED_133MHz_PCIX_ECC = 0x07, 209 PCI_SPEED_66MHz_PCIX_266 = 0x09, 210 PCI_SPEED_100MHz_PCIX_266 = 0x0a, 211 PCI_SPEED_133MHz_PCIX_266 = 0x0b, 212 AGP_UNKNOWN = 0x0c, 213 AGP_1X = 0x0d, 214 AGP_2X = 0x0e, 215 AGP_4X = 0x0f, 216 AGP_8X = 0x10, 217 PCI_SPEED_66MHz_PCIX_533 = 0x11, 218 PCI_SPEED_100MHz_PCIX_533 = 0x12, 219 PCI_SPEED_133MHz_PCIX_533 = 0x13, 220 PCIE_SPEED_2_5GT = 0x14, 221 PCIE_SPEED_5_0GT = 0x15, 222 PCIE_SPEED_8_0GT = 0x16, 223 PCI_SPEED_UNKNOWN = 0xff, 224 }; 225 226 struct pci_cap_saved_data { 227 u16 cap_nr; 228 bool cap_extended; 229 unsigned int size; 230 u32 data[0]; 231 }; 232 233 struct pci_cap_saved_state { 234 struct hlist_node next; 235 struct pci_cap_saved_data cap; 236 }; 237 238 struct pcie_link_state; 239 struct pci_vpd; 240 struct pci_sriov; 241 struct pci_ats; 242 243 /* 244 * The pci_dev structure is used to describe PCI devices. 245 */ 246 struct pci_dev { 247 struct list_head bus_list; /* node in per-bus list */ 248 struct pci_bus *bus; /* bus this device is on */ 249 struct pci_bus *subordinate; /* bus this device bridges to */ 250 251 void *sysdata; /* hook for sys-specific extension */ 252 struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */ 253 struct pci_slot *slot; /* Physical slot this device is in */ 254 255 unsigned int devfn; /* encoded device & function index */ 256 unsigned short vendor; 257 unsigned short device; 258 unsigned short subsystem_vendor; 259 unsigned short subsystem_device; 260 unsigned int class; /* 3 bytes: (base,sub,prog-if) */ 261 u8 revision; /* PCI revision, low byte of class word */ 262 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 263 u8 pcie_cap; /* PCIe capability offset */ 264 u8 msi_cap; /* MSI capability offset */ 265 u8 msix_cap; /* MSI-X capability offset */ 266 u8 pcie_mpss:3; /* PCIe Max Payload Size Supported */ 267 u8 rom_base_reg; /* which config register controls the ROM */ 268 u8 pin; /* which interrupt pin this device uses */ 269 u16 pcie_flags_reg; /* cached PCIe Capabilities Register */ 270 271 struct pci_driver *driver; /* which driver has allocated this device */ 272 u64 dma_mask; /* Mask of the bits of bus address this 273 device implements. Normally this is 274 0xffffffff. You only need to change 275 this if your device has broken DMA 276 or supports 64-bit transfers. */ 277 278 struct device_dma_parameters dma_parms; 279 280 pci_power_t current_state; /* Current operating state. In ACPI-speak, 281 this is D0-D3, D0 being fully functional, 282 and D3 being off. */ 283 u8 pm_cap; /* PM capability offset */ 284 unsigned int pme_support:5; /* Bitmask of states from which PME# 285 can be generated */ 286 unsigned int pme_interrupt:1; 287 unsigned int pme_poll:1; /* Poll device's PME status bit */ 288 unsigned int d1_support:1; /* Low power state D1 is supported */ 289 unsigned int d2_support:1; /* Low power state D2 is supported */ 290 unsigned int no_d1d2:1; /* D1 and D2 are forbidden */ 291 unsigned int no_d3cold:1; /* D3cold is forbidden */ 292 unsigned int d3cold_allowed:1; /* D3cold is allowed by user */ 293 unsigned int mmio_always_on:1; /* disallow turning off io/mem 294 decoding during bar sizing */ 295 unsigned int wakeup_prepared:1; 296 unsigned int runtime_d3cold:1; /* whether go through runtime 297 D3cold, not set for devices 298 powered on/off by the 299 corresponding bridge */ 300 unsigned int d3_delay; /* D3->D0 transition time in ms */ 301 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ 302 303 #ifdef CONFIG_PCIEASPM 304 struct pcie_link_state *link_state; /* ASPM link state */ 305 #endif 306 307 pci_channel_state_t error_state; /* current connectivity state */ 308 struct device dev; /* Generic device interface */ 309 310 int cfg_size; /* Size of configuration space */ 311 312 /* 313 * Instead of touching interrupt line and base address registers 314 * directly, use the values stored here. They might be different! 315 */ 316 unsigned int irq; 317 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ 318 319 bool match_driver; /* Skip attaching driver */ 320 /* These fields are used by common fixups */ 321 unsigned int transparent:1; /* Subtractive decode PCI bridge */ 322 unsigned int multifunction:1;/* Part of multi-function device */ 323 /* keep track of device state */ 324 unsigned int is_added:1; 325 unsigned int is_busmaster:1; /* device is busmaster */ 326 unsigned int no_msi:1; /* device may not use msi */ 327 unsigned int block_cfg_access:1; /* config space access is blocked */ 328 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 329 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ 330 unsigned int msi_enabled:1; 331 unsigned int msix_enabled:1; 332 unsigned int ari_enabled:1; /* ARI forwarding */ 333 unsigned int is_managed:1; 334 unsigned int needs_freset:1; /* Dev requires fundamental reset */ 335 unsigned int state_saved:1; 336 unsigned int is_physfn:1; 337 unsigned int is_virtfn:1; 338 unsigned int reset_fn:1; 339 unsigned int is_hotplug_bridge:1; 340 unsigned int __aer_firmware_first_valid:1; 341 unsigned int __aer_firmware_first:1; 342 unsigned int broken_intx_masking:1; 343 unsigned int io_window_1k:1; /* Intel P2P bridge 1K I/O windows */ 344 pci_dev_flags_t dev_flags; 345 atomic_t enable_cnt; /* pci_enable_device has been called */ 346 347 u32 saved_config_space[16]; /* config space saved at suspend time */ 348 struct hlist_head saved_cap_space; 349 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ 350 int rom_attr_enabled; /* has display of the rom attribute been enabled? */ 351 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ 352 struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */ 353 #ifdef CONFIG_PCI_MSI 354 struct list_head msi_list; 355 const struct attribute_group **msi_irq_groups; 356 #endif 357 struct pci_vpd *vpd; 358 #ifdef CONFIG_PCI_ATS 359 union { 360 struct pci_sriov *sriov; /* SR-IOV capability related */ 361 struct pci_dev *physfn; /* the PF this VF is associated with */ 362 }; 363 struct pci_ats *ats; /* Address Translation Service */ 364 #endif 365 phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */ 366 size_t romlen; /* Length of ROM if it's not from the BAR */ 367 }; 368 369 static inline struct pci_dev *pci_physfn(struct pci_dev *dev) 370 { 371 #ifdef CONFIG_PCI_IOV 372 if (dev->is_virtfn) 373 dev = dev->physfn; 374 #endif 375 return dev; 376 } 377 378 struct pci_dev *pci_alloc_dev(struct pci_bus *bus); 379 380 #define to_pci_dev(n) container_of(n, struct pci_dev, dev) 381 #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) 382 383 static inline int pci_channel_offline(struct pci_dev *pdev) 384 { 385 return (pdev->error_state != pci_channel_io_normal); 386 } 387 388 struct pci_host_bridge_window { 389 struct list_head list; 390 struct resource *res; /* host bridge aperture (CPU address) */ 391 resource_size_t offset; /* bus address + offset = CPU address */ 392 }; 393 394 struct pci_host_bridge { 395 struct device dev; 396 struct pci_bus *bus; /* root bus */ 397 struct list_head windows; /* pci_host_bridge_windows */ 398 void (*release_fn)(struct pci_host_bridge *); 399 void *release_data; 400 }; 401 402 #define to_pci_host_bridge(n) container_of(n, struct pci_host_bridge, dev) 403 void pci_set_host_bridge_release(struct pci_host_bridge *bridge, 404 void (*release_fn)(struct pci_host_bridge *), 405 void *release_data); 406 407 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge); 408 409 /* 410 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond 411 * to P2P or CardBus bridge windows) go in a table. Additional ones (for 412 * buses below host bridges or subtractive decode bridges) go in the list. 413 * Use pci_bus_for_each_resource() to iterate through all the resources. 414 */ 415 416 /* 417 * PCI_SUBTRACTIVE_DECODE means the bridge forwards the window implicitly 418 * and there's no way to program the bridge with the details of the window. 419 * This does not apply to ACPI _CRS windows, even with the _DEC subtractive- 420 * decode bit set, because they are explicit and can be programmed with _SRS. 421 */ 422 #define PCI_SUBTRACTIVE_DECODE 0x1 423 424 struct pci_bus_resource { 425 struct list_head list; 426 struct resource *res; 427 unsigned int flags; 428 }; 429 430 #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ 431 432 struct pci_bus { 433 struct list_head node; /* node in list of buses */ 434 struct pci_bus *parent; /* parent bus this bridge is on */ 435 struct list_head children; /* list of child buses */ 436 struct list_head devices; /* list of devices on this bus */ 437 struct pci_dev *self; /* bridge device as seen by parent */ 438 struct list_head slots; /* list of slots on this bus */ 439 struct resource *resource[PCI_BRIDGE_RESOURCE_NUM]; 440 struct list_head resources; /* address space routed to this bus */ 441 struct resource busn_res; /* bus numbers routed to this bus */ 442 443 struct pci_ops *ops; /* configuration access functions */ 444 struct msi_chip *msi; /* MSI controller */ 445 void *sysdata; /* hook for sys-specific extension */ 446 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */ 447 448 unsigned char number; /* bus number */ 449 unsigned char primary; /* number of primary bridge */ 450 unsigned char max_bus_speed; /* enum pci_bus_speed */ 451 unsigned char cur_bus_speed; /* enum pci_bus_speed */ 452 453 char name[48]; 454 455 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */ 456 pci_bus_flags_t bus_flags; /* inherited by child buses */ 457 struct device *bridge; 458 struct device dev; 459 struct bin_attribute *legacy_io; /* legacy I/O for this bus */ 460 struct bin_attribute *legacy_mem; /* legacy mem */ 461 unsigned int is_added:1; 462 }; 463 464 #define pci_bus_b(n) list_entry(n, struct pci_bus, node) 465 #define to_pci_bus(n) container_of(n, struct pci_bus, dev) 466 467 /* 468 * Returns true if the PCI bus is root (behind host-PCI bridge), 469 * false otherwise 470 * 471 * Some code assumes that "bus->self == NULL" means that bus is a root bus. 472 * This is incorrect because "virtual" buses added for SR-IOV (via 473 * virtfn_add_bus()) have "bus->self == NULL" but are not root buses. 474 */ 475 static inline bool pci_is_root_bus(struct pci_bus *pbus) 476 { 477 return !(pbus->parent); 478 } 479 480 static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev) 481 { 482 dev = pci_physfn(dev); 483 if (pci_is_root_bus(dev->bus)) 484 return NULL; 485 486 return dev->bus->self; 487 } 488 489 #ifdef CONFIG_PCI_MSI 490 static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) 491 { 492 return pci_dev->msi_enabled || pci_dev->msix_enabled; 493 } 494 #else 495 static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false; } 496 #endif 497 498 /* 499 * Error values that may be returned by PCI functions. 500 */ 501 #define PCIBIOS_SUCCESSFUL 0x00 502 #define PCIBIOS_FUNC_NOT_SUPPORTED 0x81 503 #define PCIBIOS_BAD_VENDOR_ID 0x83 504 #define PCIBIOS_DEVICE_NOT_FOUND 0x86 505 #define PCIBIOS_BAD_REGISTER_NUMBER 0x87 506 #define PCIBIOS_SET_FAILED 0x88 507 #define PCIBIOS_BUFFER_TOO_SMALL 0x89 508 509 /* 510 * Translate above to generic errno for passing back through non-PCI code. 511 */ 512 static inline int pcibios_err_to_errno(int err) 513 { 514 if (err <= PCIBIOS_SUCCESSFUL) 515 return err; /* Assume already errno */ 516 517 switch (err) { 518 case PCIBIOS_FUNC_NOT_SUPPORTED: 519 return -ENOENT; 520 case PCIBIOS_BAD_VENDOR_ID: 521 return -EINVAL; 522 case PCIBIOS_DEVICE_NOT_FOUND: 523 return -ENODEV; 524 case PCIBIOS_BAD_REGISTER_NUMBER: 525 return -EFAULT; 526 case PCIBIOS_SET_FAILED: 527 return -EIO; 528 case PCIBIOS_BUFFER_TOO_SMALL: 529 return -ENOSPC; 530 } 531 532 return -ENOTTY; 533 } 534 535 /* Low-level architecture-dependent routines */ 536 537 struct pci_ops { 538 int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val); 539 int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); 540 }; 541 542 /* 543 * ACPI needs to be able to access PCI config space before we've done a 544 * PCI bus scan and created pci_bus structures. 545 */ 546 int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, 547 int reg, int len, u32 *val); 548 int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, 549 int reg, int len, u32 val); 550 551 struct pci_bus_region { 552 dma_addr_t start; 553 dma_addr_t end; 554 }; 555 556 struct pci_dynids { 557 spinlock_t lock; /* protects list, index */ 558 struct list_head list; /* for IDs added at runtime */ 559 }; 560 561 562 /* 563 * PCI Error Recovery System (PCI-ERS). If a PCI device driver provides 564 * a set of callbacks in struct pci_error_handlers, that device driver 565 * will be notified of PCI bus errors, and will be driven to recovery 566 * when an error occurs. 567 */ 568 569 typedef unsigned int __bitwise pci_ers_result_t; 570 571 enum pci_ers_result { 572 /* no result/none/not supported in device driver */ 573 PCI_ERS_RESULT_NONE = (__force pci_ers_result_t) 1, 574 575 /* Device driver can recover without slot reset */ 576 PCI_ERS_RESULT_CAN_RECOVER = (__force pci_ers_result_t) 2, 577 578 /* Device driver wants slot to be reset. */ 579 PCI_ERS_RESULT_NEED_RESET = (__force pci_ers_result_t) 3, 580 581 /* Device has completely failed, is unrecoverable */ 582 PCI_ERS_RESULT_DISCONNECT = (__force pci_ers_result_t) 4, 583 584 /* Device driver is fully recovered and operational */ 585 PCI_ERS_RESULT_RECOVERED = (__force pci_ers_result_t) 5, 586 587 /* No AER capabilities registered for the driver */ 588 PCI_ERS_RESULT_NO_AER_DRIVER = (__force pci_ers_result_t) 6, 589 }; 590 591 /* PCI bus error event callbacks */ 592 struct pci_error_handlers { 593 /* PCI bus error detected on this device */ 594 pci_ers_result_t (*error_detected)(struct pci_dev *dev, 595 enum pci_channel_state error); 596 597 /* MMIO has been re-enabled, but not DMA */ 598 pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev); 599 600 /* PCI Express link has been reset */ 601 pci_ers_result_t (*link_reset)(struct pci_dev *dev); 602 603 /* PCI slot has been reset */ 604 pci_ers_result_t (*slot_reset)(struct pci_dev *dev); 605 606 /* Device driver may resume normal operations */ 607 void (*resume)(struct pci_dev *dev); 608 }; 609 610 611 struct module; 612 struct pci_driver { 613 struct list_head node; 614 const char *name; 615 const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */ 616 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ 617 void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ 618 int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */ 619 int (*suspend_late) (struct pci_dev *dev, pm_message_t state); 620 int (*resume_early) (struct pci_dev *dev); 621 int (*resume) (struct pci_dev *dev); /* Device woken up */ 622 void (*shutdown) (struct pci_dev *dev); 623 int (*sriov_configure) (struct pci_dev *dev, int num_vfs); /* PF pdev */ 624 const struct pci_error_handlers *err_handler; 625 struct device_driver driver; 626 struct pci_dynids dynids; 627 }; 628 629 #define to_pci_driver(drv) container_of(drv, struct pci_driver, driver) 630 631 /** 632 * DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table 633 * @_table: device table name 634 * 635 * This macro is deprecated and should not be used in new code. 636 */ 637 #define DEFINE_PCI_DEVICE_TABLE(_table) \ 638 const struct pci_device_id _table[] 639 640 /** 641 * PCI_DEVICE - macro used to describe a specific pci device 642 * @vend: the 16 bit PCI Vendor ID 643 * @dev: the 16 bit PCI Device ID 644 * 645 * This macro is used to create a struct pci_device_id that matches a 646 * specific device. The subvendor and subdevice fields will be set to 647 * PCI_ANY_ID. 648 */ 649 #define PCI_DEVICE(vend,dev) \ 650 .vendor = (vend), .device = (dev), \ 651 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID 652 653 /** 654 * PCI_DEVICE_SUB - macro used to describe a specific pci device with subsystem 655 * @vend: the 16 bit PCI Vendor ID 656 * @dev: the 16 bit PCI Device ID 657 * @subvend: the 16 bit PCI Subvendor ID 658 * @subdev: the 16 bit PCI Subdevice ID 659 * 660 * This macro is used to create a struct pci_device_id that matches a 661 * specific device with subsystem information. 662 */ 663 #define PCI_DEVICE_SUB(vend, dev, subvend, subdev) \ 664 .vendor = (vend), .device = (dev), \ 665 .subvendor = (subvend), .subdevice = (subdev) 666 667 /** 668 * PCI_DEVICE_CLASS - macro used to describe a specific pci device class 669 * @dev_class: the class, subclass, prog-if triple for this device 670 * @dev_class_mask: the class mask for this device 671 * 672 * This macro is used to create a struct pci_device_id that matches a 673 * specific PCI class. The vendor, device, subvendor, and subdevice 674 * fields will be set to PCI_ANY_ID. 675 */ 676 #define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \ 677 .class = (dev_class), .class_mask = (dev_class_mask), \ 678 .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \ 679 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID 680 681 /** 682 * PCI_VDEVICE - macro used to describe a specific pci device in short form 683 * @vendor: the vendor name 684 * @device: the 16 bit PCI Device ID 685 * 686 * This macro is used to create a struct pci_device_id that matches a 687 * specific PCI device. The subvendor, and subdevice fields will be set 688 * to PCI_ANY_ID. The macro allows the next field to follow as the device 689 * private data. 690 */ 691 692 #define PCI_VDEVICE(vendor, device) \ 693 PCI_VENDOR_ID_##vendor, (device), \ 694 PCI_ANY_ID, PCI_ANY_ID, 0, 0 695 696 /* these external functions are only available when PCI support is enabled */ 697 #ifdef CONFIG_PCI 698 699 void pcie_bus_configure_settings(struct pci_bus *bus); 700 701 enum pcie_bus_config_types { 702 PCIE_BUS_TUNE_OFF, 703 PCIE_BUS_SAFE, 704 PCIE_BUS_PERFORMANCE, 705 PCIE_BUS_PEER2PEER, 706 }; 707 708 extern enum pcie_bus_config_types pcie_bus_config; 709 710 extern struct bus_type pci_bus_type; 711 712 /* Do NOT directly access these two variables, unless you are arch-specific PCI 713 * code, or PCI core code. */ 714 extern struct list_head pci_root_buses; /* list of all known PCI buses */ 715 /* Some device drivers need know if PCI is initiated */ 716 int no_pci_devices(void); 717 718 void pcibios_resource_survey_bus(struct pci_bus *bus); 719 void pcibios_add_bus(struct pci_bus *bus); 720 void pcibios_remove_bus(struct pci_bus *bus); 721 void pcibios_fixup_bus(struct pci_bus *); 722 int __must_check pcibios_enable_device(struct pci_dev *, int mask); 723 /* Architecture-specific versions may override this (weak) */ 724 char *pcibios_setup(char *str); 725 726 /* Used only when drivers/pci/setup.c is used */ 727 resource_size_t pcibios_align_resource(void *, const struct resource *, 728 resource_size_t, 729 resource_size_t); 730 void pcibios_update_irq(struct pci_dev *, int irq); 731 732 /* Weak but can be overriden by arch */ 733 void pci_fixup_cardbus(struct pci_bus *); 734 735 /* Generic PCI functions used internally */ 736 737 void pcibios_resource_to_bus(struct pci_bus *bus, struct pci_bus_region *region, 738 struct resource *res); 739 void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res, 740 struct pci_bus_region *region); 741 void pcibios_scan_specific_bus(int busn); 742 struct pci_bus *pci_find_bus(int domain, int busnr); 743 void pci_bus_add_devices(const struct pci_bus *bus); 744 struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 745 struct pci_ops *ops, void *sysdata); 746 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata); 747 struct pci_bus *pci_create_root_bus(struct device *parent, int bus, 748 struct pci_ops *ops, void *sysdata, 749 struct list_head *resources); 750 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax); 751 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax); 752 void pci_bus_release_busn_res(struct pci_bus *b); 753 struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, 754 struct pci_ops *ops, void *sysdata, 755 struct list_head *resources); 756 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 757 int busnr); 758 void pcie_update_link_speed(struct pci_bus *bus, u16 link_status); 759 struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, 760 const char *name, 761 struct hotplug_slot *hotplug); 762 void pci_destroy_slot(struct pci_slot *slot); 763 int pci_scan_slot(struct pci_bus *bus, int devfn); 764 struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); 765 void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 766 unsigned int pci_scan_child_bus(struct pci_bus *bus); 767 int __must_check pci_bus_add_device(struct pci_dev *dev); 768 void pci_read_bridge_bases(struct pci_bus *child); 769 struct resource *pci_find_parent_resource(const struct pci_dev *dev, 770 struct resource *res); 771 u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin); 772 int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 773 u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp); 774 struct pci_dev *pci_dev_get(struct pci_dev *dev); 775 void pci_dev_put(struct pci_dev *dev); 776 void pci_remove_bus(struct pci_bus *b); 777 void pci_stop_and_remove_bus_device(struct pci_dev *dev); 778 void pci_stop_and_remove_bus_device_locked(struct pci_dev *dev); 779 void pci_stop_root_bus(struct pci_bus *bus); 780 void pci_remove_root_bus(struct pci_bus *bus); 781 void pci_setup_cardbus(struct pci_bus *bus); 782 void pci_sort_breadthfirst(void); 783 #define dev_is_pci(d) ((d)->bus == &pci_bus_type) 784 #define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false)) 785 #define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0)) 786 787 /* Generic PCI functions exported to card drivers */ 788 789 enum pci_lost_interrupt_reason { 790 PCI_LOST_IRQ_NO_INFORMATION = 0, 791 PCI_LOST_IRQ_DISABLE_MSI, 792 PCI_LOST_IRQ_DISABLE_MSIX, 793 PCI_LOST_IRQ_DISABLE_ACPI, 794 }; 795 enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev); 796 int pci_find_capability(struct pci_dev *dev, int cap); 797 int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); 798 int pci_find_ext_capability(struct pci_dev *dev, int cap); 799 int pci_find_next_ext_capability(struct pci_dev *dev, int pos, int cap); 800 int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); 801 int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); 802 struct pci_bus *pci_find_next_bus(const struct pci_bus *from); 803 804 struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, 805 struct pci_dev *from); 806 struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, 807 unsigned int ss_vendor, unsigned int ss_device, 808 struct pci_dev *from); 809 struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); 810 struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, 811 unsigned int devfn); 812 static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, 813 unsigned int devfn) 814 { 815 return pci_get_domain_bus_and_slot(0, bus, devfn); 816 } 817 struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); 818 int pci_dev_present(const struct pci_device_id *ids); 819 820 int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, 821 int where, u8 *val); 822 int pci_bus_read_config_word(struct pci_bus *bus, unsigned int devfn, 823 int where, u16 *val); 824 int pci_bus_read_config_dword(struct pci_bus *bus, unsigned int devfn, 825 int where, u32 *val); 826 int pci_bus_write_config_byte(struct pci_bus *bus, unsigned int devfn, 827 int where, u8 val); 828 int pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn, 829 int where, u16 val); 830 int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn, 831 int where, u32 val); 832 struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops); 833 834 static inline int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val) 835 { 836 return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); 837 } 838 static inline int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val) 839 { 840 return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); 841 } 842 static inline int pci_read_config_dword(const struct pci_dev *dev, int where, 843 u32 *val) 844 { 845 return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); 846 } 847 static inline int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val) 848 { 849 return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); 850 } 851 static inline int pci_write_config_word(const struct pci_dev *dev, int where, u16 val) 852 { 853 return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); 854 } 855 static inline int pci_write_config_dword(const struct pci_dev *dev, int where, 856 u32 val) 857 { 858 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); 859 } 860 861 int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); 862 int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val); 863 int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val); 864 int pcie_capability_write_dword(struct pci_dev *dev, int pos, u32 val); 865 int pcie_capability_clear_and_set_word(struct pci_dev *dev, int pos, 866 u16 clear, u16 set); 867 int pcie_capability_clear_and_set_dword(struct pci_dev *dev, int pos, 868 u32 clear, u32 set); 869 870 static inline int pcie_capability_set_word(struct pci_dev *dev, int pos, 871 u16 set) 872 { 873 return pcie_capability_clear_and_set_word(dev, pos, 0, set); 874 } 875 876 static inline int pcie_capability_set_dword(struct pci_dev *dev, int pos, 877 u32 set) 878 { 879 return pcie_capability_clear_and_set_dword(dev, pos, 0, set); 880 } 881 882 static inline int pcie_capability_clear_word(struct pci_dev *dev, int pos, 883 u16 clear) 884 { 885 return pcie_capability_clear_and_set_word(dev, pos, clear, 0); 886 } 887 888 static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos, 889 u32 clear) 890 { 891 return pcie_capability_clear_and_set_dword(dev, pos, clear, 0); 892 } 893 894 /* user-space driven config access */ 895 int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); 896 int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); 897 int pci_user_read_config_dword(struct pci_dev *dev, int where, u32 *val); 898 int pci_user_write_config_byte(struct pci_dev *dev, int where, u8 val); 899 int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val); 900 int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val); 901 902 int __must_check pci_enable_device(struct pci_dev *dev); 903 int __must_check pci_enable_device_io(struct pci_dev *dev); 904 int __must_check pci_enable_device_mem(struct pci_dev *dev); 905 int __must_check pci_reenable_device(struct pci_dev *); 906 int __must_check pcim_enable_device(struct pci_dev *pdev); 907 void pcim_pin_device(struct pci_dev *pdev); 908 909 static inline int pci_is_enabled(struct pci_dev *pdev) 910 { 911 return (atomic_read(&pdev->enable_cnt) > 0); 912 } 913 914 static inline int pci_is_managed(struct pci_dev *pdev) 915 { 916 return pdev->is_managed; 917 } 918 919 void pci_disable_device(struct pci_dev *dev); 920 921 extern unsigned int pcibios_max_latency; 922 void pci_set_master(struct pci_dev *dev); 923 void pci_clear_master(struct pci_dev *dev); 924 925 int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); 926 int pci_set_cacheline_size(struct pci_dev *dev); 927 #define HAVE_PCI_SET_MWI 928 int __must_check pci_set_mwi(struct pci_dev *dev); 929 int pci_try_set_mwi(struct pci_dev *dev); 930 void pci_clear_mwi(struct pci_dev *dev); 931 void pci_intx(struct pci_dev *dev, int enable); 932 bool pci_intx_mask_supported(struct pci_dev *dev); 933 bool pci_check_and_mask_intx(struct pci_dev *dev); 934 bool pci_check_and_unmask_intx(struct pci_dev *dev); 935 void pci_msi_off(struct pci_dev *dev); 936 int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); 937 int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); 938 int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask); 939 int pci_wait_for_pending_transaction(struct pci_dev *dev); 940 int pcix_get_max_mmrbc(struct pci_dev *dev); 941 int pcix_get_mmrbc(struct pci_dev *dev); 942 int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 943 int pcie_get_readrq(struct pci_dev *dev); 944 int pcie_set_readrq(struct pci_dev *dev, int rq); 945 int pcie_get_mps(struct pci_dev *dev); 946 int pcie_set_mps(struct pci_dev *dev, int mps); 947 int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed, 948 enum pcie_link_width *width); 949 int __pci_reset_function(struct pci_dev *dev); 950 int __pci_reset_function_locked(struct pci_dev *dev); 951 int pci_reset_function(struct pci_dev *dev); 952 int pci_try_reset_function(struct pci_dev *dev); 953 int pci_probe_reset_slot(struct pci_slot *slot); 954 int pci_reset_slot(struct pci_slot *slot); 955 int pci_try_reset_slot(struct pci_slot *slot); 956 int pci_probe_reset_bus(struct pci_bus *bus); 957 int pci_reset_bus(struct pci_bus *bus); 958 int pci_try_reset_bus(struct pci_bus *bus); 959 void pci_reset_bridge_secondary_bus(struct pci_dev *dev); 960 void pci_update_resource(struct pci_dev *dev, int resno); 961 int __must_check pci_assign_resource(struct pci_dev *dev, int i); 962 int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); 963 int pci_select_bars(struct pci_dev *dev, unsigned long flags); 964 bool pci_device_is_present(struct pci_dev *pdev); 965 966 /* ROM control related routines */ 967 int pci_enable_rom(struct pci_dev *pdev); 968 void pci_disable_rom(struct pci_dev *pdev); 969 void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); 970 void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); 971 size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size); 972 void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size); 973 974 /* Power management related routines */ 975 int pci_save_state(struct pci_dev *dev); 976 void pci_restore_state(struct pci_dev *dev); 977 struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev); 978 int pci_load_and_free_saved_state(struct pci_dev *dev, 979 struct pci_saved_state **state); 980 struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *dev, char cap); 981 struct pci_cap_saved_state *pci_find_saved_ext_cap(struct pci_dev *dev, 982 u16 cap); 983 int pci_add_cap_save_buffer(struct pci_dev *dev, char cap, unsigned int size); 984 int pci_add_ext_cap_save_buffer(struct pci_dev *dev, 985 u16 cap, unsigned int size); 986 int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state); 987 int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 988 pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 989 bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); 990 void pci_pme_active(struct pci_dev *dev, bool enable); 991 int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, 992 bool runtime, bool enable); 993 int pci_wake_from_d3(struct pci_dev *dev, bool enable); 994 int pci_prepare_to_sleep(struct pci_dev *dev); 995 int pci_back_from_sleep(struct pci_dev *dev); 996 bool pci_dev_run_wake(struct pci_dev *dev); 997 bool pci_check_pme_status(struct pci_dev *dev); 998 void pci_pme_wakeup_bus(struct pci_bus *bus); 999 1000 static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, 1001 bool enable) 1002 { 1003 return __pci_enable_wake(dev, state, false, enable); 1004 } 1005 1006 /* PCI Virtual Channel */ 1007 int pci_save_vc_state(struct pci_dev *dev); 1008 void pci_restore_vc_state(struct pci_dev *dev); 1009 void pci_allocate_vc_save_buffers(struct pci_dev *dev); 1010 1011 /* For use by arch with custom probe code */ 1012 void set_pcie_port_type(struct pci_dev *pdev); 1013 void set_pcie_hotplug_bridge(struct pci_dev *pdev); 1014 1015 /* Functions for PCI Hotplug drivers to use */ 1016 int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 1017 unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge); 1018 unsigned int pci_rescan_bus(struct pci_bus *bus); 1019 void pci_lock_rescan_remove(void); 1020 void pci_unlock_rescan_remove(void); 1021 1022 /* Vital product data routines */ 1023 ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); 1024 ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); 1025 1026 /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 1027 resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx); 1028 void pci_bus_assign_resources(const struct pci_bus *bus); 1029 void pci_bus_size_bridges(struct pci_bus *bus); 1030 int pci_claim_resource(struct pci_dev *, int); 1031 void pci_assign_unassigned_resources(void); 1032 void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); 1033 void pci_assign_unassigned_bus_resources(struct pci_bus *bus); 1034 void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus); 1035 void pdev_enable_device(struct pci_dev *); 1036 int pci_enable_resources(struct pci_dev *, int mask); 1037 void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 1038 int (*)(const struct pci_dev *, u8, u8)); 1039 #define HAVE_PCI_REQ_REGIONS 2 1040 int __must_check pci_request_regions(struct pci_dev *, const char *); 1041 int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *); 1042 void pci_release_regions(struct pci_dev *); 1043 int __must_check pci_request_region(struct pci_dev *, int, const char *); 1044 int __must_check pci_request_region_exclusive(struct pci_dev *, int, const char *); 1045 void pci_release_region(struct pci_dev *, int); 1046 int pci_request_selected_regions(struct pci_dev *, int, const char *); 1047 int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *); 1048 void pci_release_selected_regions(struct pci_dev *, int); 1049 1050 /* drivers/pci/bus.c */ 1051 struct pci_bus *pci_bus_get(struct pci_bus *bus); 1052 void pci_bus_put(struct pci_bus *bus); 1053 void pci_add_resource(struct list_head *resources, struct resource *res); 1054 void pci_add_resource_offset(struct list_head *resources, struct resource *res, 1055 resource_size_t offset); 1056 void pci_free_resource_list(struct list_head *resources); 1057 void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); 1058 struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); 1059 void pci_bus_remove_resources(struct pci_bus *bus); 1060 1061 #define pci_bus_for_each_resource(bus, res, i) \ 1062 for (i = 0; \ 1063 (res = pci_bus_resource_n(bus, i)) || i < PCI_BRIDGE_RESOURCE_NUM; \ 1064 i++) 1065 1066 int __must_check pci_bus_alloc_resource(struct pci_bus *bus, 1067 struct resource *res, resource_size_t size, 1068 resource_size_t align, resource_size_t min, 1069 unsigned int type_mask, 1070 resource_size_t (*alignf)(void *, 1071 const struct resource *, 1072 resource_size_t, 1073 resource_size_t), 1074 void *alignf_data); 1075 1076 static inline dma_addr_t pci_bus_address(struct pci_dev *pdev, int bar) 1077 { 1078 struct pci_bus_region region; 1079 1080 pcibios_resource_to_bus(pdev->bus, &region, &pdev->resource[bar]); 1081 return region.start; 1082 } 1083 1084 /* Proper probing supporting hot-pluggable devices */ 1085 int __must_check __pci_register_driver(struct pci_driver *, struct module *, 1086 const char *mod_name); 1087 1088 /* 1089 * pci_register_driver must be a macro so that KBUILD_MODNAME can be expanded 1090 */ 1091 #define pci_register_driver(driver) \ 1092 __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) 1093 1094 void pci_unregister_driver(struct pci_driver *dev); 1095 1096 /** 1097 * module_pci_driver() - Helper macro for registering a PCI driver 1098 * @__pci_driver: pci_driver struct 1099 * 1100 * Helper macro for PCI drivers which do not do anything special in module 1101 * init/exit. This eliminates a lot of boilerplate. Each module may only 1102 * use this macro once, and calling it replaces module_init() and module_exit() 1103 */ 1104 #define module_pci_driver(__pci_driver) \ 1105 module_driver(__pci_driver, pci_register_driver, \ 1106 pci_unregister_driver) 1107 1108 struct pci_driver *pci_dev_driver(const struct pci_dev *dev); 1109 int pci_add_dynid(struct pci_driver *drv, 1110 unsigned int vendor, unsigned int device, 1111 unsigned int subvendor, unsigned int subdevice, 1112 unsigned int class, unsigned int class_mask, 1113 unsigned long driver_data); 1114 const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, 1115 struct pci_dev *dev); 1116 int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, 1117 int pass); 1118 1119 void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), 1120 void *userdata); 1121 int pci_cfg_space_size(struct pci_dev *dev); 1122 unsigned char pci_bus_max_busnr(struct pci_bus *bus); 1123 void pci_setup_bridge(struct pci_bus *bus); 1124 resource_size_t pcibios_window_alignment(struct pci_bus *bus, 1125 unsigned long type); 1126 1127 #define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0) 1128 #define PCI_VGA_STATE_CHANGE_DECODES (1 << 1) 1129 1130 int pci_set_vga_state(struct pci_dev *pdev, bool decode, 1131 unsigned int command_bits, u32 flags); 1132 /* kmem_cache style wrapper around pci_alloc_consistent() */ 1133 1134 #include <linux/pci-dma.h> 1135 #include <linux/dmapool.h> 1136 1137 #define pci_pool dma_pool 1138 #define pci_pool_create(name, pdev, size, align, allocation) \ 1139 dma_pool_create(name, &pdev->dev, size, align, allocation) 1140 #define pci_pool_destroy(pool) dma_pool_destroy(pool) 1141 #define pci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, handle) 1142 #define pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr) 1143 1144 enum pci_dma_burst_strategy { 1145 PCI_DMA_BURST_INFINITY, /* make bursts as large as possible, 1146 strategy_parameter is N/A */ 1147 PCI_DMA_BURST_BOUNDARY, /* disconnect at every strategy_parameter 1148 byte boundaries */ 1149 PCI_DMA_BURST_MULTIPLE, /* disconnect at some multiple of 1150 strategy_parameter byte boundaries */ 1151 }; 1152 1153 struct msix_entry { 1154 u32 vector; /* kernel uses to write allocated vector */ 1155 u16 entry; /* driver uses to specify entry, OS writes */ 1156 }; 1157 1158 1159 #ifdef CONFIG_PCI_MSI 1160 int pci_msi_vec_count(struct pci_dev *dev); 1161 int pci_enable_msi_block(struct pci_dev *dev, int nvec); 1162 void pci_msi_shutdown(struct pci_dev *dev); 1163 void pci_disable_msi(struct pci_dev *dev); 1164 int pci_msix_vec_count(struct pci_dev *dev); 1165 int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); 1166 void pci_msix_shutdown(struct pci_dev *dev); 1167 void pci_disable_msix(struct pci_dev *dev); 1168 void msi_remove_pci_irq_vectors(struct pci_dev *dev); 1169 void pci_restore_msi_state(struct pci_dev *dev); 1170 int pci_msi_enabled(void); 1171 int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); 1172 static inline int pci_enable_msi_exact(struct pci_dev *dev, int nvec) 1173 { 1174 int rc = pci_enable_msi_range(dev, nvec, nvec); 1175 if (rc < 0) 1176 return rc; 1177 return 0; 1178 } 1179 int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, 1180 int minvec, int maxvec); 1181 static inline int pci_enable_msix_exact(struct pci_dev *dev, 1182 struct msix_entry *entries, int nvec) 1183 { 1184 int rc = pci_enable_msix_range(dev, entries, nvec, nvec); 1185 if (rc < 0) 1186 return rc; 1187 return 0; 1188 } 1189 #else 1190 static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; } 1191 static inline int pci_enable_msi_block(struct pci_dev *dev, int nvec) 1192 { return -ENOSYS; } 1193 static inline void pci_msi_shutdown(struct pci_dev *dev) { } 1194 static inline void pci_disable_msi(struct pci_dev *dev) { } 1195 static inline int pci_msix_vec_count(struct pci_dev *dev) { return -ENOSYS; } 1196 static inline int pci_enable_msix(struct pci_dev *dev, 1197 struct msix_entry *entries, int nvec) 1198 { return -ENOSYS; } 1199 static inline void pci_msix_shutdown(struct pci_dev *dev) { } 1200 static inline void pci_disable_msix(struct pci_dev *dev) { } 1201 static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) { } 1202 static inline void pci_restore_msi_state(struct pci_dev *dev) { } 1203 static inline int pci_msi_enabled(void) { return 0; } 1204 static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec, 1205 int maxvec) 1206 { return -ENOSYS; } 1207 static inline int pci_enable_msi_exact(struct pci_dev *dev, int nvec) 1208 { return -ENOSYS; } 1209 static inline int pci_enable_msix_range(struct pci_dev *dev, 1210 struct msix_entry *entries, int minvec, int maxvec) 1211 { return -ENOSYS; } 1212 static inline int pci_enable_msix_exact(struct pci_dev *dev, 1213 struct msix_entry *entries, int nvec) 1214 { return -ENOSYS; } 1215 #endif 1216 1217 #ifdef CONFIG_PCIEPORTBUS 1218 extern bool pcie_ports_disabled; 1219 extern bool pcie_ports_auto; 1220 #else 1221 #define pcie_ports_disabled true 1222 #define pcie_ports_auto false 1223 #endif 1224 1225 #ifdef CONFIG_PCIEASPM 1226 bool pcie_aspm_support_enabled(void); 1227 #else 1228 static inline bool pcie_aspm_support_enabled(void) { return false; } 1229 #endif 1230 1231 #ifdef CONFIG_PCIEAER 1232 void pci_no_aer(void); 1233 bool pci_aer_available(void); 1234 #else 1235 static inline void pci_no_aer(void) { } 1236 static inline bool pci_aer_available(void) { return false; } 1237 #endif 1238 1239 #ifdef CONFIG_PCIE_ECRC 1240 void pcie_set_ecrc_checking(struct pci_dev *dev); 1241 void pcie_ecrc_get_policy(char *str); 1242 #else 1243 static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { } 1244 static inline void pcie_ecrc_get_policy(char *str) { } 1245 #endif 1246 1247 #define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) 1248 1249 #ifdef CONFIG_HT_IRQ 1250 /* The functions a driver should call */ 1251 int ht_create_irq(struct pci_dev *dev, int idx); 1252 void ht_destroy_irq(unsigned int irq); 1253 #endif /* CONFIG_HT_IRQ */ 1254 1255 void pci_cfg_access_lock(struct pci_dev *dev); 1256 bool pci_cfg_access_trylock(struct pci_dev *dev); 1257 void pci_cfg_access_unlock(struct pci_dev *dev); 1258 1259 /* 1260 * PCI domain support. Sometimes called PCI segment (eg by ACPI), 1261 * a PCI domain is defined to be a set of PCI buses which share 1262 * configuration space. 1263 */ 1264 #ifdef CONFIG_PCI_DOMAINS 1265 extern int pci_domains_supported; 1266 #else 1267 enum { pci_domains_supported = 0 }; 1268 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 1269 static inline int pci_proc_domain(struct pci_bus *bus) { return 0; } 1270 #endif /* CONFIG_PCI_DOMAINS */ 1271 1272 /* some architectures require additional setup to direct VGA traffic */ 1273 typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, 1274 unsigned int command_bits, u32 flags); 1275 void pci_register_set_vga_state(arch_set_vga_state_t func); 1276 1277 #else /* CONFIG_PCI is not enabled */ 1278 1279 /* 1280 * If the system does not have PCI, clearly these return errors. Define 1281 * these as simple inline functions to avoid hair in drivers. 1282 */ 1283 1284 #define _PCI_NOP(o, s, t) \ 1285 static inline int pci_##o##_config_##s(struct pci_dev *dev, \ 1286 int where, t val) \ 1287 { return PCIBIOS_FUNC_NOT_SUPPORTED; } 1288 1289 #define _PCI_NOP_ALL(o, x) _PCI_NOP(o, byte, u8 x) \ 1290 _PCI_NOP(o, word, u16 x) \ 1291 _PCI_NOP(o, dword, u32 x) 1292 _PCI_NOP_ALL(read, *) 1293 _PCI_NOP_ALL(write,) 1294 1295 static inline struct pci_dev *pci_get_device(unsigned int vendor, 1296 unsigned int device, 1297 struct pci_dev *from) 1298 { return NULL; } 1299 1300 static inline struct pci_dev *pci_get_subsys(unsigned int vendor, 1301 unsigned int device, 1302 unsigned int ss_vendor, 1303 unsigned int ss_device, 1304 struct pci_dev *from) 1305 { return NULL; } 1306 1307 static inline struct pci_dev *pci_get_class(unsigned int class, 1308 struct pci_dev *from) 1309 { return NULL; } 1310 1311 #define pci_dev_present(ids) (0) 1312 #define no_pci_devices() (1) 1313 #define pci_dev_put(dev) do { } while (0) 1314 1315 static inline void pci_set_master(struct pci_dev *dev) { } 1316 static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } 1317 static inline void pci_disable_device(struct pci_dev *dev) { } 1318 static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) 1319 { return -EIO; } 1320 static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) 1321 { return -EIO; } 1322 static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, 1323 unsigned int size) 1324 { return -EIO; } 1325 static inline int pci_set_dma_seg_boundary(struct pci_dev *dev, 1326 unsigned long mask) 1327 { return -EIO; } 1328 static inline int pci_assign_resource(struct pci_dev *dev, int i) 1329 { return -EBUSY; } 1330 static inline int __pci_register_driver(struct pci_driver *drv, 1331 struct module *owner) 1332 { return 0; } 1333 static inline int pci_register_driver(struct pci_driver *drv) 1334 { return 0; } 1335 static inline void pci_unregister_driver(struct pci_driver *drv) { } 1336 static inline int pci_find_capability(struct pci_dev *dev, int cap) 1337 { return 0; } 1338 static inline int pci_find_next_capability(struct pci_dev *dev, u8 post, 1339 int cap) 1340 { return 0; } 1341 static inline int pci_find_ext_capability(struct pci_dev *dev, int cap) 1342 { return 0; } 1343 1344 /* Power management related routines */ 1345 static inline int pci_save_state(struct pci_dev *dev) { return 0; } 1346 static inline void pci_restore_state(struct pci_dev *dev) { } 1347 static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) 1348 { return 0; } 1349 static inline int pci_wake_from_d3(struct pci_dev *dev, bool enable) 1350 { return 0; } 1351 static inline pci_power_t pci_choose_state(struct pci_dev *dev, 1352 pm_message_t state) 1353 { return PCI_D0; } 1354 static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, 1355 int enable) 1356 { return 0; } 1357 1358 static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) 1359 { return -EIO; } 1360 static inline void pci_release_regions(struct pci_dev *dev) { } 1361 1362 #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) 1363 1364 static inline void pci_block_cfg_access(struct pci_dev *dev) { } 1365 static inline int pci_block_cfg_access_in_atomic(struct pci_dev *dev) 1366 { return 0; } 1367 static inline void pci_unblock_cfg_access(struct pci_dev *dev) { } 1368 1369 static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from) 1370 { return NULL; } 1371 static inline struct pci_dev *pci_get_slot(struct pci_bus *bus, 1372 unsigned int devfn) 1373 { return NULL; } 1374 static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, 1375 unsigned int devfn) 1376 { return NULL; } 1377 1378 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 1379 static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; } 1380 1381 #define dev_is_pci(d) (false) 1382 #define dev_is_pf(d) (false) 1383 #define dev_num_vf(d) (0) 1384 #endif /* CONFIG_PCI */ 1385 1386 /* Include architecture-dependent settings and functions */ 1387 1388 #include <asm/pci.h> 1389 1390 /* these helpers provide future and backwards compatibility 1391 * for accessing popular PCI BAR info */ 1392 #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) 1393 #define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end) 1394 #define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags) 1395 #define pci_resource_len(dev,bar) \ 1396 ((pci_resource_start((dev), (bar)) == 0 && \ 1397 pci_resource_end((dev), (bar)) == \ 1398 pci_resource_start((dev), (bar))) ? 0 : \ 1399 \ 1400 (pci_resource_end((dev), (bar)) - \ 1401 pci_resource_start((dev), (bar)) + 1)) 1402 1403 /* Similar to the helpers above, these manipulate per-pci_dev 1404 * driver-specific data. They are really just a wrapper around 1405 * the generic device structure functions of these calls. 1406 */ 1407 static inline void *pci_get_drvdata(struct pci_dev *pdev) 1408 { 1409 return dev_get_drvdata(&pdev->dev); 1410 } 1411 1412 static inline void pci_set_drvdata(struct pci_dev *pdev, void *data) 1413 { 1414 dev_set_drvdata(&pdev->dev, data); 1415 } 1416 1417 /* If you want to know what to call your pci_dev, ask this function. 1418 * Again, it's a wrapper around the generic device. 1419 */ 1420 static inline const char *pci_name(const struct pci_dev *pdev) 1421 { 1422 return dev_name(&pdev->dev); 1423 } 1424 1425 1426 /* Some archs don't want to expose struct resource to userland as-is 1427 * in sysfs and /proc 1428 */ 1429 #ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER 1430 static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, 1431 const struct resource *rsrc, resource_size_t *start, 1432 resource_size_t *end) 1433 { 1434 *start = rsrc->start; 1435 *end = rsrc->end; 1436 } 1437 #endif /* HAVE_ARCH_PCI_RESOURCE_TO_USER */ 1438 1439 1440 /* 1441 * The world is not perfect and supplies us with broken PCI devices. 1442 * For at least a part of these bugs we need a work-around, so both 1443 * generic (drivers/pci/quirks.c) and per-architecture code can define 1444 * fixup hooks to be called for particular buggy devices. 1445 */ 1446 1447 struct pci_fixup { 1448 u16 vendor; /* You can use PCI_ANY_ID here of course */ 1449 u16 device; /* You can use PCI_ANY_ID here of course */ 1450 u32 class; /* You can use PCI_ANY_ID here too */ 1451 unsigned int class_shift; /* should be 0, 8, 16 */ 1452 void (*hook)(struct pci_dev *dev); 1453 }; 1454 1455 enum pci_fixup_pass { 1456 pci_fixup_early, /* Before probing BARs */ 1457 pci_fixup_header, /* After reading configuration header */ 1458 pci_fixup_final, /* Final phase of device fixups */ 1459 pci_fixup_enable, /* pci_enable_device() time */ 1460 pci_fixup_resume, /* pci_device_resume() */ 1461 pci_fixup_suspend, /* pci_device_suspend */ 1462 pci_fixup_resume_early, /* pci_device_resume_early() */ 1463 }; 1464 1465 /* Anonymous variables would be nice... */ 1466 #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ 1467 class_shift, hook) \ 1468 static const struct pci_fixup __PASTE(__pci_fixup_##name,__LINE__) __used \ 1469 __attribute__((__section__(#section), aligned((sizeof(void *))))) \ 1470 = { vendor, device, class, class_shift, hook }; 1471 1472 #define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \ 1473 class_shift, hook) \ 1474 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 1475 hook, vendor, device, class, class_shift, hook) 1476 #define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class, \ 1477 class_shift, hook) \ 1478 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ 1479 hook, vendor, device, class, class_shift, hook) 1480 #define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \ 1481 class_shift, hook) \ 1482 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ 1483 hook, vendor, device, class, class_shift, hook) 1484 #define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class, \ 1485 class_shift, hook) \ 1486 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ 1487 hook, vendor, device, class, class_shift, hook) 1488 #define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \ 1489 class_shift, hook) \ 1490 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ 1491 resume##hook, vendor, device, class, \ 1492 class_shift, hook) 1493 #define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \ 1494 class_shift, hook) \ 1495 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ 1496 resume_early##hook, vendor, device, \ 1497 class, class_shift, hook) 1498 #define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \ 1499 class_shift, hook) \ 1500 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1501 suspend##hook, vendor, device, class, \ 1502 class_shift, hook) 1503 1504 #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 1505 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 1506 hook, vendor, device, PCI_ANY_ID, 0, hook) 1507 #define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ 1508 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ 1509 hook, vendor, device, PCI_ANY_ID, 0, hook) 1510 #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ 1511 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ 1512 hook, vendor, device, PCI_ANY_ID, 0, hook) 1513 #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ 1514 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ 1515 hook, vendor, device, PCI_ANY_ID, 0, hook) 1516 #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ 1517 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ 1518 resume##hook, vendor, device, \ 1519 PCI_ANY_ID, 0, hook) 1520 #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ 1521 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ 1522 resume_early##hook, vendor, device, \ 1523 PCI_ANY_ID, 0, hook) 1524 #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ 1525 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1526 suspend##hook, vendor, device, \ 1527 PCI_ANY_ID, 0, hook) 1528 1529 #ifdef CONFIG_PCI_QUIRKS 1530 void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1531 struct pci_dev *pci_get_dma_source(struct pci_dev *dev); 1532 int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); 1533 #else 1534 static inline void pci_fixup_device(enum pci_fixup_pass pass, 1535 struct pci_dev *dev) { } 1536 static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev) 1537 { 1538 return pci_dev_get(dev); 1539 } 1540 static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev, 1541 u16 acs_flags) 1542 { 1543 return -ENOTTY; 1544 } 1545 #endif 1546 1547 void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1548 void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); 1549 void __iomem * const *pcim_iomap_table(struct pci_dev *pdev); 1550 int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name); 1551 int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask, 1552 const char *name); 1553 void pcim_iounmap_regions(struct pci_dev *pdev, int mask); 1554 1555 extern int pci_pci_problems; 1556 #define PCIPCI_FAIL 1 /* No PCI PCI DMA */ 1557 #define PCIPCI_TRITON 2 1558 #define PCIPCI_NATOMA 4 1559 #define PCIPCI_VIAETBF 8 1560 #define PCIPCI_VSFX 16 1561 #define PCIPCI_ALIMAGIK 32 /* Need low latency setting */ 1562 #define PCIAGP_FAIL 64 /* No PCI to AGP DMA */ 1563 1564 extern unsigned long pci_cardbus_io_size; 1565 extern unsigned long pci_cardbus_mem_size; 1566 extern u8 pci_dfl_cache_line_size; 1567 extern u8 pci_cache_line_size; 1568 1569 extern unsigned long pci_hotplug_io_size; 1570 extern unsigned long pci_hotplug_mem_size; 1571 1572 /* Architecture-specific versions may override these (weak) */ 1573 int pcibios_add_platform_entries(struct pci_dev *dev); 1574 void pcibios_disable_device(struct pci_dev *dev); 1575 void pcibios_set_master(struct pci_dev *dev); 1576 int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1577 enum pcie_reset_state state); 1578 int pcibios_add_device(struct pci_dev *dev); 1579 void pcibios_release_device(struct pci_dev *dev); 1580 1581 #ifdef CONFIG_HIBERNATE_CALLBACKS 1582 extern struct dev_pm_ops pcibios_pm_ops; 1583 #endif 1584 1585 #ifdef CONFIG_PCI_MMCONFIG 1586 void __init pci_mmcfg_early_init(void); 1587 void __init pci_mmcfg_late_init(void); 1588 #else 1589 static inline void pci_mmcfg_early_init(void) { } 1590 static inline void pci_mmcfg_late_init(void) { } 1591 #endif 1592 1593 int pci_ext_cfg_avail(void); 1594 1595 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); 1596 1597 #ifdef CONFIG_PCI_IOV 1598 int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); 1599 void pci_disable_sriov(struct pci_dev *dev); 1600 irqreturn_t pci_sriov_migration(struct pci_dev *dev); 1601 int pci_num_vf(struct pci_dev *dev); 1602 int pci_vfs_assigned(struct pci_dev *dev); 1603 int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); 1604 int pci_sriov_get_totalvfs(struct pci_dev *dev); 1605 #else 1606 static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) 1607 { return -ENODEV; } 1608 static inline void pci_disable_sriov(struct pci_dev *dev) { } 1609 static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev) 1610 { return IRQ_NONE; } 1611 static inline int pci_num_vf(struct pci_dev *dev) { return 0; } 1612 static inline int pci_vfs_assigned(struct pci_dev *dev) 1613 { return 0; } 1614 static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) 1615 { return 0; } 1616 static inline int pci_sriov_get_totalvfs(struct pci_dev *dev) 1617 { return 0; } 1618 #endif 1619 1620 #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) 1621 void pci_hp_create_module_link(struct pci_slot *pci_slot); 1622 void pci_hp_remove_module_link(struct pci_slot *pci_slot); 1623 #endif 1624 1625 /** 1626 * pci_pcie_cap - get the saved PCIe capability offset 1627 * @dev: PCI device 1628 * 1629 * PCIe capability offset is calculated at PCI device initialization 1630 * time and saved in the data structure. This function returns saved 1631 * PCIe capability offset. Using this instead of pci_find_capability() 1632 * reduces unnecessary search in the PCI configuration space. If you 1633 * need to calculate PCIe capability offset from raw device for some 1634 * reasons, please use pci_find_capability() instead. 1635 */ 1636 static inline int pci_pcie_cap(struct pci_dev *dev) 1637 { 1638 return dev->pcie_cap; 1639 } 1640 1641 /** 1642 * pci_is_pcie - check if the PCI device is PCI Express capable 1643 * @dev: PCI device 1644 * 1645 * Returns: true if the PCI device is PCI Express capable, false otherwise. 1646 */ 1647 static inline bool pci_is_pcie(struct pci_dev *dev) 1648 { 1649 return pci_pcie_cap(dev); 1650 } 1651 1652 /** 1653 * pcie_caps_reg - get the PCIe Capabilities Register 1654 * @dev: PCI device 1655 */ 1656 static inline u16 pcie_caps_reg(const struct pci_dev *dev) 1657 { 1658 return dev->pcie_flags_reg; 1659 } 1660 1661 /** 1662 * pci_pcie_type - get the PCIe device/port type 1663 * @dev: PCI device 1664 */ 1665 static inline int pci_pcie_type(const struct pci_dev *dev) 1666 { 1667 return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4; 1668 } 1669 1670 void pci_request_acs(void); 1671 bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); 1672 bool pci_acs_path_enabled(struct pci_dev *start, 1673 struct pci_dev *end, u16 acs_flags); 1674 1675 #define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ 1676 #define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) 1677 1678 /* Large Resource Data Type Tag Item Names */ 1679 #define PCI_VPD_LTIN_ID_STRING 0x02 /* Identifier String */ 1680 #define PCI_VPD_LTIN_RO_DATA 0x10 /* Read-Only Data */ 1681 #define PCI_VPD_LTIN_RW_DATA 0x11 /* Read-Write Data */ 1682 1683 #define PCI_VPD_LRDT_ID_STRING PCI_VPD_LRDT_ID(PCI_VPD_LTIN_ID_STRING) 1684 #define PCI_VPD_LRDT_RO_DATA PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RO_DATA) 1685 #define PCI_VPD_LRDT_RW_DATA PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RW_DATA) 1686 1687 /* Small Resource Data Type Tag Item Names */ 1688 #define PCI_VPD_STIN_END 0x78 /* End */ 1689 1690 #define PCI_VPD_SRDT_END PCI_VPD_STIN_END 1691 1692 #define PCI_VPD_SRDT_TIN_MASK 0x78 1693 #define PCI_VPD_SRDT_LEN_MASK 0x07 1694 1695 #define PCI_VPD_LRDT_TAG_SIZE 3 1696 #define PCI_VPD_SRDT_TAG_SIZE 1 1697 1698 #define PCI_VPD_INFO_FLD_HDR_SIZE 3 1699 1700 #define PCI_VPD_RO_KEYWORD_PARTNO "PN" 1701 #define PCI_VPD_RO_KEYWORD_MFR_ID "MN" 1702 #define PCI_VPD_RO_KEYWORD_VENDOR0 "V0" 1703 #define PCI_VPD_RO_KEYWORD_CHKSUM "RV" 1704 1705 /** 1706 * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length 1707 * @lrdt: Pointer to the beginning of the Large Resource Data Type tag 1708 * 1709 * Returns the extracted Large Resource Data Type length. 1710 */ 1711 static inline u16 pci_vpd_lrdt_size(const u8 *lrdt) 1712 { 1713 return (u16)lrdt[1] + ((u16)lrdt[2] << 8); 1714 } 1715 1716 /** 1717 * pci_vpd_srdt_size - Extracts the Small Resource Data Type length 1718 * @lrdt: Pointer to the beginning of the Small Resource Data Type tag 1719 * 1720 * Returns the extracted Small Resource Data Type length. 1721 */ 1722 static inline u8 pci_vpd_srdt_size(const u8 *srdt) 1723 { 1724 return (*srdt) & PCI_VPD_SRDT_LEN_MASK; 1725 } 1726 1727 /** 1728 * pci_vpd_info_field_size - Extracts the information field length 1729 * @lrdt: Pointer to the beginning of an information field header 1730 * 1731 * Returns the extracted information field length. 1732 */ 1733 static inline u8 pci_vpd_info_field_size(const u8 *info_field) 1734 { 1735 return info_field[2]; 1736 } 1737 1738 /** 1739 * pci_vpd_find_tag - Locates the Resource Data Type tag provided 1740 * @buf: Pointer to buffered vpd data 1741 * @off: The offset into the buffer at which to begin the search 1742 * @len: The length of the vpd buffer 1743 * @rdt: The Resource Data Type to search for 1744 * 1745 * Returns the index where the Resource Data Type was found or 1746 * -ENOENT otherwise. 1747 */ 1748 int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt); 1749 1750 /** 1751 * pci_vpd_find_info_keyword - Locates an information field keyword in the VPD 1752 * @buf: Pointer to buffered vpd data 1753 * @off: The offset into the buffer at which to begin the search 1754 * @len: The length of the buffer area, relative to off, in which to search 1755 * @kw: The keyword to search for 1756 * 1757 * Returns the index where the information field keyword was found or 1758 * -ENOENT otherwise. 1759 */ 1760 int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, 1761 unsigned int len, const char *kw); 1762 1763 /* PCI <-> OF binding helpers */ 1764 #ifdef CONFIG_OF 1765 struct device_node; 1766 void pci_set_of_node(struct pci_dev *dev); 1767 void pci_release_of_node(struct pci_dev *dev); 1768 void pci_set_bus_of_node(struct pci_bus *bus); 1769 void pci_release_bus_of_node(struct pci_bus *bus); 1770 1771 /* Arch may override this (weak) */ 1772 struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus); 1773 1774 static inline struct device_node * 1775 pci_device_to_OF_node(const struct pci_dev *pdev) 1776 { 1777 return pdev ? pdev->dev.of_node : NULL; 1778 } 1779 1780 static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) 1781 { 1782 return bus ? bus->dev.of_node : NULL; 1783 } 1784 1785 #else /* CONFIG_OF */ 1786 static inline void pci_set_of_node(struct pci_dev *dev) { } 1787 static inline void pci_release_of_node(struct pci_dev *dev) { } 1788 static inline void pci_set_bus_of_node(struct pci_bus *bus) { } 1789 static inline void pci_release_bus_of_node(struct pci_bus *bus) { } 1790 #endif /* CONFIG_OF */ 1791 1792 #ifdef CONFIG_EEH 1793 static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev) 1794 { 1795 return pdev->dev.archdata.edev; 1796 } 1797 #endif 1798 1799 /** 1800 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device 1801 * @pdev: the PCI device 1802 * 1803 * if the device is PCIE, return NULL 1804 * if the device isn't connected to a PCIe bridge (that is its parent is a 1805 * legacy PCI bridge and the bridge is directly connected to bus 0), return its 1806 * parent 1807 */ 1808 struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev); 1809 1810 #endif /* LINUX_PCI_H */
1 #ifndef __LINUX_SPINLOCK_H 2 #define __LINUX_SPINLOCK_H 3 4 /* 5 * include/linux/spinlock.h - generic spinlock/rwlock declarations 6 * 7 * here's the role of the various spinlock/rwlock related include files: 8 * 9 * on SMP builds: 10 * 11 * asm/spinlock_types.h: contains the arch_spinlock_t/arch_rwlock_t and the 12 * initializers 13 * 14 * linux/spinlock_types.h: 15 * defines the generic type and initializers 16 * 17 * asm/spinlock.h: contains the arch_spin_*()/etc. lowlevel 18 * implementations, mostly inline assembly code 19 * 20 * (also included on UP-debug builds:) 21 * 22 * linux/spinlock_api_smp.h: 23 * contains the prototypes for the _spin_*() APIs. 24 * 25 * linux/spinlock.h: builds the final spin_*() APIs. 26 * 27 * on UP builds: 28 * 29 * linux/spinlock_type_up.h: 30 * contains the generic, simplified UP spinlock type. 31 * (which is an empty structure on non-debug builds) 32 * 33 * linux/spinlock_types.h: 34 * defines the generic type and initializers 35 * 36 * linux/spinlock_up.h: 37 * contains the arch_spin_*()/etc. version of UP 38 * builds. (which are NOPs on non-debug, non-preempt 39 * builds) 40 * 41 * (included on UP-non-debug builds:) 42 * 43 * linux/spinlock_api_up.h: 44 * builds the _spin_*() APIs. 45 * 46 * linux/spinlock.h: builds the final spin_*() APIs. 47 */ 48 49 #include <linux/typecheck.h> 50 #include <linux/preempt.h> 51 #include <linux/linkage.h> 52 #include <linux/compiler.h> 53 #include <linux/irqflags.h> 54 #include <linux/thread_info.h> 55 #include <linux/kernel.h> 56 #include <linux/stringify.h> 57 #include <linux/bottom_half.h> 58 #include <asm/barrier.h> 59 60 61 /* 62 * Must define these before including other files, inline functions need them 63 */ 64 #define LOCK_SECTION_NAME ".text..lock."KBUILD_BASENAME 65 66 #define LOCK_SECTION_START(extra) \ 67 ".subsection 1\n\t" \ 68 extra \ 69 ".ifndef " LOCK_SECTION_NAME "\n\t" \ 70 LOCK_SECTION_NAME ":\n\t" \ 71 ".endif\n" 72 73 #define LOCK_SECTION_END \ 74 ".previous\n\t" 75 76 #define __lockfunc __attribute__((section(".spinlock.text"))) 77 78 /* 79 * Pull the arch_spinlock_t and arch_rwlock_t definitions: 80 */ 81 #include <linux/spinlock_types.h> 82 83 /* 84 * Pull the arch_spin*() functions/declarations (UP-nondebug doesn't need them): 85 */ 86 #ifdef CONFIG_SMP 87 # include <asm/spinlock.h> 88 #else 89 # include <linux/spinlock_up.h> 90 #endif 91 92 #ifdef CONFIG_DEBUG_SPINLOCK 93 extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name, 94 struct lock_class_key *key); 95 # define raw_spin_lock_init(lock) \ 96 do { \ 97 static struct lock_class_key __key; \ 98 \ 99 __raw_spin_lock_init((lock), #lock, &__key); \ 100 } while (0) 101 102 #else 103 # define raw_spin_lock_init(lock) \ 104 do { *(lock) = __RAW_SPIN_LOCK_UNLOCKED(lock); } while (0) 105 #endif 106 107 #define raw_spin_is_locked(lock) arch_spin_is_locked(&(lock)->raw_lock) 108 109 #ifdef CONFIG_GENERIC_LOCKBREAK 110 #define raw_spin_is_contended(lock) ((lock)->break_lock) 111 #else 112 113 #ifdef arch_spin_is_contended 114 #define raw_spin_is_contended(lock) arch_spin_is_contended(&(lock)->raw_lock) 115 #else 116 #define raw_spin_is_contended(lock) (((void)(lock), 0)) 117 #endif /*arch_spin_is_contended*/ 118 #endif 119 120 /* 121 * Despite its name it doesn't necessarily has to be a full barrier. 122 * It should only guarantee that a STORE before the critical section 123 * can not be reordered with a LOAD inside this section. 124 * spin_lock() is the one-way barrier, this LOAD can not escape out 125 * of the region. So the default implementation simply ensures that 126 * a STORE can not move into the critical section, smp_wmb() should 127 * serialize it with another STORE done by spin_lock(). 128 */ 129 #ifndef smp_mb__before_spinlock 130 #define smp_mb__before_spinlock() smp_wmb() 131 #endif 132 133 /* 134 * Place this after a lock-acquisition primitive to guarantee that 135 * an UNLOCK+LOCK pair act as a full barrier. This guarantee applies 136 * if the UNLOCK and LOCK are executed by the same CPU or if the 137 * UNLOCK and LOCK operate on the same lock variable. 138 */ 139 #ifndef smp_mb__after_unlock_lock 140 #define smp_mb__after_unlock_lock() do { } while (0) 141 #endif 142 143 /** 144 * raw_spin_unlock_wait - wait until the spinlock gets unlocked 145 * @lock: the spinlock in question. 146 */ 147 #define raw_spin_unlock_wait(lock) arch_spin_unlock_wait(&(lock)->raw_lock) 148 149 #ifdef CONFIG_DEBUG_SPINLOCK 150 extern void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock); 151 #define do_raw_spin_lock_flags(lock, flags) do_raw_spin_lock(lock) 152 extern int do_raw_spin_trylock(raw_spinlock_t *lock); 153 extern void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock); 154 #else 155 static inline void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock) 156 { 157 __acquire(lock); 158 arch_spin_lock(&lock->raw_lock); 159 } 160 161 static inline void 162 do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) __acquires(lock) 163 { 164 __acquire(lock); 165 arch_spin_lock_flags(&lock->raw_lock, *flags); 166 } 167 168 static inline int do_raw_spin_trylock(raw_spinlock_t *lock) 169 { 170 return arch_spin_trylock(&(lock)->raw_lock); 171 } 172 173 static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock) 174 { 175 arch_spin_unlock(&lock->raw_lock); 176 __release(lock); 177 } 178 #endif 179 180 /* 181 * Define the various spin_lock methods. Note we define these 182 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The 183 * various methods are defined as nops in the case they are not 184 * required. 185 */ 186 #define raw_spin_trylock(lock) __cond_lock(lock, _raw_spin_trylock(lock)) 187 188 #define raw_spin_lock(lock) _raw_spin_lock(lock) 189 190 #ifdef CONFIG_DEBUG_LOCK_ALLOC 191 # define raw_spin_lock_nested(lock, subclass) \ 192 _raw_spin_lock_nested(lock, subclass) 193 194 # define raw_spin_lock_nest_lock(lock, nest_lock) \ 195 do { \ 196 typecheck(struct lockdep_map *, &(nest_lock)->dep_map);\ 197 _raw_spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \ 198 } while (0) 199 #else 200 # define raw_spin_lock_nested(lock, subclass) _raw_spin_lock(lock) 201 # define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock) 202 #endif 203 204 #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 205 206 #define raw_spin_lock_irqsave(lock, flags) \ 207 do { \ 208 typecheck(unsigned long, flags); \ 209 flags = _raw_spin_lock_irqsave(lock); \ 210 } while (0) 211 212 #ifdef CONFIG_DEBUG_LOCK_ALLOC 213 #define raw_spin_lock_irqsave_nested(lock, flags, subclass) \ 214 do { \ 215 typecheck(unsigned long, flags); \ 216 flags = _raw_spin_lock_irqsave_nested(lock, subclass); \ 217 } while (0) 218 #else 219 #define raw_spin_lock_irqsave_nested(lock, flags, subclass) \ 220 do { \ 221 typecheck(unsigned long, flags); \ 222 flags = _raw_spin_lock_irqsave(lock); \ 223 } while (0) 224 #endif 225 226 #else 227 228 #define raw_spin_lock_irqsave(lock, flags) \ 229 do { \ 230 typecheck(unsigned long, flags); \ 231 _raw_spin_lock_irqsave(lock, flags); \ 232 } while (0) 233 234 #define raw_spin_lock_irqsave_nested(lock, flags, subclass) \ 235 raw_spin_lock_irqsave(lock, flags) 236 237 #endif 238 239 #define raw_spin_lock_irq(lock) _raw_spin_lock_irq(lock) 240 #define raw_spin_lock_bh(lock) _raw_spin_lock_bh(lock) 241 #define raw_spin_unlock(lock) _raw_spin_unlock(lock) 242 #define raw_spin_unlock_irq(lock) _raw_spin_unlock_irq(lock) 243 244 #define raw_spin_unlock_irqrestore(lock, flags) \ 245 do { \ 246 typecheck(unsigned long, flags); \ 247 _raw_spin_unlock_irqrestore(lock, flags); \ 248 } while (0) 249 #define raw_spin_unlock_bh(lock) _raw_spin_unlock_bh(lock) 250 251 #define raw_spin_trylock_bh(lock) \ 252 __cond_lock(lock, _raw_spin_trylock_bh(lock)) 253 254 #define raw_spin_trylock_irq(lock) \ 255 ({ \ 256 local_irq_disable(); \ 257 raw_spin_trylock(lock) ? \ 258 1 : ({ local_irq_enable(); 0; }); \ 259 }) 260 261 #define raw_spin_trylock_irqsave(lock, flags) \ 262 ({ \ 263 local_irq_save(flags); \ 264 raw_spin_trylock(lock) ? \ 265 1 : ({ local_irq_restore(flags); 0; }); \ 266 }) 267 268 /** 269 * raw_spin_can_lock - would raw_spin_trylock() succeed? 270 * @lock: the spinlock in question. 271 */ 272 #define raw_spin_can_lock(lock) (!raw_spin_is_locked(lock)) 273 274 /* Include rwlock functions */ 275 #include <linux/rwlock.h> 276 277 /* 278 * Pull the _spin_*()/_read_*()/_write_*() functions/declarations: 279 */ 280 #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 281 # include <linux/spinlock_api_smp.h> 282 #else 283 # include <linux/spinlock_api_up.h> 284 #endif 285 286 /* 287 * Map the spin_lock functions to the raw variants for PREEMPT_RT=n 288 */ 289 290 static inline raw_spinlock_t *spinlock_check(spinlock_t *lock) 291 { 292 return &lock->rlock; 293 } 294 295 #define spin_lock_init(_lock) \ 296 do { \ 297 spinlock_check(_lock); \ 298 raw_spin_lock_init(&(_lock)->rlock); \ 299 } while (0) 300 301 static inline void spin_lock(spinlock_t *lock) 302 { 303 raw_spin_lock(&lock->rlock); 304 } 305 306 static inline void spin_lock_bh(spinlock_t *lock) 307 { 308 raw_spin_lock_bh(&lock->rlock); 309 } 310 311 static inline int spin_trylock(spinlock_t *lock) 312 { 313 return raw_spin_trylock(&lock->rlock); 314 } 315 316 #define spin_lock_nested(lock, subclass) \ 317 do { \ 318 raw_spin_lock_nested(spinlock_check(lock), subclass); \ 319 } while (0) 320 321 #define spin_lock_nest_lock(lock, nest_lock) \ 322 do { \ 323 raw_spin_lock_nest_lock(spinlock_check(lock), nest_lock); \ 324 } while (0) 325 326 static inline void spin_lock_irq(spinlock_t *lock) 327 { 328 raw_spin_lock_irq(&lock->rlock); 329 } 330 331 #define spin_lock_irqsave(lock, flags) \ 332 do { \ 333 raw_spin_lock_irqsave(spinlock_check(lock), flags); \ 334 } while (0) 335 336 #define spin_lock_irqsave_nested(lock, flags, subclass) \ 337 do { \ 338 raw_spin_lock_irqsave_nested(spinlock_check(lock), flags, subclass); \ 339 } while (0) 340 341 static inline void spin_unlock(spinlock_t *lock) 342 { 343 raw_spin_unlock(&lock->rlock); 344 } 345 346 static inline void spin_unlock_bh(spinlock_t *lock) 347 { 348 raw_spin_unlock_bh(&lock->rlock); 349 } 350 351 static inline void spin_unlock_irq(spinlock_t *lock) 352 { 353 raw_spin_unlock_irq(&lock->rlock); 354 } 355 356 static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) 357 { 358 raw_spin_unlock_irqrestore(&lock->rlock, flags); 359 } 360 361 static inline int spin_trylock_bh(spinlock_t *lock) 362 { 363 return raw_spin_trylock_bh(&lock->rlock); 364 } 365 366 static inline int spin_trylock_irq(spinlock_t *lock) 367 { 368 return raw_spin_trylock_irq(&lock->rlock); 369 } 370 371 #define spin_trylock_irqsave(lock, flags) \ 372 ({ \ 373 raw_spin_trylock_irqsave(spinlock_check(lock), flags); \ 374 }) 375 376 static inline void spin_unlock_wait(spinlock_t *lock) 377 { 378 raw_spin_unlock_wait(&lock->rlock); 379 } 380 381 static inline int spin_is_locked(spinlock_t *lock) 382 { 383 return raw_spin_is_locked(&lock->rlock); 384 } 385 386 static inline int spin_is_contended(spinlock_t *lock) 387 { 388 return raw_spin_is_contended(&lock->rlock); 389 } 390 391 static inline int spin_can_lock(spinlock_t *lock) 392 { 393 return raw_spin_can_lock(&lock->rlock); 394 } 395 396 #define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock) 397 398 /* 399 * Pull the atomic_t declaration: 400 * (asm-mips/atomic.h needs above definitions) 401 */ 402 #include <linux/atomic.h> 403 /** 404 * atomic_dec_and_lock - lock on reaching reference count zero 405 * @atomic: the atomic counter 406 * @lock: the spinlock in question 407 * 408 * Decrements @atomic by 1. If the result is 0, returns true and locks 409 * @lock. Returns false for all other cases. 410 */ 411 extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); 412 #define atomic_dec_and_lock(atomic, lock) \ 413 __cond_lock(lock, _atomic_dec_and_lock(atomic, lock)) 414 415 #endif /* __LINUX_SPINLOCK_H */
1 #ifndef _LDV_RCV_H_ 2 #define _LDV_RCV_H_ 3 4 /* If expr evaluates to zero, ldv_assert() causes a program to reach the error 5 label like the standard assert(). */ 6 #define ldv_assert(expr) ((expr) ? 0 : ldv_error()) 7 8 /* The error label wrapper. It is used because of some static verifiers (like 9 BLAST) don't accept multiple error labels through a program. */ 10 static inline void ldv_error(void) 11 { 12 LDV_ERROR: goto LDV_ERROR; 13 } 14 15 /* If expr evaluates to zero, ldv_assume() causes an infinite loop that is 16 avoided by verifiers. */ 17 #define ldv_assume(expr) ((expr) ? 0 : ldv_stop()) 18 19 /* Infinite loop, that causes verifiers to skip such paths. */ 20 static inline void ldv_stop(void) { 21 LDV_STOP: goto LDV_STOP; 22 } 23 24 /* Special nondeterministic functions. */ 25 int ldv_undef_int(void); 26 void *ldv_undef_ptr(void); 27 unsigned long ldv_undef_ulong(void); 28 long ldv_undef_long(void); 29 /* Return nondeterministic negative integer number. */ 30 static inline int ldv_undef_int_negative(void) 31 { 32 int ret = ldv_undef_int(); 33 34 ldv_assume(ret < 0); 35 36 return ret; 37 } 38 /* Return nondeterministic nonpositive integer number. */ 39 static inline int ldv_undef_int_nonpositive(void) 40 { 41 int ret = ldv_undef_int(); 42 43 ldv_assume(ret <= 0); 44 45 return ret; 46 } 47 48 /* Add explicit model for __builin_expect GCC function. Without the model a 49 return value will be treated as nondetermined by verifiers. */ 50 static inline long __builtin_expect(long exp, long c) 51 { 52 return exp; 53 } 54 55 /* This function causes the program to exit abnormally. GCC implements this 56 function by using a target-dependent mechanism (such as intentionally executing 57 an illegal instruction) or by calling abort. The mechanism used may vary from 58 release to release so you should not rely on any particular implementation. 59 http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */ 60 static inline void __builtin_trap(void) 61 { 62 ldv_assert(0); 63 } 64 65 /* The constant is for simulating an error of ldv_undef_ptr() function. */ 66 #define LDV_PTR_MAX 2012 67 68 #endif /* _LDV_RCV_H_ */

Here is an explanation of a rule violation arisen while checking your driver against a corresponding kernel.

Note that it may be false positive, i.e. there isn't a real error indeed. Please analyze a given error trace and related source code to understand whether there is an error in your driver.

Error trace column contains a path on which the given rule is violated. You can expand/collapse some entity classes by clicking on corresponding checkboxes in a main menu or in an advanced Others menu. Also you can expand/collapse each particular entity by clicking on +/-. In hovering on some entities you can see some tips. Also the error trace is bound with related source code. Line numbers may be shown as links on the left. You can click on them to open corresponding lines in source code.

Source code column contains a content of files related with the error trace. There is source code of your driver (note that there are some LDV modifications at the end), kernel headers and rule model. Tabs show a currently opened file and other available files. In hovering on them you can see full file names. On clicking a corresponding file content will be shown.

Ядро Модуль Правило Верификатор Вердикт Статус Время создания Описание проблемы
linux-3.14.1.tar.xz drivers/net/wireless/ipw2x00/ipw2100.ko 331_1a CPAchecker Bug Fixed 2016-01-02 02:20:31 L0216

Комментарий

reported: 2 Jan 2016

[В начало]